From 4f4596404c2cdd144cbd629585be35eb1bfc12fc Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Wed, 10 Jan 2024 03:06:30 +0530 Subject: [PATCH 01/15] feat: add generic xcm benchmarks wrapper --- Cargo.lock | 26 ++ Cargo.toml | 2 + .../src/generic/benchmarking.rs | 193 +++++++++++++++ .../astar-xcm-benchmarks/src/generic/mock.rs | 230 ++++++++++++++++++ .../astar-xcm-benchmarks/src/generic/mod.rs | 36 +++ pallets/astar-xcm-benchmarks/src/lib.rs | 32 +++ pallets/astar-xcm-benchmarks/src/mock.rs | 92 +++++++ 7 files changed, 611 insertions(+) create mode 100644 pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs create mode 100644 pallets/astar-xcm-benchmarks/src/generic/mock.rs create mode 100644 pallets/astar-xcm-benchmarks/src/generic/mod.rs create mode 100644 pallets/astar-xcm-benchmarks/src/lib.rs create mode 100644 pallets/astar-xcm-benchmarks/src/mock.rs diff --git a/Cargo.lock b/Cargo.lock index 7eb99fcf53..caa6bbb7b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -648,6 +648,30 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "astar-xcm-benchmarks" +version = "0.1.0" +dependencies = [ + "astar-primitives", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-assets", + "pallet-balances", + "pallet-xcm-benchmarks", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", + "xcm-builder", + "xcm-executor", +] + [[package]] name = "async-channel" version = "1.9.0" @@ -13141,6 +13165,7 @@ version = "5.28.0" dependencies = [ "array-bytes 6.1.0", "astar-primitives", + "astar-xcm-benchmarks", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -13219,6 +13244,7 @@ dependencies = [ "pallet-vesting", "pallet-xc-asset-config", "pallet-xcm", + "pallet-xcm-benchmarks", "pallet-xvm", "parachain-info", "parity-scale-codec", diff --git a/Cargo.toml b/Cargo.toml index 2e5b80db4a..736c61ccfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -255,6 +255,7 @@ polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43", default-features = false } xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false } pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false } +pallet-xcm-benchmarks = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false } xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false } @@ -282,6 +283,7 @@ pallet-ethereum-checked = { path = "./pallets/ethereum-checked", default-feature pallet-inflation = { path = "./pallets/inflation", default-features = false } pallet-dynamic-evm-base-fee = { path = "./pallets/dynamic-evm-base-fee", default-features = false } pallet-unified-accounts = { path = "./pallets/unified-accounts", default-features = false } +astar-xcm-benchmarks = { path = "./pallets/astar-xcm-benchmarks", default-features = false } dapp-staking-v3-runtime-api = { path = "./pallets/dapp-staking-v3/rpc/runtime-api", default-features = false } diff --git a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs new file mode 100644 index 0000000000..fb702ab447 --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs @@ -0,0 +1,193 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +use super::*; +use frame_benchmarking::v2::*; +// use frame_benchmarking::{benchmarks, BenchmarkError, BenchmarkResult}; +use frame_support::dispatch::Weight; +use pallet_xcm_benchmarks::{new_executor, XcmCallOf}; +use sp_std::vec; +use sp_std::vec::Vec; +use xcm::latest::prelude::*; + +#[benchmarks] +mod benchmarks { + use super::*; + + /// We need re-write buy_execution benchmark becuase our runtime + /// needs 1 additional DB read (XcAssetConfig) for fetching unit per sec + /// for a fungible asset. The upstream benchmark use native assets thus + /// won't accout for it. + #[benchmark] + fn buy_execution() -> Result<(), BenchmarkError> { + let holding = T::worst_case_holding(0).into(); + + let mut executor = new_executor::(Default::default()); + executor.set_holding(holding); + + // A fungible asset + let fee_asset = Concrete(MultiLocation::parent()); + + let instruction = Instruction::>::BuyExecution { + fees: (fee_asset, 100_000_000u128).into(), // should be something inside of holding + weight_limit: WeightLimit::Unlimited, + }; + + let xcm = Xcm(vec![instruction]); + + #[block] + { + executor.bench_process(xcm)?; + } + // The completion of execution above is enough to validate this is completed. + Ok(()) + } + + /// Re-write as upstream one has hardcoded system pallet index as 1 whereas our runtimes + /// uses index 10. + #[benchmark] + fn expect_pallet() -> Result<(), BenchmarkError> { + let mut executor = new_executor::(Default::default()); + + let instruction = Instruction::ExpectPallet { + // used index 10 for our runtimes + index: 10, + name: b"System".to_vec(), + module_name: b"frame_system".to_vec(), + crate_major: 4, + min_crate_minor: 0, + }; + let xcm = Xcm(vec![instruction]); + + #[block] + { + executor.bench_process(xcm)?; + } + Ok(()) + } + + #[benchmark] + fn exchange_asset() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + #[benchmark] + fn export_message() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + #[benchmark] + fn lock_asset() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + #[benchmark] + fn unlock_asset() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + #[benchmark] + fn note_unlockable() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + #[benchmark] + fn request_unlock() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + #[benchmark] + fn universal_origin() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + impl_benchmark_test_suite!( + Pallet, + crate::generic::mock::new_test_ext(), + crate::generic::mock::Test + ); +} + +pub struct XcmGenericBenchmarks(sp_std::marker::PhantomData); +// Benchmarks wrapper +impl frame_benchmarking::Benchmarking for XcmGenericBenchmarks { + fn benchmarks(extra: bool) -> Vec { + // all the generic xcm benchmarks + use pallet_xcm_benchmarks::generic::Pallet as PalletXcmGenericBench; + PalletXcmGenericBench::::benchmarks(extra) + } + fn run_benchmark( + extrinsic: &[u8], + c: &[(frame_benchmarking::BenchmarkParameter, u32)], + whitelist: &[frame_benchmarking::TrackedStorageKey], + verify: bool, + internal_repeats: u32, + ) -> Result, frame_benchmarking::BenchmarkError> { + use pallet_xcm_benchmarks::generic::Pallet as PalletXcmGenericBench; + + use crate::generic::Pallet as AstarXcmGenericBench; + if AstarXcmGenericBench::::benchmarks(true) + .iter() + .any(|x| x.name == extrinsic) + { + AstarXcmGenericBench::::run_benchmark( + extrinsic, + c, + whitelist, + verify, + internal_repeats, + ) + } else { + PalletXcmGenericBench::::run_benchmark( + extrinsic, + c, + whitelist, + verify, + internal_repeats, + ) + } + } +} diff --git a/pallets/astar-xcm-benchmarks/src/generic/mock.rs b/pallets/astar-xcm-benchmarks/src/generic/mock.rs new file mode 100644 index 0000000000..4f35029c40 --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/generic/mock.rs @@ -0,0 +1,230 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +//! A mock runtime for XCM benchmarking. + +use crate::{generic, mock::*, *}; +use frame_benchmarking::BenchmarkError; +use frame_support::{ + parameter_types, + traits::{Everything, OriginTrait}, +}; +use parity_scale_codec::Decode; +use sp_core::H256; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput}, + BuildStorage, +}; +use xcm::latest::prelude::*; +use xcm_builder::{ + test_utils::{ + Assets, TestAssetExchanger, TestAssetLocker, TestAssetTrap, TestSubscriptionService, + TestUniversalAliases, + }, + AllowUnpaidExecutionFrom, +}; +use xcm_executor::traits::ConvertOrigin; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event} = 10, + PolkadotXcmBenchmarks: pallet_xcm_benchmarks::generic::{Pallet}, + XcmGenericBenchmarks: generic::{Pallet}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub UniversalLocation: InteriorMultiLocation = Here; +} + +impl frame_system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type RuntimeCall = RuntimeCall; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +/// The benchmarks in this pallet should never need an asset transactor to begin with. +pub struct NoAssetTransactor; +impl xcm_executor::traits::TransactAsset for NoAssetTransactor { + fn deposit_asset(_: &MultiAsset, _: &MultiLocation, _: &XcmContext) -> Result<(), XcmError> { + unreachable!(); + } + + fn withdraw_asset( + _: &MultiAsset, + _: &MultiLocation, + _: Option<&XcmContext>, + ) -> Result { + unreachable!(); + } +} + +parameter_types! { + pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; +} + +pub struct XcmConfig; +impl xcm_executor::Config for XcmConfig { + type RuntimeCall = RuntimeCall; + type XcmSender = DevNull; + type AssetTransactor = NoAssetTransactor; + type OriginConverter = AlwaysSignedByDefault; + type IsReserve = AllAssetLocationsPass; + type IsTeleporter = (); + type UniversalLocation = UniversalLocation; + type Barrier = AllowUnpaidExecutionFrom; + type Weigher = xcm_builder::FixedWeightBounds; + type Trader = xcm_builder::FixedRateOfFungible; + type ResponseHandler = DevNull; + type AssetTrap = TestAssetTrap; + type AssetLocker = TestAssetLocker; + type AssetExchanger = TestAssetExchanger; + type AssetClaims = TestAssetTrap; + type SubscriptionService = TestSubscriptionService; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type FeeManager = (); + // No bridges yet... + type MessageExporter = (); + type UniversalAliases = TestUniversalAliases; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; +} + +impl pallet_xcm_benchmarks::Config for Test { + type XcmConfig = XcmConfig; + type AccountIdConverter = AccountIdConverter; + fn valid_destination() -> Result { + let valid_destination: MultiLocation = Junction::AccountId32 { + network: None, + id: [0u8; 32], + } + .into(); + + Ok(valid_destination) + } + fn worst_case_holding(_depositable_count: u32) -> MultiAssets { + crate::mock::mock_worst_case_holding() + } +} + +impl pallet_xcm_benchmarks::generic::Config for Test { + type RuntimeCall = RuntimeCall; + + fn worst_case_response() -> (u64, Response) { + let assets: MultiAssets = (Concrete(Here.into()), 100).into(); + (0, Response::Assets(assets)) + } + + fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn export_message_origin_and_destination( + ) -> Result<(MultiLocation, NetworkId, Junctions), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok(( + Default::default(), + frame_system::Call::remark_with_event { remark: vec![] }.into(), + )) + } + + fn subscribe_origin() -> Result { + Ok(Default::default()) + } + + fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> { + let assets: MultiAssets = (Concrete(Here.into()), 100).into(); + let ticket = MultiLocation { + parents: 0, + interior: X1(GeneralIndex(0)), + }; + Ok((Default::default(), ticket, assets)) + } + + fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) + } +} + +impl generic::Config for Test {} +impl Config for Test {} + +pub fn new_test_ext() -> sp_io::TestExternalities { + let t = GenesisConfig { + ..Default::default() + } + .build_storage() + .unwrap(); + t.into() +} + +pub struct AlwaysSignedByDefault(core::marker::PhantomData); +impl ConvertOrigin for AlwaysSignedByDefault +where + Origin: OriginTrait, + ::AccountId: Decode, +{ + fn convert_origin( + _origin: impl Into, + _kind: OriginKind, + ) -> Result { + Ok(Origin::signed( + ::AccountId::decode(&mut TrailingZeroInput::zeroes()) + .expect("infinite length input; no invalid inputs for type; qed"), + )) + } +} diff --git a/pallets/astar-xcm-benchmarks/src/generic/mod.rs b/pallets/astar-xcm-benchmarks/src/generic/mod.rs new file mode 100644 index 0000000000..6e4e09c44c --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/generic/mod.rs @@ -0,0 +1,36 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +pub use pallet::*; + +pub mod benchmarking; + +#[cfg(test)] +pub mod mock; + +#[frame_support::pallet] +pub mod pallet { + #[pallet::config] + pub trait Config: + frame_system::Config + crate::Config + pallet_xcm_benchmarks::generic::Config + { + } + + #[pallet::pallet] + pub struct Pallet(_); +} diff --git a/pallets/astar-xcm-benchmarks/src/lib.rs b/pallets/astar-xcm-benchmarks/src/lib.rs new file mode 100644 index 0000000000..0046022adb --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/lib.rs @@ -0,0 +1,32 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(feature = "runtime-benchmarks")] +pub mod generic; + +#[cfg(feature = "runtime-benchmarks")] +pub mod fungible; + +#[cfg(test)] +mod mock; + +#[cfg(feature = "runtime-benchmarks")] +/// A base trait for all individual pallets +pub trait Config: frame_system::Config + pallet_xcm_benchmarks::Config {} diff --git a/pallets/astar-xcm-benchmarks/src/mock.rs b/pallets/astar-xcm-benchmarks/src/mock.rs new file mode 100644 index 0000000000..3bac16114f --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/mock.rs @@ -0,0 +1,92 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +use frame_support::{dispatch::Weight, parameter_types, traits::ContainsPair}; +use xcm::latest::prelude::*; + +// An xcm sender/receiver akin to > /dev/null +pub struct DevNull; +impl SendXcm for DevNull { + type Ticket = (); + + fn validate( + _destination: &mut Option, + _message: &mut Option, + ) -> SendResult { + Ok(((), MultiAssets::new())) + } + + fn deliver(_: Self::Ticket) -> Result { + Ok(XcmHash::default()) + } +} + +impl xcm_executor::traits::OnResponse for DevNull { + fn expecting_response(_: &MultiLocation, _: u64, _: Option<&MultiLocation>) -> bool { + false + } + fn on_response( + _: &MultiLocation, + _: u64, + _: Option<&MultiLocation>, + _: Response, + _: Weight, + _: &XcmContext, + ) -> Weight { + Weight::zero() + } +} + +pub struct AccountIdConverter; +impl xcm_executor::traits::Convert for AccountIdConverter { + fn convert(ml: MultiLocation) -> Result { + match ml { + MultiLocation { + parents: 0, + interior: X1(Junction::AccountId32 { id, .. }), + } => Ok(::decode(&mut &*id.to_vec()).unwrap()), + _ => Err(ml), + } + } + + fn reverse(acc: u64) -> Result { + Err(acc) + } +} + +parameter_types! { + pub Ancestry: MultiLocation = Junction::Parachain(101).into(); + pub UnitWeightCost: u64 = 10; + pub WeightPrice: (AssetId, u128, u128) = (Concrete(MultiLocation::parent()), 1_000_000, 1024); +} + +pub struct AllAssetLocationsPass; +impl ContainsPair for AllAssetLocationsPass { + fn contains(_: &MultiAsset, _: &MultiLocation) -> bool { + true + } +} + +#[cfg(feature = "runtime-benchmarks")] +pub fn mock_worst_case_holding() -> MultiAssets { + let assets: Vec = vec![MultiAsset { + id: Concrete(MultiLocation::parent()), + fun: Fungible(u128::MAX), + }]; + assets.into() +} From 292d47f1f2e321787d4b2e3fce66b1d594c653e4 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Wed, 10 Jan 2024 03:07:21 +0530 Subject: [PATCH 02/15] feat: add fungible xcm benchmarks wrapper --- pallets/astar-xcm-benchmarks/Cargo.toml | 66 ++++ .../src/fungible/benchmarking.rs | 212 +++++++++++++ .../astar-xcm-benchmarks/src/fungible/mock.rs | 289 ++++++++++++++++++ .../astar-xcm-benchmarks/src/fungible/mod.rs | 36 +++ 4 files changed, 603 insertions(+) create mode 100644 pallets/astar-xcm-benchmarks/Cargo.toml create mode 100644 pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs create mode 100644 pallets/astar-xcm-benchmarks/src/fungible/mock.rs create mode 100644 pallets/astar-xcm-benchmarks/src/fungible/mod.rs diff --git a/pallets/astar-xcm-benchmarks/Cargo.toml b/pallets/astar-xcm-benchmarks/Cargo.toml new file mode 100644 index 0000000000..1ddf6bc759 --- /dev/null +++ b/pallets/astar-xcm-benchmarks/Cargo.toml @@ -0,0 +1,66 @@ +[package] +name = "astar-xcm-benchmarks" +version = "0.1.0" +description = "Pallet for providing benchmarks for xcm instructions" +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +log = { workspace = true } +serde = { workspace = true, optional = true } + +# Substrate +frame-support = { workspace = true } +frame-system = { workspace = true } +parity-scale-codec = { workspace = true, optional = true, features = ["derive"] } +scale-info = { workspace = true, optional = true, features = ["derive"] } +sp-std = { workspace = true } + +# Polkadot / XCM +pallet-xcm-benchmarks = { workspace = true } +xcm = { workspace = true } +xcm-executor = { workspace = true } + +# Benchmarks +frame-benchmarking = { workspace = true, optional = true } + +# Astar +astar-primitives = { workspace = true } + +[dev-dependencies] +pallet-assets = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +sp-core = { workspace = true, features = ["std"] } +sp-io = { workspace = true, features = ["std"] } +sp-runtime = { workspace = true, features = ["std"] } +xcm-builder = { workspace = true, features = ["std"] } + +[features] +default = ["std"] +std = [ + "astar-primitives/std", + "frame-benchmarking/std", + "frame-support/std", + "frame-system/std", + "pallet-xcm-benchmarks/std", + "parity-scale-codec/std", + "serde", + "sp-std/std", + "xcm/std", +] + +try-runtime = ["frame-support/try-runtime"] + +runtime-benchmarks = [ + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-xcm-benchmarks/runtime-benchmarks", + "parity-scale-codec", + "scale-info", + "xcm-executor/runtime-benchmarks", +] diff --git a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs new file mode 100644 index 0000000000..fd882a9575 --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs @@ -0,0 +1,212 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +use super::*; +use frame_benchmarking::v2::*; +use frame_support::{dispatch::Weight, traits::fungible::Inspect}; +use pallet_xcm_benchmarks::{account_and_location, new_executor, AssetTransactorOf}; +use sp_std::vec; +use sp_std::vec::Vec; +use xcm::latest::prelude::*; +use xcm_executor::traits::{Convert, TransactAsset}; + +#[benchmarks( + where + < + < + T::TransactAsset + as + Inspect + >::Balance + as + TryInto + >::Error: sp_std::fmt::Debug, +)] +mod benchmarks { + use super::*; + + /// Re-write for fungibles assets (like pallet_assets's assets) as + /// upstream benchmark does not take ED (assets's min_balance) into consideration + #[benchmark] + fn transfer_asset() -> Result<(), BenchmarkError> { + let (sender_account, sender_location) = account_and_location::(1); + let asset_to_deposit = T::get_multi_asset(); + // take out ED from given asset + let (asset_to_send, min_balance) = + take_minimum_balance::(asset_to_deposit.clone()).unwrap(); + let assets: MultiAssets = vec![asset_to_send.clone()].into(); + // this xcm doesn't use holding + + let dest_location = T::valid_destination()?; + let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap(); + + >::deposit_asset( + &asset_to_deposit, + &sender_location, + &XcmContext { + origin: Some(sender_location.clone()), + message_hash: [0; 32], + topic: None, + }, + ) + .unwrap(); + + let mut executor = new_executor::(sender_location); + let instruction = Instruction::TransferAsset { + assets, + beneficiary: dest_location, + }; + let xcm = Xcm(vec![instruction]); + + #[block] + { + executor.bench_process(xcm)?; + } + + assert_eq!(T::TransactAsset::balance(&sender_account), min_balance); + assert!(!T::TransactAsset::balance(&dest_account).is_zero()); + Ok(()) + } + + /// Re-write for fungibles assets (like pallet_assets's assets) as + /// upstream benchmark does not take ED (assets's min_balance) into consideration + #[benchmark] + fn transfer_reserve_asset() -> Result<(), BenchmarkError> { + let (sender_account, sender_location) = account_and_location::(1); + let dest_location = T::valid_destination()?; + let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap(); + + let asset_to_deposit = T::get_multi_asset(); + // take out ED from given asset + let (asset_to_send, min_balance) = + take_minimum_balance::(asset_to_deposit.clone()).unwrap(); + let assets: MultiAssets = vec![asset_to_send].into(); + + >::deposit_asset( + &asset_to_deposit, + &sender_location, + &XcmContext { + origin: Some(sender_location.clone()), + message_hash: [0; 32], + topic: None, + }, + ) + .unwrap(); + assert!(T::TransactAsset::balance(&dest_account).is_zero()); + + let mut executor = new_executor::(sender_location); + let instruction = Instruction::TransferReserveAsset { + assets, + dest: dest_location, + xcm: Xcm::new(), + }; + let xcm = Xcm(vec![instruction]); + + #[block] + { + executor.bench_process(xcm)?; + } + + assert_eq!(T::TransactAsset::balance(&sender_account), min_balance); + assert!(!T::TransactAsset::balance(&dest_account).is_zero()); + Ok(()) + } + + #[benchmark] + fn receive_teleported_asset() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + impl_benchmark_test_suite!( + Pallet, + crate::fungible::mock::new_test_ext(), + crate::fungible::mock::Test + ); +} + +pub struct XcmFungibleBenchmarks(sp_std::marker::PhantomData); +// Benchmarks wrapper +impl frame_benchmarking::Benchmarking for XcmFungibleBenchmarks +where + <>::Balance as TryInto>::Error: + sp_std::fmt::Debug, +{ + fn benchmarks(extra: bool) -> Vec { + // all the fungible xcm benchmarks + use pallet_xcm_benchmarks::fungible::Pallet as PalletXcmFungibleBench; + PalletXcmFungibleBench::::benchmarks(extra) + } + fn run_benchmark( + extrinsic: &[u8], + c: &[(frame_benchmarking::BenchmarkParameter, u32)], + whitelist: &[frame_benchmarking::TrackedStorageKey], + verify: bool, + internal_repeats: u32, + ) -> Result, frame_benchmarking::BenchmarkError> { + use pallet_xcm_benchmarks::fungible::Pallet as PalletXcmFungibleBench; + + use crate::fungible::Pallet as AstarXcmFungibleBench; + if AstarXcmFungibleBench::::benchmarks(true) + .iter() + .any(|x| x.name == extrinsic) + { + AstarXcmFungibleBench::::run_benchmark( + extrinsic, + c, + whitelist, + verify, + internal_repeats, + ) + } else { + PalletXcmFungibleBench::::run_benchmark( + extrinsic, + c, + whitelist, + verify, + internal_repeats, + ) + } + } +} + +/// Take out the ED from given MultiAsset (if fungible) +fn take_minimum_balance( + mut asset: MultiAsset, +) -> Result< + ( + MultiAsset, + >::Balance, + ), + (), +> +where + <>::Balance as TryInto>::Error: + sp_std::fmt::Debug, +{ + let minimum_balance = T::TransactAsset::minimum_balance(); + + if let Fungible(fun) = asset.fun { + asset.fun = Fungible(fun.saturating_sub(minimum_balance.try_into().map_err(|_| ())?)); + } + + Ok((asset, minimum_balance)) +} diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mock.rs b/pallets/astar-xcm-benchmarks/src/fungible/mock.rs new file mode 100644 index 0000000000..5c0e2168b9 --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/fungible/mock.rs @@ -0,0 +1,289 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +//! A mock runtime for XCM benchmarking. + +use core::marker::PhantomData; + +use crate::{fungible as xcm_fungible_benchmark, mock::*, *}; +use astar_primitives::xcm::ReserveAssetFilter; +use frame_benchmarking::BenchmarkError; +use frame_support::{ + assert_ok, parameter_types, + traits::{fungible::ItemOf, AsEnsureOriginWithArg, ConstU32, Everything, Nothing}, + weights::Weight, +}; +use frame_system::{EnsureRoot, EnsureSigned}; +use sp_core::{ConstU64, Get, H256}; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, +}; +use xcm::latest::prelude::*; +use xcm_builder::{AllowUnpaidExecutionFrom, FungiblesAdapter, MintLocation, NoChecking}; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; +type Balance = u64; +type AccountId = u64; +type AssetId = u128; + +// For testing the pallet, we construct a mock runtime. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + Assets: pallet_assets::{Pallet, Call, Storage, Event}, + XcmBalancesBenchmark: xcm_fungible_benchmark::{Pallet}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub BlockWeights: frame_system::limits::BlockWeights = + frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, u64::MAX)); + pub UniversalLocation: InteriorMultiLocation = Here; +} +impl frame_system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type RuntimeCall = RuntimeCall; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = ConstU32<16>; +} + +parameter_types! { + pub const ExistentialDeposit: u64 = 10; +} + +impl pallet_balances::Config for Test { + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type HoldIdentifier = (); + type FreezeIdentifier = (); + type MaxHolds = ConstU32<0>; + type MaxFreezes = ConstU32<0>; +} + +impl pallet_assets::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type AssetId = AssetId; + type AssetIdParameter = AssetId; + type Currency = Balances; + type CreateOrigin = AsEnsureOriginWithArg>; + type ForceOrigin = EnsureRoot; + type AssetDeposit = ConstU64<10>; + type MetadataDepositBase = ConstU64<10>; + type MetadataDepositPerByte = ConstU64<1>; + type AssetAccountDeposit = ConstU64<10>; + type ApprovalDeposit = ConstU64<10>; + type StringLimit = ConstU32<50>; + type Freezer = (); + type Extra = (); + type RemoveItemsLimit = ConstU32<100>; + type CallbackHandle = (); + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + +parameter_types! { + pub const AssetDeposit: u64 = 100 * ExistentialDeposit::get(); + pub const ApprovalDeposit: u64 = 1 * ExistentialDeposit::get(); + pub const StringLimit: u32 = 50; + pub const MetadataDepositBase: u64 = 10 * ExistentialDeposit::get(); + pub const MetadataDepositPerByte: u64 = 1 * ExistentialDeposit::get(); +} + +pub struct MatchOnlyAsset(PhantomData); +impl> xcm_executor::traits::MatchesFungibles + for MatchOnlyAsset +{ + fn matches_fungibles( + a: &MultiAsset, + ) -> core::result::Result<(AssetId, Balance), xcm_executor::traits::prelude::Error> { + use sp_runtime::traits::SaturatedConversion; + match a { + MultiAsset { + fun: Fungible(amount), + .. + } => Ok((Asset::get(), (*amount).saturated_into::())), + _ => Err(xcm_executor::traits::prelude::Error::AssetNotHandled), + } + } +} + +// Use ONLY assets as the asset transactor. +pub type AssetTransactor = FungiblesAdapter< + Assets, + MatchOnlyAsset, + AccountIdConverter, + AccountId, + NoChecking, + DummyCheckingAccount, +>; + +parameter_types! { + /// Maximum number of instructions in a single XCM fragment. A sanity check against weight + /// calculations getting too crazy. + pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; +} + +pub struct XcmConfig; +impl xcm_executor::Config for XcmConfig { + type RuntimeCall = RuntimeCall; + type XcmSender = DevNull; + type AssetTransactor = AssetTransactor; + type OriginConverter = (); + type IsReserve = ReserveAssetFilter; + type IsTeleporter = (); + type UniversalLocation = UniversalLocation; + type Barrier = AllowUnpaidExecutionFrom; + type Weigher = xcm_builder::FixedWeightBounds; + type Trader = xcm_builder::FixedRateOfFungible; + type ResponseHandler = DevNull; + type AssetTrap = (); + type AssetLocker = (); + type AssetExchanger = (); + type AssetClaims = (); + type SubscriptionService = (); + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; +} + +impl pallet_xcm_benchmarks::Config for Test { + type XcmConfig = XcmConfig; + type AccountIdConverter = AccountIdConverter; + fn valid_destination() -> Result { + let valid_destination: MultiLocation = X1(AccountId32 { + network: None, + id: [0u8; 32], + }) + .into(); + + Ok(valid_destination) + } + fn worst_case_holding(_depositable_count: u32) -> MultiAssets { + crate::mock::mock_worst_case_holding() + } +} + +parameter_types! { + pub DummyCheckingAccount: AccountId = 0; + pub const CheckingAccount: Option<(u64, MintLocation)> = Some((100, MintLocation::Local)); + pub const ChildTeleporter: MultiLocation = Parachain(1000).into_location(); + pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( + ChildTeleporter::get(), + MultiAsset { id: Concrete(Here.into_location()), fun: Fungible(100) }, + )); + pub const TeleportConcreteFungible: (MultiAssetFilter, MultiLocation) = + (Wild(AllOf { fun: WildFungible, id: Concrete(Here.into_location()) }), ChildTeleporter::get()); + pub const ReserveConcreteFungible: (MultiAssetFilter, MultiLocation) = + (Wild(AllOf { fun: WildFungible, id: Concrete(Here.into_location()) }), ChildTeleporter::get()); + pub const TransactAssetId: u128 = 1; + pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) }; + pub const WeightPrice: (xcm::latest::AssetId, u128, u128) = (Concrete(TransactAssetLocation::get()), 1_000_000, 1024); +} + +impl pallet_xcm_benchmarks::fungible::Config for Test { + type TransactAsset = ItemOf; + type CheckedAccount = CheckingAccount; + type TrustedTeleporter = TrustedTeleporter; + + fn get_multi_asset() -> MultiAsset { + let min_balance = 100u64; + let asset_location: MultiLocation = GeneralIndex(TransactAssetId::get()).into(); + + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TransactAssetId::get(), + 0u64, + true, + min_balance, + )); + + MultiAsset { + id: Concrete(asset_location), + fun: Fungible((min_balance * 100).into()), + } + } +} + +impl fungible::Config for Test {} +impl Config for Test {} + +#[cfg(feature = "runtime-benchmarks")] +pub fn new_test_ext() -> sp_io::TestExternalities { + use sp_runtime::BuildStorage; + let t = GenesisConfig { + ..Default::default() + } + .build_storage() + .unwrap(); + + let mut ext = sp_io::TestExternalities::from(t); + ext.execute_with(|| { + System::set_block_number(1); + // assert_ok!(Assets::force_create( + // RuntimeOrigin::root(), + // TransactAssetId::get(), + // 0u64, + // true, + // 100, + // )); + // register the transact asset + }); + ext +} diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs new file mode 100644 index 0000000000..d3f2565ba2 --- /dev/null +++ b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs @@ -0,0 +1,36 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +pub use pallet::*; + +pub mod benchmarking; + +#[cfg(test)] +pub mod mock; + +#[frame_support::pallet] +pub mod pallet { + #[pallet::config] + pub trait Config: + frame_system::Config + crate::Config + pallet_xcm_benchmarks::fungible::Config + { + } + + #[pallet::pallet] + pub struct Pallet(_); +} From 4d20c03f95d0381bc0cf2ca8842fe19bcba3cba5 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Wed, 10 Jan 2024 03:13:53 +0530 Subject: [PATCH 03/15] feat: add xcm benchmarks to shibuya --- runtime/shibuya/Cargo.toml | 4 + runtime/shibuya/src/lib.rs | 130 +++++++++++++++++++++++++++++- runtime/shibuya/src/xcm_config.rs | 3 +- 3 files changed, 134 insertions(+), 3 deletions(-) diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml index 46e2eb1c87..b79902de3b 100644 --- a/runtime/shibuya/Cargo.toml +++ b/runtime/shibuya/Cargo.toml @@ -97,6 +97,7 @@ orml-xtokens = { workspace = true } # Astar pallets astar-primitives = { workspace = true } +astar-xcm-benchmarks = { workspace = true, optional = true } pallet-chain-extension-unified-accounts = { workspace = true } pallet-chain-extension-xvm = { workspace = true } pallet-collator-selection = { workspace = true } @@ -116,6 +117,7 @@ pallet-inflation = { workspace = true } pallet-unified-accounts = { workspace = true } pallet-xc-asset-config = { workspace = true } pallet-xcm = { workspace = true } +pallet-xcm-benchmarks = { workspace = true, optional = true } pallet-xvm = { workspace = true } dapp-staking-v3-runtime-api = { workspace = true } @@ -245,6 +247,8 @@ std = [ "astar-primitives/std", ] runtime-benchmarks = [ + "astar-xcm-benchmarks/runtime-benchmarks", + "pallet-xcm-benchmarks/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index b98dcae097..e890f79e9b 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -1468,6 +1468,8 @@ mod benches { [pallet_xvm, Xvm] [pallet_dynamic_evm_base_fee, DynamicEvmBaseFee] [pallet_unified_accounts, UnifiedAccounts] + [xcm_benchmarks_generic, XcmGeneric] + [xcm_benchmarks_fungible, XcmFungible] ); } @@ -1950,6 +1952,12 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; + // This is defined once again in dispatch_benchmark, because list_benchmarks! + // and add_benchmarks! are macros exported by define_benchmarks! macros and those types + // are referenced in that call. + type XcmFungible = astar_xcm_benchmarks::fungible::benchmarking::XcmFungibleBenchmarks::; + type XcmGeneric = astar_xcm_benchmarks::generic::benchmarking::XcmGenericBenchmarks::; + let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -1961,14 +1969,132 @@ impl_runtime_apis! { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError}; use frame_system_benchmarking::Pallet as SystemBench; + use frame_support::{traits::{WhitelistedStorageKeys, tokens::fungible::{ItemOf}}, assert_ok}; use baseline::Pallet as BaselineBench; + use xcm::latest::prelude::*; + use xcm_builder::MintLocation; + use xcm_config::MaxAssetsIntoHolding; impl frame_system_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} - use frame_support::traits::WhitelistedStorageKeys; + // XCM Benchmarks + impl astar_xcm_benchmarks::Config for Runtime {} + impl astar_xcm_benchmarks::generic::Config for Runtime {} + impl astar_xcm_benchmarks::fungible::Config for Runtime {} + + impl pallet_xcm_benchmarks::Config for Runtime { + type XcmConfig = xcm_config::XcmConfig; + type AccountIdConverter = xcm_config::LocationToAccountId; + // destination location to be used in benchmarks + fn valid_destination() -> Result { + Ok(MultiLocation::parent()) + } + fn worst_case_holding(_depositable_count: u32) -> MultiAssets { + // max fungible assests with a native asset + let fungibles = MaxAssetsIntoHolding::get() - 1; + let fungibles_amount: u128 = 100; + (0..fungibles).map(|i| { + MultiAsset { + id: Concrete(GeneralIndex(i as u128).into()), + fun: Fungible(fungibles_amount * i as u128), + } + }).chain( + core::iter::once( + MultiAsset { + id: Concrete(MultiLocation::parent()), + fun: Fungible(u128::MAX) + } + ) + ).collect::>().into() + } + } + + impl pallet_xcm_benchmarks::generic::Config for Runtime { + type RuntimeCall = RuntimeCall; + fn worst_case_response() -> (u64, Response) { + (0u64, Response::Version(Default::default())) + } + fn worst_case_asset_exchange() + -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { + Err(BenchmarkError::Skip) + } + fn transact_origin_and_runtime_call() + -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok((MultiLocation::parent(), frame_system::Call::remark_with_event { + remark: vec![] + }.into())) + } + fn subscribe_origin() -> Result { + Ok(MultiLocation::parent()) + } + fn claimable_asset() + -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> { + let origin = MultiLocation::parent(); + let assets: MultiAssets = (Concrete(MultiLocation::parent()), 1_000u128) + .into(); + let ticket = MultiLocation { parents: 0, interior: Here }; + Ok((origin, ticket, assets)) + } + fn unlockable_asset() + -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) + } + fn export_message_origin_and_destination( + ) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> { + Err(BenchmarkError::Skip) + } + } + + parameter_types! { + pub const NoCheckingAccount: Option<(AccountId, MintLocation)> = None; + pub const NoTeleporter: Option<(MultiLocation, MultiAsset)> = None; + pub const TransactAssetId: u128 = 1; + pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) }; + } + + impl pallet_xcm_benchmarks::fungible::Config for Runtime { + type TransactAsset = ItemOf; + type CheckedAccount = NoCheckingAccount; + type TrustedTeleporter = NoTeleporter; + + fn get_multi_asset() -> MultiAsset { + let min_balance = 100u128; + // create the transact asset and make it sufficient + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TransactAssetId::get().into(), + Address::Id([0u8; 32].into()), + true, + // min balance + min_balance + )); + + // convert mapping for asset id + assert_ok!( + XcAssetConfig::register_asset_location( + RuntimeOrigin::root(), + Box::new(TransactAssetLocation::get().into_versioned()), + TransactAssetId::get(), + ) + ); + + MultiAsset { + id: Concrete(TransactAssetLocation::get()), + fun: Fungible(min_balance * 100), + } + } + } + + type XcmFungible = astar_xcm_benchmarks::fungible::benchmarking::XcmFungibleBenchmarks::; + type XcmGeneric = astar_xcm_benchmarks::generic::benchmarking::XcmGenericBenchmarks::; + let whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); let mut batches = Vec::::new(); diff --git a/runtime/shibuya/src/xcm_config.rs b/runtime/shibuya/src/xcm_config.rs index 8a5f5ba881..b1d01ba325 100644 --- a/runtime/shibuya/src/xcm_config.rs +++ b/runtime/shibuya/src/xcm_config.rs @@ -141,6 +141,7 @@ parameter_types! { // For the PoV size, we estimate 4 kB per instruction. This will be changed when we benchmark the instructions. pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 4 * 1024); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } match_types! { @@ -194,7 +195,7 @@ impl xcm_executor::Config for XcmConfig { type SubscriptionService = PolkadotXcm; type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = ConstU32<64>; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; type AssetLocker = (); type AssetExchanger = (); type FeeManager = (); From e050241bb39c59c3f6f7ec55d2e4859b81fa403d Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Wed, 10 Jan 2024 04:45:39 +0530 Subject: [PATCH 04/15] feat: add missing benchmark --- .../src/fungible/benchmarking.rs | 45 +++++++++++++++++-- .../astar-xcm-benchmarks/src/fungible/mock.rs | 22 ++++----- .../astar-xcm-benchmarks/src/fungible/mod.rs | 5 +++ 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs index fd882a9575..360edecf71 100644 --- a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs +++ b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs @@ -18,10 +18,12 @@ use super::*; use frame_benchmarking::v2::*; -use frame_support::{dispatch::Weight, traits::fungible::Inspect}; +use frame_support::{ + dispatch::Weight, + traits::{fungible::Inspect, Get}, +}; use pallet_xcm_benchmarks::{account_and_location, new_executor, AssetTransactorOf}; -use sp_std::vec; -use sp_std::vec::Vec; +use sp_std::{vec, vec::Vec}; use xcm::latest::prelude::*; use xcm_executor::traits::{Convert, TransactAsset}; @@ -127,6 +129,30 @@ mod benchmarks { Ok(()) } + /// The benchmarks for `reserve_asset_deposited` was added in later versions of + /// `pallet-xcm-benchmarks` (in v1.x.x versions). + /// TODO: remove this once we uplift to new polkadot release + #[benchmark] + fn reserve_asset_deposited() -> Result<(), BenchmarkError> { + let (trusted_reserve, transferable_reserve_asset) = T::TrustedReserve::get().ok_or( + BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)), + )?; + + let assets: MultiAssets = vec![transferable_reserve_asset].into(); + + let mut executor = new_executor::(trusted_reserve); + let instruction = Instruction::ReserveAssetDeposited(assets.clone()); + let xcm = Xcm(vec![instruction]); + + #[block] + { + executor.bench_process(xcm)?; + } + + assert!(executor.holding().ensure_contains(&assets).is_ok()); + Ok(()) + } + #[benchmark] fn receive_teleported_asset() -> Result<(), BenchmarkError> { #[block] @@ -152,8 +178,19 @@ where { fn benchmarks(extra: bool) -> Vec { // all the fungible xcm benchmarks + use crate::fungible::Pallet as AstarXcmFungibleBench; use pallet_xcm_benchmarks::fungible::Pallet as PalletXcmFungibleBench; - PalletXcmFungibleBench::::benchmarks(extra) + + let mut benchmarks = PalletXcmFungibleBench::::benchmarks(extra); + // append the aditional benchmark + // TODO: remove this once we uplift to new polkadot release + if let Some(bench) = AstarXcmFungibleBench::::benchmarks(true) + .into_iter() + .find(|b| b.name == "reserve_asset_deposited".as_bytes().to_vec()) + { + benchmarks.push(bench); + } + benchmarks } fn run_benchmark( extrinsic: &[u8], diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mock.rs b/pallets/astar-xcm-benchmarks/src/fungible/mock.rs index 5c0e2168b9..588741be51 100644 --- a/pallets/astar-xcm-benchmarks/src/fungible/mock.rs +++ b/pallets/astar-xcm-benchmarks/src/fungible/mock.rs @@ -235,6 +235,10 @@ parameter_types! { pub const TransactAssetId: u128 = 1; pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) }; pub const WeightPrice: (xcm::latest::AssetId, u128, u128) = (Concrete(TransactAssetLocation::get()), 1_000_000, 1024); + + pub TrustedReserveLocation: MultiLocation = Parent.into(); + pub TrustedReserveAsset: MultiAsset = MultiAsset { id: Concrete(TrustedReserveLocation::get()), fun: Fungible(1_000_000) }; + pub TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((TrustedReserveLocation::get(), TrustedReserveAsset::get())); } impl pallet_xcm_benchmarks::fungible::Config for Test { @@ -261,7 +265,9 @@ impl pallet_xcm_benchmarks::fungible::Config for Test { } } -impl fungible::Config for Test {} +impl fungible::Config for Test { + type TrustedReserve = TrustedReserve; +} impl Config for Test {} #[cfg(feature = "runtime-benchmarks")] @@ -273,17 +279,5 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .build_storage() .unwrap(); - let mut ext = sp_io::TestExternalities::from(t); - ext.execute_with(|| { - System::set_block_number(1); - // assert_ok!(Assets::force_create( - // RuntimeOrigin::root(), - // TransactAssetId::get(), - // 0u64, - // true, - // 100, - // )); - // register the transact asset - }); - ext + t.into() } diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs index d3f2565ba2..b0f0befdb5 100644 --- a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs +++ b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs @@ -29,6 +29,11 @@ pub mod pallet { pub trait Config: frame_system::Config + crate::Config + pallet_xcm_benchmarks::fungible::Config { + /// A trusted location where reserve assets are stored, and the asset we allow to be + /// reserves. + type TrustedReserve: frame_support::traits::Get< + Option<(xcm::latest::MultiLocation, xcm::latest::MultiAsset)>, + >; } #[pallet::pallet] From 4cf86387ff96750f50928c2b5a6afd629a64c0b7 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Wed, 10 Jan 2024 04:46:48 +0530 Subject: [PATCH 05/15] feat: use `WeightInfoBounds` in shibuya --- primitives/src/xcm/mod.rs | 1 + runtime/shibuya/src/lib.rs | 8 +- runtime/shibuya/src/weights/mod.rs | 1 + runtime/shibuya/src/weights/xcm/fungible.rs | 368 +++++++++ runtime/shibuya/src/weights/xcm/generic.rs | 818 ++++++++++++++++++++ runtime/shibuya/src/weights/xcm/mod.rs | 263 +++++++ runtime/shibuya/src/xcm_config.rs | 11 +- 7 files changed, 1464 insertions(+), 6 deletions(-) create mode 100644 runtime/shibuya/src/weights/xcm/fungible.rs create mode 100644 runtime/shibuya/src/weights/xcm/generic.rs create mode 100644 runtime/shibuya/src/weights/xcm/mod.rs diff --git a/primitives/src/xcm/mod.rs b/primitives/src/xcm/mod.rs index a0945c7532..85cdb740b9 100644 --- a/primitives/src/xcm/mod.rs +++ b/primitives/src/xcm/mod.rs @@ -53,6 +53,7 @@ use pallet_xc_asset_config::{ExecutionPaymentRate, XcAssetLocation}; mod tests; pub const XCM_SIZE_LIMIT: u32 = 2u32.pow(16); +pub const MAX_ASSETS: u32 = 64; /// Used to convert between cross-chain asset multilocation and local asset Id. /// diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index e890f79e9b..905ffdea5c 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -1983,7 +1983,9 @@ impl_runtime_apis! { // XCM Benchmarks impl astar_xcm_benchmarks::Config for Runtime {} impl astar_xcm_benchmarks::generic::Config for Runtime {} - impl astar_xcm_benchmarks::fungible::Config for Runtime {} + impl astar_xcm_benchmarks::fungible::Config for Runtime { + type TrustedReserve = TrustedReserve; + } impl pallet_xcm_benchmarks::Config for Runtime { type XcmConfig = xcm_config::XcmConfig; @@ -2057,6 +2059,10 @@ impl_runtime_apis! { pub const NoTeleporter: Option<(MultiLocation, MultiAsset)> = None; pub const TransactAssetId: u128 = 1; pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) }; + + pub TrustedReserveLocation: MultiLocation = Parent.into(); + pub TrustedReserveAsset: MultiAsset = MultiAsset { id: Concrete(TrustedReserveLocation::get()), fun: Fungible(1_000_000) }; + pub TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((TrustedReserveLocation::get(), TrustedReserveAsset::get())); } impl pallet_xcm_benchmarks::fungible::Config for Runtime { diff --git a/runtime/shibuya/src/weights/mod.rs b/runtime/shibuya/src/weights/mod.rs index b49f1c1a29..11722c07a3 100644 --- a/runtime/shibuya/src/weights/mod.rs +++ b/runtime/shibuya/src/weights/mod.rs @@ -22,3 +22,4 @@ pub mod pallet_dapp_staking_migration; pub mod pallet_dapp_staking_v3; pub mod pallet_inflation; pub mod pallet_xcm; +pub mod xcm; diff --git a/runtime/shibuya/src/weights/xcm/fungible.rs b/runtime/shibuya/src/weights/xcm/fungible.rs new file mode 100644 index 0000000000..9c922e211b --- /dev/null +++ b/runtime/shibuya/src/weights/xcm/fungible.rs @@ -0,0 +1,368 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +//! Autogenerated weights for xcm_benchmarks_fungible +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2024-01-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Ashutoshs-MacBook-Pro.local`, CPU: `` +//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/astar-collator +// benchmark +// pallet +// --chain=shibuya-dev +// --steps=50 +// --repeat=20 +// --pallet=xcm_benchmarks_fungible +// --extrinsic=* +// --execution=native +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./pallets/astar-xcm-benchmarks/weights-fungible.rs +// --template=./scripts/templates/weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions needed for xcm_benchmarks_fungible. +pub trait WeightInfo { + fn withdraw_asset() -> Weight; + fn transfer_asset() -> Weight; + fn transfer_reserve_asset() -> Weight; + fn receive_teleported_asset() -> Weight; + fn deposit_asset() -> Weight; + fn deposit_reserve_asset() -> Weight; + fn initiate_teleport() -> Weight; + fn reserve_asset_deposited() -> Weight; +} + +/// Weights for xcm_benchmarks_fungible using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) + /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn withdraw_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `688` + // Estimated: `4153` + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 4153) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn transfer_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `544` + // Estimated: `6232` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_000_000, 6232) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn transfer_reserve_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `758` + // Estimated: `6232` + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(42_000_000, 6232) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn receive_teleported_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn deposit_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `424` + // Estimated: `3889` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(21_000_000, 3889) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn deposit_reserve_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `638` + // Estimated: `4103` + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(34_000_000, 4103) + .saturating_add(T::DbWeight::get().reads(10_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn initiate_teleport() -> Weight { + // Proof Size summary in bytes: + // Measured: `346` + // Estimated: `3811` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 3811) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn reserve_asset_deposited() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) + /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn withdraw_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `688` + // Estimated: `4153` + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 4153) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn transfer_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `544` + // Estimated: `6232` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_000_000, 6232) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn transfer_reserve_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `758` + // Estimated: `6232` + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(42_000_000, 6232) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn receive_teleported_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn deposit_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `424` + // Estimated: `3889` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(21_000_000, 3889) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn deposit_reserve_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `638` + // Estimated: `4103` + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(34_000_000, 4103) + .saturating_add(RocksDbWeight::get().reads(10_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn initiate_teleport() -> Weight { + // Proof Size summary in bytes: + // Measured: `346` + // Estimated: `3811` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 3811) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn reserve_asset_deposited() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } +} diff --git a/runtime/shibuya/src/weights/xcm/generic.rs b/runtime/shibuya/src/weights/xcm/generic.rs new file mode 100644 index 0000000000..030caa91f7 --- /dev/null +++ b/runtime/shibuya/src/weights/xcm/generic.rs @@ -0,0 +1,818 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +//! Autogenerated weights for xcm_benchmarks_generic +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2024-01-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Ashutoshs-MacBook-Pro.local`, CPU: `` +//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/astar-collator +// benchmark +// pallet +// --chain=shibuya-dev +// --steps=50 +// --repeat=20 +// --pallet=xcm_benchmarks_generic +// --extrinsic=* +// --execution=native +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./pallets/astar-xcm-benchmarks/weights-generic.rs +// --template=./scripts/templates/weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions needed for xcm_benchmarks_generic. +pub trait WeightInfo { + fn report_holding() -> Weight; + fn buy_execution() -> Weight; + fn query_response() -> Weight; + fn transact() -> Weight; + fn refund_surplus() -> Weight; + fn set_error_handler() -> Weight; + fn set_appendix() -> Weight; + fn clear_error() -> Weight; + fn descend_origin() -> Weight; + fn clear_origin() -> Weight; + fn report_error() -> Weight; + fn claim_asset() -> Weight; + fn trap() -> Weight; + fn subscribe_version() -> Weight; + fn unsubscribe_version() -> Weight; + fn initiate_reserve_withdraw() -> Weight; + fn burn_asset() -> Weight; + fn expect_asset() -> Weight; + fn expect_origin() -> Weight; + fn expect_error() -> Weight; + fn expect_transact_status() -> Weight; + fn query_pallet() -> Weight; + fn expect_pallet() -> Weight; + fn report_transact_status() -> Weight; + fn clear_transact_status() -> Weight; + fn set_topic() -> Weight; + fn clear_topic() -> Weight; + fn exchange_asset() -> Weight; + fn universal_origin() -> Weight; + fn export_message() -> Weight; + fn set_fees_mode() -> Weight; + fn lock_asset() -> Weight; + fn unlock_asset() -> Weight; + fn note_unlockable() -> Weight; + fn request_unlock() -> Weight; + fn unpaid_execution() -> Weight; +} + +/// Weights for xcm_benchmarks_generic using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn report_holding() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 61_000_000 picoseconds. + Weight::from_parts(62_000_000, 3679) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn buy_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: PolkadotXcm Queries (r:1 w:0) + /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) + fn query_response() -> Weight { + // Proof Size summary in bytes: + // Measured: `69` + // Estimated: `3534` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(5_000_000, 3534) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + fn transact() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(5_000_000, 0) + } + fn refund_surplus() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn set_error_handler() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn set_appendix() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn clear_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn descend_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn clear_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn report_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 3679) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: PolkadotXcm AssetTraps (r:1 w:1) + /// Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured) + fn claim_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `126` + // Estimated: `3591` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3591) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + fn trap() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn subscribe_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `111` + // Estimated: `3576` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 3576) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + fn unsubscribe_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(2_000_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn initiate_reserve_withdraw() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 68_000_000 picoseconds. + Weight::from_parts(69_000_000, 3679) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn burn_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(23_000_000, 0) + } + fn expect_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(5_000_000, 0) + } + fn expect_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn expect_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn expect_transact_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn query_pallet() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 3679) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn expect_pallet() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn report_transact_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 3679) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn clear_transact_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn set_topic() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn clear_topic() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn exchange_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn universal_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + /// The range of component `x` is `[1, 1000]`. + fn export_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + fn set_fees_mode() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn lock_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn unlock_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn note_unlockable() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn request_unlock() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + fn unpaid_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn report_holding() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 61_000_000 picoseconds. + Weight::from_parts(62_000_000, 3679) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn buy_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: PolkadotXcm Queries (r:1 w:0) + /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) + fn query_response() -> Weight { + // Proof Size summary in bytes: + // Measured: `69` + // Estimated: `3534` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(5_000_000, 3534) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + } + fn transact() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(5_000_000, 0) + } + fn refund_surplus() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn set_error_handler() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn set_appendix() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn clear_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn descend_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn clear_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn report_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 3679) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: PolkadotXcm AssetTraps (r:1 w:1) + /// Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured) + fn claim_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `126` + // Estimated: `3591` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3591) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + fn trap() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn subscribe_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `111` + // Estimated: `3576` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 3576) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) + /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + fn unsubscribe_version() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(2_000_000, 0) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn initiate_reserve_withdraw() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 68_000_000 picoseconds. + Weight::from_parts(69_000_000, 3679) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn burn_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(23_000_000, 0) + } + fn expect_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(5_000_000, 0) + } + fn expect_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn expect_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn expect_transact_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn query_pallet() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 3679) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn expect_pallet() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem HostConfiguration (r:1 w:0) + /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) + fn report_transact_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `214` + // Estimated: `3679` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 3679) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn clear_transact_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn set_topic() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + fn clear_topic() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn exchange_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn universal_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + /// The range of component `x` is `[1, 1000]`. + fn export_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + fn set_fees_mode() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn lock_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn unlock_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn note_unlockable() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn request_unlock() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + fn unpaid_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(1_000_000, 0) + } +} diff --git a/runtime/shibuya/src/weights/xcm/mod.rs b/runtime/shibuya/src/weights/xcm/mod.rs new file mode 100644 index 0000000000..f4f5851ea3 --- /dev/null +++ b/runtime/shibuya/src/weights/xcm/mod.rs @@ -0,0 +1,263 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +mod fungible; +mod generic; + +use astar_primitives::xcm::MAX_ASSETS; +use core::cmp::min; +use frame_support::weights::Weight; +use fungible::{SubstrateWeight as XcmFungibleWeight, WeightInfo as FungibleWeightInfo}; +use generic::{SubstrateWeight as XcmGeneric, WeightInfo as GenericWeightInfo}; +use sp_std::prelude::*; +use xcm::{ + latest::{prelude::*, Weight as XCMWeight}, + DoubleEncoded, +}; + +trait WeighMultiAssets { + fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight; +} + +trait WeighMultiAssetsFilter { + fn weigh_multi_assets_filter(&self, weight: Weight) -> XCMWeight; +} + +impl WeighMultiAssetsFilter for MultiAssetFilter { + fn weigh_multi_assets_filter(&self, weight: Weight) -> XCMWeight { + match self { + Self::Definite(assets) => { + weight.saturating_mul(assets.inner().into_iter().count() as u64) + } + Self::Wild(AllCounted(count) | AllOfCounted { count, .. }) => { + weight.saturating_mul(min(MAX_ASSETS, *count) as u64) + } + Self::Wild(All | AllOf { .. }) => weight.saturating_mul(MAX_ASSETS as u64), + } + } +} + +impl WeighMultiAssets for MultiAssets { + fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { + weight.saturating_mul(self.inner().into_iter().count() as u64) + } +} + +pub struct XcmWeight(core::marker::PhantomData<(Runtime, Call)>); +impl XcmWeightInfo for XcmWeight +where + Runtime: frame_system::Config, +{ + fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { + assets.inner().iter().fold(Weight::zero(), |acc, _asset| { + acc.saturating_add(XcmFungibleWeight::::withdraw_asset()) + }) + } + + fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight { + XcmFungibleWeight::::reserve_asset_deposited() + } + fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { + assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) + } + fn query_response( + _query_id: &u64, + _response: &Response, + _max_weight: &Weight, + _querier: &Option, + ) -> XCMWeight { + XcmGeneric::::query_response() + } + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { + assets.inner().iter().fold(Weight::zero(), |acc, _asset| { + acc.saturating_add(XcmFungibleWeight::::transfer_asset()) + }) + } + fn transfer_reserve_asset( + assets: &MultiAssets, + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + assets.inner().iter().fold(Weight::zero(), |acc, _asset| { + acc.saturating_add(XcmFungibleWeight::::transfer_reserve_asset()) + }) + } + fn transact( + _origin_type: &OriginKind, + _require_weight_at_most: &Weight, + _call: &DoubleEncoded, + ) -> XCMWeight { + XcmGeneric::::transact() + } + fn hrmp_new_channel_open_request( + _sender: &u32, + _max_message_size: &u32, + _max_capacity: &u32, + ) -> XCMWeight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX + } + fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX + } + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX + } + fn clear_origin() -> XCMWeight { + XcmGeneric::::clear_origin() + } + fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { + XcmGeneric::::descend_origin() + } + fn report_error(_query_response_info: &QueryResponseInfo) -> XCMWeight { + XcmGeneric::::report_error() + } + fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> XCMWeight { + assets.weigh_multi_assets_filter(XcmFungibleWeight::::deposit_asset()) + } + fn deposit_reserve_asset( + assets: &MultiAssetFilter, + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + assets.weigh_multi_assets_filter(XcmFungibleWeight::::deposit_reserve_asset()) + } + fn exchange_asset( + _give: &MultiAssetFilter, + _receive: &MultiAssets, + _maximal: &bool, + ) -> XCMWeight { + Weight::MAX + } + fn initiate_reserve_withdraw( + _assets: &MultiAssetFilter, + _reserve: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + // This is not correct. initiate reserve withdraw does not to that many db reads + // the only thing it does based on number of assets is a take from a local variable + //assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) + XcmGeneric::::initiate_reserve_withdraw() + } + fn initiate_teleport( + _assets: &MultiAssetFilter, + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + XcmFungibleWeight::::initiate_teleport() + } + fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { + XcmGeneric::::report_holding() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { + XcmGeneric::::buy_execution() + } + fn refund_surplus() -> XCMWeight { + XcmGeneric::::refund_surplus() + } + fn set_error_handler(_xcm: &Xcm) -> XCMWeight { + XcmGeneric::::set_error_handler() + } + fn set_appendix(_xcm: &Xcm) -> XCMWeight { + XcmGeneric::::set_appendix() + } + fn clear_error() -> XCMWeight { + XcmGeneric::::clear_error() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { + XcmGeneric::::claim_asset() + } + fn trap(_code: &u64) -> XCMWeight { + XcmGeneric::::trap() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> XCMWeight { + XcmGeneric::::subscribe_version() + } + fn unsubscribe_version() -> XCMWeight { + XcmGeneric::::unsubscribe_version() + } + fn burn_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::burn_asset()) + } + fn expect_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::expect_asset()) + } + fn expect_origin(_origin: &Option) -> Weight { + XcmGeneric::::expect_origin() + } + fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight { + XcmGeneric::::expect_error() + } + fn expect_transact_status(_transact_status: &MaybeErrorCode) -> Weight { + XcmGeneric::::expect_transact_status() + } + fn query_pallet(_module_name: &Vec, _response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::query_pallet() + } + fn expect_pallet( + _index: &u32, + _name: &Vec, + _module_name: &Vec, + _crate_major: &u32, + _min_crate_minor: &u32, + ) -> Weight { + XcmGeneric::::expect_pallet() + } + fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_transact_status() + } + fn clear_transact_status() -> Weight { + XcmGeneric::::clear_transact_status() + } + fn universal_origin(_: &Junction) -> Weight { + Weight::MAX + } + fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { + Weight::MAX + } + fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX + } + fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX + } + fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX + } + fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX + } + fn set_fees_mode(_: &bool) -> Weight { + XcmGeneric::::set_fees_mode() + } + fn set_topic(_topic: &[u8; 32]) -> Weight { + XcmGeneric::::set_topic() + } + fn clear_topic() -> Weight { + XcmGeneric::::clear_topic() + } + fn alias_origin(_: &MultiLocation) -> Weight { + // XCM Executor does not currently support alias origin operations + Weight::MAX + } + fn unpaid_execution(_: &WeightLimit, _: &Option) -> Weight { + XcmGeneric::::unpaid_execution() + } +} diff --git a/runtime/shibuya/src/xcm_config.rs b/runtime/shibuya/src/xcm_config.rs index b1d01ba325..e8e710e003 100644 --- a/runtime/shibuya/src/xcm_config.rs +++ b/runtime/shibuya/src/xcm_config.rs @@ -35,10 +35,10 @@ use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, ConvertedConcreteId, CurrencyAdapter, - EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, IsConcrete, NoChecking, - ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, + EnsureXcmOrigin, FungiblesAdapter, IsConcrete, NoChecking, ParentAsSuperuser, ParentIsPreset, + RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + UsingComponents, WeightInfoBounds, WithComputedOrigin, }; use xcm_executor::{ traits::{Convert as XcmConvert, JustTry}, @@ -172,7 +172,8 @@ pub type ShibuyaXcmFungibleFeeHandler = XcmFungibleFeeHandler< TreasuryAccountId, >; -pub type Weigher = FixedWeightBounds; +pub type Weigher = + WeightInfoBounds, RuntimeCall, MaxInstructions>; pub struct XcmConfig; impl xcm_executor::Config for XcmConfig { From 0a6acaa27e2c5c310f549e9885a297699a4b7527 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Wed, 10 Jan 2024 14:25:45 +0530 Subject: [PATCH 06/15] fix: use max assets properly --- runtime/shibuya/src/xcm_config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/shibuya/src/xcm_config.rs b/runtime/shibuya/src/xcm_config.rs index e8e710e003..4b91a10878 100644 --- a/runtime/shibuya/src/xcm_config.rs +++ b/runtime/shibuya/src/xcm_config.rs @@ -52,7 +52,7 @@ use orml_xcm_support::DisabledParachainFee; use astar_primitives::xcm::{ AbsoluteAndRelativeReserveProvider, AccountIdToMultiLocation, DescribeAllTerminal, DescribeFamily, FixedRateOfForeignAsset, HashedDescription, ReserveAssetFilter, - XcmFungibleFeeHandler, + XcmFungibleFeeHandler, MAX_ASSETS, }; parameter_types! { @@ -141,7 +141,7 @@ parameter_types! { // For the PoV size, we estimate 4 kB per instruction. This will be changed when we benchmark the instructions. pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 4 * 1024); pub const MaxInstructions: u32 = 100; - pub const MaxAssetsIntoHolding: u32 = 64; + pub const MaxAssetsIntoHolding: u32 = MAX_ASSETS; } match_types! { From 9d3ece740834c9fab424ab26396f0492e4d50236 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Thu, 11 Jan 2024 13:33:52 +0530 Subject: [PATCH 07/15] feat: update weights from benchmarks --- runtime/shibuya/src/weights/xcm/fungible.rs | 86 +++--- runtime/shibuya/src/weights/xcm/generic.rs | 306 ++++++++++---------- 2 files changed, 196 insertions(+), 196 deletions(-) diff --git a/runtime/shibuya/src/weights/xcm/fungible.rs b/runtime/shibuya/src/weights/xcm/fungible.rs index 9c922e211b..6160061eb2 100644 --- a/runtime/shibuya/src/weights/xcm/fungible.rs +++ b/runtime/shibuya/src/weights/xcm/fungible.rs @@ -19,10 +19,10 @@ //! Autogenerated weights for xcm_benchmarks_fungible //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-01-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-01-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Ashutoshs-MacBook-Pro.local`, CPU: `` -//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 +//! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 // Executed Command: // ./target/release/astar-collator @@ -33,10 +33,10 @@ // --repeat=20 // --pallet=xcm_benchmarks_fungible // --extrinsic=* -// --execution=native +// --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./pallets/astar-xcm-benchmarks/weights-fungible.rs +// --output=./benchmark-results/shibuya-dev/benchmarks_fungible_weights.rs // --template=./scripts/templates/weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -75,8 +75,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `688` // Estimated: `4153` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 4153) + // Minimum execution time: 48_708_000 picoseconds. + Weight::from_parts(49_394_000, 4153) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -92,8 +92,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `544` // Estimated: `6232` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(28_000_000, 6232) + // Minimum execution time: 49_225_000 picoseconds. + Weight::from_parts(49_700_000, 6232) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -119,10 +119,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `758` + // Measured: `720` // Estimated: `6232` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(42_000_000, 6232) + // Minimum execution time: 72_392_000 picoseconds. + Weight::from_parts(73_104_000, 6232) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `424` // Estimated: `3889` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_000_000, 3889) + // Minimum execution time: 37_873_000 picoseconds. + Weight::from_parts(38_273_000, 3889) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -174,10 +174,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `638` - // Estimated: `4103` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 4103) + // Measured: `600` + // Estimated: `4065` + // Minimum execution time: 62_630_000 picoseconds. + Weight::from_parts(63_475_000, 4065) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -197,10 +197,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn initiate_teleport() -> Weight { // Proof Size summary in bytes: - // Measured: `346` - // Estimated: `3811` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 3811) + // Measured: `308` + // Estimated: `3773` + // Minimum execution time: 39_637_000 picoseconds. + Weight::from_parts(40_123_000, 3773) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -208,8 +208,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_440_000 picoseconds. + Weight::from_parts(3_603_000, 0) } } @@ -229,8 +229,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `688` // Estimated: `4153` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 4153) + // Minimum execution time: 48_708_000 picoseconds. + Weight::from_parts(49_394_000, 4153) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -246,8 +246,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `544` // Estimated: `6232` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(28_000_000, 6232) + // Minimum execution time: 49_225_000 picoseconds. + Weight::from_parts(49_700_000, 6232) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -273,10 +273,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `758` + // Measured: `720` // Estimated: `6232` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(42_000_000, 6232) + // Minimum execution time: 72_392_000 picoseconds. + Weight::from_parts(73_104_000, 6232) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -301,8 +301,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `424` // Estimated: `3889` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_000_000, 3889) + // Minimum execution time: 37_873_000 picoseconds. + Weight::from_parts(38_273_000, 3889) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -328,10 +328,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `638` - // Estimated: `4103` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 4103) + // Measured: `600` + // Estimated: `4065` + // Minimum execution time: 62_630_000 picoseconds. + Weight::from_parts(63_475_000, 4065) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -351,10 +351,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn initiate_teleport() -> Weight { // Proof Size summary in bytes: - // Measured: `346` - // Estimated: `3811` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 3811) + // Measured: `308` + // Estimated: `3773` + // Minimum execution time: 39_637_000 picoseconds. + Weight::from_parts(40_123_000, 3773) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -362,7 +362,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_440_000 picoseconds. + Weight::from_parts(3_603_000, 0) } } diff --git a/runtime/shibuya/src/weights/xcm/generic.rs b/runtime/shibuya/src/weights/xcm/generic.rs index 030caa91f7..f009a7065f 100644 --- a/runtime/shibuya/src/weights/xcm/generic.rs +++ b/runtime/shibuya/src/weights/xcm/generic.rs @@ -19,10 +19,10 @@ //! Autogenerated weights for xcm_benchmarks_generic //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-01-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-01-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Ashutoshs-MacBook-Pro.local`, CPU: `` -//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 +//! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 // Executed Command: // ./target/release/astar-collator @@ -33,10 +33,10 @@ // --repeat=20 // --pallet=xcm_benchmarks_generic // --extrinsic=* -// --execution=native +// --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./pallets/astar-xcm-benchmarks/weights-generic.rs +// --output=./benchmark-results/shibuya-dev/benchmarks_generic_weights.rs // --template=./scripts/templates/weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -103,10 +103,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn report_holding() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 61_000_000 picoseconds. - Weight::from_parts(62_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 348_128_000 picoseconds. + Weight::from_parts(355_569_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -114,67 +114,67 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_575_000 picoseconds. + Weight::from_parts(3_685_000, 0) } /// Storage: PolkadotXcm Queries (r:1 w:0) /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn query_response() -> Weight { // Proof Size summary in bytes: - // Measured: `69` - // Estimated: `3534` - // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(5_000_000, 3534) + // Measured: `31` + // Estimated: `3496` + // Minimum execution time: 10_842_000 picoseconds. + Weight::from_parts(11_039_000, 3496) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + // Minimum execution time: 12_146_000 picoseconds. + Weight::from_parts(12_448_000, 0) } fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_826_000 picoseconds. + Weight::from_parts(3_986_000, 0) } fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_597_000 picoseconds. + Weight::from_parts(2_724_000, 0) } fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_596_000 picoseconds. + Weight::from_parts(2_699_000, 0) } fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_585_000 picoseconds. + Weight::from_parts(2_664_000, 0) } fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_372_000 picoseconds. + Weight::from_parts(3_480_000, 0) } fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_601_000 picoseconds. + Weight::from_parts(2_694_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -190,10 +190,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn report_error() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 25_876_000 picoseconds. + Weight::from_parts(26_337_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -201,10 +201,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured) fn claim_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `126` - // Estimated: `3591` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 3591) + // Measured: `88` + // Estimated: `3553` + // Minimum execution time: 14_605_000 picoseconds. + Weight::from_parts(14_812_000, 3553) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -212,8 +212,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_562_000 picoseconds. + Weight::from_parts(2_678_000, 0) } /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -229,10 +229,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn subscribe_version() -> Weight { // Proof Size summary in bytes: - // Measured: `111` - // Estimated: `3576` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3576) + // Measured: `73` + // Estimated: `3538` + // Minimum execution time: 25_850_000 picoseconds. + Weight::from_parts(26_304_000, 3538) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -242,8 +242,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(2_000_000, 0) + // Minimum execution time: 4_791_000 picoseconds. + Weight::from_parts(4_909_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainInfo ParachainId (r:1 w:0) @@ -260,10 +260,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 68_000_000 picoseconds. - Weight::from_parts(69_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 408_529_000 picoseconds. + Weight::from_parts(417_068_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -271,36 +271,36 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(23_000_000, 0) + // Minimum execution time: 121_976_000 picoseconds. + Weight::from_parts(125_121_000, 0) } fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + // Minimum execution time: 10_182_000 picoseconds. + Weight::from_parts(10_336_000, 0) } fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_704_000 picoseconds. + Weight::from_parts(2_827_000, 0) } fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_616_000 picoseconds. + Weight::from_parts(2_743_000, 0) } fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_745_000 picoseconds. + Weight::from_parts(2_846_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -316,10 +316,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn query_pallet() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 32_303_000 picoseconds. + Weight::from_parts(33_006_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -327,8 +327,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 7_311_000 picoseconds. + Weight::from_parts(7_493_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -344,10 +344,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn report_transact_status() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 25_707_000 picoseconds. + Weight::from_parts(26_164_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -355,22 +355,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_590_000 picoseconds. + Weight::from_parts(2_701_000, 0) } fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_605_000 picoseconds. + Weight::from_parts(2_676_000, 0) } fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_575_000 picoseconds. + Weight::from_parts(2_717_000, 0) } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) @@ -404,8 +404,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_509_000 picoseconds. + Weight::from_parts(2_663_000, 0) } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) @@ -447,8 +447,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_695_000 picoseconds. + Weight::from_parts(2_840_000, 0) } } @@ -468,10 +468,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn report_holding() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 61_000_000 picoseconds. - Weight::from_parts(62_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 348_128_000 picoseconds. + Weight::from_parts(355_569_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -479,67 +479,67 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_575_000 picoseconds. + Weight::from_parts(3_685_000, 0) } /// Storage: PolkadotXcm Queries (r:1 w:0) /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn query_response() -> Weight { // Proof Size summary in bytes: - // Measured: `69` - // Estimated: `3534` - // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(5_000_000, 3534) + // Measured: `31` + // Estimated: `3496` + // Minimum execution time: 10_842_000 picoseconds. + Weight::from_parts(11_039_000, 3496) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + // Minimum execution time: 12_146_000 picoseconds. + Weight::from_parts(12_448_000, 0) } fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_826_000 picoseconds. + Weight::from_parts(3_986_000, 0) } fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_597_000 picoseconds. + Weight::from_parts(2_724_000, 0) } fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_596_000 picoseconds. + Weight::from_parts(2_699_000, 0) } fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_585_000 picoseconds. + Weight::from_parts(2_664_000, 0) } fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 3_372_000 picoseconds. + Weight::from_parts(3_480_000, 0) } fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_601_000 picoseconds. + Weight::from_parts(2_694_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -555,10 +555,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn report_error() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 25_876_000 picoseconds. + Weight::from_parts(26_337_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -566,10 +566,10 @@ impl WeightInfo for () { /// Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured) fn claim_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `126` - // Estimated: `3591` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 3591) + // Measured: `88` + // Estimated: `3553` + // Minimum execution time: 14_605_000 picoseconds. + Weight::from_parts(14_812_000, 3553) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -577,8 +577,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_562_000 picoseconds. + Weight::from_parts(2_678_000, 0) } /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -594,10 +594,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn subscribe_version() -> Weight { // Proof Size summary in bytes: - // Measured: `111` - // Estimated: `3576` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3576) + // Measured: `73` + // Estimated: `3538` + // Minimum execution time: 25_850_000 picoseconds. + Weight::from_parts(26_304_000, 3538) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -607,8 +607,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(2_000_000, 0) + // Minimum execution time: 4_791_000 picoseconds. + Weight::from_parts(4_909_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: ParachainInfo ParachainId (r:1 w:0) @@ -625,10 +625,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 68_000_000 picoseconds. - Weight::from_parts(69_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 408_529_000 picoseconds. + Weight::from_parts(417_068_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -636,36 +636,36 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(23_000_000, 0) + // Minimum execution time: 121_976_000 picoseconds. + Weight::from_parts(125_121_000, 0) } fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + // Minimum execution time: 10_182_000 picoseconds. + Weight::from_parts(10_336_000, 0) } fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_704_000 picoseconds. + Weight::from_parts(2_827_000, 0) } fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_616_000 picoseconds. + Weight::from_parts(2_743_000, 0) } fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_745_000 picoseconds. + Weight::from_parts(2_846_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -681,10 +681,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn query_pallet() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 32_303_000 picoseconds. + Weight::from_parts(33_006_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -692,8 +692,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 7_311_000 picoseconds. + Weight::from_parts(7_493_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -709,10 +709,10 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn report_transact_status() -> Weight { // Proof Size summary in bytes: - // Measured: `214` - // Estimated: `3679` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3679) + // Measured: `176` + // Estimated: `3641` + // Minimum execution time: 25_707_000 picoseconds. + Weight::from_parts(26_164_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -720,22 +720,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_590_000 picoseconds. + Weight::from_parts(2_701_000, 0) } fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_605_000 picoseconds. + Weight::from_parts(2_676_000, 0) } fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_575_000 picoseconds. + Weight::from_parts(2_717_000, 0) } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) @@ -769,8 +769,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_509_000 picoseconds. + Weight::from_parts(2_663_000, 0) } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) @@ -812,7 +812,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_695_000 picoseconds. + Weight::from_parts(2_840_000, 0) } } From 3a8254a9f54b95b63bddc98a0b0f4ec7db56ca44 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Thu, 11 Jan 2024 14:27:47 +0530 Subject: [PATCH 08/15] feat: merge mocks --- pallets/astar-xcm-benchmarks/Cargo.toml | 2 +- .../src/fungible/benchmarking.rs | 15 +- .../astar-xcm-benchmarks/src/fungible/mock.rs | 283 --------------- .../astar-xcm-benchmarks/src/fungible/mod.rs | 3 - .../src/generic/benchmarking.rs | 6 +- .../astar-xcm-benchmarks/src/generic/mock.rs | 230 ------------ .../astar-xcm-benchmarks/src/generic/mod.rs | 3 - pallets/astar-xcm-benchmarks/src/mock.rs | 339 ++++++++++++++++-- 8 files changed, 325 insertions(+), 556 deletions(-) delete mode 100644 pallets/astar-xcm-benchmarks/src/fungible/mock.rs delete mode 100644 pallets/astar-xcm-benchmarks/src/generic/mock.rs diff --git a/pallets/astar-xcm-benchmarks/Cargo.toml b/pallets/astar-xcm-benchmarks/Cargo.toml index 1ddf6bc759..b8236ad013 100644 --- a/pallets/astar-xcm-benchmarks/Cargo.toml +++ b/pallets/astar-xcm-benchmarks/Cargo.toml @@ -40,7 +40,7 @@ sp-runtime = { workspace = true, features = ["std"] } xcm-builder = { workspace = true, features = ["std"] } [features] -default = ["std"] +default = ["std", "runtime-benchmarks"] std = [ "astar-primitives/std", "frame-benchmarking/std", diff --git a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs index 360edecf71..8c47e7c683 100644 --- a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs +++ b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs @@ -162,11 +162,16 @@ mod benchmarks { ))) } - impl_benchmark_test_suite!( - Pallet, - crate::fungible::mock::new_test_ext(), - crate::fungible::mock::Test - ); + #[benchmark] + fn initiate_teleport() -> Result<(), BenchmarkError> { + #[block] + {} + Err(BenchmarkError::Override(BenchmarkResult::from_weight( + Weight::MAX, + ))) + } + + impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test); } pub struct XcmFungibleBenchmarks(sp_std::marker::PhantomData); diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mock.rs b/pallets/astar-xcm-benchmarks/src/fungible/mock.rs deleted file mode 100644 index 588741be51..0000000000 --- a/pallets/astar-xcm-benchmarks/src/fungible/mock.rs +++ /dev/null @@ -1,283 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later - -// Astar 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. - -// Astar 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 Astar. If not, see . - -//! A mock runtime for XCM benchmarking. - -use core::marker::PhantomData; - -use crate::{fungible as xcm_fungible_benchmark, mock::*, *}; -use astar_primitives::xcm::ReserveAssetFilter; -use frame_benchmarking::BenchmarkError; -use frame_support::{ - assert_ok, parameter_types, - traits::{fungible::ItemOf, AsEnsureOriginWithArg, ConstU32, Everything, Nothing}, - weights::Weight, -}; -use frame_system::{EnsureRoot, EnsureSigned}; -use sp_core::{ConstU64, Get, H256}; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, -}; -use xcm::latest::prelude::*; -use xcm_builder::{AllowUnpaidExecutionFrom, FungiblesAdapter, MintLocation, NoChecking}; - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; -type Balance = u64; -type AccountId = u64; -type AssetId = u128; - -// For testing the pallet, we construct a mock runtime. -frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - Assets: pallet_assets::{Pallet, Call, Storage, Event}, - XcmBalancesBenchmark: xcm_fungible_benchmark::{Pallet}, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, u64::MAX)); - pub UniversalLocation: InteriorMultiLocation = Here; -} -impl frame_system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type RuntimeCall = RuntimeCall; - type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = ConstU32<16>; -} - -parameter_types! { - pub const ExistentialDeposit: u64 = 10; -} - -impl pallet_balances::Config for Test { - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; - type Balance = Balance; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); - type HoldIdentifier = (); - type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; - type MaxFreezes = ConstU32<0>; -} - -impl pallet_assets::Config for Test { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; - type AssetId = AssetId; - type AssetIdParameter = AssetId; - type Currency = Balances; - type CreateOrigin = AsEnsureOriginWithArg>; - type ForceOrigin = EnsureRoot; - type AssetDeposit = ConstU64<10>; - type MetadataDepositBase = ConstU64<10>; - type MetadataDepositPerByte = ConstU64<1>; - type AssetAccountDeposit = ConstU64<10>; - type ApprovalDeposit = ConstU64<10>; - type StringLimit = ConstU32<50>; - type Freezer = (); - type Extra = (); - type RemoveItemsLimit = ConstU32<100>; - type CallbackHandle = (); - type WeightInfo = (); - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); -} - -parameter_types! { - pub const AssetDeposit: u64 = 100 * ExistentialDeposit::get(); - pub const ApprovalDeposit: u64 = 1 * ExistentialDeposit::get(); - pub const StringLimit: u32 = 50; - pub const MetadataDepositBase: u64 = 10 * ExistentialDeposit::get(); - pub const MetadataDepositPerByte: u64 = 1 * ExistentialDeposit::get(); -} - -pub struct MatchOnlyAsset(PhantomData); -impl> xcm_executor::traits::MatchesFungibles - for MatchOnlyAsset -{ - fn matches_fungibles( - a: &MultiAsset, - ) -> core::result::Result<(AssetId, Balance), xcm_executor::traits::prelude::Error> { - use sp_runtime::traits::SaturatedConversion; - match a { - MultiAsset { - fun: Fungible(amount), - .. - } => Ok((Asset::get(), (*amount).saturated_into::())), - _ => Err(xcm_executor::traits::prelude::Error::AssetNotHandled), - } - } -} - -// Use ONLY assets as the asset transactor. -pub type AssetTransactor = FungiblesAdapter< - Assets, - MatchOnlyAsset, - AccountIdConverter, - AccountId, - NoChecking, - DummyCheckingAccount, ->; - -parameter_types! { - /// Maximum number of instructions in a single XCM fragment. A sanity check against weight - /// calculations getting too crazy. - pub const MaxInstructions: u32 = 100; - pub const MaxAssetsIntoHolding: u32 = 64; -} - -pub struct XcmConfig; -impl xcm_executor::Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = DevNull; - type AssetTransactor = AssetTransactor; - type OriginConverter = (); - type IsReserve = ReserveAssetFilter; - type IsTeleporter = (); - type UniversalLocation = UniversalLocation; - type Barrier = AllowUnpaidExecutionFrom; - type Weigher = xcm_builder::FixedWeightBounds; - type Trader = xcm_builder::FixedRateOfFungible; - type ResponseHandler = DevNull; - type AssetTrap = (); - type AssetLocker = (); - type AssetExchanger = (); - type AssetClaims = (); - type SubscriptionService = (); - type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = Everything; -} - -impl pallet_xcm_benchmarks::Config for Test { - type XcmConfig = XcmConfig; - type AccountIdConverter = AccountIdConverter; - fn valid_destination() -> Result { - let valid_destination: MultiLocation = X1(AccountId32 { - network: None, - id: [0u8; 32], - }) - .into(); - - Ok(valid_destination) - } - fn worst_case_holding(_depositable_count: u32) -> MultiAssets { - crate::mock::mock_worst_case_holding() - } -} - -parameter_types! { - pub DummyCheckingAccount: AccountId = 0; - pub const CheckingAccount: Option<(u64, MintLocation)> = Some((100, MintLocation::Local)); - pub const ChildTeleporter: MultiLocation = Parachain(1000).into_location(); - pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( - ChildTeleporter::get(), - MultiAsset { id: Concrete(Here.into_location()), fun: Fungible(100) }, - )); - pub const TeleportConcreteFungible: (MultiAssetFilter, MultiLocation) = - (Wild(AllOf { fun: WildFungible, id: Concrete(Here.into_location()) }), ChildTeleporter::get()); - pub const ReserveConcreteFungible: (MultiAssetFilter, MultiLocation) = - (Wild(AllOf { fun: WildFungible, id: Concrete(Here.into_location()) }), ChildTeleporter::get()); - pub const TransactAssetId: u128 = 1; - pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) }; - pub const WeightPrice: (xcm::latest::AssetId, u128, u128) = (Concrete(TransactAssetLocation::get()), 1_000_000, 1024); - - pub TrustedReserveLocation: MultiLocation = Parent.into(); - pub TrustedReserveAsset: MultiAsset = MultiAsset { id: Concrete(TrustedReserveLocation::get()), fun: Fungible(1_000_000) }; - pub TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((TrustedReserveLocation::get(), TrustedReserveAsset::get())); -} - -impl pallet_xcm_benchmarks::fungible::Config for Test { - type TransactAsset = ItemOf; - type CheckedAccount = CheckingAccount; - type TrustedTeleporter = TrustedTeleporter; - - fn get_multi_asset() -> MultiAsset { - let min_balance = 100u64; - let asset_location: MultiLocation = GeneralIndex(TransactAssetId::get()).into(); - - assert_ok!(Assets::force_create( - RuntimeOrigin::root(), - TransactAssetId::get(), - 0u64, - true, - min_balance, - )); - - MultiAsset { - id: Concrete(asset_location), - fun: Fungible((min_balance * 100).into()), - } - } -} - -impl fungible::Config for Test { - type TrustedReserve = TrustedReserve; -} -impl Config for Test {} - -#[cfg(feature = "runtime-benchmarks")] -pub fn new_test_ext() -> sp_io::TestExternalities { - use sp_runtime::BuildStorage; - let t = GenesisConfig { - ..Default::default() - } - .build_storage() - .unwrap(); - - t.into() -} diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs index b0f0befdb5..980b6e8910 100644 --- a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs +++ b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs @@ -20,9 +20,6 @@ pub use pallet::*; pub mod benchmarking; -#[cfg(test)] -pub mod mock; - #[frame_support::pallet] pub mod pallet { #[pallet::config] diff --git a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs index fb702ab447..d7c0e3a739 100644 --- a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs +++ b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs @@ -144,11 +144,7 @@ mod benchmarks { ))) } - impl_benchmark_test_suite!( - Pallet, - crate::generic::mock::new_test_ext(), - crate::generic::mock::Test - ); + impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test); } pub struct XcmGenericBenchmarks(sp_std::marker::PhantomData); diff --git a/pallets/astar-xcm-benchmarks/src/generic/mock.rs b/pallets/astar-xcm-benchmarks/src/generic/mock.rs deleted file mode 100644 index 4f35029c40..0000000000 --- a/pallets/astar-xcm-benchmarks/src/generic/mock.rs +++ /dev/null @@ -1,230 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later - -// Astar 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. - -// Astar 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 Astar. If not, see . - -//! A mock runtime for XCM benchmarking. - -use crate::{generic, mock::*, *}; -use frame_benchmarking::BenchmarkError; -use frame_support::{ - parameter_types, - traits::{Everything, OriginTrait}, -}; -use parity_scale_codec::Decode; -use sp_core::H256; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput}, - BuildStorage, -}; -use xcm::latest::prelude::*; -use xcm_builder::{ - test_utils::{ - Assets, TestAssetExchanger, TestAssetLocker, TestAssetTrap, TestSubscriptionService, - TestUniversalAliases, - }, - AllowUnpaidExecutionFrom, -}; -use xcm_executor::traits::ConvertOrigin; - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; - -frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Pallet, Call, Config, Storage, Event} = 10, - PolkadotXcmBenchmarks: pallet_xcm_benchmarks::generic::{Pallet}, - XcmGenericBenchmarks: generic::{Pallet}, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub UniversalLocation: InteriorMultiLocation = Here; -} - -impl frame_system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type RuntimeCall = RuntimeCall; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -/// The benchmarks in this pallet should never need an asset transactor to begin with. -pub struct NoAssetTransactor; -impl xcm_executor::traits::TransactAsset for NoAssetTransactor { - fn deposit_asset(_: &MultiAsset, _: &MultiLocation, _: &XcmContext) -> Result<(), XcmError> { - unreachable!(); - } - - fn withdraw_asset( - _: &MultiAsset, - _: &MultiLocation, - _: Option<&XcmContext>, - ) -> Result { - unreachable!(); - } -} - -parameter_types! { - pub const MaxInstructions: u32 = 100; - pub const MaxAssetsIntoHolding: u32 = 64; -} - -pub struct XcmConfig; -impl xcm_executor::Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = DevNull; - type AssetTransactor = NoAssetTransactor; - type OriginConverter = AlwaysSignedByDefault; - type IsReserve = AllAssetLocationsPass; - type IsTeleporter = (); - type UniversalLocation = UniversalLocation; - type Barrier = AllowUnpaidExecutionFrom; - type Weigher = xcm_builder::FixedWeightBounds; - type Trader = xcm_builder::FixedRateOfFungible; - type ResponseHandler = DevNull; - type AssetTrap = TestAssetTrap; - type AssetLocker = TestAssetLocker; - type AssetExchanger = TestAssetExchanger; - type AssetClaims = TestAssetTrap; - type SubscriptionService = TestSubscriptionService; - type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type FeeManager = (); - // No bridges yet... - type MessageExporter = (); - type UniversalAliases = TestUniversalAliases; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = Everything; -} - -impl pallet_xcm_benchmarks::Config for Test { - type XcmConfig = XcmConfig; - type AccountIdConverter = AccountIdConverter; - fn valid_destination() -> Result { - let valid_destination: MultiLocation = Junction::AccountId32 { - network: None, - id: [0u8; 32], - } - .into(); - - Ok(valid_destination) - } - fn worst_case_holding(_depositable_count: u32) -> MultiAssets { - crate::mock::mock_worst_case_holding() - } -} - -impl pallet_xcm_benchmarks::generic::Config for Test { - type RuntimeCall = RuntimeCall; - - fn worst_case_response() -> (u64, Response) { - let assets: MultiAssets = (Concrete(Here.into()), 100).into(); - (0, Response::Assets(assets)) - } - - fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { - Err(BenchmarkError::Skip) - } - - fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { - Err(BenchmarkError::Skip) - } - - fn export_message_origin_and_destination( - ) -> Result<(MultiLocation, NetworkId, Junctions), BenchmarkError> { - Err(BenchmarkError::Skip) - } - - fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { - Ok(( - Default::default(), - frame_system::Call::remark_with_event { remark: vec![] }.into(), - )) - } - - fn subscribe_origin() -> Result { - Ok(Default::default()) - } - - fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> { - let assets: MultiAssets = (Concrete(Here.into()), 100).into(); - let ticket = MultiLocation { - parents: 0, - interior: X1(GeneralIndex(0)), - }; - Ok((Default::default(), ticket, assets)) - } - - fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { - Err(BenchmarkError::Skip) - } -} - -impl generic::Config for Test {} -impl Config for Test {} - -pub fn new_test_ext() -> sp_io::TestExternalities { - let t = GenesisConfig { - ..Default::default() - } - .build_storage() - .unwrap(); - t.into() -} - -pub struct AlwaysSignedByDefault(core::marker::PhantomData); -impl ConvertOrigin for AlwaysSignedByDefault -where - Origin: OriginTrait, - ::AccountId: Decode, -{ - fn convert_origin( - _origin: impl Into, - _kind: OriginKind, - ) -> Result { - Ok(Origin::signed( - ::AccountId::decode(&mut TrailingZeroInput::zeroes()) - .expect("infinite length input; no invalid inputs for type; qed"), - )) - } -} diff --git a/pallets/astar-xcm-benchmarks/src/generic/mod.rs b/pallets/astar-xcm-benchmarks/src/generic/mod.rs index 6e4e09c44c..3278020bed 100644 --- a/pallets/astar-xcm-benchmarks/src/generic/mod.rs +++ b/pallets/astar-xcm-benchmarks/src/generic/mod.rs @@ -20,9 +20,6 @@ pub use pallet::*; pub mod benchmarking; -#[cfg(test)] -pub mod mock; - #[frame_support::pallet] pub mod pallet { #[pallet::config] diff --git a/pallets/astar-xcm-benchmarks/src/mock.rs b/pallets/astar-xcm-benchmarks/src/mock.rs index 3bac16114f..083cb38fe2 100644 --- a/pallets/astar-xcm-benchmarks/src/mock.rs +++ b/pallets/astar-xcm-benchmarks/src/mock.rs @@ -16,8 +16,67 @@ // You should have received a copy of the GNU General Public License // along with Astar. If not, see . -use frame_support::{dispatch::Weight, parameter_types, traits::ContainsPair}; +//! A mock runtime for XCM benchmarking. + +use crate::{fungible, generic, *}; +use astar_primitives::xcm::ReserveAssetFilter; +use frame_benchmarking::BenchmarkError; +use frame_support::{ + assert_ok, parameter_types, + traits::{fungible::ItemOf, AsEnsureOriginWithArg, Everything, Nothing}, + weights::Weight, +}; +use frame_system::{EnsureRoot, EnsureSigned}; + +use core::marker::PhantomData; +use sp_core::{ConstU32, ConstU64, Get, H256}; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, +}; use xcm::latest::prelude::*; +use xcm_builder::{AllowUnpaidExecutionFrom, FungiblesAdapter, MintLocation, NoChecking}; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; +type Balance = u64; +type AccountId = u64; +type AssetId = u128; + +// For testing the pallet, we construct a mock runtime. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event} = 10, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + Assets: pallet_assets::{Pallet, Call, Storage, Event}, + PolkadotXcmGenericBenchmarks: pallet_xcm_benchmarks::generic::{Pallet}, + PolkadotXcmFungibleBenchmarks: pallet_xcm_benchmarks::fungible::{Pallet}, + XcmAssetsBenchmark: fungible::{Pallet}, + XcmGenericBenchmarks: generic::{Pallet}, + } +); + +pub struct AccountIdConverter; +impl xcm_executor::traits::Convert for AccountIdConverter { + fn convert(ml: MultiLocation) -> Result { + match ml { + MultiLocation { + parents: 0, + interior: X1(Junction::AccountId32 { id, .. }), + } => Ok(::decode(&mut &*id.to_vec()).unwrap()), + _ => Err(ml), + } + } + + fn reverse(acc: u64) -> Result { + Err(acc) + } +} // An xcm sender/receiver akin to > /dev/null pub struct DevNull; @@ -52,41 +111,269 @@ impl xcm_executor::traits::OnResponse for DevNull { } } -pub struct AccountIdConverter; -impl xcm_executor::traits::Convert for AccountIdConverter { - fn convert(ml: MultiLocation) -> Result { - match ml { - MultiLocation { - parents: 0, - interior: X1(Junction::AccountId32 { id, .. }), - } => Ok(::decode(&mut &*id.to_vec()).unwrap()), - _ => Err(ml), +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub BlockWeights: frame_system::limits::BlockWeights = + frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, u64::MAX)); + pub UniversalLocation: InteriorMultiLocation = Here; +} +impl frame_system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type RuntimeCall = RuntimeCall; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = ConstU32<16>; +} + +parameter_types! { + pub const ExistentialDeposit: u64 = 10; +} + +impl pallet_balances::Config for Test { + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type HoldIdentifier = (); + type FreezeIdentifier = (); + type MaxHolds = ConstU32<0>; + type MaxFreezes = ConstU32<0>; +} + +impl pallet_assets::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type AssetId = AssetId; + type AssetIdParameter = AssetId; + type Currency = Balances; + type CreateOrigin = AsEnsureOriginWithArg>; + type ForceOrigin = EnsureRoot; + type AssetDeposit = ConstU64<10>; + type MetadataDepositBase = ConstU64<10>; + type MetadataDepositPerByte = ConstU64<1>; + type AssetAccountDeposit = ConstU64<10>; + type ApprovalDeposit = ConstU64<10>; + type StringLimit = ConstU32<50>; + type Freezer = (); + type Extra = (); + type RemoveItemsLimit = ConstU32<100>; + type CallbackHandle = (); + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + +pub struct MatchOnlyAsset(PhantomData); +impl> xcm_executor::traits::MatchesFungibles + for MatchOnlyAsset +{ + fn matches_fungibles( + a: &MultiAsset, + ) -> core::result::Result<(AssetId, Balance), xcm_executor::traits::prelude::Error> { + use sp_runtime::traits::SaturatedConversion; + match a { + MultiAsset { + fun: Fungible(amount), + .. + } => Ok((Asset::get(), (*amount).saturated_into::())), + _ => Err(xcm_executor::traits::prelude::Error::AssetNotHandled), } } +} - fn reverse(acc: u64) -> Result { - Err(acc) +parameter_types! { + pub const DummyCheckingAccount: AccountId = 0; + + // AssetId used as a fungible for benchmarks + pub const TransactAssetId: u128 = 1; + pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) }; +} + +// Use ONLY assets as the asset transactor. +pub type AssetTransactor = FungiblesAdapter< + Assets, + MatchOnlyAsset, + AccountIdConverter, + AccountId, + NoChecking, + DummyCheckingAccount, +>; + +parameter_types! { + /// Maximum number of instructions in a single XCM fragment. A sanity check against weight + /// calculations getting too crazy. + pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; + + pub const WeightPrice: (xcm::latest::AssetId, u128, u128) = (Concrete(TransactAssetLocation::get()), 1_000_000, 1024); + pub const UnitWeightCost: u64 = 10; +} + +pub struct XcmConfig; +impl xcm_executor::Config for XcmConfig { + type RuntimeCall = RuntimeCall; + type XcmSender = DevNull; + type AssetTransactor = AssetTransactor; + type OriginConverter = (); + type IsReserve = ReserveAssetFilter; + type IsTeleporter = (); + type UniversalLocation = UniversalLocation; + type Barrier = AllowUnpaidExecutionFrom; + type Weigher = xcm_builder::FixedWeightBounds; + type Trader = xcm_builder::FixedRateOfFungible; + type ResponseHandler = DevNull; + type AssetTrap = (); + type AssetLocker = (); + type AssetExchanger = (); + type AssetClaims = (); + type SubscriptionService = (); + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; +} + +impl pallet_xcm_benchmarks::Config for Test { + type XcmConfig = XcmConfig; + type AccountIdConverter = AccountIdConverter; + fn valid_destination() -> Result { + let valid_destination: MultiLocation = X1(AccountId32 { + network: None, + id: [0u8; 32], + }) + .into(); + + Ok(valid_destination) + } + fn worst_case_holding(_depositable_count: u32) -> MultiAssets { + let assets: Vec = vec![MultiAsset { + id: Concrete(MultiLocation::parent()), + fun: Fungible(u128::MAX), + }]; + assets.into() + } +} + +impl pallet_xcm_benchmarks::generic::Config for Test { + type RuntimeCall = RuntimeCall; + + fn worst_case_response() -> (u64, Response) { + let assets: MultiAssets = (Concrete(Here.into()), 100).into(); + (0, Response::Assets(assets)) + } + + fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn export_message_origin_and_destination( + ) -> Result<(MultiLocation, NetworkId, Junctions), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok(( + Default::default(), + frame_system::Call::remark_with_event { remark: vec![] }.into(), + )) + } + + fn subscribe_origin() -> Result { + Ok(Default::default()) + } + + fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> { + let assets: MultiAssets = (Concrete(Here.into()), 100).into(); + let ticket = MultiLocation { + parents: 0, + interior: X1(GeneralIndex(0)), + }; + Ok((Default::default(), ticket, assets)) + } + + fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) } } parameter_types! { - pub Ancestry: MultiLocation = Junction::Parachain(101).into(); - pub UnitWeightCost: u64 = 10; - pub WeightPrice: (AssetId, u128, u128) = (Concrete(MultiLocation::parent()), 1_000_000, 1024); + pub const CheckingAccount: Option<(u64, MintLocation)> = None; + pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = None; } -pub struct AllAssetLocationsPass; -impl ContainsPair for AllAssetLocationsPass { - fn contains(_: &MultiAsset, _: &MultiLocation) -> bool { - true +impl pallet_xcm_benchmarks::fungible::Config for Test { + type TransactAsset = ItemOf; + type CheckedAccount = CheckingAccount; + type TrustedTeleporter = TrustedTeleporter; + + fn get_multi_asset() -> MultiAsset { + let min_balance = 100u64; + let asset_location: MultiLocation = GeneralIndex(TransactAssetId::get()).into(); + + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TransactAssetId::get(), + 0u64, + true, + min_balance, + )); + + MultiAsset { + id: Concrete(asset_location), + fun: Fungible((min_balance * 100).into()), + } } } -#[cfg(feature = "runtime-benchmarks")] -pub fn mock_worst_case_holding() -> MultiAssets { - let assets: Vec = vec![MultiAsset { - id: Concrete(MultiLocation::parent()), - fun: Fungible(u128::MAX), - }]; - assets.into() +parameter_types! { + pub TrustedReserveLocation: MultiLocation = Parent.into(); + pub TrustedReserveAsset: MultiAsset = MultiAsset { id: Concrete(TrustedReserveLocation::get()), fun: Fungible(1_000_000) }; + pub TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((TrustedReserveLocation::get(), TrustedReserveAsset::get())); +} + +impl fungible::Config for Test { + type TrustedReserve = TrustedReserve; +} + +impl generic::Config for Test {} +impl Config for Test {} + +pub fn new_test_ext() -> sp_io::TestExternalities { + let t = GenesisConfig { + ..Default::default() + } + .build_storage() + .unwrap(); + t.into() } From 8b0b9fe2e7e9272861899abcc52162d4db606b70 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Thu, 11 Jan 2024 15:16:54 +0530 Subject: [PATCH 09/15] feat: refactor code --- pallets/astar-xcm-benchmarks/Cargo.toml | 5 +- .../src/fungible/benchmarking.rs | 66 +++---------------- .../astar-xcm-benchmarks/src/fungible/mod.rs | 1 + .../src/generic/benchmarking.rs | 48 ++------------ .../astar-xcm-benchmarks/src/generic/mod.rs | 1 + pallets/astar-xcm-benchmarks/src/lib.rs | 43 ++++++++++-- pallets/astar-xcm-benchmarks/src/mock.rs | 3 +- 7 files changed, 56 insertions(+), 111 deletions(-) diff --git a/pallets/astar-xcm-benchmarks/Cargo.toml b/pallets/astar-xcm-benchmarks/Cargo.toml index b8236ad013..62a2af64bf 100644 --- a/pallets/astar-xcm-benchmarks/Cargo.toml +++ b/pallets/astar-xcm-benchmarks/Cargo.toml @@ -17,7 +17,7 @@ serde = { workspace = true, optional = true } frame-support = { workspace = true } frame-system = { workspace = true } parity-scale-codec = { workspace = true, optional = true, features = ["derive"] } -scale-info = { workspace = true, optional = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } sp-std = { workspace = true } # Polkadot / XCM @@ -40,7 +40,7 @@ sp-runtime = { workspace = true, features = ["std"] } xcm-builder = { workspace = true, features = ["std"] } [features] -default = ["std", "runtime-benchmarks"] +default = ["std"] std = [ "astar-primitives/std", "frame-benchmarking/std", @@ -61,6 +61,5 @@ runtime-benchmarks = [ "pallet-assets/runtime-benchmarks", "pallet-xcm-benchmarks/runtime-benchmarks", "parity-scale-codec", - "scale-info", "xcm-executor/runtime-benchmarks", ] diff --git a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs index 8c47e7c683..4246c1076d 100644 --- a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs +++ b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs @@ -16,14 +16,17 @@ // You should have received a copy of the GNU General Public License // along with Astar. If not, see . -use super::*; +use super::{Pallet as AstarBenchmarks, *}; +use crate::WrappedBenchmark; use frame_benchmarking::v2::*; use frame_support::{ dispatch::Weight, traits::{fungible::Inspect, Get}, }; -use pallet_xcm_benchmarks::{account_and_location, new_executor, AssetTransactorOf}; -use sp_std::{vec, vec::Vec}; +use pallet_xcm_benchmarks::{ + account_and_location, fungible::Pallet as PalletXcmBenchmarks, new_executor, AssetTransactorOf, +}; +use sp_std::vec; use xcm::latest::prelude::*; use xcm_executor::traits::{Convert, TransactAsset}; @@ -174,61 +177,8 @@ mod benchmarks { impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test); } -pub struct XcmFungibleBenchmarks(sp_std::marker::PhantomData); -// Benchmarks wrapper -impl frame_benchmarking::Benchmarking for XcmFungibleBenchmarks -where - <>::Balance as TryInto>::Error: - sp_std::fmt::Debug, -{ - fn benchmarks(extra: bool) -> Vec { - // all the fungible xcm benchmarks - use crate::fungible::Pallet as AstarXcmFungibleBench; - use pallet_xcm_benchmarks::fungible::Pallet as PalletXcmFungibleBench; - - let mut benchmarks = PalletXcmFungibleBench::::benchmarks(extra); - // append the aditional benchmark - // TODO: remove this once we uplift to new polkadot release - if let Some(bench) = AstarXcmFungibleBench::::benchmarks(true) - .into_iter() - .find(|b| b.name == "reserve_asset_deposited".as_bytes().to_vec()) - { - benchmarks.push(bench); - } - benchmarks - } - fn run_benchmark( - extrinsic: &[u8], - c: &[(frame_benchmarking::BenchmarkParameter, u32)], - whitelist: &[frame_benchmarking::TrackedStorageKey], - verify: bool, - internal_repeats: u32, - ) -> Result, frame_benchmarking::BenchmarkError> { - use pallet_xcm_benchmarks::fungible::Pallet as PalletXcmFungibleBench; - - use crate::fungible::Pallet as AstarXcmFungibleBench; - if AstarXcmFungibleBench::::benchmarks(true) - .iter() - .any(|x| x.name == extrinsic) - { - AstarXcmFungibleBench::::run_benchmark( - extrinsic, - c, - whitelist, - verify, - internal_repeats, - ) - } else { - PalletXcmFungibleBench::::run_benchmark( - extrinsic, - c, - whitelist, - verify, - internal_repeats, - ) - } - } -} +// wrapper benchmarks +pub type XcmFungibleBenchmarks = WrappedBenchmark, PalletXcmBenchmarks>; /// Take out the ED from given MultiAsset (if fungible) fn take_minimum_balance( diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs index 980b6e8910..6e4fa21e6b 100644 --- a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs +++ b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs @@ -18,6 +18,7 @@ pub use pallet::*; +#[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; #[frame_support::pallet] diff --git a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs index d7c0e3a739..cfda02a2a3 100644 --- a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs +++ b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs @@ -16,13 +16,12 @@ // You should have received a copy of the GNU General Public License // along with Astar. If not, see . -use super::*; +use super::{Pallet as AstarBenchmarks, *}; +use crate::WrappedBenchmark; use frame_benchmarking::v2::*; -// use frame_benchmarking::{benchmarks, BenchmarkError, BenchmarkResult}; use frame_support::dispatch::Weight; -use pallet_xcm_benchmarks::{new_executor, XcmCallOf}; +use pallet_xcm_benchmarks::{generic::Pallet as PalletXcmBenchmarks, new_executor, XcmCallOf}; use sp_std::vec; -use sp_std::vec::Vec; use xcm::latest::prelude::*; #[benchmarks] @@ -147,43 +146,4 @@ mod benchmarks { impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test); } -pub struct XcmGenericBenchmarks(sp_std::marker::PhantomData); -// Benchmarks wrapper -impl frame_benchmarking::Benchmarking for XcmGenericBenchmarks { - fn benchmarks(extra: bool) -> Vec { - // all the generic xcm benchmarks - use pallet_xcm_benchmarks::generic::Pallet as PalletXcmGenericBench; - PalletXcmGenericBench::::benchmarks(extra) - } - fn run_benchmark( - extrinsic: &[u8], - c: &[(frame_benchmarking::BenchmarkParameter, u32)], - whitelist: &[frame_benchmarking::TrackedStorageKey], - verify: bool, - internal_repeats: u32, - ) -> Result, frame_benchmarking::BenchmarkError> { - use pallet_xcm_benchmarks::generic::Pallet as PalletXcmGenericBench; - - use crate::generic::Pallet as AstarXcmGenericBench; - if AstarXcmGenericBench::::benchmarks(true) - .iter() - .any(|x| x.name == extrinsic) - { - AstarXcmGenericBench::::run_benchmark( - extrinsic, - c, - whitelist, - verify, - internal_repeats, - ) - } else { - PalletXcmGenericBench::::run_benchmark( - extrinsic, - c, - whitelist, - verify, - internal_repeats, - ) - } - } -} +pub type XcmGenericBenchmarks = WrappedBenchmark, PalletXcmBenchmarks>; diff --git a/pallets/astar-xcm-benchmarks/src/generic/mod.rs b/pallets/astar-xcm-benchmarks/src/generic/mod.rs index 3278020bed..715e12fbfa 100644 --- a/pallets/astar-xcm-benchmarks/src/generic/mod.rs +++ b/pallets/astar-xcm-benchmarks/src/generic/mod.rs @@ -18,6 +18,7 @@ pub use pallet::*; +#[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; #[frame_support::pallet] diff --git a/pallets/astar-xcm-benchmarks/src/lib.rs b/pallets/astar-xcm-benchmarks/src/lib.rs index 0046022adb..437c8fa4cd 100644 --- a/pallets/astar-xcm-benchmarks/src/lib.rs +++ b/pallets/astar-xcm-benchmarks/src/lib.rs @@ -18,15 +18,48 @@ #![cfg_attr(not(feature = "std"), no_std)] -#[cfg(feature = "runtime-benchmarks")] -pub mod generic; - -#[cfg(feature = "runtime-benchmarks")] pub mod fungible; +pub mod generic; #[cfg(test)] mod mock; -#[cfg(feature = "runtime-benchmarks")] +use sp_std::vec::Vec; + /// A base trait for all individual pallets pub trait Config: frame_system::Config + pallet_xcm_benchmarks::Config {} + +/// This is a wrapper benchmark implementation over `Inner` by `Outer` by merging +/// the benches from `Inner` if they don't exist in `Outer`. +pub struct WrappedBenchmark(core::marker::PhantomData<(Outer, Inner)>); +impl frame_benchmarking::Benchmarking for WrappedBenchmark +where + Outer: frame_benchmarking::Benchmarking, + Inner: frame_benchmarking::Benchmarking, +{ + fn benchmarks(extra: bool) -> Vec { + let mut outer = Outer::benchmarks(extra); + let inner = Inner::benchmarks(extra); + + for meta in inner { + if outer.iter().find(|m| m.name == meta.name).is_none() { + outer.push(meta) + } + } + outer + } + + fn run_benchmark( + name: &[u8], + c: &[(frame_benchmarking::BenchmarkParameter, u32)], + whitelist: &[frame_benchmarking::TrackedStorageKey], + verify: bool, + internal_repeats: u32, + ) -> Result, frame_benchmarking::BenchmarkError> { + if Outer::benchmarks(true).iter().any(|x| x.name == name) { + Outer::run_benchmark(name, c, whitelist, verify, internal_repeats) + } else { + Inner::run_benchmark(name, c, whitelist, verify, internal_repeats) + } + } +} diff --git a/pallets/astar-xcm-benchmarks/src/mock.rs b/pallets/astar-xcm-benchmarks/src/mock.rs index 083cb38fe2..bbfb01cbad 100644 --- a/pallets/astar-xcm-benchmarks/src/mock.rs +++ b/pallets/astar-xcm-benchmarks/src/mock.rs @@ -33,7 +33,6 @@ use sp_core::{ConstU32, ConstU64, Get, H256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, - BuildStorage, }; use xcm::latest::prelude::*; use xcm_builder::{AllowUnpaidExecutionFrom, FungiblesAdapter, MintLocation, NoChecking}; @@ -369,7 +368,9 @@ impl fungible::Config for Test { impl generic::Config for Test {} impl Config for Test {} +#[cfg(feature = "runtime-benchmarks")] pub fn new_test_ext() -> sp_io::TestExternalities { + use sp_runtime::BuildStorage; let t = GenesisConfig { ..Default::default() } From 9399e5fa7ac907d957a18aaba29e0cf47c1d08d1 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Thu, 11 Jan 2024 15:47:58 +0530 Subject: [PATCH 10/15] fix: make clippy happy --- pallets/astar-xcm-benchmarks/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/astar-xcm-benchmarks/src/lib.rs b/pallets/astar-xcm-benchmarks/src/lib.rs index 437c8fa4cd..b0f232da72 100644 --- a/pallets/astar-xcm-benchmarks/src/lib.rs +++ b/pallets/astar-xcm-benchmarks/src/lib.rs @@ -42,7 +42,7 @@ where let inner = Inner::benchmarks(extra); for meta in inner { - if outer.iter().find(|m| m.name == meta.name).is_none() { + if !outer.iter().any(|m| m.name == meta.name) { outer.push(meta) } } From 4a847349fc9cfc7cc3725f2a91ea40c987c7f449 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Thu, 11 Jan 2024 18:41:11 +0530 Subject: [PATCH 11/15] fix: buy execution benchmarks --- Cargo.lock | 1 + pallets/astar-xcm-benchmarks/Cargo.toml | 2 +- .../src/generic/benchmarking.rs | 4 +- .../astar-xcm-benchmarks/weights-fungible.rs | 100 ++++++++++++++++++ primitives/Cargo.toml | 2 + primitives/src/benchmarks.rs | 77 +++++++++++++- runtime/shibuya/src/lib.rs | 20 +--- 7 files changed, 183 insertions(+), 23 deletions(-) create mode 100644 pallets/astar-xcm-benchmarks/weights-fungible.rs diff --git a/Cargo.lock b/Cargo.lock index b8e727b1bb..013c0838a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -521,6 +521,7 @@ dependencies = [ "ethereum-types", "fp-evm", "frame-support", + "frame-system", "impl-trait-for-tuples", "log", "orml-traits", diff --git a/pallets/astar-xcm-benchmarks/Cargo.toml b/pallets/astar-xcm-benchmarks/Cargo.toml index 62a2af64bf..d115be0b6a 100644 --- a/pallets/astar-xcm-benchmarks/Cargo.toml +++ b/pallets/astar-xcm-benchmarks/Cargo.toml @@ -17,7 +17,7 @@ serde = { workspace = true, optional = true } frame-support = { workspace = true } frame-system = { workspace = true } parity-scale-codec = { workspace = true, optional = true, features = ["derive"] } -scale-info = { workspace = true, features = ["derive"] } +scale-info = { workspace = true } sp-std = { workspace = true } # Polkadot / XCM diff --git a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs index cfda02a2a3..d244fd0da1 100644 --- a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs +++ b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs @@ -44,7 +44,9 @@ mod benchmarks { let instruction = Instruction::>::BuyExecution { fees: (fee_asset, 100_000_000u128).into(), // should be something inside of holding - weight_limit: WeightLimit::Unlimited, + // this should not be Unlimited, as xcm-executor will skip buying the + // exceution altogether. + weight_limit: WeightLimit::Limited(Weight::from_parts(1u64, 1024)), }; let xcm = Xcm(vec![instruction]); diff --git a/pallets/astar-xcm-benchmarks/weights-fungible.rs b/pallets/astar-xcm-benchmarks/weights-fungible.rs new file mode 100644 index 0000000000..4c5d126127 --- /dev/null +++ b/pallets/astar-xcm-benchmarks/weights-fungible.rs @@ -0,0 +1,100 @@ + +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar 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. + +// Astar 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 Astar. If not, see . + +//! Autogenerated weights for xcm_benchmarks_generic +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2024-01-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Ashutoshs-MacBook-Pro.local`, CPU: `` +//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/astar-collator +// benchmark +// pallet +// --chain=shibuya-dev +// --steps=50 +// --repeat=20 +// --pallet=xcm_benchmarks_generic +// --extrinsic=buy_execution +// --execution=native +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./pallets/astar-xcm-benchmarks/weights-fungible.rs +// --template=./scripts/templates/weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions needed for xcm_benchmarks_generic. +pub trait WeightInfo { + fn buy_execution() -> Weight; +} + +/// Weights for xcm_benchmarks_generic using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured) + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn buy_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `2468` + // Estimated: `5933` + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(52_000_000, 5933) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured) + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn buy_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `2468` + // Estimated: `5933` + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(52_000_000, 5933) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } +} diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 0cbe00078a..8cac9bf8aa 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -20,6 +20,7 @@ fp-evm = { workspace = true } # Substrate dependencies frame-support = { workspace = true } +frame-system = { workspace = true } pallet-assets = { workspace = true } sp-arithmetic = { workspace = true } sp-core = { workspace = true } @@ -53,6 +54,7 @@ std = [ "ethereum/std", "fp-evm/std", "frame-support/std", + "frame-system/std", "sp-std/std", "sp-runtime/std", "sp-core/std", diff --git a/primitives/src/benchmarks.rs b/primitives/src/benchmarks.rs index f0cfa392df..c06d6da29d 100644 --- a/primitives/src/benchmarks.rs +++ b/primitives/src/benchmarks.rs @@ -16,11 +16,16 @@ // You should have received a copy of the GNU General Public License // along with Astar. If not, see . -use crate::AssetId; - -#[cfg(feature = "runtime-benchmarks")] +use crate::{xcm::MAX_ASSETS, Address, AssetId}; +use core::marker::PhantomData; +use frame_support::{assert_ok, dispatch::RawOrigin, traits::IsType}; +use sp_runtime::traits::StaticLookup; +use sp_std::{boxed::Box, vec::Vec}; +use xcm::prelude::*; /// Benchmark helper for `pallet-assets`. pub struct AssetsBenchmarkHelper; + +#[cfg(feature = "runtime-benchmarks")] impl> pallet_assets::BenchmarkHelper for AssetsBenchmarkHelper { @@ -28,3 +33,69 @@ impl> pallet_assets::BenchmarkHelper(PhantomData); +impl XcmBenchmarkHelper +where + T: pallet_assets::Config + pallet_xc_asset_config::Config, + ::AssetIdParameter: From, + ::Balance: IsType, + ::AssetId: IsType, + <::Lookup as StaticLookup>::Source: IsType
, +{ + /// Get the worst case holding for xcm benchmarks + /// Scenario: Max allowed fungible assets (pallet_assets) + pub fn worst_case_holding() -> MultiAssets { + let fungibles = MAX_ASSETS - 1; + let fungibles_amount: u128 = 100_000; + let assets = (0..fungibles) + .map(|i| MultiAsset { + id: Concrete(GeneralIndex(i as u128).into()), + fun: Fungible(fungibles_amount * i as u128), + }) + // adding relay asset as it is used in buy execution benchmarks + .chain(core::iter::once(MultiAsset { + id: Concrete(MultiLocation::parent()), + fun: Fungible(u128::MAX), + })) + .collect::>(); + + // register the assets + for (i, asset) in assets.iter().enumerate() { + if let MultiAsset { + id: Concrete(location), + fun: Fungible(_), + } = asset + { + // create the asset + assert_ok!(pallet_assets::Pallet::::force_create( + RawOrigin::Root.into(), + (i as u128).into(), + // min balance, no significane in holding + Address::Id([0u8; 32].into()).into(), + true, + // min balance, no significane in holding + 1u128.into() + )); + + // register asset in XcAssetConfig + assert_ok!( + pallet_xc_asset_config::Pallet::::register_asset_location( + RawOrigin::Root.into(), + Box::new(location.clone().into_versioned()), + (i as u128).into(), + ) + ); + assert_ok!( + pallet_xc_asset_config::Pallet::::set_asset_units_per_second( + RawOrigin::Root.into(), + Box::new(location.clone().into_versioned()), + 1_000_000_000_000u128, + ) + ); + } + } + + assets.into() + } +} diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 44d6c2c13b..417a774573 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -1989,8 +1989,7 @@ impl_runtime_apis! { use baseline::Pallet as BaselineBench; use xcm::latest::prelude::*; use xcm_builder::MintLocation; - use xcm_config::MaxAssetsIntoHolding; - + use astar_primitives::benchmarks::XcmBenchmarkHelper; impl frame_system_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} @@ -2009,22 +2008,7 @@ impl_runtime_apis! { Ok(MultiLocation::parent()) } fn worst_case_holding(_depositable_count: u32) -> MultiAssets { - // max fungible assests with a native asset - let fungibles = MaxAssetsIntoHolding::get() - 1; - let fungibles_amount: u128 = 100; - (0..fungibles).map(|i| { - MultiAsset { - id: Concrete(GeneralIndex(i as u128).into()), - fun: Fungible(fungibles_amount * i as u128), - } - }).chain( - core::iter::once( - MultiAsset { - id: Concrete(MultiLocation::parent()), - fun: Fungible(u128::MAX) - } - ) - ).collect::>().into() + XcmBenchmarkHelper::::worst_case_holding() } } From 121a505ff16ff20eed77be0ea928b8e9c75c46aa Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Thu, 11 Jan 2024 18:42:30 +0530 Subject: [PATCH 12/15] chore: remove file --- .../astar-xcm-benchmarks/weights-fungible.rs | 100 ------------------ 1 file changed, 100 deletions(-) delete mode 100644 pallets/astar-xcm-benchmarks/weights-fungible.rs diff --git a/pallets/astar-xcm-benchmarks/weights-fungible.rs b/pallets/astar-xcm-benchmarks/weights-fungible.rs deleted file mode 100644 index 4c5d126127..0000000000 --- a/pallets/astar-xcm-benchmarks/weights-fungible.rs +++ /dev/null @@ -1,100 +0,0 @@ - -// This file is part of Astar. - -// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later - -// Astar 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. - -// Astar 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 Astar. If not, see . - -//! Autogenerated weights for xcm_benchmarks_generic -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-01-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Ashutoshs-MacBook-Pro.local`, CPU: `` -//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/astar-collator -// benchmark -// pallet -// --chain=shibuya-dev -// --steps=50 -// --repeat=20 -// --pallet=xcm_benchmarks_generic -// --extrinsic=buy_execution -// --execution=native -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./pallets/astar-xcm-benchmarks/weights-fungible.rs -// --template=./scripts/templates/weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use core::marker::PhantomData; - -/// Weight functions needed for xcm_benchmarks_generic. -pub trait WeightInfo { - fn buy_execution() -> Weight; -} - -/// Weights for xcm_benchmarks_generic using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured) - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn buy_execution() -> Weight { - // Proof Size summary in bytes: - // Measured: `2468` - // Estimated: `5933` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(52_000_000, 5933) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured) - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn buy_execution() -> Weight { - // Proof Size summary in bytes: - // Measured: `2468` - // Estimated: `5933` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(52_000_000, 5933) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } -} From d258dd847d6c4ad411989ca7ca51f09bde1b94c8 Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Sat, 13 Jan 2024 00:59:45 +0530 Subject: [PATCH 13/15] fix: benchmakrs --- runtime/shibuya/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 417a774573..ea2bdb3f55 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -2055,7 +2055,7 @@ impl_runtime_apis! { parameter_types! { pub const NoCheckingAccount: Option<(AccountId, MintLocation)> = None; pub const NoTeleporter: Option<(MultiLocation, MultiAsset)> = None; - pub const TransactAssetId: u128 = 1; + pub const TransactAssetId: u128 = 1001; pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) }; pub TrustedReserveLocation: MultiLocation = Parent.into(); From ec7587f49c9780849e421fb23bb6b98df20b293b Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Sat, 13 Jan 2024 16:41:48 +0530 Subject: [PATCH 14/15] feat: update weights from benchmarks --- runtime/shibuya/src/weights/xcm/fungible.rs | 232 +++++----- runtime/shibuya/src/weights/xcm/generic.rs | 476 ++++++++++---------- 2 files changed, 351 insertions(+), 357 deletions(-) diff --git a/runtime/shibuya/src/weights/xcm/fungible.rs b/runtime/shibuya/src/weights/xcm/fungible.rs index 6160061eb2..2d73746b4c 100644 --- a/runtime/shibuya/src/weights/xcm/fungible.rs +++ b/runtime/shibuya/src/weights/xcm/fungible.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for xcm_benchmarks_fungible //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-01-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-01-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 @@ -48,38 +48,19 @@ use core::marker::PhantomData; /// Weight functions needed for xcm_benchmarks_fungible. pub trait WeightInfo { - fn withdraw_asset() -> Weight; fn transfer_asset() -> Weight; fn transfer_reserve_asset() -> Weight; + fn reserve_asset_deposited() -> Weight; fn receive_teleported_asset() -> Weight; + fn initiate_teleport() -> Weight; + fn withdraw_asset() -> Weight; fn deposit_asset() -> Weight; fn deposit_reserve_asset() -> Weight; - fn initiate_teleport() -> Weight; - fn reserve_asset_deposited() -> Weight; } /// Weights for xcm_benchmarks_fungible using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn withdraw_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `688` - // Estimated: `4153` - // Minimum execution time: 48_708_000 picoseconds. - Weight::from_parts(49_394_000, 4153) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) /// Storage: Assets Asset (r:1 w:1) @@ -90,10 +71,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `544` + // Measured: `545` // Estimated: `6232` - // Minimum execution time: 49_225_000 picoseconds. - Weight::from_parts(49_700_000, 6232) + // Minimum execution time: 49_562_000 picoseconds. + Weight::from_parts(50_040_000, 6232) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -119,13 +100,20 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `720` + // Measured: `721` // Estimated: `6232` - // Minimum execution time: 72_392_000 picoseconds. - Weight::from_parts(73_104_000, 6232) + // Minimum execution time: 72_571_000 picoseconds. + Weight::from_parts(73_202_000, 6232) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } + fn reserve_asset_deposited() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_430_000 picoseconds. + Weight::from_parts(3_566_000, 0) + } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn receive_teleported_asset() -> Weight { @@ -135,6 +123,34 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. Weight::from_parts(18_446_744_073_709_551_000, 0) } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn initiate_teleport() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) + /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn withdraw_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `1960` + // Estimated: `5425` + // Minimum execution time: 57_091_000 picoseconds. + Weight::from_parts(57_836_000, 5425) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) /// Storage: Assets Asset (r:1 w:1) @@ -145,10 +161,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn deposit_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `424` - // Estimated: `3889` - // Minimum execution time: 37_873_000 picoseconds. - Weight::from_parts(38_273_000, 3889) + // Measured: `1696` + // Estimated: `5161` + // Minimum execution time: 45_650_000 picoseconds. + Weight::from_parts(46_029_000, 5161) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -174,66 +190,17 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `600` - // Estimated: `4065` - // Minimum execution time: 62_630_000 picoseconds. - Weight::from_parts(63_475_000, 4065) + // Measured: `1872` + // Estimated: `5337` + // Minimum execution time: 71_400_000 picoseconds. + Weight::from_parts(72_038_000, 5337) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn initiate_teleport() -> Weight { - // Proof Size summary in bytes: - // Measured: `308` - // Estimated: `3773` - // Minimum execution time: 39_637_000 picoseconds. - Weight::from_parts(40_123_000, 3773) - .saturating_add(T::DbWeight::get().reads(7_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - fn reserve_asset_deposited() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_440_000 picoseconds. - Weight::from_parts(3_603_000, 0) - } } // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn withdraw_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `688` - // Estimated: `4153` - // Minimum execution time: 48_708_000 picoseconds. - Weight::from_parts(49_394_000, 4153) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) /// Storage: Assets Asset (r:1 w:1) @@ -244,10 +211,10 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `544` + // Measured: `545` // Estimated: `6232` - // Minimum execution time: 49_225_000 picoseconds. - Weight::from_parts(49_700_000, 6232) + // Minimum execution time: 49_562_000 picoseconds. + Weight::from_parts(50_040_000, 6232) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -273,13 +240,20 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `720` + // Measured: `721` // Estimated: `6232` - // Minimum execution time: 72_392_000 picoseconds. - Weight::from_parts(73_104_000, 6232) + // Minimum execution time: 72_571_000 picoseconds. + Weight::from_parts(73_202_000, 6232) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } + fn reserve_asset_deposited() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_430_000 picoseconds. + Weight::from_parts(3_566_000, 0) + } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn receive_teleported_asset() -> Weight { @@ -289,6 +263,34 @@ impl WeightInfo for () { // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. Weight::from_parts(18_446_744_073_709_551_000, 0) } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn initiate_teleport() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) + /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn withdraw_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `1960` + // Estimated: `5425` + // Minimum execution time: 57_091_000 picoseconds. + Weight::from_parts(57_836_000, 5425) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) /// Storage: Assets Asset (r:1 w:1) @@ -299,10 +301,10 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn deposit_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `424` - // Estimated: `3889` - // Minimum execution time: 37_873_000 picoseconds. - Weight::from_parts(38_273_000, 3889) + // Measured: `1696` + // Estimated: `5161` + // Minimum execution time: 45_650_000 picoseconds. + Weight::from_parts(46_029_000, 5161) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -328,41 +330,11 @@ impl WeightInfo for () { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `600` - // Estimated: `4065` - // Minimum execution time: 62_630_000 picoseconds. - Weight::from_parts(63_475_000, 4065) + // Measured: `1872` + // Estimated: `5337` + // Minimum execution time: 71_400_000 picoseconds. + Weight::from_parts(72_038_000, 5337) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn initiate_teleport() -> Weight { - // Proof Size summary in bytes: - // Measured: `308` - // Estimated: `3773` - // Minimum execution time: 39_637_000 picoseconds. - Weight::from_parts(40_123_000, 3773) - .saturating_add(RocksDbWeight::get().reads(7_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - fn reserve_asset_deposited() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_440_000 picoseconds. - Weight::from_parts(3_603_000, 0) - } } diff --git a/runtime/shibuya/src/weights/xcm/generic.rs b/runtime/shibuya/src/weights/xcm/generic.rs index f009a7065f..6834118a3b 100644 --- a/runtime/shibuya/src/weights/xcm/generic.rs +++ b/runtime/shibuya/src/weights/xcm/generic.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for xcm_benchmarks_generic //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-01-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-01-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 @@ -48,8 +48,16 @@ use core::marker::PhantomData; /// Weight functions needed for xcm_benchmarks_generic. pub trait WeightInfo { - fn report_holding() -> Weight; fn buy_execution() -> Weight; + fn expect_pallet() -> Weight; + fn exchange_asset() -> Weight; + fn export_message() -> Weight; + fn lock_asset() -> Weight; + fn unlock_asset() -> Weight; + fn note_unlockable() -> Weight; + fn request_unlock() -> Weight; + fn universal_origin() -> Weight; + fn report_holding() -> Weight; fn query_response() -> Weight; fn transact() -> Weight; fn refund_surplus() -> Weight; @@ -70,25 +78,106 @@ pub trait WeightInfo { fn expect_error() -> Weight; fn expect_transact_status() -> Weight; fn query_pallet() -> Weight; - fn expect_pallet() -> Weight; fn report_transact_status() -> Weight; fn clear_transact_status() -> Weight; fn set_topic() -> Weight; fn clear_topic() -> Weight; - fn exchange_asset() -> Weight; - fn universal_origin() -> Weight; - fn export_message() -> Weight; fn set_fees_mode() -> Weight; - fn lock_asset() -> Weight; - fn unlock_asset() -> Weight; - fn note_unlockable() -> Weight; - fn request_unlock() -> Weight; fn unpaid_execution() -> Weight; } /// Weights for xcm_benchmarks_generic using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { + /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured) + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn buy_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `2468` + // Estimated: `5933` + // Minimum execution time: 110_783_000 picoseconds. + Weight::from_parts(115_074_000, 5933) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + fn expect_pallet() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_111_000 picoseconds. + Weight::from_parts(7_262_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn exchange_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn export_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn lock_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn unlock_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn note_unlockable() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn request_unlock() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn universal_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) + } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -105,76 +194,69 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 348_128_000 picoseconds. - Weight::from_parts(355_569_000, 3641) + // Minimum execution time: 356_141_000 picoseconds. + Weight::from_parts(360_928_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } - fn buy_execution() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_575_000 picoseconds. - Weight::from_parts(3_685_000, 0) - } /// Storage: PolkadotXcm Queries (r:1 w:0) /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn query_response() -> Weight { // Proof Size summary in bytes: // Measured: `31` // Estimated: `3496` - // Minimum execution time: 10_842_000 picoseconds. - Weight::from_parts(11_039_000, 3496) + // Minimum execution time: 10_476_000 picoseconds. + Weight::from_parts(10_697_000, 3496) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_146_000 picoseconds. - Weight::from_parts(12_448_000, 0) + // Minimum execution time: 12_040_000 picoseconds. + Weight::from_parts(12_275_000, 0) } fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_826_000 picoseconds. - Weight::from_parts(3_986_000, 0) + // Minimum execution time: 4_820_000 picoseconds. + Weight::from_parts(5_004_000, 0) } fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_597_000 picoseconds. - Weight::from_parts(2_724_000, 0) + // Minimum execution time: 2_559_000 picoseconds. + Weight::from_parts(2_752_000, 0) } fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_596_000 picoseconds. - Weight::from_parts(2_699_000, 0) + // Minimum execution time: 2_501_000 picoseconds. + Weight::from_parts(2_661_000, 0) } fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_585_000 picoseconds. - Weight::from_parts(2_664_000, 0) + // Minimum execution time: 2_479_000 picoseconds. + Weight::from_parts(2_585_000, 0) } fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_372_000 picoseconds. - Weight::from_parts(3_480_000, 0) + // Minimum execution time: 3_282_000 picoseconds. + Weight::from_parts(3_470_000, 0) } fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_601_000 picoseconds. - Weight::from_parts(2_694_000, 0) + // Minimum execution time: 2_555_000 picoseconds. + Weight::from_parts(2_710_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -192,8 +274,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 25_876_000 picoseconds. - Weight::from_parts(26_337_000, 3641) + // Minimum execution time: 25_651_000 picoseconds. + Weight::from_parts(26_142_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -203,8 +285,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `88` // Estimated: `3553` - // Minimum execution time: 14_605_000 picoseconds. - Weight::from_parts(14_812_000, 3553) + // Minimum execution time: 14_628_000 picoseconds. + Weight::from_parts(14_982_000, 3553) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -212,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_562_000 picoseconds. - Weight::from_parts(2_678_000, 0) + // Minimum execution time: 2_594_000 picoseconds. + Weight::from_parts(2_702_000, 0) } /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -231,8 +313,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `73` // Estimated: `3538` - // Minimum execution time: 25_850_000 picoseconds. - Weight::from_parts(26_304_000, 3538) + // Minimum execution time: 26_759_000 picoseconds. + Weight::from_parts(27_033_000, 3538) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -242,8 +324,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_791_000 picoseconds. - Weight::from_parts(4_909_000, 0) + // Minimum execution time: 4_755_000 picoseconds. + Weight::from_parts(4_895_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainInfo ParachainId (r:1 w:0) @@ -262,8 +344,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 408_529_000 picoseconds. - Weight::from_parts(417_068_000, 3641) + // Minimum execution time: 416_383_000 picoseconds. + Weight::from_parts(421_855_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -271,36 +353,36 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 121_976_000 picoseconds. - Weight::from_parts(125_121_000, 0) + // Minimum execution time: 124_786_000 picoseconds. + Weight::from_parts(128_000_000, 0) } fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_182_000 picoseconds. - Weight::from_parts(10_336_000, 0) + // Minimum execution time: 10_947_000 picoseconds. + Weight::from_parts(11_467_000, 0) } fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_704_000 picoseconds. - Weight::from_parts(2_827_000, 0) + // Minimum execution time: 2_641_000 picoseconds. + Weight::from_parts(2_713_000, 0) } fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_616_000 picoseconds. - Weight::from_parts(2_743_000, 0) + // Minimum execution time: 2_569_000 picoseconds. + Weight::from_parts(2_665_000, 0) } fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_745_000 picoseconds. - Weight::from_parts(2_846_000, 0) + // Minimum execution time: 2_785_000 picoseconds. + Weight::from_parts(2_864_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -318,18 +400,11 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 32_303_000 picoseconds. - Weight::from_parts(33_006_000, 3641) + // Minimum execution time: 30_487_000 picoseconds. + Weight::from_parts(31_068_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } - fn expect_pallet() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_311_000 picoseconds. - Weight::from_parts(7_493_000, 0) - } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -346,8 +421,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 25_707_000 picoseconds. - Weight::from_parts(26_164_000, 3641) + // Minimum execution time: 24_913_000 picoseconds. + Weight::from_parts(25_550_000, 3641) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -355,35 +430,70 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_590_000 picoseconds. - Weight::from_parts(2_701_000, 0) + // Minimum execution time: 2_530_000 picoseconds. + Weight::from_parts(2_617_000, 0) } fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_605_000 picoseconds. - Weight::from_parts(2_676_000, 0) + // Minimum execution time: 2_489_000 picoseconds. + Weight::from_parts(2_599_000, 0) } fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_575_000 picoseconds. - Weight::from_parts(2_717_000, 0) + // Minimum execution time: 2_508_000 picoseconds. + Weight::from_parts(2_610_000, 0) } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn exchange_asset() -> Weight { + fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) + // Minimum execution time: 2_482_000 picoseconds. + Weight::from_parts(2_592_000, 0) + } + fn unpaid_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_663_000 picoseconds. + Weight::from_parts(2_765_000, 0) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured) + /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) + /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn buy_execution() -> Weight { + // Proof Size summary in bytes: + // Measured: `2468` + // Estimated: `5933` + // Minimum execution time: 110_783_000 picoseconds. + Weight::from_parts(115_074_000, 5933) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + fn expect_pallet() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_111_000 picoseconds. + Weight::from_parts(7_262_000, 0) } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn universal_origin() -> Weight { + fn exchange_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` @@ -392,7 +502,6 @@ impl WeightInfo for SubstrateWeight { } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - /// The range of component `x` is `[1, 1000]`. fn export_message() -> Weight { // Proof Size summary in bytes: // Measured: `0` @@ -400,13 +509,6 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. Weight::from_parts(18_446_744_073_709_551_000, 0) } - fn set_fees_mode() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_509_000 picoseconds. - Weight::from_parts(2_663_000, 0) - } /// Storage: Benchmark Override (r:0 w:0) /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) fn lock_asset() -> Weight { @@ -443,17 +545,15 @@ impl WeightInfo for SubstrateWeight { // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. Weight::from_parts(18_446_744_073_709_551_000, 0) } - fn unpaid_execution() -> Weight { + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn universal_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_695_000 picoseconds. - Weight::from_parts(2_840_000, 0) + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) } -} - -// For backwards compatibility and tests -impl WeightInfo for () { /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -470,76 +570,69 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 348_128_000 picoseconds. - Weight::from_parts(355_569_000, 3641) + // Minimum execution time: 356_141_000 picoseconds. + Weight::from_parts(360_928_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } - fn buy_execution() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_575_000 picoseconds. - Weight::from_parts(3_685_000, 0) - } /// Storage: PolkadotXcm Queries (r:1 w:0) /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn query_response() -> Weight { // Proof Size summary in bytes: // Measured: `31` // Estimated: `3496` - // Minimum execution time: 10_842_000 picoseconds. - Weight::from_parts(11_039_000, 3496) + // Minimum execution time: 10_476_000 picoseconds. + Weight::from_parts(10_697_000, 3496) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_146_000 picoseconds. - Weight::from_parts(12_448_000, 0) + // Minimum execution time: 12_040_000 picoseconds. + Weight::from_parts(12_275_000, 0) } fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_826_000 picoseconds. - Weight::from_parts(3_986_000, 0) + // Minimum execution time: 4_820_000 picoseconds. + Weight::from_parts(5_004_000, 0) } fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_597_000 picoseconds. - Weight::from_parts(2_724_000, 0) + // Minimum execution time: 2_559_000 picoseconds. + Weight::from_parts(2_752_000, 0) } fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_596_000 picoseconds. - Weight::from_parts(2_699_000, 0) + // Minimum execution time: 2_501_000 picoseconds. + Weight::from_parts(2_661_000, 0) } fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_585_000 picoseconds. - Weight::from_parts(2_664_000, 0) + // Minimum execution time: 2_479_000 picoseconds. + Weight::from_parts(2_585_000, 0) } fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_372_000 picoseconds. - Weight::from_parts(3_480_000, 0) + // Minimum execution time: 3_282_000 picoseconds. + Weight::from_parts(3_470_000, 0) } fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_601_000 picoseconds. - Weight::from_parts(2_694_000, 0) + // Minimum execution time: 2_555_000 picoseconds. + Weight::from_parts(2_710_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -557,8 +650,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 25_876_000 picoseconds. - Weight::from_parts(26_337_000, 3641) + // Minimum execution time: 25_651_000 picoseconds. + Weight::from_parts(26_142_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -568,8 +661,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `88` // Estimated: `3553` - // Minimum execution time: 14_605_000 picoseconds. - Weight::from_parts(14_812_000, 3553) + // Minimum execution time: 14_628_000 picoseconds. + Weight::from_parts(14_982_000, 3553) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -577,8 +670,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_562_000 picoseconds. - Weight::from_parts(2_678_000, 0) + // Minimum execution time: 2_594_000 picoseconds. + Weight::from_parts(2_702_000, 0) } /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -596,8 +689,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `73` // Estimated: `3538` - // Minimum execution time: 25_850_000 picoseconds. - Weight::from_parts(26_304_000, 3538) + // Minimum execution time: 26_759_000 picoseconds. + Weight::from_parts(27_033_000, 3538) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -607,8 +700,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_791_000 picoseconds. - Weight::from_parts(4_909_000, 0) + // Minimum execution time: 4_755_000 picoseconds. + Weight::from_parts(4_895_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: ParachainInfo ParachainId (r:1 w:0) @@ -627,8 +720,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 408_529_000 picoseconds. - Weight::from_parts(417_068_000, 3641) + // Minimum execution time: 416_383_000 picoseconds. + Weight::from_parts(421_855_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -636,36 +729,36 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 121_976_000 picoseconds. - Weight::from_parts(125_121_000, 0) + // Minimum execution time: 124_786_000 picoseconds. + Weight::from_parts(128_000_000, 0) } fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_182_000 picoseconds. - Weight::from_parts(10_336_000, 0) + // Minimum execution time: 10_947_000 picoseconds. + Weight::from_parts(11_467_000, 0) } fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_704_000 picoseconds. - Weight::from_parts(2_827_000, 0) + // Minimum execution time: 2_641_000 picoseconds. + Weight::from_parts(2_713_000, 0) } fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_616_000 picoseconds. - Weight::from_parts(2_743_000, 0) + // Minimum execution time: 2_569_000 picoseconds. + Weight::from_parts(2_665_000, 0) } fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_745_000 picoseconds. - Weight::from_parts(2_846_000, 0) + // Minimum execution time: 2_785_000 picoseconds. + Weight::from_parts(2_864_000, 0) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -683,18 +776,11 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 32_303_000 picoseconds. - Weight::from_parts(33_006_000, 3641) + // Minimum execution time: 30_487_000 picoseconds. + Weight::from_parts(31_068_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } - fn expect_pallet() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_311_000 picoseconds. - Weight::from_parts(7_493_000, 0) - } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -711,8 +797,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3641` - // Minimum execution time: 25_707_000 picoseconds. - Weight::from_parts(26_164_000, 3641) + // Minimum execution time: 24_913_000 picoseconds. + Weight::from_parts(25_550_000, 3641) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -720,99 +806,35 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_590_000 picoseconds. - Weight::from_parts(2_701_000, 0) + // Minimum execution time: 2_530_000 picoseconds. + Weight::from_parts(2_617_000, 0) } fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_605_000 picoseconds. - Weight::from_parts(2_676_000, 0) + // Minimum execution time: 2_489_000 picoseconds. + Weight::from_parts(2_599_000, 0) } fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_575_000 picoseconds. - Weight::from_parts(2_717_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn exchange_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn universal_origin() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - /// The range of component `x` is `[1, 1000]`. - fn export_message() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) + // Minimum execution time: 2_508_000 picoseconds. + Weight::from_parts(2_610_000, 0) } fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_509_000 picoseconds. - Weight::from_parts(2_663_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn lock_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn unlock_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn note_unlockable() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn request_unlock() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) + // Minimum execution time: 2_482_000 picoseconds. + Weight::from_parts(2_592_000, 0) } fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_695_000 picoseconds. - Weight::from_parts(2_840_000, 0) + // Minimum execution time: 2_663_000 picoseconds. + Weight::from_parts(2_765_000, 0) } } From 69b84faa15a5b643b2432ecb13620e34958b6fdc Mon Sep 17 00:00:00 2001 From: Ashutosh Varma Date: Mon, 15 Jan 2024 13:29:56 +0530 Subject: [PATCH 15/15] feat: apply suggestions --- runtime/shibuya/src/weights/xcm/fungible.rs | 140 -------- runtime/shibuya/src/weights/xcm/generic.rs | 376 -------------------- 2 files changed, 516 deletions(-) diff --git a/runtime/shibuya/src/weights/xcm/fungible.rs b/runtime/shibuya/src/weights/xcm/fungible.rs index 2d73746b4c..68c7acc306 100644 --- a/runtime/shibuya/src/weights/xcm/fungible.rs +++ b/runtime/shibuya/src/weights/xcm/fungible.rs @@ -198,143 +198,3 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes(5_u64)) } } - -// For backwards compatibility and tests -impl WeightInfo for () { - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn transfer_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `545` - // Estimated: `6232` - // Minimum execution time: 49_562_000 picoseconds. - Weight::from_parts(50_040_000, 6232) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn transfer_reserve_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `721` - // Estimated: `6232` - // Minimum execution time: 72_571_000 picoseconds. - Weight::from_parts(73_202_000, 6232) - .saturating_add(RocksDbWeight::get().reads(11_u64)) - .saturating_add(RocksDbWeight::get().writes(6_u64)) - } - fn reserve_asset_deposited() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_430_000 picoseconds. - Weight::from_parts(3_566_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn receive_teleported_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn initiate_teleport() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn withdraw_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `1960` - // Estimated: `5425` - // Minimum execution time: 57_091_000 picoseconds. - Weight::from_parts(57_836_000, 5425) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn deposit_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `1696` - // Estimated: `5161` - // Minimum execution time: 45_650_000 picoseconds. - Weight::from_parts(46_029_000, 5161) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn deposit_reserve_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `1872` - // Estimated: `5337` - // Minimum execution time: 71_400_000 picoseconds. - Weight::from_parts(72_038_000, 5337) - .saturating_add(RocksDbWeight::get().reads(10_u64)) - .saturating_add(RocksDbWeight::get().writes(5_u64)) - } -} diff --git a/runtime/shibuya/src/weights/xcm/generic.rs b/runtime/shibuya/src/weights/xcm/generic.rs index 6834118a3b..9903bcdec2 100644 --- a/runtime/shibuya/src/weights/xcm/generic.rs +++ b/runtime/shibuya/src/weights/xcm/generic.rs @@ -462,379 +462,3 @@ impl WeightInfo for SubstrateWeight { Weight::from_parts(2_765_000, 0) } } - -// For backwards compatibility and tests -impl WeightInfo for () { - /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured) - /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0) - /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured) - /// Storage: Assets Asset (r:1 w:1) - /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn buy_execution() -> Weight { - // Proof Size summary in bytes: - // Measured: `2468` - // Estimated: `5933` - // Minimum execution time: 110_783_000 picoseconds. - Weight::from_parts(115_074_000, 5933) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } - fn expect_pallet() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_111_000 picoseconds. - Weight::from_parts(7_262_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn exchange_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn export_message() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn lock_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn unlock_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn note_unlockable() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn request_unlock() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: Benchmark Override (r:0 w:0) - /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) - fn universal_origin() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. - Weight::from_parts(18_446_744_073_709_551_000, 0) - } - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn report_holding() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `3641` - // Minimum execution time: 356_141_000 picoseconds. - Weight::from_parts(360_928_000, 3641) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: PolkadotXcm Queries (r:1 w:0) - /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) - fn query_response() -> Weight { - // Proof Size summary in bytes: - // Measured: `31` - // Estimated: `3496` - // Minimum execution time: 10_476_000 picoseconds. - Weight::from_parts(10_697_000, 3496) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - } - fn transact() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 12_040_000 picoseconds. - Weight::from_parts(12_275_000, 0) - } - fn refund_surplus() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_820_000 picoseconds. - Weight::from_parts(5_004_000, 0) - } - fn set_error_handler() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_559_000 picoseconds. - Weight::from_parts(2_752_000, 0) - } - fn set_appendix() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_501_000 picoseconds. - Weight::from_parts(2_661_000, 0) - } - fn clear_error() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_479_000 picoseconds. - Weight::from_parts(2_585_000, 0) - } - fn descend_origin() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_282_000 picoseconds. - Weight::from_parts(3_470_000, 0) - } - fn clear_origin() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_555_000 picoseconds. - Weight::from_parts(2_710_000, 0) - } - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn report_error() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `3641` - // Minimum execution time: 25_651_000 picoseconds. - Weight::from_parts(26_142_000, 3641) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: PolkadotXcm AssetTraps (r:1 w:1) - /// Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured) - fn claim_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `88` - // Estimated: `3553` - // Minimum execution time: 14_628_000 picoseconds. - Weight::from_parts(14_982_000, 3553) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - fn trap() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_594_000 picoseconds. - Weight::from_parts(2_702_000, 0) - } - /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn subscribe_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `73` - // Estimated: `3538` - // Minimum execution time: 26_759_000 picoseconds. - Weight::from_parts(27_033_000, 3538) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } - /// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) - /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) - fn unsubscribe_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_755_000 picoseconds. - Weight::from_parts(4_895_000, 0) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn initiate_reserve_withdraw() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `3641` - // Minimum execution time: 416_383_000 picoseconds. - Weight::from_parts(421_855_000, 3641) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - fn burn_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 124_786_000 picoseconds. - Weight::from_parts(128_000_000, 0) - } - fn expect_asset() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 10_947_000 picoseconds. - Weight::from_parts(11_467_000, 0) - } - fn expect_origin() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_641_000 picoseconds. - Weight::from_parts(2_713_000, 0) - } - fn expect_error() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_569_000 picoseconds. - Weight::from_parts(2_665_000, 0) - } - fn expect_transact_status() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_785_000 picoseconds. - Weight::from_parts(2_864_000, 0) - } - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn query_pallet() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `3641` - // Minimum execution time: 30_487_000 picoseconds. - Weight::from_parts(31_068_000, 3641) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) - /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) - /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) - /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem HostConfiguration (r:1 w:0) - /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) - fn report_transact_status() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `3641` - // Minimum execution time: 24_913_000 picoseconds. - Weight::from_parts(25_550_000, 3641) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - fn clear_transact_status() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_530_000 picoseconds. - Weight::from_parts(2_617_000, 0) - } - fn set_topic() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_489_000 picoseconds. - Weight::from_parts(2_599_000, 0) - } - fn clear_topic() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_508_000 picoseconds. - Weight::from_parts(2_610_000, 0) - } - fn set_fees_mode() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_482_000 picoseconds. - Weight::from_parts(2_592_000, 0) - } - fn unpaid_execution() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_663_000 picoseconds. - Weight::from_parts(2_765_000, 0) - } -}