diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index 75f12540d2fbbe3a0b93c34c18d7129b4dfc64ff..5a28e63f19bfd5b5a0c85a112298e1f936b9e47d 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -159,19 +159,25 @@ impl Contains<Call> for BaseCallFilter { )] #[allow(clippy::unnecessary_cast)] pub enum ProxyType { - Any = 0, + AlmostAny = 0, TransferOnly = 1, CancelProxy = 2, } impl Default for ProxyType { fn default() -> Self { - Self::Any + Self::AlmostAny } } impl frame_support::traits::InstanceFilter<Call> for ProxyType { fn filter(&self, c: &Call) -> bool { match self { - ProxyType::Any => true, + ProxyType::AlmostAny => { + // Some calls are never authorized from a proxied account + !matches!( + c, + Call::Cert(..) | Call::Identity(..) | Call::SmithsCert(..) + ) + } ProxyType::TransferOnly => { matches!(c, Call::Balances(..) | Call::UniversalDividend(..)) } diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index 6e574292b081d36d0168f46e35d1eb5c2b14bfef..f350f9f2b0868164b940b5f48ee8268778bee9c3 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -181,20 +181,26 @@ impl Contains<Call> for BaseCallFilter { )] #[allow(clippy::unnecessary_cast)] pub enum ProxyType { - Any = 0, + AlmostAny = 0, TransferOnly = 1, CancelProxy = 2, SmithsCollectivePropose = 3, } impl Default for ProxyType { fn default() -> Self { - Self::Any + Self::AlmostAny } } impl frame_support::traits::InstanceFilter<Call> for ProxyType { fn filter(&self, c: &Call) -> bool { match self { - ProxyType::Any => true, + ProxyType::AlmostAny => { + // Some calls are never authorized from a proxied account + !matches!( + c, + Call::Cert(..) | Call::Identity(..) | Call::SmithsCert(..) + ) + } ProxyType::TransferOnly => { matches!(c, Call::Balances(..) | Call::UniversalDividend(..)) } diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index 3cad420ec9bfc1b9b4bc293595aea4cdbb4eb35c..5c8c50df92cc07b4e21714dbe50a92155c564583 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -71,7 +71,7 @@ fn verify_pallet_indices() { #[test] fn verify_proxy_type_indices() { - assert_eq!(ProxyType::Any as u8, 0); + assert_eq!(ProxyType::AlmostAny as u8, 0); } #[test] diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index 43c84ab9e56583fb8ab570ce0ba5a68e4c8b8dbf..0c534e3a5b26c4fa7e8d62763621a1fec7afa3a7 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -160,19 +160,25 @@ impl Contains<Call> for BaseCallFilter { )] #[allow(clippy::unnecessary_cast)] pub enum ProxyType { - Any = 0, + AlmostAny = 0, TransferOnly = 1, CancelProxy = 2, } impl Default for ProxyType { fn default() -> Self { - Self::Any + Self::AlmostAny } } impl frame_support::traits::InstanceFilter<Call> for ProxyType { fn filter(&self, c: &Call) -> bool { match self { - ProxyType::Any => true, + ProxyType::AlmostAny => { + // Some calls are never authorized from a proxied account + !matches!( + c, + Call::Cert(..) | Call::Identity(..) | Call::SmithsCert(..) + ) + } ProxyType::TransferOnly => { matches!(c, Call::Balances(..) | Call::UniversalDividend(..)) }