git.delta.rocks / unique-network / refs/commits / 90ad566cc7e8

difftreelog

Merge pull request #1008 from UniqueNetwork/fix/update-benchmarks-to-v2

Yaroslav Bolyukin2023-10-12parents: #900be63 #4275a8f.patch.diff
in: master
Update benchmarks to v2

31 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6536,6 +6536,7 @@
  "sp-runtime",
  "sp-session",
  "sp-std",
+ "sp-storage",
  "sp-transaction-pool",
  "sp-version",
  "staging-xcm",
@@ -10144,6 +10145,7 @@
  "sp-runtime",
  "sp-session",
  "sp-std",
+ "sp-storage",
  "sp-transaction-pool",
  "sp-version",
  "staging-xcm",
@@ -14896,6 +14898,7 @@
  "sp-runtime",
  "sp-session",
  "sp-std",
+ "sp-storage",
  "sp-transaction-pool",
  "sp-version",
  "staging-xcm",
modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -170,6 +170,7 @@
 sp-staking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
 sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
 sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
+sp-storage = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
 sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
 sp-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
 sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -88,69 +88,36 @@
 
 evm_stubs: UniqueFungible UniqueNFT UniqueRefungible UniqueRefungibleToken ContractHelpers CollectionHelpers
 
-.PHONY: _bench
-_bench:
-	cargo run --profile production --features runtime-benchmarks,$(RUNTIME) -- \
-	benchmark pallet --pallet pallet-$(if $(PALLET),$(PALLET),$(error Must set PALLET)) \
-	--wasm-execution compiled --extrinsic '*' \
-	$(if $(TEMPLATE),$(TEMPLATE),--template=.maintain/frame-weight-template.hbs) --steps=50 --repeat=80 --heap-pages=4096 \
-	--output=$(if $(OUTPUT),$(OUTPUT),./pallets/$(if $(PALLET_DIR),$(PALLET_DIR),$(PALLET))/src/weights.rs)
-
-.PHONY: bench-evm-migration
-bench-evm-migration:
-	make _bench PALLET=evm-migration
-
-.PHONY: bench-configuration
-bench-configuration:
-	make _bench PALLET=configuration
-
-.PHONY: bench-common
-bench-common:
-	make _bench PALLET=common
-
-.PHONY: bench-unique
-bench-unique:
-	make _bench PALLET=unique
-
-.PHONY: bench-fungible
-bench-fungible:
-	make _bench PALLET=fungible
-
-.PHONY: bench-refungible
-bench-refungible:
-	make _bench PALLET=refungible
-
-.PHONY: bench-nonfungible
-bench-nonfungible:
-	make _bench PALLET=nonfungible
-
-.PHONY: bench-structure
-bench-structure:
-	make _bench PALLET=structure
-
-.PHONY: bench-foreign-assets
-bench-foreign-assets:
-	make _bench PALLET=foreign-assets
-
-.PHONY: bench-collator-selection
-bench-collator-selection:
-	make _bench PALLET=collator-selection
+# TODO: Create benchmarking profile, make it a proper dependency
+.PHONY: benchmarking-node
+benchmarking-node:
+	cargo build --profile production --features runtime-benchmarks
 
-.PHONY: bench-identity
-bench-identity:
-	make _bench PALLET=identity
+define _bench =
+.PHONY: bench-$(1)
+bench-$(1): benchmarking-node
+	./target/production/unique-collator \
+	benchmark pallet --pallet pallet-$(1) \
+	--wasm-execution compiled --extrinsic '*' \
+	$(if $(4),$(4),--template=.maintain/frame-weight-template.hbs) --steps=50 --repeat=80 --heap-pages=4096 \
+	--output=$$(if $(3),$(3),./pallets/$(if $(2),$(2),$(1))/src/weights.rs)
+endef
 
-.PHONY: bench-app-promotion
-bench-app-promotion:
-	make _bench PALLET=app-promotion
-
-.PHONY: bench-maintenance
-bench-maintenance:
-	make _bench PALLET=maintenance
-
-.PHONY: bench-xcm
-bench-xcm:
-	make _bench PALLET=xcm OUTPUT=./runtime/common/weights/xcm.rs TEMPLATE="--template=.maintain/external-weight-template.hbs"
+# _bench,pallet,(pallet_dir|),(output|),(extra|)
+$(eval $(call _bench,evm-migration))
+$(eval $(call _bench,configuration))
+$(eval $(call _bench,common))
+$(eval $(call _bench,unique))
+$(eval $(call _bench,fungible))
+$(eval $(call _bench,refungible))
+$(eval $(call _bench,nonfungible))
+$(eval $(call _bench,structure))
+$(eval $(call _bench,foreign-assets))
+$(eval $(call _bench,collator-selection))
+$(eval $(call _bench,identity))
+$(eval $(call _bench,app-promotion))
+$(eval $(call _bench,maintenance))
+$(eval $(call _bench,xcm,,./runtime/common/weights/xcm.rs,"--template=.maintain/external-weights/template.hbs"))
 
 .PHONY: bench
 bench: bench-app-promotion bench-common bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-configuration bench-foreign-assets bench-maintenance bench-xcm bench-collator-selection bench-identity
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -238,7 +238,7 @@
 			vesting: VestingConfig { vesting: vec![] },
 			parachain_info: ParachainInfoConfig {
 				parachain_id: $id.into(),
-				Default::default()
+				..Default::default()
 			},
 			aura: AuraConfig {
 				authorities: $initial_invulnerables
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -42,10 +42,6 @@
 use sp_runtime::traits::AccountIdConversion;
 use up_common::types::opaque::RuntimeId;
 
-#[cfg(feature = "runtime-benchmarks")]
-use crate::chain_spec::default_runtime;
-#[cfg(feature = "runtime-benchmarks")]
-use crate::service::DefaultRuntimeExecutor;
 #[cfg(feature = "quartz-runtime")]
 use crate::service::QuartzRuntimeExecutor;
 #[cfg(feature = "unique-runtime")]
@@ -355,26 +351,37 @@
 		#[cfg(feature = "runtime-benchmarks")]
 		Some(Subcommand::Benchmark(cmd)) => {
 			use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
+			use polkadot_cli::Block;
+			use sp_io::SubstrateHostFunctions;
+
 			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, DefaultRuntimeExecutor>(config))
+					runner.sync_run(|config| cmd.run::<Block, SubstrateHostFunctions>(config))
 				}
 				BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
 					let partials = new_partial::<
-						default_runtime::RuntimeApi,
-						DefaultRuntimeExecutor,
+						opal_runtime::Runtime,
+						opal_runtime::RuntimeApi,
+						OpalRuntimeExecutor,
 						_,
-					>(&config, crate::service::parachain_build_import_queue)?;
+					>(
+						&config,
+						crate::service::parachain_build_import_queue::<opal_runtime::Runtime, _, _>,
+					)?;
 					cmd.run(partials.client)
 				}),
 				BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
 					let partials = new_partial::<
-						default_runtime::RuntimeApi,
-						DefaultRuntimeExecutor,
+						opal_runtime::Runtime,
+						opal_runtime::RuntimeApi,
+						OpalRuntimeExecutor,
 						_,
-					>(&config, crate::service::parachain_build_import_queue)?;
+					>(
+						&config,
+						crate::service::parachain_build_import_queue::<opal_runtime::Runtime, _, _>,
+					)?;
 					let db = partials.backend.expose_db();
 					let storage = partials.backend.expose_storage();
 
@@ -392,6 +399,7 @@
 		Some(Subcommand::TryRuntime(cmd)) => {
 			use std::{future::Future, pin::Pin};
 
+			use polkadot_cli::Block;
 			use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
 			use try_runtime_cli::block_building_info::timestamp_with_aura_info;
 
modifiednode/cli/src/rpc.rsdiffbeforeafterboth
--- a/node/cli/src/rpc.rs
+++ b/node/cli/src/rpc.rs
@@ -67,7 +67,7 @@
 }
 
 /// Instantiate all Full RPC extensions.
-pub fn create_full<C, P, SC, R, A, B>(
+pub fn create_full<C, P, SC, R, B>(
 	io: &mut RpcModule<()>,
 	deps: FullDeps<C, P, SC>,
 ) -> Result<(), Box<dyn std::error::Error + Send + Sync>>
@@ -244,7 +244,7 @@
 			EthFilter::new(
 				client.clone(),
 				eth_backend,
-				graph.clone(),
+				graph,
 				filter_pool,
 				500_usize, // max stored filters
 				max_past_logs,
modifiednode/cli/src/service.rsdiffbeforeafterboth
before · node/cli/src/service.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// std18use std::{19	collections::BTreeMap,20	marker::PhantomData,21	pin::Pin,22	sync::{Arc, Mutex},23	time::Duration,24};2526use cumulus_client_cli::CollatorOptions;27use cumulus_client_collator::service::CollatorService;28#[cfg(not(feature = "lookahead"))]29use cumulus_client_consensus_aura::collators::basic::{30	run as run_aura, Params as BuildAuraConsensusParams,31};32#[cfg(feature = "lookahead")]33use cumulus_client_consensus_aura::collators::lookahead::{34	run as run_aura, Params as BuildAuraConsensusParams,35};36use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;37use cumulus_client_consensus_proposer::Proposer;38use cumulus_client_network::RequireSecondedInBlockAnnounce;39use cumulus_client_service::{40	build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, DARecoveryProfile,41	StartRelayChainTasksParams,42};43use cumulus_primitives_core::ParaId;44use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};45use fc_mapping_sync::{kv::MappingSyncWorker, EthereumBlockNotificationSinks, SyncStrategy};46use fc_rpc::{47	frontier_backend_client::SystemAccountId32StorageOverride, EthBlockDataCacheTask, EthConfig,48	EthTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override,49	SchemaV3Override, StorageOverride,50};51use fc_rpc_core::types::{FeeHistoryCache, FilterPool};52use fp_rpc::EthereumRuntimeRPCApi;53use fp_storage::EthereumStorageSchema;54use futures::{55	stream::select,56	task::{Context, Poll},57	Stream, StreamExt,58};59use jsonrpsee::RpcModule;60use polkadot_service::CollatorPair;61use sc_client_api::{AuxStore, Backend, BlockOf, BlockchainEvents, StorageProvider};62use sc_consensus::ImportQueue;63use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};64use sc_network::NetworkBlock;65use sc_network_sync::SyncingService;66use sc_rpc::SubscriptionTaskExecutor;67use sc_service::{Configuration, PartialComponents, TaskManager};68use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};69use serde::{Deserialize, Serialize};70use sp_api::{ProvideRuntimeApi, StateBackend};71use sp_block_builder::BlockBuilder;72use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};73use sp_consensus_aura::sr25519::AuthorityPair as AuraAuthorityPair;74use sp_keystore::KeystorePtr;75use sp_runtime::traits::BlakeTwo256;76use substrate_prometheus_endpoint::Registry;77use tokio::time::Interval;78use up_common::types::{opaque::*, Nonce};7980use crate::{81	chain_spec::RuntimeIdentification,82	rpc::{create_eth, create_full, EthDeps, FullDeps},83};8485/// Unique native executor instance.86#[cfg(feature = "unique-runtime")]87pub struct UniqueRuntimeExecutor;8889#[cfg(feature = "quartz-runtime")]90/// Quartz native executor instance.91pub struct QuartzRuntimeExecutor;9293/// Opal native executor instance.94pub struct OpalRuntimeExecutor;9596#[cfg(all(feature = "unique-runtime", feature = "runtime-benchmarks"))]97pub type DefaultRuntimeExecutor = UniqueRuntimeExecutor;9899#[cfg(all(100	not(feature = "unique-runtime"),101	feature = "quartz-runtime",102	feature = "runtime-benchmarks"103))]104pub type DefaultRuntimeExecutor = QuartzRuntimeExecutor;105106#[cfg(all(107	not(feature = "unique-runtime"),108	not(feature = "quartz-runtime"),109	feature = "runtime-benchmarks"110))]111pub type DefaultRuntimeExecutor = OpalRuntimeExecutor;112113#[cfg(feature = "unique-runtime")]114impl NativeExecutionDispatch for UniqueRuntimeExecutor {115	/// Only enable the benchmarking host functions when we actually want to benchmark.116	#[cfg(feature = "runtime-benchmarks")]117	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;118	/// Otherwise we only use the default Substrate host functions.119	#[cfg(not(feature = "runtime-benchmarks"))]120	type ExtendHostFunctions = ();121122	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {123		unique_runtime::api::dispatch(method, data)124	}125126	fn native_version() -> sc_executor::NativeVersion {127		unique_runtime::native_version()128	}129}130131#[cfg(feature = "quartz-runtime")]132impl NativeExecutionDispatch for QuartzRuntimeExecutor {133	/// Only enable the benchmarking host functions when we actually want to benchmark.134	#[cfg(feature = "runtime-benchmarks")]135	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;136	/// Otherwise we only use the default Substrate host functions.137	#[cfg(not(feature = "runtime-benchmarks"))]138	type ExtendHostFunctions = ();139140	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {141		quartz_runtime::api::dispatch(method, data)142	}143144	fn native_version() -> sc_executor::NativeVersion {145		quartz_runtime::native_version()146	}147}148149impl NativeExecutionDispatch for OpalRuntimeExecutor {150	/// Only enable the benchmarking host functions when we actually want to benchmark.151	#[cfg(feature = "runtime-benchmarks")]152	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;153	/// Otherwise we only use the default Substrate host functions.154	#[cfg(not(feature = "runtime-benchmarks"))]155	type ExtendHostFunctions = ();156157	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {158		opal_runtime::api::dispatch(method, data)159	}160161	fn native_version() -> sc_executor::NativeVersion {162		opal_runtime::native_version()163	}164}165166pub struct AutosealInterval {167	interval: Interval,168}169170impl AutosealInterval {171	pub fn new(config: &Configuration, interval: u64) -> Self {172		let _tokio_runtime = config.tokio_handle.enter();173		let interval = tokio::time::interval(Duration::from_millis(interval));174175		Self { interval }176	}177}178179impl Stream for AutosealInterval {180	type Item = tokio::time::Instant;181182	fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {183		self.interval.poll_tick(cx).map(Some)184	}185}186187pub fn open_frontier_backend<C: HeaderBackend<Block>>(188	client: Arc<C>,189	config: &Configuration,190) -> Result<Arc<fc_db::kv::Backend<Block>>, String> {191	let config_dir = config.base_path.config_dir(config.chain_spec.id());192	let database_dir = config_dir.join("frontier").join("db");193194	Ok(Arc::new(fc_db::kv::Backend::<Block>::new(195		client,196		&fc_db::kv::DatabaseSettings {197			source: fc_db::DatabaseSource::RocksDb {198				path: database_dir,199				cache_size: 0,200			},201		},202	)?))203}204205type FullClient<RuntimeApi, ExecutorDispatch> =206	sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;207type FullBackend = sc_service::TFullBackend<Block>;208type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;209type ParachainBlockImport<RuntimeApi, ExecutorDispatch> =210	TParachainBlockImport<Block, Arc<FullClient<RuntimeApi, ExecutorDispatch>>, FullBackend>;211212/// Generate a supertrait based on bounds, and blanket impl for it.213macro_rules! ez_bounds {214	($vis:vis trait $name:ident$(<$($gen:ident $(: $($(+)? $bound:path)*)?),* $(,)?>)? $(:)? $($(+)? $super:path)* {}) => {215		$vis trait $name $(<$($gen $(: $($bound+)*)?,)*>)?: $($super +)* {}216		impl<T, $($($gen $(: $($bound+)*)?,)*)?> $name$(<$($gen,)*>)? for T217		where T: $($super +)* {}218	}219}220ez_bounds!(221	pub trait RuntimeApiDep<Runtime: RuntimeInstance>:222		sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>223		+ sp_consensus_aura::AuraApi<Block, AuraId>224		+ fp_rpc::EthereumRuntimeRPCApi<Block>225		+ sp_session::SessionKeys<Block>226		+ sp_block_builder::BlockBuilder<Block>227		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>228		+ sp_api::ApiExt<Block>229		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>230		+ app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>231		+ up_pov_estimate_rpc::PovEstimateApi<Block>232		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>233		+ sp_api::Metadata<Block>234		+ sp_offchain::OffchainWorkerApi<Block>235		+ cumulus_primitives_core::CollectCollationInfo<Block>236		// Deprecated, not used.237		+ fp_rpc::ConvertTransactionRuntimeApi<Block>238	{239	}240);241242/// Starts a `ServiceBuilder` for a full service.243///244/// Use this macro if you don't actually need the full service, but just the builder in order to245/// be able to perform chain operations.246#[allow(clippy::type_complexity)]247pub fn new_partial<Runtime, RuntimeApi, ExecutorDispatch, BIQ>(248	config: &Configuration,249	build_import_queue: BIQ,250) -> Result<251	PartialComponents<252		FullClient<RuntimeApi, ExecutorDispatch>,253		FullBackend,254		FullSelectChain,255		sc_consensus::DefaultImportQueue<Block>,256		sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,257		OtherPartial,258	>,259	sc_service::Error,260>261where262	sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,263	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>264		+ Send265		+ Sync266		+ 'static,267	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,268	Runtime: RuntimeInstance,269	ExecutorDispatch: NativeExecutionDispatch + 'static,270	BIQ: FnOnce(271		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,272		Arc<FullBackend>,273		&Configuration,274		Option<TelemetryHandle>,275		&TaskManager,276	) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>,277{278	let telemetry = config279		.telemetry_endpoints280		.clone()281		.filter(|x| !x.is_empty())282		.map(|endpoints| -> Result<_, sc_telemetry::Error> {283			let worker = TelemetryWorker::new(16)?;284			let telemetry = worker.handle().new_telemetry(endpoints);285			Ok((worker, telemetry))286		})287		.transpose()?;288289	let executor = sc_service::new_native_or_wasm_executor(config);290291	let (client, backend, keystore_container, task_manager) =292		sc_service::new_full_parts::<Block, RuntimeApi, _>(293			config,294			telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),295			executor,296		)?;297	let client = Arc::new(client);298299	let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle());300301	let telemetry = telemetry.map(|(worker, telemetry)| {302		task_manager303			.spawn_handle()304			.spawn("telemetry", None, worker.run());305		telemetry306	});307308	let select_chain = sc_consensus::LongestChain::new(backend.clone());309310	let transaction_pool = sc_transaction_pool::BasicPool::new_full(311		config.transaction_pool.clone(),312		config.role.is_authority().into(),313		config.prometheus_registry(),314		task_manager.spawn_essential_handle(),315		client.clone(),316	);317318	let eth_filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));319320	let eth_backend = open_frontier_backend(client.clone(), config)?;321322	let import_queue = build_import_queue(323		client.clone(),324		backend.clone(),325		config,326		telemetry.as_ref().map(|telemetry| telemetry.handle()),327		&task_manager,328	)?;329330	let params = PartialComponents {331		backend,332		client,333		import_queue,334		keystore_container,335		task_manager,336		transaction_pool,337		select_chain,338		other: OtherPartial {339			telemetry,340			eth_filter_pool,341			eth_backend,342			telemetry_worker_handle,343		},344	};345346	Ok(params)347}348349macro_rules! clone {350    ($($i:ident),* $(,)?) => {351		$(352			let $i = $i.clone();353		)*354    };355}356357/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.358///359/// This is the actual implementation that is abstract over the executor and the runtime api.360#[sc_tracing::logging::prefix_logs_with("Parachain")]361pub async fn start_node<Runtime, RuntimeApi, ExecutorDispatch>(362	parachain_config: Configuration,363	polkadot_config: Configuration,364	collator_options: CollatorOptions,365	para_id: ParaId,366	hwbench: Option<sc_sysinfo::HwBench>,367) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>368where369	sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,370	Runtime: RuntimeInstance + Send + Sync + 'static,371	<Runtime as RuntimeInstance>::CrossAccountId: Serialize,372	for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,373	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>374		+ Send375		+ Sync376		+ 'static,377	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,378	Runtime: RuntimeInstance,379	ExecutorDispatch: NativeExecutionDispatch + 'static,380{381	let parachain_config = prepare_node_config(parachain_config);382383	let params = new_partial::<Runtime, RuntimeApi, ExecutorDispatch, _>(384		&parachain_config,385		parachain_build_import_queue,386	)?;387	let OtherPartial {388		mut telemetry,389		telemetry_worker_handle,390		eth_filter_pool,391		eth_backend,392	} = params.other;393	let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);394395	let client = params.client.clone();396	let backend = params.backend.clone();397	let mut task_manager = params.task_manager;398399	let (relay_chain_interface, collator_key) = build_relay_chain_interface(400		polkadot_config,401		&parachain_config,402		telemetry_worker_handle,403		&mut task_manager,404		collator_options.clone(),405		hwbench.clone(),406	)407	.await408	.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;409410	let block_announce_validator =411		RequireSecondedInBlockAnnounce::new(relay_chain_interface.clone(), para_id);412413	let validator = parachain_config.role.is_authority();414	let prometheus_registry = parachain_config.prometheus_registry().cloned();415	let transaction_pool = params.transaction_pool.clone();416	let import_queue_service = params.import_queue.service();417418	let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =419		sc_service::build_network(sc_service::BuildNetworkParams {420			config: &parachain_config,421			net_config,422			client: client.clone(),423			transaction_pool: transaction_pool.clone(),424			spawn_handle: task_manager.spawn_handle(),425			import_queue: params.import_queue,426			block_announce_validator_builder: Some(Box::new(|_| {427				Box::new(block_announce_validator)428			})),429			warp_sync_params: None,430		})?;431432	let select_chain = params.select_chain.clone();433434	let runtime_id = parachain_config.chain_spec.runtime_id();435436	// Frontier437	let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));438	let fee_history_limit = 2048;439440	let eth_pubsub_notification_sinks: Arc<441		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,442	> = Default::default();443444	let overrides = overrides_handle(client.clone());445	let eth_block_data_cache = spawn_frontier_tasks(446		FrontierTaskParams {447			client: client.clone(),448			substrate_backend: backend.clone(),449			eth_filter_pool: eth_filter_pool.clone(),450			eth_backend: eth_backend.clone(),451			fee_history_limit,452			fee_history_cache: fee_history_cache.clone(),453			task_manager: &task_manager,454			prometheus_registry: prometheus_registry.clone(),455			overrides: overrides.clone(),456			sync_strategy: SyncStrategy::Parachain,457		},458		sync_service.clone(),459		eth_pubsub_notification_sinks.clone(),460	);461462	// Rpc463	let rpc_builder = Box::new({464		clone!(465			client,466			backend,467			eth_backend,468			eth_pubsub_notification_sinks,469			fee_history_cache,470			eth_block_data_cache,471			overrides,472			transaction_pool,473			network,474			sync_service,475		);476		move |deny_unsafe, subscription_task_executor: SubscriptionTaskExecutor| {477			clone!(478				backend,479				eth_block_data_cache,480				client,481				eth_backend,482				eth_filter_pool,483				eth_pubsub_notification_sinks,484				fee_history_cache,485				eth_block_data_cache,486				network,487				runtime_id,488				transaction_pool,489				select_chain,490				overrides,491			);492493			#[cfg(not(feature = "pov-estimate"))]494			let _ = backend;495496			let mut rpc_handle = RpcModule::new(());497498			let full_deps = FullDeps {499				client: client.clone(),500				runtime_id,501502				#[cfg(feature = "pov-estimate")]503				exec_params: uc_rpc::pov_estimate::ExecutorParams {504					wasm_method: parachain_config.wasm_method,505					default_heap_pages: parachain_config.default_heap_pages,506					max_runtime_instances: parachain_config.max_runtime_instances,507					runtime_cache_size: parachain_config.runtime_cache_size,508				},509510				#[cfg(feature = "pov-estimate")]511				backend,512513				deny_unsafe,514				pool: transaction_pool.clone(),515				select_chain,516			};517518			create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_handle, full_deps)?;519520			let eth_deps = EthDeps {521				client,522				graph: transaction_pool.pool().clone(),523				pool: transaction_pool,524				is_authority: validator,525				network,526				eth_backend,527				// TODO: Unhardcode528				max_past_logs: 10000,529				fee_history_limit,530				fee_history_cache,531				eth_block_data_cache,532				// TODO: Unhardcode533				enable_dev_signer: false,534				eth_filter_pool,535				eth_pubsub_notification_sinks,536				overrides,537				sync: sync_service.clone(),538				pending_create_inherent_data_providers: |_, ()| async move { Ok(()) },539			};540541			create_eth::<542				_,543				_,544				_,545				_,546				_,547				_,548				DefaultEthConfig<FullClient<RuntimeApi, ExecutorDispatch>>,549			>(550				&mut rpc_handle,551				eth_deps,552				subscription_task_executor.clone(),553			)?;554555			Ok(rpc_handle)556		}557	});558559	sc_service::spawn_tasks(sc_service::SpawnTasksParams {560		rpc_builder,561		client: client.clone(),562		transaction_pool: transaction_pool.clone(),563		task_manager: &mut task_manager,564		config: parachain_config,565		keystore: params.keystore_container.keystore(),566		backend: backend.clone(),567		network: network.clone(),568		sync_service: sync_service.clone(),569		system_rpc_tx,570		telemetry: telemetry.as_mut(),571		tx_handler_controller,572	})?;573574	if let Some(hwbench) = hwbench {575		sc_sysinfo::print_hwbench(&hwbench);576577		if let Some(ref mut telemetry) = telemetry {578			let telemetry_handle = telemetry.handle();579			task_manager.spawn_handle().spawn(580				"telemetry_hwbench",581				None,582				sc_sysinfo::initialize_hwbench_telemetry(telemetry_handle, hwbench),583			);584		}585	}586587	let announce_block = {588		let sync_service = sync_service.clone();589		Arc::new(Box::new(move |hash, data| {590			sync_service.announce_block(hash, data)591		}))592	};593594	let relay_chain_slot_duration = Duration::from_secs(6);595596	let overseer_handle = relay_chain_interface597		.overseer_handle()598		.map_err(|e| sc_service::Error::Application(Box::new(e)))?;599600	start_relay_chain_tasks(StartRelayChainTasksParams {601		client: client.clone(),602		announce_block: announce_block.clone(),603		para_id,604		relay_chain_interface: relay_chain_interface.clone(),605		task_manager: &mut task_manager,606		da_recovery_profile: if validator {607			DARecoveryProfile::Collator608		} else {609			DARecoveryProfile::FullNode610		},611		import_queue: import_queue_service,612		relay_chain_slot_duration,613		recovery_handle: Box::new(overseer_handle.clone()),614		sync_service: sync_service.clone(),615	})?;616617	if validator {618		start_consensus(619			client.clone(),620			backend.clone(),621			prometheus_registry.as_ref(),622			telemetry.as_ref().map(|t| t.handle()),623			&task_manager,624			relay_chain_interface.clone(),625			transaction_pool,626			sync_service.clone(),627			params.keystore_container.keystore(),628			overseer_handle,629			relay_chain_slot_duration,630			para_id,631			collator_key.expect("cli args do not allow this"),632			announce_block,633		)?;634	}635636	start_network.start_network();637638	Ok((task_manager, client))639}640641/// Build the import queue for the the parachain runtime.642pub fn parachain_build_import_queue<Runtime, RuntimeApi, ExecutorDispatch>(643	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,644	backend: Arc<FullBackend>,645	config: &Configuration,646	telemetry: Option<TelemetryHandle>,647	task_manager: &TaskManager,648) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>649where650	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>651		+ Send652		+ Sync653		+ 'static,654	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,655	Runtime: RuntimeInstance,656	ExecutorDispatch: NativeExecutionDispatch + 'static,657{658	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;659660	let block_import = ParachainBlockImport::new(client.clone(), backend);661662	cumulus_client_consensus_aura::import_queue::<663		sp_consensus_aura::sr25519::AuthorityPair,664		_,665		_,666		_,667		_,668		_,669	>(cumulus_client_consensus_aura::ImportQueueParams {670		block_import,671		client,672		create_inherent_data_providers: move |_, _| async move {673			let time = sp_timestamp::InherentDataProvider::from_system_time();674675			let slot =676				sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(677					*time,678					slot_duration,679				);680681			Ok((slot, time))682		},683		registry: config.prometheus_registry(),684		spawner: &task_manager.spawn_essential_handle(),685		telemetry,686	})687	.map_err(Into::into)688}689690pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(691	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,692	backend: Arc<FullBackend>,693	prometheus_registry: Option<&Registry>,694	telemetry: Option<TelemetryHandle>,695	task_manager: &TaskManager,696	relay_chain_interface: Arc<dyn RelayChainInterface>,697	transaction_pool: Arc<698		sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,699	>,700	sync_oracle: Arc<SyncingService<Block>>,701	keystore: KeystorePtr,702	overseer_handle: OverseerHandle,703	relay_chain_slot_duration: Duration,704	para_id: ParaId,705	collator_key: CollatorPair,706	announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,707) -> Result<(), sc_service::Error>708where709	ExecutorDispatch: NativeExecutionDispatch + 'static,710	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>711		+ Send712		+ Sync713		+ 'static,714	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,715	Runtime: RuntimeInstance,716{717	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;718719	let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(720		task_manager.spawn_handle(),721		client.clone(),722		transaction_pool,723		prometheus_registry,724		telemetry.clone(),725	);726	let proposer = Proposer::new(proposer_factory);727728	let collator_service = CollatorService::new(729		client.clone(),730		Arc::new(task_manager.spawn_handle()),731		announce_block,732		client.clone(),733	);734735	let block_import = ParachainBlockImport::new(client.clone(), backend);736737	let params = BuildAuraConsensusParams {738		create_inherent_data_providers: move |_, ()| async move { Ok(()) },739		block_import,740		para_client: client,741		#[cfg(feature = "lookahead")]742		para_backend: backend,743		para_id,744		relay_client: relay_chain_interface,745		sync_oracle,746		keystore,747		slot_duration,748		proposer,749		collator_service,750		// With async-baking, we allowed to be both slower (longer authoring) and faster (multiple para blocks per relay block)751		authoring_duration: Duration::from_millis(500),752		overseer_handle,753		#[cfg(feature = "lookahead")]754		code_hash_provider: || {},755		collator_key,756		relay_chain_slot_duration,757	};758759	task_manager.spawn_essential_handle().spawn(760		"aura",761		None,762		run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _>(params),763	);764	Ok(())765}766767fn dev_build_import_queue<RuntimeApi, ExecutorDispatch>(768	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,769	_: Arc<FullBackend>,770	config: &Configuration,771	_: Option<TelemetryHandle>,772	task_manager: &TaskManager,773) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>774where775	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>776		+ Send777		+ Sync778		+ 'static,779	RuntimeApi::RuntimeApi:780		sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> + sp_api::ApiExt<Block>,781	ExecutorDispatch: NativeExecutionDispatch + 'static,782{783	Ok(sc_consensus_manual_seal::import_queue(784		Box::new(client),785		&task_manager.spawn_essential_handle(),786		config.prometheus_registry(),787	))788}789790pub struct OtherPartial {791	pub telemetry: Option<Telemetry>,792	pub telemetry_worker_handle: Option<TelemetryWorkerHandle>,793	pub eth_filter_pool: Option<FilterPool>,794	pub eth_backend: Arc<fc_db::kv::Backend<Block>>,795}796797struct DefaultEthConfig<C>(PhantomData<C>);798impl<C> EthConfig<Block, C> for DefaultEthConfig<C>799where800	C: StorageProvider<Block, FullBackend> + Sync + Send + 'static,801{802	type EstimateGasAdapter = ();803	type RuntimeStorageOverride = SystemAccountId32StorageOverride<Block, C, FullBackend>;804}805806/// Builds a new development service. This service uses instant seal, and mocks807/// the parachain inherent808pub fn start_dev_node<Runtime, RuntimeApi, ExecutorDispatch>(809	config: Configuration,810	autoseal_interval: u64,811	autoseal_finalize_delay: Option<u64>,812	disable_autoseal_on_tx: bool,813) -> sc_service::error::Result<TaskManager>814where815	Runtime: RuntimeInstance + Send + Sync + 'static,816	<Runtime as RuntimeInstance>::CrossAccountId: Serialize,817	for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,818	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>819		+ Send820		+ Sync821		+ 'static,822	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,823	ExecutorDispatch: NativeExecutionDispatch + 'static,824{825	use fc_consensus::FrontierBlockImport;826	use sc_consensus_manual_seal::{827		run_delayed_finalize, run_manual_seal, DelayedFinalizeParams, EngineCommand,828		ManualSealParams,829	};830831	let sc_service::PartialComponents {832		client,833		backend,834		mut task_manager,835		import_queue,836		keystore_container,837		select_chain: maybe_select_chain,838		transaction_pool,839		other:840			OtherPartial {841				telemetry,842				eth_filter_pool,843				eth_backend,844				telemetry_worker_handle: _,845			},846	} = new_partial::<Runtime, RuntimeApi, ExecutorDispatch, _>(847		&config,848		dev_build_import_queue::<RuntimeApi, ExecutorDispatch>,849	)?;850	let net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);851	let prometheus_registry = config.prometheus_registry().cloned();852853	let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =854		sc_service::build_network(sc_service::BuildNetworkParams {855			config: &config,856			net_config,857			client: client.clone(),858			transaction_pool: transaction_pool.clone(),859			spawn_handle: task_manager.spawn_handle(),860			import_queue,861			block_announce_validator_builder: None,862			warp_sync_params: None,863		})?;864865	let collator = config.role.is_authority();866867	let select_chain = maybe_select_chain;868869	if collator {870		let block_import = FrontierBlockImport::new(client.clone(), client.clone());871872		let env = sc_basic_authorship::ProposerFactory::new(873			task_manager.spawn_handle(),874			client.clone(),875			transaction_pool.clone(),876			prometheus_registry.as_ref(),877			telemetry.as_ref().map(|x| x.handle()),878		);879880		let transactions_commands_stream: Box<881			dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,882		> = Box::new(883			transaction_pool884				.pool()885				.validated_pool()886				.import_notification_stream()887				.filter(move |_| futures::future::ready(!disable_autoseal_on_tx))888				.map(|_| EngineCommand::SealNewBlock {889					create_empty: true,890					finalize: false,891					parent_hash: None,892					sender: None,893				}),894		);895896		let autoseal_interval = Box::pin(AutosealInterval::new(&config, autoseal_interval));897898		let idle_commands_stream: Box<899			dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,900		> = Box::new(autoseal_interval.map(|_| EngineCommand::SealNewBlock {901			create_empty: true,902			finalize: false,903			parent_hash: None,904			sender: None,905		}));906907		let commands_stream = select(transactions_commands_stream, idle_commands_stream);908909		let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;910		let client_set_aside_for_cidp = client.clone();911912		if let Some(delay_sec) = autoseal_finalize_delay {913			let spawn_handle = task_manager.spawn_handle();914915			task_manager.spawn_essential_handle().spawn_blocking(916				"finalization_task",917				Some("block-authoring"),918				run_delayed_finalize(DelayedFinalizeParams {919					client: client.clone(),920					delay_sec,921					spawn_handle,922				}),923			);924		}925926		task_manager.spawn_essential_handle().spawn_blocking(927			"authorship_task",928			Some("block-authoring"),929			run_manual_seal(ManualSealParams {930				block_import,931				env,932				client: client.clone(),933				pool: transaction_pool.clone(),934				commands_stream,935				select_chain: select_chain.clone(),936				consensus_data_provider: None,937				create_inherent_data_providers: move |block: Hash, ()| {938					let current_para_block = client_set_aside_for_cidp939						.number(block)940						.expect("Header lookup should succeed")941						.expect("Header passed in as parent should be present in backend.");942943					let client_for_xcm = client_set_aside_for_cidp.clone();944					async move {945						let time = sp_timestamp::InherentDataProvider::from_system_time();946947						let mocked_parachain = cumulus_primitives_parachain_inherent::MockValidationDataInherentDataProvider {948							current_para_block,949							relay_offset: 1000,950							relay_blocks_per_para_block: 2,951							para_blocks_per_relay_epoch: 0,952							xcm_config: cumulus_primitives_parachain_inherent::MockXcmConfig::new(953								&*client_for_xcm,954								block,955								Default::default(),956								Default::default(),957							),958							relay_randomness_config: (),959							raw_downward_messages: vec![],960							raw_horizontal_messages: vec![],961						};962963						let slot =964						sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(965							*time,966							slot_duration,967						);968969						Ok((time, slot, mocked_parachain))970					}971				},972			}),973		);974	}975976	#[cfg(feature = "pov-estimate")]977	let rpc_backend = backend.clone();978979	let runtime_id = config.chain_spec.runtime_id();980981	// Frontier982	let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));983	let fee_history_limit = 2048;984985	let eth_pubsub_notification_sinks: Arc<986		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,987	> = Default::default();988989	let overrides = overrides_handle(client.clone());990	let eth_block_data_cache = spawn_frontier_tasks(991		FrontierTaskParams {992			client: client.clone(),993			substrate_backend: backend.clone(),994			eth_filter_pool: eth_filter_pool.clone(),995			eth_backend: eth_backend.clone(),996			fee_history_limit,997			fee_history_cache: fee_history_cache.clone(),998			task_manager: &task_manager,999			prometheus_registry,1000			overrides: overrides.clone(),1001			sync_strategy: SyncStrategy::Normal,1002		},1003		sync_service.clone(),1004		eth_pubsub_notification_sinks.clone(),1005	);10061007	// Rpc1008	let rpc_builder = Box::new({1009		clone!(1010			client,1011			backend,1012			eth_backend,1013			eth_pubsub_notification_sinks,1014			fee_history_cache,1015			eth_block_data_cache,1016			overrides,1017			transaction_pool,1018			network,1019			sync_service,1020		);1021		move |deny_unsafe, subscription_task_executor: SubscriptionTaskExecutor| {1022			clone!(1023				backend,1024				eth_block_data_cache,1025				client,1026				eth_backend,1027				eth_filter_pool,1028				eth_pubsub_notification_sinks,1029				fee_history_cache,1030				eth_block_data_cache,1031				network,1032				runtime_id,1033				transaction_pool,1034				select_chain,1035				overrides,1036			);10371038			#[cfg(not(feature = "pov-estimate"))]1039			let _ = backend;10401041			let mut rpc_module = RpcModule::new(());10421043			let full_deps = FullDeps {1044				runtime_id,10451046				#[cfg(feature = "pov-estimate")]1047				exec_params: uc_rpc::pov_estimate::ExecutorParams {1048					wasm_method: config.wasm_method,1049					default_heap_pages: config.default_heap_pages,1050					max_runtime_instances: config.max_runtime_instances,1051					runtime_cache_size: config.runtime_cache_size,1052				},10531054				#[cfg(feature = "pov-estimate")]1055				backend,1056				// eth_backend,1057				deny_unsafe,1058				client: client.clone(),1059				pool: transaction_pool.clone(),1060				select_chain,1061			};10621063			create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_module, full_deps)?;10641065			let eth_deps = EthDeps {1066				client,1067				graph: transaction_pool.pool().clone(),1068				pool: transaction_pool,1069				is_authority: true,1070				network,1071				eth_backend,1072				// TODO: Unhardcode1073				max_past_logs: 10000,1074				fee_history_limit,1075				fee_history_cache,1076				eth_block_data_cache,1077				// TODO: Unhardcode1078				enable_dev_signer: false,1079				eth_filter_pool,1080				eth_pubsub_notification_sinks,1081				overrides,1082				sync: sync_service.clone(),1083				// We don't have any inherents except parachain built-ins, which we can't even extract from inside `run_aura`.1084				pending_create_inherent_data_providers: |_, ()| async move { Ok(()) },1085			};10861087			create_eth::<1088				_,1089				_,1090				_,1091				_,1092				_,1093				_,1094				DefaultEthConfig<FullClient<RuntimeApi, ExecutorDispatch>>,1095			>(1096				&mut rpc_module,1097				eth_deps,1098				subscription_task_executor.clone(),1099			)?;11001101			Ok(rpc_module)1102		}1103	});11041105	sc_service::spawn_tasks(sc_service::SpawnTasksParams {1106		network,1107		sync_service,1108		client,1109		keystore: keystore_container.keystore(),1110		task_manager: &mut task_manager,1111		transaction_pool,1112		rpc_builder,1113		backend,1114		system_rpc_tx,1115		config,1116		telemetry: None,1117		tx_handler_controller,1118	})?;11191120	network_starter.start_network();1121	Ok(task_manager)1122}11231124fn overrides_handle<C, BE>(client: Arc<C>) -> Arc<OverrideHandle<Block>>1125where1126	C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,1127	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,1128	C: Send + Sync + 'static,1129	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,1130	BE: Backend<Block> + 'static,1131	BE::State: StateBackend<BlakeTwo256>,1132{1133	let mut overrides_map = BTreeMap::new();1134	overrides_map.insert(1135		EthereumStorageSchema::V1,1136		Box::new(SchemaV1Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1137	);1138	overrides_map.insert(1139		EthereumStorageSchema::V2,1140		Box::new(SchemaV2Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1141	);1142	overrides_map.insert(1143		EthereumStorageSchema::V3,1144		Box::new(SchemaV3Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1145	);11461147	Arc::new(OverrideHandle {1148		schemas: overrides_map,1149		fallback: Box::new(RuntimeApiStorageOverride::new(client)),1150	})1151}11521153pub struct FrontierTaskParams<'a, C, B> {1154	pub task_manager: &'a TaskManager,1155	pub client: Arc<C>,1156	pub substrate_backend: Arc<B>,1157	pub eth_backend: Arc<fc_db::kv::Backend<Block>>,1158	pub eth_filter_pool: Option<FilterPool>,1159	pub overrides: Arc<OverrideHandle<Block>>,1160	pub fee_history_limit: u64,1161	pub fee_history_cache: FeeHistoryCache,1162	pub sync_strategy: SyncStrategy,1163	pub prometheus_registry: Option<Registry>,1164}11651166pub fn spawn_frontier_tasks<C, B>(1167	params: FrontierTaskParams<C, B>,1168	sync: Arc<SyncingService<Block>>,1169	pubsub_notification_sinks: Arc<1170		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,1171	>,1172) -> Arc<EthBlockDataCacheTask<Block>>1173where1174	C: ProvideRuntimeApi<Block> + BlockOf,1175	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,1176	C: BlockchainEvents<Block> + StorageProvider<Block, B>,1177	C: Send + Sync + 'static,1178	C::Api: EthereumRuntimeRPCApi<Block>,1179	C::Api: BlockBuilder<Block>,1180	B: Backend<Block> + 'static,1181	B::State: StateBackend<BlakeTwo256>,1182{1183	let FrontierTaskParams {1184		task_manager,1185		client,1186		substrate_backend,1187		eth_backend,1188		eth_filter_pool,1189		overrides,1190		fee_history_limit,1191		fee_history_cache,1192		sync_strategy,1193		prometheus_registry,1194	} = params;1195	// Frontier offchain DB task. Essential.1196	// Maps emulated ethereum data to substrate native data.1197	params.task_manager.spawn_essential_handle().spawn(1198		"frontier-mapping-sync-worker",1199		Some("frontier"),1200		MappingSyncWorker::new(1201			client.import_notification_stream(),1202			Duration::new(6, 0),1203			client.clone(),1204			substrate_backend,1205			overrides.clone(),1206			eth_backend,1207			3,1208			0,1209			sync_strategy,1210			sync,1211			pubsub_notification_sinks,1212		)1213		.for_each(|()| futures::future::ready(())),1214	);12151216	// Frontier `EthFilterApi` maintenance.1217	// Manages the pool of user-created Filters.1218	if let Some(eth_filter_pool) = eth_filter_pool {1219		// Each filter is allowed to stay in the pool for 100 blocks.1220		const FILTER_RETAIN_THRESHOLD: u64 = 100;1221		params.task_manager.spawn_essential_handle().spawn(1222			"frontier-filter-pool",1223			Some("frontier"),1224			EthTask::filter_pool_task(client.clone(), eth_filter_pool, FILTER_RETAIN_THRESHOLD),1225		);1226	}12271228	// Spawn Frontier FeeHistory cache maintenance task.1229	params.task_manager.spawn_essential_handle().spawn(1230		"frontier-fee-history",1231		Some("frontier"),1232		EthTask::fee_history_task(1233			client,1234			overrides.clone(),1235			fee_history_cache,1236			fee_history_limit,1237		),1238	);12391240	Arc::new(EthBlockDataCacheTask::new(1241		task_manager.spawn_handle(),1242		overrides,1243		50,1244		50,1245		prometheus_registry,1246	))1247}
after · node/cli/src/service.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// std18use std::{19	collections::BTreeMap,20	marker::PhantomData,21	pin::Pin,22	sync::{Arc, Mutex},23	time::Duration,24};2526use cumulus_client_cli::CollatorOptions;27use cumulus_client_collator::service::CollatorService;28#[cfg(not(feature = "lookahead"))]29use cumulus_client_consensus_aura::collators::basic::{30	run as run_aura, Params as BuildAuraConsensusParams,31};32#[cfg(feature = "lookahead")]33use cumulus_client_consensus_aura::collators::lookahead::{34	run as run_aura, Params as BuildAuraConsensusParams,35};36use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;37use cumulus_client_consensus_proposer::Proposer;38use cumulus_client_network::RequireSecondedInBlockAnnounce;39use cumulus_client_service::{40	build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, DARecoveryProfile,41	StartRelayChainTasksParams,42};43use cumulus_primitives_core::ParaId;44use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};45use fc_mapping_sync::{kv::MappingSyncWorker, EthereumBlockNotificationSinks, SyncStrategy};46use fc_rpc::{47	frontier_backend_client::SystemAccountId32StorageOverride, EthBlockDataCacheTask, EthConfig,48	EthTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override,49	SchemaV3Override, StorageOverride,50};51use fc_rpc_core::types::{FeeHistoryCache, FilterPool};52use fp_rpc::EthereumRuntimeRPCApi;53use fp_storage::EthereumStorageSchema;54use futures::{55	stream::select,56	task::{Context, Poll},57	Stream, StreamExt,58};59use jsonrpsee::RpcModule;60use polkadot_service::CollatorPair;61use sc_client_api::{AuxStore, Backend, BlockOf, BlockchainEvents, StorageProvider};62use sc_consensus::ImportQueue;63use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};64use sc_network::NetworkBlock;65use sc_network_sync::SyncingService;66use sc_rpc::SubscriptionTaskExecutor;67use sc_service::{Configuration, PartialComponents, TaskManager};68use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};69use serde::{Deserialize, Serialize};70use sp_api::{ProvideRuntimeApi, StateBackend};71use sp_block_builder::BlockBuilder;72use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};73use sp_consensus_aura::sr25519::AuthorityPair as AuraAuthorityPair;74use sp_keystore::KeystorePtr;75use sp_runtime::traits::BlakeTwo256;76use substrate_prometheus_endpoint::Registry;77use tokio::time::Interval;78use up_common::types::{opaque::*, Nonce};7980use crate::{81	chain_spec::RuntimeIdentification,82	rpc::{create_eth, create_full, EthDeps, FullDeps},83};8485/// Unique native executor instance.86#[cfg(feature = "unique-runtime")]87pub struct UniqueRuntimeExecutor;8889#[cfg(feature = "quartz-runtime")]90/// Quartz native executor instance.91pub struct QuartzRuntimeExecutor;9293/// Opal native executor instance.94pub struct OpalRuntimeExecutor;9596#[cfg(feature = "unique-runtime")]97impl NativeExecutionDispatch for UniqueRuntimeExecutor {98	/// Only enable the benchmarking host functions when we actually want to benchmark.99	#[cfg(feature = "runtime-benchmarks")]100	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;101	/// Otherwise we only use the default Substrate host functions.102	#[cfg(not(feature = "runtime-benchmarks"))]103	type ExtendHostFunctions = ();104105	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {106		unique_runtime::api::dispatch(method, data)107	}108109	fn native_version() -> sc_executor::NativeVersion {110		unique_runtime::native_version()111	}112}113114#[cfg(feature = "quartz-runtime")]115impl NativeExecutionDispatch for QuartzRuntimeExecutor {116	/// Only enable the benchmarking host functions when we actually want to benchmark.117	#[cfg(feature = "runtime-benchmarks")]118	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;119	/// Otherwise we only use the default Substrate host functions.120	#[cfg(not(feature = "runtime-benchmarks"))]121	type ExtendHostFunctions = ();122123	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {124		quartz_runtime::api::dispatch(method, data)125	}126127	fn native_version() -> sc_executor::NativeVersion {128		quartz_runtime::native_version()129	}130}131132impl NativeExecutionDispatch for OpalRuntimeExecutor {133	/// Only enable the benchmarking host functions when we actually want to benchmark.134	#[cfg(feature = "runtime-benchmarks")]135	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;136	/// Otherwise we only use the default Substrate host functions.137	#[cfg(not(feature = "runtime-benchmarks"))]138	type ExtendHostFunctions = ();139140	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {141		opal_runtime::api::dispatch(method, data)142	}143144	fn native_version() -> sc_executor::NativeVersion {145		opal_runtime::native_version()146	}147}148149pub struct AutosealInterval {150	interval: Interval,151}152153impl AutosealInterval {154	pub fn new(config: &Configuration, interval: u64) -> Self {155		let _tokio_runtime = config.tokio_handle.enter();156		let interval = tokio::time::interval(Duration::from_millis(interval));157158		Self { interval }159	}160}161162impl Stream for AutosealInterval {163	type Item = tokio::time::Instant;164165	fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {166		self.interval.poll_tick(cx).map(Some)167	}168}169170pub fn open_frontier_backend<C: HeaderBackend<Block>>(171	client: Arc<C>,172	config: &Configuration,173) -> Result<Arc<fc_db::kv::Backend<Block>>, String> {174	let config_dir = config.base_path.config_dir(config.chain_spec.id());175	let database_dir = config_dir.join("frontier").join("db");176177	Ok(Arc::new(fc_db::kv::Backend::<Block>::new(178		client,179		&fc_db::kv::DatabaseSettings {180			source: fc_db::DatabaseSource::RocksDb {181				path: database_dir,182				cache_size: 0,183			},184		},185	)?))186}187188type FullClient<RuntimeApi, ExecutorDispatch> =189	sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;190type FullBackend = sc_service::TFullBackend<Block>;191type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;192type ParachainBlockImport<RuntimeApi, ExecutorDispatch> =193	TParachainBlockImport<Block, Arc<FullClient<RuntimeApi, ExecutorDispatch>>, FullBackend>;194195/// Generate a supertrait based on bounds, and blanket impl for it.196macro_rules! ez_bounds {197	($vis:vis trait $name:ident$(<$($gen:ident $(: $($(+)? $bound:path)*)?),* $(,)?>)? $(:)? $($(+)? $super:path)* {}) => {198		$vis trait $name $(<$($gen $(: $($bound+)*)?,)*>)?: $($super +)* {}199		impl<T, $($($gen $(: $($bound+)*)?,)*)?> $name$(<$($gen,)*>)? for T200		where T: $($super +)* {}201	}202}203ez_bounds!(204	pub trait RuntimeApiDep<Runtime: RuntimeInstance>:205		sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>206		+ sp_consensus_aura::AuraApi<Block, AuraId>207		+ fp_rpc::EthereumRuntimeRPCApi<Block>208		+ sp_session::SessionKeys<Block>209		+ sp_block_builder::BlockBuilder<Block>210		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>211		+ sp_api::ApiExt<Block>212		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>213		+ app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>214		+ up_pov_estimate_rpc::PovEstimateApi<Block>215		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>216		+ sp_api::Metadata<Block>217		+ sp_offchain::OffchainWorkerApi<Block>218		+ cumulus_primitives_core::CollectCollationInfo<Block>219		// Deprecated, not used.220		+ fp_rpc::ConvertTransactionRuntimeApi<Block>221	{222	}223);224225/// Starts a `ServiceBuilder` for a full service.226///227/// Use this macro if you don't actually need the full service, but just the builder in order to228/// be able to perform chain operations.229#[allow(clippy::type_complexity)]230pub fn new_partial<Runtime, RuntimeApi, ExecutorDispatch, BIQ>(231	config: &Configuration,232	build_import_queue: BIQ,233) -> Result<234	PartialComponents<235		FullClient<RuntimeApi, ExecutorDispatch>,236		FullBackend,237		FullSelectChain,238		sc_consensus::DefaultImportQueue<Block>,239		sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,240		OtherPartial,241	>,242	sc_service::Error,243>244where245	sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,246	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>247		+ Send248		+ Sync249		+ 'static,250	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,251	Runtime: RuntimeInstance,252	ExecutorDispatch: NativeExecutionDispatch + 'static,253	BIQ: FnOnce(254		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,255		Arc<FullBackend>,256		&Configuration,257		Option<TelemetryHandle>,258		&TaskManager,259	) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>,260{261	let telemetry = config262		.telemetry_endpoints263		.clone()264		.filter(|x| !x.is_empty())265		.map(|endpoints| -> Result<_, sc_telemetry::Error> {266			let worker = TelemetryWorker::new(16)?;267			let telemetry = worker.handle().new_telemetry(endpoints);268			Ok((worker, telemetry))269		})270		.transpose()?;271272	let executor = sc_service::new_native_or_wasm_executor(config);273274	let (client, backend, keystore_container, task_manager) =275		sc_service::new_full_parts::<Block, RuntimeApi, _>(276			config,277			telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),278			executor,279		)?;280	let client = Arc::new(client);281282	let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle());283284	let telemetry = telemetry.map(|(worker, telemetry)| {285		task_manager286			.spawn_handle()287			.spawn("telemetry", None, worker.run());288		telemetry289	});290291	let select_chain = sc_consensus::LongestChain::new(backend.clone());292293	let transaction_pool = sc_transaction_pool::BasicPool::new_full(294		config.transaction_pool.clone(),295		config.role.is_authority().into(),296		config.prometheus_registry(),297		task_manager.spawn_essential_handle(),298		client.clone(),299	);300301	let eth_filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));302303	let eth_backend = open_frontier_backend(client.clone(), config)?;304305	let import_queue = build_import_queue(306		client.clone(),307		backend.clone(),308		config,309		telemetry.as_ref().map(|telemetry| telemetry.handle()),310		&task_manager,311	)?;312313	let params = PartialComponents {314		backend,315		client,316		import_queue,317		keystore_container,318		task_manager,319		transaction_pool,320		select_chain,321		other: OtherPartial {322			telemetry,323			eth_filter_pool,324			eth_backend,325			telemetry_worker_handle,326		},327	};328329	Ok(params)330}331332macro_rules! clone {333    ($($i:ident),* $(,)?) => {334		$(335			let $i = $i.clone();336		)*337    };338}339340/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.341///342/// This is the actual implementation that is abstract over the executor and the runtime api.343#[sc_tracing::logging::prefix_logs_with("Parachain")]344pub async fn start_node<Runtime, RuntimeApi, ExecutorDispatch>(345	parachain_config: Configuration,346	polkadot_config: Configuration,347	collator_options: CollatorOptions,348	para_id: ParaId,349	hwbench: Option<sc_sysinfo::HwBench>,350) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>351where352	sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,353	Runtime: RuntimeInstance + Send + Sync + 'static,354	<Runtime as RuntimeInstance>::CrossAccountId: Serialize,355	for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,356	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>357		+ Send358		+ Sync359		+ 'static,360	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,361	Runtime: RuntimeInstance,362	ExecutorDispatch: NativeExecutionDispatch + 'static,363{364	let parachain_config = prepare_node_config(parachain_config);365366	let params = new_partial::<Runtime, RuntimeApi, ExecutorDispatch, _>(367		&parachain_config,368		parachain_build_import_queue,369	)?;370	let OtherPartial {371		mut telemetry,372		telemetry_worker_handle,373		eth_filter_pool,374		eth_backend,375	} = params.other;376	let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);377378	let client = params.client.clone();379	let backend = params.backend.clone();380	let mut task_manager = params.task_manager;381382	let (relay_chain_interface, collator_key) = build_relay_chain_interface(383		polkadot_config,384		&parachain_config,385		telemetry_worker_handle,386		&mut task_manager,387		collator_options.clone(),388		hwbench.clone(),389	)390	.await391	.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;392393	let block_announce_validator =394		RequireSecondedInBlockAnnounce::new(relay_chain_interface.clone(), para_id);395396	let validator = parachain_config.role.is_authority();397	let prometheus_registry = parachain_config.prometheus_registry().cloned();398	let transaction_pool = params.transaction_pool.clone();399	let import_queue_service = params.import_queue.service();400401	let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =402		sc_service::build_network(sc_service::BuildNetworkParams {403			config: &parachain_config,404			net_config,405			client: client.clone(),406			transaction_pool: transaction_pool.clone(),407			spawn_handle: task_manager.spawn_handle(),408			import_queue: params.import_queue,409			block_announce_validator_builder: Some(Box::new(|_| {410				Box::new(block_announce_validator)411			})),412			warp_sync_params: None,413		})?;414415	let select_chain = params.select_chain.clone();416417	let runtime_id = parachain_config.chain_spec.runtime_id();418419	// Frontier420	let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));421	let fee_history_limit = 2048;422423	let eth_pubsub_notification_sinks: Arc<424		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,425	> = Default::default();426427	let overrides = overrides_handle(client.clone());428	let eth_block_data_cache = spawn_frontier_tasks(429		FrontierTaskParams {430			client: client.clone(),431			substrate_backend: backend.clone(),432			eth_filter_pool: eth_filter_pool.clone(),433			eth_backend: eth_backend.clone(),434			fee_history_limit,435			fee_history_cache: fee_history_cache.clone(),436			task_manager: &task_manager,437			prometheus_registry: prometheus_registry.clone(),438			overrides: overrides.clone(),439			sync_strategy: SyncStrategy::Parachain,440		},441		sync_service.clone(),442		eth_pubsub_notification_sinks.clone(),443	);444445	// Rpc446	let rpc_builder = Box::new({447		clone!(448			client,449			backend,450			eth_backend,451			eth_pubsub_notification_sinks,452			fee_history_cache,453			eth_block_data_cache,454			overrides,455			transaction_pool,456			network,457			sync_service,458		);459		move |deny_unsafe, subscription_task_executor: SubscriptionTaskExecutor| {460			clone!(461				backend,462				eth_block_data_cache,463				client,464				eth_backend,465				eth_filter_pool,466				eth_pubsub_notification_sinks,467				fee_history_cache,468				eth_block_data_cache,469				network,470				runtime_id,471				transaction_pool,472				select_chain,473				overrides,474			);475476			#[cfg(not(feature = "pov-estimate"))]477			let _ = backend;478479			let mut rpc_handle = RpcModule::new(());480481			let full_deps = FullDeps {482				client: client.clone(),483				runtime_id,484485				#[cfg(feature = "pov-estimate")]486				exec_params: uc_rpc::pov_estimate::ExecutorParams {487					wasm_method: parachain_config.wasm_method,488					default_heap_pages: parachain_config.default_heap_pages,489					max_runtime_instances: parachain_config.max_runtime_instances,490					runtime_cache_size: parachain_config.runtime_cache_size,491				},492493				#[cfg(feature = "pov-estimate")]494				backend,495496				deny_unsafe,497				pool: transaction_pool.clone(),498				select_chain,499			};500501			create_full::<_, _, _, Runtime, _>(&mut rpc_handle, full_deps)?;502503			let eth_deps = EthDeps {504				client,505				graph: transaction_pool.pool().clone(),506				pool: transaction_pool,507				is_authority: validator,508				network,509				eth_backend,510				// TODO: Unhardcode511				max_past_logs: 10000,512				fee_history_limit,513				fee_history_cache,514				eth_block_data_cache,515				// TODO: Unhardcode516				enable_dev_signer: false,517				eth_filter_pool,518				eth_pubsub_notification_sinks,519				overrides,520				sync: sync_service.clone(),521				pending_create_inherent_data_providers: |_, ()| async move { Ok(()) },522			};523524			create_eth::<525				_,526				_,527				_,528				_,529				_,530				_,531				DefaultEthConfig<FullClient<RuntimeApi, ExecutorDispatch>>,532			>(533				&mut rpc_handle,534				eth_deps,535				subscription_task_executor.clone(),536			)?;537538			Ok(rpc_handle)539		}540	});541542	sc_service::spawn_tasks(sc_service::SpawnTasksParams {543		rpc_builder,544		client: client.clone(),545		transaction_pool: transaction_pool.clone(),546		task_manager: &mut task_manager,547		config: parachain_config,548		keystore: params.keystore_container.keystore(),549		backend: backend.clone(),550		network,551		sync_service: sync_service.clone(),552		system_rpc_tx,553		telemetry: telemetry.as_mut(),554		tx_handler_controller,555	})?;556557	if let Some(hwbench) = hwbench {558		sc_sysinfo::print_hwbench(&hwbench);559560		if let Some(ref mut telemetry) = telemetry {561			let telemetry_handle = telemetry.handle();562			task_manager.spawn_handle().spawn(563				"telemetry_hwbench",564				None,565				sc_sysinfo::initialize_hwbench_telemetry(telemetry_handle, hwbench),566			);567		}568	}569570	let announce_block = {571		let sync_service = sync_service.clone();572		Arc::new(Box::new(move |hash, data| {573			sync_service.announce_block(hash, data)574		}))575	};576577	let relay_chain_slot_duration = Duration::from_secs(6);578579	let overseer_handle = relay_chain_interface580		.overseer_handle()581		.map_err(|e| sc_service::Error::Application(Box::new(e)))?;582583	start_relay_chain_tasks(StartRelayChainTasksParams {584		client: client.clone(),585		announce_block: announce_block.clone(),586		para_id,587		relay_chain_interface: relay_chain_interface.clone(),588		task_manager: &mut task_manager,589		da_recovery_profile: if validator {590			DARecoveryProfile::Collator591		} else {592			DARecoveryProfile::FullNode593		},594		import_queue: import_queue_service,595		relay_chain_slot_duration,596		recovery_handle: Box::new(overseer_handle.clone()),597		sync_service: sync_service.clone(),598	})?;599600	if validator {601		start_consensus(602			client.clone(),603			transaction_pool,604			StartConsensusParameters {605				backend: backend.clone(),606				prometheus_registry: prometheus_registry.as_ref(),607				telemetry: telemetry.as_ref().map(|t| t.handle()),608				task_manager: &task_manager,609				relay_chain_interface: relay_chain_interface.clone(),610				sync_oracle: sync_service,611				keystore: params.keystore_container.keystore(),612				overseer_handle,613				relay_chain_slot_duration,614				para_id,615				collator_key: collator_key.expect("cli args do not allow this"),616				announce_block,617			},618		)?;619	}620621	start_network.start_network();622623	Ok((task_manager, client))624}625626/// Build the import queue for the the parachain runtime.627pub fn parachain_build_import_queue<Runtime, RuntimeApi, ExecutorDispatch>(628	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,629	backend: Arc<FullBackend>,630	config: &Configuration,631	telemetry: Option<TelemetryHandle>,632	task_manager: &TaskManager,633) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>634where635	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>636		+ Send637		+ Sync638		+ 'static,639	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,640	Runtime: RuntimeInstance,641	ExecutorDispatch: NativeExecutionDispatch + 'static,642{643	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;644645	let block_import = ParachainBlockImport::new(client.clone(), backend);646647	cumulus_client_consensus_aura::import_queue::<648		sp_consensus_aura::sr25519::AuthorityPair,649		_,650		_,651		_,652		_,653		_,654	>(cumulus_client_consensus_aura::ImportQueueParams {655		block_import,656		client,657		create_inherent_data_providers: move |_, _| async move {658			let time = sp_timestamp::InherentDataProvider::from_system_time();659660			let slot =661				sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(662					*time,663					slot_duration,664				);665666			Ok((slot, time))667		},668		registry: config.prometheus_registry(),669		spawner: &task_manager.spawn_essential_handle(),670		telemetry,671	})672	.map_err(Into::into)673}674675pub struct StartConsensusParameters<'a> {676	backend: Arc<FullBackend>,677	prometheus_registry: Option<&'a Registry>,678	telemetry: Option<TelemetryHandle>,679	task_manager: &'a TaskManager,680	relay_chain_interface: Arc<dyn RelayChainInterface>,681	sync_oracle: Arc<SyncingService<Block>>,682	keystore: KeystorePtr,683	overseer_handle: OverseerHandle,684	relay_chain_slot_duration: Duration,685	para_id: ParaId,686	collator_key: CollatorPair,687	announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,688}689690pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(691	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,692	transaction_pool: Arc<693		sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,694	>,695	parameters: StartConsensusParameters<'_>,696) -> Result<(), sc_service::Error>697where698	ExecutorDispatch: NativeExecutionDispatch + 'static,699	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>700		+ Send701		+ Sync702		+ 'static,703	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,704	Runtime: RuntimeInstance,705{706	let StartConsensusParameters {707		backend,708		prometheus_registry,709		telemetry,710		task_manager,711		relay_chain_interface,712		sync_oracle,713		keystore,714		overseer_handle,715		relay_chain_slot_duration,716		para_id,717		collator_key,718		announce_block,719	} = parameters;720	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;721722	let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(723		task_manager.spawn_handle(),724		client.clone(),725		transaction_pool,726		prometheus_registry,727		telemetry,728	);729	let proposer = Proposer::new(proposer_factory);730731	let collator_service = CollatorService::new(732		client.clone(),733		Arc::new(task_manager.spawn_handle()),734		announce_block,735		client.clone(),736	);737738	let block_import = ParachainBlockImport::new(client.clone(), backend);739740	let params = BuildAuraConsensusParams {741		create_inherent_data_providers: move |_, ()| async move { Ok(()) },742		block_import,743		para_client: client,744		#[cfg(feature = "lookahead")]745		para_backend: backend,746		para_id,747		relay_client: relay_chain_interface,748		sync_oracle,749		keystore,750		slot_duration,751		proposer,752		collator_service,753		// With async-baking, we allowed to be both slower (longer authoring) and faster (multiple para blocks per relay block)754		authoring_duration: Duration::from_millis(500),755		overseer_handle,756		#[cfg(feature = "lookahead")]757		code_hash_provider: || {},758		collator_key,759		relay_chain_slot_duration,760	};761762	task_manager.spawn_essential_handle().spawn(763		"aura",764		None,765		run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _>(params),766	);767	Ok(())768}769770fn dev_build_import_queue<RuntimeApi, ExecutorDispatch>(771	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,772	_: Arc<FullBackend>,773	config: &Configuration,774	_: Option<TelemetryHandle>,775	task_manager: &TaskManager,776) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>777where778	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>779		+ Send780		+ Sync781		+ 'static,782	RuntimeApi::RuntimeApi:783		sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> + sp_api::ApiExt<Block>,784	ExecutorDispatch: NativeExecutionDispatch + 'static,785{786	Ok(sc_consensus_manual_seal::import_queue(787		Box::new(client),788		&task_manager.spawn_essential_handle(),789		config.prometheus_registry(),790	))791}792793pub struct OtherPartial {794	pub telemetry: Option<Telemetry>,795	pub telemetry_worker_handle: Option<TelemetryWorkerHandle>,796	pub eth_filter_pool: Option<FilterPool>,797	pub eth_backend: Arc<fc_db::kv::Backend<Block>>,798}799800struct DefaultEthConfig<C>(PhantomData<C>);801impl<C> EthConfig<Block, C> for DefaultEthConfig<C>802where803	C: StorageProvider<Block, FullBackend> + Sync + Send + 'static,804{805	type EstimateGasAdapter = ();806	type RuntimeStorageOverride = SystemAccountId32StorageOverride<Block, C, FullBackend>;807}808809/// Builds a new development service. This service uses instant seal, and mocks810/// the parachain inherent811pub fn start_dev_node<Runtime, RuntimeApi, ExecutorDispatch>(812	config: Configuration,813	autoseal_interval: u64,814	autoseal_finalize_delay: Option<u64>,815	disable_autoseal_on_tx: bool,816) -> sc_service::error::Result<TaskManager>817where818	Runtime: RuntimeInstance + Send + Sync + 'static,819	<Runtime as RuntimeInstance>::CrossAccountId: Serialize,820	for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,821	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>822		+ Send823		+ Sync824		+ 'static,825	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,826	ExecutorDispatch: NativeExecutionDispatch + 'static,827{828	use fc_consensus::FrontierBlockImport;829	use sc_consensus_manual_seal::{830		run_delayed_finalize, run_manual_seal, DelayedFinalizeParams, EngineCommand,831		ManualSealParams,832	};833834	let sc_service::PartialComponents {835		client,836		backend,837		mut task_manager,838		import_queue,839		keystore_container,840		select_chain: maybe_select_chain,841		transaction_pool,842		other:843			OtherPartial {844				telemetry,845				eth_filter_pool,846				eth_backend,847				telemetry_worker_handle: _,848			},849	} = new_partial::<Runtime, RuntimeApi, ExecutorDispatch, _>(850		&config,851		dev_build_import_queue::<RuntimeApi, ExecutorDispatch>,852	)?;853	let net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);854	let prometheus_registry = config.prometheus_registry().cloned();855856	let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =857		sc_service::build_network(sc_service::BuildNetworkParams {858			config: &config,859			net_config,860			client: client.clone(),861			transaction_pool: transaction_pool.clone(),862			spawn_handle: task_manager.spawn_handle(),863			import_queue,864			block_announce_validator_builder: None,865			warp_sync_params: None,866		})?;867868	let collator = config.role.is_authority();869870	let select_chain = maybe_select_chain;871872	if collator {873		let block_import = FrontierBlockImport::new(client.clone(), client.clone());874875		let env = sc_basic_authorship::ProposerFactory::new(876			task_manager.spawn_handle(),877			client.clone(),878			transaction_pool.clone(),879			prometheus_registry.as_ref(),880			telemetry.as_ref().map(|x| x.handle()),881		);882883		let transactions_commands_stream: Box<884			dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,885		> = Box::new(886			transaction_pool887				.pool()888				.validated_pool()889				.import_notification_stream()890				.filter(move |_| futures::future::ready(!disable_autoseal_on_tx))891				.map(|_| EngineCommand::SealNewBlock {892					create_empty: true,893					finalize: false,894					parent_hash: None,895					sender: None,896				}),897		);898899		let autoseal_interval = Box::pin(AutosealInterval::new(&config, autoseal_interval));900901		let idle_commands_stream: Box<902			dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,903		> = Box::new(autoseal_interval.map(|_| EngineCommand::SealNewBlock {904			create_empty: true,905			finalize: false,906			parent_hash: None,907			sender: None,908		}));909910		let commands_stream = select(transactions_commands_stream, idle_commands_stream);911912		let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;913		let client_set_aside_for_cidp = client.clone();914915		if let Some(delay_sec) = autoseal_finalize_delay {916			let spawn_handle = task_manager.spawn_handle();917918			task_manager.spawn_essential_handle().spawn_blocking(919				"finalization_task",920				Some("block-authoring"),921				run_delayed_finalize(DelayedFinalizeParams {922					client: client.clone(),923					delay_sec,924					spawn_handle,925				}),926			);927		}928929		task_manager.spawn_essential_handle().spawn_blocking(930			"authorship_task",931			Some("block-authoring"),932			run_manual_seal(ManualSealParams {933				block_import,934				env,935				client: client.clone(),936				pool: transaction_pool.clone(),937				commands_stream,938				select_chain: select_chain.clone(),939				consensus_data_provider: None,940				create_inherent_data_providers: move |block: Hash, ()| {941					let current_para_block = client_set_aside_for_cidp942						.number(block)943						.expect("Header lookup should succeed")944						.expect("Header passed in as parent should be present in backend.");945946					let client_for_xcm = client_set_aside_for_cidp.clone();947					async move {948						let time = sp_timestamp::InherentDataProvider::from_system_time();949950						let mocked_parachain = cumulus_primitives_parachain_inherent::MockValidationDataInherentDataProvider {951							current_para_block,952							relay_offset: 1000,953							relay_blocks_per_para_block: 2,954							para_blocks_per_relay_epoch: 0,955							xcm_config: cumulus_primitives_parachain_inherent::MockXcmConfig::new(956								&*client_for_xcm,957								block,958								Default::default(),959								Default::default(),960							),961							relay_randomness_config: (),962							raw_downward_messages: vec![],963							raw_horizontal_messages: vec![],964						};965966						let slot =967						sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(968							*time,969							slot_duration,970						);971972						Ok((time, slot, mocked_parachain))973					}974				},975			}),976		);977	}978979	#[cfg(feature = "pov-estimate")]980	let rpc_backend = backend.clone();981982	let runtime_id = config.chain_spec.runtime_id();983984	// Frontier985	let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));986	let fee_history_limit = 2048;987988	let eth_pubsub_notification_sinks: Arc<989		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,990	> = Default::default();991992	let overrides = overrides_handle(client.clone());993	let eth_block_data_cache = spawn_frontier_tasks(994		FrontierTaskParams {995			client: client.clone(),996			substrate_backend: backend.clone(),997			eth_filter_pool: eth_filter_pool.clone(),998			eth_backend: eth_backend.clone(),999			fee_history_limit,1000			fee_history_cache: fee_history_cache.clone(),1001			task_manager: &task_manager,1002			prometheus_registry,1003			overrides: overrides.clone(),1004			sync_strategy: SyncStrategy::Normal,1005		},1006		sync_service.clone(),1007		eth_pubsub_notification_sinks.clone(),1008	);10091010	// Rpc1011	let rpc_builder = Box::new({1012		clone!(1013			client,1014			backend,1015			eth_backend,1016			eth_pubsub_notification_sinks,1017			fee_history_cache,1018			eth_block_data_cache,1019			overrides,1020			transaction_pool,1021			network,1022			sync_service,1023		);1024		move |deny_unsafe, subscription_task_executor: SubscriptionTaskExecutor| {1025			clone!(1026				backend,1027				eth_block_data_cache,1028				client,1029				eth_backend,1030				eth_filter_pool,1031				eth_pubsub_notification_sinks,1032				fee_history_cache,1033				eth_block_data_cache,1034				network,1035				runtime_id,1036				transaction_pool,1037				select_chain,1038				overrides,1039			);10401041			#[cfg(not(feature = "pov-estimate"))]1042			let _ = backend;10431044			let mut rpc_module = RpcModule::new(());10451046			let full_deps = FullDeps {1047				runtime_id,10481049				#[cfg(feature = "pov-estimate")]1050				exec_params: uc_rpc::pov_estimate::ExecutorParams {1051					wasm_method: config.wasm_method,1052					default_heap_pages: config.default_heap_pages,1053					max_runtime_instances: config.max_runtime_instances,1054					runtime_cache_size: config.runtime_cache_size,1055				},10561057				#[cfg(feature = "pov-estimate")]1058				backend,1059				// eth_backend,1060				deny_unsafe,1061				client: client.clone(),1062				pool: transaction_pool.clone(),1063				select_chain,1064			};10651066			create_full::<_, _, _, Runtime, _>(&mut rpc_module, full_deps)?;10671068			let eth_deps = EthDeps {1069				client,1070				graph: transaction_pool.pool().clone(),1071				pool: transaction_pool,1072				is_authority: true,1073				network,1074				eth_backend,1075				// TODO: Unhardcode1076				max_past_logs: 10000,1077				fee_history_limit,1078				fee_history_cache,1079				eth_block_data_cache,1080				// TODO: Unhardcode1081				enable_dev_signer: false,1082				eth_filter_pool,1083				eth_pubsub_notification_sinks,1084				overrides,1085				sync: sync_service.clone(),1086				// We don't have any inherents except parachain built-ins, which we can't even extract from inside `run_aura`.1087				pending_create_inherent_data_providers: |_, ()| async move { Ok(()) },1088			};10891090			create_eth::<1091				_,1092				_,1093				_,1094				_,1095				_,1096				_,1097				DefaultEthConfig<FullClient<RuntimeApi, ExecutorDispatch>>,1098			>(1099				&mut rpc_module,1100				eth_deps,1101				subscription_task_executor.clone(),1102			)?;11031104			Ok(rpc_module)1105		}1106	});11071108	sc_service::spawn_tasks(sc_service::SpawnTasksParams {1109		network,1110		sync_service,1111		client,1112		keystore: keystore_container.keystore(),1113		task_manager: &mut task_manager,1114		transaction_pool,1115		rpc_builder,1116		backend,1117		system_rpc_tx,1118		config,1119		telemetry: None,1120		tx_handler_controller,1121	})?;11221123	network_starter.start_network();1124	Ok(task_manager)1125}11261127fn overrides_handle<C, BE>(client: Arc<C>) -> Arc<OverrideHandle<Block>>1128where1129	C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,1130	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,1131	C: Send + Sync + 'static,1132	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,1133	BE: Backend<Block> + 'static,1134	BE::State: StateBackend<BlakeTwo256>,1135{1136	let mut overrides_map = BTreeMap::new();1137	overrides_map.insert(1138		EthereumStorageSchema::V1,1139		Box::new(SchemaV1Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1140	);1141	overrides_map.insert(1142		EthereumStorageSchema::V2,1143		Box::new(SchemaV2Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1144	);1145	overrides_map.insert(1146		EthereumStorageSchema::V3,1147		Box::new(SchemaV3Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1148	);11491150	Arc::new(OverrideHandle {1151		schemas: overrides_map,1152		fallback: Box::new(RuntimeApiStorageOverride::new(client)),1153	})1154}11551156pub struct FrontierTaskParams<'a, C, B> {1157	pub task_manager: &'a TaskManager,1158	pub client: Arc<C>,1159	pub substrate_backend: Arc<B>,1160	pub eth_backend: Arc<fc_db::kv::Backend<Block>>,1161	pub eth_filter_pool: Option<FilterPool>,1162	pub overrides: Arc<OverrideHandle<Block>>,1163	pub fee_history_limit: u64,1164	pub fee_history_cache: FeeHistoryCache,1165	pub sync_strategy: SyncStrategy,1166	pub prometheus_registry: Option<Registry>,1167}11681169pub fn spawn_frontier_tasks<C, B>(1170	params: FrontierTaskParams<C, B>,1171	sync: Arc<SyncingService<Block>>,1172	pubsub_notification_sinks: Arc<1173		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,1174	>,1175) -> Arc<EthBlockDataCacheTask<Block>>1176where1177	C: ProvideRuntimeApi<Block> + BlockOf,1178	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,1179	C: BlockchainEvents<Block> + StorageProvider<Block, B>,1180	C: Send + Sync + 'static,1181	C::Api: EthereumRuntimeRPCApi<Block>,1182	C::Api: BlockBuilder<Block>,1183	B: Backend<Block> + 'static,1184	B::State: StateBackend<BlakeTwo256>,1185{1186	let FrontierTaskParams {1187		task_manager,1188		client,1189		substrate_backend,1190		eth_backend,1191		eth_filter_pool,1192		overrides,1193		fee_history_limit,1194		fee_history_cache,1195		sync_strategy,1196		prometheus_registry,1197	} = params;1198	// Frontier offchain DB task. Essential.1199	// Maps emulated ethereum data to substrate native data.1200	params.task_manager.spawn_essential_handle().spawn(1201		"frontier-mapping-sync-worker",1202		Some("frontier"),1203		MappingSyncWorker::new(1204			client.import_notification_stream(),1205			Duration::new(6, 0),1206			client.clone(),1207			substrate_backend,1208			overrides.clone(),1209			eth_backend,1210			3,1211			0,1212			sync_strategy,1213			sync,1214			pubsub_notification_sinks,1215		)1216		.for_each(|()| futures::future::ready(())),1217	);12181219	// Frontier `EthFilterApi` maintenance.1220	// Manages the pool of user-created Filters.1221	if let Some(eth_filter_pool) = eth_filter_pool {1222		// Each filter is allowed to stay in the pool for 100 blocks.1223		const FILTER_RETAIN_THRESHOLD: u64 = 100;1224		params.task_manager.spawn_essential_handle().spawn(1225			"frontier-filter-pool",1226			Some("frontier"),1227			EthTask::filter_pool_task(client.clone(), eth_filter_pool, FILTER_RETAIN_THRESHOLD),1228		);1229	}12301231	// Spawn Frontier FeeHistory cache maintenance task.1232	params.task_manager.spawn_essential_handle().spawn(1233		"frontier-fee-history",1234		Some("frontier"),1235		EthTask::fee_history_task(1236			client,1237			overrides.clone(),1238			fee_history_cache,1239			fee_history_limit,1240		),1241	);12421243	Arc::new(EthBlockDataCacheTask::new(1244		task_manager.spawn_handle(),1245		overrides,1246		50,1247		50,1248		prometheus_registry,1249	))1250}
modifiedpallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -16,15 +16,24 @@
 
 #![cfg(feature = "runtime-benchmarks")]
 
-use frame_benchmarking::{account, benchmarks};
-use frame_support::traits::{fungible::Unbalanced, OnInitialize};
-use frame_system::RawOrigin;
+use frame_benchmarking::v2::*;
+use frame_support::traits::{
+	fungible::{Inspect, Mutate, Unbalanced},
+	OnInitialize,
+};
+use frame_system::{pallet_prelude::*, RawOrigin};
+use pallet_evm::account::CrossAccountId;
 use pallet_evm_migration::Pallet as EvmMigrationPallet;
 use pallet_unique::benchmarking::create_nft_collection;
-use sp_runtime::traits::Bounded;
+use sp_core::{Get, H160};
+use sp_runtime::{
+	traits::{BlockNumberProvider, Bounded},
+	Perbill,
+};
+use sp_std::{iter::Sum, vec, vec::Vec};
 
-use super::*;
-use crate::Pallet as PromototionPallet;
+use super::{BalanceOf, Call, Config, Pallet, Staked, PENDING_LIMIT_PER_BLOCK};
+use crate::{pallet, Pallet as PromototionPallet};
 
 const SEED: u32 = 0;
 
@@ -49,55 +58,98 @@
 	Ok(pallet_admin)
 }
 
-benchmarks! {
-	where_clause{
-		where T:  Config + pallet_unique::Config + pallet_evm_migration::Config ,
+#[benchmarks(
+	where T:  Config + pallet_unique::Config + pallet_evm_migration::Config ,
 		BlockNumberFor<T>: From<u32> + Into<u32>,
 		BalanceOf<T>: Sum + From<u128>
-	}
+)]
+mod benchmarks {
+	use super::*;
 
-	on_initialize {
-		let b in 0..PENDING_LIMIT_PER_BLOCK;
+	#[benchmark]
+	fn on_initialize(b: Linear<0, PENDING_LIMIT_PER_BLOCK>) -> Result<(), BenchmarkError> {
 		set_admin::<T>()?;
 
 		(0..b).try_for_each(|index| {
 			let staker = account::<T::AccountId>("staker", index, SEED);
-			<T as Config>::Currency::write_balance(&staker,  Into::<BalanceOf<T>>::into(10_000u128) * T::Nominal::get())?;
-			PromototionPallet::<T>::stake(RawOrigin::Signed(staker.clone()).into(), Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get())?;
+			<T as Config>::Currency::write_balance(
+				&staker,
+				Into::<BalanceOf<T>>::into(10_000u128) * T::Nominal::get(),
+			)?;
+			PromototionPallet::<T>::stake(
+				RawOrigin::Signed(staker.clone()).into(),
+				Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get(),
+			)?;
 			PromototionPallet::<T>::unstake_all(RawOrigin::Signed(staker).into())?;
 			Result::<(), sp_runtime::DispatchError>::Ok(())
 		})?;
-		let block_number = <frame_system::Pallet<T>>::current_block_number() + T::PendingInterval::get();
-	}: {PromototionPallet::<T>::on_initialize(block_number)}
+		let block_number =
+			<frame_system::Pallet<T>>::current_block_number() + T::PendingInterval::get();
+
+		#[block]
+		{
+			PromototionPallet::<T>::on_initialize(block_number);
+		}
+
+		Ok(())
+	}
 
-	set_admin_address {
+	#[benchmark]
+	fn set_admin_address() -> Result<(), BenchmarkError> {
 		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
-		let _ = <T as Config>::Currency::set_balance(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
-	} : _(RawOrigin::Root, T::CrossAccountId::from_sub(pallet_admin))
+		let _ = <T as Config>::Currency::set_balance(
+			&pallet_admin,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
+
+		#[extrinsic_call]
+		_(RawOrigin::Root, T::CrossAccountId::from_sub(pallet_admin));
 
-	payout_stakers{
-		let b in 1..100;
+		Ok(())
+	}
 
+	#[benchmark]
+	fn payout_stakers(b: Linear<1, 100>) -> Result<(), BenchmarkError> {
 		let pallet_admin = account::<T::AccountId>("admin", 1, SEED);
-		let share = Perbill::from_rational(1u32, 20);
-		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;
-		<T as Config>::Currency::write_balance(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value())?;
-		<T as Config>::Currency::write_balance(&<T as pallet::Config>::TreasuryAccountId::get(),  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value())?;
+		PromototionPallet::<T>::set_admin_address(
+			RawOrigin::Root.into(),
+			T::CrossAccountId::from_sub(pallet_admin.clone()),
+		)?;
+		<T as Config>::Currency::write_balance(
+			&pallet_admin,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		)?;
+		<T as Config>::Currency::write_balance(
+			&<T as pallet::Config>::TreasuryAccountId::get(),
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		)?;
 
-		let stakers: Vec<T::AccountId> = (0..b).map(|index| account("staker", index, SEED)).collect();
+		let stakers: Vec<T::AccountId> =
+			(0..b).map(|index| account("staker", index, SEED)).collect();
 		stakers.iter().try_for_each(|staker| {
-			<T as Config>::Currency::write_balance(staker,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value())?;
+			<T as Config>::Currency::write_balance(
+				staker,
+				Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+			)?;
 			Result::<(), sp_runtime::DispatchError>::Ok(())
 		})?;
 		(1..11).try_for_each(|i| {
 			<frame_system::Pallet<T>>::set_block_number(i.into());
-			T::RelayBlockNumberProvider::set_block_number((2*i).into());
+			T::RelayBlockNumberProvider::set_block_number((2 * i).into());
 			assert_eq!(<frame_system::Pallet<T>>::block_number(), i.into());
-			assert_eq!(T::RelayBlockNumberProvider::current_block_number(), (2*i).into());
-			stakers.iter()
-			.map(|staker| {
-				PromototionPallet::<T>::stake(RawOrigin::Signed(staker.clone()).into(), Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get())
-			}).collect::<Result<Vec<_>, _>>()?;
+			assert_eq!(
+				T::RelayBlockNumberProvider::current_block_number(),
+				(2 * i).into()
+			);
+			stakers
+				.iter()
+				.map(|staker| {
+					PromototionPallet::<T>::stake(
+						RawOrigin::Signed(staker.clone()).into(),
+						Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get(),
+					)
+				})
+				.collect::<Result<Vec<_>, _>>()?;
 
 			Result::<(), sp_runtime::DispatchError>::Ok(())
 		})?;
@@ -107,83 +159,195 @@
 
 		<frame_system::Pallet<T>>::set_block_number(15_000.into());
 		T::RelayBlockNumberProvider::set_block_number(30_000.into());
-	} : _(RawOrigin::Signed(pallet_admin.clone()), Some(b as u8))
 
-	stake {
+		#[extrinsic_call]
+		_(RawOrigin::Signed(pallet_admin), Some(b as u8));
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn stake() -> Result<(), BenchmarkError> {
 		let caller = account::<T::AccountId>("caller", 0, SEED);
 		let share = Perbill::from_rational(1u32, 10);
-		let _ = <T as Config>::Currency::write_balance(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
-	} : _(RawOrigin::Signed(caller.clone()), share * <T as Config>::Currency::total_balance(&caller))
 
-	unstake_all {
+		let _ = <T as Config>::Currency::write_balance(
+			&caller,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			share * <T as Config>::Currency::total_balance(&caller),
+		);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn unstake_all() -> Result<(), BenchmarkError> {
 		let caller = account::<T::AccountId>("caller", 0, SEED);
 		let share = Perbill::from_rational(1u32, 20);
-		let _ = <T as Config>::Currency::write_balance(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
-		(1..11).map(|i| {
-			// used to change block number
-			<frame_system::Pallet<T>>::set_block_number(i.into());
-			T::RelayBlockNumberProvider::set_block_number((2*i).into());
-			assert_eq!(<frame_system::Pallet<T>>::block_number(), i.into());
-			assert_eq!(T::RelayBlockNumberProvider::current_block_number(), (2*i).into());
-			PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))
-		}).collect::<Result<Vec<_>, _>>()?;
+		let _ = <T as Config>::Currency::write_balance(
+			&caller,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
+		(1..11)
+			.map(|i| {
+				// used to change block number
+				<frame_system::Pallet<T>>::set_block_number(i.into());
+				T::RelayBlockNumberProvider::set_block_number((2 * i).into());
+				assert_eq!(<frame_system::Pallet<T>>::block_number(), i.into());
+				assert_eq!(
+					T::RelayBlockNumberProvider::current_block_number(),
+					(2 * i).into()
+				);
+				PromototionPallet::<T>::stake(
+					RawOrigin::Signed(caller.clone()).into(),
+					share * <T as Config>::Currency::total_balance(&caller),
+				)
+			})
+			.collect::<Result<Vec<_>, _>>()?;
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller));
 
-	} : _(RawOrigin::Signed(caller.clone()))
+		Ok(())
+	}
 
-	unstake_partial {
+	#[benchmark]
+	fn unstake_partial() -> Result<(), BenchmarkError> {
 		let caller = account::<T::AccountId>("caller", 0, SEED);
-		let share = Perbill::from_rational(1u32, 20);
-		let _ = <T as Config>::Currency::write_balance(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
-		(1..11).map(|i| {
-			// used to change block number
-			<frame_system::Pallet<T>>::set_block_number(i.into());
-			T::RelayBlockNumberProvider::set_block_number((2*i).into());
-			assert_eq!(<frame_system::Pallet<T>>::block_number(), i.into());
-			assert_eq!(T::RelayBlockNumberProvider::current_block_number(), (2*i).into());
-			PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get())
-		}).collect::<Result<Vec<_>, _>>()?;
+		let _ = <T as Config>::Currency::write_balance(
+			&caller,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
+		(1..11)
+			.map(|i| {
+				// used to change block number
+				<frame_system::Pallet<T>>::set_block_number(i.into());
+				T::RelayBlockNumberProvider::set_block_number((2 * i).into());
+				assert_eq!(<frame_system::Pallet<T>>::block_number(), i.into());
+				assert_eq!(
+					T::RelayBlockNumberProvider::current_block_number(),
+					(2 * i).into()
+				);
+				PromototionPallet::<T>::stake(
+					RawOrigin::Signed(caller.clone()).into(),
+					Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get(),
+				)
+			})
+			.collect::<Result<Vec<_>, _>>()?;
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			Into::<BalanceOf<T>>::into(1000u128) * T::Nominal::get(),
+		);
 
-	} : _(RawOrigin::Signed(caller.clone()), Into::<BalanceOf<T>>::into(1000u128) * T::Nominal::get())
+		Ok(())
+	}
 
-	sponsor_collection {
+	#[benchmark]
+	fn sponsor_collection() -> Result<(), BenchmarkError> {
 		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
-		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;
-		let _ = <T as Config>::Currency::write_balance(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+		PromototionPallet::<T>::set_admin_address(
+			RawOrigin::Root.into(),
+			T::CrossAccountId::from_sub(pallet_admin.clone()),
+		)?;
+		let _ = <T as Config>::Currency::write_balance(
+			&pallet_admin,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
 		let caller: T::AccountId = account("caller", 0, SEED);
-		let _ = <T as Config>::Currency::write_balance(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+		let _ = <T as Config>::Currency::write_balance(
+			&caller,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
 		let collection = create_nft_collection::<T>(caller)?;
-	} : _(RawOrigin::Signed(pallet_admin.clone()), collection)
 
-	stop_sponsoring_collection {
+		#[extrinsic_call]
+		_(RawOrigin::Signed(pallet_admin), collection);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn stop_sponsoring_collection() -> Result<(), BenchmarkError> {
 		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
-		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;
-		let _ = <T as Config>::Currency::write_balance(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+		PromototionPallet::<T>::set_admin_address(
+			RawOrigin::Root.into(),
+			T::CrossAccountId::from_sub(pallet_admin.clone()),
+		)?;
+		let _ = <T as Config>::Currency::write_balance(
+			&pallet_admin,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
 		let caller: T::AccountId = account("caller", 0, SEED);
-		let _ = <T as Config>::Currency::write_balance(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+		let _ = <T as Config>::Currency::write_balance(
+			&caller,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
 		let collection = create_nft_collection::<T>(caller)?;
-		PromototionPallet::<T>::sponsor_collection(RawOrigin::Signed(pallet_admin.clone()).into(), collection)?;
-	} : _(RawOrigin::Signed(pallet_admin.clone()), collection)
+		PromototionPallet::<T>::sponsor_collection(
+			RawOrigin::Signed(pallet_admin.clone()).into(),
+			collection,
+		)?;
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(pallet_admin), collection);
+
+		Ok(())
+	}
 
-	sponsor_contract {
+	#[benchmark]
+	fn sponsor_contract() -> Result<(), BenchmarkError> {
 		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
-		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;
+		PromototionPallet::<T>::set_admin_address(
+			RawOrigin::Root.into(),
+			T::CrossAccountId::from_sub(pallet_admin.clone()),
+		)?;
 
-		let _ = <T as Config>::Currency::write_balance(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+		let _ = <T as Config>::Currency::write_balance(
+			&pallet_admin,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
 		let address = H160::from_low_u64_be(SEED as u64);
 		let data: Vec<u8> = (0..20).collect();
 		<EvmMigrationPallet<T>>::begin(RawOrigin::Root.into(), address)?;
 		<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;
-	} : _(RawOrigin::Signed(pallet_admin.clone()), address)
 
-	stop_sponsoring_contract {
+		#[extrinsic_call]
+		_(RawOrigin::Signed(pallet_admin), address);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn stop_sponsoring_contract() -> Result<(), BenchmarkError> {
 		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
-		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;
+		PromototionPallet::<T>::set_admin_address(
+			RawOrigin::Root.into(),
+			T::CrossAccountId::from_sub(pallet_admin.clone()),
+		)?;
 
-		let _ = <T as Config>::Currency::write_balance(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+		let _ = <T as Config>::Currency::write_balance(
+			&pallet_admin,
+			Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value(),
+		);
 		let address = H160::from_low_u64_be(SEED as u64);
 		let data: Vec<u8> = (0..20).collect();
 		<EvmMigrationPallet<T>>::begin(RawOrigin::Root.into(), address)?;
 		<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;
-		PromototionPallet::<T>::sponsor_contract(RawOrigin::Signed(pallet_admin.clone()).into(), address)?;
-	} : _(RawOrigin::Signed(pallet_admin.clone()), address)
+		PromototionPallet::<T>::sponsor_contract(
+			RawOrigin::Signed(pallet_admin.clone()).into(),
+			address,
+		)?;
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(pallet_admin), address);
+
+		Ok(())
+	}
 }
modifiedpallets/app-promotion/src/weights.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/weights.rs
+++ b/pallets/app-promotion/src/weights.rs
@@ -3,10 +3,10 @@
 //! Autogenerated weights for pallet_app_promotion
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-10-12, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+//! HOSTNAME: `ubuntu-11`, CPU: `QEMU Virtual CPU version 2.5+`
+//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
 
 // Executed Command:
 // target/production/unique-collator
@@ -20,7 +20,7 @@
 // *
 // --template=.maintain/frame-weight-template.hbs
 // --steps=50
-// --repeat=400
+// --repeat=80
 // --heap-pages=4096
 // --output=./pallets/app-promotion/src/weights.rs
 
@@ -48,185 +48,185 @@
 /// Weights for pallet_app_promotion using the Substrate node and recommended hardware.
 pub struct SubstrateWeight<T>(PhantomData<T>);
 impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
-	/// Storage: Maintenance Enabled (r:1 w:0)
-	/// Proof: Maintenance Enabled (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
-	/// Storage: AppPromotion PendingUnstake (r:1 w:1)
-	/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
-	/// Storage: Balances Freezes (r:3 w:3)
-	/// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
-	/// Storage: System Account (r:3 w:3)
-	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
-	/// Storage: Balances Locks (r:3 w:0)
-	/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
+	/// Storage: `Maintenance::Enabled` (r:1 w:0)
+	/// Proof: `Maintenance::Enabled` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::PendingUnstake` (r:1 w:1)
+	/// Proof: `AppPromotion::PendingUnstake` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Freezes` (r:3 w:3)
+	/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(369), added: 2844, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:3 w:3)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Locks` (r:3 w:0)
+	/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 3]`.
 	fn on_initialize(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `222 + b * (285 ±0)`
 		//  Estimated: `3622 + b * (3774 ±0)`
-		// Minimum execution time: 4_107_000 picoseconds.
-		Weight::from_parts(4_751_973, 3622)
-			// Standard Error: 4_668
-			.saturating_add(Weight::from_parts(10_570_330, 0).saturating_mul(b.into()))
+		// Minimum execution time: 6_031_000 picoseconds.
+		Weight::from_parts(6_880_848, 3622)
+			// Standard Error: 18_753
+			.saturating_add(Weight::from_parts(22_907_186, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into())))
 			.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 3774).saturating_mul(b.into()))
 	}
-	/// Storage: AppPromotion Admin (r:0 w:1)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:0 w:1)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
 	fn set_admin_address() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 3_459_000 picoseconds.
-		Weight::from_parts(3_627_000, 0)
+		// Minimum execution time: 7_565_000 picoseconds.
+		Weight::from_parts(7_795_000, 0)
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: ParachainSystem ValidationData (r:1 w:0)
-	/// Proof Skipped: ParachainSystem ValidationData (max_values: Some(1), max_size: None, mode: Measured)
-	/// Storage: AppPromotion PreviousCalculatedRecord (r:1 w:1)
-	/// Proof: AppPromotion PreviousCalculatedRecord (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen)
-	/// Storage: AppPromotion Staked (r:1001 w:1000)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: System Account (r:101 w:101)
-	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
-	/// Storage: Balances Freezes (r:100 w:100)
-	/// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
-	/// Storage: Balances Locks (r:100 w:0)
-	/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `ParachainSystem::ValidationData` (r:1 w:0)
+	/// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+	/// Storage: `AppPromotion::PreviousCalculatedRecord` (r:1 w:1)
+	/// Proof: `AppPromotion::PreviousCalculatedRecord` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::Staked` (r:1001 w:1000)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:101 w:101)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Freezes` (r:100 w:100)
+	/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(369), added: 2844, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Locks` (r:100 w:0)
+	/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[1, 100]`.
 	fn payout_stakers(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `564 + b * (641 ±0)`
 		//  Estimated: `3593 + b * (25550 ±0)`
-		// Minimum execution time: 73_245_000 picoseconds.
-		Weight::from_parts(74_196_000, 3593)
-			// Standard Error: 8_231
-			.saturating_add(Weight::from_parts(49_090_053, 0).saturating_mul(b.into()))
+		// Minimum execution time: 146_577_000 picoseconds.
+		Weight::from_parts(147_970_000, 3593)
+			// Standard Error: 59_065
+			.saturating_add(Weight::from_parts(115_527_092, 0).saturating_mul(b.into()))
 			.saturating_add(T::DbWeight::get().reads(7_u64))
 			.saturating_add(T::DbWeight::get().reads((13_u64).saturating_mul(b.into())))
 			.saturating_add(T::DbWeight::get().writes(3_u64))
 			.saturating_add(T::DbWeight::get().writes((12_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 25550).saturating_mul(b.into()))
 	}
-	/// Storage: AppPromotion StakesPerAccount (r:1 w:1)
-	/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: System Account (r:1 w:1)
-	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
-	/// Storage: Balances Freezes (r:1 w:1)
-	/// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
-	/// Storage: Balances Locks (r:1 w:0)
-	/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
-	/// Storage: ParachainSystem ValidationData (r:1 w:0)
-	/// Proof Skipped: ParachainSystem ValidationData (max_values: Some(1), max_size: None, mode: Measured)
-	/// Storage: AppPromotion Staked (r:1 w:1)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::StakesPerAccount` (r:1 w:1)
+	/// Proof: `AppPromotion::StakesPerAccount` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:1 w:1)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Freezes` (r:1 w:1)
+	/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(369), added: 2844, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Locks` (r:1 w:0)
+	/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
+	/// Storage: `ParachainSystem::ValidationData` (r:1 w:0)
+	/// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+	/// Storage: `AppPromotion::Staked` (r:1 w:1)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
 	fn stake() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `389`
 		//  Estimated: `4764`
-		// Minimum execution time: 21_088_000 picoseconds.
-		Weight::from_parts(21_639_000, 4764)
+		// Minimum execution time: 46_889_000 picoseconds.
+		Weight::from_parts(47_549_000, 4764)
 			.saturating_add(T::DbWeight::get().reads(8_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
 	}
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: AppPromotion PendingUnstake (r:1 w:1)
-	/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
-	/// Storage: AppPromotion Staked (r:11 w:10)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
-	/// Storage: AppPromotion StakesPerAccount (r:0 w:1)
-	/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::PendingUnstake` (r:1 w:1)
+	/// Proof: `AppPromotion::PendingUnstake` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::Staked` (r:11 w:10)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::StakesPerAccount` (r:0 w:1)
+	/// Proof: `AppPromotion::StakesPerAccount` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
 	fn unstake_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `829`
 		//  Estimated: `29095`
-		// Minimum execution time: 42_086_000 picoseconds.
-		Weight::from_parts(43_149_000, 29095)
+		// Minimum execution time: 63_069_000 picoseconds.
+		Weight::from_parts(64_522_000, 29095)
 			.saturating_add(T::DbWeight::get().reads(14_u64))
 			.saturating_add(T::DbWeight::get().writes(13_u64))
 	}
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: AppPromotion PendingUnstake (r:1 w:1)
-	/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
-	/// Storage: AppPromotion Staked (r:11 w:10)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
-	/// Storage: AppPromotion StakesPerAccount (r:1 w:1)
-	/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::PendingUnstake` (r:1 w:1)
+	/// Proof: `AppPromotion::PendingUnstake` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::Staked` (r:11 w:10)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::StakesPerAccount` (r:1 w:1)
+	/// Proof: `AppPromotion::StakesPerAccount` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
 	fn unstake_partial() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `829`
 		//  Estimated: `29095`
-		// Minimum execution time: 46_458_000 picoseconds.
-		Weight::from_parts(47_333_000, 29095)
+		// Minimum execution time: 84_649_000 picoseconds.
+		Weight::from_parts(86_173_000, 29095)
 			.saturating_add(T::DbWeight::get().reads(15_u64))
 			.saturating_add(T::DbWeight::get().writes(13_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: Common CollectionById (r:1 w:1)
-	/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `Common::CollectionById` (r:1 w:1)
+	/// Proof: `Common::CollectionById` (`max_values`: None, `max_size`: Some(860), added: 3335, mode: `MaxEncodedLen`)
 	fn sponsor_collection() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `1060`
 		//  Estimated: `4325`
-		// Minimum execution time: 12_827_000 picoseconds.
-		Weight::from_parts(13_610_000, 4325)
+		// Minimum execution time: 24_396_000 picoseconds.
+		Weight::from_parts(24_917_000, 4325)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: Common CollectionById (r:1 w:1)
-	/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `Common::CollectionById` (r:1 w:1)
+	/// Proof: `Common::CollectionById` (`max_values`: None, `max_size`: Some(860), added: 3335, mode: `MaxEncodedLen`)
 	fn stop_sponsoring_collection() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `1092`
 		//  Estimated: `4325`
-		// Minimum execution time: 11_899_000 picoseconds.
-		Weight::from_parts(12_303_000, 4325)
+		// Minimum execution time: 22_412_000 picoseconds.
+		Weight::from_parts(23_033_000, 4325)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: EvmContractHelpers Sponsoring (r:0 w:1)
-	/// Proof: EvmContractHelpers Sponsoring (max_values: None, max_size: Some(62), added: 2537, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `EvmContractHelpers::Sponsoring` (r:0 w:1)
+	/// Proof: `EvmContractHelpers::Sponsoring` (`max_values`: None, `max_size`: Some(62), added: 2537, mode: `MaxEncodedLen`)
 	fn sponsor_contract() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `198`
 		//  Estimated: `1517`
-		// Minimum execution time: 10_226_000 picoseconds.
-		Weight::from_parts(10_549_000, 1517)
+		// Minimum execution time: 21_621_000 picoseconds.
+		Weight::from_parts(22_041_000, 1517)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: EvmContractHelpers Sponsoring (r:1 w:1)
-	/// Proof: EvmContractHelpers Sponsoring (max_values: None, max_size: Some(62), added: 2537, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `EvmContractHelpers::Sponsoring` (r:1 w:1)
+	/// Proof: `EvmContractHelpers::Sponsoring` (`max_values`: None, `max_size`: Some(62), added: 2537, mode: `MaxEncodedLen`)
 	fn stop_sponsoring_contract() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `396`
 		//  Estimated: `3527`
-		// Minimum execution time: 10_528_000 picoseconds.
-		Weight::from_parts(10_842_000, 3527)
+		// Minimum execution time: 19_186_000 picoseconds.
+		Weight::from_parts(19_616_000, 3527)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -234,185 +234,185 @@
 
 // For backwards compatibility and tests
 impl WeightInfo for () {
-	/// Storage: Maintenance Enabled (r:1 w:0)
-	/// Proof: Maintenance Enabled (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
-	/// Storage: AppPromotion PendingUnstake (r:1 w:1)
-	/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
-	/// Storage: Balances Freezes (r:3 w:3)
-	/// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
-	/// Storage: System Account (r:3 w:3)
-	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
-	/// Storage: Balances Locks (r:3 w:0)
-	/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
+	/// Storage: `Maintenance::Enabled` (r:1 w:0)
+	/// Proof: `Maintenance::Enabled` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::PendingUnstake` (r:1 w:1)
+	/// Proof: `AppPromotion::PendingUnstake` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Freezes` (r:3 w:3)
+	/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(369), added: 2844, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:3 w:3)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Locks` (r:3 w:0)
+	/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[0, 3]`.
 	fn on_initialize(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `222 + b * (285 ±0)`
 		//  Estimated: `3622 + b * (3774 ±0)`
-		// Minimum execution time: 4_107_000 picoseconds.
-		Weight::from_parts(4_751_973, 3622)
-			// Standard Error: 4_668
-			.saturating_add(Weight::from_parts(10_570_330, 0).saturating_mul(b.into()))
+		// Minimum execution time: 6_031_000 picoseconds.
+		Weight::from_parts(6_880_848, 3622)
+			// Standard Error: 18_753
+			.saturating_add(Weight::from_parts(22_907_186, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(b.into())))
 			.saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 3774).saturating_mul(b.into()))
 	}
-	/// Storage: AppPromotion Admin (r:0 w:1)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:0 w:1)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
 	fn set_admin_address() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 3_459_000 picoseconds.
-		Weight::from_parts(3_627_000, 0)
+		// Minimum execution time: 7_565_000 picoseconds.
+		Weight::from_parts(7_795_000, 0)
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: ParachainSystem ValidationData (r:1 w:0)
-	/// Proof Skipped: ParachainSystem ValidationData (max_values: Some(1), max_size: None, mode: Measured)
-	/// Storage: AppPromotion PreviousCalculatedRecord (r:1 w:1)
-	/// Proof: AppPromotion PreviousCalculatedRecord (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen)
-	/// Storage: AppPromotion Staked (r:1001 w:1000)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: System Account (r:101 w:101)
-	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
-	/// Storage: Balances Freezes (r:100 w:100)
-	/// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
-	/// Storage: Balances Locks (r:100 w:0)
-	/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `ParachainSystem::ValidationData` (r:1 w:0)
+	/// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+	/// Storage: `AppPromotion::PreviousCalculatedRecord` (r:1 w:1)
+	/// Proof: `AppPromotion::PreviousCalculatedRecord` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::Staked` (r:1001 w:1000)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:101 w:101)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Freezes` (r:100 w:100)
+	/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(369), added: 2844, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Locks` (r:100 w:0)
+	/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
 	/// The range of component `b` is `[1, 100]`.
 	fn payout_stakers(b: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `564 + b * (641 ±0)`
 		//  Estimated: `3593 + b * (25550 ±0)`
-		// Minimum execution time: 73_245_000 picoseconds.
-		Weight::from_parts(74_196_000, 3593)
-			// Standard Error: 8_231
-			.saturating_add(Weight::from_parts(49_090_053, 0).saturating_mul(b.into()))
+		// Minimum execution time: 146_577_000 picoseconds.
+		Weight::from_parts(147_970_000, 3593)
+			// Standard Error: 59_065
+			.saturating_add(Weight::from_parts(115_527_092, 0).saturating_mul(b.into()))
 			.saturating_add(RocksDbWeight::get().reads(7_u64))
 			.saturating_add(RocksDbWeight::get().reads((13_u64).saturating_mul(b.into())))
 			.saturating_add(RocksDbWeight::get().writes(3_u64))
 			.saturating_add(RocksDbWeight::get().writes((12_u64).saturating_mul(b.into())))
 			.saturating_add(Weight::from_parts(0, 25550).saturating_mul(b.into()))
 	}
-	/// Storage: AppPromotion StakesPerAccount (r:1 w:1)
-	/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: System Account (r:1 w:1)
-	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
-	/// Storage: Balances Freezes (r:1 w:1)
-	/// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
-	/// Storage: Balances Locks (r:1 w:0)
-	/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
-	/// Storage: ParachainSystem ValidationData (r:1 w:0)
-	/// Proof Skipped: ParachainSystem ValidationData (max_values: Some(1), max_size: None, mode: Measured)
-	/// Storage: AppPromotion Staked (r:1 w:1)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::StakesPerAccount` (r:1 w:1)
+	/// Proof: `AppPromotion::StakesPerAccount` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:1 w:1)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Freezes` (r:1 w:1)
+	/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(369), added: 2844, mode: `MaxEncodedLen`)
+	/// Storage: `Balances::Locks` (r:1 w:0)
+	/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
+	/// Storage: `ParachainSystem::ValidationData` (r:1 w:0)
+	/// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+	/// Storage: `AppPromotion::Staked` (r:1 w:1)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
 	fn stake() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `389`
 		//  Estimated: `4764`
-		// Minimum execution time: 21_088_000 picoseconds.
-		Weight::from_parts(21_639_000, 4764)
+		// Minimum execution time: 46_889_000 picoseconds.
+		Weight::from_parts(47_549_000, 4764)
 			.saturating_add(RocksDbWeight::get().reads(8_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: AppPromotion PendingUnstake (r:1 w:1)
-	/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
-	/// Storage: AppPromotion Staked (r:11 w:10)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
-	/// Storage: AppPromotion StakesPerAccount (r:0 w:1)
-	/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::PendingUnstake` (r:1 w:1)
+	/// Proof: `AppPromotion::PendingUnstake` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::Staked` (r:11 w:10)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::StakesPerAccount` (r:0 w:1)
+	/// Proof: `AppPromotion::StakesPerAccount` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
 	fn unstake_all() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `829`
 		//  Estimated: `29095`
-		// Minimum execution time: 42_086_000 picoseconds.
-		Weight::from_parts(43_149_000, 29095)
+		// Minimum execution time: 63_069_000 picoseconds.
+		Weight::from_parts(64_522_000, 29095)
 			.saturating_add(RocksDbWeight::get().reads(14_u64))
 			.saturating_add(RocksDbWeight::get().writes(13_u64))
 	}
-	/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
-	/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
-	/// Storage: AppPromotion PendingUnstake (r:1 w:1)
-	/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
-	/// Storage: AppPromotion Staked (r:11 w:10)
-	/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
-	/// Storage: AppPromotion TotalStaked (r:1 w:1)
-	/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
-	/// Storage: AppPromotion StakesPerAccount (r:1 w:1)
-	/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
+	/// Storage: `Configuration::AppPromomotionConfigurationOverride` (r:1 w:0)
+	/// Proof: `Configuration::AppPromomotionConfigurationOverride` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::PendingUnstake` (r:1 w:1)
+	/// Proof: `AppPromotion::PendingUnstake` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::Staked` (r:11 w:10)
+	/// Proof: `AppPromotion::Staked` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::TotalStaked` (r:1 w:1)
+	/// Proof: `AppPromotion::TotalStaked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
+	/// Storage: `AppPromotion::StakesPerAccount` (r:1 w:1)
+	/// Proof: `AppPromotion::StakesPerAccount` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
 	fn unstake_partial() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `829`
 		//  Estimated: `29095`
-		// Minimum execution time: 46_458_000 picoseconds.
-		Weight::from_parts(47_333_000, 29095)
+		// Minimum execution time: 84_649_000 picoseconds.
+		Weight::from_parts(86_173_000, 29095)
 			.saturating_add(RocksDbWeight::get().reads(15_u64))
 			.saturating_add(RocksDbWeight::get().writes(13_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: Common CollectionById (r:1 w:1)
-	/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `Common::CollectionById` (r:1 w:1)
+	/// Proof: `Common::CollectionById` (`max_values`: None, `max_size`: Some(860), added: 3335, mode: `MaxEncodedLen`)
 	fn sponsor_collection() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `1060`
 		//  Estimated: `4325`
-		// Minimum execution time: 12_827_000 picoseconds.
-		Weight::from_parts(13_610_000, 4325)
+		// Minimum execution time: 24_396_000 picoseconds.
+		Weight::from_parts(24_917_000, 4325)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: Common CollectionById (r:1 w:1)
-	/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `Common::CollectionById` (r:1 w:1)
+	/// Proof: `Common::CollectionById` (`max_values`: None, `max_size`: Some(860), added: 3335, mode: `MaxEncodedLen`)
 	fn stop_sponsoring_collection() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `1092`
 		//  Estimated: `4325`
-		// Minimum execution time: 11_899_000 picoseconds.
-		Weight::from_parts(12_303_000, 4325)
+		// Minimum execution time: 22_412_000 picoseconds.
+		Weight::from_parts(23_033_000, 4325)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: EvmContractHelpers Sponsoring (r:0 w:1)
-	/// Proof: EvmContractHelpers Sponsoring (max_values: None, max_size: Some(62), added: 2537, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `EvmContractHelpers::Sponsoring` (r:0 w:1)
+	/// Proof: `EvmContractHelpers::Sponsoring` (`max_values`: None, `max_size`: Some(62), added: 2537, mode: `MaxEncodedLen`)
 	fn sponsor_contract() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `198`
 		//  Estimated: `1517`
-		// Minimum execution time: 10_226_000 picoseconds.
-		Weight::from_parts(10_549_000, 1517)
+		// Minimum execution time: 21_621_000 picoseconds.
+		Weight::from_parts(22_041_000, 1517)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: AppPromotion Admin (r:1 w:0)
-	/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
-	/// Storage: EvmContractHelpers Sponsoring (r:1 w:1)
-	/// Proof: EvmContractHelpers Sponsoring (max_values: None, max_size: Some(62), added: 2537, mode: MaxEncodedLen)
+	/// Storage: `AppPromotion::Admin` (r:1 w:0)
+	/// Proof: `AppPromotion::Admin` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `EvmContractHelpers::Sponsoring` (r:1 w:1)
+	/// Proof: `EvmContractHelpers::Sponsoring` (`max_values`: None, `max_size`: Some(62), added: 2537, mode: `MaxEncodedLen`)
 	fn stop_sponsoring_contract() -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `396`
 		//  Estimated: `3527`
-		// Minimum execution time: 10_528_000 picoseconds.
-		Weight::from_parts(10_842_000, 3527)
+		// Minimum execution time: 19_186_000 picoseconds.
+		Weight::from_parts(19_616_000, 3527)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
modifiedpallets/collator-selection/Cargo.tomldiffbeforeafterboth
--- a/pallets/collator-selection/Cargo.toml
+++ b/pallets/collator-selection/Cargo.toml
@@ -14,7 +14,7 @@
 [dependencies]
 log = { workspace = true }
 parity-scale-codec = { workspace = true }
-rand = { version = "0.8.5", default-features = false }
+rand = { version = "0.8.5", default-features = false, features = ["std_rng"] }
 scale-info = { workspace = true }
 serde = { workspace = true }
 
modifiedpallets/collator-selection/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/benchmarking.rs
+++ b/pallets/collator-selection/src/benchmarking.rs
@@ -32,7 +32,9 @@
 
 //! Benchmarking setup for pallet-collator-selection
 
-use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
+use frame_benchmarking::v2::{
+	account, benchmarks, impl_benchmark_test_suite, whitelisted_caller, BenchmarkError,
+};
 use frame_support::{
 	assert_ok,
 	traits::{
@@ -159,16 +161,18 @@
 /// Our benchmarking environment already has invulnerables registered.
 const INITIAL_INVULNERABLES: u32 = 2;
 
-benchmarks! {
-	where_clause { where
-		T: Config + pallet_authorship::Config + session::Config
-	}
+#[benchmarks(where T: Config + pallet_authorship::Config + session::Config)]
+mod benchmarks {
+	use super::*;
+	const MAX_COLLATORS: u32 = 10;
+	const MAX_INVULNERABLES: u32 = MAX_COLLATORS - INITIAL_INVULNERABLES;
 
 	// todo:collator this and all the following do not work for some reason, going all the way up to 10 in length
 	// Both invulnerables and candidates count together against MaxCollators.
 	// Maybe try putting it in braces? 1 .. (T::MaxCollators::get() - 2)
-	add_invulnerable {
-		let b in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES - 1;
+	#[benchmark]
+	fn add_invulnerable<T>(b: Linear<2, MAX_INVULNERABLES>) -> Result<(), BenchmarkError> {
+		let b = b - 1;
 		register_validators::<T>(b);
 		register_invulnerables::<T>(b);
 
@@ -181,39 +185,59 @@
 		<session::Pallet<T>>::set_keys(
 			RawOrigin::Signed(new_invulnerable.clone()).into(),
 			keys::<T>(b + 1),
-			Vec::new()
-		).unwrap();
+			Vec::new(),
+		)
+		.unwrap();
 
 		let root_origin = T::UpdateOrigin::try_successful_origin().unwrap();
-	}: {
-		assert_ok!(
-			<CollatorSelection<T>>::add_invulnerable(root_origin, new_invulnerable.clone())
+
+		#[block]
+		{
+			assert_ok!(<CollatorSelection<T>>::add_invulnerable(
+				root_origin,
+				new_invulnerable.clone()
+			));
+		}
+
+		assert_last_event::<T>(
+			Event::InvulnerableAdded {
+				invulnerable: new_invulnerable,
+			}
+			.into(),
 		);
-	}
-	verify {
-		assert_last_event::<T>(Event::InvulnerableAdded{invulnerable: new_invulnerable}.into());
+
+		Ok(())
 	}
 
-	remove_invulnerable {
-		let b in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES - 1;
+	#[benchmark]
+	fn remove_invulnerable(b: Linear<1, MAX_INVULNERABLES>) -> Result<(), BenchmarkError> {
 		register_validators::<T>(b);
 		register_invulnerables::<T>(b);
 
 		let root_origin = T::UpdateOrigin::try_successful_origin().unwrap();
 		let leaving = <Invulnerables<T>>::get().last().unwrap().clone();
 		whitelist!(leaving);
-	}: {
-		assert_ok!(
-			<CollatorSelection<T>>::remove_invulnerable(root_origin, leaving.clone())
+
+		#[block]
+		{
+			assert_ok!(<CollatorSelection<T>>::remove_invulnerable(
+				root_origin,
+				leaving.clone()
+			));
+		}
+
+		assert_last_event::<T>(
+			Event::InvulnerableRemoved {
+				invulnerable: leaving,
+			}
+			.into(),
 		);
-	}
-	verify {
-		assert_last_event::<T>(Event::InvulnerableRemoved{invulnerable: leaving}.into());
+
+		Ok(())
 	}
 
-	get_license {
-		let c in 1 .. T::MaxCollators::get() - 1;
-
+	#[benchmark]
+	fn get_license(c: Linear<1, MAX_COLLATORS>) -> Result<(), BenchmarkError> {
 		register_validators::<T>(c);
 		get_licenses::<T>(c);
 
@@ -224,19 +248,29 @@
 		<session::Pallet<T>>::set_keys(
 			RawOrigin::Signed(caller.clone()).into(),
 			keys::<T>(c + 1),
-			Vec::new()
-		).unwrap();
+			Vec::new(),
+		)
+		.unwrap();
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller.clone()));
+
+		assert_last_event::<T>(
+			Event::LicenseObtained {
+				account_id: caller,
+				deposit: bond / 2u32.into(),
+			}
+			.into(),
+		);
 
-	}: _(RawOrigin::Signed(caller.clone()))
-	verify {
-		assert_last_event::<T>(Event::LicenseObtained{account_id: caller, deposit: bond / 2u32.into()}.into());
+		Ok(())
 	}
 
 	// worst case is when we have all the max-candidate slots filled except one, and we fill that
 	// one.
-	onboard {
-		let c in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES - 1;
-
+	#[benchmark]
+	fn onboard(c: Linear<2, MAX_INVULNERABLES>) -> Result<(), BenchmarkError> {
+		let c = c - 1;
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
 
@@ -246,37 +280,44 @@
 
 		let origin = RawOrigin::Signed(caller.clone());
 
-		<session::Pallet<T>>::set_keys(
-			origin.clone().into(),
-			keys::<T>(c + 1),
-			Vec::new()
-		).unwrap();
+		<session::Pallet<T>>::set_keys(origin.clone().into(), keys::<T>(c + 1), Vec::new())
+			.unwrap();
+
+		assert_ok!(<CollatorSelection<T>>::get_license(origin.clone().into()));
 
-		assert_ok!(
-			<CollatorSelection<T>>::get_license(origin.clone().into())
-		);
-	}: _(origin)
-	verify {
-		assert_last_event::<T>(Event::CandidateAdded{account_id: caller}.into());
+		#[extrinsic_call]
+		_(origin);
+
+		assert_last_event::<T>(Event::CandidateAdded { account_id: caller }.into());
+
+		Ok(())
 	}
 
 	// worst case is the last candidate leaving.
-	offboard {
-		let c in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES;
-
+	#[benchmark]
+	fn offboard(c: Linear<1, MAX_INVULNERABLES>) -> Result<(), BenchmarkError> {
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
 
 		let leaving = <Candidates<T>>::get().last().unwrap().clone();
 		whitelist!(leaving);
-	}: _(RawOrigin::Signed(leaving.clone()))
-	verify {
-		assert_last_event::<T>(Event::CandidateRemoved{account_id: leaving}.into());
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(leaving.clone()));
+
+		assert_last_event::<T>(
+			Event::CandidateRemoved {
+				account_id: leaving,
+			}
+			.into(),
+		);
+
+		Ok(())
 	}
 
 	// worst case is the last candidate leaving.
-	release_license {
-		let c in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES;
+	#[benchmark]
+	fn release_license(c: Linear<1, MAX_INVULNERABLES>) -> Result<(), BenchmarkError> {
 		let bond = balance_unit::<T>();
 
 		register_validators::<T>(c);
@@ -284,14 +325,24 @@
 
 		let leaving = <Candidates<T>>::get().last().unwrap().clone();
 		whitelist!(leaving);
-	}: _(RawOrigin::Signed(leaving.clone()))
-	verify {
-		assert_last_event::<T>(Event::LicenseReleased{account_id: leaving, deposit_returned: bond}.into());
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(leaving.clone()));
+
+		assert_last_event::<T>(
+			Event::LicenseReleased {
+				account_id: leaving,
+				deposit_returned: bond,
+			}
+			.into(),
+		);
+
+		Ok(())
 	}
 
 	// worst case is the last candidate leaving.
-	force_release_license {
-		let c in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES;
+	#[benchmark]
+	fn force_release_license(c: Linear<1, MAX_INVULNERABLES>) -> Result<(), BenchmarkError> {
 		let bond = balance_unit::<T>();
 
 		register_validators::<T>(c);
@@ -300,44 +351,62 @@
 		let leaving = <Candidates<T>>::get().last().unwrap().clone();
 		whitelist!(leaving);
 		let origin = T::UpdateOrigin::try_successful_origin().unwrap();
-	}: {
-		assert_ok!(
-			<CollatorSelection<T>>::force_release_license(origin, leaving.clone())
+
+		#[block]
+		{
+			assert_ok!(<CollatorSelection<T>>::force_release_license(
+				origin,
+				leaving.clone()
+			));
+		}
+
+		assert_last_event::<T>(
+			Event::LicenseReleased {
+				account_id: leaving,
+				deposit_returned: bond,
+			}
+			.into(),
 		);
-	}
-	verify {
-		assert_last_event::<T>(Event::LicenseReleased{account_id: leaving, deposit_returned: bond}.into());
+
+		Ok(())
 	}
 
 	// worst case is paying a non-existing candidate account.
-	note_author {
+	#[benchmark]
+	fn note_author() -> Result<(), BenchmarkError> {
 		T::Currency::set_balance(
 			&<CollatorSelection<T>>::account_id(),
 			balance_unit::<T>() * 4u32.into(),
 		);
 		let author = account("author", 0, SEED);
-		let new_block: BlockNumberFor<T>= 10u32.into();
+		let new_block: BlockNumberFor<T> = 10u32.into();
 
 		frame_system::Pallet::<T>::set_block_number(new_block);
 		assert!(T::Currency::balance(&author) == 0u32.into());
-	}: {
-		<CollatorSelection<T> as EventHandler<_, _>>::note_author(author.clone())
-	} verify {
+
+		#[block]
+		{
+			<CollatorSelection<T> as EventHandler<_, _>>::note_author(author.clone());
+		}
+
 		assert!(T::Currency::balance(&author) > 0u32.into());
 		assert_eq!(frame_system::Pallet::<T>::block_number(), new_block);
+
+		Ok(())
 	}
 
 	// worst case for new session.
-	new_session {
-		let r in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES;
-		let c in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES;
-
+	#[benchmark]
+	fn new_session(
+		r: Linear<1, MAX_INVULNERABLES>,
+		c: Linear<1, MAX_INVULNERABLES>,
+	) -> Result<(), BenchmarkError> {
 		frame_system::Pallet::<T>::set_block_number(0u32.into());
 
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
 
-		let new_block: BlockNumberFor<T>= 1800u32.into();
+		let new_block: BlockNumberFor<T> = 1800u32.into();
 		let zero_block: BlockNumberFor<T> = 0u32.into();
 		let candidates = <Candidates<T>>::get();
 
@@ -362,19 +431,24 @@
 		frame_system::Pallet::<T>::set_block_number(new_block);
 
 		assert!(<Candidates<T>>::get().len() == c as usize);
-	}: {
-		<CollatorSelection<T> as SessionManager<_>>::new_session(0)
-	} verify {
+
+		#[block]
+		{
+			<CollatorSelection<T> as SessionManager<_>>::new_session(0);
+		}
+
 		if c > r {
 			assert!(<Candidates<T>>::get().len() < pre_length);
 		} else {
 			assert!(<Candidates<T>>::get().len() == pre_length);
 		}
+
+		Ok(())
 	}
-}
 
-impl_benchmark_test_suite!(
-	CollatorSelection,
-	crate::mock::new_test_ext(),
-	crate::mock::Test,
-);
+	impl_benchmark_test_suite!(
+		CollatorSelection,
+		crate::mock::new_test_ext(),
+		crate::mock::Test,
+	);
+}
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -18,7 +18,7 @@
 
 use core::convert::TryInto;
 
-use frame_benchmarking::{account, benchmarks};
+use frame_benchmarking::{account, v2::*};
 use frame_support::{
 	pallet_prelude::ConstU32,
 	traits::{fungible::Balanced, tokens::Precision, Get, Imbalance},
@@ -26,7 +26,7 @@
 };
 use pallet_evm::account::CrossAccountId;
 use sp_runtime::{traits::Zero, DispatchError};
-use sp_std::vec::Vec;
+use sp_std::{vec, vec::Vec};
 use up_data_structs::{
 	AccessMode, CollectionId, CollectionMode, CollectionPermissions, CreateCollectionData,
 	NestingPermissions, PropertiesPermissionMap, Property, PropertyKey, PropertyValue,
@@ -178,62 +178,103 @@
 	() => {}
 }
 
-benchmarks! {
-	set_collection_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn set_collection_properties(
+		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let props = (0..b).map(|p| Property {
-			key: property_key(p as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
-	}: {<Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?}
+		let props = (0..b)
+			.map(|p| Property {
+				key: property_key(p as usize),
+				value: property_value(),
+			})
+			.collect::<Vec<_>>();
+
+		#[block]
+		{
+			<Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;
+		}
+
+		Ok(())
+	}
 
-	delete_collection_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+	#[benchmark]
+	fn delete_collection_properties(
+		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let props = (0..b).map(|p| Property {
-			key: property_key(p as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
+		let props = (0..b)
+			.map(|p| Property {
+				key: property_key(p as usize),
+				value: property_value(),
+			})
+			.collect::<Vec<_>>();
 		<Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;
 		let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();
-	}: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?}
 
-	check_accesslist{
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn check_accesslist() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner);
 		};
 
 		let mut collection_handle = <CollectionHandle<T>>::try_get(collection.id)?;
-			<Pallet<T>>::update_permissions(
-				&sender,
-				&mut collection_handle,
-				CollectionPermissions { access: Some(AccessMode::AllowList), ..Default::default() }
-			)?;
+		<Pallet<T>>::update_permissions(
+			&sender,
+			&mut collection_handle,
+			CollectionPermissions {
+				access: Some(AccessMode::AllowList),
+				..Default::default()
+			},
+		)?;
 
-		<Pallet<T>>::toggle_allowlist(
-				&collection,
-				&sender,
-				&sender,
-				true,
-			)?;
+		<Pallet<T>>::toggle_allowlist(&collection, &sender, &sender, true)?;
 
-		assert_eq!(collection_handle.permissions.access(), AccessMode::AllowList);
+		assert_eq!(
+			collection_handle.permissions.access(),
+			AccessMode::AllowList
+		);
+
+		#[block]
+		{
+			collection_handle.check_allowlist(&sender)?;
+		}
 
-	}: {collection_handle.check_allowlist(&sender)?;}
+		Ok(())
+	}
 
-	init_token_properties_common {
-		bench_init!{
+	#[benchmark]
+	fn init_token_properties_common() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: sub;
 			sender: cross_from_sub(sender);
 		};
-	}: {load_is_admin_and_property_permissions(&collection, &sender);}
+
+		#[block]
+		{
+			load_is_admin_and_property_permissions(&collection, &sender);
+		}
+
+		Ok(())
+	}
 }
modifiedpallets/configuration/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/configuration/src/benchmarking.rs
+++ b/pallets/configuration/src/benchmarking.rs
@@ -16,9 +16,10 @@
 
 //! Benchmarking setup for pallet-configuration
 
-use frame_benchmarking::benchmarks;
+use frame_benchmarking::v2::*;
 use frame_support::assert_ok;
 use frame_system::{pallet_prelude::*, EventRecord, RawOrigin};
+use sp_std::vec;
 
 use super::*;
 
@@ -30,66 +31,117 @@
 	assert_eq!(event, &system_event);
 }
 
-benchmarks! {
-	where_clause { where
+#[benchmarks(
+	where
 		T: Config,
 		T::Balance: From<u32>
-	}
+)]
+mod benchmarks {
+	use super::*;
 
-	set_weight_to_fee_coefficient_override {
+	#[benchmark]
+	fn set_weight_to_fee_coefficient_override() -> Result<(), BenchmarkError> {
 		let coeff: u64 = 999;
-	}: {
-		assert_ok!(
-			<Pallet<T>>::set_weight_to_fee_coefficient_override(RawOrigin::Root.into(), Some(coeff))
-		);
+
+		#[block]
+		{
+			assert_ok!(<Pallet<T>>::set_weight_to_fee_coefficient_override(
+				RawOrigin::Root.into(),
+				Some(coeff)
+			));
+		}
+
+		Ok(())
 	}
 
-	set_min_gas_price_override {
+	#[benchmark]
+	fn set_min_gas_price_override() -> Result<(), BenchmarkError> {
 		let coeff: u64 = 999;
-	}: {
-		assert_ok!(
-			<Pallet<T>>::set_min_gas_price_override(RawOrigin::Root.into(), Some(coeff))
-		);
+
+		#[block]
+		{
+			assert_ok!(<Pallet<T>>::set_min_gas_price_override(
+				RawOrigin::Root.into(),
+				Some(coeff)
+			));
+		}
+
+		Ok(())
 	}
 
-	set_app_promotion_configuration_override {
+	#[benchmark]
+	fn set_app_promotion_configuration_override() -> Result<(), BenchmarkError> {
 		let configuration: AppPromotionConfiguration<BlockNumberFor<T>> = Default::default();
-	}: {
-		assert_ok!(
-			<Pallet<T>>::set_app_promotion_configuration_override(RawOrigin::Root.into(), configuration)
-		);
+
+		#[block]
+		{
+			assert_ok!(<Pallet<T>>::set_app_promotion_configuration_override(
+				RawOrigin::Root.into(),
+				configuration
+			));
+		}
+
+		Ok(())
 	}
 
-	set_collator_selection_desired_collators {
+	#[benchmark]
+	fn set_collator_selection_desired_collators() -> Result<(), BenchmarkError> {
 		let max: u32 = 999;
-	}: {
-		assert_ok!(
-			<Pallet<T>>::set_collator_selection_desired_collators(RawOrigin::Root.into(), Some(max))
+
+		#[block]
+		{
+			assert_ok!(<Pallet<T>>::set_collator_selection_desired_collators(
+				RawOrigin::Root.into(),
+				Some(max)
+			));
+		}
+
+		assert_last_event::<T>(
+			Event::NewDesiredCollators {
+				desired_collators: Some(max),
+			}
+			.into(),
 		);
+
+		Ok(())
 	}
-	verify {
-		assert_last_event::<T>(Event::NewDesiredCollators{desired_collators: Some(max)}.into());
-	}
 
-	set_collator_selection_license_bond {
+	#[benchmark]
+	fn set_collator_selection_license_bond() -> Result<(), BenchmarkError> {
 		let bond_cost: Option<T::Balance> = Some(1000u32.into());
-	}: {
-		assert_ok!(
-			<Pallet<T>>::set_collator_selection_license_bond(RawOrigin::Root.into(), bond_cost)
-		);
-	}
-	verify {
-		assert_last_event::<T>(Event::NewCollatorLicenseBond{bond_cost}.into());
+
+		#[block]
+		{
+			assert_ok!(<Pallet<T>>::set_collator_selection_license_bond(
+				RawOrigin::Root.into(),
+				bond_cost
+			));
+		}
+
+		assert_last_event::<T>(Event::NewCollatorLicenseBond { bond_cost }.into());
+
+		Ok(())
 	}
 
-	set_collator_selection_kick_threshold {
+	#[benchmark]
+	fn set_collator_selection_kick_threshold() -> Result<(), BenchmarkError> {
 		let threshold: Option<BlockNumberFor<T>> = Some(900u32.into());
-	}: {
-		assert_ok!(
-			<Pallet<T>>::set_collator_selection_kick_threshold(RawOrigin::Root.into(), threshold)
+
+		#[block]
+		{
+			assert_ok!(<Pallet<T>>::set_collator_selection_kick_threshold(
+				RawOrigin::Root.into(),
+				threshold
+			));
+		}
+
+		assert_last_event::<T>(
+			Event::NewCollatorKickThreshold {
+				length_in_blocks: threshold,
+			}
+			.into(),
 		);
-	}
-	verify {
-		assert_last_event::<T>(Event::NewCollatorKickThreshold{length_in_blocks: threshold}.into());
+
+		Ok(())
 	}
 }
modifiedpallets/evm-migration/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/evm-migration/src/benchmarking.rs
+++ b/pallets/evm-migration/src/benchmarking.rs
@@ -16,21 +16,29 @@
 
 #![allow(missing_docs)]
 
-use frame_benchmarking::benchmarks;
+use frame_benchmarking::v2::*;
 use frame_system::RawOrigin;
 use sp_core::{H160, H256};
 use sp_std::{vec, vec::Vec};
 
 use super::{Call, Config, Pallet};
 
-benchmarks! {
-	where_clause { where <T as Config>::RuntimeEvent: parity_scale_codec::Encode }
+#[benchmarks(
+	where <T as Config>::RuntimeEvent: parity_scale_codec::Encode
+)]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn begin() -> Result<(), BenchmarkError> {
+		#[extrinsic_call]
+		_(RawOrigin::Root, H160::default());
 
-	begin {
-	}: _(RawOrigin::Root, H160::default())
+		Ok(())
+	}
 
-	set_data {
-		let b in 0..80;
+	#[benchmark]
+	fn set_data(b: Linear<0, 80>) -> Result<(), BenchmarkError> {
 		let address = H160::from_low_u64_be(b as u64);
 		let mut data = Vec::new();
 		for i in 0..b {
@@ -40,27 +48,51 @@
 			));
 		}
 		<Pallet<T>>::begin(RawOrigin::Root.into(), address)?;
-	}: _(RawOrigin::Root, address, data)
 
-	finish {
-		let b in 0..80;
+		#[extrinsic_call]
+		_(RawOrigin::Root, address, data);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn finish(b: Linear<0, 80>) -> Result<(), BenchmarkError> {
 		let address = H160::from_low_u64_be(b as u64);
 		let data: Vec<u8> = (0..b as u8).collect();
 		<Pallet<T>>::begin(RawOrigin::Root.into(), address)?;
-	}: _(RawOrigin::Root, address, data)
 
-	insert_eth_logs {
-		let b in 0..200;
-		let logs = (0..b).map(|_| ethereum::Log {
-			address: H160([b as u8; 20]),
-			data: vec![b as u8; 128],
-			topics: vec![H256([b as u8; 32]); 6],
-		}).collect::<Vec<_>>();
-	}: _(RawOrigin::Root, logs)
+		#[extrinsic_call]
+		_(RawOrigin::Root, address, data);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn insert_eth_logs(b: Linear<0, 200>) -> Result<(), BenchmarkError> {
+		let logs = (0..b)
+			.map(|_| ethereum::Log {
+				address: H160([b as u8; 20]),
+				data: vec![b as u8; 128],
+				topics: vec![H256([b as u8; 32]); 6],
+			})
+			.collect::<Vec<_>>();
 
-	insert_events {
-		let b in 0..200;
+		#[extrinsic_call]
+		_(RawOrigin::Root, logs);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn insert_events(b: Linear<0, 200>) -> Result<(), BenchmarkError> {
 		use parity_scale_codec::Encode;
-		let logs = (0..b).map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode()).collect::<Vec<_>>();
-	}: _(RawOrigin::Root, logs)
+		let logs = (0..b)
+			.map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode())
+			.collect::<Vec<_>>();
+
+		#[extrinsic_call]
+		_(RawOrigin::Root, logs);
+
+		Ok(())
+	}
 }
modifiedpallets/foreign-assets/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/benchmarking.rs
+++ b/pallets/foreign-assets/src/benchmarking.rs
@@ -16,10 +16,10 @@
 
 #![allow(missing_docs)]
 
-use frame_benchmarking::{account, benchmarks};
+use frame_benchmarking::{account, v2::*};
 use frame_support::traits::Currency;
 use frame_system::RawOrigin;
-use sp_std::{boxed::Box, vec::Vec};
+use sp_std::{boxed::Box, vec, vec::Vec};
 use staging_xcm::{opaque::latest::Junction::Parachain, v3::Junctions::X1, VersionedMultiLocation};
 
 use super::{Call, Config, Pallet};
@@ -31,42 +31,74 @@
 		.unwrap()
 }
 
-benchmarks! {
-	register_foreign_asset {
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn register_foreign_asset() -> Result<(), BenchmarkError> {
 		let owner: T::AccountId = account("user", 0, 1);
 		let location: VersionedMultiLocation = VersionedMultiLocation::from(X1(Parachain(1000)));
-		let metadata: AssetMetadata<<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance> = AssetMetadata{
+		let metadata: AssetMetadata<
+			<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance,
+		> = AssetMetadata {
 			name: bounded(b"name"),
 			symbol: bounded(b"symbol"),
 			decimals: 18,
-			minimal_balance: 1u32.into()
+			minimal_balance: 1u32.into(),
 		};
-		let mut balance: <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance =
-		   4_000_000_000u32.into();
+		let mut balance: <<T as Config>::Currency as Currency<
+			<T as frame_system::Config>::AccountId,
+		>>::Balance = 4_000_000_000u32.into();
 		balance = balance * balance;
-		<T as Config>::Currency::make_free_balance_be(&owner,
-			balance);
-	}: _(RawOrigin::Root, owner, Box::new(location), Box::new(metadata))
+		<T as Config>::Currency::make_free_balance_be(&owner, balance);
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Root,
+			owner,
+			Box::new(location),
+			Box::new(metadata),
+		);
+
+		Ok(())
+	}
 
-	update_foreign_asset {
+	#[benchmark]
+	fn update_foreign_asset() -> Result<(), BenchmarkError> {
 		let owner: T::AccountId = account("user", 0, 1);
 		let location: VersionedMultiLocation = VersionedMultiLocation::from(X1(Parachain(2000)));
-		let metadata: AssetMetadata<<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance> = AssetMetadata{
+		let metadata: AssetMetadata<
+			<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance,
+		> = AssetMetadata {
 			name: bounded(b"name"),
 			symbol: bounded(b"symbol"),
 			decimals: 18,
-			minimal_balance: 1u32.into()
+			minimal_balance: 1u32.into(),
 		};
-		let metadata2: AssetMetadata<<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance> = AssetMetadata{
+		let metadata2: AssetMetadata<
+			<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance,
+		> = AssetMetadata {
 			name: bounded(b"name2"),
 			symbol: bounded(b"symbol2"),
 			decimals: 18,
-			minimal_balance: 1u32.into()
+			minimal_balance: 1u32.into(),
 		};
-		let mut balance: <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance =
-		   4_000_000_000u32.into();
+		let mut balance: <<T as Config>::Currency as Currency<
+			<T as frame_system::Config>::AccountId,
+		>>::Balance = 4_000_000_000u32.into();
 		balance = balance * balance;
 		<T as Config>::Currency::make_free_balance_be(&owner, balance);
-		Pallet::<T>::register_foreign_asset(RawOrigin::Root.into(), owner, Box::new(location.clone()), Box::new(metadata))?;
-	}: _(RawOrigin::Root, 0, Box::new(location), Box::new(metadata2))
+		Pallet::<T>::register_foreign_asset(
+			RawOrigin::Root.into(),
+			owner,
+			Box::new(location.clone()),
+			Box::new(metadata),
+		)?;
+
+		#[extrinsic_call]
+		_(RawOrigin::Root, 0, Box::new(location), Box::new(metadata2));
+
+		Ok(())
+	}
 }
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_benchmarking::{account, benchmarks};
+use frame_benchmarking::{account, v2::*};
 use pallet_common::{bench_init, benchmarking::create_collection_raw};
 use sp_std::prelude::*;
 use up_data_structs::{budget::Unlimited, CollectionMode, MAX_ITEMS_PER_BATCH};
@@ -35,83 +35,159 @@
 	)
 }
 
-benchmarks! {
-	create_item {
-		bench_init!{
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn create_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
-	}: {<Pallet<T>>::create_item(&collection, &sender, (to, 200), &Unlimited)?}
 
-	create_multiple_items_ex {
-		let b in 0..MAX_ITEMS_PER_BATCH;
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::create_item(&collection, &sender, (to, 200), &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn create_multiple_items_ex(b: Linear<0, MAX_ITEMS_PER_BATCH>) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner);
 		};
-		let data = (0..b).map(|i| {
-			bench_init!(to: cross_sub(i););
-			(to, 200)
-		}).collect::<BTreeMap<_, _>>();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
+		let data = (0..b)
+			.map(|i| {
+				bench_init!(to: cross_sub(i););
+				(to, 200)
+			})
+			.collect::<BTreeMap<_, _>>();
+
+		#[block]
+		{
+			<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?;
+		}
+
+		Ok(())
+	}
 
-	burn_item {
-		bench_init!{
+	#[benchmark]
+	fn burn_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; burner: cross_sub;
 		};
 		<Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;
-	}: {<Pallet<T>>::burn(&collection, &burner, 100)?}
 
-	transfer_raw {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::burn(&collection, &burner, 100)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn transfer_raw() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; to: cross_sub;
 		};
 		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &to, 200, &Unlimited)?}
 
-	approve {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::transfer(&collection, &sender, &to, 200, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn approve() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
-	}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?}
 
-	approve_from {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn approve_from() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 
 		};
 		let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
 		<Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;
-	}: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, 100)?}
 
-	check_allowed_raw {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, 100)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn check_allowed_raw() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;
-	}: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, 200, &Unlimited)?;}
 
-	set_allowance_unchecked_raw {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::check_allowed(&collection, &spender, &sender, 200, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_allowance_unchecked_raw() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
-	}: {<Pallet<T>>::set_allowance_unchecked(&collection, &sender, &spender, 200);}
 
-	burn_from {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance_unchecked(&collection, &sender, &spender, 200);
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn burn_from() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
 		};
 		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &burner, 200)?;
-	}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, 100, &Unlimited)?}
+
+		#[block]
+		{
+			<Pallet<T>>::burn_from(&collection, &burner, &sender, 100, &Unlimited)?
+		}
+
+		Ok(())
+	}
 }
modifiedpallets/identity/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/identity/src/benchmarking.rs
+++ b/pallets/identity/src/benchmarking.rs
@@ -37,11 +37,8 @@
 #![cfg(feature = "runtime-benchmarks")]
 #![allow(clippy::no_effect)]
 
-use frame_benchmarking::{account, benchmarks, whitelisted_caller};
-use frame_support::{
-	assert_ok, ensure,
-	traits::{EnsureOrigin, Get},
-};
+use frame_benchmarking::v2::*;
+use frame_support::{assert_ok, ensure, traits::EnsureOrigin};
 use frame_system::RawOrigin;
 use sp_runtime::traits::Bounded;
 
@@ -145,25 +142,48 @@
 	200u32.into()
 }
 
-benchmarks! {
-	add_registrar {
-		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;
-		ensure!(Registrars::<T>::get().len() as u32 == r, "Registrars not set up correctly.");
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	const MAX_REGISTRARS: u32 = 20;
+	const MAX_ADDITIONAL_FIELDS: u32 = 100;
+	const MAX_SUB_ACCOUNTS: u32 = 100;
+
+	#[benchmark]
+	fn add_registrar(r: Linear<2, MAX_REGISTRARS>) -> Result<(), BenchmarkError> {
+		let r = r - 1;
+		add_registrars::<T>(r)?;
+		ensure!(
+			Registrars::<T>::get().len() as u32 == r,
+			"Registrars not set up correctly."
+		);
 		let origin = T::RegistrarOrigin::try_successful_origin().unwrap();
 		let account = T::Lookup::unlookup(account("registrar", r + 1, SEED));
-	}: _<T::RuntimeOrigin>(origin, account)
-	verify {
-		ensure!(Registrars::<T>::get().len() as u32 == r + 1, "Registrars not added.");
+
+		#[extrinsic_call]
+		_(origin as T::RuntimeOrigin, account);
+
+		ensure!(
+			Registrars::<T>::get().len() as u32 == r + 1,
+			"Registrars not added."
+		);
+
+		Ok(())
 	}
 
-	set_identity {
-		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
-		let x in 0 .. T::MaxAdditionalFields::get();
+	#[benchmark]
+	fn set_identity(
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+		r: Linear<1, MAX_REGISTRARS>,
+	) -> Result<(), BenchmarkError> {
+		add_registrars::<T>(r)?;
 		let caller = {
 			// The target user
 			let caller: T::AccountId = whitelisted_caller();
 			let caller_lookup = T::Lookup::unlookup(caller.clone());
-			let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into();
+			let caller_origin: <T as frame_system::Config>::RuntimeOrigin =
+				RawOrigin::Signed(caller.clone()).into();
 			let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
 
 			// Add an initial identity
@@ -173,8 +193,7 @@
 			// User requests judgement from all the registrars, and they approve
 			for i in 0..r {
 				let registrar: T::AccountId = account("registrar", i, SEED);
-				let registrar_lookup = T::Lookup::unlookup(registrar.clone());
-				let balance_to_use =  balance_unit::<T>() * 10u32.into();
+				let balance_to_use = balance_unit::<T>() * 10u32.into();
 				let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);
 
 				Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;
@@ -188,66 +207,91 @@
 			}
 			caller
 		};
-	}: _(RawOrigin::Signed(caller.clone()), Box::new(create_identity_info::<T>(x)))
-	verify {
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller.clone()),
+			Box::new(create_identity_info::<T>(x)),
+		);
+
 		assert_last_event::<T>(Event::<T>::IdentitySet { who: caller }.into());
+
+		Ok(())
 	}
 
 	// We need to split `set_subs` into two benchmarks to accurately isolate the potential
 	// writes caused by new or old sub accounts. The actual weight should simply be
 	// the sum of these two weights.
-	set_subs_new {
+	#[benchmark]
+	fn set_subs_new(s: Linear<0, MAX_SUB_ACCOUNTS>) -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = whitelisted_caller();
 		// Create a new subs vec with s sub accounts
-		let s in 0 .. T::MaxSubAccounts::get() => ();
 		let subs = create_sub_accounts::<T>(&caller, s)?;
-		ensure!(SubsOf::<T>::get(&caller).1.len() == 0, "Caller already has subs");
-	}: set_subs(RawOrigin::Signed(caller.clone()), subs)
-	verify {
-		ensure!(SubsOf::<T>::get(&caller).1.len() as u32 == s, "Subs not added");
+		ensure!(
+			SubsOf::<T>::get(&caller).1.len() == 0,
+			"Caller already has subs"
+		);
+
+		#[extrinsic_call]
+		set_subs(RawOrigin::Signed(caller.clone()), subs);
+
+		ensure!(
+			SubsOf::<T>::get(&caller).1.len() as u32 == s,
+			"Subs not added"
+		);
+
+		Ok(())
 	}
 
-	set_subs_old {
+	#[benchmark]
+	fn set_subs_old(p: Linear<0, MAX_SUB_ACCOUNTS>) -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = whitelisted_caller();
 		// Give them p many previous sub accounts.
-		let p in 0 .. T::MaxSubAccounts::get() => {
-			let _ = add_sub_accounts::<T>(&caller, p)?;
-		};
+		let _ = add_sub_accounts::<T>(&caller, p)?;
 		// Remove all subs.
 		let subs = create_sub_accounts::<T>(&caller, 0)?;
 		ensure!(
 			SubsOf::<T>::get(&caller).1.len() as u32 == p,
 			"Caller does have subs",
 		);
-	}: set_subs(RawOrigin::Signed(caller.clone()), subs)
-	verify {
+
+		#[extrinsic_call]
+		set_subs(RawOrigin::Signed(caller.clone()), subs);
+
 		ensure!(SubsOf::<T>::get(&caller).1.len() == 0, "Subs not removed");
+
+		Ok(())
 	}
 
-	clear_identity {
+	#[benchmark]
+	fn clear_identity(
+		r: Linear<1, MAX_REGISTRARS>,
+		s: Linear<0, MAX_SUB_ACCOUNTS>,
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+	) -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = whitelisted_caller();
-		let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));
 		let caller_lookup = <T::Lookup as StaticLookup>::unlookup(caller.clone());
 		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
 
-		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
-		let s in 0 .. T::MaxSubAccounts::get() => {
+		add_registrars::<T>(r)?;
+
+		{
 			// Give them s many sub accounts
 			let caller: T::AccountId = whitelisted_caller();
 			let _ = add_sub_accounts::<T>(&caller, s)?;
-		};
-		let x in 0 .. T::MaxAdditionalFields::get();
+		}
 
 		// Create their main identity with x additional fields
 		let info = create_identity_info::<T>(x);
 		let caller: T::AccountId = whitelisted_caller();
-		let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));
+		let caller_origin =
+			<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));
 		Identity::<T>::set_identity(caller_origin.clone(), Box::new(info.clone()))?;
 
 		// User requests judgement from all the registrars, and they approve
 		for i in 0..r {
 			let registrar: T::AccountId = account("registrar", i, SEED);
-			let balance_to_use =  balance_unit::<T>() * 10u32.into();
+			let balance_to_use = balance_unit::<T>() * 10u32.into();
 			let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);
 
 			Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;
@@ -259,108 +303,199 @@
 				T::Hashing::hash_of(&info),
 			)?;
 		}
-		ensure!(IdentityOf::<T>::contains_key(&caller), "Identity does not exist.");
-	}: _(RawOrigin::Signed(caller.clone()))
-	verify {
-		ensure!(!IdentityOf::<T>::contains_key(&caller), "Identity not cleared.");
+		ensure!(
+			IdentityOf::<T>::contains_key(&caller),
+			"Identity does not exist."
+		);
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller.clone()));
+
+		ensure!(
+			!IdentityOf::<T>::contains_key(&caller),
+			"Identity not cleared."
+		);
+
+		Ok(())
 	}
 
-	request_judgement {
+	#[benchmark]
+	fn request_judgement(
+		r: Linear<1, MAX_REGISTRARS>,
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+	) -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = whitelisted_caller();
 		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
 
-		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
-		let x in 0 .. T::MaxAdditionalFields::get() => {
+		add_registrars::<T>(r)?;
+
+		{
 			// Create their main identity with x additional fields
 			let info = create_identity_info::<T>(x);
 			let caller: T::AccountId = whitelisted_caller();
-			let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller));
+			let caller_origin =
+				<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller));
 			Identity::<T>::set_identity(caller_origin, Box::new(info))?;
-		};
-	}: _(RawOrigin::Signed(caller.clone()), r - 1, 10u32.into())
-	verify {
-		assert_last_event::<T>(Event::<T>::JudgementRequested { who: caller, registrar_index: r-1 }.into());
+		}
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller.clone()), r - 1, 10u32.into());
+
+		assert_last_event::<T>(
+			Event::<T>::JudgementRequested {
+				who: caller,
+				registrar_index: r - 1,
+			}
+			.into(),
+		);
+
+		Ok(())
 	}
 
-	cancel_request {
+	#[benchmark]
+	fn cancel_request(
+		r: Linear<1, MAX_REGISTRARS>,
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+	) -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = whitelisted_caller();
-		let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));
+		let caller_origin =
+			<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));
 		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
 
-		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
-		let x in 0 .. T::MaxAdditionalFields::get() => {
+		add_registrars::<T>(r)?;
+
+		{
 			// Create their main identity with x additional fields
 			let info = create_identity_info::<T>(x);
 			let caller: T::AccountId = whitelisted_caller();
-			let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller));
+			let caller_origin =
+				<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller));
 			Identity::<T>::set_identity(caller_origin, Box::new(info))?;
-		};
+		}
 
 		Identity::<T>::request_judgement(caller_origin, r - 1, 10u32.into())?;
-	}: _(RawOrigin::Signed(caller.clone()), r - 1)
-	verify {
-		assert_last_event::<T>(Event::<T>::JudgementUnrequested { who: caller, registrar_index: r-1 }.into());
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller.clone()), r - 1);
+
+		assert_last_event::<T>(
+			Event::<T>::JudgementUnrequested {
+				who: caller,
+				registrar_index: r - 1,
+			}
+			.into(),
+		);
+
+		Ok(())
 	}
 
-	set_fee {
+	#[benchmark]
+	fn set_fee(r: Linear<2, MAX_REGISTRARS>) -> Result<(), BenchmarkError> {
+		let r = r - 1;
 		let caller: T::AccountId = whitelisted_caller();
 		let caller_lookup = T::Lookup::unlookup(caller.clone());
 
-		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;
+		add_registrars::<T>(r)?;
 
 		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();
 		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;
 		let registrars = Registrars::<T>::get();
-		ensure!(registrars[r as usize].as_ref().unwrap().fee == 0u32.into(), "Fee already set.");
-	}: _(RawOrigin::Signed(caller), r, 100u32.into())
-	verify {
+		ensure!(
+			registrars[r as usize].as_ref().unwrap().fee == 0u32.into(),
+			"Fee already set."
+		);
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), r, 100u32.into());
+
 		let registrars = Registrars::<T>::get();
-		ensure!(registrars[r as usize].as_ref().unwrap().fee == 100u32.into(), "Fee not changed.");
+		ensure!(
+			registrars[r as usize].as_ref().unwrap().fee == 100u32.into(),
+			"Fee not changed."
+		);
+
+		Ok(())
 	}
 
-	set_account_id {
+	#[benchmark]
+	fn set_account_id(r: Linear<2, MAX_REGISTRARS>) -> Result<(), BenchmarkError> {
+		let r = r - 1;
 		let caller: T::AccountId = whitelisted_caller();
 		let caller_lookup = T::Lookup::unlookup(caller.clone());
 		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
 
-		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;
+		add_registrars::<T>(r)?;
 
 		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();
 		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;
 		let registrars = Registrars::<T>::get();
-		ensure!(registrars[r as usize].as_ref().unwrap().account == caller, "id not set.");
+		ensure!(
+			registrars[r as usize].as_ref().unwrap().account == caller,
+			"id not set."
+		);
 		let new_account = T::Lookup::unlookup(account("new", 0, SEED));
-	}: _(RawOrigin::Signed(caller), r, new_account)
-	verify {
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), r, new_account);
+
 		let registrars = Registrars::<T>::get();
-		ensure!(registrars[r as usize].as_ref().unwrap().account == account("new", 0, SEED), "id not changed.");
+		ensure!(
+			registrars[r as usize].as_ref().unwrap().account == account("new", 0, SEED),
+			"id not changed."
+		);
+
+		Ok(())
 	}
 
-	set_fields {
+	#[benchmark]
+	fn set_fields(r: Linear<2, MAX_REGISTRARS>) -> Result<(), BenchmarkError> {
+		let r = r - 1;
 		let caller: T::AccountId = whitelisted_caller();
 		let caller_lookup = T::Lookup::unlookup(caller.clone());
 		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
 
-		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;
+		add_registrars::<T>(r)?;
 
 		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();
 		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;
 		let fields = IdentityFields(
-			IdentityField::Display | IdentityField::Legal | IdentityField::Web | IdentityField::Riot
-			| IdentityField::Email | IdentityField::PgpFingerprint | IdentityField::Image | IdentityField::Twitter
+			IdentityField::Display
+				| IdentityField::Legal
+				| IdentityField::Web
+				| IdentityField::Riot
+				| IdentityField::Email
+				| IdentityField::PgpFingerprint
+				| IdentityField::Image
+				| IdentityField::Twitter,
 		);
 		let registrars = Registrars::<T>::get();
-		ensure!(registrars[r as usize].as_ref().unwrap().fields == Default::default(), "fields already set.");
-	}: _(RawOrigin::Signed(caller), r, fields)
-	verify {
+		ensure!(
+			registrars[r as usize].as_ref().unwrap().fields == Default::default(),
+			"fields already set."
+		);
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), r, fields);
+
 		let registrars = Registrars::<T>::get();
-		ensure!(registrars[r as usize].as_ref().unwrap().fields != Default::default(), "fields not set.");
+		ensure!(
+			registrars[r as usize].as_ref().unwrap().fields != Default::default(),
+			"fields not set."
+		);
+
+		Ok(())
 	}
 
-	provide_judgement {
+	#[benchmark]
+	fn provide_judgement(
+		r: Linear<2, MAX_REGISTRARS>,
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+	) -> Result<(), BenchmarkError> {
+		let r = r - 1;
 		// The user
 		let user: T::AccountId = account("user", r, SEED);
-		let user_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(user.clone()));
+		let user_origin =
+			<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(user.clone()));
 		let user_lookup = <T::Lookup as StaticLookup>::unlookup(user.clone());
 		let _ = T::Currency::make_free_balance_be(&user, BalanceOf::<T>::max_value());
 
@@ -368,8 +503,7 @@
 		let caller_lookup = T::Lookup::unlookup(caller.clone());
 		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
 
-		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;
-		let x in 0 .. T::MaxAdditionalFields::get();
+		add_registrars::<T>(r)?;
 
 		let info = create_identity_info::<T>(x);
 		let info_hash = T::Hashing::hash_of(&info);
@@ -378,18 +512,38 @@
 		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();
 		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;
 		Identity::<T>::request_judgement(user_origin, r, 10u32.into())?;
-	}: _(RawOrigin::Signed(caller), r, user_lookup, Judgement::Reasonable, info_hash)
-	verify {
-		assert_last_event::<T>(Event::<T>::JudgementGiven { target: user, registrar_index: r }.into())
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			r,
+			user_lookup,
+			Judgement::Reasonable,
+			info_hash,
+		);
+
+		assert_last_event::<T>(
+			Event::<T>::JudgementGiven {
+				target: user,
+				registrar_index: r,
+			}
+			.into(),
+		);
+
+		Ok(())
 	}
 
-	kill_identity {
-		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
-		let s in 0 .. T::MaxSubAccounts::get();
-		let x in 0 .. T::MaxAdditionalFields::get();
+	#[benchmark]
+	fn kill_identity(
+		r: Linear<1, MAX_REGISTRARS>,
+		s: Linear<0, MAX_SUB_ACCOUNTS>,
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+	) -> Result<(), BenchmarkError> {
+		add_registrars::<T>(r)?;
 
 		let target: T::AccountId = account("target", 0, SEED);
-		let target_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(target.clone()).into();
+		let target_origin: <T as frame_system::Config>::RuntimeOrigin =
+			RawOrigin::Signed(target.clone()).into();
 		let target_lookup = T::Lookup::unlookup(target.clone());
 		let _ = T::Currency::make_free_balance_be(&target, BalanceOf::<T>::max_value());
 
@@ -400,7 +554,7 @@
 		// User requests judgement from all the registrars, and they approve
 		for i in 0..r {
 			let registrar: T::AccountId = account("registrar", i, SEED);
-			let balance_to_use =  balance_unit::<T>() * 10u32.into();
+			let balance_to_use = balance_unit::<T>() * 10u32.into();
 			let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);
 
 			Identity::<T>::request_judgement(target_origin.clone(), i, 10u32.into())?;
@@ -414,110 +568,190 @@
 		}
 		ensure!(IdentityOf::<T>::contains_key(&target), "Identity not set");
 		let origin = T::ForceOrigin::try_successful_origin().unwrap();
-	}: _<T::RuntimeOrigin>(origin, target_lookup)
-	verify {
-		ensure!(!IdentityOf::<T>::contains_key(&target), "Identity not removed");
+
+		#[extrinsic_call]
+		_(origin as T::RuntimeOrigin, target_lookup);
+
+		ensure!(
+			!IdentityOf::<T>::contains_key(&target),
+			"Identity not removed"
+		);
+
+		Ok(())
 	}
 
-	force_insert_identities {
-		let x in 0 .. T::MaxAdditionalFields::get();
-		let n in 0..600;
+	#[benchmark]
+	fn force_insert_identities(
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+		n: Linear<0, 600>,
+	) -> Result<(), BenchmarkError> {
 		use frame_benchmarking::account;
-		let identities = (0..n).map(|i| (
-			account("caller", i, SEED),
-			Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
-				judgements: Default::default(),
-				deposit: Default::default(),
-				info: create_identity_info::<T>(x),
-			},
-		)).collect::<Vec<_>>();
+		let identities = (0..n)
+			.map(|i| {
+				(
+					account("caller", i, SEED),
+					Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
+						judgements: Default::default(),
+						deposit: Default::default(),
+						info: create_identity_info::<T>(x),
+					},
+				)
+			})
+			.collect::<Vec<_>>();
 		let origin = T::ForceOrigin::try_successful_origin().unwrap();
-	}: _<T::RuntimeOrigin>(origin, identities)
 
-	force_remove_identities {
-		let x in 0 .. T::MaxAdditionalFields::get();
-		let n in 0..600;
+		#[extrinsic_call]
+		_(origin as T::RuntimeOrigin, identities);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn force_remove_identities(
+		x: Linear<0, MAX_ADDITIONAL_FIELDS>,
+		n: Linear<0, 600>,
+	) -> Result<(), BenchmarkError> {
 		use frame_benchmarking::account;
 		let origin = T::ForceOrigin::try_successful_origin().unwrap();
-		let identities = (0..n).map(|i| (
-			account("caller", i, SEED),
-			Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
-				judgements: Default::default(),
-				deposit: Default::default(),
-				info: create_identity_info::<T>(x),
-			},
-		)).collect::<Vec<_>>();
-		assert_ok!(
-			Identity::<T>::force_insert_identities(origin.clone(), identities.clone()),
-		);
-		let identities = identities.into_iter().map(|(acc, _)| acc).collect::<Vec<_>>();
-	}: _<T::RuntimeOrigin>(origin, identities)
+		let identities = (0..n)
+			.map(|i| {
+				(
+					account("caller", i, SEED),
+					Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
+						judgements: Default::default(),
+						deposit: Default::default(),
+						info: create_identity_info::<T>(x),
+					},
+				)
+			})
+			.collect::<Vec<_>>();
+		assert_ok!(Identity::<T>::force_insert_identities(
+			origin.clone(),
+			identities.clone()
+		),);
+		let identities = identities
+			.into_iter()
+			.map(|(acc, _)| acc)
+			.collect::<Vec<_>>();
 
-	force_set_subs {
-		let s in 0 .. T::MaxSubAccounts::get();
-		let n in 0..600;
+		#[extrinsic_call]
+		_(origin as T::RuntimeOrigin, identities);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn force_set_subs(
+		s: Linear<0, MAX_SUB_ACCOUNTS>,
+		n: Linear<0, 600>,
+	) -> Result<(), BenchmarkError> {
 		use frame_benchmarking::account;
-		let identities = (0..n).map(|i| {
-			let caller: T::AccountId = account("caller", i, SEED);
-			(
-				caller.clone(),
+		let identities = (0..n)
+			.map(|i| {
+				let caller: T::AccountId = account("caller", i, SEED);
 				(
-					BalanceOf::<T>::max_value(),
-					create_sub_accounts::<T>(&caller, s).unwrap().try_into().unwrap(),
-				),
-			)
-		}).collect::<Vec<_>>();
+					caller.clone(),
+					(
+						BalanceOf::<T>::max_value(),
+						create_sub_accounts::<T>(&caller, s)
+							.unwrap()
+							.try_into()
+							.unwrap(),
+					),
+				)
+			})
+			.collect::<Vec<_>>();
 		let origin = T::ForceOrigin::try_successful_origin().unwrap();
-	}: _<T::RuntimeOrigin>(origin, identities)
 
-	add_sub {
-		let s in 0 .. T::MaxSubAccounts::get() - 1;
+		#[extrinsic_call]
+		_(origin as T::RuntimeOrigin, identities);
 
+		Ok(())
+	}
+
+	#[benchmark]
+	fn add_sub(s: Linear<1, MAX_SUB_ACCOUNTS>) -> Result<(), BenchmarkError> {
+		let s = s - 1;
 		let caller: T::AccountId = whitelisted_caller();
 		let _ = add_sub_accounts::<T>(&caller, s)?;
 		let sub = account("new_sub", 0, SEED);
 		let data = Data::Raw(vec![0; 32].try_into().unwrap());
-		ensure!(SubsOf::<T>::get(&caller).1.len() as u32 == s, "Subs not set.");
-	}: _(RawOrigin::Signed(caller.clone()), T::Lookup::unlookup(sub), data)
-	verify {
-		ensure!(SubsOf::<T>::get(&caller).1.len() as u32 == s + 1, "Subs not added.");
-	}
+		ensure!(
+			SubsOf::<T>::get(&caller).1.len() as u32 == s,
+			"Subs not set."
+		);
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller.clone()),
+			T::Lookup::unlookup(sub),
+			data,
+		);
+
+		ensure!(
+			SubsOf::<T>::get(&caller).1.len() as u32 == s + 1,
+			"Subs not added."
+		);
 
-	rename_sub {
-		let s in 1 .. T::MaxSubAccounts::get();
+		Ok(())
+	}
 
+	#[benchmark]
+	fn rename_sub(s: Linear<1, MAX_SUB_ACCOUNTS>) -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = whitelisted_caller();
 		let (sub, _) = add_sub_accounts::<T>(&caller, s)?.remove(0);
 		let data = Data::Raw(vec![1; 32].try_into().unwrap());
-		ensure!(SuperOf::<T>::get(&sub).unwrap().1 != data, "data already set");
-	}: _(RawOrigin::Signed(caller), T::Lookup::unlookup(sub.clone()), data.clone())
-	verify {
+		ensure!(
+			SuperOf::<T>::get(&sub).unwrap().1 != data,
+			"data already set"
+		);
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			T::Lookup::unlookup(sub.clone()),
+			data.clone(),
+		);
+
 		ensure!(SuperOf::<T>::get(&sub).unwrap().1 == data, "data not set");
-	}
 
-	remove_sub {
-		let s in 1 .. T::MaxSubAccounts::get();
+		Ok(())
+	}
 
+	#[benchmark]
+	fn remove_sub(s: Linear<1, MAX_SUB_ACCOUNTS>) -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = whitelisted_caller();
 		let (sub, _) = add_sub_accounts::<T>(&caller, s)?.remove(0);
 		ensure!(SuperOf::<T>::contains_key(&sub), "Sub doesn't exists");
-	}: _(RawOrigin::Signed(caller), T::Lookup::unlookup(sub.clone()))
-	verify {
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), T::Lookup::unlookup(sub.clone()));
+
 		ensure!(!SuperOf::<T>::contains_key(&sub), "Sub not removed");
+
+		Ok(())
 	}
 
-	quit_sub {
-		let s in 0 .. T::MaxSubAccounts::get() - 1;
-
+	#[benchmark]
+	fn quit_sub(s: Linear<1, MAX_SUB_ACCOUNTS>) -> Result<(), BenchmarkError> {
+		let s = s - 1;
 		let caller: T::AccountId = whitelisted_caller();
 		let sup = account("super", 0, SEED);
 		let _ = add_sub_accounts::<T>(&sup, s)?;
 		let sup_origin = RawOrigin::Signed(sup).into();
-		Identity::<T>::add_sub(sup_origin, T::Lookup::unlookup(caller.clone()), Data::Raw(vec![0; 32].try_into().unwrap()))?;
+		Identity::<T>::add_sub(
+			sup_origin,
+			T::Lookup::unlookup(caller.clone()),
+			Data::Raw(vec![0; 32].try_into().unwrap()),
+		)?;
 		ensure!(SuperOf::<T>::contains_key(&caller), "Sub doesn't exists");
-	}: _(RawOrigin::Signed(caller.clone()))
-	verify {
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller.clone()));
+
 		ensure!(!SuperOf::<T>::contains_key(&caller), "Sub not removed");
+
+		Ok(())
 	}
 
 	impl_benchmark_test_suite!(Identity, crate::tests::new_test_ext(), crate::tests::Test);
modifiedpallets/inflation/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/inflation/src/benchmarking.rs
+++ b/pallets/inflation/src/benchmarking.rs
@@ -16,18 +16,29 @@
 
 #![cfg(feature = "runtime-benchmarks")]
 
-use frame_benchmarking::benchmarks;
-use frame_support::{pallet_prelude::*, traits::Hooks};
+use frame_benchmarking::v2::*;
+use frame_support::traits::Hooks;
+use sp_std::vec;
 
 use super::*;
 use crate::Pallet as Inflation;
 
-benchmarks! {
+#[benchmarks]
+mod benchmarks {
+	use super::*;
 
-	on_initialize {
+	#[benchmark]
+	fn on_initialize() -> Result<(), BenchmarkError> {
 		let block1: BlockNumberFor<T> = 1u32.into();
 		let block2: BlockNumberFor<T> = 2u32.into();
-		<Inflation<T> as Hooks>::on_initialize(block1); // Create Treasury account
-	}: { <Inflation<T> as Hooks>::on_initialize(block2); } // Benchmark deposit_into_existing path
+		<Inflation<T> as Hooks<_>>::on_initialize(block1); // Create Treasury account
 
+		#[block]
+		{
+			<Inflation<T> as Hooks<_>>::on_initialize(block2);
+			// Benchmark deposit_into_existing path
+		}
+
+		Ok(())
+	}
 }
modifiedpallets/maintenance/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/maintenance/src/benchmarking.rs
+++ b/pallets/maintenance/src/benchmarking.rs
@@ -14,36 +14,37 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_benchmarking::benchmarks;
-use frame_support::{ensure, pallet_prelude::Weight, traits::StorePreimage};
+use frame_benchmarking::v2::*;
+use frame_support::ensure;
 use frame_system::RawOrigin;
-use parity_scale_codec::Encode;
+use sp_std::vec;
 
 use super::*;
 use crate::{Config, Pallet as Maintenance};
 
-benchmarks! {
-	enable {
-	}: _(RawOrigin::Root)
-	verify {
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn enable() -> Result<(), BenchmarkError> {
+		#[extrinsic_call]
+		_(RawOrigin::Root);
+
 		ensure!(<Enabled<T>>::get(), "didn't enable the MM");
+
+		Ok(())
 	}
 
-	disable {
+	#[benchmark]
+	fn disable() -> Result<(), BenchmarkError> {
 		Maintenance::<T>::enable(RawOrigin::Root.into())?;
-	}: _(RawOrigin::Root)
-	verify {
+
+		#[extrinsic_call]
+		_(RawOrigin::Root);
+
 		ensure!(!<Enabled<T>>::get(), "didn't disable the MM");
-	}
 
-	#[pov_mode = MaxEncodedLen {
-		// PoV size is deducted from weight_bound
-		Preimage::PreimageFor: Measured
-	}]
-	execute_preimage {
-		let call = <T as Config>::RuntimeCall::from(frame_system::Call::<T>::remark { remark: 1u32.encode() });
-		let hash = T::Preimages::note(call.encode().into())?;
-	}: _(RawOrigin::Root, hash, Weight::from_parts(100000000000, 100000000000))
-	verify {
+		Ok(())
 	}
 }
modifiedpallets/maintenance/src/lib.rsdiffbeforeafterboth
--- a/pallets/maintenance/src/lib.rs
+++ b/pallets/maintenance/src/lib.rs
@@ -32,7 +32,6 @@
 		traits::{EnsureOrigin, QueryPreimage, StorePreimage},
 	};
 	use frame_system::pallet_prelude::*;
-	use sp_core::H256;
 	use sp_runtime::traits::Dispatchable;
 
 	use crate::weights::WeightInfo;
@@ -102,50 +101,6 @@
 			Self::deposit_event(Event::MaintenanceDisabled);
 
 			Ok(())
-		}
-
-		/// Execute a runtime call stored as a preimage.
-		///
-		/// `weight_bound` is the maximum weight that the caller is willing
-		/// to allow the extrinsic to be executed with.
-		#[pallet::call_index(2)]
-		#[pallet::weight(<T as Config>::WeightInfo::execute_preimage() + *weight_bound)]
-		pub fn execute_preimage(
-			origin: OriginFor<T>,
-			hash: H256,
-			weight_bound: Weight,
-		) -> DispatchResultWithPostInfo {
-			use parity_scale_codec::Decode;
-
-			T::PreimageOrigin::ensure_origin(origin.clone())?;
-
-			let data = T::Preimages::fetch(&hash, None)?;
-			weight_bound.set_proof_size(
-				weight_bound
-					.proof_size()
-					.checked_sub(
-						data.len()
-							.try_into()
-							.map_err(|_| DispatchError::Corruption)?,
-					)
-					.ok_or(DispatchError::Exhausted)?,
-			);
-
-			let call = <T as Config>::RuntimeCall::decode(&mut &data[..])
-				.map_err(|_| DispatchError::Corruption)?;
-
-			ensure!(
-				call.get_dispatch_info().weight.all_lte(weight_bound),
-				DispatchError::Exhausted
-			);
-
-			match call.dispatch(origin) {
-				Ok(_) => Ok(Pays::No.into()),
-				Err(error_and_info) => Err(DispatchErrorWithPostInfo {
-					post_info: Pays::No.into(),
-					error: error_and_info.error,
-				}),
-			}
 		}
 	}
 }
modifiedpallets/maintenance/src/weights.rsdiffbeforeafterboth
--- a/pallets/maintenance/src/weights.rs
+++ b/pallets/maintenance/src/weights.rs
@@ -35,7 +35,6 @@
 pub trait WeightInfo {
 	fn enable() -> Weight;
 	fn disable() -> Weight;
-	fn execute_preimage() -> Weight;
 }
 
 /// Weights for pallet_maintenance using the Substrate node and recommended hardware.
@@ -60,18 +59,6 @@
 		// Minimum execution time: 2_976_000 picoseconds.
 		Weight::from_parts(3_111_000, 0)
 			.saturating_add(T::DbWeight::get().writes(1_u64))
-	}
-	/// Storage: Preimage StatusFor (r:1 w:0)
-	/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
-	/// Storage: Preimage PreimageFor (r:1 w:0)
-	/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: Measured)
-	fn execute_preimage() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `209`
-		//  Estimated: `3674`
-		// Minimum execution time: 7_359_000 picoseconds.
-		Weight::from_parts(7_613_000, 3674)
-			.saturating_add(T::DbWeight::get().reads(2_u64))
 	}
 }
 
@@ -96,18 +83,6 @@
 		// Minimum execution time: 2_976_000 picoseconds.
 		Weight::from_parts(3_111_000, 0)
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
-	}
-	/// Storage: Preimage StatusFor (r:1 w:0)
-	/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
-	/// Storage: Preimage PreimageFor (r:1 w:0)
-	/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: Measured)
-	fn execute_preimage() -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `209`
-		//  Estimated: `3674`
-		// Minimum execution time: 7_359_000 picoseconds.
-		Weight::from_parts(7_613_000, 3674)
-			.saturating_add(RocksDbWeight::get().reads(2_u64))
 	}
 }
 
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -14,12 +14,10 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_benchmarking::{account, benchmarks};
+use frame_benchmarking::v2::{account, benchmarks, BenchmarkError};
 use pallet_common::{
 	bench_init,
-	benchmarking::{
-		create_collection_raw, load_is_admin_and_property_permissions, property_key, property_value,
-	},
+	benchmarking::{create_collection_raw, property_key, property_value},
 	CommonCollectionOperations,
 };
 use sp_std::prelude::*;
@@ -64,236 +62,433 @@
 	)
 }
 
-benchmarks! {
-	create_item {
-		bench_init!{
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn create_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
-	}: {create_max_item(&collection, &sender, to.clone())?}
 
-	create_multiple_items {
-		let b in 0..MAX_ITEMS_PER_BATCH;
-		bench_init!{
+		#[block]
+		{
+			create_max_item(&collection, &sender, to)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn create_multiple_items(b: Linear<0, MAX_ITEMS_PER_BATCH>) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
-		let data = (0..b).map(|_| create_max_item_data::<T>(to.clone())).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
+		let data = (0..b)
+			.map(|_| create_max_item_data::<T>(to.clone()))
+			.collect();
 
-	create_multiple_items_ex {
-		let b in 0..MAX_ITEMS_PER_BATCH;
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn create_multiple_items_ex(b: Linear<0, MAX_ITEMS_PER_BATCH>) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner);
 		};
-		let data = (0..b).map(|i| {
-			bench_init!(to: cross_sub(i););
-			create_max_item_data::<T>(to)
-		}).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
+		let data = (0..b)
+			.map(|i| {
+				bench_init!(to: cross_sub(i););
+				create_max_item_data::<T>(to)
+			})
+			.collect();
+
+		#[block]
+		{
+			<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?;
+		}
 
-	burn_item {
-		bench_init!{
+		Ok(())
+	}
+
+	#[benchmark]
+	fn burn_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); burner: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, burner.clone())?;
-	}: {<Pallet<T>>::burn(&collection, &burner, item)?}
 
-	burn_recursively_self_raw {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::burn(&collection, &burner, item)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn burn_recursively_self_raw() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); burner: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, burner.clone())?;
-	}: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}
 
-	burn_recursively_breadth_plus_self_plus_self_per_each_raw {
-		let b in 0..200;
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(
+		b: Linear<0, 200>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); burner: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, burner.clone())?;
-		for i in 0..b {
-			create_max_item(&collection, &sender, T::CrossTokenAddressMapping::token_to_address(collection.id, item))?;
+		for _ in 0..b {
+			create_max_item(
+				&collection,
+				&sender,
+				T::CrossTokenAddressMapping::token_to_address(collection.id, item),
+			)?;
 		}
-	}: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}
 
-	transfer_raw {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn transfer_raw() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, sender.clone())?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, &Unlimited)?}
 
-	approve {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::transfer(&collection, &sender, &receiver, item, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn approve() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, sender.clone())?;
-	}: {<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?}
 
-	approve_from {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn approve_from() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
 		let item = create_max_item(&collection, &owner, owner_eth.clone())?;
-	}: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, item, Some(&spender))?}
 
-	check_allowed_raw {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance_from(
+				&collection,
+				&sender,
+				&owner_eth,
+				item,
+				Some(&spender),
+			)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn check_allowed_raw() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
-			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
+			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, sender.clone())?;
 		<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;
-	}: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, item, &Unlimited)?}
 
-	burn_from {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::check_allowed(&collection, &spender, &sender, item, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn burn_from() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, sender.clone())?;
 		<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;
-	}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}
 
-	set_token_property_permissions {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_token_property_permissions(
+		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: false,
-				collection_admin: false,
-				token_owner: false,
-			},
-		}).collect::<Vec<_>>();
-	}: {<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?}
+		let perms = (0..b)
+			.map(|k| PropertyKeyPermission {
+				key: property_key(k as usize),
+				permission: PropertyPermission {
+					mutable: false,
+					collection_admin: false,
+					token_owner: false,
+				},
+			})
+			.collect::<Vec<_>>();
+
+		#[block]
+		{
+			<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+		}
+
+		Ok(())
+	}
 
-	set_token_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+	#[benchmark]
+	fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: false,
-				collection_admin: true,
-				token_owner: true,
-			},
-		}).collect::<Vec<_>>();
+		let perms = (0..b)
+			.map(|k| PropertyKeyPermission {
+				key: property_key(k as usize),
+				permission: PropertyPermission {
+					mutable: false,
+					collection_admin: true,
+					token_owner: true,
+				},
+			})
+			.collect::<Vec<_>>();
 		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b).map(|k| Property {
-			key: property_key(k as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
+		let props = (0..b)
+			.map(|k| Property {
+				key: property_key(k as usize),
+				value: property_value(),
+			})
+			.collect::<Vec<_>>();
 		let item = create_max_item(&collection, &owner, owner.clone())?;
-	}: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?}
 
-	init_token_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
-			owner: sub; collection: collection(owner);
-			owner: cross_from_sub;
-		};
+		#[block]
+		{
+			<Pallet<T>>::set_token_properties(
+				&collection,
+				&owner,
+				item,
+				props.into_iter(),
+				&Unlimited,
+			)?;
+		}
+
+		Ok(())
+	}
+
+	// TODO:
+	#[benchmark]
+	fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+		// bench_init! {
+		// 	owner: sub; collection: collection(owner);
+		// 	owner: cross_from_sub;
+		// };
 
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: false,
-				collection_admin: true,
-				token_owner: true,
-			},
-		}).collect::<Vec<_>>();
-		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b).map(|k| Property {
-			key: property_key(k as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
-		let item = create_max_item(&collection, &owner, owner.clone())?;
+		// let perms = (0..b)
+		// 	.map(|k| PropertyKeyPermission {
+		// 		key: property_key(k as usize),
+		// 		permission: PropertyPermission {
+		// 			mutable: false,
+		// 			collection_admin: true,
+		// 			token_owner: true,
+		// 		},
+		// 	})
+		// 	.collect::<Vec<_>>();
+		// <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+		#[block]
+		{}
+		// let props = (0..b)
+		// 	.map(|k| Property {
+		// 		key: property_key(k as usize),
+		// 		value: property_value(),
+		// 	})
+		// 	.collect::<Vec<_>>();
+		// let item = create_max_item(&collection, &owner, owner.clone())?;
 
-		let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner);
-	}: {
-		let mut property_writer = pallet_common::collection_info_loaded_property_writer(
-			&collection,
-			is_collection_admin,
-			property_permissions,
-		);
+		// let (is_collection_admin, property_permissions) =
+		// 	load_is_admin_and_property_permissions(&collection, &owner);
+		// #[block]
+		// {
+		// 	let mut property_writer =
+		// 		pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);
 
-		property_writer.write_token_properties(
-			true,
-			item,
-			props.into_iter(),
-			crate::erc::ERC721TokenEvent::TokenChanged {
-				token_id: item.into(),
-			}
-			.to_log(T::ContractAddress::get()),
-		)?
+		// 	property_writer.write_token_properties(
+		// 		item,
+		// 		props.into_iter(),
+		// 		crate::erc::ERC721TokenEvent::TokenChanged {
+		// 			token_id: item.into(),
+		// 		}
+		// 		.to_log(T::ContractAddress::get()),
+		// 	)?;
+		// }
+
+		Ok(())
 	}
 
-	delete_token_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+	#[benchmark]
+	fn delete_token_properties(
+		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: true,
-				collection_admin: true,
-				token_owner: true,
-			},
-		}).collect::<Vec<_>>();
+		let perms = (0..b)
+			.map(|k| PropertyKeyPermission {
+				key: property_key(k as usize),
+				permission: PropertyPermission {
+					mutable: true,
+					collection_admin: true,
+					token_owner: true,
+				},
+			})
+			.collect::<Vec<_>>();
 		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b).map(|k| Property {
-			key: property_key(k as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
+		let props = (0..b)
+			.map(|k| Property {
+				key: property_key(k as usize),
+				value: property_value(),
+			})
+			.collect::<Vec<_>>();
 		let item = create_max_item(&collection, &owner, owner.clone())?;
-		<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?;
+		<Pallet<T>>::set_token_properties(
+			&collection,
+			&owner,
+			item,
+			props.into_iter(),
+			&Unlimited,
+		)?;
 		let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
-	}: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}
 
-	token_owner {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::delete_token_properties(
+				&collection,
+				&owner,
+				item,
+				to_delete.into_iter(),
+				&Unlimited,
+			)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn token_owner() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
 		let item = create_max_item(&collection, &owner, owner.clone())?;
-	}: {collection.token_owner(item).unwrap()}
 
-	set_allowance_for_all {
-		bench_init!{
+		#[block]
+		{
+			collection.token_owner(item).unwrap();
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_allowance_for_all() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner); owner: cross_from_sub;
 			operator: cross_sub;
 		};
-	}: {<Pallet<T>>::set_allowance_for_all(&collection, &owner, &operator, true)?}
 
-	allowance_for_all {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance_for_all(&collection, &owner, &operator, true)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn allowance_for_all() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner); owner: cross_from_sub;
 			operator: cross_sub;
 		};
-	}: {<Pallet<T>>::allowance_for_all(&collection, &owner, &operator)}
 
-	repair_item {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::allowance_for_all(&collection, &owner, &operator);
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn repair_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
 		let item = create_max_item(&collection, &owner, owner.clone())?;
-	}: {<Pallet<T>>::repair_item(&collection, item)?}
+
+		#[block]
+		{
+			<Pallet<T>>::repair_item(&collection, item)?;
+		}
+
+		Ok(())
+	}
 }
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -16,11 +16,12 @@
 
 use core::{convert::TryInto, iter::IntoIterator};
 
-use frame_benchmarking::{account, benchmarks};
+use frame_benchmarking::v2::*;
 use pallet_common::{
 	bench_init,
 	benchmarking::{
-		create_collection_raw, load_is_admin_and_property_permissions, property_key, property_value,
+		create_collection_raw, /*load_is_admin_and_property_permissions,*/ property_key,
+		property_value,
 	},
 };
 use sp_std::prelude::*;
@@ -68,38 +69,70 @@
 	)
 }
 
-benchmarks! {
-	create_item {
-		bench_init!{
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn create_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
-	}: {create_max_item(&collection, &sender, [(to.clone(), 200)])?}
 
-	create_multiple_items {
-		let b in 0..MAX_ITEMS_PER_BATCH;
-		bench_init!{
+		#[block]
+		{
+			create_max_item(&collection, &sender, [(to, 200)])?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn create_multiple_items(b: Linear<0, MAX_ITEMS_PER_BATCH>) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
-		let data = (0..b).map(|_| create_max_item_data::<T>([(to.clone(), 200)])).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
+		let data = (0..b)
+			.map(|_| create_max_item_data::<T>([(to.clone(), 200)]))
+			.collect();
+
+		#[block]
+		{
+			<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?;
+		}
 
-	create_multiple_items_ex_multiple_items {
-		let b in 0..MAX_ITEMS_PER_BATCH;
-		bench_init!{
+		Ok(())
+	}
+	#[benchmark]
+	fn create_multiple_items_ex_multiple_items(
+		b: Linear<0, MAX_ITEMS_PER_BATCH>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner);
 		};
-		let data = (0..b).map(|t| {
-			bench_init!(to: cross_sub(t););
-			create_max_item_data::<T>([(to, 200)])
-		}).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
+		let data = (0..b)
+			.map(|t| {
+				bench_init!(to: cross_sub(t););
+				create_max_item_data::<T>([(to, 200)])
+			})
+			.collect();
+
+		#[block]
+		{
+			<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?;
+		}
+
+		Ok(())
+	}
 
-	create_multiple_items_ex_multiple_owners {
-		let b in 0..MAX_ITEMS_PER_BATCH;
-		bench_init!{
+	#[benchmark]
+	fn create_multiple_items_ex_multiple_owners(
+		b: Linear<0, MAX_ITEMS_PER_BATCH>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner);
 		};
@@ -107,258 +140,531 @@
 			bench_init!(to: cross_sub(u););
 			(to, 200)
 		}))];
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
+		#[block]
+		{
+			<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
 	// Other user left, token data is kept
-	burn_item_partial {
-		bench_init!{
+	#[benchmark]
+	fn burn_item_partial() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); burner: cross_sub; another_owner: cross_sub;
 		};
-		let item = create_max_item(&collection, &sender, [(burner.clone(), 200), (another_owner, 200)])?;
-	}: {<Pallet<T>>::burn(&collection, &burner, item, 200)?}
+		let item = create_max_item(
+			&collection,
+			&sender,
+			[(burner.clone(), 200), (another_owner, 200)],
+		)?;
+
+		#[block]
+		{
+			<Pallet<T>>::burn(&collection, &burner, item, 200)?;
+		}
+
+		Ok(())
+	}
+
 	// No users remaining, token is destroyed
-	burn_item_fully {
-		bench_init!{
+	#[benchmark]
+	fn burn_item_fully() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
-			sender: cross_from_sub(owner); burner: cross_sub; another_owner: cross_sub;
+			sender: cross_from_sub(owner); burner: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(burner.clone(), 200)])?;
-	}: {<Pallet<T>>::burn(&collection, &burner, item, 200)?}
 
-	transfer_normal {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::burn(&collection, &burner, item, 200)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn transfer_normal() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
-		let item = create_max_item(&collection, &sender, [(sender.clone(), 200), (receiver.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?}
+		let item = create_max_item(
+			&collection,
+			&sender,
+			[(sender.clone(), 200), (receiver.clone(), 200)],
+		)?;
+
+		#[block]
+		{
+			<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
 	// Target account is created
-	transfer_creating {
-		bench_init!{
+	#[benchmark]
+	fn transfer_creating() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(sender.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?}
+
+		#[block]
+		{
+			<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
 	// Source account is destroyed
-	transfer_removing {
-		bench_init!{
+	#[benchmark]
+	fn transfer_removing() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
-		let item = create_max_item(&collection, &sender, [(sender.clone(), 200), (receiver.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?}
+		let item = create_max_item(
+			&collection,
+			&sender,
+			[(sender.clone(), 200), (receiver.clone(), 200)],
+		)?;
+
+		#[block]
+		{
+			<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
 	// Source account destroyed, target created
-	transfer_creating_removing {
-		bench_init!{
+	#[benchmark]
+	fn transfer_creating_removing() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(sender.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?}
 
-	approve {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn approve() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
-	}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 100)?}
 
-	approve_from {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 100)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn approve_from() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
 		let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
 		let item = create_max_item(&collection, &owner, [(owner_eth.clone(), 200)])?;
-	}: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, item, 100)?}
 
-	transfer_from_normal {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, item, 100)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn transfer_from_normal() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
 		};
-		let item = create_max_item(&collection, &owner, [(sender.clone(), 200), (receiver.clone(), 200)])?;
+		let item = create_max_item(
+			&collection,
+			&owner,
+			[(sender.clone(), 200), (receiver.clone(), 200)],
+		)?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 100)?;
-	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, 100, &Unlimited)?}
+
+		#[block]
+		{
+			<Pallet<T>>::transfer_from(
+				&collection,
+				&spender,
+				&sender,
+				&receiver,
+				item,
+				100,
+				&Unlimited,
+			)?;
+		}
+
+		Ok(())
+	}
+
 	// Target account is created
-	transfer_from_creating {
-		bench_init!{
+	#[benchmark]
+	fn transfer_from_creating() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 100)?;
-	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, 100, &Unlimited)?}
+
+		#[block]
+		{
+			<Pallet<T>>::transfer_from(
+				&collection,
+				&spender,
+				&sender,
+				&receiver,
+				item,
+				100,
+				&Unlimited,
+			)?;
+		}
+
+		Ok(())
+	}
+
 	// Source account is destroyed
-	transfer_from_removing {
-		bench_init!{
+	#[benchmark]
+	fn transfer_from_removing() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
 		};
-		let item = create_max_item(&collection, &owner, [(sender.clone(), 200), (receiver.clone(), 200)])?;
+		let item = create_max_item(
+			&collection,
+			&owner,
+			[(sender.clone(), 200), (receiver.clone(), 200)],
+		)?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 200)?;
-	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, 200, &Unlimited)?}
+
+		#[block]
+		{
+			<Pallet<T>>::transfer_from(
+				&collection,
+				&spender,
+				&sender,
+				&receiver,
+				item,
+				200,
+				&Unlimited,
+			)?;
+		}
+
+		Ok(())
+	}
+
 	// Source account destroyed, target created
-	transfer_from_creating_removing {
-		bench_init!{
+	#[benchmark]
+	fn transfer_from_creating_removing() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 200)?;
-	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, 200, &Unlimited)?}
 
+		#[block]
+		{
+			<Pallet<T>>::transfer_from(
+				&collection,
+				&spender,
+				&sender,
+				&receiver,
+				item,
+				200,
+				&Unlimited,
+			)?;
+		}
+
+		Ok(())
+	}
+
 	// Both source account and token is destroyed
-	burn_from {
-		bench_init!{
+	#[benchmark]
+	fn burn_from() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &burner, item, 200)?;
-	}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200, &Unlimited)?}
 
-	set_token_property_permissions {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200, &Unlimited)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_token_property_permissions(
+		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: false,
-				collection_admin: false,
-				token_owner: false,
-			},
-		}).collect::<Vec<_>>();
-	}: {<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?}
+		let perms = (0..b)
+			.map(|k| PropertyKeyPermission {
+				key: property_key(k as usize),
+				permission: PropertyPermission {
+					mutable: false,
+					collection_admin: false,
+					token_owner: false,
+				},
+			})
+			.collect::<Vec<_>>();
+
+		#[block]
+		{
+			<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+		}
+
+		Ok(())
+	}
 
-	set_token_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+	#[benchmark]
+	fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: false,
-				collection_admin: true,
-				token_owner: true,
-			},
-		}).collect::<Vec<_>>();
+		let perms = (0..b)
+			.map(|k| PropertyKeyPermission {
+				key: property_key(k as usize),
+				permission: PropertyPermission {
+					mutable: false,
+					collection_admin: true,
+					token_owner: true,
+				},
+			})
+			.collect::<Vec<_>>();
 		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b).map(|k| Property {
-			key: property_key(k as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
+		let props = (0..b)
+			.map(|k| Property {
+				key: property_key(k as usize),
+				value: property_value(),
+			})
+			.collect::<Vec<_>>();
 		let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
-	}: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?}
 
-	init_token_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
-			owner: sub; collection: collection(owner);
-			owner: cross_from_sub;
-		};
+		#[block]
+		{
+			<Pallet<T>>::set_token_properties(
+				&collection,
+				&owner,
+				item,
+				props.into_iter(),
+				&Unlimited,
+			)?;
+		}
 
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: false,
-				collection_admin: true,
-				token_owner: true,
-			},
-		}).collect::<Vec<_>>();
-		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b).map(|k| Property {
-			key: property_key(k as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
-		let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+		Ok(())
+	}
 
-		let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner);
-	}: {
-		let mut property_writer = pallet_common::collection_info_loaded_property_writer(
-			&collection,
-			is_collection_admin,
-			property_permissions,
-		);
+	// TODO:
+	#[benchmark]
+	fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+		// bench_init! {
+		// 	owner: sub; collection: collection(owner);
+		// 	owner: cross_from_sub;
+		// };
 
-		property_writer.write_token_properties(
-			true,
-			item,
-			props.into_iter(),
-			crate::erc::ERC721TokenEvent::TokenChanged {
-				token_id: item.into(),
-			}
-			.to_log(T::ContractAddress::get()),
-		)?
+		// let perms = (0..b)
+		// 	.map(|k| PropertyKeyPermission {
+		// 		key: property_key(k as usize),
+		// 		permission: PropertyPermission {
+		// 			mutable: false,
+		// 			collection_admin: true,
+		// 			token_owner: true,
+		// 		},
+		// 	})
+		// 	.collect::<Vec<_>>();
+		// <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+
+		#[block]
+		{}
+		// let props = (0..b).map(|k| Property {
+		// 	key: property_key(k as usize),
+		// 	value: property_value(),
+		// }).collect::<Vec<_>>();
+		// let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+
+		// let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner)
+		// let mut property_writer = pallet_common::collection_info_loaded_property_writer(
+		// 	&collection,
+		// 	is_collection_admin,
+		// 	property_permissions,
+		// );
+
+		// #[block]
+		// {
+		// 	property_writer.write_token_properties(
+		// 		true,
+		// 		item,
+		// 		props.into_iter(),
+		// 		crate::erc::ERC721TokenEvent::TokenChanged {
+		// 			token_id: item.into(),
+		// 		}
+		// 		.to_log(T::ContractAddress::get()),
+		// 	)?;
+		// }
+
+		Ok(())
 	}
 
-	delete_token_properties {
-		let b in 0..MAX_PROPERTIES_PER_ITEM;
-		bench_init!{
+	#[benchmark]
+	fn delete_token_properties(
+		b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
+	) -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
-		let perms = (0..b).map(|k| PropertyKeyPermission {
-			key: property_key(k as usize),
-			permission: PropertyPermission {
-				mutable: true,
-				collection_admin: true,
-				token_owner: true,
-			},
-		}).collect::<Vec<_>>();
+		let perms = (0..b)
+			.map(|k| PropertyKeyPermission {
+				key: property_key(k as usize),
+				permission: PropertyPermission {
+					mutable: true,
+					collection_admin: true,
+					token_owner: true,
+				},
+			})
+			.collect::<Vec<_>>();
 		<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-		let props = (0..b).map(|k| Property {
-			key: property_key(k as usize),
-			value: property_value(),
-		}).collect::<Vec<_>>();
+		let props = (0..b)
+			.map(|k| Property {
+				key: property_key(k as usize),
+				value: property_value(),
+			})
+			.collect::<Vec<_>>();
 		let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
-		<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?;
+		<Pallet<T>>::set_token_properties(
+			&collection,
+			&owner,
+			item,
+			props.into_iter(),
+			&Unlimited,
+		)?;
 		let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
-	}: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}
 
-	repartition_item {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::delete_token_properties(
+				&collection,
+				&owner,
+				item,
+				to_delete.into_iter(),
+				&Unlimited,
+			)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn repartition_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); owner: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
-	}: {<Pallet<T>>::repartition(&collection, &owner, item, 200)?}
 
-	token_owner {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::repartition(&collection, &owner, item, 200)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn token_owner() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); owner: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(owner, 100)])?;
-	}: {<Pallet<T>>::token_owner(collection.id, item).unwrap()}
 
-	set_allowance_for_all {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::token_owner(collection.id, item).unwrap();
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_allowance_for_all() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner); owner: cross_from_sub;
 			operator: cross_sub;
 		};
-	}: {<Pallet<T>>::set_allowance_for_all(&collection, &owner, &operator, true)?}
 
-	allowance_for_all {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::set_allowance_for_all(&collection, &owner, &operator, true)?;
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn allowance_for_all() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner); owner: cross_from_sub;
 			operator: cross_sub;
 		};
-	}: {<Pallet<T>>::allowance_for_all(&collection, &owner, &operator)}
 
-	repair_item {
-		bench_init!{
+		#[block]
+		{
+			<Pallet<T>>::allowance_for_all(&collection, &owner, &operator);
+		}
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn repair_item() -> Result<(), BenchmarkError> {
+		bench_init! {
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub;
 		};
 		let item = create_max_item(&collection, &owner, [(owner.clone(), 100)])?;
-	}: {<Pallet<T>>::repair_item(&collection, item)?}
+
+		#[block]
+		{
+			<Pallet<T>>::repair_item(&collection, item)?;
+		}
+
+		Ok(())
+	}
 }
modifiedpallets/structure/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/structure/src/benchmarking.rs
+++ b/pallets/structure/src/benchmarking.rs
@@ -14,10 +14,11 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_benchmarking::{account, benchmarks};
+use frame_benchmarking::v2::{account, benchmarks, BenchmarkError};
 use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};
 use pallet_common::Config as CommonConfig;
 use pallet_evm::account::CrossAccountId;
+use sp_std::vec;
 use up_data_structs::{
 	budget::Unlimited, CollectionMode, CreateCollectionData, CreateItemData, CreateNftData,
 };
@@ -26,12 +27,21 @@
 
 const SEED: u32 = 1;
 
-benchmarks! {
-	find_parent {
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn find_parent() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let caller_cross = T::CrossAccountId::from_sub(caller.clone());
 
-		let _ = <T as CommonConfig>::Currency::deposit(&caller, T::CollectionCreationPrice::get(), Precision::Exact).unwrap();
+		let _ = <T as CommonConfig>::Currency::deposit(
+			&caller,
+			T::CollectionCreationPrice::get(),
+			Precision::Exact,
+		)
+		.unwrap();
 		T::CollectionDispatch::create(
 			caller_cross.clone(),
 			caller_cross.clone(),
@@ -43,9 +53,19 @@
 		let dispatch = T::CollectionDispatch::dispatch(CollectionId(1))?;
 		let dispatch = dispatch.as_dyn();
 
-		dispatch.create_item(caller_cross.clone(), caller_cross, CreateItemData::NFT(CreateNftData::default()), &Unlimited)?;
-	}: {
-		let parent = <Pallet<T>>::find_parent(CollectionId(1), TokenId(1))?;
-		assert!(matches!(parent, Parent::User(_)))
+		dispatch.create_item(
+			caller_cross.clone(),
+			caller_cross,
+			CreateItemData::NFT(CreateNftData::default()),
+			&Unlimited,
+		)?;
+
+		#[block]
+		{
+			let parent = <Pallet<T>>::find_parent(CollectionId(1), TokenId(1))?;
+			assert!(matches!(parent, Parent::User(_)));
+		}
+
+		Ok(())
 	}
 }
modifiedpallets/unique/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/unique/src/benchmarking.rs
+++ b/pallets/unique/src/benchmarking.rs
@@ -16,7 +16,7 @@
 
 #![cfg(feature = "runtime-benchmarks")]
 
-use frame_benchmarking::{account, benchmarks};
+use frame_benchmarking::v2::{account, benchmarks, BenchmarkError};
 use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};
 use frame_system::RawOrigin;
 use pallet_common::{
@@ -25,6 +25,7 @@
 	Config as CommonConfig,
 };
 use sp_runtime::DispatchError;
+use sp_std::vec;
 use up_data_structs::{
 	CollectionId, CollectionLimits, CollectionMode, MAX_COLLECTION_DESCRIPTION_LENGTH,
 	MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
@@ -63,81 +64,197 @@
 	create_collection_helper::<T>(owner, CollectionMode::NFT)
 }
 
-benchmarks! {
-	create_collection {
-		let col_name = create_u16_data::<{MAX_COLLECTION_NAME_LENGTH}>();
-		let col_desc = create_u16_data::<{MAX_COLLECTION_DESCRIPTION_LENGTH}>();
-		let token_prefix = create_data::<{MAX_TOKEN_PREFIX_LENGTH}>();
+#[benchmarks]
+mod benchmarks {
+	use super::*;
+
+	#[benchmark]
+	fn create_collection() -> Result<(), BenchmarkError> {
+		let col_name = create_u16_data::<{ MAX_COLLECTION_NAME_LENGTH }>();
+		let col_desc = create_u16_data::<{ MAX_COLLECTION_DESCRIPTION_LENGTH }>();
+		let token_prefix = create_data::<{ MAX_TOKEN_PREFIX_LENGTH }>();
 		let mode: CollectionMode = CollectionMode::NFT;
 		let caller: T::AccountId = account("caller", 0, SEED);
-		let _ = <T as CommonConfig>::Currency::deposit(&caller, T::CollectionCreationPrice::get(), Precision::Exact).unwrap();
-	}: _(RawOrigin::Signed(caller.clone()), col_name, col_desc, token_prefix, mode)
-	verify {
-		assert_eq!(<pallet_common::CollectionById<T>>::get(CollectionId(1)).unwrap().owner, caller);
+		let _ = <T as CommonConfig>::Currency::deposit(
+			&caller,
+			T::CollectionCreationPrice::get(),
+			Precision::Exact,
+		)
+		.unwrap();
+
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller.clone()),
+			col_name,
+			col_desc,
+			token_prefix,
+			mode,
+		);
+
+		assert_eq!(
+			<pallet_common::CollectionById<T>>::get(CollectionId(1))
+				.unwrap()
+				.owner,
+			caller
+		);
+
+		Ok(())
 	}
 
-	destroy_collection {
+	#[benchmark]
+	fn destroy_collection() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
-	}: _(RawOrigin::Signed(caller.clone()), collection)
 
-	add_to_allow_list {
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), collection);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn add_to_allow_list() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let allowlist_account: T::AccountId = account("admin", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
-	}: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(allowlist_account))
 
-	remove_from_allow_list {
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			collection,
+			T::CrossAccountId::from_sub(allowlist_account),
+		);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn remove_from_allow_list() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let allowlist_account: T::AccountId = account("admin", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
-		<Pallet<T>>::add_to_allow_list(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(allowlist_account.clone()))?;
-	}: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(allowlist_account))
+		<Pallet<T>>::add_to_allow_list(
+			RawOrigin::Signed(caller.clone()).into(),
+			collection,
+			T::CrossAccountId::from_sub(allowlist_account.clone()),
+		)?;
 
-	change_collection_owner {
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			collection,
+			T::CrossAccountId::from_sub(allowlist_account),
+		);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn change_collection_owner() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
 		let new_owner: T::AccountId = account("admin", 0, SEED);
-	}: _(RawOrigin::Signed(caller.clone()), collection, new_owner)
 
-	add_collection_admin {
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), collection, new_owner);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn add_collection_admin() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
 		let new_admin: T::AccountId = account("admin", 0, SEED);
-	}: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(new_admin))
 
-	remove_collection_admin {
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			collection,
+			T::CrossAccountId::from_sub(new_admin),
+		);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn remove_collection_admin() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
 		let new_admin: T::AccountId = account("admin", 0, SEED);
-		<Pallet<T>>::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(new_admin.clone()))?;
-	}: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(new_admin))
+		<Pallet<T>>::add_collection_admin(
+			RawOrigin::Signed(caller.clone()).into(),
+			collection,
+			T::CrossAccountId::from_sub(new_admin.clone()),
+		)?;
 
-	set_collection_sponsor {
+		#[extrinsic_call]
+		_(
+			RawOrigin::Signed(caller),
+			collection,
+			T::CrossAccountId::from_sub(new_admin),
+		);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_collection_sponsor() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
-	}: _(RawOrigin::Signed(caller.clone()), collection, caller.clone())
 
-	confirm_sponsorship {
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), collection, caller.clone());
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn confirm_sponsorship() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
-		<Pallet<T>>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), collection, caller.clone())?;
-	}: _(RawOrigin::Signed(caller.clone()), collection)
+		<Pallet<T>>::set_collection_sponsor(
+			RawOrigin::Signed(caller.clone()).into(),
+			collection,
+			caller.clone(),
+		)?;
+
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), collection);
+
+		Ok(())
+	}
 
-	remove_collection_sponsor {
+	#[benchmark]
+	fn remove_collection_sponsor() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
-		<Pallet<T>>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), collection, caller.clone())?;
+		<Pallet<T>>::set_collection_sponsor(
+			RawOrigin::Signed(caller.clone()).into(),
+			collection,
+			caller.clone(),
+		)?;
 		<Pallet<T>>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), collection)?;
-	}: _(RawOrigin::Signed(caller.clone()), collection)
 
-	set_transfers_enabled_flag {
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), collection);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_transfers_enabled_flag() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
-	}: _(RawOrigin::Signed(caller.clone()), collection, false)
 
+		#[extrinsic_call]
+		_(RawOrigin::Signed(caller), collection, false);
 
-	set_collection_limits {
+		Ok(())
+	}
+
+	#[benchmark]
+	fn set_collection_limits() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller.clone())?;
 
@@ -152,10 +269,21 @@
 			sponsored_data_rate_limit: None,
 			transfers_enabled: Some(true),
 		};
-	}: set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl)
 
-	force_repair_collection {
+		#[extrinsic_call]
+		set_collection_limits(RawOrigin::Signed(caller), collection, cl);
+
+		Ok(())
+	}
+
+	#[benchmark]
+	fn force_repair_collection() -> Result<(), BenchmarkError> {
 		let caller: T::AccountId = account("caller", 0, SEED);
 		let collection = create_nft_collection::<T>(caller)?;
-	}: _(RawOrigin::Root, collection)
+
+		#[extrinsic_call]
+		_(RawOrigin::Root, collection);
+
+		Ok(())
+	}
 }
modifiedruntime/common/config/xcm/foreignassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -77,19 +77,18 @@
 		let here_id =
 			ConvertAssetId::convert(&AssetId::NativeAssetId(NativeCurrency::Here)).unwrap();
 
-		if asset_id.clone() == parent_id {
+		if *asset_id == parent_id {
 			return Some(MultiLocation::parent());
 		}
 
-		if asset_id.clone() == here_id {
+		if *asset_id == here_id {
 			return Some(MultiLocation::new(
 				1,
 				X1(Parachain(ParachainInfo::get().into())),
 			));
 		}
 
-		let fid =
-			<AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(asset_id.clone())?;
+		let fid = <AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(*asset_id)?;
 		XcmForeignAssetIdMapping::<Runtime>::get_multi_location(fid)
 	}
 }
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -569,7 +569,8 @@
 				fn dispatch_benchmark(
 					config: frame_benchmarking::BenchmarkConfig
 				) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
-					use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
+					use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
+					use sp_storage::TrackedStorageKey;
 
 					let allowlist: Vec<TrackedStorageKey> = vec![
 						// Total Issuance
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -136,6 +136,7 @@
 	'sp-runtime/std',
 	'sp-session/std',
 	'sp-std/std',
+    'sp-storage/std',
 	'sp-transaction-pool/std',
 	'sp-version/std',
 	'staging-xcm-builder/std',
@@ -279,6 +280,7 @@
 sp-runtime = { workspace = true }
 sp-session = { workspace = true }
 sp-std = { workspace = true }
+sp-storage = { workspace = true }
 sp-transaction-pool = { workspace = true }
 sp-version = { workspace = true }
 staging-xcm = { workspace = true }
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -271,6 +271,7 @@
 sp-runtime = { workspace = true }
 sp-session = { workspace = true }
 sp-std = { workspace = true }
+sp-storage = { workspace = true }
 sp-transaction-pool = { workspace = true }
 sp-version = { workspace = true }
 staging-xcm = { workspace = true }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -274,6 +274,7 @@
 sp-runtime = { workspace = true }
 sp-session = { workspace = true }
 sp-std = { workspace = true }
+sp-storage = { workspace = true }
 sp-transaction-pool = { workspace = true }
 sp-version = { workspace = true }
 staging-xcm = { workspace = true }
modifiedtests/src/maintenance.seqtest.tsdiffbeforeafterboth
--- a/tests/src/maintenance.seqtest.ts
+++ b/tests/src/maintenance.seqtest.ts
@@ -283,87 +283,6 @@
     });
   });
 
-  describe('Preimage Execution', () => {
-    const preimageHashes: string[] = [];
-
-    before(async function() {
-      await usingPlaygrounds(async (helper) => {
-        requirePalletsOrSkip(this, helper, [Pallets.Preimage, Pallets.Maintenance]);
-
-        // create a preimage to be operated with in the tests
-        const randomAccounts = await helper.arrange.createCrowd(10, 0n, superuser);
-        const randomIdentities = randomAccounts.map((acc, i) => [
-          acc.address, {
-            deposit: 0n,
-            judgements: [],
-            info: {
-              display: {
-                raw: `Random Account #${i}`,
-              },
-            },
-          },
-        ]);
-        const preimage = helper.constructApiCall('api.tx.identity.forceInsertIdentities', [randomIdentities]).method.toHex();
-        preimageHashes.push(await helper.preimage.notePreimage(bob, preimage, true));
-      });
-    });
-
-    itSub('Successfully executes call in a preimage', async ({helper}) => {
-      const result = await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
-        preimageHashes[0], {refTime: 10000000000, proofSize: 10000},
-      ])).to.be.fulfilled;
-
-      // preimage is executed, and an appropriate event is present
-      const events = result.result.events.filter((x: any) => x.event.method === 'IdentitiesInserted' && x.event.section === 'identity');
-      expect(events.length).to.be.equal(1);
-
-      // the preimage goes back to being unrequested
-      expect(await helper.preimage.getPreimageInfo(preimageHashes[0])).to.have.property('unrequested');
-    });
-
-    itSub('Does not allow execution of a preimage that would fail', async ({helper}) => {
-      const [zeroAccount] = await helper.arrange.createAccounts([0n], superuser);
-
-      const preimage = helper.constructApiCall('api.tx.balances.forceTransfer', [
-        {Id: zeroAccount.address}, {Id: superuser.address}, 1000n,
-      ]).method.toHex();
-      const preimageHash = await helper.preimage.notePreimage(bob, preimage, true);
-      preimageHashes.push(preimageHash);
-
-      await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
-        preimageHash, {refTime: 10000000000, proofSize: 10000},
-      ])).to.be.rejectedWith(/^Token: FundsUnavailable$/);
-    });
-
-    itSub('Does not allow preimage execution with non-root', async ({helper}) => {
-      await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.executePreimage', [
-        preimageHashes[0], {refTime: 10000000000, proofSize: 10000},
-      ])).to.be.rejectedWith(/^Misc: BadOrigin$/);
-    });
-
-    itSub('Does not allow execution of non-existent preimages', async ({helper}) => {
-      await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
-        '0x1010101010101010101010101010101010101010101010101010101010101010', {refTime: 10000000000, proofSize: 10000},
-      ])).to.be.rejectedWith(/^Misc: Unavailable$/);
-    });
-
-    itSub('Does not allow preimage execution with less than minimum weights', async ({helper}) => {
-      await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
-        preimageHashes[0], {refTime: 1000, proofSize: 100},
-      ])).to.be.rejectedWith(/^Misc: Exhausted$/);
-    });
-
-    after(async function() {
-      await usingPlaygrounds(async (helper) => {
-        if(helper.fetchMissingPalletNames([Pallets.Preimage, Pallets.Maintenance]).length != 0) return;
-
-        for(const hash of preimageHashes) {
-          await helper.preimage.unnotePreimage(bob, hash);
-        }
-      });
-    });
-  });
-
   describe('Integration Test: Maintenance mode & App Promo', () => {
     let superuser: IKeyringPair;