From ab94aad28a906bc8c5ad1d4b3b626befb744b9f8 Mon Sep 17 00:00:00 2001 From: thecaptain789 Date: Thu, 5 Feb 2026 18:56:50 +0000 Subject: [PATCH] feat: add CancelProxy type for time-delayed proxy announcements This PR adds a new proxy type that enables users to delegate the ability to reject proxy announcements without granting other permissions. This is particularly useful for time-delayed proxies where: - Users want to be able to cancel pending announcements for security - They don't want to grant broader permissions to the delegate - The Cancel proxy can ONLY call from the proxy pallet Implements the feature request from issue #590. Changes: - Added CancelProxy variant to ProxyType enum - Added TryFrom/From implementations (value: 18) - Added InstanceFilter implementation allowing only reject_announcement calls --- common/src/lib.rs | 3 +++ runtime/src/lib.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/common/src/lib.rs b/common/src/lib.rs index 658f8b2e01..557fc3199e 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -160,6 +160,7 @@ pub enum ProxyType { SwapHotkey, SubnetLeaseBeneficiary, // Used to operate the leased subnet RootClaim, + CancelProxy, // Only allows rejecting proxy announcements for time-delayed proxies } impl TryFrom for ProxyType { @@ -185,6 +186,7 @@ impl TryFrom for ProxyType { 15 => Ok(Self::SwapHotkey), 16 => Ok(Self::SubnetLeaseBeneficiary), 17 => Ok(Self::RootClaim), + 18 => Ok(Self::CancelProxy), _ => Err(()), } } @@ -211,6 +213,7 @@ impl From for u8 { ProxyType::SwapHotkey => 15, ProxyType::SubnetLeaseBeneficiary => 16, ProxyType::RootClaim => 17, + ProxyType::CancelProxy => 18, } } } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 59784e6294..348d5d045f 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -751,6 +751,10 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::SubtensorModule(pallet_subtensor::Call::claim_root { .. }) ), + ProxyType::CancelProxy => matches!( + c, + RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) + ), } } fn is_superset(&self, o: &Self) -> bool {