diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 51665c2b28..8efb034016 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -364,6 +364,7 @@ pub(crate) mod runtime { ext } + #[cfg(feature = "runtime-benchmarks")] pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index b096f56a8f..ede4f0cfbf 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -506,6 +506,7 @@ pub(crate) mod runtime { ext } + #[cfg(feature = "runtime-benchmarks")] pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 37fb2dcf15..ef765550f8 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -496,8 +496,7 @@ impl ExtBuilder { ext } - // allowance only required for clippy, this function is actually used - #[allow(dead_code)] + #[cfg(feature = "runtime-benchmarks")] pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(None); diff --git a/pallets/pallet-did-lookup/src/mock.rs b/pallets/pallet-did-lookup/src/mock.rs index 568aec4af9..aa5628308a 100644 --- a/pallets/pallet-did-lookup/src/mock.rs +++ b/pallets/pallet-did-lookup/src/mock.rs @@ -158,7 +158,6 @@ impl ExtBuilder { ext } - // allowance only required for clippy, this function is actually used #[cfg(feature = "runtime-benchmarks")] pub fn build_with_keystore(self) -> sp_io::TestExternalities { let mut ext = self.build(); diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 46a8df87a2..9ab90f2132 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -753,11 +753,19 @@ impl pallet_randomness_collective_flip::Config for Runtime {} Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, )] pub enum ProxyType { + /// Allow for any call. Any, + /// Allow for calls that do not move tokens out of the caller's account. NonTransfer, + /// Allow for governance-related calls. Governance, + /// Allow for staking-related calls. ParachainStaking, + /// Allow for calls that cancel proxy information. CancelProxy, + /// Allow for calls that do not result in a deposit being claimed (e.g., for + /// attestations, delegations, or DIDs). + NonDepositClaiming, } impl Default for ProxyType { @@ -772,47 +780,132 @@ impl InstanceFilter for ProxyType { ProxyType::Any => true, ProxyType::NonTransfer => matches!( c, - Call::System(..) | - Call::Scheduler(..) | - Call::Timestamp(..) | - Call::Indices(pallet_indices::Call::claim{..}) | - Call::Indices(pallet_indices::Call::free{..}) | - Call::Indices(pallet_indices::Call::freeze{..}) | - // Specifically omitting Indices `transfer`, `force_transfer` - // Specifically omitting the entire Balances pallet - Call::Authorship(..) | - Call::Session(..) | - Call::Democracy(..) | - Call::Council(..) | - Call::TechnicalCommittee(..) | - Call::TechnicalMembership(..) | - Call::Treasury(..) | - Call::Vesting(pallet_vesting::Call::vest{..}) | - Call::Vesting(pallet_vesting::Call::vest_other{..}) | - // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` - Call::Utility(..) | - Call::ParachainStaking(..) + Call::Attestation(..) + | Call::Authorship(..) + // Excludes `Balances` + | Call::Council(..) | Call::Ctype(..) + | Call::Delegation(..) + | Call::Democracy(..) + | Call::Did(..) + | Call::DidLookup(..) + | Call::Indices( + // Excludes `force_transfer`, and `transfer` + pallet_indices::Call::claim { .. } + | pallet_indices::Call::free { .. } + | pallet_indices::Call::freeze { .. } + ) + // Excludes `KiltLaunch` + | Call::ParachainStaking(..) + // Excludes `ParachainSystem` + | Call::Preimage(..) + | Call::Proxy(..) + | Call::Scheduler(..) + | Call::Session(..) + // Excludes `Sudo` + | Call::System(..) + | Call::TechnicalCommittee(..) + | Call::TechnicalMembership(..) + | Call::Timestamp(..) + | Call::Treasury(..) + | Call::Utility(..) + | Call::Vesting( + // Excludes `force_vested_transfer`, `merge_schedules`, and `vested_transfer` + pallet_vesting::Call::vest { .. } + | pallet_vesting::Call::vest_other { .. } + ) + | Call::Web3Names(..), + ), + ProxyType::NonDepositClaiming => matches!( + c, + Call::Attestation( + // Excludes `reclaim_deposit` + attestation::Call::add { .. } + | attestation::Call::remove { .. } + | attestation::Call::revoke { .. } + ) + | Call::Authorship(..) + // Excludes `Balances` + | Call::Council(..) | Call::Ctype(..) + | Call::Delegation( + // Excludes `reclaim_deposit` + delegation::Call::add_delegation { .. } + | delegation::Call::create_hierarchy { .. } + | delegation::Call::remove_delegation { .. } + | delegation::Call::revoke_delegation { .. } + ) + | Call::Democracy(..) + | Call::Did( + // Excludes `reclaim_deposit` + did::Call::add_key_agreement_key { .. } + | did::Call::add_service_endpoint { .. } + | did::Call::create { .. } + | did::Call::delete { .. } + | did::Call::remove_attestation_key { .. } + | did::Call::remove_delegation_key { .. } + | did::Call::remove_key_agreement_key { .. } + | did::Call::remove_service_endpoint { .. } + | did::Call::set_attestation_key { .. } + | did::Call::set_authentication_key { .. } + | did::Call::set_delegation_key { .. } + | did::Call::submit_did_call { .. } + ) + | Call::DidLookup( + // Excludes `reclaim_deposit` + pallet_did_lookup::Call::associate_account { .. } + | pallet_did_lookup::Call::associate_sender { .. } + | pallet_did_lookup::Call::remove_account_association { .. } + | pallet_did_lookup::Call::remove_sender_association { .. } + ) + | Call::Indices(..) + // Excludes `KiltLaunch` + | Call::ParachainStaking(..) + // Excludes `ParachainSystem` + | Call::Preimage(..) + | Call::Proxy(..) + | Call::Scheduler(..) + | Call::Session(..) + // Excludes `Sudo` + | Call::System(..) + | Call::TechnicalCommittee(..) + | Call::TechnicalMembership(..) + | Call::Timestamp(..) + | Call::Treasury(..) + | Call::Utility(..) + | Call::Vesting(..) + | Call::Web3Names( + // Excludes `ban`, and `reclaim_deposit` + pallet_web3_names::Call::claim { .. } + | pallet_web3_names::Call::release_by_owner { .. } + | pallet_web3_names::Call::unban { .. } + ), ), ProxyType::Governance => matches!( c, - Call::Democracy(..) - | Call::Council(..) | Call::TechnicalCommittee(..) - | Call::Treasury(..) | Call::Utility(..) + Call::Council(..) + | Call::Democracy(..) + | Call::TechnicalCommittee(..) | Call::TechnicalMembership(..) + | Call::Treasury(..) | Call::Utility(..) ), ProxyType::ParachainStaking => { matches!(c, Call::ParachainStaking(..) | Call::Session(..) | Call::Utility(..)) } - ProxyType::CancelProxy => { - matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) - } + ProxyType::CancelProxy => matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })), } } fn is_superset(&self, o: &Self) -> bool { match (self, o) { (x, y) if x == y => true, + // "anything" always contains any subset (ProxyType::Any, _) => true, (_, ProxyType::Any) => false, + // reclaiming deposits is part of NonTransfer but not in NonDepositClaiming + (ProxyType::NonDepositClaiming, ProxyType::NonTransfer) => false, + // everything except NonTransfer and Any is part of NonDepositClaiming + (ProxyType::NonDepositClaiming, _) => true, + // Transfers are part of NonDepositClaiming but not in NonTransfer + (ProxyType::NonTransfer, ProxyType::NonDepositClaiming) => false, + // everything except NonDepositClaiming and Any is part of NonTransfer (ProxyType::NonTransfer, _) => true, _ => false, } diff --git a/runtimes/peregrine/src/weights/pallet_proxy.rs b/runtimes/peregrine/src/weights/pallet_proxy.rs index da9e315e49..d73c27170b 100644 --- a/runtimes/peregrine/src/weights/pallet_proxy.rs +++ b/runtimes/peregrine/src/weights/pallet_proxy.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for pallet_proxy //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-01-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 +//! DATE: 2022-03-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: // target/release/kilt-parachain @@ -49,40 +49,38 @@ pub struct WeightInfo(PhantomData); impl pallet_proxy::WeightInfo for WeightInfo { // Storage: Proxy Proxies (r:1 w:0) fn proxy(p: u32, ) -> Weight { - (22_218_000 as Weight) - // Standard Error: 2_000 - .saturating_add((145_000 as Weight).saturating_mul(p as Weight)) + (19_267_000 as Weight) + // Standard Error: 12_000 + .saturating_add((314_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:0) // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) fn proxy_announced(a: u32, p: u32, ) -> Weight { - (52_087_000 as Weight) - // Standard Error: 2_000 - .saturating_add((486_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 2_000 - .saturating_add((140_000 as Weight).saturating_mul(p as Weight)) + (43_254_000 as Weight) + // Standard Error: 12_000 + .saturating_add((461_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 14_000 + .saturating_add((86_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) fn remove_announcement(a: u32, _p: u32, ) -> Weight { - (35_943_000 as Weight) - // Standard Error: 1_000 - .saturating_add((491_000 as Weight).saturating_mul(a as Weight)) + (29_933_000 as Weight) + // Standard Error: 8_000 + .saturating_add((515_000 as Weight).saturating_mul(a as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) - fn reject_announcement(a: u32, p: u32, ) -> Weight { - (35_780_000 as Weight) - // Standard Error: 1_000 - .saturating_add((495_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 1_000 - .saturating_add((3_000 as Weight).saturating_mul(p as Weight)) + fn reject_announcement(a: u32, _p: u32, ) -> Weight { + (30_310_000 as Weight) + // Standard Error: 9_000 + .saturating_add((479_000 as Weight).saturating_mul(a as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -90,52 +88,52 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) fn announce(a: u32, p: u32, ) -> Weight { - (49_742_000 as Weight) - // Standard Error: 2_000 - .saturating_add((487_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 2_000 - .saturating_add((141_000 as Weight).saturating_mul(p as Weight)) + (41_024_000 as Weight) + // Standard Error: 9_000 + .saturating_add((445_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 10_000 + .saturating_add((51_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn add_proxy(p: u32, ) -> Weight { - (41_413_000 as Weight) - // Standard Error: 4_000 - .saturating_add((222_000 as Weight).saturating_mul(p as Weight)) + (33_452_000 as Weight) + // Standard Error: 21_000 + .saturating_add((360_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn remove_proxy(p: u32, ) -> Weight { - (33_997_000 as Weight) - // Standard Error: 3_000 - .saturating_add((239_000 as Weight).saturating_mul(p as Weight)) + (28_225_000 as Weight) + // Standard Error: 19_000 + .saturating_add((356_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn remove_proxies(p: u32, ) -> Weight { - (33_792_000 as Weight) - // Standard Error: 2_000 - .saturating_add((140_000 as Weight).saturating_mul(p as Weight)) + (28_040_000 as Weight) + // Standard Error: 19_000 + .saturating_add((232_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) // Storage: Proxy Proxies (r:1 w:1) fn anonymous(p: u32, ) -> Weight { - (47_634_000 as Weight) - // Standard Error: 3_000 - .saturating_add((33_000 as Weight).saturating_mul(p as Weight)) + (39_325_000 as Weight) + // Standard Error: 15_000 + .saturating_add((11_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn kill_anonymous(p: u32, ) -> Weight { - (35_811_000 as Weight) - // Standard Error: 3_000 - .saturating_add((140_000 as Weight).saturating_mul(p as Weight)) + (30_673_000 as Weight) + // Standard Error: 14_000 + .saturating_add((205_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 80ccf938fa..809210c68f 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -758,11 +758,19 @@ impl pallet_randomness_collective_flip::Config for Runtime {} Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, )] pub enum ProxyType { + /// Allow for any call. Any, + /// Allow for calls that do not move tokens out of the caller's account. NonTransfer, + /// Allow for governance-related calls. Governance, + /// Allow for staking-related calls. ParachainStaking, + /// Allow for calls that cancel proxy information. CancelProxy, + /// Allow for calls that do not result in a deposit being claimed (e.g., for + /// attestations, delegations, or DIDs). + NonDepositClaiming, } impl Default for ProxyType { @@ -777,47 +785,130 @@ impl InstanceFilter for ProxyType { ProxyType::Any => true, ProxyType::NonTransfer => matches!( c, - Call::System(..) | - Call::Scheduler(..) | - Call::Timestamp(..) | - Call::Indices(pallet_indices::Call::claim{..}) | - Call::Indices(pallet_indices::Call::free{..}) | - Call::Indices(pallet_indices::Call::freeze{..}) | - // Specifically omitting Indices `transfer`, `force_transfer` - // Specifically omitting the entire Balances pallet - Call::Authorship(..) | - Call::Session(..) | - Call::Democracy(..) | - Call::Council(..) | - Call::TechnicalCommittee(..) | - Call::TechnicalMembership(..) | - Call::Treasury(..) | - Call::Vesting(pallet_vesting::Call::vest{..}) | - Call::Vesting(pallet_vesting::Call::vest_other{..}) | - // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` - Call::Utility(..) | - Call::ParachainStaking(..) + Call::Attestation(..) + | Call::Authorship(..) + // Excludes `Balances` + | Call::Council(..) | Call::Ctype(..) + | Call::Delegation(..) + | Call::Democracy(..) + | Call::Did(..) + | Call::DidLookup(..) + | Call::Indices( + // Excludes `force_transfer`, and `transfer` + pallet_indices::Call::claim { .. } + | pallet_indices::Call::free { .. } + | pallet_indices::Call::freeze { .. } + ) + // Excludes `KiltLaunch` + | Call::ParachainStaking(..) + // Excludes `ParachainSystem` + | Call::Preimage(..) + | Call::Proxy(..) + | Call::Scheduler(..) + | Call::Session(..) + | Call::System(..) + | Call::TechnicalCommittee(..) + | Call::TechnicalMembership(..) + | Call::Timestamp(..) + | Call::Treasury(..) + | Call::Utility(..) + | Call::Vesting( + // Excludes `force_vested_transfer`, `merge_schedules`, and `vested_transfer` + pallet_vesting::Call::vest { .. } + | pallet_vesting::Call::vest_other { .. } + ) + | Call::Web3Names(..), + ), + ProxyType::NonDepositClaiming => matches!( + c, + Call::Attestation( + // Excludes `reclaim_deposit` + attestation::Call::add { .. } + | attestation::Call::remove { .. } + | attestation::Call::revoke { .. } + ) + | Call::Authorship(..) + // Excludes `Balances` + | Call::Council(..) | Call::Ctype(..) + | Call::Delegation( + // Excludes `reclaim_deposit` + delegation::Call::add_delegation { .. } + | delegation::Call::create_hierarchy { .. } + | delegation::Call::remove_delegation { .. } + | delegation::Call::revoke_delegation { .. } + ) + | Call::Democracy(..) + | Call::Did( + // Excludes `reclaim_deposit` + did::Call::add_key_agreement_key { .. } + | did::Call::add_service_endpoint { .. } + | did::Call::create { .. } + | did::Call::delete { .. } + | did::Call::remove_attestation_key { .. } + | did::Call::remove_delegation_key { .. } + | did::Call::remove_key_agreement_key { .. } + | did::Call::remove_service_endpoint { .. } + | did::Call::set_attestation_key { .. } + | did::Call::set_authentication_key { .. } + | did::Call::set_delegation_key { .. } + | did::Call::submit_did_call { .. } + ) + | Call::DidLookup( + // Excludes `reclaim_deposit` + pallet_did_lookup::Call::associate_account { .. } + | pallet_did_lookup::Call::associate_sender { .. } + | pallet_did_lookup::Call::remove_account_association { .. } + | pallet_did_lookup::Call::remove_sender_association { .. } + ) + | Call::Indices(..) + // Excludes `KiltLaunch` + | Call::ParachainStaking(..) + // Excludes `ParachainSystem` + | Call::Preimage(..) + | Call::Proxy(..) + | Call::Scheduler(..) + | Call::Session(..) + | Call::System(..) + | Call::TechnicalCommittee(..) + | Call::TechnicalMembership(..) + | Call::Timestamp(..) + | Call::Treasury(..) + | Call::Utility(..) + | Call::Vesting(..) + | Call::Web3Names( + // Excludes `ban`, and `reclaim_deposit` + pallet_web3_names::Call::claim { .. } + | pallet_web3_names::Call::release_by_owner { .. } + | pallet_web3_names::Call::unban { .. } + ), ), ProxyType::Governance => matches!( c, - Call::Democracy(..) - | Call::Council(..) | Call::TechnicalCommittee(..) - | Call::Treasury(..) | Call::Utility(..) + Call::Council(..) + | Call::Democracy(..) + | Call::TechnicalCommittee(..) | Call::TechnicalMembership(..) + | Call::Treasury(..) | Call::Utility(..) ), ProxyType::ParachainStaking => { matches!(c, Call::ParachainStaking(..) | Call::Session(..) | Call::Utility(..)) } - ProxyType::CancelProxy => { - matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) - } + ProxyType::CancelProxy => matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })), } } fn is_superset(&self, o: &Self) -> bool { match (self, o) { (x, y) if x == y => true, + // "anything" always contains any subset (ProxyType::Any, _) => true, (_, ProxyType::Any) => false, + // reclaiming deposits is part of NonTransfer but not in NonDepositClaiming + (ProxyType::NonDepositClaiming, ProxyType::NonTransfer) => false, + // everything except NonTransfer and Any is part of NonDepositClaiming + (ProxyType::NonDepositClaiming, _) => true, + // Transfers are part of NonDepositClaiming but not in NonTransfer + (ProxyType::NonTransfer, ProxyType::NonDepositClaiming) => false, + // everything except NonDepositClaiming and Any is part of NonTransfer (ProxyType::NonTransfer, _) => true, _ => false, } diff --git a/runtimes/spiritnet/src/weights/pallet_proxy.rs b/runtimes/spiritnet/src/weights/pallet_proxy.rs index a8e6b1c9a7..762a7ff703 100644 --- a/runtimes/spiritnet/src/weights/pallet_proxy.rs +++ b/runtimes/spiritnet/src/weights/pallet_proxy.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for pallet_proxy //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-01-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 128 +//! DATE: 2022-03-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 1024 // Executed Command: // target/release/kilt-parachain @@ -49,42 +49,40 @@ pub struct WeightInfo(PhantomData); impl pallet_proxy::WeightInfo for WeightInfo { // Storage: Proxy Proxies (r:1 w:0) fn proxy(p: u32, ) -> Weight { - (21_095_000 as Weight) - // Standard Error: 2_000 - .saturating_add((151_000 as Weight).saturating_mul(p as Weight)) + (19_721_000 as Weight) + // Standard Error: 14_000 + .saturating_add((162_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:0) // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) fn proxy_announced(a: u32, p: u32, ) -> Weight { - (49_348_000 as Weight) - // Standard Error: 2_000 - .saturating_add((495_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 2_000 - .saturating_add((149_000 as Weight).saturating_mul(p as Weight)) + (42_425_000 as Weight) + // Standard Error: 16_000 + .saturating_add((496_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 18_000 + .saturating_add((155_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) - fn remove_announcement(a: u32, p: u32, ) -> Weight { - (34_130_000 as Weight) - // Standard Error: 2_000 - .saturating_add((498_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 2_000 - .saturating_add((7_000 as Weight).saturating_mul(p as Weight)) + fn remove_announcement(a: u32, _p: u32, ) -> Weight { + (29_958_000 as Weight) + // Standard Error: 11_000 + .saturating_add((499_000 as Weight).saturating_mul(a as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) fn reject_announcement(a: u32, p: u32, ) -> Weight { - (33_599_000 as Weight) - // Standard Error: 4_000 - .saturating_add((507_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 4_000 - .saturating_add((20_000 as Weight).saturating_mul(p as Weight)) + (29_568_000 as Weight) + // Standard Error: 12_000 + .saturating_add((513_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 14_000 + .saturating_add((11_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -92,52 +90,50 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Storage: Proxy Announcements (r:1 w:1) // Storage: System Account (r:1 w:1) fn announce(a: u32, p: u32, ) -> Weight { - (46_734_000 as Weight) - // Standard Error: 2_000 - .saturating_add((494_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 2_000 - .saturating_add((156_000 as Weight).saturating_mul(p as Weight)) + (39_486_000 as Weight) + // Standard Error: 14_000 + .saturating_add((560_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 16_000 + .saturating_add((229_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn add_proxy(p: u32, ) -> Weight { - (39_046_000 as Weight) - // Standard Error: 3_000 - .saturating_add((225_000 as Weight).saturating_mul(p as Weight)) + (34_522_000 as Weight) + // Standard Error: 17_000 + .saturating_add((249_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn remove_proxy(p: u32, ) -> Weight { - (32_338_000 as Weight) - // Standard Error: 3_000 - .saturating_add((245_000 as Weight).saturating_mul(p as Weight)) + (29_057_000 as Weight) + // Standard Error: 17_000 + .saturating_add((240_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn remove_proxies(p: u32, ) -> Weight { - (32_023_000 as Weight) - // Standard Error: 2_000 - .saturating_add((146_000 as Weight).saturating_mul(p as Weight)) + (28_744_000 as Weight) + // Standard Error: 19_000 + .saturating_add((184_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) // Storage: Proxy Proxies (r:1 w:1) - fn anonymous(p: u32, ) -> Weight { - (45_233_000 as Weight) - // Standard Error: 3_000 - .saturating_add((35_000 as Weight).saturating_mul(p as Weight)) + fn anonymous(_p: u32, ) -> Weight { + (40_665_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Proxy Proxies (r:1 w:1) fn kill_anonymous(p: u32, ) -> Weight { - (33_859_000 as Weight) - // Standard Error: 2_000 - .saturating_add((159_000 as Weight).saturating_mul(p as Weight)) + (31_118_000 as Weight) + // Standard Error: 14_000 + .saturating_add((213_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index 2e05c60cdb..7d24e645cd 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -524,13 +524,15 @@ impl pallet_randomness_collective_flip::Config for Runtime {} Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, )] pub enum ProxyType { + /// Allow for any call. Any, + /// Allow for calls that do not move tokens out of the caller's account. NonTransfer, + /// Allow for staking-related calls. CancelProxy, - Ctype, - Attestation, - Delegation, - Did, + /// Allow for calls that do not result in a deposit being claimed (e.g., for + /// attestations, delegations, or DIDs). + NonDepositClaiming, } impl Default for ProxyType { @@ -545,34 +547,97 @@ impl InstanceFilter for ProxyType { ProxyType::Any => true, ProxyType::NonTransfer => matches!( c, - Call::System(..) | - Call::Timestamp(..) | - Call::Indices(pallet_indices::Call::claim{..}) | - Call::Indices(pallet_indices::Call::free{..}) | - Call::Indices(pallet_indices::Call::freeze{..}) | - // Specifically omitting Indices `transfer`, `force_transfer` - // Specifically omitting the entire Balances pallet - Call::Authorship(..) | - Call::Session(..) | - Call::Vesting(pallet_vesting::Call::vest{..}) | - Call::Vesting(pallet_vesting::Call::vest_other{..}) | - // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` - Call::Utility(..) + Call::Attestation(..) + | Call::Authorship(..) + // Excludes `Balances` + | Call::Ctype(..) + | Call::Delegation(..) + | Call::Did(..) + | Call::DidLookup(..) + | Call::Indices( + // Excludes `force_transfer`, and `transfer` + pallet_indices::Call::claim { .. } + | pallet_indices::Call::free { .. } + | pallet_indices::Call::freeze { .. } + ) + | Call::Proxy(..) + | Call::Session(..) + // Excludes `Sudo` + | Call::System(..) + | Call::Timestamp(..) + | Call::Utility(..) + | Call::Web3Names(..), ), - ProxyType::Ctype => matches!(c, Call::Ctype(..)), - ProxyType::Delegation => matches!(c, Call::Delegation(..)), - ProxyType::Attestation => matches!(c, Call::Attestation(..)), - ProxyType::Did => matches!(c, Call::Did(..)), - ProxyType::CancelProxy => { - matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) - } + ProxyType::NonDepositClaiming => matches!( + c, + Call::Attestation( + // Excludes `reclaim_deposit` + attestation::Call::add { .. } + | attestation::Call::remove { .. } + | attestation::Call::revoke { .. } + ) + | Call::Authorship(..) + // Excludes `Balances` + | Call::Ctype(..) + | Call::Delegation( + // Excludes `reclaim_deposit` + delegation::Call::add_delegation { .. } + | delegation::Call::create_hierarchy { .. } + | delegation::Call::remove_delegation { .. } + | delegation::Call::revoke_delegation { .. } + ) + | Call::Did( + // Excludes `reclaim_deposit` + did::Call::add_key_agreement_key { .. } + | did::Call::add_service_endpoint { .. } + | did::Call::create { .. } + | did::Call::delete { .. } + | did::Call::remove_attestation_key { .. } + | did::Call::remove_delegation_key { .. } + | did::Call::remove_key_agreement_key { .. } + | did::Call::remove_service_endpoint { .. } + | did::Call::set_attestation_key { .. } + | did::Call::set_authentication_key { .. } + | did::Call::set_delegation_key { .. } + | did::Call::submit_did_call { .. } + ) + | Call::DidLookup( + // Excludes `reclaim_deposit` + pallet_did_lookup::Call::associate_account { .. } + | pallet_did_lookup::Call::associate_sender { .. } + | pallet_did_lookup::Call::remove_account_association { .. } + | pallet_did_lookup::Call::remove_sender_association { .. } + ) + | Call::Indices(..) + | Call::Proxy(..) + | Call::Session(..) + // Excludes `Sudo` + | Call::System(..) + | Call::Timestamp(..) + | Call::Utility(..) + | Call::Web3Names( + // Excludes `ban`, and `reclaim_deposit` + pallet_web3_names::Call::claim { .. } + | pallet_web3_names::Call::release_by_owner { .. } + | pallet_web3_names::Call::unban { .. } + ), + ), + ProxyType::CancelProxy => matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })), } } fn is_superset(&self, o: &Self) -> bool { match (self, o) { (x, y) if x == y => true, + // "anything" always contains any subset (ProxyType::Any, _) => true, (_, ProxyType::Any) => false, + // reclaiming deposits is part of NonTransfer but not in NonDepositClaiming + (ProxyType::NonDepositClaiming, ProxyType::NonTransfer) => false, + // everything except NonTransfer and Any is part of NonDepositClaiming + (ProxyType::NonDepositClaiming, _) => true, + // Transfers are part of NonDepositClaiming but not in NonTransfer + (ProxyType::NonTransfer, ProxyType::NonDepositClaiming) => false, + // everything except NonDepositClaiming and Any is part of NonTransfer (ProxyType::NonTransfer, _) => true, _ => false, }