From 31f7879a1d9200fa01e3dcd21f6701a1cc34dbee Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Fri, 1 Nov 2024 17:11:30 +0200 Subject: [PATCH 01/21] make docs for LocalOriginToLocation uniform across codebase --- .../assets/asset-hub-rococo/src/xcm_config.rs | 4 ++-- .../assets/asset-hub-westend/src/xcm_config.rs | 3 ++- .../bridge-hubs/bridge-hub-rococo/src/xcm_config.rs | 4 ++-- .../bridge-hubs/bridge-hub-westend/src/xcm_config.rs | 4 ++-- .../collectives-westend/src/xcm_config.rs | 4 ++-- .../contracts/contracts-rococo/src/xcm_config.rs | 4 ++-- .../runtimes/testing/penpal/src/xcm_config.rs | 3 ++- .../runtimes/testing/rococo-parachain/src/lib.rs | 3 ++- polkadot/runtime/westend/src/xcm_config.rs | 3 ++- .../relay_token_transactor/parachain/xcm_config.rs | 2 ++ .../relay_token_transactor/relay_chain/xcm_config.rs | 2 ++ polkadot/xcm/pallet-xcm/src/lib.rs | 12 ++++++++++++ polkadot/xcm/pallet-xcm/src/mock.rs | 2 ++ .../src/asset_exchange/single_asset_adapter/mock.rs | 2 ++ polkadot/xcm/xcm-builder/src/tests/pay/mock.rs | 2 ++ polkadot/xcm/xcm-builder/tests/mock/mod.rs | 2 ++ polkadot/xcm/xcm-runtime-apis/tests/mock.rs | 2 ++ .../parachain/runtime/src/configs/xcm_config.rs | 3 ++- 18 files changed, 46 insertions(+), 15 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index 56310959aa80..3f075cb1b36f 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -448,8 +448,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = PolkadotXcm; } -/// Converts a local signed origin into an XCM location. -/// Forms the basis for local origins sending/executing XCMs. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; pub type PriceForParentDelivery = diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index f16dbcc02519..b8f64da0228c 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -470,7 +470,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = PolkadotXcm; } -/// Local origins on this chain are allowed to dispatch XCM sends/executions. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; pub type PriceForParentDelivery = diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index 2fb186703a88..d66c5e5acccb 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -237,8 +237,8 @@ impl xcm_executor::Config for XcmConfig { pub type PriceForParentDelivery = ExponentialPrice; -/// Converts a local signed origin into an XCM location. -/// Forms the basis for local origins sending/executing XCMs. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; /// The means for routing XCM messages which are not for local execution into the right message diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/xcm_config.rs index ae31ca4cedf2..edd62bb68c1c 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/xcm_config.rs @@ -231,8 +231,8 @@ impl xcm_executor::Config for XcmConfig { pub type PriceForParentDelivery = ExponentialPrice; -/// Converts a local signed origin into an XCM location. -/// Forms the basis for local origins sending/executing XCMs. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; /// The means for routing XCM messages which are not for local execution into the right message diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/xcm_config.rs index f8e03303c32e..d7f75ba47e04 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/xcm_config.rs @@ -235,8 +235,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = PolkadotXcm; } -/// Converts a local signed origin into an XCM location. -/// Forms the basis for local origins sending/executing XCMs. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; pub type PriceForParentDelivery = diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs index 39fdd30a0498..5aa0f15b6f18 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs @@ -208,8 +208,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = PolkadotXcm; } -/// Converts a local signed origin into an XCM location. -/// Forms the basis for local origins sending/executing XCMs. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; pub type PriceForParentDelivery = diff --git a/cumulus/parachains/runtimes/testing/penpal/src/xcm_config.rs b/cumulus/parachains/runtimes/testing/penpal/src/xcm_config.rs index b72d6d232a1d..71004bce11bb 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/xcm_config.rs @@ -415,7 +415,8 @@ pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger = ForeignAssetsInstance, >; -/// No local origins on this chain are allowed to dispatch XCM sends/executions. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; pub type PriceForParentDelivery = diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 095f571974f0..e7f1e7145847 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -498,7 +498,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = PolkadotXcm; } -/// Local origins on this chain are allowed to dispatch XCM sends/executions. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; /// The means for routing XCM messages which are not for local execution into the right message diff --git a/polkadot/runtime/westend/src/xcm_config.rs b/polkadot/runtime/westend/src/xcm_config.rs index d75083929a04..fd615095f4b9 100644 --- a/polkadot/runtime/westend/src/xcm_config.rs +++ b/polkadot/runtime/westend/src/xcm_config.rs @@ -239,7 +239,8 @@ parameter_types! { pub type GeneralAdminToPlurality = OriginToPluralityVoice; -/// location of this chain. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = ( GeneralAdminToPlurality, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 diff --git a/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/xcm_config.rs b/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/xcm_config.rs index f8a1826b8ab1..d2d5da1f040a 100644 --- a/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/xcm_config.rs +++ b/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/xcm_config.rs @@ -146,6 +146,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = (); } +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { diff --git a/polkadot/xcm/docs/src/cookbook/relay_token_transactor/relay_chain/xcm_config.rs b/polkadot/xcm/docs/src/cookbook/relay_token_transactor/relay_chain/xcm_config.rs index e7b602df7338..ebb068b064a7 100644 --- a/polkadot/xcm/docs/src/cookbook/relay_token_transactor/relay_chain/xcm_config.rs +++ b/polkadot/xcm/docs/src/cookbook/relay_token_transactor/relay_chain/xcm_config.rs @@ -119,6 +119,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = (); } +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 9b8f735b478f..37cc7df81b11 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -3429,6 +3429,18 @@ where } } +/// Filter for `(origin: Location, target: Location)` to find whether `target` has explicitly +/// authorized `origin` to alias it. +/// +/// TODO: how to authorize?. +pub struct AuthorizedAliases; +impl ContainsPair for AuthorizedAliases { + fn contains(origin: &Location, target: &Location) -> bool { + // TODO: use storage + return false + } +} + /// Filter for `Location` to find those which represent a strict majority approval of an /// identified plurality. /// diff --git a/polkadot/xcm/pallet-xcm/src/mock.rs b/polkadot/xcm/pallet-xcm/src/mock.rs index 8d0476b0e70d..604f1e100e21 100644 --- a/polkadot/xcm/pallet-xcm/src/mock.rs +++ b/polkadot/xcm/pallet-xcm/src/mock.rs @@ -518,6 +518,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = XcmPallet; } +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; parameter_types! { diff --git a/polkadot/xcm/xcm-builder/src/asset_exchange/single_asset_adapter/mock.rs b/polkadot/xcm/xcm-builder/src/asset_exchange/single_asset_adapter/mock.rs index e6fe8e45c265..2f0287c3c2b7 100644 --- a/polkadot/xcm/xcm-builder/src/asset_exchange/single_asset_adapter/mock.rs +++ b/polkadot/xcm/xcm-builder/src/asset_exchange/single_asset_adapter/mock.rs @@ -290,6 +290,8 @@ parameter_types! { pub const NoNetwork: Option = None; } +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountIndex64; impl pallet_xcm::Config for Runtime { diff --git a/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs b/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs index 26ea226313f0..e4771a185cf7 100644 --- a/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs +++ b/polkadot/xcm/xcm-builder/src/tests/pay/mock.rs @@ -160,6 +160,8 @@ impl MaybeEquivalence } } +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; pub type LocalAssetsTransactor = FungiblesAdapter< Assets, diff --git a/polkadot/xcm/xcm-builder/tests/mock/mod.rs b/polkadot/xcm/xcm-builder/tests/mock/mod.rs index 0468b0a5410c..2a0148d409c5 100644 --- a/polkadot/xcm/xcm-builder/tests/mock/mod.rs +++ b/polkadot/xcm/xcm-builder/tests/mock/mod.rs @@ -197,6 +197,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = XcmPallet; } +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { diff --git a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs index 4a5de8875007..c3ff778b4dc8 100644 --- a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs +++ b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs @@ -332,6 +332,8 @@ where } } +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountIndex64; impl pallet_xcm::Config for TestRuntime { diff --git a/templates/parachain/runtime/src/configs/xcm_config.rs b/templates/parachain/runtime/src/configs/xcm_config.rs index 3da3b711f4ff..09e8e3bfef1b 100644 --- a/templates/parachain/runtime/src/configs/xcm_config.rs +++ b/templates/parachain/runtime/src/configs/xcm_config.rs @@ -150,7 +150,8 @@ impl xcm_executor::Config for XcmConfig { type XcmRecorder = PolkadotXcm; } -/// No local origins on this chain are allowed to dispatch XCM sends/executions. +/// Converts a local signed origin into an XCM location. Forms the basis for local origins +/// sending/executing XCMs. pub type LocalOriginToLocation = SignedToAccountId32; /// The means for routing XCM messages which are not for local execution into the right message From 7a0af10404bc876de5d61d62ee9ea42f2336a62e Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Fri, 1 Nov 2024 18:36:56 +0200 Subject: [PATCH 02/21] pallet-xcm: add support for authorizing aliases --- polkadot/xcm/pallet-xcm/src/lib.rs | 82 ++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 5 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 37cc7df81b11..d4392fb51456 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -97,6 +97,8 @@ pub trait WeightInfo { fn new_query() -> Weight; fn take_response() -> Weight; fn claim_assets() -> Weight; + fn add_authorized_alias() -> Weight; + fn remove_authorized_alias() -> Weight; } /// fallback implementation @@ -181,6 +183,14 @@ impl WeightInfo for TestWeightInfo { fn claim_assets() -> Weight { Weight::from_parts(100_000_000, 0) } + + fn add_authorized_alias() -> Weight { + Weight::from_parts(100_000, 0) + } + + fn remove_authorized_alias() -> Weight { + Weight::from_parts(100_000, 0) + } } #[frame_support::pallet] @@ -199,6 +209,9 @@ pub mod pallet { /// An implementation of `Get` which just returns the latest XCM version which we can /// support. pub const CurrentXcmVersion: u32 = XCM_VERSION; + + /// The maximum number of distinct locations allowed as authorized aliases for a local origin. + pub const MaxAuthorizedAliases: u32 = 10; } const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); @@ -574,6 +587,9 @@ pub mod pallet { /// Local XCM execution incomplete. #[codec(index = 24)] LocalExecutionIncomplete, + /// Too many locations authorized to alias origin. + #[codec(index = 25)] + TooManyAuthorizedAliases, } impl From for Error { @@ -793,6 +809,17 @@ pub mod pallet { #[pallet::storage] pub(crate) type RecordedXcm = StorageValue<_, Xcm<()>>; + /// Map of authorized aliasers of local origins. Each local location can authorize a list of + /// other locations to alias into it. + #[pallet::storage] + pub(super) type AuthorizedAliases = StorageMap< + _, + Blake2_128Concat, + Location, + BoundedVec, + ValueQuery, + >; + #[pallet::genesis_config] pub struct GenesisConfig { #[serde(skip)] @@ -1425,6 +1452,51 @@ pub mod pallet { weight_limit, ) } + + /// Authorize another `aliaser` location to alias into the local `origin` making this call. + /// + /// Usually useful to allow your local account to be aliased into from a remote location + /// also under your control (like your account on another chain). + /// + /// WARNING: make sure the caller `origin` (you) trusts the `aliaser` location to act in + /// their/your name. Once authorized using this call, the `aliaser` can freely impersonate + /// `origin` in XCM programs executed on the local chain. + #[pallet::call_index(14)] + pub fn add_authorized_alias( + origin: OriginFor, + aliaser: Box, + ) -> DispatchResult { + let origin = T::ExecuteXcmOrigin::ensure_origin(origin)?; + let aliaser = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; + ensure!(origin != aliaser, Error::::BadLocation); + let mut authorized_aliases = AuthorizedAliases::::get(&origin); + if !authorized_aliases.contains(&aliaser) { + authorized_aliases + .try_push(aliaser) + .map_err(|_| Error::::TooManyAuthorizedAliases)?; + AuthorizedAliases::::insert(&origin, authorized_aliases); + } + Ok(()) + } + + /// Remove a previously authorized `aliaser` from the list of locations that can alias into + /// the local `origin` making this call. + #[pallet::call_index(15)] + pub fn remove_authorized_alias( + origin: OriginFor, + aliaser: Box, + ) -> DispatchResult { + let origin = T::ExecuteXcmOrigin::ensure_origin(origin)?; + let to_remove = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; + ensure!(origin != to_remove, Error::::BadLocation); + let mut authorized_aliases = AuthorizedAliases::::get(&origin); + let original_length = authorized_aliases.len(); + authorized_aliases.retain(|alias| to_remove.ne(alias)); + if original_length != authorized_aliases.len() { + AuthorizedAliases::::insert(&origin, authorized_aliases); + } + Ok(()) + } } } @@ -3432,12 +3504,12 @@ where /// Filter for `(origin: Location, target: Location)` to find whether `target` has explicitly /// authorized `origin` to alias it. /// -/// TODO: how to authorize?. -pub struct AuthorizedAliases; -impl ContainsPair for AuthorizedAliases { +/// Note: users can authorize other locations to alias them by using +/// `pallet_xcm::add_authorized_alias()`. +pub struct AuthorizedAliases(PhantomData); +impl ContainsPair for AuthorizedAliases { fn contains(origin: &Location, target: &Location) -> bool { - // TODO: use storage - return false + pallet::AuthorizedAliases::::get(&origin).contains(target) } } From 879d48b4666b4b394a90b43155ad16a878eeb9db Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Wed, 6 Nov 2024 16:41:18 +0200 Subject: [PATCH 03/21] add stub weights --- .../asset-hub-rococo/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../asset-hub-westend/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../bridge-hub-rococo/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../bridge-hub-westend/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../collectives-westend/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../coretime-rococo/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../coretime-westend/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../people/people-rococo/src/weights/pallet_xcm.rs | 14 ++++++++++++++ .../people-westend/src/weights/pallet_xcm.rs | 14 ++++++++++++++ polkadot/runtime/rococo/src/weights/pallet_xcm.rs | 14 ++++++++++++++ polkadot/runtime/westend/src/weights/pallet_xcm.rs | 14 ++++++++++++++ 11 files changed, 154 insertions(+) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs index 51b6543bae82..ab4dd9af31ad 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs index be3d7661ab3c..0c0c08077dab 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs index a732e1a57343..c01243ef1c5b 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs index a78ff2355efa..76846397c7d2 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs index 5d427d850046..58b773939de6 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs index 7fb492173dad..d5ec7614a5c2 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs index fa588e982f09..0b3fc7ae23ed 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs index fabce29b5fd9..d6e370eebe89 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs index c337289243b7..e50b2b70daae 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) diff --git a/polkadot/runtime/rococo/src/weights/pallet_xcm.rs b/polkadot/runtime/rococo/src/weights/pallet_xcm.rs index d5cf33515e6b..3e7d29e973c4 100644 --- a/polkadot/runtime/rococo/src/weights/pallet_xcm.rs +++ b/polkadot/runtime/rococo/src/weights/pallet_xcm.rs @@ -50,6 +50,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) diff --git a/polkadot/runtime/westend/src/weights/pallet_xcm.rs b/polkadot/runtime/westend/src/weights/pallet_xcm.rs index 10725cecf249..aac57102613d 100644 --- a/polkadot/runtime/westend/src/weights/pallet_xcm.rs +++ b/polkadot/runtime/westend/src/weights/pallet_xcm.rs @@ -48,6 +48,20 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + fn add_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn remove_authorized_alias() -> Weight { + // TODO: benchmark + Weight::from_parts(3_724_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) From 9103e27deab28e974870a60921543cf8f389e5f3 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Wed, 6 Nov 2024 16:41:51 +0200 Subject: [PATCH 04/21] add benchmark code --- polkadot/xcm/pallet-xcm/src/benchmarking.rs | 30 +++++++++++++++++++++ polkadot/xcm/pallet-xcm/src/lib.rs | 12 ++++----- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index 404b9358d4d9..093129a4bde7 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -385,6 +385,36 @@ benchmarks! { let versioned_assets = VersionedAssets::V4(asset.into()); }: _>(claim_origin.into(), Box::new(versioned_assets), Box::new(VersionedLocation::V4(claim_location))) + add_authorized_alias { + let origin = RawOrigin::Root; + let origin_location = T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap(); + let mut existing_aliases = BoundedVec::::new(); + // prepopulate list with `max-1` aliases to benchmark worst case + for i in 1..MaxAuthorizedAliases::get() { + let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]); + existing_aliases.try_push(alias).unwrap() + } + AuthorizedAliasesMap::::insert(&origin_location, existing_aliases); + // now benchmark adding new alias + let aliaser: VersionedLocation = + Location::new(1, [Parachain(1234), AccountId32 { network: None, id: [42_u8; 32] }]).into(); + }: _(origin, Box::new(aliaser)) + + remove_authorized_alias { + let origin = RawOrigin::Root; + let origin_location = T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap(); + let mut existing_aliases = BoundedVec::::new(); + // prepopulate list with `max` aliases to benchmark worst case + for i in 1..MaxAuthorizedAliases::get()+1 { + let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]); + existing_aliases.try_push(alias).unwrap() + } + AuthorizedAliasesMap::::insert(&origin_location, existing_aliases); + // now benchmark adding new alias + let aliaser_to_remove: VersionedLocation = + Location::new(1, [Parachain(1), AccountId32 { network: None, id: [42_u8; 32] }]).into(); + }: _(origin, Box::new(aliaser_to_remove)) + impl_benchmark_test_suite!( Pallet, crate::mock::new_test_ext_with_balances(Vec::new()), diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index d4392fb51456..27880893c584 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -812,7 +812,7 @@ pub mod pallet { /// Map of authorized aliasers of local origins. Each local location can authorize a list of /// other locations to alias into it. #[pallet::storage] - pub(super) type AuthorizedAliases = StorageMap< + pub(super) type AuthorizedAliasesMap = StorageMap< _, Blake2_128Concat, Location, @@ -1469,12 +1469,12 @@ pub mod pallet { let origin = T::ExecuteXcmOrigin::ensure_origin(origin)?; let aliaser = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; ensure!(origin != aliaser, Error::::BadLocation); - let mut authorized_aliases = AuthorizedAliases::::get(&origin); + let mut authorized_aliases = AuthorizedAliasesMap::::get(&origin); if !authorized_aliases.contains(&aliaser) { authorized_aliases .try_push(aliaser) .map_err(|_| Error::::TooManyAuthorizedAliases)?; - AuthorizedAliases::::insert(&origin, authorized_aliases); + AuthorizedAliasesMap::::insert(&origin, authorized_aliases); } Ok(()) } @@ -1489,11 +1489,11 @@ pub mod pallet { let origin = T::ExecuteXcmOrigin::ensure_origin(origin)?; let to_remove = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; ensure!(origin != to_remove, Error::::BadLocation); - let mut authorized_aliases = AuthorizedAliases::::get(&origin); + let mut authorized_aliases = AuthorizedAliasesMap::::get(&origin); let original_length = authorized_aliases.len(); authorized_aliases.retain(|alias| to_remove.ne(alias)); if original_length != authorized_aliases.len() { - AuthorizedAliases::::insert(&origin, authorized_aliases); + AuthorizedAliasesMap::::insert(&origin, authorized_aliases); } Ok(()) } @@ -3509,7 +3509,7 @@ where pub struct AuthorizedAliases(PhantomData); impl ContainsPair for AuthorizedAliases { fn contains(origin: &Location, target: &Location) -> bool { - pallet::AuthorizedAliases::::get(&origin).contains(target) + AuthorizedAliasesMap::::get(&origin).contains(target) } } From c29fc5dd910c416b8bdbf00cf68f3f35f0cd8e6c Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Wed, 6 Nov 2024 18:31:15 +0200 Subject: [PATCH 05/21] add migration for authorized aliases --- polkadot/xcm/pallet-xcm/src/benchmarking.rs | 14 ++-- polkadot/xcm/pallet-xcm/src/lib.rs | 45 +++++++----- polkadot/xcm/pallet-xcm/src/migration.rs | 76 +++++++++++++++++++++ 3 files changed, 113 insertions(+), 22 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index 093129a4bde7..227bf58d2fd9 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -387,11 +387,12 @@ benchmarks! { add_authorized_alias { let origin = RawOrigin::Root; - let origin_location = T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap(); - let mut existing_aliases = BoundedVec::::new(); + let origin_location: VersionedLocation = + T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap().into(); + let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max-1` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get() { - let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]); + let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]).into(); existing_aliases.try_push(alias).unwrap() } AuthorizedAliasesMap::::insert(&origin_location, existing_aliases); @@ -402,11 +403,12 @@ benchmarks! { remove_authorized_alias { let origin = RawOrigin::Root; - let origin_location = T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap(); - let mut existing_aliases = BoundedVec::::new(); + let origin_location: VersionedLocation = + T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap().into(); + let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get()+1 { - let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]); + let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]).into(); existing_aliases.try_push(alias).unwrap() } AuthorizedAliasesMap::::insert(&origin_location, existing_aliases); diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 27880893c584..18a8cf0174f7 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -815,8 +815,8 @@ pub mod pallet { pub(super) type AuthorizedAliasesMap = StorageMap< _, Blake2_128Concat, - Location, - BoundedVec, + VersionedLocation, + BoundedVec, ValueQuery, >; @@ -1466,15 +1466,17 @@ pub mod pallet { origin: OriginFor, aliaser: Box, ) -> DispatchResult { - let origin = T::ExecuteXcmOrigin::ensure_origin(origin)?; - let aliaser = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; + let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; + let aliaser: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; ensure!(origin != aliaser, Error::::BadLocation); - let mut authorized_aliases = AuthorizedAliasesMap::::get(&origin); - if !authorized_aliases.contains(&aliaser) { + let v_origin = VersionedLocation::from(origin); + let v_aliaser = VersionedLocation::from(aliaser); + let mut authorized_aliases = AuthorizedAliasesMap::::get(&v_origin); + if !authorized_aliases.contains(&v_aliaser) { authorized_aliases - .try_push(aliaser) + .try_push(v_aliaser) .map_err(|_| Error::::TooManyAuthorizedAliases)?; - AuthorizedAliasesMap::::insert(&origin, authorized_aliases); + AuthorizedAliasesMap::::insert(&v_origin, authorized_aliases); } Ok(()) } @@ -1486,14 +1488,16 @@ pub mod pallet { origin: OriginFor, aliaser: Box, ) -> DispatchResult { - let origin = T::ExecuteXcmOrigin::ensure_origin(origin)?; - let to_remove = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; + let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; + let to_remove: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; ensure!(origin != to_remove, Error::::BadLocation); - let mut authorized_aliases = AuthorizedAliasesMap::::get(&origin); + let v_origin = VersionedLocation::from(origin); + let v_to_remove = VersionedLocation::from(to_remove); + let mut authorized_aliases = AuthorizedAliasesMap::::get(&v_origin); let original_length = authorized_aliases.len(); - authorized_aliases.retain(|alias| to_remove.ne(alias)); + authorized_aliases.retain(|alias| v_to_remove.ne(alias)); if original_length != authorized_aliases.len() { - AuthorizedAliasesMap::::insert(&origin, authorized_aliases); + AuthorizedAliasesMap::::insert(&v_origin, authorized_aliases); } Ok(()) } @@ -3507,11 +3511,20 @@ where /// Note: users can authorize other locations to alias them by using /// `pallet_xcm::add_authorized_alias()`. pub struct AuthorizedAliases(PhantomData); -impl ContainsPair for AuthorizedAliases { - fn contains(origin: &Location, target: &Location) -> bool { - AuthorizedAliasesMap::::get(&origin).contains(target) +impl + Clone, T: Config> ContainsPair for AuthorizedAliases { + fn contains(origin: &L, target: &L) -> bool { + let origin: VersionedLocation = origin.clone().into(); + let target: VersionedLocation = target.clone().into(); + AuthorizedAliasesMap::::get(&origin).contains(&target) } } +// pub struct AuthorizedAliases(PhantomData); +// impl ContainsPair for AuthorizedAliases { +// fn contains(origin: &Location, target: &Location) -> bool { +// let target = VersionedLocation::from(target.clone()); +// AuthorizedAliasesMap::::get(&origin).contains(&target) +// } +// } /// Filter for `Location` to find those which represent a strict majority approval of an /// identified plurality. diff --git a/polkadot/xcm/pallet-xcm/src/migration.rs b/polkadot/xcm/pallet-xcm/src/migration.rs index 80154f57ddfb..64b35bd8566d 100644 --- a/polkadot/xcm/pallet-xcm/src/migration.rs +++ b/polkadot/xcm/pallet-xcm/src/migration.rs @@ -170,6 +170,49 @@ pub mod data { } } + /// Implementation of `NeedsMigration` for `AuthorizedAliasesMap` data. + impl> NeedsMigration for (&VersionedLocation, &BoundedVec) { + type MigratedData = (VersionedLocation, BoundedVec); + + fn needs_migration(&self, _: XcmVersion) -> bool { + self.0.identify_version() < XCM_VERSION || + self.1.iter().any(|alias| alias.identify_version() < XCM_VERSION) + } + + fn try_migrate(self, new_version: XcmVersion) -> Result, ()> { + if !self.needs_migration(new_version) { + return Ok(None) + } + + let key = if self.0.identify_version() < new_version { + let Ok(converted_key) = self.0.clone().into_version(new_version) else { + return Err(()) + }; + converted_key + } else { + self.0.clone() + }; + let mut aliases = BoundedVec::::new(); + for alias in self.1 { + if aliases + .try_push(if alias.identify_version() < new_version { + let Ok(new_alias) = alias.clone().into_version(new_version) else { + return Err(()) + }; + new_alias + } else { + alias.clone() + }) + .is_err() + { + return Err(()) + }; + } + + Ok(Some((key, aliases))) + } + } + impl Pallet { /// Migrates relevant data to the `required_xcm_version`. pub(crate) fn migrate_data_to_xcm_version( @@ -323,6 +366,39 @@ pub mod data { >(&old_key, &new_key); weight.saturating_add(T::DbWeight::get().writes(1)); } + + // check and migrate `AuthorizedAliasesMap` + let aliases_to_migrate = AuthorizedAliasesMap::::iter().filter_map(|(id, data)| { + weight.saturating_add(T::DbWeight::get().reads(1)); + match (&id, &data).try_migrate(required_xcm_version) { + Ok(Some((new_id, new_data))) => Some((id, new_id, new_data)), + Ok(None) => None, + Err(_) => { + tracing::error!( + target: LOG_TARGET, + ?id, + ?data, + ?required_xcm_version, + "`AuthorizedAliasesMap` cannot be migrated!" + ); + None + }, + } + }); + let mut count = 0; + for (old_id, new_id, new_data) in aliases_to_migrate { + tracing::info!( + target: LOG_TARGET, + ?new_id, + ?new_data, + "Migrating `AuthorizedAliasesMap`" + ); + AuthorizedAliasesMap::::remove(old_id); + AuthorizedAliasesMap::::insert(new_id, new_data); + count = count + 1; + } + // two writes per key, one to remove old entry, one to write new entry + weight.saturating_add(T::DbWeight::get().writes(count * 2)); } } } From e84293fc5f53d106d2788f4e7457216c746b7d03 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Wed, 6 Nov 2024 19:30:34 +0200 Subject: [PATCH 06/21] fix pallet-xcm authorized aliases --- polkadot/xcm/pallet-xcm/src/lib.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 18a8cf0174f7..bbe094c8cb63 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -1468,6 +1468,7 @@ pub mod pallet { ) -> DispatchResult { let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; let aliaser: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; + tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?aliaser); ensure!(origin != aliaser, Error::::BadLocation); let v_origin = VersionedLocation::from(origin); let v_aliaser = VersionedLocation::from(aliaser); @@ -1490,6 +1491,7 @@ pub mod pallet { ) -> DispatchResult { let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; let to_remove: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; + tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?to_remove); ensure!(origin != to_remove, Error::::BadLocation); let v_origin = VersionedLocation::from(origin); let v_to_remove = VersionedLocation::from(to_remove); @@ -3515,16 +3517,10 @@ impl + Clone, T: Config> ContainsPair for Autho fn contains(origin: &L, target: &L) -> bool { let origin: VersionedLocation = origin.clone().into(); let target: VersionedLocation = target.clone().into(); - AuthorizedAliasesMap::::get(&origin).contains(&target) + tracing::trace!(target: "xcm::pallet_xcm::AuthorizedAliases::contains", ?origin, ?target); + AuthorizedAliasesMap::::get(&target).contains(&origin) } } -// pub struct AuthorizedAliases(PhantomData); -// impl ContainsPair for AuthorizedAliases { -// fn contains(origin: &Location, target: &Location) -> bool { -// let target = VersionedLocation::from(target.clone()); -// AuthorizedAliasesMap::::get(&origin).contains(&target) -// } -// } /// Filter for `Location` to find those which represent a strict majority approval of an /// identified plurality. From 0332aca754ed4c8b5636feb069edff62d815f389 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Wed, 6 Nov 2024 19:30:58 +0200 Subject: [PATCH 07/21] asset hub westend: add support for authorized aliases --- .../asset-hub-westend/src/xcm_config.rs | 6 +- .../assets/asset-hub-westend/tests/tests.rs | 92 +++++++++++++++++++ 2 files changed, 95 insertions(+), 3 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index b8f64da0228c..82ce96ea03af 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -28,11 +28,11 @@ use frame_support::{ parameter_types, traits::{ tokens::imbalance::{ResolveAssetTo, ResolveTo}, - ConstU32, Contains, Equals, Everything, Nothing, PalletInfoAccess, + ConstU32, Contains, Equals, Everything, PalletInfoAccess, }, }; use frame_system::EnsureRoot; -use pallet_xcm::XcmPassthrough; +use pallet_xcm::{AuthorizedAliases, XcmPassthrough}; use parachains_common::{ xcm_config::{ AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, @@ -462,7 +462,7 @@ impl xcm_executor::Config for XcmConfig { (bridging::to_rococo::UniversalAliases, bridging::to_ethereum::UniversalAliases); type CallDispatcher = RuntimeCall; type SafeCallFilter = Everything; - type Aliasers = Nothing; + type Aliasers = AuthorizedAliases; type TransactionalProcessor = FrameTransactionalProcessor; type HrmpNewChannelOpenRequestHandler = (); type HrmpChannelAcceptedHandler = (); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index 6a48b19ce946..9ddc0cfa5f07 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -43,6 +43,7 @@ use frame_support::{ fungibles::{ Create, Inspect as FungiblesInspect, InspectEnumerable, Mutate as FungiblesMutate, }, + ContainsPair, }, weights::{Weight, WeightToFee as WeightToFeeT}, }; @@ -133,6 +134,7 @@ fn setup_pool_for_paying_fees_with_foreign_assets( #[test] fn test_buy_and_refund_weight_in_native() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -191,6 +193,7 @@ fn test_buy_and_refund_weight_in_native() { #[test] fn test_buy_and_refund_weight_with_swap_local_asset_xcm_trader() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -300,6 +303,7 @@ fn test_buy_and_refund_weight_with_swap_local_asset_xcm_trader() { #[test] fn test_buy_and_refund_weight_with_swap_foreign_asset_xcm_trader() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -410,6 +414,7 @@ fn test_buy_and_refund_weight_with_swap_foreign_asset_xcm_trader() { #[test] fn test_asset_xcm_take_first_trader() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -488,6 +493,7 @@ fn test_asset_xcm_take_first_trader() { #[test] fn test_foreign_asset_xcm_take_first_trader() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -569,6 +575,7 @@ fn test_foreign_asset_xcm_take_first_trader() { #[test] fn test_asset_xcm_take_first_trader_with_refund() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -648,6 +655,7 @@ fn test_asset_xcm_take_first_trader_with_refund() { #[test] fn test_asset_xcm_take_first_trader_refund_not_possible_since_amount_less_than_ed() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -700,6 +708,7 @@ fn test_asset_xcm_take_first_trader_refund_not_possible_since_amount_less_than_e #[test] fn test_that_buying_ed_refund_does_not_refund_for_take_first_trader() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -764,6 +773,7 @@ fn test_that_buying_ed_refund_does_not_refund_for_take_first_trader() { #[test] fn test_asset_xcm_take_first_trader_not_possible_for_non_sufficient_assets() { ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -825,6 +835,7 @@ fn test_assets_balances_api_works() { use assets_common::runtime_api::runtime_decl_for_fungibles_api::FungiblesApi; ExtBuilder::::default() + .with_tracing() .with_collators(vec![AccountId::from(ALICE)]) .with_session_keys(vec![( AccountId::from(ALICE), @@ -939,6 +950,87 @@ fn test_assets_balances_api_works() { }); } +#[test] +fn authorized_aliases_work() { + ExtBuilder::::default() + .with_tracing() + .with_collators(vec![AccountId::from(ALICE)]) + .with_session_keys(vec![( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, + )]) + .build() + .execute_with(|| { + let alice: AccountId = ALICE.into(); + let local_alice = Location::new(0, AccountId32 { network: Some(Westend), id: ALICE }); + let alice_on_sibling_para = + Location::new(1, [Parachain(42), AccountId32 { network: None, id: ALICE }]); + let alice_on_relay = Location::new(1, AccountId32 { network: None, id: ALICE }); + let bob_on_relay = Location::new(1, AccountId32 { network: None, id: [42_u8; 32] }); + + // neither `alice_on_sibling_para`, `alice_on_relay`, `bob_on_relay` are allowed to + // alias into `local_alice` + for aliaser in [&alice_on_sibling_para, &alice_on_relay, &bob_on_relay] { + assert!(!::Aliasers::contains( + aliaser, + &local_alice + )); + } + + // Alice explicitly authorizes `alice_on_sibling_para` to alias her local account + assert_ok!(PolkadotXcm::add_authorized_alias( + RuntimeHelper::origin_of(alice.clone()), + Box::new(alice_on_sibling_para.clone().into()) + )); + + // `alice_on_sibling_para` now explicitly allowed to alias into `local_alice` + assert!(::Aliasers::contains( + &alice_on_sibling_para, + &local_alice + )); + // as expected, `alice_on_relay` and `bob_on_relay` still can't alias into `local_alice` + for aliaser in [&alice_on_relay, &bob_on_relay] { + assert!(!::Aliasers::contains( + aliaser, + &local_alice + )); + } + + // Alice explicitly authorizes `alice_on_relay` to alias her local account + assert_ok!(PolkadotXcm::add_authorized_alias( + RuntimeHelper::origin_of(alice.clone()), + Box::new(alice_on_relay.clone().into()) + )); + // Now both `alice_on_relay` and `alice_on_sibling_para` can alias into her local + // account + for aliaser in [&alice_on_relay, &alice_on_sibling_para] { + assert!(::Aliasers::contains( + aliaser, + &local_alice + )); + } + + // Alice removes authorization for `alice_on_relay` to alias her local account + assert_ok!(PolkadotXcm::remove_authorized_alias( + RuntimeHelper::origin_of(alice.clone()), + Box::new(alice_on_relay.clone().into()) + )); + + // `alice_on_relay` no longer allowed to alias into `local_alice` + assert!(!::Aliasers::contains( + &alice_on_relay, + &local_alice + )); + + // `alice_on_sibling_para` still allowed to alias into `local_alice` + assert!(::Aliasers::contains( + &alice_on_sibling_para, + &local_alice + )); + }) +} + asset_test_utils::include_teleports_for_native_asset_works!( Runtime, AllPalletsWithoutSystem, From 4611498b3159c20c7429c455f1877b50da6469af Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Thu, 7 Nov 2024 13:30:41 +0200 Subject: [PATCH 08/21] address comments and fix tests after rebase --- .../runtimes/assets/asset-hub-westend/tests/tests.rs | 7 +++++-- polkadot/xcm/pallet-xcm/src/benchmarking.rs | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index 9438f317ce74..23bec5016832 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -55,7 +55,7 @@ use std::{convert::Into, ops::Mul}; use testnet_parachains_constants::westend::{consensus::*, currency::UNITS, fee::WeightToFee}; use xcm::latest::{ prelude::{Assets as XcmAssets, *}, - ROCOCO_GENESIS_HASH, + ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH, }; use xcm_builder::WithLatestLocationConverter; use xcm_executor::traits::{ConvertLocation, JustTry, WeightTrader}; @@ -966,7 +966,10 @@ fn authorized_aliases_work() { .build() .execute_with(|| { let alice: AccountId = ALICE.into(); - let local_alice = Location::new(0, AccountId32 { network: Some(Westend), id: ALICE }); + let local_alice = Location::new( + 0, + AccountId32 { network: Some(ByGenesis(WESTEND_GENESIS_HASH)), id: ALICE }, + ); let alice_on_sibling_para = Location::new(1, [Parachain(42), AccountId32 { network: None, id: ALICE }]); let alice_on_relay = Location::new(1, AccountId32 { network: None, id: ALICE }); diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index d5672addf6ea..e858edf29d29 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -387,8 +387,8 @@ benchmarks! { add_authorized_alias { let origin = RawOrigin::Root; - let origin_location: VersionedLocation = - T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap().into(); + let origin_location: VersionedLocation = T::ExecuteXcmOrigin::try_origin(origin.clone().into()) + .map_err(|_| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?.into(); let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max-1` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get() { @@ -403,8 +403,8 @@ benchmarks! { remove_authorized_alias { let origin = RawOrigin::Root; - let origin_location: VersionedLocation = - T::ExecuteXcmOrigin::ensure_origin(origin.clone().into()).unwrap().into(); + let origin_location: VersionedLocation = T::ExecuteXcmOrigin::try_origin(origin.clone().into()) + .map_err(|_| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?.into(); let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get()+1 { From 709cf3ef39c43b5d0fbaff25b41cecf3fd071374 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Thu, 7 Nov 2024 13:58:56 +0200 Subject: [PATCH 09/21] add prdoc --- prdoc/pr_6336.prdoc | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 prdoc/pr_6336.prdoc diff --git a/prdoc/pr_6336.prdoc b/prdoc/pr_6336.prdoc new file mode 100644 index 000000000000..dec27cf18f22 --- /dev/null +++ b/prdoc/pr_6336.prdoc @@ -0,0 +1,58 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: "pallet-xcm: add support to authorize aliases" + +doc: + - audience: Runtime User + description: | + Added new `add_authorized_alias()` and `remove_authorized_alias()` calls to `pallet-xcm`. + These can be used by a "caller" to explicitly authorize another location to alias into the "caller" origin. + Usually useful to allow one's local account to be aliased into from a remote location also under + one's control (one's account on another chain). + WARNING: make sure that you as the caller `origin` trust the `aliaser` location to act in your name on this + chain. Once authorized using this call, the `aliaser` can freely impersonate `origin` in XCM programs + executed on the local chain. + + - audience: Runtime Dev + description: | + Added `AuthorizedAliases` type exposed by `pallet-xcm`, that acts as a filter for explicitly authorized + aliases using `pallet-xcm::add_authorized_alias()` and `pallet-xcm::remove_authorized_alias()`. + Runtime developers can simply plug this `pallet-xcm::AuthorizedAliases` type in their runtime's `XcmConfig`, + specifically in `::Aliasers`. + +crates: + - name: pallet-xcm + bump: minor + - name: staging-xcm-builder + bump: none + - name: xcm-runtime-apis + bump: none + - name: westend-runtime + bump: none + - name: rococo-runtime + bump: none + - name: asset-hub-rococo-runtime + bump: none + - name: asset-hub-westend-runtime + bump: none + - name: bridge-hub-rococo-runtime + bump: none + - name: bridge-hub-westend-runtime + bump: none + - name: collectives-westend-runtime + bump: none + - name: coretime-rococo-runtime + bump: none + - name: coretime-westend-runtime + bump: none + - name: people-rococo-runtime + bump: none + - name: people-westend-runtime + bump: none + - name: penpal-runtime + bump: none + - name: contracts-rococo-runtime + bump: none + - name: rococo-parachain-runtime + bump: none From 35b4859464c4d3d241edd2a41e9a47975db65129 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Thu, 7 Nov 2024 12:44:26 +0000 Subject: [PATCH 10/21] ".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=westend --target_dir=polkadot --pallet=pallet_xcm --- .../westend/src/weights/xcm/pallet_xcm.rs | 363 ++++++++++++++++++ 1 file changed, 363 insertions(+) create mode 100644 polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs diff --git a/polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs b/polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs new file mode 100644 index 000000000000..0e770a88c069 --- /dev/null +++ b/polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs @@ -0,0 +1,363 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=westend-dev +// --header=./polkadot/file_header.txt +// --template=./polkadot/xcm/pallet-xcm-benchmarks/template.hbs +// --output=./polkadot/runtime/westend/src/weights/xcm/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn send() -> Weight { + // Proof Size summary in bytes: + // Measured: `147` + // Estimated: `3612` + // Minimum execution time: 30_777_000 picoseconds. + Weight::from_parts(31_746_000, 3612) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn teleport_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `250` + // Estimated: `6196` + // Minimum execution time: 130_855_000 picoseconds. + Weight::from_parts(135_315_000, 6196) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn reserve_transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `302` + // Estimated: `6196` + // Minimum execution time: 128_185_000 picoseconds. + Weight::from_parts(132_459_000, 6196) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `250` + // Estimated: `6196` + // Minimum execution time: 132_603_000 picoseconds. + Weight::from_parts(135_485_000, 6196) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub(crate) fn execute() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 9_227_000 picoseconds. + Weight::from_parts(9_554_000, 1485) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `XcmPallet::SupportedVersion` (r:0 w:1) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn force_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_033_000 picoseconds. + Weight::from_parts(8_269_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + pub(crate) fn force_default_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_445_000, 0) + } + /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) + /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) + /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::Queries` (r:0 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn force_subscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `147` + // Estimated: `3612` + // Minimum execution time: 36_912_000 picoseconds. + Weight::from_parts(38_677_000, 3612) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) + /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::Queries` (r:0 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn force_unsubscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `327` + // Estimated: `3792` + // Minimum execution time: 46_175_000 picoseconds. + Weight::from_parts(47_850_000, 3792) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `XcmPallet::XcmExecutionSuspended` (r:0 w:1) + /// Proof: `XcmPallet::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub(crate) fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_464_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::SupportedVersion` (r:6 w:2) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_supported_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `22` + // Estimated: `15862` + // Minimum execution time: 22_130_000 picoseconds. + Weight::from_parts(22_492_000, 15862) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::VersionNotifiers` (r:6 w:2) + /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_version_notifiers() -> Weight { + // Proof Size summary in bytes: + // Measured: `26` + // Estimated: `15866` + // Minimum execution time: 22_043_000 picoseconds. + Weight::from_parts(22_750_000, 15866) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:7 w:0) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn already_notified_target() -> Weight { + // Proof Size summary in bytes: + // Measured: `40` + // Estimated: `18355` + // Minimum execution time: 25_046_000 picoseconds. + Weight::from_parts(25_660_000, 18355) + .saturating_add(T::DbWeight::get().reads(7)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:2 w:1) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn notify_current_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `183` + // Estimated: `6123` + // Minimum execution time: 36_029_000 picoseconds. + Weight::from_parts(37_313_000, 6123) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:5 w:0) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn notify_target_migration_fail() -> Weight { + // Proof Size summary in bytes: + // Measured: `40` + // Estimated: `13405` + // Minimum execution time: 17_295_000 picoseconds. + Weight::from_parts(17_961_000, 13405) + .saturating_add(T::DbWeight::get().reads(5)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_version_notify_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `33` + // Estimated: `15873` + // Minimum execution time: 21_606_000 picoseconds. + Weight::from_parts(21_939_000, 15873) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_and_notify_old_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `183` + // Estimated: `16023` + // Minimum execution time: 49_623_000 picoseconds. + Weight::from_parts(50_940_000, 16023) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) + /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::Queries` (r:0 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn new_query() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 2_662_000 picoseconds. + Weight::from_parts(2_832_000, 1485) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::Queries` (r:1 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn take_response() -> Weight { + // Proof Size summary in bytes: + // Measured: `7576` + // Estimated: `11041` + // Minimum execution time: 26_358_000 picoseconds. + Weight::from_parts(26_871_000, 11041) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::AssetTraps` (r:1 w:1) + /// Proof: `XcmPallet::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn claim_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `23` + // Estimated: `3488` + // Minimum execution time: 39_745_000 picoseconds. + Weight::from_parts(40_188_000, 3488) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn add_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `361` + // Estimated: `3826` + // Minimum execution time: 15_726_000 picoseconds. + Weight::from_parts(16_154_000, 3826) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn remove_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `400` + // Estimated: `3865` + // Minimum execution time: 17_404_000 picoseconds. + Weight::from_parts(17_718_000, 3865) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} From 79bfce2bdd5a726c6651cc55c71d066805e6d01d Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Thu, 7 Nov 2024 12:44:34 +0000 Subject: [PATCH 11/21] ".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=rococo --target_dir=polkadot --pallet=pallet_xcm --- .../rococo/src/weights/xcm/pallet_xcm.rs | 363 ++++++++++++++++++ 1 file changed, 363 insertions(+) create mode 100644 polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs diff --git a/polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs b/polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs new file mode 100644 index 000000000000..4309c155ca9a --- /dev/null +++ b/polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs @@ -0,0 +1,363 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=rococo-dev +// --header=./polkadot/file_header.txt +// --template=./polkadot/xcm/pallet-xcm-benchmarks/template.hbs +// --output=./polkadot/runtime/rococo/src/weights/xcm/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn send() -> Weight { + // Proof Size summary in bytes: + // Measured: `180` + // Estimated: `3645` + // Minimum execution time: 30_643_000 picoseconds. + Weight::from_parts(31_782_000, 3645) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn teleport_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `180` + // Estimated: `3645` + // Minimum execution time: 130_791_000 picoseconds. + Weight::from_parts(134_979_000, 3645) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn reserve_transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `232` + // Estimated: `3697` + // Minimum execution time: 129_933_000 picoseconds. + Weight::from_parts(134_918_000, 3697) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `180` + // Estimated: `3645` + // Minimum execution time: 130_466_000 picoseconds. + Weight::from_parts(135_449_000, 3645) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub(crate) fn execute() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 9_620_000 picoseconds. + Weight::from_parts(10_073_000, 1485) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `XcmPallet::SupportedVersion` (r:0 w:1) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn force_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_386_000 picoseconds. + Weight::from_parts(8_727_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + pub(crate) fn force_default_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_481_000 picoseconds. + Weight::from_parts(2_653_000, 0) + } + /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) + /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) + /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::Queries` (r:0 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn force_subscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `180` + // Estimated: `3645` + // Minimum execution time: 37_250_000 picoseconds. + Weight::from_parts(38_353_000, 3645) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) + /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::Queries` (r:0 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn force_unsubscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `360` + // Estimated: `3825` + // Minimum execution time: 46_257_000 picoseconds. + Weight::from_parts(47_915_000, 3825) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `XcmPallet::XcmExecutionSuspended` (r:0 w:1) + /// Proof: `XcmPallet::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub(crate) fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_530_000 picoseconds. + Weight::from_parts(2_619_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::SupportedVersion` (r:6 w:2) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_supported_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `22` + // Estimated: `15862` + // Minimum execution time: 21_851_000 picoseconds. + Weight::from_parts(22_104_000, 15862) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::VersionNotifiers` (r:6 w:2) + /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_version_notifiers() -> Weight { + // Proof Size summary in bytes: + // Measured: `26` + // Estimated: `15866` + // Minimum execution time: 22_063_000 picoseconds. + Weight::from_parts(22_386_000, 15866) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:7 w:0) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn already_notified_target() -> Weight { + // Proof Size summary in bytes: + // Measured: `40` + // Estimated: `18355` + // Minimum execution time: 25_210_000 picoseconds. + Weight::from_parts(25_527_000, 18355) + .saturating_add(T::DbWeight::get().reads(7)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:2 w:1) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn notify_current_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `216` + // Estimated: `6156` + // Minimum execution time: 36_418_000 picoseconds. + Weight::from_parts(37_557_000, 6156) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:5 w:0) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn notify_target_migration_fail() -> Weight { + // Proof Size summary in bytes: + // Measured: `40` + // Estimated: `13405` + // Minimum execution time: 17_617_000 picoseconds. + Weight::from_parts(17_794_000, 13405) + .saturating_add(T::DbWeight::get().reads(5)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_version_notify_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `33` + // Estimated: `15873` + // Minimum execution time: 22_091_000 picoseconds. + Weight::from_parts(22_394_000, 15873) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) + /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn migrate_and_notify_old_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `216` + // Estimated: `16056` + // Minimum execution time: 49_581_000 picoseconds. + Weight::from_parts(50_795_000, 16056) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) + /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::Queries` (r:0 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn new_query() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 2_781_000 picoseconds. + Weight::from_parts(2_893_000, 1485) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `XcmPallet::Queries` (r:1 w:1) + /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn take_response() -> Weight { + // Proof Size summary in bytes: + // Measured: `7576` + // Estimated: `11041` + // Minimum execution time: 26_391_000 picoseconds. + Weight::from_parts(26_902_000, 11041) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) + /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::AssetTraps` (r:1 w:1) + /// Proof: `XcmPallet::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn claim_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `23` + // Estimated: `3488` + // Minimum execution time: 39_963_000 picoseconds. + Weight::from_parts(41_025_000, 3488) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn add_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `361` + // Estimated: `3826` + // Minimum execution time: 15_975_000 picoseconds. + Weight::from_parts(16_398_000, 3826) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub(crate) fn remove_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `400` + // Estimated: `3865` + // Minimum execution time: 17_326_000 picoseconds. + Weight::from_parts(17_622_000, 3865) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} From 673c3f6f086fb3dfcaa67c5492ee2294740ad791 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Thu, 7 Nov 2024 13:14:26 +0000 Subject: [PATCH 12/21] ".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=asset-hub-westend --runtime_dir=assets --target_dir=cumulus --pallet=pallet_xcm --- .../src/weights/xcm/pallet_xcm.rs | 411 ++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs new file mode 100644 index 000000000000..1bf29cae6509 --- /dev/null +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs @@ -0,0 +1,411 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-westend-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=asset-hub-westend-dev +// --header=./cumulus/file_header.txt +// --template=./cumulus/templates/xcm-bench-template.hbs +// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weights for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn send() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3610` + // Minimum execution time: 27_966_000 picoseconds. + Weight::from_parts(28_529_000, 3610) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `ParachainInfo::ParachainId` (r:1 w:0) + // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `System::Account` (r:1 w:1) + // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn teleport_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3610` + // Minimum execution time: 111_910_000 picoseconds. + Weight::from_parts(114_432_000, 3610) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: `ParachainInfo::ParachainId` (r:1 w:0) + // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `System::Account` (r:2 w:2) + // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + // Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) + // Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + // Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + // Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + // Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + // Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) + pub fn reserve_transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `400` + // Estimated: `6196` + // Minimum execution time: 136_886_000 picoseconds. + Weight::from_parts(141_399_000, 6196) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: `ParachainInfo::ParachainId` (r:1 w:0) + // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `Assets::Asset` (r:1 w:1) + // Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + // Storage: `Assets::Account` (r:2 w:2) + // Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + // Storage: `AssetsFreezer::FrozenBalances` (r:1 w:0) + // Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + // Storage: `System::Account` (r:2 w:2) + // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `571` + // Estimated: `6208` + // Minimum execution time: 176_288_000 picoseconds. + Weight::from_parts(184_999_000, 6208) + .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().writes(7)) + } + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn execute() -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1588` + // Minimum execution time: 12_420_000 picoseconds. + Weight::from_parts(12_882_000, 1588) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn force_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_994_000 picoseconds. + Weight::from_parts(7_196_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::SafeXcmVersion` (r:0 w:1) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn force_default_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_352_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) + // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) + // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::Queries` (r:0 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn force_subscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3610` + // Minimum execution time: 34_493_000 picoseconds. + Weight::from_parts(35_689_000, 3610) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) + // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::Queries` (r:0 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn force_unsubscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `363` + // Estimated: `3828` + // Minimum execution time: 38_104_000 picoseconds. + Weight::from_parts(39_185_000, 3828) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: `PolkadotXcm::XcmExecutionSuspended` (r:0 w:1) + // Proof: `PolkadotXcm::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_303_000 picoseconds. + Weight::from_parts(2_445_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::SupportedVersion` (r:6 w:2) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn migrate_supported_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `159` + // Estimated: `15999` + // Minimum execution time: 25_339_000 picoseconds. + Weight::from_parts(25_983_000, 15999) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::VersionNotifiers` (r:6 w:2) + // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn migrate_version_notifiers() -> Weight { + // Proof Size summary in bytes: + // Measured: `163` + // Estimated: `16003` + // Minimum execution time: 25_010_000 picoseconds. + Weight::from_parts(25_742_000, 16003) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:7 w:0) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn already_notified_target() -> Weight { + // Proof Size summary in bytes: + // Measured: `173` + // Estimated: `18488` + // Minimum execution time: 28_326_000 picoseconds. + Weight::from_parts(28_909_000, 18488) + .saturating_add(T::DbWeight::get().reads(7)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:2 w:1) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn notify_current_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `212` + // Estimated: `6152` + // Minimum execution time: 32_943_000 picoseconds. + Weight::from_parts(33_935_000, 6152) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:0) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn notify_target_migration_fail() -> Weight { + // Proof Size summary in bytes: + // Measured: `176` + // Estimated: `13541` + // Minimum execution time: 17_887_000 picoseconds. + Weight::from_parts(18_345_000, 13541) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn migrate_version_notify_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `170` + // Estimated: `16010` + // Minimum execution time: 25_926_000 picoseconds. + Weight::from_parts(26_253_000, 16010) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn migrate_and_notify_old_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `212` + // Estimated: `16052` + // Minimum execution time: 46_227_000 picoseconds. + Weight::from_parts(47_320_000, 16052) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) + // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::Queries` (r:0 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn new_query() -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1588` + // Minimum execution time: 5_634_000 picoseconds. + Weight::from_parts(5_918_000, 1588) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::Queries` (r:1 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn take_response() -> Weight { + // Proof Size summary in bytes: + // Measured: `7740` + // Estimated: `11205` + // Minimum execution time: 30_787_000 picoseconds. + Weight::from_parts(31_078_000, 11205) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::AssetTraps` (r:1 w:1) + // Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn claim_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `160` + // Estimated: `3625` + // Minimum execution time: 43_765_000 picoseconds. + Weight::from_parts(45_070_000, 3625) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn add_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_160_000 picoseconds. + Weight::from_parts(19_749_000, 3963) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn remove_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_372_000 picoseconds. + Weight::from_parts(21_198_000, 4002) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} From ac5d4a6de31b262cf1340ac2a1cbe5a75b6dec25 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Thu, 7 Nov 2024 13:18:07 +0000 Subject: [PATCH 13/21] ".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=asset-hub-rococo --runtime_dir=assets --target_dir=cumulus --pallet=pallet_xcm --- .../src/weights/xcm/pallet_xcm.rs | 411 ++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs new file mode 100644 index 000000000000..d9ad8d67bcb1 --- /dev/null +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs @@ -0,0 +1,411 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=asset-hub-rococo-dev +// --header=./cumulus/file_header.txt +// --template=./cumulus/templates/xcm-bench-template.hbs +// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weights for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn send() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3610` + // Minimum execution time: 28_037_000 picoseconds. + Weight::from_parts(28_751_000, 3610) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `ParachainInfo::ParachainId` (r:1 w:0) + // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `System::Account` (r:1 w:1) + // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn teleport_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3610` + // Minimum execution time: 107_295_000 picoseconds. + Weight::from_parts(110_562_000, 3610) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: `ParachainInfo::ParachainId` (r:1 w:0) + // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `System::Account` (r:2 w:2) + // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + // Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) + // Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + // Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + // Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + // Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + // Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) + pub fn reserve_transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `400` + // Estimated: `6196` + // Minimum execution time: 133_841_000 picoseconds. + Weight::from_parts(137_244_000, 6196) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: `ParachainInfo::ParachainId` (r:1 w:0) + // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `Assets::Asset` (r:1 w:1) + // Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + // Storage: `Assets::Account` (r:2 w:2) + // Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + // Storage: `AssetsFreezer::FrozenBalances` (r:1 w:0) + // Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + // Storage: `System::Account` (r:2 w:2) + // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn transfer_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `6208` + // Minimum execution time: 174_612_000 picoseconds. + Weight::from_parts(178_221_000, 6208) + .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().writes(7)) + } + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn execute() -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1588` + // Minimum execution time: 13_537_000 picoseconds. + Weight::from_parts(14_041_000, 1588) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn force_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_186_000 picoseconds. + Weight::from_parts(7_366_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::SafeXcmVersion` (r:0 w:1) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn force_default_xcm_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_459_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) + // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) + // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::Queries` (r:0 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn force_subscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3610` + // Minimum execution time: 34_134_000 picoseconds. + Weight::from_parts(35_407_000, 3610) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) + // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::Queries` (r:0 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn force_unsubscribe_version_notify() -> Weight { + // Proof Size summary in bytes: + // Measured: `363` + // Estimated: `3828` + // Minimum execution time: 37_823_000 picoseconds. + Weight::from_parts(39_541_000, 3828) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: `PolkadotXcm::XcmExecutionSuspended` (r:0 w:1) + // Proof: `PolkadotXcm::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_426_000, 0) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::SupportedVersion` (r:6 w:2) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn migrate_supported_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `159` + // Estimated: `15999` + // Minimum execution time: 25_999_000 picoseconds. + Weight::from_parts(26_384_000, 15999) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::VersionNotifiers` (r:6 w:2) + // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn migrate_version_notifiers() -> Weight { + // Proof Size summary in bytes: + // Measured: `163` + // Estimated: `16003` + // Minimum execution time: 25_468_000 picoseconds. + Weight::from_parts(25_872_000, 16003) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:7 w:0) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn already_notified_target() -> Weight { + // Proof Size summary in bytes: + // Measured: `173` + // Estimated: `18488` + // Minimum execution time: 28_828_000 picoseconds. + Weight::from_parts(29_442_000, 18488) + .saturating_add(T::DbWeight::get().reads(7)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:2 w:1) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn notify_current_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `212` + // Estimated: `6152` + // Minimum execution time: 32_950_000 picoseconds. + Weight::from_parts(34_114_000, 6152) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:0) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn notify_target_migration_fail() -> Weight { + // Proof Size summary in bytes: + // Measured: `176` + // Estimated: `13541` + // Minimum execution time: 18_210_000 picoseconds. + Weight::from_parts(18_770_000, 13541) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn migrate_version_notify_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `170` + // Estimated: `16010` + // Minimum execution time: 25_773_000 picoseconds. + Weight::from_parts(26_286_000, 16010) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) + // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) + // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) + // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + pub fn migrate_and_notify_old_targets() -> Weight { + // Proof Size summary in bytes: + // Measured: `212` + // Estimated: `16052` + // Minimum execution time: 45_974_000 picoseconds. + Weight::from_parts(46_967_000, 16052) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) + // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::Queries` (r:0 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn new_query() -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1588` + // Minimum execution time: 7_076_000 picoseconds. + Weight::from_parts(7_318_000, 1588) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: `PolkadotXcm::Queries` (r:1 w:1) + // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn take_response() -> Weight { + // Proof Size summary in bytes: + // Measured: `7740` + // Estimated: `11205` + // Minimum execution time: 30_736_000 picoseconds. + Weight::from_parts(31_187_000, 11205) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) + // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + // Storage: `PolkadotXcm::AssetTraps` (r:1 w:1) + // Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn claim_assets() -> Weight { + // Proof Size summary in bytes: + // Measured: `160` + // Estimated: `3625` + // Minimum execution time: 43_226_000 picoseconds. + Weight::from_parts(44_498_000, 3625) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn add_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + pub fn remove_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} From 70694ddbe609c82e0200db5d43cbfbc9cec2fbf2 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Thu, 7 Nov 2024 16:17:35 +0200 Subject: [PATCH 14/21] fix benchmarks --- .../src/weights/pallet_xcm.rs | 20 +- .../src/weights/xcm/pallet_xcm.rs | 411 ------------------ .../src/weights/pallet_xcm.rs | 20 +- .../src/weights/xcm/pallet_xcm.rs | 411 ------------------ .../src/weights/pallet_xcm.rs | 20 +- .../src/weights/pallet_xcm.rs | 20 +- .../src/weights/pallet_xcm.rs | 20 +- .../coretime-rococo/src/weights/pallet_xcm.rs | 20 +- .../src/weights/pallet_xcm.rs | 20 +- .../people-rococo/src/weights/pallet_xcm.rs | 20 +- .../people-westend/src/weights/pallet_xcm.rs | 20 +- .../runtime/rococo/src/weights/pallet_xcm.rs | 36 +- .../rococo/src/weights/xcm/pallet_xcm.rs | 363 ---------------- .../runtime/westend/src/weights/pallet_xcm.rs | 36 +- .../westend/src/weights/xcm/pallet_xcm.rs | 363 ---------------- 15 files changed, 170 insertions(+), 1630 deletions(-) delete mode 100644 cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs delete mode 100644 cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs delete mode 100644 polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs delete mode 100644 polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs index ab4dd9af31ad..b39a4440f308 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs deleted file mode 100644 index d9ad8d67bcb1..000000000000 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm.rs +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Cumulus is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Cumulus is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Cumulus. If not, see . - -//! Autogenerated weights for `pallet_xcm` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024 - -// Executed Command: -// target/production/polkadot-parachain -// benchmark -// pallet -// --steps=50 -// --repeat=20 -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json -// --pallet=pallet_xcm -// --chain=asset-hub-rococo-dev -// --header=./cumulus/file_header.txt -// --template=./cumulus/templates/xcm-bench-template.hbs -// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/ - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weights for `pallet_xcm`. -pub struct WeightInfo(PhantomData); -impl WeightInfo { - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn send() -> Weight { - // Proof Size summary in bytes: - // Measured: `145` - // Estimated: `3610` - // Minimum execution time: 28_037_000 picoseconds. - Weight::from_parts(28_751_000, 3610) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `ParachainInfo::ParachainId` (r:1 w:0) - // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `System::Account` (r:1 w:1) - // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn teleport_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `145` - // Estimated: `3610` - // Minimum execution time: 107_295_000 picoseconds. - Weight::from_parts(110_562_000, 3610) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: `ParachainInfo::ParachainId` (r:1 w:0) - // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `System::Account` (r:2 w:2) - // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - // Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) - // Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) - // Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) - // Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) - // Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) - // Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) - pub fn reserve_transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `400` - // Estimated: `6196` - // Minimum execution time: 133_841_000 picoseconds. - Weight::from_parts(137_244_000, 6196) - .saturating_add(T::DbWeight::get().reads(10)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: `ParachainInfo::ParachainId` (r:1 w:0) - // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `Assets::Asset` (r:1 w:1) - // Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) - // Storage: `Assets::Account` (r:2 w:2) - // Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - // Storage: `AssetsFreezer::FrozenBalances` (r:1 w:0) - // Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) - // Storage: `System::Account` (r:2 w:2) - // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `537` - // Estimated: `6208` - // Minimum execution time: 174_612_000 picoseconds. - Weight::from_parts(178_221_000, 6208) - .saturating_add(T::DbWeight::get().reads(14)) - .saturating_add(T::DbWeight::get().writes(7)) - } - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn execute() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `1588` - // Minimum execution time: 13_537_000 picoseconds. - Weight::from_parts(14_041_000, 1588) - .saturating_add(T::DbWeight::get().reads(1)) - } - // Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn force_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_186_000 picoseconds. - Weight::from_parts(7_366_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::SafeXcmVersion` (r:0 w:1) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn force_default_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_358_000 picoseconds. - Weight::from_parts(2_459_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) - // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) - // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::Queries` (r:0 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn force_subscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `145` - // Estimated: `3610` - // Minimum execution time: 34_134_000 picoseconds. - Weight::from_parts(35_407_000, 3610) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) - // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::Queries` (r:0 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn force_unsubscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `363` - // Estimated: `3828` - // Minimum execution time: 37_823_000 picoseconds. - Weight::from_parts(39_541_000, 3828) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: `PolkadotXcm::XcmExecutionSuspended` (r:0 w:1) - // Proof: `PolkadotXcm::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn force_suspension() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_426_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::SupportedVersion` (r:6 w:2) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn migrate_supported_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `159` - // Estimated: `15999` - // Minimum execution time: 25_999_000 picoseconds. - Weight::from_parts(26_384_000, 15999) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::VersionNotifiers` (r:6 w:2) - // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn migrate_version_notifiers() -> Weight { - // Proof Size summary in bytes: - // Measured: `163` - // Estimated: `16003` - // Minimum execution time: 25_468_000 picoseconds. - Weight::from_parts(25_872_000, 16003) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:7 w:0) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn already_notified_target() -> Weight { - // Proof Size summary in bytes: - // Measured: `173` - // Estimated: `18488` - // Minimum execution time: 28_828_000 picoseconds. - Weight::from_parts(29_442_000, 18488) - .saturating_add(T::DbWeight::get().reads(7)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:2 w:1) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn notify_current_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `212` - // Estimated: `6152` - // Minimum execution time: 32_950_000 picoseconds. - Weight::from_parts(34_114_000, 6152) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:0) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn notify_target_migration_fail() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `13541` - // Minimum execution time: 18_210_000 picoseconds. - Weight::from_parts(18_770_000, 13541) - .saturating_add(T::DbWeight::get().reads(5)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn migrate_version_notify_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `16010` - // Minimum execution time: 25_773_000 picoseconds. - Weight::from_parts(26_286_000, 16010) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn migrate_and_notify_old_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `212` - // Estimated: `16052` - // Minimum execution time: 45_974_000 picoseconds. - Weight::from_parts(46_967_000, 16052) - .saturating_add(T::DbWeight::get().reads(12)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) - // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::Queries` (r:0 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn new_query() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `1588` - // Minimum execution time: 7_076_000 picoseconds. - Weight::from_parts(7_318_000, 1588) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::Queries` (r:1 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn take_response() -> Weight { - // Proof Size summary in bytes: - // Measured: `7740` - // Estimated: `11205` - // Minimum execution time: 30_736_000 picoseconds. - Weight::from_parts(31_187_000, 11205) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::AssetTraps` (r:1 w:1) - // Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn claim_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `160` - // Estimated: `3625` - // Minimum execution time: 43_226_000 picoseconds. - Weight::from_parts(44_498_000, 3625) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn add_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `498` - // Estimated: `3963` - // Minimum execution time: 19_789_000 picoseconds. - Weight::from_parts(20_317_000, 3963) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn remove_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `537` - // Estimated: `4002` - // Minimum execution time: 20_805_000 picoseconds. - Weight::from_parts(21_481_000, 4002) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs index 0c0c08077dab..d10a348abcdf 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs deleted file mode 100644 index 1bf29cae6509..000000000000 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm.rs +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Cumulus is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Cumulus is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Cumulus. If not, see . - -//! Autogenerated weights for `pallet_xcm` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-westend-dev"), DB CACHE: 1024 - -// Executed Command: -// target/production/polkadot-parachain -// benchmark -// pallet -// --steps=50 -// --repeat=20 -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json -// --pallet=pallet_xcm -// --chain=asset-hub-westend-dev -// --header=./cumulus/file_header.txt -// --template=./cumulus/templates/xcm-bench-template.hbs -// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/ - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weights for `pallet_xcm`. -pub struct WeightInfo(PhantomData); -impl WeightInfo { - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn send() -> Weight { - // Proof Size summary in bytes: - // Measured: `145` - // Estimated: `3610` - // Minimum execution time: 27_966_000 picoseconds. - Weight::from_parts(28_529_000, 3610) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `ParachainInfo::ParachainId` (r:1 w:0) - // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `System::Account` (r:1 w:1) - // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn teleport_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `145` - // Estimated: `3610` - // Minimum execution time: 111_910_000 picoseconds. - Weight::from_parts(114_432_000, 3610) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: `ParachainInfo::ParachainId` (r:1 w:0) - // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `System::Account` (r:2 w:2) - // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - // Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) - // Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) - // Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) - // Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) - // Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) - // Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) - pub fn reserve_transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `400` - // Estimated: `6196` - // Minimum execution time: 136_886_000 picoseconds. - Weight::from_parts(141_399_000, 6196) - .saturating_add(T::DbWeight::get().reads(10)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: `ParachainInfo::ParachainId` (r:1 w:0) - // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `Assets::Asset` (r:1 w:1) - // Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) - // Storage: `Assets::Account` (r:2 w:2) - // Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - // Storage: `AssetsFreezer::FrozenBalances` (r:1 w:0) - // Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) - // Storage: `System::Account` (r:2 w:2) - // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `571` - // Estimated: `6208` - // Minimum execution time: 176_288_000 picoseconds. - Weight::from_parts(184_999_000, 6208) - .saturating_add(T::DbWeight::get().reads(14)) - .saturating_add(T::DbWeight::get().writes(7)) - } - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn execute() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `1588` - // Minimum execution time: 12_420_000 picoseconds. - Weight::from_parts(12_882_000, 1588) - .saturating_add(T::DbWeight::get().reads(1)) - } - // Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn force_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 6_994_000 picoseconds. - Weight::from_parts(7_196_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::SafeXcmVersion` (r:0 w:1) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn force_default_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_352_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) - // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) - // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::Queries` (r:0 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn force_subscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `145` - // Estimated: `3610` - // Minimum execution time: 34_493_000 picoseconds. - Weight::from_parts(35_689_000, 3610) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) - // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::Queries` (r:0 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn force_unsubscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `363` - // Estimated: `3828` - // Minimum execution time: 38_104_000 picoseconds. - Weight::from_parts(39_185_000, 3828) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: `PolkadotXcm::XcmExecutionSuspended` (r:0 w:1) - // Proof: `PolkadotXcm::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn force_suspension() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_303_000 picoseconds. - Weight::from_parts(2_445_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::SupportedVersion` (r:6 w:2) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn migrate_supported_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `159` - // Estimated: `15999` - // Minimum execution time: 25_339_000 picoseconds. - Weight::from_parts(25_983_000, 15999) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::VersionNotifiers` (r:6 w:2) - // Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn migrate_version_notifiers() -> Weight { - // Proof Size summary in bytes: - // Measured: `163` - // Estimated: `16003` - // Minimum execution time: 25_010_000 picoseconds. - Weight::from_parts(25_742_000, 16003) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:7 w:0) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn already_notified_target() -> Weight { - // Proof Size summary in bytes: - // Measured: `173` - // Estimated: `18488` - // Minimum execution time: 28_326_000 picoseconds. - Weight::from_parts(28_909_000, 18488) - .saturating_add(T::DbWeight::get().reads(7)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:2 w:1) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn notify_current_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `212` - // Estimated: `6152` - // Minimum execution time: 32_943_000 picoseconds. - Weight::from_parts(33_935_000, 6152) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:0) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn notify_target_migration_fail() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `13541` - // Minimum execution time: 17_887_000 picoseconds. - Weight::from_parts(18_345_000, 13541) - .saturating_add(T::DbWeight::get().reads(5)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn migrate_version_notify_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `16010` - // Minimum execution time: 25_926_000 picoseconds. - Weight::from_parts(26_253_000, 16010) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:2) - // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) - // Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - // Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - // Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - // Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - // Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn migrate_and_notify_old_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `212` - // Estimated: `16052` - // Minimum execution time: 46_227_000 picoseconds. - Weight::from_parts(47_320_000, 16052) - .saturating_add(T::DbWeight::get().reads(12)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: `PolkadotXcm::QueryCounter` (r:1 w:1) - // Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::Queries` (r:0 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn new_query() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `1588` - // Minimum execution time: 5_634_000 picoseconds. - Weight::from_parts(5_918_000, 1588) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: `PolkadotXcm::Queries` (r:1 w:1) - // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn take_response() -> Weight { - // Proof Size summary in bytes: - // Measured: `7740` - // Estimated: `11205` - // Minimum execution time: 30_787_000 picoseconds. - Weight::from_parts(31_078_000, 11205) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::ShouldRecordXcm` (r:1 w:0) - // Proof: `PolkadotXcm::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - // Storage: `PolkadotXcm::AssetTraps` (r:1 w:1) - // Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn claim_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `160` - // Estimated: `3625` - // Minimum execution time: 43_765_000 picoseconds. - Weight::from_parts(45_070_000, 3625) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn add_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `498` - // Estimated: `3963` - // Minimum execution time: 19_160_000 picoseconds. - Weight::from_parts(19_749_000, 3963) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - // Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub fn remove_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `537` - // Estimated: `4002` - // Minimum execution time: 20_372_000 picoseconds. - Weight::from_parts(21_198_000, 4002) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs index c01243ef1c5b..12ff328ca2cb 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs index 76846397c7d2..48ba7656ac71 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs index 58b773939de6..c9b597050ca8 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs index d5ec7614a5c2..9b05842003bd 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs index 0b3fc7ae23ed..16010d08b7b4 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs index d6e370eebe89..9868db381cbf 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs index e50b2b70daae..636152779906 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs @@ -48,17 +48,25 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `3963` + // Minimum execution time: 19_789_000 picoseconds. + Weight::from_parts(20_317_000, 3963) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `4002` + // Minimum execution time: 20_805_000 picoseconds. + Weight::from_parts(21_481_000, 4002) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/polkadot/runtime/rococo/src/weights/pallet_xcm.rs b/polkadot/runtime/rococo/src/weights/pallet_xcm.rs index 3e7d29e973c4..5849b8806b1e 100644 --- a/polkadot/runtime/rococo/src/weights/pallet_xcm.rs +++ b/polkadot/runtime/rococo/src/weights/pallet_xcm.rs @@ -50,20 +50,6 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) @@ -362,4 +348,26 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn add_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `361` + // Estimated: `3826` + // Minimum execution time: 15_975_000 picoseconds. + Weight::from_parts(16_398_000, 3826) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `400` + // Estimated: `3865` + // Minimum execution time: 17_326_000 picoseconds. + Weight::from_parts(17_622_000, 3865) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } } diff --git a/polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs b/polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs deleted file mode 100644 index 4309c155ca9a..000000000000 --- a/polkadot/runtime/rococo/src/weights/xcm/pallet_xcm.rs +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Polkadot is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Polkadot. If not, see . - -//! Autogenerated weights for `pallet_xcm` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 - -// Executed Command: -// target/production/polkadot -// benchmark -// pallet -// --steps=50 -// --repeat=20 -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json -// --pallet=pallet_xcm -// --chain=rococo-dev -// --header=./polkadot/file_header.txt -// --template=./polkadot/xcm/pallet-xcm-benchmarks/template.hbs -// --output=./polkadot/runtime/rococo/src/weights/xcm/ - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_xcm`. -pub struct WeightInfo(PhantomData); -impl WeightInfo { - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn send() -> Weight { - // Proof Size summary in bytes: - // Measured: `180` - // Estimated: `3645` - // Minimum execution time: 30_643_000 picoseconds. - Weight::from_parts(31_782_000, 3645) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn teleport_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `180` - // Estimated: `3645` - // Minimum execution time: 130_791_000 picoseconds. - Weight::from_parts(134_979_000, 3645) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn reserve_transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `232` - // Estimated: `3697` - // Minimum execution time: 129_933_000 picoseconds. - Weight::from_parts(134_918_000, 3697) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `180` - // Estimated: `3645` - // Minimum execution time: 130_466_000 picoseconds. - Weight::from_parts(135_449_000, 3645) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub(crate) fn execute() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1485` - // Minimum execution time: 9_620_000 picoseconds. - Weight::from_parts(10_073_000, 1485) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `XcmPallet::SupportedVersion` (r:0 w:1) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn force_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 8_386_000 picoseconds. - Weight::from_parts(8_727_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - pub(crate) fn force_default_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_481_000 picoseconds. - Weight::from_parts(2_653_000, 0) - } - /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) - /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) - /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::Queries` (r:0 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn force_subscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `180` - // Estimated: `3645` - // Minimum execution time: 37_250_000 picoseconds. - Weight::from_parts(38_353_000, 3645) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) - /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::Queries` (r:0 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn force_unsubscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `360` - // Estimated: `3825` - // Minimum execution time: 46_257_000 picoseconds. - Weight::from_parts(47_915_000, 3825) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `XcmPallet::XcmExecutionSuspended` (r:0 w:1) - /// Proof: `XcmPallet::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub(crate) fn force_suspension() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_530_000 picoseconds. - Weight::from_parts(2_619_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::SupportedVersion` (r:6 w:2) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_supported_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `15862` - // Minimum execution time: 21_851_000 picoseconds. - Weight::from_parts(22_104_000, 15862) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::VersionNotifiers` (r:6 w:2) - /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_version_notifiers() -> Weight { - // Proof Size summary in bytes: - // Measured: `26` - // Estimated: `15866` - // Minimum execution time: 22_063_000 picoseconds. - Weight::from_parts(22_386_000, 15866) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:7 w:0) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn already_notified_target() -> Weight { - // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `18355` - // Minimum execution time: 25_210_000 picoseconds. - Weight::from_parts(25_527_000, 18355) - .saturating_add(T::DbWeight::get().reads(7)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:2 w:1) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn notify_current_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `216` - // Estimated: `6156` - // Minimum execution time: 36_418_000 picoseconds. - Weight::from_parts(37_557_000, 6156) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:5 w:0) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn notify_target_migration_fail() -> Weight { - // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `13405` - // Minimum execution time: 17_617_000 picoseconds. - Weight::from_parts(17_794_000, 13405) - .saturating_add(T::DbWeight::get().reads(5)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_version_notify_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `33` - // Estimated: `15873` - // Minimum execution time: 22_091_000 picoseconds. - Weight::from_parts(22_394_000, 15873) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_and_notify_old_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `216` - // Estimated: `16056` - // Minimum execution time: 49_581_000 picoseconds. - Weight::from_parts(50_795_000, 16056) - .saturating_add(T::DbWeight::get().reads(10)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) - /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::Queries` (r:0 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn new_query() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1485` - // Minimum execution time: 2_781_000 picoseconds. - Weight::from_parts(2_893_000, 1485) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::Queries` (r:1 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn take_response() -> Weight { - // Proof Size summary in bytes: - // Measured: `7576` - // Estimated: `11041` - // Minimum execution time: 26_391_000 picoseconds. - Weight::from_parts(26_902_000, 11041) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::AssetTraps` (r:1 w:1) - /// Proof: `XcmPallet::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn claim_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `23` - // Estimated: `3488` - // Minimum execution time: 39_963_000 picoseconds. - Weight::from_parts(41_025_000, 3488) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn add_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `361` - // Estimated: `3826` - // Minimum execution time: 15_975_000 picoseconds. - Weight::from_parts(16_398_000, 3826) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn remove_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `400` - // Estimated: `3865` - // Minimum execution time: 17_326_000 picoseconds. - Weight::from_parts(17_622_000, 3865) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/polkadot/runtime/westend/src/weights/pallet_xcm.rs b/polkadot/runtime/westend/src/weights/pallet_xcm.rs index aac57102613d..0032dfaa3b64 100644 --- a/polkadot/runtime/westend/src/weights/pallet_xcm.rs +++ b/polkadot/runtime/westend/src/weights/pallet_xcm.rs @@ -48,20 +48,6 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - fn add_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn remove_authorized_alias() -> Weight { - // TODO: benchmark - Weight::from_parts(3_724_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) @@ -362,4 +348,26 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn add_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `361` + // Estimated: `3826` + // Minimum execution time: 15_975_000 picoseconds. + Weight::from_parts(16_398_000, 3826) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_authorized_alias() -> Weight { + // Proof Size summary in bytes: + // Measured: `400` + // Estimated: `3865` + // Minimum execution time: 17_326_000 picoseconds. + Weight::from_parts(17_622_000, 3865) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } } diff --git a/polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs b/polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs deleted file mode 100644 index 0e770a88c069..000000000000 --- a/polkadot/runtime/westend/src/weights/xcm/pallet_xcm.rs +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Polkadot is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Polkadot. If not, see . - -//! Autogenerated weights for `pallet_xcm` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-11-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-vcatxqpx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 - -// Executed Command: -// target/production/polkadot -// benchmark -// pallet -// --steps=50 -// --repeat=20 -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json -// --pallet=pallet_xcm -// --chain=westend-dev -// --header=./polkadot/file_header.txt -// --template=./polkadot/xcm/pallet-xcm-benchmarks/template.hbs -// --output=./polkadot/runtime/westend/src/weights/xcm/ - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_xcm`. -pub struct WeightInfo(PhantomData); -impl WeightInfo { - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn send() -> Weight { - // Proof Size summary in bytes: - // Measured: `147` - // Estimated: `3612` - // Minimum execution time: 30_777_000 picoseconds. - Weight::from_parts(31_746_000, 3612) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn teleport_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `250` - // Estimated: `6196` - // Minimum execution time: 130_855_000 picoseconds. - Weight::from_parts(135_315_000, 6196) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn reserve_transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `302` - // Estimated: `6196` - // Minimum execution time: 128_185_000 picoseconds. - Weight::from_parts(132_459_000, 6196) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn transfer_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `250` - // Estimated: `6196` - // Minimum execution time: 132_603_000 picoseconds. - Weight::from_parts(135_485_000, 6196) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub(crate) fn execute() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1485` - // Minimum execution time: 9_227_000 picoseconds. - Weight::from_parts(9_554_000, 1485) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `XcmPallet::SupportedVersion` (r:0 w:1) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn force_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 8_033_000 picoseconds. - Weight::from_parts(8_269_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - pub(crate) fn force_default_xcm_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_445_000, 0) - } - /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) - /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) - /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::Queries` (r:0 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn force_subscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `147` - // Estimated: `3612` - // Minimum execution time: 36_912_000 picoseconds. - Weight::from_parts(38_677_000, 3612) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: `XcmPallet::VersionNotifiers` (r:1 w:1) - /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::Queries` (r:0 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn force_unsubscribe_version_notify() -> Weight { - // Proof Size summary in bytes: - // Measured: `327` - // Estimated: `3792` - // Minimum execution time: 46_175_000 picoseconds. - Weight::from_parts(47_850_000, 3792) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `XcmPallet::XcmExecutionSuspended` (r:0 w:1) - /// Proof: `XcmPallet::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub(crate) fn force_suspension() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_328_000 picoseconds. - Weight::from_parts(2_464_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::SupportedVersion` (r:6 w:2) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_supported_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `22` - // Estimated: `15862` - // Minimum execution time: 22_130_000 picoseconds. - Weight::from_parts(22_492_000, 15862) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::VersionNotifiers` (r:6 w:2) - /// Proof: `XcmPallet::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_version_notifiers() -> Weight { - // Proof Size summary in bytes: - // Measured: `26` - // Estimated: `15866` - // Minimum execution time: 22_043_000 picoseconds. - Weight::from_parts(22_750_000, 15866) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:7 w:0) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn already_notified_target() -> Weight { - // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `18355` - // Minimum execution time: 25_046_000 picoseconds. - Weight::from_parts(25_660_000, 18355) - .saturating_add(T::DbWeight::get().reads(7)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:2 w:1) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn notify_current_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `183` - // Estimated: `6123` - // Minimum execution time: 36_029_000 picoseconds. - Weight::from_parts(37_313_000, 6123) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:5 w:0) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn notify_target_migration_fail() -> Weight { - // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `13405` - // Minimum execution time: 17_295_000 picoseconds. - Weight::from_parts(17_961_000, 13405) - .saturating_add(T::DbWeight::get().reads(5)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_version_notify_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `33` - // Estimated: `15873` - // Minimum execution time: 21_606_000 picoseconds. - Weight::from_parts(21_939_000, 15873) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::VersionNotifyTargets` (r:6 w:2) - /// Proof: `XcmPallet::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn migrate_and_notify_old_targets() -> Weight { - // Proof Size summary in bytes: - // Measured: `183` - // Estimated: `16023` - // Minimum execution time: 49_623_000 picoseconds. - Weight::from_parts(50_940_000, 16023) - .saturating_add(T::DbWeight::get().reads(10)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) - /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::Queries` (r:0 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn new_query() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1485` - // Minimum execution time: 2_662_000 picoseconds. - Weight::from_parts(2_832_000, 1485) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `XcmPallet::Queries` (r:1 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn take_response() -> Weight { - // Proof Size summary in bytes: - // Measured: `7576` - // Estimated: `11041` - // Minimum execution time: 26_358_000 picoseconds. - Weight::from_parts(26_871_000, 11041) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::ShouldRecordXcm` (r:1 w:0) - /// Proof: `XcmPallet::ShouldRecordXcm` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::AssetTraps` (r:1 w:1) - /// Proof: `XcmPallet::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn claim_assets() -> Weight { - // Proof Size summary in bytes: - // Measured: `23` - // Estimated: `3488` - // Minimum execution time: 39_745_000 picoseconds. - Weight::from_parts(40_188_000, 3488) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn add_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `361` - // Estimated: `3826` - // Minimum execution time: 15_726_000 picoseconds. - Weight::from_parts(16_154_000, 3826) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) - pub(crate) fn remove_authorized_alias() -> Weight { - // Proof Size summary in bytes: - // Measured: `400` - // Estimated: `3865` - // Minimum execution time: 17_404_000 picoseconds. - Weight::from_parts(17_718_000, 3865) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} From 61c822433a4f655dc34e65294cfa49861a46f64a Mon Sep 17 00:00:00 2001 From: Francisco Aguirre Date: Thu, 7 Nov 2024 18:17:23 -0300 Subject: [PATCH 15/21] Update polkadot/xcm/pallet-xcm/src/benchmarking.rs --- polkadot/xcm/pallet-xcm/src/benchmarking.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index e858edf29d29..034b4508c744 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -412,7 +412,7 @@ benchmarks! { existing_aliases.try_push(alias).unwrap() } AuthorizedAliasesMap::::insert(&origin_location, existing_aliases); - // now benchmark adding new alias + // now benchmark removing an alias let aliaser_to_remove: VersionedLocation = Location::new(1, [Parachain(1), AccountId32 { network: None, id: [42_u8; 32] }]).into(); }: _(origin, Box::new(aliaser_to_remove)) From 9d59105661978586d428d9708f640c20b00f91d1 Mon Sep 17 00:00:00 2001 From: Francisco Aguirre Date: Thu, 7 Nov 2024 18:17:35 -0300 Subject: [PATCH 16/21] Update polkadot/xcm/pallet-xcm/src/lib.rs --- polkadot/xcm/pallet-xcm/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 9ded29527334..b15cf3e47aaa 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -1470,14 +1470,14 @@ pub mod pallet { let aliaser: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?aliaser); ensure!(origin != aliaser, Error::::BadLocation); - let v_origin = VersionedLocation::from(origin); - let v_aliaser = VersionedLocation::from(aliaser); - let mut authorized_aliases = AuthorizedAliasesMap::::get(&v_origin); - if !authorized_aliases.contains(&v_aliaser) { + let versioned_origin = VersionedLocation::from(origin); + let versioned_aliaser = VersionedLocation::from(aliaser); + let mut authorized_aliases = AuthorizedAliasesMap::::get(&versioned_origin); + if !authorized_aliases.contains(&versioned_aliaser) { authorized_aliases - .try_push(v_aliaser) + .try_push(versioned_aliaser) .map_err(|_| Error::::TooManyAuthorizedAliases)?; - AuthorizedAliasesMap::::insert(&v_origin, authorized_aliases); + AuthorizedAliasesMap::::insert(&versioned_origin, authorized_aliases); } Ok(()) } From 1b647db5880a405a2834dc0c457294236fb31ebc Mon Sep 17 00:00:00 2001 From: Francisco Aguirre Date: Thu, 7 Nov 2024 18:17:45 -0300 Subject: [PATCH 17/21] Update polkadot/xcm/pallet-xcm/src/lib.rs --- polkadot/xcm/pallet-xcm/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index b15cf3e47aaa..2a201557245c 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -1493,13 +1493,13 @@ pub mod pallet { let to_remove: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?to_remove); ensure!(origin != to_remove, Error::::BadLocation); - let v_origin = VersionedLocation::from(origin); - let v_to_remove = VersionedLocation::from(to_remove); - let mut authorized_aliases = AuthorizedAliasesMap::::get(&v_origin); + let versioned_origin = VersionedLocation::from(origin); + let versioned_to_remove = VersionedLocation::from(to_remove); + let mut authorized_aliases = AuthorizedAliasesMap::::get(&versioned_origin); let original_length = authorized_aliases.len(); - authorized_aliases.retain(|alias| v_to_remove.ne(alias)); + authorized_aliases.retain(|alias| versioned_to_remove.ne(alias)); if original_length != authorized_aliases.len() { - AuthorizedAliasesMap::::insert(&v_origin, authorized_aliases); + AuthorizedAliasesMap::::insert(&versioned_origin, authorized_aliases); } Ok(()) } From 7b58df8f7ee7c70e74dc0fb5fc235ab61bdc9a2d Mon Sep 17 00:00:00 2001 From: Francisco Aguirre Date: Thu, 7 Nov 2024 18:20:17 -0300 Subject: [PATCH 18/21] chore: change new_version to XCM_VERSION --- polkadot/xcm/pallet-xcm/src/migration.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/migration.rs b/polkadot/xcm/pallet-xcm/src/migration.rs index 64b35bd8566d..aee5cde6dfe3 100644 --- a/polkadot/xcm/pallet-xcm/src/migration.rs +++ b/polkadot/xcm/pallet-xcm/src/migration.rs @@ -179,13 +179,13 @@ pub mod data { self.1.iter().any(|alias| alias.identify_version() < XCM_VERSION) } - fn try_migrate(self, new_version: XcmVersion) -> Result, ()> { - if !self.needs_migration(new_version) { + fn try_migrate(self, _: XcmVersion) -> Result, ()> { + if !self.needs_migration(XCM_VERSION) { return Ok(None) } - let key = if self.0.identify_version() < new_version { - let Ok(converted_key) = self.0.clone().into_version(new_version) else { + let key = if self.0.identify_version() < XCM_VERSION { + let Ok(converted_key) = self.0.clone().into_version(XCM_VERSION) else { return Err(()) }; converted_key @@ -195,8 +195,8 @@ pub mod data { let mut aliases = BoundedVec::::new(); for alias in self.1 { if aliases - .try_push(if alias.identify_version() < new_version { - let Ok(new_alias) = alias.clone().into_version(new_version) else { + .try_push(if alias.identify_version() < XCM_VERSION { + let Ok(new_alias) = alias.clone().into_version(XCM_VERSION) else { return Err(()) }; new_alias From c239f8dd6f6a034b64dcbcdc8c039569d9787761 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Mon, 11 Nov 2024 20:01:18 +0200 Subject: [PATCH 19/21] rename vars --- .../asset-hub-rococo/src/weights/pallet_xcm.rs | 8 ++++---- .../src/weights/pallet_xcm.rs | 8 ++++---- .../assets/asset-hub-westend/src/xcm_config.rs | 4 ++-- .../src/weights/pallet_xcm.rs | 8 ++++---- .../src/weights/pallet_xcm.rs | 8 ++++---- .../src/weights/pallet_xcm.rs | 8 ++++---- .../coretime-rococo/src/weights/pallet_xcm.rs | 8 ++++---- .../coretime-westend/src/weights/pallet_xcm.rs | 8 ++++---- .../people-rococo/src/weights/pallet_xcm.rs | 8 ++++---- .../people-westend/src/weights/pallet_xcm.rs | 8 ++++---- .../runtime/rococo/src/weights/pallet_xcm.rs | 8 ++++---- .../runtime/westend/src/weights/pallet_xcm.rs | 8 ++++---- polkadot/xcm/pallet-xcm/src/benchmarking.rs | 4 ++-- polkadot/xcm/pallet-xcm/src/lib.rs | 18 +++++++++--------- polkadot/xcm/pallet-xcm/src/migration.rs | 14 +++++++------- prdoc/pr_6336.prdoc | 4 ++-- 16 files changed, 66 insertions(+), 66 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs index b39a4440f308..b05fd39fa9d0 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs index d10a348abcdf..65943a0d6bc2 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index fa4040f461b7..647356fd2bec 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -32,7 +32,7 @@ use frame_support::{ }, }; use frame_system::EnsureRoot; -use pallet_xcm::{AuthorizedAliases, XcmPassthrough}; +use pallet_xcm::{AuthorizedAliasers, XcmPassthrough}; use parachains_common::{ xcm_config::{ AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, @@ -357,7 +357,7 @@ pub type TrustedTeleporters = ( /// /// - Allow any origin to alias into a child sub-location (equivalent to DescendOrigin), /// - Allow origins explicitly authorized by the alias target location. -pub type TrustedAliasers = (AliasChildLocation, AuthorizedAliases); +pub type TrustedAliasers = (AliasChildLocation, AuthorizedAliasers); /// Asset converter for pool assets. /// Used to convert one asset to another, when there is a pool available between the two. diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs index 12ff328ca2cb..ce572fa16356 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs index 48ba7656ac71..19ecbfb5727e 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs index c9b597050ca8..043710b0d7ab 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs index 9b05842003bd..9997422961fd 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs index 16010d08b7b4..42ef5c2b4071 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs index 9868db381cbf..5a9c069c2e07 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs index 636152779906..5307360e2713 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_xcm.rs @@ -48,8 +48,8 @@ use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); impl pallet_xcm::WeightInfo for WeightInfo { - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `498` @@ -59,8 +59,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `PolkadotXcm::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `PolkadotXcm::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::AuthorizedAliases` (r:1 w:1) + /// Proof: `PolkadotXcm::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `537` diff --git a/polkadot/runtime/rococo/src/weights/pallet_xcm.rs b/polkadot/runtime/rococo/src/weights/pallet_xcm.rs index 5849b8806b1e..06ebd68a19c5 100644 --- a/polkadot/runtime/rococo/src/weights/pallet_xcm.rs +++ b/polkadot/runtime/rococo/src/weights/pallet_xcm.rs @@ -348,8 +348,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::AuthorizedAliases` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `361` @@ -359,8 +359,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::AuthorizedAliases` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `400` diff --git a/polkadot/runtime/westend/src/weights/pallet_xcm.rs b/polkadot/runtime/westend/src/weights/pallet_xcm.rs index 0032dfaa3b64..aaeb0438520e 100644 --- a/polkadot/runtime/westend/src/weights/pallet_xcm.rs +++ b/polkadot/runtime/westend/src/weights/pallet_xcm.rs @@ -348,8 +348,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::AuthorizedAliases` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `361` @@ -359,8 +359,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `XcmPallet::AuthorizedAliasesMap` (r:1 w:1) - /// Proof: `XcmPallet::AuthorizedAliasesMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::AuthorizedAliases` (r:1 w:1) + /// Proof: `XcmPallet::AuthorizedAliases` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_authorized_alias() -> Weight { // Proof Size summary in bytes: // Measured: `400` diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index 034b4508c744..69d710a35d4b 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -395,7 +395,7 @@ benchmarks! { let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]).into(); existing_aliases.try_push(alias).unwrap() } - AuthorizedAliasesMap::::insert(&origin_location, existing_aliases); + AuthorizedAliases::::insert(&origin_location, existing_aliases); // now benchmark adding new alias let aliaser: VersionedLocation = Location::new(1, [Parachain(1234), AccountId32 { network: None, id: [42_u8; 32] }]).into(); @@ -411,7 +411,7 @@ benchmarks! { let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]).into(); existing_aliases.try_push(alias).unwrap() } - AuthorizedAliasesMap::::insert(&origin_location, existing_aliases); + AuthorizedAliases::::insert(&origin_location, existing_aliases); // now benchmark removing an alias let aliaser_to_remove: VersionedLocation = Location::new(1, [Parachain(1), AccountId32 { network: None, id: [42_u8; 32] }]).into(); diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 135f98cddc52..8b4ba937fec6 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -813,7 +813,7 @@ pub mod pallet { /// Map of authorized aliasers of local origins. Each local location can authorize a list of /// other locations to alias into it. #[pallet::storage] - pub(super) type AuthorizedAliasesMap = StorageMap< + pub(super) type AuthorizedAliases = StorageMap< _, Blake2_128Concat, VersionedLocation, @@ -1473,12 +1473,12 @@ pub mod pallet { ensure!(origin != aliaser, Error::::BadLocation); let versioned_origin = VersionedLocation::from(origin); let versioned_aliaser = VersionedLocation::from(aliaser); - let mut authorized_aliases = AuthorizedAliasesMap::::get(&versioned_origin); + let mut authorized_aliases = AuthorizedAliases::::get(&versioned_origin); if !authorized_aliases.contains(&versioned_aliaser) { authorized_aliases .try_push(versioned_aliaser) .map_err(|_| Error::::TooManyAuthorizedAliases)?; - AuthorizedAliasesMap::::insert(&versioned_origin, authorized_aliases); + AuthorizedAliases::::insert(&versioned_origin, authorized_aliases); } Ok(()) } @@ -1496,11 +1496,11 @@ pub mod pallet { ensure!(origin != to_remove, Error::::BadLocation); let versioned_origin = VersionedLocation::from(origin); let versioned_to_remove = VersionedLocation::from(to_remove); - let mut authorized_aliases = AuthorizedAliasesMap::::get(&versioned_origin); + let mut authorized_aliases = AuthorizedAliases::::get(&versioned_origin); let original_length = authorized_aliases.len(); authorized_aliases.retain(|alias| versioned_to_remove.ne(alias)); if original_length != authorized_aliases.len() { - AuthorizedAliasesMap::::insert(&versioned_origin, authorized_aliases); + AuthorizedAliases::::insert(&versioned_origin, authorized_aliases); } Ok(()) } @@ -3513,13 +3513,13 @@ where /// /// Note: users can authorize other locations to alias them by using /// `pallet_xcm::add_authorized_alias()`. -pub struct AuthorizedAliases(PhantomData); -impl + Clone, T: Config> ContainsPair for AuthorizedAliases { +pub struct AuthorizedAliasers(PhantomData); +impl + Clone, T: Config> ContainsPair for AuthorizedAliasers { fn contains(origin: &L, target: &L) -> bool { let origin: VersionedLocation = origin.clone().into(); let target: VersionedLocation = target.clone().into(); - tracing::trace!(target: "xcm::pallet_xcm::AuthorizedAliases::contains", ?origin, ?target); - AuthorizedAliasesMap::::get(&target).contains(&origin) + tracing::trace!(target: "xcm::pallet_xcm::AuthorizedAliasers::contains", ?origin, ?target); + AuthorizedAliases::::get(&target).contains(&origin) } } diff --git a/polkadot/xcm/pallet-xcm/src/migration.rs b/polkadot/xcm/pallet-xcm/src/migration.rs index aee5cde6dfe3..fafef2b23d86 100644 --- a/polkadot/xcm/pallet-xcm/src/migration.rs +++ b/polkadot/xcm/pallet-xcm/src/migration.rs @@ -170,7 +170,7 @@ pub mod data { } } - /// Implementation of `NeedsMigration` for `AuthorizedAliasesMap` data. + /// Implementation of `NeedsMigration` for `AuthorizedAliases` data. impl> NeedsMigration for (&VersionedLocation, &BoundedVec) { type MigratedData = (VersionedLocation, BoundedVec); @@ -367,8 +367,8 @@ pub mod data { weight.saturating_add(T::DbWeight::get().writes(1)); } - // check and migrate `AuthorizedAliasesMap` - let aliases_to_migrate = AuthorizedAliasesMap::::iter().filter_map(|(id, data)| { + // check and migrate `AuthorizedAliases` + let aliases_to_migrate = AuthorizedAliases::::iter().filter_map(|(id, data)| { weight.saturating_add(T::DbWeight::get().reads(1)); match (&id, &data).try_migrate(required_xcm_version) { Ok(Some((new_id, new_data))) => Some((id, new_id, new_data)), @@ -379,7 +379,7 @@ pub mod data { ?id, ?data, ?required_xcm_version, - "`AuthorizedAliasesMap` cannot be migrated!" + "`AuthorizedAliases` cannot be migrated!" ); None }, @@ -391,10 +391,10 @@ pub mod data { target: LOG_TARGET, ?new_id, ?new_data, - "Migrating `AuthorizedAliasesMap`" + "Migrating `AuthorizedAliases`" ); - AuthorizedAliasesMap::::remove(old_id); - AuthorizedAliasesMap::::insert(new_id, new_data); + AuthorizedAliases::::remove(old_id); + AuthorizedAliases::::insert(new_id, new_data); count = count + 1; } // two writes per key, one to remove old entry, one to write new entry diff --git a/prdoc/pr_6336.prdoc b/prdoc/pr_6336.prdoc index dec27cf18f22..5edf7ed01b22 100644 --- a/prdoc/pr_6336.prdoc +++ b/prdoc/pr_6336.prdoc @@ -16,9 +16,9 @@ doc: - audience: Runtime Dev description: | - Added `AuthorizedAliases` type exposed by `pallet-xcm`, that acts as a filter for explicitly authorized + Added `AuthorizedAliasers` type exposed by `pallet-xcm`, that acts as a filter for explicitly authorized aliases using `pallet-xcm::add_authorized_alias()` and `pallet-xcm::remove_authorized_alias()`. - Runtime developers can simply plug this `pallet-xcm::AuthorizedAliases` type in their runtime's `XcmConfig`, + Runtime developers can simply plug this `pallet-xcm::AuthorizedAliasers` type in their runtime's `XcmConfig`, specifically in `::Aliasers`. crates: From a606607344f688aeed2912bffbf233654cadc6f0 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Tue, 12 Nov 2024 14:27:01 +0200 Subject: [PATCH 20/21] pallet-xcm: add expiry to authorized aliases --- .../assets/asset-hub-westend/tests/tests.rs | 6 +- polkadot/xcm/pallet-xcm/src/benchmarking.rs | 26 ++--- polkadot/xcm/pallet-xcm/src/lib.rs | 97 ++++++++++++++++--- polkadot/xcm/pallet-xcm/src/migration.rs | 42 ++++---- polkadot/xcm/pallet-xcm/src/tests/mod.rs | 4 +- 5 files changed, 126 insertions(+), 49 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index 23bec5016832..e64a365ca5bd 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -987,7 +987,8 @@ fn authorized_aliases_work() { // Alice explicitly authorizes `alice_on_sibling_para` to alias her local account assert_ok!(PolkadotXcm::add_authorized_alias( RuntimeHelper::origin_of(alice.clone()), - Box::new(alice_on_sibling_para.clone().into()) + Box::new(alice_on_sibling_para.clone().into()), + None )); // `alice_on_sibling_para` now explicitly allowed to alias into `local_alice` @@ -1006,7 +1007,8 @@ fn authorized_aliases_work() { // Alice explicitly authorizes `alice_on_relay` to alias her local account assert_ok!(PolkadotXcm::add_authorized_alias( RuntimeHelper::origin_of(alice.clone()), - Box::new(alice_on_relay.clone().into()) + Box::new(alice_on_relay.clone().into()), + None )); // Now both `alice_on_relay` and `alice_on_sibling_para` can alias into her local // account diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index 69d710a35d4b..0e0f50e7cc7d 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -276,7 +276,7 @@ benchmarks! { let loc = VersionedLocation::from(Location::from(Parent)); SupportedVersion::::insert(old_version, loc, old_version); }: { - crate::Pallet::::check_xcm_version_change(VersionMigrationStage::MigrateSupportedVersion, Weight::zero()); + crate::Pallet::::lazy_migration(VersionMigrationStage::MigrateSupportedVersion, Weight::zero()); } migrate_version_notifiers { @@ -284,7 +284,7 @@ benchmarks! { let loc = VersionedLocation::from(Location::from(Parent)); VersionNotifiers::::insert(old_version, loc, 0); }: { - crate::Pallet::::check_xcm_version_change(VersionMigrationStage::MigrateVersionNotifiers, Weight::zero()); + crate::Pallet::::lazy_migration(VersionMigrationStage::MigrateVersionNotifiers, Weight::zero()); } already_notified_target { @@ -295,7 +295,7 @@ benchmarks! { let current_version = T::AdvertisedXcmVersion::get(); VersionNotifyTargets::::insert(current_version, loc, (0, Weight::zero(), current_version)); }: { - crate::Pallet::::check_xcm_version_change(VersionMigrationStage::NotifyCurrentTargets(None), Weight::zero()); + crate::Pallet::::lazy_migration(VersionMigrationStage::NotifyCurrentTargets(None), Weight::zero()); } notify_current_targets { @@ -307,7 +307,7 @@ benchmarks! { let old_version = current_version - 1; VersionNotifyTargets::::insert(current_version, loc, (0, Weight::zero(), old_version)); }: { - crate::Pallet::::check_xcm_version_change(VersionMigrationStage::NotifyCurrentTargets(None), Weight::zero()); + crate::Pallet::::lazy_migration(VersionMigrationStage::NotifyCurrentTargets(None), Weight::zero()); } notify_target_migration_fail { @@ -323,7 +323,7 @@ benchmarks! { let current_version = T::AdvertisedXcmVersion::get(); VersionNotifyTargets::::insert(current_version, bad_location, (0, Weight::zero(), current_version)); }: { - crate::Pallet::::check_xcm_version_change(VersionMigrationStage::MigrateAndNotifyOldTargets, Weight::zero()); + crate::Pallet::::lazy_migration(VersionMigrationStage::MigrateAndNotifyOldTargets, Weight::zero()); } migrate_version_notify_targets { @@ -332,7 +332,7 @@ benchmarks! { let loc = VersionedLocation::from(Location::from(Parent)); VersionNotifyTargets::::insert(old_version, loc, (0, Weight::zero(), current_version)); }: { - crate::Pallet::::check_xcm_version_change(VersionMigrationStage::MigrateAndNotifyOldTargets, Weight::zero()); + crate::Pallet::::lazy_migration(VersionMigrationStage::MigrateAndNotifyOldTargets, Weight::zero()); } migrate_and_notify_old_targets { @@ -343,7 +343,7 @@ benchmarks! { let old_version = T::AdvertisedXcmVersion::get() - 1; VersionNotifyTargets::::insert(old_version, loc, (0, Weight::zero(), old_version)); }: { - crate::Pallet::::check_xcm_version_change(VersionMigrationStage::MigrateAndNotifyOldTargets, Weight::zero()); + crate::Pallet::::lazy_migration(VersionMigrationStage::MigrateAndNotifyOldTargets, Weight::zero()); } new_query { @@ -389,27 +389,29 @@ benchmarks! { let origin = RawOrigin::Root; let origin_location: VersionedLocation = T::ExecuteXcmOrigin::try_origin(origin.clone().into()) .map_err(|_| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?.into(); - let mut existing_aliases = BoundedVec::::new(); + let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max-1` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get() { let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]).into(); - existing_aliases.try_push(alias).unwrap() + let aliaser = OriginAliaser { location: alias, expiry: None }; + existing_aliases.try_push(aliaser).unwrap() } AuthorizedAliases::::insert(&origin_location, existing_aliases); // now benchmark adding new alias let aliaser: VersionedLocation = Location::new(1, [Parachain(1234), AccountId32 { network: None, id: [42_u8; 32] }]).into(); - }: _(origin, Box::new(aliaser)) + }: _(origin, Box::new(aliaser), None) remove_authorized_alias { let origin = RawOrigin::Root; let origin_location: VersionedLocation = T::ExecuteXcmOrigin::try_origin(origin.clone().into()) .map_err(|_| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?.into(); - let mut existing_aliases = BoundedVec::::new(); + let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get()+1 { let alias = Location::new(1, [Parachain(i), AccountId32 { network: None, id: [42_u8; 32] }]).into(); - existing_aliases.try_push(alias).unwrap() + let aliaser = OriginAliaser { location: alias, expiry: None }; + existing_aliases.try_push(aliaser).unwrap() } AuthorizedAliases::::insert(&origin_location, existing_aliases); // now benchmark removing an alias diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 8b4ba937fec6..167c4e20f1c6 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -51,7 +51,7 @@ use sp_runtime::{ AccountIdConversion, BadOrigin, BlakeTwo256, BlockNumberProvider, Dispatchable, Hash, Saturating, Zero, }, - Either, RuntimeDebug, + Either, RuntimeDebug, SaturatedConversion, }; use xcm::{latest::QueryResponseInfo, prelude::*}; use xcm_builder::{ @@ -591,6 +591,9 @@ pub mod pallet { /// Too many locations authorized to alias origin. #[codec(index = 25)] TooManyAuthorizedAliases, + /// Expiry block number is in the past. + #[codec(index = 26)] + ExpiresInPast, } impl From for Error { @@ -649,6 +652,15 @@ pub mod pallet { MigrateVersionNotifiers, NotifyCurrentTargets(Option>), MigrateAndNotifyOldTargets, + RemoveExpiredAliasAuthorizations, + } + + /// Entry of an authorized aliaser for a local origin. The aliaser `location` is only authorized + /// until its inner `expiry` block number. + #[derive(Clone, Encode, Decode, Debug, Eq, PartialEq, Ord, PartialOrd, TypeInfo)] + pub(crate) struct OriginAliaser { + pub(crate) location: VersionedLocation, + pub(crate) expiry: Option, } impl Default for VersionMigrationStage { @@ -811,13 +823,14 @@ pub mod pallet { pub(crate) type RecordedXcm = StorageValue<_, Xcm<()>>; /// Map of authorized aliasers of local origins. Each local location can authorize a list of - /// other locations to alias into it. + /// other locations to alias into it. Each aliaser is only valid until its inner `expiry` + /// block number. #[pallet::storage] pub(super) type AuthorizedAliases = StorageMap< _, Blake2_128Concat, VersionedLocation, - BoundedVec, + BoundedVec, ValueQuery, >; @@ -849,7 +862,7 @@ pub mod pallet { if let Some(migration) = CurrentMigration::::get() { // Consume 10% of block at most let max_weight = T::BlockWeights::get().max_block / 10; - let (w, maybe_migration) = Self::check_xcm_version_change(migration, max_weight); + let (w, maybe_migration) = Self::lazy_migration(migration, max_weight); if maybe_migration.is_none() { Self::deposit_event(Event::VersionMigrationFinished { version: XCM_VERSION }); } @@ -1455,6 +1468,7 @@ pub mod pallet { } /// Authorize another `aliaser` location to alias into the local `origin` making this call. + /// The `aliaser` is only authorized until the provided `expiry` block number. /// /// Usually useful to allow your local account to be aliased into from a remote location /// also under your control (like your account on another chain). @@ -1466,20 +1480,42 @@ pub mod pallet { pub fn add_authorized_alias( origin: OriginFor, aliaser: Box, + expires: Option, ) -> DispatchResult { let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; let aliaser: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; - tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?aliaser); + tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?aliaser, ?expires); ensure!(origin != aliaser, Error::::BadLocation); + if let Some(expiry) = expires { + ensure!( + expiry > frame_system::Pallet::::block_number().saturated_into::(), + Error::::ExpiresInPast + ); + } let versioned_origin = VersionedLocation::from(origin); let versioned_aliaser = VersionedLocation::from(aliaser); let mut authorized_aliases = AuthorizedAliases::::get(&versioned_origin); - if !authorized_aliases.contains(&versioned_aliaser) { + if authorized_aliases + .iter_mut() + .find_map(|aliaser| { + // if the aliaser already exists, just update its expiry block + if aliaser.location == versioned_aliaser { + aliaser.expiry = expires; + Some(()) + } else { + None + } + }) + .is_none() + { + // if the aliaser does not yet exist, add it to the list + let aliaser = OriginAliaser { location: versioned_aliaser, expiry: expires }; authorized_aliases - .try_push(versioned_aliaser) + .try_push(aliaser) .map_err(|_| Error::::TooManyAuthorizedAliases)?; - AuthorizedAliases::::insert(&versioned_origin, authorized_aliases); + // todo: hold storage deposit } + AuthorizedAliases::::insert(&versioned_origin, authorized_aliases); Ok(()) } @@ -1498,8 +1534,11 @@ pub mod pallet { let versioned_to_remove = VersionedLocation::from(to_remove); let mut authorized_aliases = AuthorizedAliases::::get(&versioned_origin); let original_length = authorized_aliases.len(); - authorized_aliases.retain(|alias| versioned_to_remove.ne(alias)); - if original_length != authorized_aliases.len() { + authorized_aliases.retain(|alias| versioned_to_remove.ne(&alias.location)); + if authorized_aliases.is_empty() { + // todo: return storage deposit + AuthorizedAliases::::remove(&versioned_origin); + } else if original_length != authorized_aliases.len() { AuthorizedAliases::::insert(&versioned_origin, authorized_aliases); } Ok(()) @@ -2342,7 +2381,7 @@ impl Pallet { /// Will always make progress, and will do its best not to use much more than `weight_cutoff` /// in doing so. - pub(crate) fn check_xcm_version_change( + pub(crate) fn lazy_migration( mut stage: VersionMigrationStage, weight_cutoff: Weight, ) -> (Weight, Option) { @@ -2495,6 +2534,29 @@ impl Pallet { } } } + stage = RemoveExpiredAliasAuthorizations; + } + if stage == RemoveExpiredAliasAuthorizations { + let block_num = frame_system::Pallet::::block_number().saturated_into::(); + let mut writes = 0; + // need to iterate keys and modify map in separate steps to avoid undefined behavior + let keys: Vec = AuthorizedAliases::::iter_keys().collect(); + weight_used.saturating_add(T::DbWeight::get().reads(keys.len() as u64)); + for key in keys { + let mut aliases = AuthorizedAliases::::get(&key); + let old_len = aliases.len(); + aliases.retain(|aliaser| { + aliaser.expiry.map(|expiry| expiry > block_num).unwrap_or(true) + }); + if aliases.is_empty() { + AuthorizedAliases::::remove(&key); + writes = writes + 1; + } else if aliases.len() != old_len { + AuthorizedAliases::::insert(key, aliases); + writes = writes + 1; + } + } + weight_used.saturating_add(T::DbWeight::get().writes(writes)); } (weight_used, None) } @@ -3519,7 +3581,18 @@ impl + Clone, T: Config> ContainsPair for Autho let origin: VersionedLocation = origin.clone().into(); let target: VersionedLocation = target.clone().into(); tracing::trace!(target: "xcm::pallet_xcm::AuthorizedAliasers::contains", ?origin, ?target); - AuthorizedAliases::::get(&target).contains(&origin) + // return true if the `origin` has been explicitly authorized by `target` as aliaser, and + // the authorization has not expired + AuthorizedAliases::::get(&target) + .iter() + .find(|&aliaser| { + let current_block = + frame_system::Pallet::::block_number().saturated_into::(); + let not_expired = + aliaser.expiry.map(|expiry| expiry < current_block).unwrap_or(true); + aliaser.location == origin && not_expired + }) + .is_some() } } diff --git a/polkadot/xcm/pallet-xcm/src/migration.rs b/polkadot/xcm/pallet-xcm/src/migration.rs index fafef2b23d86..82df2870e117 100644 --- a/polkadot/xcm/pallet-xcm/src/migration.rs +++ b/polkadot/xcm/pallet-xcm/src/migration.rs @@ -171,12 +171,14 @@ pub mod data { } /// Implementation of `NeedsMigration` for `AuthorizedAliases` data. - impl> NeedsMigration for (&VersionedLocation, &BoundedVec) { - type MigratedData = (VersionedLocation, BoundedVec); + impl, T: frame_system::Config> NeedsMigration + for (&VersionedLocation, &BoundedVec, PhantomData) + { + type MigratedData = (VersionedLocation, BoundedVec); fn needs_migration(&self, _: XcmVersion) -> bool { self.0.identify_version() < XCM_VERSION || - self.1.iter().any(|alias| alias.identify_version() < XCM_VERSION) + self.1.iter().any(|alias| alias.location.identify_version() < XCM_VERSION) } fn try_migrate(self, _: XcmVersion) -> Result, ()> { @@ -184,6 +186,7 @@ pub mod data { return Ok(None) } + let block_num = frame_system::Pallet::::block_number().saturated_into::(); let key = if self.0.identify_version() < XCM_VERSION { let Ok(converted_key) = self.0.clone().into_version(XCM_VERSION) else { return Err(()) @@ -192,24 +195,19 @@ pub mod data { } else { self.0.clone() }; - let mut aliases = BoundedVec::::new(); + let mut new_aliases = BoundedVec::::new(); for alias in self.1 { - if aliases - .try_push(if alias.identify_version() < XCM_VERSION { - let Ok(new_alias) = alias.clone().into_version(XCM_VERSION) else { - return Err(()) - }; - new_alias - } else { - alias.clone() - }) - .is_err() - { - return Err(()) - }; + // skip expired aliases + if alias.expiry.map(|expiry| expiry <= block_num).unwrap_or(false) { + continue + } + let OriginAliaser { mut location, expiry } = alias.clone(); + if location.identify_version() < XCM_VERSION { + location = location.into_version(XCM_VERSION)?; + } + new_aliases.try_push(OriginAliaser { location, expiry }).map_err(|_| ())?; } - - Ok(Some((key, aliases))) + Ok(Some((key, new_aliases))) } } @@ -370,7 +368,7 @@ pub mod data { // check and migrate `AuthorizedAliases` let aliases_to_migrate = AuthorizedAliases::::iter().filter_map(|(id, data)| { weight.saturating_add(T::DbWeight::get().reads(1)); - match (&id, &data).try_migrate(required_xcm_version) { + match (&id, &data, PhantomData::).try_migrate(required_xcm_version) { Ok(Some((new_id, new_data))) => Some((id, new_id, new_data)), Ok(None) => None, Err(_) => { @@ -394,7 +392,9 @@ pub mod data { "Migrating `AuthorizedAliases`" ); AuthorizedAliases::::remove(old_id); - AuthorizedAliases::::insert(new_id, new_data); + if !new_data.is_empty() { + AuthorizedAliases::::insert(new_id, new_data); + } count = count + 1; } // two writes per key, one to remove old entry, one to write new entry diff --git a/polkadot/xcm/pallet-xcm/src/tests/mod.rs b/polkadot/xcm/pallet-xcm/src/tests/mod.rs index 350530f7711f..9dd42999774f 100644 --- a/polkadot/xcm/pallet-xcm/src/tests/mod.rs +++ b/polkadot/xcm/pallet-xcm/src/tests/mod.rs @@ -1058,7 +1058,7 @@ fn subscription_side_upgrades_work_with_multistage_notify() { let mut counter = 0; while let Some(migration) = maybe_migration.take() { counter += 1; - let (_, m) = XcmPallet::check_xcm_version_change(migration, Weight::zero()); + let (_, m) = XcmPallet::lazy_migration(migration, Weight::zero()); maybe_migration = m; } assert_eq!(counter, 4); @@ -1211,7 +1211,7 @@ fn multistage_migration_works() { let mut weight_used = Weight::zero(); while let Some(migration) = maybe_migration.take() { counter += 1; - let (w, m) = XcmPallet::check_xcm_version_change(migration, Weight::zero()); + let (w, m) = XcmPallet::lazy_migration(migration, Weight::zero()); maybe_migration = m; weight_used.saturating_accrue(w); } From b7ef64ca902d4eb5d67fc823652251ab42134c65 Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Tue, 12 Nov 2024 20:24:06 +0200 Subject: [PATCH 21/21] pallet-xcm: add storage deposit for authorized aliases --- .../asset-hub-westend/src/xcm_config.rs | 21 +- polkadot/xcm/pallet-xcm/src/benchmarking.rs | 30 ++- polkadot/xcm/pallet-xcm/src/lib.rs | 189 ++++++++++++------ polkadot/xcm/pallet-xcm/src/migration.rs | 30 ++- polkadot/xcm/pallet-xcm/src/mock.rs | 19 +- 5 files changed, 194 insertions(+), 95 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index 647356fd2bec..34aa50bcb029 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -15,10 +15,10 @@ use super::{ AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, BaseDeliveryFee, - CollatorSelection, FeeAssetId, ForeignAssets, ForeignAssetsInstance, ParachainInfo, - ParachainSystem, PolkadotXcm, PoolAssets, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, - ToRococoXcmRouter, TransactionByteFee, TrustBackedAssetsInstance, Uniques, WeightToFee, - XcmpQueue, + CollatorSelection, DepositPerByte, DepositPerItem, FeeAssetId, ForeignAssets, + ForeignAssetsInstance, ParachainInfo, ParachainSystem, PolkadotXcm, PoolAssets, Runtime, + RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, ToRococoXcmRouter, + TransactionByteFee, TrustBackedAssetsInstance, Uniques, WeightToFee, XcmpQueue, }; use assets_common::{ matching::{FromSiblingParachain, IsForeignConcreteAsset, ParentLocation}, @@ -27,8 +27,9 @@ use assets_common::{ use frame_support::{ parameter_types, traits::{ + fungible::HoldConsideration, tokens::imbalance::{ResolveAssetTo, ResolveTo}, - ConstU32, Contains, Equals, Everything, PalletInfoAccess, + ConstU32, Contains, Equals, Everything, LinearStoragePrice, PalletInfoAccess, }, }; use frame_system::EnsureRoot; @@ -510,6 +511,10 @@ pub type XcmRouter = WithUniqueTopic<( >, )>; +parameter_types! { + pub const AuthorizeAliasHoldReason: RuntimeHoldReason = RuntimeHoldReason::PolkadotXcm(pallet_xcm::HoldReason::AuthorizeAlias); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type SendXcmOrigin = EnsureXcmOrigin; @@ -538,6 +543,12 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); + type Consideration = HoldConsideration< + AccountId, + Balances, + AuthorizeAliasHoldReason, + LinearStoragePrice, + >; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index 0e0f50e7cc7d..77555abfcb2e 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -28,7 +28,7 @@ type RuntimeOrigin = ::RuntimeOrigin; pub struct Pallet(crate::Pallet); /// Trait that must be implemented by runtime to be able to benchmark pallet properly. -pub trait Config: crate::Config { +pub trait Config: crate::Config + pallet_balances::Config { /// Helper that ensures successful delivery for extrinsics/benchmarks which need `SendXcm`. type DeliveryHelper: EnsureDelivery; @@ -386,9 +386,16 @@ benchmarks! { }: _>(claim_origin.into(), Box::new(versioned_assets), Box::new(VersionedLocation::from(claim_location))) add_authorized_alias { - let origin = RawOrigin::Root; + let who: T::AccountId = whitelisted_caller(); + let origin = RawOrigin::Signed(who.clone()); let origin_location: VersionedLocation = T::ExecuteXcmOrigin::try_origin(origin.clone().into()) .map_err(|_| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?.into(); + + // Give some multiple of ED + let balance = T::ExistentialDeposit::get() * 10u32.into(); + let _ = + as frame_support::traits::Currency<_>>::make_free_balance_be(&who, balance); + let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max-1` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get() { @@ -396,16 +403,26 @@ benchmarks! { let aliaser = OriginAliaser { location: alias, expiry: None }; existing_aliases.try_push(aliaser).unwrap() } - AuthorizedAliases::::insert(&origin_location, existing_aliases); + let ticket = TicketOf::::new(&who, aliasers_footprint(existing_aliases.len())).unwrap(); + let entry = AuthorizedAliasesEntry { aliasers: existing_aliases, ticket }; + AuthorizedAliases::::insert(&origin_location, entry); + // now benchmark adding new alias let aliaser: VersionedLocation = Location::new(1, [Parachain(1234), AccountId32 { network: None, id: [42_u8; 32] }]).into(); }: _(origin, Box::new(aliaser), None) remove_authorized_alias { - let origin = RawOrigin::Root; + let who: T::AccountId = whitelisted_caller(); + let origin = RawOrigin::Signed(who.clone()); let origin_location: VersionedLocation = T::ExecuteXcmOrigin::try_origin(origin.clone().into()) .map_err(|_| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?.into(); + + // Give some multiple of ED + let balance = T::ExistentialDeposit::get() * 10u32.into(); + let _ = + as frame_support::traits::Currency<_>>::make_free_balance_be(&who, balance); + let mut existing_aliases = BoundedVec::::new(); // prepopulate list with `max` aliases to benchmark worst case for i in 1..MaxAuthorizedAliases::get()+1 { @@ -413,7 +430,10 @@ benchmarks! { let aliaser = OriginAliaser { location: alias, expiry: None }; existing_aliases.try_push(aliaser).unwrap() } - AuthorizedAliases::::insert(&origin_location, existing_aliases); + let ticket = TicketOf::::new(&who, aliasers_footprint(existing_aliases.len())).unwrap(); + let entry = AuthorizedAliasesEntry { aliasers: existing_aliases, ticket }; + AuthorizedAliases::::insert(&origin_location, entry); + // now benchmark removing an alias let aliaser_to_remove: VersionedLocation = Location::new(1, [Parachain(1), AccountId32 { network: None, id: [42_u8; 32] }]).into(); diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 167c4e20f1c6..7f24d143477d 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -38,8 +38,8 @@ use frame_support::{ }, pallet_prelude::*, traits::{ - Contains, ContainsPair, Currency, Defensive, EnsureOrigin, Get, LockableCurrency, - OriginTrait, WithdrawReasons, + Consideration, Contains, ContainsPair, Currency, Defensive, EnsureOrigin, Footprint, Get, + LockableCurrency, OriginTrait, WithdrawReasons, }, PalletId, }; @@ -194,6 +194,24 @@ impl WeightInfo for TestWeightInfo { } } +/// Entry of an authorized aliaser for a local origin. The aliaser `location` is only authorized +/// until its inner `expiry` block number. +#[derive(Clone, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)] +pub(crate) struct OriginAliaser { + pub(crate) location: VersionedLocation, + pub(crate) expiry: Option, +} + +#[derive(Clone, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)] +pub(crate) struct AuthorizedAliasesEntry> { + pub(crate) aliasers: BoundedVec, + pub(crate) ticket: Ticket, +} + +pub(crate) fn aliasers_footprint(aliasers_count: usize) -> Footprint { + Footprint::from_parts(aliasers_count, OriginAliaser::max_encoded_len()) +} + #[frame_support::pallet] pub mod pallet { use super::*; @@ -211,6 +229,7 @@ pub mod pallet { /// support. pub const CurrentXcmVersion: u32 = XCM_VERSION; + #[derive(Debug, TypeInfo)] /// The maximum number of distinct locations allowed as authorized aliases for a local origin. pub const MaxAuthorizedAliases: u32 = 10; } @@ -224,6 +243,7 @@ pub mod pallet { pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; + pub type TicketOf = ::Consideration; #[pallet::config] /// The module configuration trait. @@ -238,6 +258,9 @@ pub mod pallet { /// The `Asset` matcher for `Currency`. type CurrencyMatcher: MatchesFungible>; + /// A means of providing some cost while data is stored on-chain. + type Consideration: Consideration; + /// Required origin for sending XCM messages. If successful, it resolves to `Location` /// which exists as an interior location within this chain's XCM context. type SendXcmOrigin: EnsureOrigin<::RuntimeOrigin, Success = Location>; @@ -531,6 +554,13 @@ pub mod pallet { } } + /// A reason for this pallet placing a hold on funds. + #[pallet::composite_enum] + pub enum HoldReason { + /// The funds are held as storage deposit for an authorized alias. + AuthorizeAlias, + } + #[pallet::error] pub enum Error { /// The desired destination was unreachable, generally because there is a no way of routing @@ -615,7 +645,7 @@ pub mod pallet { } /// The status of a query. - #[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)] + #[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)] pub enum QueryStatus { /// The query was sent but no response has yet been received. Pending { @@ -655,14 +685,6 @@ pub mod pallet { RemoveExpiredAliasAuthorizations, } - /// Entry of an authorized aliaser for a local origin. The aliaser `location` is only authorized - /// until its inner `expiry` block number. - #[derive(Clone, Encode, Decode, Debug, Eq, PartialEq, Ord, PartialOrd, TypeInfo)] - pub(crate) struct OriginAliaser { - pub(crate) location: VersionedLocation, - pub(crate) expiry: Option, - } - impl Default for VersionMigrationStage { fn default() -> Self { Self::MigrateSupportedVersion @@ -830,8 +852,8 @@ pub mod pallet { _, Blake2_128Concat, VersionedLocation, - BoundedVec, - ValueQuery, + AuthorizedAliasesEntry, MaxAuthorizedAliases>, + OptionQuery, >; #[pallet::genesis_config] @@ -1482,40 +1504,47 @@ pub mod pallet { aliaser: Box, expires: Option, ) -> DispatchResult { - let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; + let signed_origin = ensure_signed(origin.clone())?; + let origin_location: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; let aliaser: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; - tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?aliaser, ?expires); - ensure!(origin != aliaser, Error::::BadLocation); + tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin_location, ?aliaser, ?expires); + ensure!(origin_location != aliaser, Error::::BadLocation); if let Some(expiry) = expires { ensure!( expiry > frame_system::Pallet::::block_number().saturated_into::(), Error::::ExpiresInPast ); } - let versioned_origin = VersionedLocation::from(origin); + let versioned_origin = VersionedLocation::from(origin_location); let versioned_aliaser = VersionedLocation::from(aliaser); - let mut authorized_aliases = AuthorizedAliases::::get(&versioned_origin); - if authorized_aliases - .iter_mut() - .find_map(|aliaser| { + + let entry = if let Some(entry) = AuthorizedAliases::::get(&versioned_origin) { + // entry already exists, update it + let (mut aliasers, mut ticket) = (entry.aliasers, entry.ticket); + if let Some(aliaser) = + aliasers.iter_mut().find(|aliaser| aliaser.location == versioned_aliaser) + { // if the aliaser already exists, just update its expiry block - if aliaser.location == versioned_aliaser { - aliaser.expiry = expires; - Some(()) - } else { - None - } - }) - .is_none() - { - // if the aliaser does not yet exist, add it to the list + aliaser.expiry = expires; + } else { + // if it doesn't, we try to add it + let aliaser = OriginAliaser { location: versioned_aliaser, expiry: expires }; + aliasers.try_push(aliaser).map_err(|_| Error::::TooManyAuthorizedAliases)?; + // we try to update the ticket (the storage deposit) + ticket = ticket.update(&signed_origin, aliasers_footprint(aliasers.len()))?; + } + AuthorizedAliasesEntry { aliasers, ticket } + } else { + // add new entry with its first alias + let ticket = TicketOf::::new(&signed_origin, aliasers_footprint(1))?; let aliaser = OriginAliaser { location: versioned_aliaser, expiry: expires }; - authorized_aliases - .try_push(aliaser) - .map_err(|_| Error::::TooManyAuthorizedAliases)?; - // todo: hold storage deposit - } - AuthorizedAliases::::insert(&versioned_origin, authorized_aliases); + let mut aliasers = BoundedVec::::new(); + aliasers.try_push(aliaser).map_err(|_| Error::::TooManyAuthorizedAliases)?; + AuthorizedAliasesEntry { aliasers, ticket } + }; + + // write to storage + AuthorizedAliases::::insert(&versioned_origin, entry); Ok(()) } @@ -1526,20 +1555,28 @@ pub mod pallet { origin: OriginFor, aliaser: Box, ) -> DispatchResult { - let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; + let signed_origin = ensure_signed(origin.clone())?; + let origin_location: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?; let to_remove: Location = (*aliaser).try_into().map_err(|()| Error::::BadVersion)?; - tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?to_remove); - ensure!(origin != to_remove, Error::::BadLocation); - let versioned_origin = VersionedLocation::from(origin); + tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin_location, ?to_remove); + ensure!(origin_location != to_remove, Error::::BadLocation); + let versioned_origin = VersionedLocation::from(origin_location); let versioned_to_remove = VersionedLocation::from(to_remove); - let mut authorized_aliases = AuthorizedAliases::::get(&versioned_origin); - let original_length = authorized_aliases.len(); - authorized_aliases.retain(|alias| versioned_to_remove.ne(&alias.location)); - if authorized_aliases.is_empty() { - // todo: return storage deposit - AuthorizedAliases::::remove(&versioned_origin); - } else if original_length != authorized_aliases.len() { - AuthorizedAliases::::insert(&versioned_origin, authorized_aliases); + if let Some(entry) = AuthorizedAliases::::get(&versioned_origin) { + let (mut aliasers, mut ticket) = (entry.aliasers, entry.ticket); + let old_len = aliasers.len(); + aliasers.retain(|alias| versioned_to_remove.ne(&alias.location)); + let new_len = aliasers.len(); + if new_len > 0 { + // remove entry altogether and return all storage deposit + ticket.drop(&signed_origin)?; + AuthorizedAliases::::remove(&versioned_origin); + } else if old_len != new_len { + // update aliasers and storage deposit + ticket = ticket.update(&signed_origin, aliasers_footprint(new_len))?; + let entry = AuthorizedAliasesEntry { aliasers, ticket }; + AuthorizedAliases::::insert(&versioned_origin, entry); + } } Ok(()) } @@ -2543,17 +2580,32 @@ impl Pallet { let keys: Vec = AuthorizedAliases::::iter_keys().collect(); weight_used.saturating_add(T::DbWeight::get().reads(keys.len() as u64)); for key in keys { - let mut aliases = AuthorizedAliases::::get(&key); - let old_len = aliases.len(); - aliases.retain(|aliaser| { - aliaser.expiry.map(|expiry| expiry > block_num).unwrap_or(true) - }); - if aliases.is_empty() { - AuthorizedAliases::::remove(&key); - writes = writes + 1; - } else if aliases.len() != old_len { - AuthorizedAliases::::insert(key, aliases); - writes = writes + 1; + if let Some(entry) = AuthorizedAliases::::get(&key) { + let (mut aliases, ticket) = (entry.aliasers, entry.ticket); + let Some(who) = Location::try_from(key.clone()) + .ok() + .and_then(|key| T::SovereignAccountOf::convert_location(&key)) + else { + continue + }; + let old_len = aliases.len(); + aliases.retain(|aliaser| { + aliaser.expiry.map(|expiry| expiry > block_num).unwrap_or(true) + }); + let new_len = aliases.len(); + if new_len > 0 { + // remove entry altogether and return all storage deposit + let _ = ticket.drop(&who); + AuthorizedAliases::::remove(&key); + writes = writes + 2; + } else if old_len != new_len { + // update aliasers and storage deposit + if let Ok(ticket) = ticket.update(&who, aliasers_footprint(new_len)) { + let entry = AuthorizedAliasesEntry { aliasers: aliases, ticket }; + AuthorizedAliases::::insert(&key, entry); + writes = writes + 2; + } + } } } weight_used.saturating_add(T::DbWeight::get().writes(writes)); @@ -3584,15 +3636,20 @@ impl + Clone, T: Config> ContainsPair for Autho // return true if the `origin` has been explicitly authorized by `target` as aliaser, and // the authorization has not expired AuthorizedAliases::::get(&target) - .iter() - .find(|&aliaser| { + .map(|authorized| { let current_block = frame_system::Pallet::::block_number().saturated_into::(); - let not_expired = - aliaser.expiry.map(|expiry| expiry < current_block).unwrap_or(true); - aliaser.location == origin && not_expired + authorized + .aliasers + .iter() + .find(|&aliaser| { + let not_expired = + aliaser.expiry.map(|expiry| expiry < current_block).unwrap_or(true); + not_expired && aliaser.location == origin + }) + .is_some() }) - .is_some() + .unwrap_or(false) } } diff --git a/polkadot/xcm/pallet-xcm/src/migration.rs b/polkadot/xcm/pallet-xcm/src/migration.rs index 82df2870e117..f43719ef9b99 100644 --- a/polkadot/xcm/pallet-xcm/src/migration.rs +++ b/polkadot/xcm/pallet-xcm/src/migration.rs @@ -171,14 +171,17 @@ pub mod data { } /// Implementation of `NeedsMigration` for `AuthorizedAliases` data. - impl, T: frame_system::Config> NeedsMigration - for (&VersionedLocation, &BoundedVec, PhantomData) + impl, T: Config> NeedsMigration + for (&VersionedLocation, AuthorizedAliasesEntry, M>, PhantomData) { - type MigratedData = (VersionedLocation, BoundedVec); + type MigratedData = (VersionedLocation, AuthorizedAliasesEntry, M>); fn needs_migration(&self, _: XcmVersion) -> bool { self.0.identify_version() < XCM_VERSION || - self.1.iter().any(|alias| alias.location.identify_version() < XCM_VERSION) + self.1 + .aliasers + .iter() + .any(|alias| alias.location.identify_version() < XCM_VERSION) } fn try_migrate(self, _: XcmVersion) -> Result, ()> { @@ -186,7 +189,6 @@ pub mod data { return Ok(None) } - let block_num = frame_system::Pallet::::block_number().saturated_into::(); let key = if self.0.identify_version() < XCM_VERSION { let Ok(converted_key) = self.0.clone().into_version(XCM_VERSION) else { return Err(()) @@ -195,19 +197,18 @@ pub mod data { } else { self.0.clone() }; + let mut new_aliases = BoundedVec::::new(); - for alias in self.1 { - // skip expired aliases - if alias.expiry.map(|expiry| expiry <= block_num).unwrap_or(false) { - continue - } + let (aliasers, ticket) = (self.1.aliasers, self.1.ticket); + for alias in aliasers { let OriginAliaser { mut location, expiry } = alias.clone(); if location.identify_version() < XCM_VERSION { location = location.into_version(XCM_VERSION)?; } new_aliases.try_push(OriginAliaser { location, expiry }).map_err(|_| ())?; } - Ok(Some((key, new_aliases))) + + Ok(Some((key, AuthorizedAliasesEntry { aliasers: new_aliases, ticket }))) } } @@ -368,14 +369,13 @@ pub mod data { // check and migrate `AuthorizedAliases` let aliases_to_migrate = AuthorizedAliases::::iter().filter_map(|(id, data)| { weight.saturating_add(T::DbWeight::get().reads(1)); - match (&id, &data, PhantomData::).try_migrate(required_xcm_version) { + match (&id, data, PhantomData::).try_migrate(required_xcm_version) { Ok(Some((new_id, new_data))) => Some((id, new_id, new_data)), Ok(None) => None, Err(_) => { tracing::error!( target: LOG_TARGET, ?id, - ?data, ?required_xcm_version, "`AuthorizedAliases` cannot be migrated!" ); @@ -392,9 +392,7 @@ pub mod data { "Migrating `AuthorizedAliases`" ); AuthorizedAliases::::remove(old_id); - if !new_data.is_empty() { - AuthorizedAliases::::insert(new_id, new_data); - } + AuthorizedAliases::::insert(new_id, new_data); count = count + 1; } // two writes per key, one to remove old entry, one to write new entry diff --git a/polkadot/xcm/pallet-xcm/src/mock.rs b/polkadot/xcm/pallet-xcm/src/mock.rs index 604f1e100e21..e7a756add549 100644 --- a/polkadot/xcm/pallet-xcm/src/mock.rs +++ b/polkadot/xcm/pallet-xcm/src/mock.rs @@ -19,8 +19,8 @@ pub use core::cell::RefCell; use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{ - AsEnsureOriginWithArg, ConstU128, ConstU32, Contains, Equals, Everything, EverythingBut, - Nothing, + fungible::HoldConsideration, AsEnsureOriginWithArg, ConstU128, ConstU32, Contains, Equals, + Everything, EverythingBut, Footprint, Nothing, }, weights::Weight, }; @@ -28,7 +28,10 @@ use frame_system::EnsureRoot; use polkadot_parachain_primitives::primitives::Id as ParaId; use polkadot_runtime_parachains::origin; use sp_core::H256; -use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; +use sp_runtime::{ + traits::{Convert, IdentityLookup}, + AccountId32, BuildStorage, +}; use xcm::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, @@ -524,6 +527,14 @@ pub type LocalOriginToLocation = SignedToAccountId32 for ConvertDeposit { + fn convert(a: Footprint) -> u128 { + (a.count * 2 + a.size) as u128 + } } pub struct XcmTeleportFiltered; @@ -558,6 +569,8 @@ impl pallet_xcm::Config for Test { type MaxRemoteLockConsumers = frame_support::traits::ConstU32<0>; type RemoteLockConsumerIdentifier = (); type WeightInfo = TestWeightInfo; + type Consideration = + HoldConsideration; } impl origin::Config for Test {}