git.delta.rocks / unique-network / refs/commits / 67ee4bedd37d

difftreelog

fix benchmarks+try-runtime

Daniel Shiposha2024-05-24parent: #8c2fbfd.patch.diff
in: master

6 files changed

modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -352,11 +352,14 @@
 			use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
 			use polkadot_cli::Block;
 
+			type Header = <Block as sp_runtime::traits::Block>::Header;
+			type Hasher = <Header as sp_runtime::traits::Header>::Hashing;
+
 			let runner = cli.create_runner(cmd)?;
 			// Switch on the concrete benchmark sub-command-
 			match cmd {
 				BenchmarkCmd::Pallet(cmd) => {
-					runner.sync_run(|config| cmd.run::<Block, ParachainHostFunctions>(config))
+					runner.sync_run(|config| cmd.run::<Hasher, ParachainHostFunctions>(config))
 				}
 				BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
 					let partials = new_partial::<
modifiedpallets/foreign-assets/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/benchmarking.rs
+++ b/pallets/foreign-assets/src/benchmarking.rs
@@ -32,8 +32,7 @@
 
 	#[benchmark]
 	fn force_register_foreign_asset() -> Result<(), BenchmarkError> {
-		let location =
-			Location::from((Parachain(1000), PalletInstance(42), GeneralIndex(1)).into());
+		let asset_id: AssetId = (Parachain(1000), PalletInstance(42), GeneralIndex(1)).into();
 		let name = create_u16_data::<MAX_COLLECTION_NAME_LENGTH>();
 		let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();
 		let mode = ForeignCollectionMode::NFT;
@@ -41,7 +40,7 @@
 		#[extrinsic_call]
 		_(
 			RawOrigin::Root,
-			Box::new(location.into()),
+			Box::new(asset_id.into()),
 			name,
 			token_prefix,
 			mode,
modifiedruntime/common/config/governance/fellowship.rsdiffbeforeafterboth
--- a/runtime/common/config/governance/fellowship.rs
+++ b/runtime/common/config/governance/fellowship.rs
@@ -73,6 +73,9 @@
 	type Polls = FellowshipReferenda;
 	type MinRankOfClass = ClassToRankMapper<Self, ()>;
 	type VoteWeight = pallet_ranked_collective::Geometric;
+
+	#[cfg(feature = "runtime-benchmarks")]
+	type BenchmarkSetup = ();
 }
 
 pub struct EnsureFellowshipProposition;
modifiedruntime/common/config/xcm.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm.rs
+++ b/runtime/common/config/xcm.rs
@@ -194,11 +194,6 @@
 	type TransactionalProcessor = FrameTransactionalProcessor;
 }
 
-#[cfg(feature = "runtime-benchmarks")]
-parameter_types! {
-	pub ReachableDest: Option<Location> = Some(Parent.into());
-}
-
 impl pallet_xcm::Config for Runtime {
 	type RuntimeEvent = RuntimeEvent;
 	type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
@@ -223,10 +218,21 @@
 	type AdminOrigin = EnsureRoot<AccountId>;
 	type MaxRemoteLockConsumers = ConstU32<0>;
 	type RemoteLockConsumerIdentifier = ();
-	#[cfg(feature = "runtime-benchmarks")]
-	type ReachableDest = ReachableDest;
 }
 
+#[cfg(feature = "runtime-benchmarks")]
+impl pallet_xcm::benchmarking::Config for Runtime {
+	type DeliveryHelper = ();
+
+	fn reachable_dest() -> Option<Location> {
+		Some(Parent.into())
+	}
+
+	fn get_asset() -> Asset {
+		(Location::here(), 1_000_000_000_000_000_000u128).into()
+	}
+}
+
 impl cumulus_pallet_xcm::Config for Runtime {
 	type RuntimeEvent = RuntimeEvent;
 	type XcmExecutor = XcmExecutor<XcmExecutorConfig<Self>>;
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -535,9 +535,10 @@
 				) {
 					use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
 					use frame_support::traits::StorageInfoTrait;
+					use pallet_xcm::benchmarking::Pallet as PalletXcmBenchmarks;
 
 					let mut list = Vec::<BenchmarkList>::new();
-					list_benchmark!(list, extra, pallet_xcm, PolkadotXcm);
+					list_benchmark!(list, extra, pallet_xcm, PalletXcmBenchmarks::<Runtime>);
 
 					list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
 					list_benchmark!(list, extra, pallet_common, Common);
@@ -578,6 +579,7 @@
 				) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
 					use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
 					use sp_storage::TrackedStorageKey;
+					use pallet_xcm::benchmarking::Pallet as PalletXcmBenchmarks;
 
 					let allowlist: Vec<TrackedStorageKey> = vec![
 						// Total Issuance
@@ -601,8 +603,9 @@
 
 					let mut batches = Vec::<BenchmarkBatch>::new();
 					let params = (&config, &allowlist);
-					add_benchmark!(params, batches, pallet_xcm, PolkadotXcm);
 
+					add_benchmark!(params, batches, pallet_xcm, PalletXcmBenchmarks::<Runtime>);
+
 					add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
 					add_benchmark!(params, batches, pallet_common, Common);
 					add_benchmark!(params, batches, pallet_unique, Unique);
modifiedruntime/common/weights/xcm.rsdiffbeforeafterboth
after · runtime/common/weights/xcm.rs
1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_xcm4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 35.0.16//! DATE: 2024-05-24, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! WORST CASE MAP SIZE: `1000000`8//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024910// Executed Command:11// ./target/production/unique-collator12// benchmark13// pallet14// --pallet15// pallet-xcm16// --wasm-execution17// compiled18// --extrinsic19// *20// --template=.maintain/external-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./runtime/common/weights/xcm.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(missing_docs)]30#![allow(clippy::unnecessary_cast)]3132use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};33use sp_std::marker::PhantomData;3435/// Weights for pallet_xcm using the Substrate node and recommended hardware.36pub struct SubstrateWeight<T>(PhantomData<T>);37impl<T: frame_system::Config> pallet_xcm::WeightInfo for SubstrateWeight<T> {38	/// Storage: `Benchmark::Override` (r:0 w:0)39	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)40	fn send() -> Weight {41		// Proof Size summary in bytes:42		//  Measured:  `0`43		//  Estimated: `0`44		// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.45		Weight::from_parts(18_446_744_073_709_551_000, 0)46	}47	/// Storage: `Benchmark::Override` (r:0 w:0)48	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)49	fn teleport_assets() -> Weight {50		// Proof Size summary in bytes:51		//  Measured:  `0`52		//  Estimated: `0`53		// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.54		Weight::from_parts(18_446_744_073_709_551_000, 0)55	}56	/// Storage: `Benchmark::Override` (r:0 w:0)57	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)58	fn reserve_transfer_assets() -> Weight {59		// Proof Size summary in bytes:60		//  Measured:  `0`61		//  Estimated: `0`62		// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.63		Weight::from_parts(18_446_744_073_709_551_000, 0)64	}65	/// Storage: `Benchmark::Override` (r:0 w:0)66	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)67	fn transfer_assets() -> Weight {68		// Proof Size summary in bytes:69		//  Measured:  `0`70		//  Estimated: `0`71		// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.72		Weight::from_parts(18_446_744_073_709_551_000, 0)73	}74	fn execute() -> Weight {75		// Proof Size summary in bytes:76		//  Measured:  `0`77		//  Estimated: `0`78		// Minimum execution time: 3_230_000 picoseconds.79		Weight::from_parts(3_390_000, 0)80	}81	/// Storage: `Benchmark::Override` (r:0 w:0)82	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)83	fn force_xcm_version() -> Weight {84		// Proof Size summary in bytes:85		//  Measured:  `0`86		//  Estimated: `0`87		// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.88		Weight::from_parts(18_446_744_073_709_551_000, 0)89	}90	/// Storage: `PolkadotXcm::SafeXcmVersion` (r:0 w:1)91	/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)92	fn force_default_xcm_version() -> Weight {93		// Proof Size summary in bytes:94		//  Measured:  `0`95		//  Estimated: `0`96		// Minimum execution time: 1_020_000 picoseconds.97		Weight::from_parts(1_120_000, 0)98			.saturating_add(T::DbWeight::get().writes(1_u64))99	}100	/// Storage: `Benchmark::Override` (r:0 w:0)101	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)102	fn force_subscribe_version_notify() -> Weight {103		// Proof Size summary in bytes:104		//  Measured:  `0`105		//  Estimated: `0`106		// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.107		Weight::from_parts(18_446_744_073_709_551_000, 0)108	}109	/// Storage: `Benchmark::Override` (r:0 w:0)110	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)111	fn force_unsubscribe_version_notify() -> Weight {112		// Proof Size summary in bytes:113		//  Measured:  `0`114		//  Estimated: `0`115		// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.116		Weight::from_parts(18_446_744_073_709_551_000, 0)117	}118	/// Storage: `PolkadotXcm::XcmExecutionSuspended` (r:0 w:1)119	/// Proof: `PolkadotXcm::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)120	fn force_suspension() -> Weight {121		// Proof Size summary in bytes:122		//  Measured:  `0`123		//  Estimated: `0`124		// Minimum execution time: 1_050_000 picoseconds.125		Weight::from_parts(1_150_000, 0)126			.saturating_add(T::DbWeight::get().writes(1_u64))127	}128	/// Storage: `PolkadotXcm::SupportedVersion` (r:5 w:2)129	/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)130	fn migrate_supported_version() -> Weight {131		// Proof Size summary in bytes:132		//  Measured:  `192`133		//  Estimated: `13557`134		// Minimum execution time: 13_400_000 picoseconds.135		Weight::from_parts(13_670_000, 13557)136			.saturating_add(T::DbWeight::get().reads(5_u64))137			.saturating_add(T::DbWeight::get().writes(2_u64))138	}139	/// Storage: `PolkadotXcm::VersionNotifiers` (r:5 w:2)140	/// Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)141	fn migrate_version_notifiers() -> Weight {142		// Proof Size summary in bytes:143		//  Measured:  `196`144		//  Estimated: `13561`145		// Minimum execution time: 13_160_000 picoseconds.146		Weight::from_parts(13_650_000, 13561)147			.saturating_add(T::DbWeight::get().reads(5_u64))148			.saturating_add(T::DbWeight::get().writes(2_u64))149	}150	/// Storage: `Benchmark::Override` (r:0 w:0)151	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)152	fn already_notified_target() -> Weight {153		// Proof Size summary in bytes:154		//  Measured:  `0`155		//  Estimated: `0`156		// Minimum execution time: 25_000_000 picoseconds.157		Weight::from_parts(25_000_000, 0)158	}159	/// Storage: `Benchmark::Override` (r:0 w:0)160	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)161	fn notify_current_targets() -> Weight {162		// Proof Size summary in bytes:163		//  Measured:  `0`164		//  Estimated: `0`165		// Minimum execution time: 325_000_000 picoseconds.166		Weight::from_parts(325_000_000, 0)167	}168	/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:4 w:0)169	/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)170	fn notify_target_migration_fail() -> Weight {171		// Proof Size summary in bytes:172		//  Measured:  `239`173		//  Estimated: `11129`174		// Minimum execution time: 8_250_000 picoseconds.175		Weight::from_parts(8_780_000, 11129)176			.saturating_add(T::DbWeight::get().reads(4_u64))177	}178	/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:2)179	/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)180	fn migrate_version_notify_targets() -> Weight {181		// Proof Size summary in bytes:182		//  Measured:  `203`183		//  Estimated: `13568`184		// Minimum execution time: 13_240_000 picoseconds.185		Weight::from_parts(13_650_000, 13568)186			.saturating_add(T::DbWeight::get().reads(5_u64))187			.saturating_add(T::DbWeight::get().writes(2_u64))188	}189	/// Storage: `Benchmark::Override` (r:0 w:0)190	/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)191	fn migrate_and_notify_old_targets() -> Weight {192		// Proof Size summary in bytes:193		//  Measured:  `0`194		//  Estimated: `0`195		// Minimum execution time: 325_000_000 picoseconds.196		Weight::from_parts(325_000_000, 0)197	}198	/// Storage: `PolkadotXcm::QueryCounter` (r:1 w:1)199	/// Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)200	/// Storage: `PolkadotXcm::Queries` (r:0 w:1)201	/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)202	fn new_query() -> Weight {203		// Proof Size summary in bytes:204		//  Measured:  `136`205		//  Estimated: `1621`206		// Minimum execution time: 3_440_000 picoseconds.207		Weight::from_parts(3_560_000, 1621)208			.saturating_add(T::DbWeight::get().reads(1_u64))209			.saturating_add(T::DbWeight::get().writes(2_u64))210	}211	/// Storage: `PolkadotXcm::Queries` (r:1 w:1)212	/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)213	fn take_response() -> Weight {214		// Proof Size summary in bytes:215		//  Measured:  `7773`216		//  Estimated: `11238`217		// Minimum execution time: 19_230_000 picoseconds.218		Weight::from_parts(19_550_000, 11238)219			.saturating_add(T::DbWeight::get().reads(1_u64))220			.saturating_add(T::DbWeight::get().writes(1_u64))221	}222	/// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1)223	/// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`)224	/// Storage: `ForeignAssets::ForeignAssetToCollection` (r:1 w:0)225	/// Proof: `ForeignAssets::ForeignAssetToCollection` (`max_values`: None, `max_size`: Some(614), added: 3089, mode: `MaxEncodedLen`)226	/// Storage: `ParachainInfo::ParachainId` (r:1 w:0)227	/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)228	fn claim_assets() -> Weight {229		// Proof Size summary in bytes:230		//  Measured:  `366`231		//  Estimated: `4079`232		// Minimum execution time: 25_540_000 picoseconds.233		Weight::from_parts(26_250_000, 4079)234			.saturating_add(T::DbWeight::get().reads(3_u64))235			.saturating_add(T::DbWeight::get().writes(1_u64))236	}237}238