git.delta.rocks / unique-network / refs/commits / a64769ff6bff

difftreelog

refactor upgrade code for new substrate

Yaroslav Bolyukin2023-10-02parent: #c318883.patch.diff
in: master

39 files changed

modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -153,11 +153,12 @@
 	) => {{
 		use $runtime::*;
 
-		GenesisConfig {
+		RuntimeGenesisConfig {
 			system: SystemConfig {
 				code: WASM_BINARY
 					.expect("WASM binary was not build, please build it!")
 					.to_vec(),
+				..Default::default()
 			},
 			balances: BalancesConfig {
 				balances: $endowed_accounts
@@ -167,10 +168,6 @@
 					.map(|k| (k, 1 << 100))
 					.collect(),
 			},
-			common: Default::default(),
-			configuration: Default::default(),
-			nonfungible: Default::default(),
-			treasury: Default::default(),
 			tokens: TokensConfig { balances: vec![] },
 			sudo: SudoConfig {
 				key: Some($root_key),
@@ -179,8 +176,8 @@
 			vesting: VestingConfig { vesting: vec![] },
 			parachain_info: ParachainInfoConfig {
 				parachain_id: $id.into(),
+				..Default::default()
 			},
-			parachain_system: Default::default(),
 			collator_selection: CollatorSelectionConfig {
 				invulnerables: $initial_invulnerables
 					.iter()
@@ -200,14 +197,10 @@
 					})
 					.collect(),
 			},
-			aura: Default::default(),
-			aura_ext: Default::default(),
 			evm: EVMConfig {
 				accounts: BTreeMap::new(),
+				..Default::default()
 			},
-			ethereum: EthereumConfig {},
-			polkadot_xcm: Default::default(),
-			transaction_payment: Default::default(),
 			..Default::default()
 		}
 	}};
@@ -224,15 +217,13 @@
 	) => {{
 		use $runtime::*;
 
-		GenesisConfig {
+		RuntimeGenesisConfig {
 			system: SystemConfig {
 				code: WASM_BINARY
 					.expect("WASM binary was not build, please build it!")
 					.to_vec(),
+				..Default::default()
 			},
-			common: Default::default(),
-			configuration: Default::default(),
-			nonfungible: Default::default(),
 			balances: BalancesConfig {
 				balances: $endowed_accounts
 					.iter()
@@ -241,7 +232,6 @@
 					.map(|k| (k, 1 << 100))
 					.collect(),
 			},
-			treasury: Default::default(),
 			tokens: TokensConfig { balances: vec![] },
 			sudo: SudoConfig {
 				key: Some($root_key),
@@ -249,21 +239,19 @@
 			vesting: VestingConfig { vesting: vec![] },
 			parachain_info: ParachainInfoConfig {
 				parachain_id: $id.into(),
+				Default::default()
 			},
-			parachain_system: Default::default(),
 			aura: AuraConfig {
 				authorities: $initial_invulnerables
 					.into_iter()
 					.map(|(_, aura)| aura)
 					.collect(),
 			},
-			aura_ext: Default::default(),
 			evm: EVMConfig {
 				accounts: BTreeMap::new(),
+				..Default::default()
 			},
-			ethereum: EthereumConfig {},
-			polkadot_xcm: Default::default(),
-			transaction_payment: Default::default(),
+			..Default::default()
 		}
 	}};
 }
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -135,19 +135,6 @@
 	fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
 		load_spec(id)
 	}
-
-	fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
-		match chain_spec.runtime_id() {
-			#[cfg(feature = "unique-runtime")]
-			RuntimeId::Unique => &unique_runtime::VERSION,
-
-			#[cfg(feature = "quartz-runtime")]
-			RuntimeId::Quartz => &quartz_runtime::VERSION,
-
-			RuntimeId::Opal => &opal_runtime::VERSION,
-			runtime_id => panic!("{}", no_runtime_err!(runtime_id)),
-		}
-	}
 }
 
 impl SubstrateCli for RelayChainCli {
@@ -184,25 +171,21 @@
 
 	fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
 		polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
-	}
-
-	fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
-		polkadot_cli::Cli::native_runtime_version(chain_spec)
 	}
 }
 
 macro_rules! async_run_with_runtime {
 	(
-		$runtime_api:path, $executor:path,
+		$runtime:path, $runtime_api:path, $executor:path,
 		$runner:ident, $components:ident, $cli:ident, $cmd:ident, $config:ident,
 		$( $code:tt )*
 	) => {
 		$runner.async_run(|$config| {
 			let $components = new_partial::<
-				$runtime_api, $executor, _
+				$runtime, $runtime_api, $executor, _
 			>(
 				&$config,
-				crate::service::parachain_build_import_queue,
+				crate::service::parachain_build_import_queue::<$runtime, _, _>,
 			)?;
 			let task_manager = $components.task_manager;
 
@@ -218,18 +201,18 @@
 		match runner.config().chain_spec.runtime_id() {
 			#[cfg(feature = "unique-runtime")]
 			RuntimeId::Unique => async_run_with_runtime!(
-				unique_runtime::RuntimeApi, UniqueRuntimeExecutor,
+				unique_runtime::Runtime, unique_runtime::RuntimeApi, UniqueRuntimeExecutor,
 				runner, $components, $cli, $cmd, $config, $( $code )*
 			),
 
 			#[cfg(feature = "quartz-runtime")]
 			RuntimeId::Quartz => async_run_with_runtime!(
-				quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,
+				quartz_runtime::Runtime, quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,
 				runner, $components, $cli, $cmd, $config, $( $code )*
 			),
 
 			RuntimeId::Opal => async_run_with_runtime!(
-				opal_runtime::RuntimeApi, OpalRuntimeExecutor,
+				opal_runtime::Runtime, opal_runtime::RuntimeApi, OpalRuntimeExecutor,
 				runner, $components, $cli, $cmd, $config, $( $code )*
 			),
 
@@ -240,11 +223,18 @@
 
 macro_rules! sync_run_with_runtime {
 	(
-		$runtime_api:path, $executor:path,
+		$runtime:path, $runtime_api:path, $executor:path,
 		$runner:ident, $components:ident, $cli:ident, $cmd:ident, $config:ident,
 		$( $code:tt )*
 	) => {
 		$runner.sync_run(|$config| {
+			let $components = new_partial::<
+				$runtime, $runtime_api, $executor, _
+			>(
+				&$config,
+				crate::service::parachain_build_import_queue::<$runtime, _, _>,
+			)?;
+
 			$( $code )*
 		})
 	};
@@ -257,18 +247,18 @@
 		match runner.config().chain_spec.runtime_id() {
 			#[cfg(feature = "unique-runtime")]
 			RuntimeId::Unique => sync_run_with_runtime!(
-				unique_runtime::RuntimeApi, UniqueRuntimeExecutor,
+				unique_runtime::Runtime, unique_runtime::RuntimeApi, UniqueRuntimeExecutor,
 				runner, $components, $cli, $cmd, $config, $( $code )*
 			),
 
 			#[cfg(feature = "quartz-runtime")]
 			RuntimeId::Quartz => sync_run_with_runtime!(
-				quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,
+				quartz_runtime::Runtime, quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,
 				runner, $components, $cli, $cmd, $config, $( $code )*
 			),
 
 			RuntimeId::Opal => sync_run_with_runtime!(
-				opal_runtime::RuntimeApi, OpalRuntimeExecutor,
+				opal_runtime::Runtime, opal_runtime::RuntimeApi, OpalRuntimeExecutor,
 				runner, $components, $cli, $cmd, $config, $( $code )*
 			),
 
@@ -362,12 +352,11 @@
 		Some(Subcommand::ExportGenesisState(cmd)) => {
 			construct_sync_run!(|components, cli, cmd, _config| {
 				let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
-				let state_version = Cli::native_runtime_version(&spec).state_version();
-				cmd.run::<Block>(&*spec, state_version)
+				cmd.run(&*spec, &*components.client)
 			})
 		}
 		Some(Subcommand::ExportGenesisWasm(cmd)) => {
-			construct_sync_run!(|components, cli, cmd, _config| {
+			construct_sync_run!(|_components, cli, cmd, _config| {
 				let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
 				cmd.run(&*spec)
 			})
@@ -411,6 +400,7 @@
 		#[cfg(feature = "try-runtime")]
 		Some(Subcommand::TryRuntime(cmd)) => {
 			use std::{future::Future, pin::Pin};
+
 			use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
 			use try_runtime_cli::block_building_info::timestamp_with_aura_info;
 
@@ -506,12 +496,6 @@
 					AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(
 						&para_id,
 					);
-
-				let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
-				let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
-					.map_err(|e| format!("{e:?}"))?;
-				let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
-				let genesis_hash = format!("0x{:?}", HexDisplay::from(&block.header().hash().0));
 
 				let polkadot_config = SubstrateCli::create_configuration(
 					&polkadot_cli,
@@ -522,9 +506,6 @@
 
 				info!("Parachain id: {:?}", para_id);
 				info!("Parachain Account: {}", parachain_account);
-				info!("Parachain genesis state: {}", genesis_state);
-				info!("Parachain genesis hash: {}", genesis_hash);
-				debug!("Parachain genesis block: {:?}", block);
 				info!(
 					"Is collating: {}",
 					if config.role.is_authority() {
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -185,7 +185,7 @@
 	}
 }
 
-pub fn open_frontier_backend<Block: BlockT, C: HeaderBackend<Block>>(
+pub fn open_frontier_backend<C: HeaderBackend<Block>>(
 	client: Arc<C>,
 	config: &Configuration,
 ) -> Result<Arc<fc_db::kv::Backend<Block>>, String> {
@@ -210,12 +210,42 @@
 type ParachainBlockImport<RuntimeApi, ExecutorDispatch> =
 	TParachainBlockImport<Block, Arc<FullClient<RuntimeApi, ExecutorDispatch>>, FullBackend>;
 
+/// Generate a supertrait based on bounds, and blanket impl for it.
+macro_rules! ez_bounds {
+	($vis:vis trait $name:ident$(<$($gen:ident $(: $($(+)? $bound:path)*)?),* $(,)?>)? $(:)? $($(+)? $super:path)* {}) => {
+		$vis trait $name $(<$($gen $(: $($bound+)*)?,)*>)?: $($super +)* {}
+		impl<T, $($($gen $(: $($bound+)*)?,)*)?> $name$(<$($gen,)*>)? for T
+		where T: $($super +)* {}
+	}
+}
+ez_bounds!(
+	pub trait RuntimeApiDep<Runtime: RuntimeInstance>:
+		sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+		+ sp_consensus_aura::AuraApi<Block, AuraId>
+		+ fp_rpc::EthereumRuntimeRPCApi<Block>
+		+ sp_session::SessionKeys<Block>
+		+ sp_block_builder::BlockBuilder<Block>
+		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+		+ sp_api::ApiExt<Block>
+		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
+		+ app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
+		+ up_pov_estimate_rpc::PovEstimateApi<Block>
+		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>
+		+ sp_api::Metadata<Block>
+		+ sp_offchain::OffchainWorkerApi<Block>
+		+ cumulus_primitives_core::CollectCollationInfo<Block>
+		// Deprecated, not used.
+		+ fp_rpc::ConvertTransactionRuntimeApi<Block>
+	{
+	}
+);
+
 /// Starts a `ServiceBuilder` for a full service.
 ///
 /// Use this macro if you don't actually need the full service, but just the builder in order to
 /// be able to perform chain operations.
 #[allow(clippy::type_complexity)]
-pub fn new_partial<RuntimeApi, ExecutorDispatch, BIQ>(
+pub fn new_partial<Runtime, RuntimeApi, ExecutorDispatch, BIQ>(
 	config: &Configuration,
 	build_import_queue: BIQ,
 ) -> Result<
@@ -223,7 +253,7 @@
 		FullClient<RuntimeApi, ExecutorDispatch>,
 		FullBackend,
 		FullSelectChain,
-		sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+		sc_consensus::DefaultImportQueue<Block>,
 		sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
 		OtherPartial,
 	>,
@@ -235,7 +265,8 @@
 		+ Send
 		+ Sync
 		+ 'static,
-	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
+	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+	Runtime: RuntimeInstance,
 	ExecutorDispatch: NativeExecutionDispatch + 'static,
 	BIQ: FnOnce(
 		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
@@ -243,10 +274,7 @@
 		&Configuration,
 		Option<TelemetryHandle>,
 		&TaskManager,
-	) -> Result<
-		sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
-		sc_service::Error,
-	>,
+	) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>,
 {
 	let telemetry = config
 		.telemetry_endpoints
@@ -317,35 +345,6 @@
 	};
 
 	Ok(params)
-}
-
-async fn build_relay_chain_interface(
-	polkadot_config: Configuration,
-	parachain_config: &Configuration,
-	telemetry_worker_handle: Option<TelemetryWorkerHandle>,
-	task_manager: &mut TaskManager,
-	collator_options: CollatorOptions,
-	hwbench: Option<sc_sysinfo::HwBench>,
-) -> RelayChainResult<(
-	Arc<(dyn RelayChainInterface + 'static)>,
-	Option<CollatorPair>,
-)> {
-	if collator_options.relay_chain_rpc_urls.is_empty() {
-		build_inprocess_relay_chain(
-			polkadot_config,
-			parachain_config,
-			telemetry_worker_handle,
-			task_manager,
-			hwbench,
-		)
-	} else {
-		build_minimal_relay_chain_node(
-			polkadot_config,
-			task_manager,
-			collator_options.relay_chain_rpc_urls,
-		)
-		.await
-	}
 }
 
 macro_rules! clone {
@@ -360,13 +359,11 @@
 ///
 /// This is the actual implementation that is abstract over the executor and the runtime api.
 #[sc_tracing::logging::prefix_logs_with("Parachain")]
-async fn start_node_impl<Runtime, RuntimeApi, ExecutorDispatch, BIQ, BIC>(
+pub async fn start_node<Runtime, RuntimeApi, ExecutorDispatch>(
 	parachain_config: Configuration,
 	polkadot_config: Configuration,
 	collator_options: CollatorOptions,
-	id: ParaId,
-	build_import_queue: BIQ,
-	build_consensus: BIC,
+	para_id: ParaId,
 	hwbench: Option<sc_sysinfo::HwBench>,
 ) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>
 where
@@ -378,48 +375,16 @@
 		+ Send
 		+ Sync
 		+ 'static,
-	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
-		+ fp_rpc::EthereumRuntimeRPCApi<Block>
-		+ fp_rpc::ConvertTransactionRuntimeApi<Block>
-		+ sp_session::SessionKeys<Block>
-		+ sp_block_builder::BlockBuilder<Block>
-		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
-		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
-		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
-		+ app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
-		+ up_pov_estimate_rpc::PovEstimateApi<Block>
-		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
-		+ sp_api::Metadata<Block>
-		+ sp_offchain::OffchainWorkerApi<Block>
-		+ cumulus_primitives_core::CollectCollationInfo<Block>,
+	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+	Runtime: RuntimeInstance,
 	ExecutorDispatch: NativeExecutionDispatch + 'static,
-	BIQ: FnOnce(
-		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
-		Arc<FullBackend>,
-		&Configuration,
-		Option<TelemetryHandle>,
-		&TaskManager,
-	) -> Result<
-		sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
-		sc_service::Error,
-	>,
-	BIC: FnOnce(
-		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
-		Arc<FullBackend>,
-		Option<&Registry>,
-		Option<TelemetryHandle>,
-		&TaskManager,
-		Arc<dyn RelayChainInterface>,
-		Arc<sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>>,
-		Arc<SyncingService<Block>>,
-		KeystorePtr,
-		bool,
-	) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
 {
 	let parachain_config = prepare_node_config(parachain_config);
 
-	let params =
-		new_partial::<RuntimeApi, ExecutorDispatch, BIQ>(&parachain_config, build_import_queue)?;
+	let params = new_partial::<Runtime, RuntimeApi, ExecutorDispatch, _>(
+		&parachain_config,
+		parachain_build_import_queue,
+	)?;
 	let OtherPartial {
 		mut telemetry,
 		telemetry_worker_handle,
@@ -443,9 +408,9 @@
 	.await
 	.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;
 
-	let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id);
+	let block_announce_validator =
+		RequireSecondedInBlockAnnounce::new(relay_chain_interface.clone(), para_id);
 
-	let force_authoring = parachain_config.force_authoring;
 	let validator = parachain_config.role.is_authority();
 	let prometheus_registry = parachain_config.prometheus_registry().cloned();
 	let transaction_pool = params.transaction_pool.clone();
@@ -531,7 +496,7 @@
 
 			let mut rpc_handle = RpcModule::new(());
 
-			let full_deps = unique_rpc::FullDeps {
+			let full_deps = FullDeps {
 				client: client.clone(),
 				runtime_id,
 
@@ -551,9 +516,9 @@
 				select_chain,
 			};
 
-			unique_rpc::create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_handle, full_deps)?;
+			create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_handle, full_deps)?;
 
-			let eth_deps = unique_rpc::EthDeps {
+			let eth_deps = EthDeps {
 				client,
 				graph: transaction_pool.pool().clone(),
 				pool: transaction_pool,
@@ -571,9 +536,18 @@
 				eth_pubsub_notification_sinks,
 				overrides,
 				sync: sync_service.clone(),
+				pending_create_inherent_data_providers: |_, ()| async move { Ok(()) },
 			};
 
-			unique_rpc::create_eth(
+			create_eth::<
+				_,
+				_,
+				_,
+				_,
+				_,
+				_,
+				DefaultEthConfig<FullClient<RuntimeApi, ExecutorDispatch>>,
+			>(
 				&mut rpc_handle,
 				eth_deps,
 				subscription_task_executor.clone(),
@@ -624,8 +598,25 @@
 		.overseer_handle()
 		.map_err(|e| sc_service::Error::Application(Box::new(e)))?;
 
+	start_relay_chain_tasks(StartRelayChainTasksParams {
+		client: client.clone(),
+		announce_block: announce_block.clone(),
+		para_id,
+		relay_chain_interface: relay_chain_interface.clone(),
+		task_manager: &mut task_manager,
+		da_recovery_profile: if validator {
+			DARecoveryProfile::Collator
+		} else {
+			DARecoveryProfile::FullNode
+		},
+		import_queue: import_queue_service,
+		relay_chain_slot_duration,
+		recovery_handle: Box::new(overseer_handle.clone()),
+		sync_service: sync_service.clone(),
+	})?;
+
 	if validator {
-		let parachain_consensus = build_consensus(
+		start_consensus(
 			client.clone(),
 			backend.clone(),
 			prometheus_registry.as_ref(),
@@ -635,42 +626,12 @@
 			transaction_pool,
 			sync_service.clone(),
 			params.keystore_container.keystore(),
-			force_authoring,
-		)?;
-
-		let spawner = task_manager.spawn_handle();
-
-		let params = StartCollatorParams {
-			para_id: id,
-			block_status: client.clone(),
-			announce_block,
-			client: client.clone(),
-			task_manager: &mut task_manager,
-			spawner,
-			parachain_consensus,
-			import_queue: import_queue_service,
-			collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
-			relay_chain_interface,
+			overseer_handle,
 			relay_chain_slot_duration,
-			recovery_handle: Box::new(overseer_handle),
-			sync_service,
-		};
-
-		start_collator(params).await?;
-	} else {
-		let params = StartFullNodeParams {
-			client: client.clone(),
+			para_id,
+			collator_key.expect("cli args do not allow this"),
 			announce_block,
-			task_manager: &mut task_manager,
-			para_id: id,
-			import_queue: import_queue_service,
-			relay_chain_interface,
-			relay_chain_slot_duration,
-			recovery_handle: Box::new(overseer_handle),
-			sync_service,
-		};
-
-		start_full_node(params)?;
+		)?;
 	}
 
 	start_network.start_network();
@@ -679,25 +640,20 @@
 }
 
 /// Build the import queue for the the parachain runtime.
-pub fn parachain_build_import_queue<RuntimeApi, ExecutorDispatch>(
+pub fn parachain_build_import_queue<Runtime, RuntimeApi, ExecutorDispatch>(
 	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
 	backend: Arc<FullBackend>,
 	config: &Configuration,
 	telemetry: Option<TelemetryHandle>,
 	task_manager: &TaskManager,
-) -> Result<
-	sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
-	sc_service::Error,
->
+) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>
 where
 	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
 		+ Send
 		+ Sync
 		+ 'static,
-	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
-		+ sp_block_builder::BlockBuilder<Block>
-		+ sp_consensus_aura::AuraApi<Block, AuraId>
-		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
+	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+	Runtime: RuntimeInstance,
 	ExecutorDispatch: NativeExecutionDispatch + 'static,
 {
 	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
@@ -732,120 +688,81 @@
 	.map_err(Into::into)
 }
 
-/// Start a normal parachain node.
-pub async fn start_node<Runtime, RuntimeApi, ExecutorDispatch>(
-	parachain_config: Configuration,
-	polkadot_config: Configuration,
-	collator_options: CollatorOptions,
-	id: ParaId,
-	hwbench: Option<sc_sysinfo::HwBench>,
-) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>
+pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
+	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
+	backend: Arc<FullBackend>,
+	prometheus_registry: Option<&Registry>,
+	telemetry: Option<TelemetryHandle>,
+	task_manager: &TaskManager,
+	relay_chain_interface: Arc<dyn RelayChainInterface>,
+	transaction_pool: Arc<
+		sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+	>,
+	sync_oracle: Arc<SyncingService<Block>>,
+	keystore: KeystorePtr,
+	overseer_handle: OverseerHandle,
+	relay_chain_slot_duration: Duration,
+	para_id: ParaId,
+	collator_key: CollatorPair,
+	announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
+) -> Result<(), sc_service::Error>
 where
-	Runtime: RuntimeInstance + Send + Sync + 'static,
-	<Runtime as RuntimeInstance>::CrossAccountId: Serialize,
-	for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,
+	ExecutorDispatch: NativeExecutionDispatch + 'static,
 	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
 		+ Send
 		+ Sync
 		+ 'static,
-	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
-		+ fp_rpc::EthereumRuntimeRPCApi<Block>
-		+ fp_rpc::ConvertTransactionRuntimeApi<Block>
-		+ sp_session::SessionKeys<Block>
-		+ sp_block_builder::BlockBuilder<Block>
-		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
-		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
-		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
-		+ app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
-		+ up_pov_estimate_rpc::PovEstimateApi<Block>
-		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
-		+ sp_api::Metadata<Block>
-		+ sp_offchain::OffchainWorkerApi<Block>
-		+ cumulus_primitives_core::CollectCollationInfo<Block>
-		+ sp_consensus_aura::AuraApi<Block, AuraId>,
-	ExecutorDispatch: NativeExecutionDispatch + 'static,
+	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+	Runtime: RuntimeInstance,
 {
-	start_node_impl::<Runtime, RuntimeApi, ExecutorDispatch, _, _>(
-		parachain_config,
-		polkadot_config,
-		collator_options,
-		id,
-		parachain_build_import_queue,
-		|client,
-		 backend,
-		 prometheus_registry,
-		 telemetry,
-		 task_manager,
-		 relay_chain_interface,
-		 transaction_pool,
-		 sync_oracle,
-		 keystore,
-		 force_authoring| {
-			let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
+	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
 
-			let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
-				task_manager.spawn_handle(),
-				client.clone(),
-				transaction_pool,
-				prometheus_registry,
-				telemetry.clone(),
-			);
+	let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
+		task_manager.spawn_handle(),
+		client.clone(),
+		transaction_pool,
+		prometheus_registry,
+		telemetry.clone(),
+	);
+	let proposer = Proposer::new(proposer_factory);
 
-			let block_import = ParachainBlockImport::new(client.clone(), backend);
+	let collator_service = CollatorService::new(
+		client.clone(),
+		Arc::new(task_manager.spawn_handle()),
+		announce_block,
+		client.clone(),
+	);
 
-			Ok(AuraConsensus::build::<
-				sp_consensus_aura::sr25519::AuthorityPair,
-				_,
-				_,
-				_,
-				_,
-				_,
-				_,
-			>(BuildAuraConsensusParams {
-				proposer_factory,
-				create_inherent_data_providers: move |_, (relay_parent, validation_data)| {
-					let relay_chain_interface = relay_chain_interface.clone();
-					async move {
-						let parachain_inherent =
-						cumulus_primitives_parachain_inherent::ParachainInherentData::create_at(
-							relay_parent,
-							&relay_chain_interface,
-							&validation_data,
-							id,
-						).await;
+	let block_import = ParachainBlockImport::new(client.clone(), backend);
 
-						let time = sp_timestamp::InherentDataProvider::from_system_time();
+	let params = BuildAuraConsensusParams {
+		create_inherent_data_providers: move |_, ()| async move { Ok(()) },
+		block_import,
+		para_client: client,
+		#[cfg(feature = "lookahead")]
+		para_backend: backend,
+		para_id,
+		relay_client: relay_chain_interface,
+		sync_oracle,
+		keystore,
+		slot_duration,
+		proposer,
+		collator_service,
+		// With async-baking, we allowed to be both slower (longer authoring) and faster (multiple para blocks per relay block)
+		authoring_duration: Duration::from_millis(500),
+		overseer_handle,
+		#[cfg(feature = "lookahead")]
+		code_hash_provider: || {},
+		collator_key,
+		relay_chain_slot_duration,
+	};
 
-						let slot =
-						sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
-							*time,
-							slot_duration,
-						);
-
-						let parachain_inherent = parachain_inherent.ok_or_else(|| {
-							Box::<dyn std::error::Error + Send + Sync>::from(
-								"Failed to create parachain inherent",
-							)
-						})?;
-						Ok((slot, time, parachain_inherent))
-					}
-				},
-				block_import,
-				para_client: client,
-				backoff_authoring_blocks: Option::<()>::None,
-				sync_oracle,
-				keystore,
-				force_authoring,
-				slot_duration,
-				// We got around 500ms for proposing
-				block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32),
-				telemetry,
-				max_block_proposal_slot_portion: None,
-			}))
-		},
-		hwbench,
-	)
-	.await
+	task_manager.spawn_essential_handle().spawn(
+		"aura",
+		None,
+		run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _>(params),
+	);
+	Ok(())
 }
 
 fn dev_build_import_queue<RuntimeApi, ExecutorDispatch>(
@@ -854,17 +771,14 @@
 	config: &Configuration,
 	_: Option<TelemetryHandle>,
 	task_manager: &TaskManager,
-) -> Result<
-	sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
-	sc_service::Error,
->
+) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>
 where
 	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
 		+ Send
 		+ Sync
 		+ 'static,
-	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
-		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
+	RuntimeApi::RuntimeApi:
+		sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> + sp_api::ApiExt<Block>,
 	ExecutorDispatch: NativeExecutionDispatch + 'static,
 {
 	Ok(sc_consensus_manual_seal::import_queue(
@@ -881,6 +795,15 @@
 	pub eth_backend: Arc<fc_db::kv::Backend<Block>>,
 }
 
+struct DefaultEthConfig<C>(PhantomData<C>);
+impl<C> EthConfig<Block, C> for DefaultEthConfig<C>
+where
+	C: StorageProvider<Block, FullBackend> + Sync + Send + 'static,
+{
+	type EstimateGasAdapter = ();
+	type RuntimeStorageOverride = SystemAccountId32StorageOverride<Block, C, FullBackend>;
+}
+
 /// Builds a new development service. This service uses instant seal, and mocks
 /// the parachain inherent
 pub fn start_dev_node<Runtime, RuntimeApi, ExecutorDispatch>(
@@ -897,28 +820,14 @@
 		+ Send
 		+ Sync
 		+ 'static,
-	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
-		+ fp_rpc::EthereumRuntimeRPCApi<Block>
-		+ fp_rpc::ConvertTransactionRuntimeApi<Block>
-		+ sp_session::SessionKeys<Block>
-		+ sp_block_builder::BlockBuilder<Block>
-		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
-		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
-		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
-		+ app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
-		+ up_pov_estimate_rpc::PovEstimateApi<Block>
-		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
-		+ sp_api::Metadata<Block>
-		+ sp_offchain::OffchainWorkerApi<Block>
-		+ cumulus_primitives_core::CollectCollationInfo<Block>
-		+ sp_consensus_aura::AuraApi<Block, AuraId>,
+	RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
 	ExecutorDispatch: NativeExecutionDispatch + 'static,
 {
+	use fc_consensus::FrontierBlockImport;
 	use sc_consensus_manual_seal::{
 		run_manual_seal, run_delayed_finalize, EngineCommand, ManualSealParams,
 		DelayedFinalizeParams,
 	};
-	use fc_consensus::FrontierBlockImport;
 
 	let sc_service::PartialComponents {
 		client,
@@ -935,7 +844,7 @@
 				eth_backend,
 				telemetry_worker_handle: _,
 			},
-	} = new_partial::<RuntimeApi, ExecutorDispatch, _>(
+	} = new_partial::<Runtime, RuntimeApi, ExecutorDispatch, _>(
 		&config,
 		dev_build_import_queue::<RuntimeApi, ExecutorDispatch>,
 	)?;
@@ -953,15 +862,6 @@
 			block_announce_validator_builder: None,
 			warp_sync_params: None,
 		})?;
-
-	if config.offchain_worker.enabled {
-		sc_service::build_offchain_workers(
-			&config,
-			task_manager.spawn_handle(),
-			client.clone(),
-			network.clone(),
-		);
-	}
 
 	let collator = config.role.is_authority();
 
@@ -1141,7 +1041,7 @@
 
 			let mut rpc_module = RpcModule::new(());
 
-			let full_deps = unique_rpc::FullDeps {
+			let full_deps = FullDeps {
 				runtime_id,
 
 				#[cfg(feature = "pov-estimate")]
@@ -1161,9 +1061,9 @@
 				select_chain,
 			};
 
-			unique_rpc::create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_module, full_deps)?;
+			create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_module, full_deps)?;
 
-			let eth_deps = unique_rpc::EthDeps {
+			let eth_deps = EthDeps {
 				client,
 				graph: transaction_pool.pool().clone(),
 				pool: transaction_pool,
@@ -1181,9 +1081,19 @@
 				eth_pubsub_notification_sinks,
 				overrides,
 				sync: sync_service.clone(),
+				// We don't have any inherents except parachain built-ins, which we can't even extract from inside `run_aura`.
+				pending_create_inherent_data_providers: |_, ()| async move { Ok(()) },
 			};
 
-			unique_rpc::create_eth(
+			create_eth::<
+				_,
+				_,
+				_,
+				_,
+				_,
+				_,
+				DefaultEthConfig<FullClient<RuntimeApi, ExecutorDispatch>>,
+			>(
 				&mut rpc_module,
 				eth_deps,
 				subscription_task_executor.clone(),
@@ -1241,37 +1151,35 @@
 	})
 }
 
-pub struct FrontierTaskParams<'a, B: BlockT, C, BE> {
+pub struct FrontierTaskParams<'a, C, B> {
 	pub task_manager: &'a TaskManager,
 	pub client: Arc<C>,
-	pub substrate_backend: Arc<BE>,
-	pub eth_backend: Arc<fc_db::kv::Backend<B>>,
+	pub substrate_backend: Arc<B>,
+	pub eth_backend: Arc<fc_db::kv::Backend<Block>>,
 	pub eth_filter_pool: Option<FilterPool>,
-	pub overrides: Arc<OverrideHandle<B>>,
+	pub overrides: Arc<OverrideHandle<Block>>,
 	pub fee_history_limit: u64,
 	pub fee_history_cache: FeeHistoryCache,
 	pub sync_strategy: SyncStrategy,
 	pub prometheus_registry: Option<Registry>,
 }
 
-pub fn spawn_frontier_tasks<B, C, BE>(
-	params: FrontierTaskParams<B, C, BE>,
-	sync: Arc<SyncingService<B>>,
+pub fn spawn_frontier_tasks<C, B>(
+	params: FrontierTaskParams<C, B>,
+	sync: Arc<SyncingService<Block>>,
 	pubsub_notification_sinks: Arc<
-		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<B>>,
+		EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,
 	>,
-) -> Arc<EthBlockDataCacheTask<B>>
+) -> Arc<EthBlockDataCacheTask<Block>>
 where
-	C: ProvideRuntimeApi<B> + BlockOf,
-	C: HeaderBackend<B> + HeaderMetadata<B, Error = BlockChainError> + 'static,
-	C: BlockchainEvents<B> + StorageProvider<B, BE>,
+	C: ProvideRuntimeApi<Block> + BlockOf,
+	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,
+	C: BlockchainEvents<Block> + StorageProvider<Block, B>,
 	C: Send + Sync + 'static,
-	C::Api: EthereumRuntimeRPCApi<B>,
-	C::Api: BlockBuilder<B>,
-	B: BlockT<Hash = H256> + Send + Sync + 'static,
-	B::Header: HeaderT<Number = u32>,
-	BE: Backend<B> + 'static,
-	BE::State: StateBackend<BlakeTwo256>,
+	C::Api: EthereumRuntimeRPCApi<Block>,
+	C::Api: BlockBuilder<Block>,
+	B: Backend<Block> + 'static,
+	B::State: StateBackend<BlakeTwo256>,
 {
 	let FrontierTaskParams {
 		task_manager,
modifiedpallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -32,7 +32,7 @@
 fn set_admin<T>() -> Result<T::AccountId, sp_runtime::DispatchError>
 where
 	T: Config + pallet_unique::Config + pallet_evm_migration::Config,
-	T::BlockNumber: From<u32> + Into<u32>,
+	BlockNumberFor<T>: From<u32> + Into<u32>,
 	BalanceOf<T>: Sum + From<u128>,
 {
 	let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
@@ -53,7 +53,7 @@
 benchmarks! {
 	where_clause{
 		where T:  Config + pallet_unique::Config + pallet_evm_migration::Config ,
-		T::BlockNumber: From<u32> + Into<u32>,
+		BlockNumberFor<T>: From<u32> + Into<u32>,
 		BalanceOf<T>: Sum + From<u128>
 	}
 
modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -125,11 +125,11 @@
 
 		/// In relay blocks.
 		#[pallet::constant]
-		type RecalculationInterval: Get<Self::BlockNumber>;
+		type RecalculationInterval: Get<BlockNumberFor<Self>>;
 
 		/// In parachain blocks.
 		#[pallet::constant]
-		type PendingInterval: Get<Self::BlockNumber>;
+		type PendingInterval: Get<BlockNumberFor<Self>>;
 
 		/// Rate of return for interval in blocks defined in `RecalculationInterval`.
 		#[pallet::constant]
@@ -146,7 +146,7 @@
 		type WeightInfo: WeightInfo;
 
 		// The relay block number provider
-		type RelayBlockNumberProvider: BlockNumberProvider<BlockNumber = Self::BlockNumber>;
+		type RelayBlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
 
 		/// Events compatible with [`frame_system::Config::Event`].
 		type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;
@@ -230,9 +230,9 @@
 	pub type Staked<T: Config> = StorageNMap<
 		Key = (
 			Key<Blake2_128Concat, T::AccountId>,
-			Key<Twox64Concat, T::BlockNumber>,
+			Key<Twox64Concat, BlockNumberFor<T>>,
 		),
-		Value = (BalanceOf<T>, T::BlockNumber),
+		Value = (BalanceOf<T>, BlockNumberFor<T>),
 		QueryKind = ValueQuery,
 	>;
 
@@ -252,7 +252,7 @@
 	pub type PendingUnstake<T: Config> = StorageMap<
 		_,
 		Twox64Concat,
-		T::BlockNumber,
+		BlockNumberFor<T>,
 		BoundedVec<(T::AccountId, BalanceOf<T>), ConstU32<PENDING_LIMIT_PER_BLOCK>>,
 		ValueQuery,
 	>;
@@ -262,16 +262,16 @@
 	#[pallet::storage]
 	#[pallet::getter(fn get_next_calculated_record)]
 	pub type PreviousCalculatedRecord<T: Config> =
-		StorageValue<Value = (T::AccountId, T::BlockNumber), QueryKind = OptionQuery>;
+		StorageValue<Value = (T::AccountId, BlockNumberFor<T>), QueryKind = OptionQuery>;
 
 	#[pallet::hooks]
 	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
 		/// Block overflow is impossible due to the fact that the unstake algorithm in on_initialize
 		/// implies the execution of a strictly limited number of relatively lightweight operations.
 		/// A separate benchmark has been implemented to scale the weight depending on the number of pendings.
-		fn on_initialize(current_block_number: T::BlockNumber) -> Weight
+		fn on_initialize(current_block_number: BlockNumberFor<T>) -> Weight
 		where
-			<T as frame_system::Config>::BlockNumber: From<u32>,
+			BlockNumberFor<T>: From<u32>,
 		{
 			if T::IsMaintenanceModeEnabled::get() {
 				return T::DbWeight::get().reads_writes(1, 0);
@@ -302,7 +302,7 @@
 	#[pallet::call]
 	impl<T: Config> Pallet<T>
 	where
-		T::BlockNumber: From<u32> + Into<u32>,
+		BlockNumberFor<T>: From<u32> + Into<u32>,
 		<<T as Config>::Currency as Inspect<T::AccountId>>::Balance: Sum + From<u128>,
 	{
 		/// Sets an address as the the admin.
@@ -369,7 +369,7 @@
 
 			// Calculation of the number of recalculation periods,
 			// after how much the first interest calculation should be performed for the stake
-			let recalculate_after_interval: T::BlockNumber =
+			let recalculate_after_interval: BlockNumberFor<T> =
 				if block_number % config.recalculation_interval == 0u32.into() {
 					1u32.into()
 				} else {
@@ -705,7 +705,7 @@
 		#[pallet::weight(<T as Config>::WeightInfo::on_initialize(PENDING_LIMIT_PER_BLOCK*pending_blocks.len() as u32))]
 		pub fn force_unstake(
 			origin: OriginFor<T>,
-			pending_blocks: Vec<T::BlockNumber>,
+			pending_blocks: Vec<BlockNumberFor<T>>,
 		) -> DispatchResult {
 			ensure_root(origin)?;
 
@@ -917,7 +917,7 @@
 	/// - `staker`: staker account.
 	pub fn total_staked_by_id_per_block(
 		staker: impl EncodeLike<T::AccountId>,
-	) -> Option<Vec<(T::BlockNumber, BalanceOf<T>)>> {
+	) -> Option<Vec<(BlockNumberFor<T>, BalanceOf<T>)>> {
 		let mut staked = Staked::<T>::iter_prefix((staker,))
 			.map(|(block, (amount, _))| (block, amount))
 			.collect::<Vec<_>>();
@@ -944,14 +944,14 @@
 	/// - `staker`: staker account.
 	pub fn cross_id_total_staked_per_block(
 		staker: T::CrossAccountId,
-	) -> Vec<(T::BlockNumber, BalanceOf<T>)> {
+	) -> Vec<(BlockNumberFor<T>, BalanceOf<T>)> {
 		Self::total_staked_by_id_per_block(staker.as_sub()).unwrap_or_default()
 	}
 
 	fn recalculate_and_insert_stake(
 		staker: &T::AccountId,
-		staked_block: T::BlockNumber,
-		next_recalc_block: T::BlockNumber,
+		staked_block: BlockNumberFor<T>,
+		next_recalc_block: BlockNumberFor<T>,
 		base: BalanceOf<T>,
 		iters: u32,
 		income_acc: &mut BalanceOf<T>,
@@ -979,9 +979,9 @@
 	/// Get relay block number rounded down to multiples of config.recalculation_interval.
 	/// We need it to reward stakers in integer parts of recalculation_interval
 	fn get_current_recalc_block(
-		current_relay_block: T::BlockNumber,
+		current_relay_block: BlockNumberFor<T>,
 		config: &PalletConfiguration<T>,
-	) -> T::BlockNumber {
+	) -> BlockNumberFor<T> {
 		(current_relay_block / config.recalculation_interval) * config.recalculation_interval
 	}
 
@@ -1028,7 +1028,7 @@
 	/// - `staker`: staker account.
 	pub fn cross_id_pending_unstake_per_block(
 		staker: T::CrossAccountId,
-	) -> Vec<(T::BlockNumber, BalanceOf<T>)> {
+	) -> Vec<(BlockNumberFor<T>, BalanceOf<T>)> {
 		let mut unsorted_res = vec![];
 		PendingUnstake::<T>::iter().for_each(|(block, pendings)| {
 			pendings.into_iter().for_each(|(id, amount)| {
modifiedpallets/app-promotion/src/types.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/types.rs
+++ b/pallets/app-promotion/src/types.rs
@@ -114,9 +114,9 @@
 }
 pub(crate) struct PalletConfiguration<T: crate::Config> {
 	/// In relay blocks.
-	pub recalculation_interval: T::BlockNumber,
+	pub recalculation_interval: BlockNumberFor<T>,
 	/// In parachain blocks.
-	pub pending_interval: T::BlockNumber,
+	pub pending_interval: BlockNumberFor<T>,
 	/// Value for `RecalculationInterval` based on 0.05% per 24h.
 	pub interval_income: Perbill,
 	/// Maximum allowable number of stakers calculated per call of the `app-promotion::PayoutStakers` extrinsic.
modifiedpallets/collator-selection/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/benchmarking.rs
+++ b/pallets/collator-selection/src/benchmarking.rs
@@ -51,6 +51,10 @@
 use pallet_session::{self as session, SessionManager};
 use sp_std::prelude::*;
 
+use super::*;
+#[allow(unused)]
+use crate::{BalanceOf, Pallet as CollatorSelection};
+
 const SEED: u32 = 0;
 
 // TODO: remove if this is given in substrate commit.
@@ -317,7 +321,7 @@
 			balance_unit::<T>() * 4u32.into(),
 		);
 		let author = account("author", 0, SEED);
-		let new_block: T::BlockNumber = 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());
@@ -338,7 +342,7 @@
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
 
-		let new_block: T::BlockNumber = 1800u32.into();
+		let new_block: BlockNumberFor<T>= 1800u32.into();
 		let zero_block: T::BlockNumber = 0u32.into();
 		let candidates = <Candidates<T>>::get();
 
modifiedpallets/collator-selection/src/lib.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/lib.rs
+++ b/pallets/collator-selection/src/lib.rs
@@ -131,8 +131,11 @@
 	pub trait Config: frame_system::Config {
 		/// Overarching event type.
 		type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
+		/// Overarching hold reason.
+		type RuntimeHoldReason: From<HoldReason>;
+
 		type Currency: Mutate<Self::AccountId>
-			+ MutateHold<Self::AccountId>
+			+ MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason>
 			+ BalancedHold<Self::AccountId>;
 
 		/// Origin that can dictate updating parameters of this pallet.
@@ -164,14 +167,17 @@
 		/// The weight information of this pallet.
 		type WeightInfo: WeightInfo;
 
-		#[pallet::constant]
-		type LicenceBondIdentifier: Get<<Self::Currency as InspectHold<Self::AccountId>>::Reason>;
-
 		type DesiredCollators: Get<u32>;
 
 		type LicenseBond: Get<BalanceOf<Self>>;
 
-		type KickThreshold: Get<Self::BlockNumber>;
+		type KickThreshold: Get<BlockNumberFor<Self>>;
+	}
+
+	#[pallet::composite_enum]
+	pub enum HoldReason {
+		/// The funds are held as the license bond.
+		LicenseBond,
 	}
 
 	#[pallet::pallet]
@@ -199,14 +205,13 @@
 	#[pallet::storage]
 	#[pallet::getter(fn last_authored_block)]
 	pub type LastAuthoredBlock<T: Config> =
-		StorageMap<_, Twox64Concat, T::AccountId, T::BlockNumber, ValueQuery>;
+		StorageMap<_, Twox64Concat, T::AccountId, BlockNumberFor<T>, ValueQuery>;
 
 	#[pallet::genesis_config]
 	pub struct GenesisConfig<T: Config> {
 		pub invulnerables: Vec<T::AccountId>,
 	}
 
-	#[cfg(feature = "std")]
 	impl<T: Config> Default for GenesisConfig<T> {
 		fn default() -> Self {
 			Self {
@@ -216,12 +221,11 @@
 	}
 
 	#[pallet::genesis_build]
-	impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+	impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
 		fn build(&self) {
-			let duplicate_invulnerables = self
-				.invulnerables
-				.iter()
-				.collect::<std::collections::BTreeSet<_>>();
+			use sp_std::collections::btree_set::BTreeSet;
+
+			let duplicate_invulnerables = self.invulnerables.iter().collect::<BTreeSet<_>>();
 			assert!(
 				duplicate_invulnerables.len() == self.invulnerables.len(),
 				"duplicate invulnerables in genesis."
@@ -375,7 +379,7 @@
 
 			let deposit = T::LicenseBond::get();
 
-			T::Currency::hold(&T::LicenceBondIdentifier::get(), &who, deposit)?;
+			T::Currency::hold(&HoldReason::LicenseBond.into(), &who, deposit)?;
 			LicenseDepositOf::<T>::insert(who.clone(), deposit);
 
 			Self::deposit_event(Event::LicenseObtained {
@@ -538,7 +542,7 @@
 						let remaining = deposit - slashed;
 
 						let (imbalance, _) =
-							T::Currency::slash(&T::LicenceBondIdentifier::get(), who, slashed);
+							T::Currency::slash(&HoldReason::LicenseBond.into(), who, slashed);
 						deposit_returned = remaining;
 
 						T::Currency::resolve(&T::TreasuryAccountId::get(), imbalance)
@@ -548,7 +552,7 @@
 					}
 
 					T::Currency::release(
-						&T::LicenceBondIdentifier::get(),
+						&HoldReason::LicenseBond.into(),
 						who,
 						deposit_returned,
 						Precision::Exact,
@@ -608,7 +612,7 @@
 	/// Keep track of number of authored blocks per authority, uncles are counted as well since
 	/// they're a valid proof of being online.
 	impl<T: Config + pallet_authorship::Config>
-		pallet_authorship::EventHandler<T::AccountId, T::BlockNumber> for Pallet<T>
+		pallet_authorship::EventHandler<T::AccountId, BlockNumberFor<T>> for Pallet<T>
 	{
 		fn note_author(author: T::AccountId) {
 			let pot = Self::account_id();
modifiedpallets/collator-selection/src/mock.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/mock.rs
+++ b/pallets/collator-selection/src/mock.rs
@@ -51,18 +51,14 @@
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-	pub enum Test where
-		Block = Block,
-		NodeBlock = Block,
-		UncheckedExtrinsic = UncheckedExtrinsic,
-	{
-		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
-		Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
-		Aura: pallet_aura::{Pallet, Storage, Config<T>},
-		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
-		CollatorSelection: collator_selection::{Pallet, Call, Storage, Event<T>},
-		Authorship: pallet_authorship::{Pallet, Storage},
+	pub enum Test {
+		System: frame_system,
+		Timestamp: pallet_timestamp,
+		Session: pallet_session,
+		Aura: pallet_aura,
+		Balances: pallet_balances,
+		CollatorSelection: collator_selection,
+		Authorship: pallet_authorship,
 	}
 );
 
@@ -78,13 +74,11 @@
 	type DbWeight = ();
 	type RuntimeOrigin = RuntimeOrigin;
 	type RuntimeCall = RuntimeCall;
-	type Index = u64;
-	type BlockNumber = u64;
+	type Nonce = u64;
 	type Hash = H256;
 	type Hashing = BlakeTwo256;
 	type AccountId = u64;
 	type Lookup = IdentityLookup<Self::AccountId>;
-	type Header = Header;
 	type RuntimeEvent = RuntimeEvent;
 	type BlockHashCount = BlockHashCount;
 	type Version = ();
@@ -115,7 +109,6 @@
 	type MaxLocks = ();
 	type MaxReserves = MaxReserves;
 	type ReserveIdentifier = [u8; 8];
-	type HoldIdentifier = [u8; 16];
 	type FreezeIdentifier = [u8; 16];
 	type MaxHolds = MaxHolds;
 	type MaxFreezes = MaxFreezes;
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -463,7 +463,6 @@
 	#[pallet::genesis_config]
 	pub struct GenesisConfig<T>(PhantomData<T>);
 
-	#[cfg(feature = "std")]
 	impl<T: Config> Default for GenesisConfig<T> {
 		fn default() -> Self {
 			Self(Default::default())
@@ -471,7 +470,7 @@
 	}
 
 	#[pallet::genesis_build]
-	impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+	impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
 		fn build(&self) {
 			StorageVersion::new(1).put::<Pallet<T>>();
 		}
modifiedpallets/configuration/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/configuration/src/benchmarking.rs
+++ b/pallets/configuration/src/benchmarking.rs
@@ -52,7 +52,7 @@
 	}
 
 	set_app_promotion_configuration_override {
-		let configuration: AppPromotionConfiguration<T::BlockNumber> = Default::default();
+		let configuration: AppPromotionConfiguration<BlockNumberFor<T>> = Default::default();
 	}: {
 		assert_ok!(
 			<Pallet<T>>::set_app_promotion_configuration_override(RawOrigin::Root.into(), configuration)
@@ -82,7 +82,7 @@
 	}
 
 	set_collator_selection_kick_threshold {
-		let threshold: Option<T::BlockNumber> = Some(900u32.into());
+		let threshold: Option<BlockNumberFor<T>> = Some(900u32.into());
 	}: {
 		assert_ok!(
 			<Pallet<T>>::set_collator_selection_kick_threshold(RawOrigin::Root.into(), threshold)
modifiedpallets/configuration/src/lib.rsdiffbeforeafterboth
--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -80,14 +80,14 @@
 		#[pallet::constant]
 		type AppPromotionDailyRate: Get<Perbill>;
 		#[pallet::constant]
-		type DayRelayBlocks: Get<Self::BlockNumber>;
+		type DayRelayBlocks: Get<BlockNumberFor<Self>>;
 
 		#[pallet::constant]
 		type DefaultCollatorSelectionMaxCollators: Get<u32>;
 		#[pallet::constant]
 		type DefaultCollatorSelectionLicenseBond: Get<Self::Balance>;
 		#[pallet::constant]
-		type DefaultCollatorSelectionKickThreshold: Get<Self::BlockNumber>;
+		type DefaultCollatorSelectionKickThreshold: Get<BlockNumberFor<Self>>;
 
 		/// The weight information of this pallet.
 		type WeightInfo: WeightInfo;
@@ -103,7 +103,7 @@
 			bond_cost: Option<T::Balance>,
 		},
 		NewCollatorKickThreshold {
-			length_in_blocks: Option<T::BlockNumber>,
+			length_in_blocks: Option<BlockNumberFor<T>>,
 		},
 	}
 
@@ -134,7 +134,6 @@
 	#[pallet::genesis_config]
 	pub struct GenesisConfig<T>(PhantomData<T>);
 
-	#[cfg(feature = "std")]
 	impl<T: Config> Default for GenesisConfig<T> {
 		fn default() -> Self {
 			Self(Default::default())
@@ -142,7 +141,7 @@
 	}
 
 	#[pallet::genesis_build]
-	impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+	impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
 		fn build(&self) {
 			update_base_fee::<T>();
 		}
@@ -166,7 +165,7 @@
 
 	#[pallet::storage]
 	pub type AppPromomotionConfigurationOverride<T: Config> =
-		StorageValue<Value = AppPromotionConfiguration<T::BlockNumber>, QueryKind = ValueQuery>;
+		StorageValue<Value = AppPromotionConfiguration<BlockNumberFor<T>>, QueryKind = ValueQuery>;
 
 	#[pallet::storage]
 	pub type CollatorSelectionDesiredCollatorsOverride<T: Config> = StorageValue<
@@ -184,7 +183,7 @@
 
 	#[pallet::storage]
 	pub type CollatorSelectionKickThresholdOverride<T: Config> = StorageValue<
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = ValueQuery,
 		OnEmpty = T::DefaultCollatorSelectionKickThreshold,
 	>;
@@ -228,7 +227,7 @@
 		#[pallet::weight(T::WeightInfo::set_app_promotion_configuration_override())]
 		pub fn set_app_promotion_configuration_override(
 			origin: OriginFor<T>,
-			mut configuration: AppPromotionConfiguration<T::BlockNumber>,
+			mut configuration: AppPromotionConfiguration<BlockNumberFor<T>>,
 		) -> DispatchResult {
 			ensure_root(origin)?;
 			if configuration.interval_income.is_some() {
@@ -287,7 +286,7 @@
 		#[pallet::weight(T::WeightInfo::set_collator_selection_kick_threshold())]
 		pub fn set_collator_selection_kick_threshold(
 			origin: OriginFor<T>,
-			threshold: Option<T::BlockNumber>,
+			threshold: Option<BlockNumberFor<T>>,
 		) -> DispatchResult {
 			ensure_root(origin)?;
 			if let Some(threshold) = threshold {
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -422,7 +422,7 @@
 		{
 			return None;
 		}
-		let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+		let block_number = <frame_system::Pallet<T>>::block_number() as BlockNumberFor<T>;
 
 		if let Some(last_tx_block) = <SponsorBasket<T>>::get(contract_address, who.as_eth()) {
 			let limit = <SponsoringRateLimit<T>>::get(contract_address);
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -53,7 +53,7 @@
 
 		/// In case of enabled sponsoring, but no sponsoring rate limit set,
 		/// this value will be used implicitly
-		type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
+		type DefaultSponsoringRateLimit: Get<BlockNumberFor<Self>>;
 	}
 
 	#[pallet::error]
@@ -115,7 +115,7 @@
 	pub(super) type SponsoringRateLimit<T: Config> = StorageMap<
 		Hasher = Twox128,
 		Key = H160,
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = ValueQuery,
 		OnEmpty = T::DefaultSponsoringRateLimit,
 	>;
@@ -139,7 +139,7 @@
 		Key1 = H160,
 		Hasher2 = Twox128,
 		Key2 = H160,
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 
@@ -393,7 +393,7 @@
 		}
 
 		/// Set duration between two sponsored contract calls
-		pub fn set_sponsoring_rate_limit(contract: H160, rate_limit: T::BlockNumber) {
+		pub fn set_sponsoring_rate_limit(contract: H160, rate_limit: BlockNumberFor<T>) {
 			<SponsoringRateLimit<T>>::insert(contract, rate_limit);
 		}
 
modifiedpallets/evm-migration/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/evm-migration/src/benchmarking.rs
+++ b/pallets/evm-migration/src/benchmarking.rs
@@ -23,7 +23,7 @@
 use sp_std::{vec::Vec, vec};
 
 benchmarks! {
-	where_clause { where <T as Config>::RuntimeEvent: codec::Encode }
+	where_clause { where <T as Config>::RuntimeEvent: parity_scale_codec::Encode }
 
 	begin {
 	}: _(RawOrigin::Root, H160::default())
@@ -59,7 +59,7 @@
 
 	insert_events {
 		let b in 0..200;
-		use codec::Encode;
+		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)
 }
modifiedpallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/impl_fungibles.rs
+++ b/pallets/foreign-assets/src/impl_fungibles.rs
@@ -30,30 +30,30 @@
 
 impl<T: Config> fungibles::Inspect<<T as SystemConfig>::AccountId> for Pallet<T>
 where
-	T: orml_tokens::Config<CurrencyId = AssetIds>,
+	T: orml_tokens::Config<CurrencyId = AssetId>,
 	BalanceOf<T>: From<<T as pallet_balances::Config>::Balance>,
 	BalanceOf<T>: From<<T as orml_tokens::Config>::Balance>,
 	<T as pallet_balances::Config>::Balance: From<BalanceOf<T>>,
 	<T as orml_tokens::Config>::Balance: From<BalanceOf<T>>,
 {
-	type AssetId = AssetIds;
+	type AssetId = AssetId;
 	type Balance = BalanceOf<T>;
 
 	fn total_issuance(asset: Self::AssetId) -> Self::Balance {
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible total_issuance");
 
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				<pallet_balances::Pallet<T> as fungible::Inspect<T::AccountId>>::total_issuance()
 					.into()
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				<orml_tokens::Pallet<T> as fungibles::Inspect<T::AccountId>>::total_issuance(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 				)
 				.into()
 			}
-			AssetIds::ForeignAssetId(fid) => {
+			AssetId::ForeignAssetId(fid) => {
 				let target_collection_id = match <AssetBinding<T>>::get(fid) {
 					Some(v) => v,
 					None => return Zero::zero(),
@@ -71,38 +71,36 @@
 	fn minimum_balance(asset: Self::AssetId) -> Self::Balance {
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible minimum_balance");
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				<pallet_balances::Pallet<T> as fungible::Inspect<T::AccountId>>::minimum_balance()
 					.into()
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				<orml_tokens::Pallet<T> as fungibles::Inspect<T::AccountId>>::minimum_balance(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 				)
 				.into()
 			}
-			AssetIds::ForeignAssetId(fid) => {
-				AssetMetadatas::<T>::get(AssetIds::ForeignAssetId(fid))
-					.map(|x| x.minimal_balance)
-					.unwrap_or_else(Zero::zero)
-			}
+			AssetId::ForeignAssetId(fid) => AssetMetadatas::<T>::get(AssetId::ForeignAssetId(fid))
+				.map(|x| x.minimal_balance)
+				.unwrap_or_else(Zero::zero),
 		}
 	}
 
 	fn balance(asset: Self::AssetId, who: &<T as SystemConfig>::AccountId) -> Self::Balance {
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible balance");
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				<pallet_balances::Pallet<T> as fungible::Inspect<T::AccountId>>::balance(who).into()
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				<orml_tokens::Pallet<T> as fungibles::Inspect<T::AccountId>>::balance(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 					who,
 				)
 				.into()
 			}
-			AssetIds::ForeignAssetId(fid) => {
+			AssetId::ForeignAssetId(fid) => {
 				let target_collection_id = match <AssetBinding<T>>::get(fid) {
 					Some(v) => v,
 					None => return Zero::zero(),
@@ -133,7 +131,7 @@
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible reducible_balance");
 
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				<pallet_balances::Pallet<T> as fungible::Inspect<T::AccountId>>::reducible_balance(
 					who,
 					preservation,
@@ -141,9 +139,9 @@
 				)
 				.into()
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				<orml_tokens::Pallet<T> as fungibles::Inspect<T::AccountId>>::reducible_balance(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 					who,
 					preservation,
 					fortitude,
@@ -163,16 +161,16 @@
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible can_deposit");
 
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				<pallet_balances::Pallet<T> as fungible::Inspect<T::AccountId>>::can_deposit(
 					who,
 					amount.into(),
 					provenance,
 				)
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				<orml_tokens::Pallet<T> as fungibles::Inspect<T::AccountId>>::can_deposit(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 					who,
 					amount.into(),
 					provenance,
@@ -219,7 +217,7 @@
 		};
 
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				let this_amount: <T as pallet_balances::Config>::Balance = match value.try_into() {
 					Ok(val) => val,
 					Err(_) => {
@@ -240,7 +238,7 @@
 					_ => WithdrawConsequence::BalanceLow,
 				}
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				let parent_amount: <T as orml_tokens::Config>::Balance = match value.try_into() {
 					Ok(val) => val,
 					Err(_) => {
@@ -248,7 +246,7 @@
 					}
 				};
 				match <orml_tokens::Pallet<T> as fungibles::Inspect<T::AccountId>>::can_withdraw(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 					who,
 					parent_amount,
 				) {
@@ -269,17 +267,17 @@
 		}
 	}
 
-	fn asset_exists(asset: AssetIds) -> bool {
+	fn asset_exists(asset: AssetId) -> bool {
 		match asset {
-			AssetIds::NativeAssetId(_) => true,
-			AssetIds::ForeignAssetId(fid) => <AssetBinding<T>>::contains_key(fid),
+			AssetId::NativeAssetId(_) => true,
+			AssetId::ForeignAssetId(fid) => <AssetBinding<T>>::contains_key(fid),
 		}
 	}
 }
 
 impl<T: Config> fungibles::Mutate<<T as SystemConfig>::AccountId> for Pallet<T>
 where
-	T: orml_tokens::Config<CurrencyId = AssetIds>,
+	T: orml_tokens::Config<CurrencyId = AssetId>,
 	BalanceOf<T>: From<<T as pallet_balances::Config>::Balance>,
 	BalanceOf<T>: From<<T as orml_tokens::Config>::Balance>,
 	<T as pallet_balances::Config>::Balance: From<BalanceOf<T>>,
@@ -295,22 +293,22 @@
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible mint_into {:?}", asset);
 
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				<pallet_balances::Pallet<T> as fungible::Mutate<T::AccountId>>::mint_into(
 					who,
 					amount.into(),
 				)
 				.map(Into::into)
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				<orml_tokens::Pallet<T> as fungibles::Mutate<T::AccountId>>::mint_into(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 					who,
 					amount.into(),
 				)
 				.map(Into::into)
 			}
-			AssetIds::ForeignAssetId(fid) => {
+			AssetId::ForeignAssetId(fid) => {
 				let target_collection_id = match <AssetBinding<T>>::get(fid) {
 					Some(v) => v,
 					None => {
@@ -349,7 +347,7 @@
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible burn_from");
 
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				<pallet_balances::Pallet<T> as fungible::Mutate<T::AccountId>>::burn_from(
 					who,
 					amount.into(),
@@ -358,9 +356,9 @@
 				)
 				.map(Into::into)
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				<orml_tokens::Pallet<T> as fungibles::Mutate<T::AccountId>>::burn_from(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 					who,
 					amount.into(),
 					precision,
@@ -368,7 +366,7 @@
 				)
 				.map(Into::into)
 			}
-			AssetIds::ForeignAssetId(fid) => {
+			AssetId::ForeignAssetId(fid) => {
 				let target_collection_id = match <AssetBinding<T>>::get(fid) {
 					Some(v) => v,
 					None => {
@@ -401,7 +399,7 @@
 		log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible transfer");
 
 		match asset {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => {
+			AssetId::NativeAssetId(NativeCurrency::Here) => {
 				match <pallet_balances::Pallet<T> as fungible::Mutate<T::AccountId>>::transfer(
 					source,
 					dest,
@@ -414,9 +412,9 @@
 					)),
 				}
 			}
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => {
 				match <orml_tokens::Pallet<T> as fungibles::Mutate<T::AccountId>>::transfer(
-					AssetIds::NativeAssetId(NativeCurrency::Parent),
+					AssetId::NativeAssetId(NativeCurrency::Parent),
 					source,
 					dest,
 					amount.into(),
@@ -426,7 +424,7 @@
 					Err(e) => Err(e),
 				}
 			}
-			AssetIds::ForeignAssetId(fid) => {
+			AssetId::ForeignAssetId(fid) => {
 				let target_collection_id = match <AssetBinding<T>>::get(fid) {
 					Some(v) => v,
 					None => {
@@ -479,7 +477,7 @@
 
 impl<T: Config> fungibles::Unbalanced<<T as SystemConfig>::AccountId> for Pallet<T>
 where
-	T: orml_tokens::Config<CurrencyId = AssetIds>,
+	T: orml_tokens::Config<CurrencyId = AssetId>,
 	BalanceOf<T>: From<<T as pallet_balances::Config>::Balance>,
 	BalanceOf<T>: From<<T as orml_tokens::Config>::Balance>,
 	<T as pallet_balances::Config>::Balance: From<BalanceOf<T>>,
modifiedpallets/foreign-assets/src/lib.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/lib.rs
+++ b/pallets/foreign-assets/src/lib.rs
@@ -79,8 +79,9 @@
 	Encode,
 	Decode,
 	TypeInfo,
+	Serialize,
+	Deserialize,
 )]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 pub enum NativeCurrency {
 	Here = 0,
 	Parent = 1,
@@ -98,9 +99,10 @@
 	Encode,
 	Decode,
 	TypeInfo,
+	Serialize,
+	Deserialize,
 )]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub enum AssetIds {
+pub enum AssetId {
 	ForeignAssetId(ForeignAssetId),
 	NativeAssetId(NativeCurrency),
 }
@@ -109,17 +111,17 @@
 	fn try_as_foreign(asset: T) -> Option<F>;
 }
 
-impl TryAsForeign<AssetIds, ForeignAssetId> for AssetIds {
-	fn try_as_foreign(asset: AssetIds) -> Option<ForeignAssetId> {
+impl TryAsForeign<AssetId, ForeignAssetId> for AssetId {
+	fn try_as_foreign(asset: AssetId) -> Option<ForeignAssetId> {
 		match asset {
-			AssetIds::ForeignAssetId(id) => Some(id),
+			Self::ForeignAssetId(id) => Some(id),
 			_ => None,
 		}
 	}
 }
 
 pub type ForeignAssetId = u32;
-pub type CurrencyId = AssetIds;
+pub type CurrencyId = AssetId;
 
 mod impl_fungibles;
 pub mod weights;
@@ -151,7 +153,7 @@
 {
 	fn get_asset_metadata(foreign_asset_id: ForeignAssetId) -> Option<AssetMetadata<BalanceOf<T>>> {
 		log::trace!(target: "fassets::asset_metadatas", "call");
-		Pallet::<T>::asset_metadatas(AssetIds::ForeignAssetId(foreign_asset_id))
+		Pallet::<T>::asset_metadatas(AssetId::ForeignAssetId(foreign_asset_id))
 	}
 
 	fn get_multi_location(foreign_asset_id: ForeignAssetId) -> Option<MultiLocation> {
@@ -161,7 +163,7 @@
 
 	fn get_currency_id(multi_location: MultiLocation) -> Option<CurrencyId> {
 		log::trace!(target: "fassets::get_currency_id", "call");
-		Pallet::<T>::location_to_currency_ids(multi_location).map(AssetIds::ForeignAssetId)
+		Pallet::<T>::location_to_currency_ids(multi_location).map(AssetId::ForeignAssetId)
 	}
 }
 
@@ -231,12 +233,12 @@
 		},
 		/// The asset registered.
 		AssetRegistered {
-			asset_id: AssetIds,
+			asset_id: AssetId,
 			metadata: AssetMetadata<BalanceOf<T>>,
 		},
 		/// The asset updated.
 		AssetUpdated {
-			asset_id: AssetIds,
+			asset_id: AssetId,
 			metadata: AssetMetadata<BalanceOf<T>>,
 		},
 	}
@@ -253,7 +255,7 @@
 	#[pallet::storage]
 	#[pallet::getter(fn foreign_asset_locations)]
 	pub type ForeignAssetLocations<T: Config> =
-		StorageMap<_, Twox64Concat, ForeignAssetId, xcm::v3::MultiLocation, OptionQuery>;
+		StorageMap<_, Twox64Concat, ForeignAssetId, staging_xcm::v3::MultiLocation, OptionQuery>;
 
 	/// The storages for CurrencyIds.
 	///
@@ -261,7 +263,7 @@
 	#[pallet::storage]
 	#[pallet::getter(fn location_to_currency_ids)]
 	pub type LocationToCurrencyIds<T: Config> =
-		StorageMap<_, Twox64Concat, xcm::v3::MultiLocation, ForeignAssetId, OptionQuery>;
+		StorageMap<_, Twox64Concat, staging_xcm::v3::MultiLocation, ForeignAssetId, OptionQuery>;
 
 	/// The storages for AssetMetadatas.
 	///
@@ -269,7 +271,7 @@
 	#[pallet::storage]
 	#[pallet::getter(fn asset_metadatas)]
 	pub type AssetMetadatas<T: Config> =
-		StorageMap<_, Twox64Concat, AssetIds, AssetMetadata<BalanceOf<T>>, OptionQuery>;
+		StorageMap<_, Twox64Concat, AssetId, AssetMetadata<BalanceOf<T>>, OptionQuery>;
 
 	/// The storages for assets to fungible collection binding
 	///
@@ -381,7 +383,7 @@
 					*maybe_location = Some(*location);
 
 					AssetMetadatas::<T>::try_mutate(
-						AssetIds::ForeignAssetId(foreign_asset_id),
+						AssetId::ForeignAssetId(foreign_asset_id),
 						|maybe_asset_metadatas| -> DispatchResult {
 							ensure!(maybe_asset_metadatas.is_none(), Error::<T>::AssetIdExisted);
 							*maybe_asset_metadatas = Some(metadata.clone());
@@ -413,7 +415,7 @@
 					.ok_or(Error::<T>::AssetIdNotExists)?;
 
 				AssetMetadatas::<T>::try_mutate(
-					AssetIds::ForeignAssetId(foreign_asset_id),
+					AssetId::ForeignAssetId(foreign_asset_id),
 					|maybe_asset_metadatas| -> DispatchResult {
 						ensure!(
 							maybe_asset_metadatas.is_some(),
@@ -450,7 +452,7 @@
 	traits::{
 		fungibles::Balanced, tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT,
 	},
-	weights::{WeightToFeePolynomial, WeightToFee},
+	weights::{WeightToFee, WeightToFeePolynomial},
 };
 
 pub struct FreeForAll<
@@ -477,7 +479,12 @@
 		Self(Weight::default(), Zero::zero(), PhantomData)
 	}
 
-	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {
+	fn buy_weight(
+		&mut self,
+		weight: Weight,
+		payment: Assets,
+		_xcm: &XcmContext,
+	) -> Result<Assets, XcmError> {
 		log::trace!(target: "fassets::weight", "buy_weight weight: {:?}, payment: {:?}", weight, payment);
 		Ok(payment)
 	}
modifiedpallets/identity/src/tests.rsdiffbeforeafterboth
before · pallets/identity/src/tests.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// Original license:18// This file is part of Substrate.1920// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// 	http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435// Tests for Identity Pallet3637use super::*;38use crate as pallet_identity;3940use codec::{Decode, Encode};41use frame_support::{42	assert_noop, assert_ok, ord_parameter_types, parameter_types,43	traits::{ConstU32, ConstU64, EitherOfDiverse},44	BoundedVec,45};46use frame_system::{EnsureRoot, EnsureSignedBy};47use sp_core::H256;48use sp_runtime::{49	testing::Header,50	traits::{BadOrigin, BlakeTwo256, IdentityLookup},51};5253type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;54type Block = frame_system::mocking::MockBlock<Test>;5556frame_support::construct_runtime!(57	pub enum Test where58		Block = Block,59		NodeBlock = Block,60		UncheckedExtrinsic = UncheckedExtrinsic,61	{62		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},63		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},64		Identity: pallet_identity::{Pallet, Call, Storage, Event<T>},65	}66);6768parameter_types! {69	pub BlockWeights: frame_system::limits::BlockWeights =70		frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_parts(1024, 0));71}72impl frame_system::Config for Test {73	type BaseCallFilter = frame_support::traits::Everything;74	type BlockWeights = ();75	type BlockLength = ();76	type RuntimeOrigin = RuntimeOrigin;77	type Index = u64;78	type BlockNumber = u64;79	type Hash = H256;80	type RuntimeCall = RuntimeCall;81	type Hashing = BlakeTwo256;82	type AccountId = u64;83	type Lookup = IdentityLookup<Self::AccountId>;84	type Header = Header;85	type RuntimeEvent = RuntimeEvent;86	type BlockHashCount = ConstU64<250>;87	type DbWeight = ();88	type Version = ();89	type PalletInfo = PalletInfo;90	type AccountData = pallet_balances::AccountData<u64>;91	type OnNewAccount = ();92	type OnKilledAccount = ();93	type SystemWeightInfo = ();94	type SS58Prefix = ();95	type OnSetCode = ();96	type MaxConsumers = ConstU32<16>;97}9899impl pallet_balances::Config for Test {100	type Balance = u64;101	type RuntimeEvent = RuntimeEvent;102	type DustRemoval = ();103	type ExistentialDeposit = ConstU64<1>;104	type AccountStore = System;105	type MaxLocks = ();106	type MaxReserves = ();107	type ReserveIdentifier = [u8; 8];108	type WeightInfo = ();109	type HoldIdentifier = ();110	type FreezeIdentifier = ();111	type MaxHolds = ();112	type MaxFreezes = ();113}114115parameter_types! {116	pub const MaxAdditionalFields: u32 = 2;117	pub const MaxRegistrars: u32 = 20;118}119120ord_parameter_types! {121	pub const One: u64 = 1;122	pub const Two: u64 = 2;123}124type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<One, u64>>;125type EnsureTwoOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<Two, u64>>;126impl pallet_identity::Config for Test {127	type RuntimeEvent = RuntimeEvent;128	type Currency = Balances;129	type Slashed = ();130	type BasicDeposit = ConstU64<10>;131	type FieldDeposit = ConstU64<10>;132	type SubAccountDeposit = ConstU64<10>;133	type MaxSubAccounts = ConstU32<2>;134	type MaxAdditionalFields = MaxAdditionalFields;135	type MaxRegistrars = MaxRegistrars;136	type RegistrarOrigin = EnsureOneOrRoot;137	type ForceOrigin = EnsureTwoOrRoot;138	type WeightInfo = ();139}140141pub fn new_test_ext() -> sp_io::TestExternalities {142	let mut t = frame_system::GenesisConfig::default()143		.build_storage::<Test>()144		.unwrap();145	pallet_balances::GenesisConfig::<Test> {146		balances: vec![(1, 10), (2, 10), (3, 10), (10, 100), (20, 100), (30, 100)],147	}148	.assimilate_storage(&mut t)149	.unwrap();150	t.into()151}152153fn ten() -> IdentityInfo<MaxAdditionalFields> {154	IdentityInfo {155		display: Data::Raw(b"ten".to_vec().try_into().unwrap()),156		legal: Data::Raw(b"The Right Ordinal Ten, Esq.".to_vec().try_into().unwrap()),157		..Default::default()158	}159}160161fn twenty() -> IdentityInfo<MaxAdditionalFields> {162	IdentityInfo {163		display: Data::Raw(b"twenty".to_vec().try_into().unwrap()),164		legal: Data::Raw(165			b"The Right Ordinal Twenty, Esq."166				.to_vec()167				.try_into()168				.unwrap(),169		),170		..Default::default()171	}172}173174#[test]175fn editing_subaccounts_should_work() {176	new_test_ext().execute_with(|| {177		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());178179		assert_noop!(180			Identity::add_sub(RuntimeOrigin::signed(10), 20, data(1)),181			Error::<Test>::NoIdentity182		);183184		assert_ok!(Identity::set_identity(185			RuntimeOrigin::signed(10),186			Box::new(ten())187		));188189		// first sub account190		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));191		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));192		assert_eq!(Balances::free_balance(10), 80);193194		// second sub account195		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 2, data(2)));196		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));197		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));198		assert_eq!(Balances::free_balance(10), 70);199200		// third sub account is too many201		assert_noop!(202			Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)),203			Error::<Test>::TooManySubAccounts204		);205206		// rename first sub account207		assert_ok!(Identity::rename_sub(RuntimeOrigin::signed(10), 1, data(11)));208		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(11))));209		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));210		assert_eq!(Balances::free_balance(10), 70);211212		// remove first sub account213		assert_ok!(Identity::remove_sub(RuntimeOrigin::signed(10), 1));214		assert_eq!(SuperOf::<Test>::get(1), None);215		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));216		assert_eq!(Balances::free_balance(10), 80);217218		// add third sub account219		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)));220		assert_eq!(SuperOf::<Test>::get(1), None);221		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));222		assert_eq!(SuperOf::<Test>::get(3), Some((10, data(3))));223		assert_eq!(Balances::free_balance(10), 70);224	});225}226227#[test]228fn resolving_subaccount_ownership_works() {229	new_test_ext().execute_with(|| {230		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());231232		assert_ok!(Identity::set_identity(233			RuntimeOrigin::signed(10),234			Box::new(ten())235		));236		assert_ok!(Identity::set_identity(237			RuntimeOrigin::signed(20),238			Box::new(twenty())239		));240241		// 10 claims 1 as a subaccount242		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));243		assert_eq!(Balances::free_balance(1), 10);244		assert_eq!(Balances::free_balance(10), 80);245		assert_eq!(Balances::reserved_balance(10), 20);246		// 20 cannot claim 1 now247		assert_noop!(248			Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)),249			Error::<Test>::AlreadyClaimed250		);251		// 1 wants to be with 20 so it quits from 10252		assert_ok!(Identity::quit_sub(RuntimeOrigin::signed(1)));253		// 1 gets the 10 that 10 paid.254		assert_eq!(Balances::free_balance(1), 20);255		assert_eq!(Balances::free_balance(10), 80);256		assert_eq!(Balances::reserved_balance(10), 10);257		// 20 can claim 1 now258		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)));259	});260}261262#[test]263fn trailing_zeros_decodes_into_default_data() {264	let encoded = Data::Raw(b"Hello".to_vec().try_into().unwrap()).encode();265	assert!(<(Data, Data)>::decode(&mut &encoded[..]).is_err());266	let input = &mut &encoded[..];267	let (a, b) = <(Data, Data)>::decode(&mut AppendZerosInput::new(input)).unwrap();268	assert_eq!(a, Data::Raw(b"Hello".to_vec().try_into().unwrap()));269	assert_eq!(b, Data::None);270}271272#[test]273fn adding_registrar_should_work() {274	new_test_ext().execute_with(|| {275		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));276		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));277		let fields = IdentityFields(IdentityField::Display | IdentityField::Legal);278		assert_ok!(Identity::set_fields(RuntimeOrigin::signed(3), 0, fields));279		assert_eq!(280			Identity::registrars(),281			vec![Some(RegistrarInfo {282				account: 3,283				fee: 10,284				fields285			})]286		);287	});288}289290#[test]291fn amount_of_registrars_is_limited() {292	new_test_ext().execute_with(|| {293		for i in 1..MaxRegistrars::get() + 1 {294			assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), i as u64));295		}296		let last_registrar = MaxRegistrars::get() as u64 + 1;297		assert_noop!(298			Identity::add_registrar(RuntimeOrigin::signed(1), last_registrar),299			Error::<Test>::TooManyRegistrars300		);301	});302}303304#[test]305fn registration_should_work() {306	new_test_ext().execute_with(|| {307		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));308		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));309		let mut three_fields = ten();310		three_fields311			.additional312			.try_push(Default::default())313			.unwrap();314		three_fields315			.additional316			.try_push(Default::default())317			.unwrap();318		assert!(three_fields319			.additional320			.try_push(Default::default())321			.is_err());322		assert_ok!(Identity::set_identity(323			RuntimeOrigin::signed(10),324			Box::new(ten())325		));326		assert_eq!(Identity::identity(10).unwrap().info, ten());327		assert_eq!(Balances::free_balance(10), 90);328		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));329		assert_eq!(Balances::free_balance(10), 100);330		assert_noop!(331			Identity::clear_identity(RuntimeOrigin::signed(10)),332			Error::<Test>::NotNamed333		);334	});335}336337#[test]338fn uninvited_judgement_should_work() {339	new_test_ext().execute_with(|| {340		assert_noop!(341			Identity::provide_judgement(342				RuntimeOrigin::signed(3),343				0,344				10,345				Judgement::Reasonable,346				H256::random()347			),348			Error::<Test>::InvalidIndex349		);350351		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));352		assert_noop!(353			Identity::provide_judgement(354				RuntimeOrigin::signed(3),355				0,356				10,357				Judgement::Reasonable,358				H256::random()359			),360			Error::<Test>::InvalidTarget361		);362363		assert_ok!(Identity::set_identity(364			RuntimeOrigin::signed(10),365			Box::new(ten())366		));367		assert_noop!(368			Identity::provide_judgement(369				RuntimeOrigin::signed(3),370				0,371				10,372				Judgement::Reasonable,373				H256::random()374			),375			Error::<Test>::JudgementForDifferentIdentity376		);377378		let identity_hash = BlakeTwo256::hash_of(&ten());379380		assert_noop!(381			Identity::provide_judgement(382				RuntimeOrigin::signed(10),383				0,384				10,385				Judgement::Reasonable,386				identity_hash387			),388			Error::<Test>::InvalidIndex389		);390		assert_noop!(391			Identity::provide_judgement(392				RuntimeOrigin::signed(3),393				0,394				10,395				Judgement::FeePaid(1),396				identity_hash397			),398			Error::<Test>::InvalidJudgement399		);400401		assert_ok!(Identity::provide_judgement(402			RuntimeOrigin::signed(3),403			0,404			10,405			Judgement::Reasonable,406			identity_hash407		));408		assert_eq!(409			Identity::identity(10).unwrap().judgements,410			vec![(0, Judgement::Reasonable)]411		);412	});413}414415#[test]416fn clearing_judgement_should_work() {417	new_test_ext().execute_with(|| {418		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));419		assert_ok!(Identity::set_identity(420			RuntimeOrigin::signed(10),421			Box::new(ten())422		));423		assert_ok!(Identity::provide_judgement(424			RuntimeOrigin::signed(3),425			0,426			10,427			Judgement::Reasonable,428			BlakeTwo256::hash_of(&ten())429		));430		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));431		assert_eq!(Identity::identity(10), None);432	});433}434435#[test]436fn killing_slashing_should_work() {437	new_test_ext().execute_with(|| {438		assert_ok!(Identity::set_identity(439			RuntimeOrigin::signed(10),440			Box::new(ten())441		));442		assert_noop!(443			Identity::kill_identity(RuntimeOrigin::signed(1), 10),444			BadOrigin445		);446		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));447		assert_eq!(Identity::identity(10), None);448		assert_eq!(Balances::free_balance(10), 90);449		assert_noop!(450			Identity::kill_identity(RuntimeOrigin::signed(2), 10),451			Error::<Test>::NotNamed452		);453	});454}455456#[test]457fn setting_subaccounts_should_work() {458	new_test_ext().execute_with(|| {459		let mut subs = vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))];460		assert_noop!(461			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),462			Error::<Test>::NotFound463		);464465		assert_ok!(Identity::set_identity(466			RuntimeOrigin::signed(10),467			Box::new(ten())468		));469		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));470		assert_eq!(Balances::free_balance(10), 80);471		assert_eq!(Identity::subs_of(10), (10, vec![20].try_into().unwrap()));472		assert_eq!(473			Identity::super_of(20),474			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))475		);476477		// push another item and re-set it.478		subs.push((30, Data::Raw(vec![50; 1].try_into().unwrap())));479		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));480		assert_eq!(Balances::free_balance(10), 70);481		assert_eq!(482			Identity::subs_of(10),483			(20, vec![20, 30].try_into().unwrap())484		);485		assert_eq!(486			Identity::super_of(20),487			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))488		);489		assert_eq!(490			Identity::super_of(30),491			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))492		);493494		// switch out one of the items and re-set.495		subs[0] = (40, Data::Raw(vec![60; 1].try_into().unwrap()));496		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));497		assert_eq!(Balances::free_balance(10), 70); // no change in the balance498		assert_eq!(499			Identity::subs_of(10),500			(20, vec![40, 30].try_into().unwrap())501		);502		assert_eq!(Identity::super_of(20), None);503		assert_eq!(504			Identity::super_of(30),505			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))506		);507		assert_eq!(508			Identity::super_of(40),509			Some((10, Data::Raw(vec![60; 1].try_into().unwrap())))510		);511512		// clear513		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), vec![]));514		assert_eq!(Balances::free_balance(10), 90);515		assert_eq!(Identity::subs_of(10), (0, BoundedVec::default()));516		assert_eq!(Identity::super_of(30), None);517		assert_eq!(Identity::super_of(40), None);518519		subs.push((20, Data::Raw(vec![40; 1].try_into().unwrap())));520		assert_noop!(521			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),522			Error::<Test>::TooManySubAccounts523		);524	});525}526527#[test]528fn clearing_account_should_remove_subaccounts_and_refund() {529	new_test_ext().execute_with(|| {530		assert_ok!(Identity::set_identity(531			RuntimeOrigin::signed(10),532			Box::new(ten())533		));534		assert_ok!(Identity::set_subs(535			RuntimeOrigin::signed(10),536			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]537		));538		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));539		assert_eq!(Balances::free_balance(10), 100);540		assert!(Identity::super_of(20).is_none());541	});542}543544#[test]545fn killing_account_should_remove_subaccounts_and_not_refund() {546	new_test_ext().execute_with(|| {547		assert_ok!(Identity::set_identity(548			RuntimeOrigin::signed(10),549			Box::new(ten())550		));551		assert_ok!(Identity::set_subs(552			RuntimeOrigin::signed(10),553			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]554		));555		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));556		assert_eq!(Balances::free_balance(10), 80);557		assert!(Identity::super_of(20).is_none());558	});559}560561#[test]562fn cancelling_requested_judgement_should_work() {563	new_test_ext().execute_with(|| {564		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));565		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));566		assert_noop!(567			Identity::cancel_request(RuntimeOrigin::signed(10), 0),568			Error::<Test>::NoIdentity569		);570		assert_ok!(Identity::set_identity(571			RuntimeOrigin::signed(10),572			Box::new(ten())573		));574		assert_ok!(Identity::request_judgement(575			RuntimeOrigin::signed(10),576			0,577			10578		));579		assert_ok!(Identity::cancel_request(RuntimeOrigin::signed(10), 0));580		assert_eq!(Balances::free_balance(10), 90);581		assert_noop!(582			Identity::cancel_request(RuntimeOrigin::signed(10), 0),583			Error::<Test>::NotFound584		);585586		assert_ok!(Identity::provide_judgement(587			RuntimeOrigin::signed(3),588			0,589			10,590			Judgement::Reasonable,591			BlakeTwo256::hash_of(&ten())592		));593		assert_noop!(594			Identity::cancel_request(RuntimeOrigin::signed(10), 0),595			Error::<Test>::JudgementGiven596		);597	});598}599600#[test]601fn requesting_judgement_should_work() {602	new_test_ext().execute_with(|| {603		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));604		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));605		assert_ok!(Identity::set_identity(606			RuntimeOrigin::signed(10),607			Box::new(ten())608		));609		assert_noop!(610			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 9),611			Error::<Test>::FeeChanged612		);613		assert_ok!(Identity::request_judgement(614			RuntimeOrigin::signed(10),615			0,616			10617		));618		// 10 for the judgement request, 10 for the identity.619		assert_eq!(Balances::free_balance(10), 80);620621		// Re-requesting won't work as we already paid.622		assert_noop!(623			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),624			Error::<Test>::StickyJudgement625		);626		assert_ok!(Identity::provide_judgement(627			RuntimeOrigin::signed(3),628			0,629			10,630			Judgement::Erroneous,631			BlakeTwo256::hash_of(&ten())632		));633		// Registrar got their payment now.634		assert_eq!(Balances::free_balance(3), 20);635636		// Re-requesting still won't work as it's erroneous.637		assert_noop!(638			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),639			Error::<Test>::StickyJudgement640		);641642		// Requesting from a second registrar still works.643		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 4));644		assert_ok!(Identity::request_judgement(645			RuntimeOrigin::signed(10),646			1,647			10648		));649650		// Re-requesting after the judgement has been reduced works.651		assert_ok!(Identity::provide_judgement(652			RuntimeOrigin::signed(3),653			0,654			10,655			Judgement::OutOfDate,656			BlakeTwo256::hash_of(&ten())657		));658		assert_ok!(Identity::request_judgement(659			RuntimeOrigin::signed(10),660			0,661			10662		));663	});664}665666#[test]667fn provide_judgement_should_return_judgement_payment_failed_error() {668	new_test_ext().execute_with(|| {669		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));670		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));671		assert_ok!(Identity::set_identity(672			RuntimeOrigin::signed(10),673			Box::new(ten())674		));675		assert_ok!(Identity::request_judgement(676			RuntimeOrigin::signed(10),677			0,678			10679		));680		// 10 for the judgement request, 10 for the identity.681		assert_eq!(Balances::free_balance(10), 80);682683		// This forces judgement payment failed error684		Balances::make_free_balance_be(&3, 0);685		assert_noop!(686			Identity::provide_judgement(687				RuntimeOrigin::signed(3),688				0,689				10,690				Judgement::Erroneous,691				BlakeTwo256::hash_of(&ten())692			),693			Error::<Test>::JudgementPaymentFailed694		);695	});696}697698#[test]699fn field_deposit_should_work() {700	new_test_ext().execute_with(|| {701		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));702		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));703		assert_ok!(Identity::set_identity(704			RuntimeOrigin::signed(10),705			Box::new(IdentityInfo {706				additional: vec![707					(708						Data::Raw(b"number".to_vec().try_into().unwrap()),709						Data::Raw(10u32.encode().try_into().unwrap())710					),711					(712						Data::Raw(b"text".to_vec().try_into().unwrap()),713						Data::Raw(b"10".to_vec().try_into().unwrap())714					),715				]716				.try_into()717				.unwrap(),718				..Default::default()719			})720		));721		assert_eq!(Balances::free_balance(10), 70);722	});723}724725#[test]726fn setting_account_id_should_work() {727	new_test_ext().execute_with(|| {728		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));729		// account 4 cannot change the first registrar's identity since it's owned by 3.730		assert_noop!(731			Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3),732			Error::<Test>::InvalidIndex733		);734		// account 3 can, because that's the registrar's current account.735		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(3), 0, 4));736		// account 4 can now, because that's their new ID.737		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3));738	});739}740741#[test]742fn test_has_identity() {743	new_test_ext().execute_with(|| {744		assert_ok!(Identity::set_identity(745			RuntimeOrigin::signed(10),746			Box::new(ten())747		));748		assert!(Identity::has_identity(&10, IdentityField::Display as u64));749		assert!(Identity::has_identity(&10, IdentityField::Legal as u64));750		assert!(Identity::has_identity(751			&10,752			IdentityField::Display as u64 | IdentityField::Legal as u64753		));754		assert!(!Identity::has_identity(755			&10,756			IdentityField::Display as u64 | IdentityField::Legal as u64 | IdentityField::Web as u64757		));758	});759}
after · pallets/identity/src/tests.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// Original license:18// This file is part of Substrate.1920// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// 	http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435// Tests for Identity Pallet3637use super::*;38use crate as pallet_identity;3940use codec::{Decode, Encode};41use frame_support::{42	assert_noop, assert_ok, ord_parameter_types, parameter_types,43	traits::{ConstU32, ConstU64, EitherOfDiverse},44	BoundedVec,45};46use frame_system::{EnsureRoot, EnsureSignedBy};47use sp_core::H256;48use sp_runtime::{49	testing::Header,50	traits::{BadOrigin, BlakeTwo256, IdentityLookup},51};5253type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;54type Block = frame_system::mocking::MockBlock<Test>;5556frame_support::construct_runtime!(57	pub enum Test {58		System: frame_system,59		Balances: pallet_balances,60		Identity: pallet_identity,61	}62);6364parameter_types! {65	pub BlockWeights: frame_system::limits::BlockWeights =66		frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_parts(1024, 0));67}68impl frame_system::Config for Test {69	type BaseCallFilter = frame_support::traits::Everything;70	type Block = Block;71	type BlockWeights = ();72	type BlockLength = ();73	type RuntimeOrigin = RuntimeOrigin;74	type Nonce = u64;75	type Hash = H256;76	type RuntimeCall = RuntimeCall;77	type Hashing = BlakeTwo256;78	type AccountId = u64;79	type Lookup = IdentityLookup<Self::AccountId>;80	type RuntimeEvent = RuntimeEvent;81	type BlockHashCount = ConstU64<250>;82	type DbWeight = ();83	type Version = ();84	type PalletInfo = PalletInfo;85	type AccountData = pallet_balances::AccountData<u64>;86	type OnNewAccount = ();87	type OnKilledAccount = ();88	type SystemWeightInfo = ();89	type SS58Prefix = ();90	type OnSetCode = ();91	type MaxConsumers = ConstU32<16>;92}9394impl pallet_balances::Config for Test {95	type Balance = u64;96	type RuntimeEvent = RuntimeEvent;97	type DustRemoval = ();98	type ExistentialDeposit = ConstU64<1>;99	type AccountStore = System;100	type MaxLocks = ();101	type MaxReserves = ();102	type ReserveIdentifier = [u8; 8];103	type WeightInfo = ();104	type RuntimeHoldReason = RuntimeHoldReason;105	type FreezeIdentifier = ();106	type MaxHolds = ();107	type MaxFreezes = ();108}109110parameter_types! {111	pub const MaxAdditionalFields: u32 = 2;112	pub const MaxRegistrars: u32 = 20;113}114115ord_parameter_types! {116	pub const One: u64 = 1;117	pub const Two: u64 = 2;118}119type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<One, u64>>;120type EnsureTwoOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<Two, u64>>;121impl pallet_identity::Config for Test {122	type RuntimeEvent = RuntimeEvent;123	type Currency = Balances;124	type Slashed = ();125	type BasicDeposit = ConstU64<10>;126	type FieldDeposit = ConstU64<10>;127	type SubAccountDeposit = ConstU64<10>;128	type MaxSubAccounts = ConstU32<2>;129	type MaxAdditionalFields = MaxAdditionalFields;130	type MaxRegistrars = MaxRegistrars;131	type RegistrarOrigin = EnsureOneOrRoot;132	type ForceOrigin = EnsureTwoOrRoot;133	type WeightInfo = ();134}135136pub fn new_test_ext() -> sp_io::TestExternalities {137	let mut t = <frame_system::GenesisConfig<Test>>::default()138		.build_storage()139		.unwrap();140	pallet_balances::GenesisConfig::<Test> {141		balances: vec![(1, 10), (2, 10), (3, 10), (10, 100), (20, 100), (30, 100)],142	}143	.assimilate_storage(&mut t)144	.unwrap();145	t.into()146}147148fn ten() -> IdentityInfo<MaxAdditionalFields> {149	IdentityInfo {150		display: Data::Raw(b"ten".to_vec().try_into().unwrap()),151		legal: Data::Raw(b"The Right Ordinal Ten, Esq.".to_vec().try_into().unwrap()),152		..Default::default()153	}154}155156fn twenty() -> IdentityInfo<MaxAdditionalFields> {157	IdentityInfo {158		display: Data::Raw(b"twenty".to_vec().try_into().unwrap()),159		legal: Data::Raw(160			b"The Right Ordinal Twenty, Esq."161				.to_vec()162				.try_into()163				.unwrap(),164		),165		..Default::default()166	}167}168169#[test]170fn editing_subaccounts_should_work() {171	new_test_ext().execute_with(|| {172		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());173174		assert_noop!(175			Identity::add_sub(RuntimeOrigin::signed(10), 20, data(1)),176			Error::<Test>::NoIdentity177		);178179		assert_ok!(Identity::set_identity(180			RuntimeOrigin::signed(10),181			Box::new(ten())182		));183184		// first sub account185		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));186		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));187		assert_eq!(Balances::free_balance(10), 80);188189		// second sub account190		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 2, data(2)));191		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));192		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));193		assert_eq!(Balances::free_balance(10), 70);194195		// third sub account is too many196		assert_noop!(197			Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)),198			Error::<Test>::TooManySubAccounts199		);200201		// rename first sub account202		assert_ok!(Identity::rename_sub(RuntimeOrigin::signed(10), 1, data(11)));203		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(11))));204		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));205		assert_eq!(Balances::free_balance(10), 70);206207		// remove first sub account208		assert_ok!(Identity::remove_sub(RuntimeOrigin::signed(10), 1));209		assert_eq!(SuperOf::<Test>::get(1), None);210		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));211		assert_eq!(Balances::free_balance(10), 80);212213		// add third sub account214		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)));215		assert_eq!(SuperOf::<Test>::get(1), None);216		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));217		assert_eq!(SuperOf::<Test>::get(3), Some((10, data(3))));218		assert_eq!(Balances::free_balance(10), 70);219	});220}221222#[test]223fn resolving_subaccount_ownership_works() {224	new_test_ext().execute_with(|| {225		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());226227		assert_ok!(Identity::set_identity(228			RuntimeOrigin::signed(10),229			Box::new(ten())230		));231		assert_ok!(Identity::set_identity(232			RuntimeOrigin::signed(20),233			Box::new(twenty())234		));235236		// 10 claims 1 as a subaccount237		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));238		assert_eq!(Balances::free_balance(1), 10);239		assert_eq!(Balances::free_balance(10), 80);240		assert_eq!(Balances::reserved_balance(10), 20);241		// 20 cannot claim 1 now242		assert_noop!(243			Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)),244			Error::<Test>::AlreadyClaimed245		);246		// 1 wants to be with 20 so it quits from 10247		assert_ok!(Identity::quit_sub(RuntimeOrigin::signed(1)));248		// 1 gets the 10 that 10 paid.249		assert_eq!(Balances::free_balance(1), 20);250		assert_eq!(Balances::free_balance(10), 80);251		assert_eq!(Balances::reserved_balance(10), 10);252		// 20 can claim 1 now253		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)));254	});255}256257#[test]258fn trailing_zeros_decodes_into_default_data() {259	let encoded = Data::Raw(b"Hello".to_vec().try_into().unwrap()).encode();260	assert!(<(Data, Data)>::decode(&mut &encoded[..]).is_err());261	let input = &mut &encoded[..];262	let (a, b) = <(Data, Data)>::decode(&mut AppendZerosInput::new(input)).unwrap();263	assert_eq!(a, Data::Raw(b"Hello".to_vec().try_into().unwrap()));264	assert_eq!(b, Data::None);265}266267#[test]268fn adding_registrar_should_work() {269	new_test_ext().execute_with(|| {270		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));271		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));272		let fields = IdentityFields(IdentityField::Display | IdentityField::Legal);273		assert_ok!(Identity::set_fields(RuntimeOrigin::signed(3), 0, fields));274		assert_eq!(275			Identity::registrars(),276			vec![Some(RegistrarInfo {277				account: 3,278				fee: 10,279				fields280			})]281		);282	});283}284285#[test]286fn amount_of_registrars_is_limited() {287	new_test_ext().execute_with(|| {288		for i in 1..MaxRegistrars::get() + 1 {289			assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), i as u64));290		}291		let last_registrar = MaxRegistrars::get() as u64 + 1;292		assert_noop!(293			Identity::add_registrar(RuntimeOrigin::signed(1), last_registrar),294			Error::<Test>::TooManyRegistrars295		);296	});297}298299#[test]300fn registration_should_work() {301	new_test_ext().execute_with(|| {302		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));303		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));304		let mut three_fields = ten();305		three_fields306			.additional307			.try_push(Default::default())308			.unwrap();309		three_fields310			.additional311			.try_push(Default::default())312			.unwrap();313		assert!(three_fields314			.additional315			.try_push(Default::default())316			.is_err());317		assert_ok!(Identity::set_identity(318			RuntimeOrigin::signed(10),319			Box::new(ten())320		));321		assert_eq!(Identity::identity(10).unwrap().info, ten());322		assert_eq!(Balances::free_balance(10), 90);323		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));324		assert_eq!(Balances::free_balance(10), 100);325		assert_noop!(326			Identity::clear_identity(RuntimeOrigin::signed(10)),327			Error::<Test>::NotNamed328		);329	});330}331332#[test]333fn uninvited_judgement_should_work() {334	new_test_ext().execute_with(|| {335		assert_noop!(336			Identity::provide_judgement(337				RuntimeOrigin::signed(3),338				0,339				10,340				Judgement::Reasonable,341				H256::random()342			),343			Error::<Test>::InvalidIndex344		);345346		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));347		assert_noop!(348			Identity::provide_judgement(349				RuntimeOrigin::signed(3),350				0,351				10,352				Judgement::Reasonable,353				H256::random()354			),355			Error::<Test>::InvalidTarget356		);357358		assert_ok!(Identity::set_identity(359			RuntimeOrigin::signed(10),360			Box::new(ten())361		));362		assert_noop!(363			Identity::provide_judgement(364				RuntimeOrigin::signed(3),365				0,366				10,367				Judgement::Reasonable,368				H256::random()369			),370			Error::<Test>::JudgementForDifferentIdentity371		);372373		let identity_hash = BlakeTwo256::hash_of(&ten());374375		assert_noop!(376			Identity::provide_judgement(377				RuntimeOrigin::signed(10),378				0,379				10,380				Judgement::Reasonable,381				identity_hash382			),383			Error::<Test>::InvalidIndex384		);385		assert_noop!(386			Identity::provide_judgement(387				RuntimeOrigin::signed(3),388				0,389				10,390				Judgement::FeePaid(1),391				identity_hash392			),393			Error::<Test>::InvalidJudgement394		);395396		assert_ok!(Identity::provide_judgement(397			RuntimeOrigin::signed(3),398			0,399			10,400			Judgement::Reasonable,401			identity_hash402		));403		assert_eq!(404			Identity::identity(10).unwrap().judgements,405			vec![(0, Judgement::Reasonable)]406		);407	});408}409410#[test]411fn clearing_judgement_should_work() {412	new_test_ext().execute_with(|| {413		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));414		assert_ok!(Identity::set_identity(415			RuntimeOrigin::signed(10),416			Box::new(ten())417		));418		assert_ok!(Identity::provide_judgement(419			RuntimeOrigin::signed(3),420			0,421			10,422			Judgement::Reasonable,423			BlakeTwo256::hash_of(&ten())424		));425		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));426		assert_eq!(Identity::identity(10), None);427	});428}429430#[test]431fn killing_slashing_should_work() {432	new_test_ext().execute_with(|| {433		assert_ok!(Identity::set_identity(434			RuntimeOrigin::signed(10),435			Box::new(ten())436		));437		assert_noop!(438			Identity::kill_identity(RuntimeOrigin::signed(1), 10),439			BadOrigin440		);441		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));442		assert_eq!(Identity::identity(10), None);443		assert_eq!(Balances::free_balance(10), 90);444		assert_noop!(445			Identity::kill_identity(RuntimeOrigin::signed(2), 10),446			Error::<Test>::NotNamed447		);448	});449}450451#[test]452fn setting_subaccounts_should_work() {453	new_test_ext().execute_with(|| {454		let mut subs = vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))];455		assert_noop!(456			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),457			Error::<Test>::NotFound458		);459460		assert_ok!(Identity::set_identity(461			RuntimeOrigin::signed(10),462			Box::new(ten())463		));464		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));465		assert_eq!(Balances::free_balance(10), 80);466		assert_eq!(Identity::subs_of(10), (10, vec![20].try_into().unwrap()));467		assert_eq!(468			Identity::super_of(20),469			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))470		);471472		// push another item and re-set it.473		subs.push((30, Data::Raw(vec![50; 1].try_into().unwrap())));474		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));475		assert_eq!(Balances::free_balance(10), 70);476		assert_eq!(477			Identity::subs_of(10),478			(20, vec![20, 30].try_into().unwrap())479		);480		assert_eq!(481			Identity::super_of(20),482			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))483		);484		assert_eq!(485			Identity::super_of(30),486			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))487		);488489		// switch out one of the items and re-set.490		subs[0] = (40, Data::Raw(vec![60; 1].try_into().unwrap()));491		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));492		assert_eq!(Balances::free_balance(10), 70); // no change in the balance493		assert_eq!(494			Identity::subs_of(10),495			(20, vec![40, 30].try_into().unwrap())496		);497		assert_eq!(Identity::super_of(20), None);498		assert_eq!(499			Identity::super_of(30),500			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))501		);502		assert_eq!(503			Identity::super_of(40),504			Some((10, Data::Raw(vec![60; 1].try_into().unwrap())))505		);506507		// clear508		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), vec![]));509		assert_eq!(Balances::free_balance(10), 90);510		assert_eq!(Identity::subs_of(10), (0, BoundedVec::default()));511		assert_eq!(Identity::super_of(30), None);512		assert_eq!(Identity::super_of(40), None);513514		subs.push((20, Data::Raw(vec![40; 1].try_into().unwrap())));515		assert_noop!(516			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),517			Error::<Test>::TooManySubAccounts518		);519	});520}521522#[test]523fn clearing_account_should_remove_subaccounts_and_refund() {524	new_test_ext().execute_with(|| {525		assert_ok!(Identity::set_identity(526			RuntimeOrigin::signed(10),527			Box::new(ten())528		));529		assert_ok!(Identity::set_subs(530			RuntimeOrigin::signed(10),531			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]532		));533		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));534		assert_eq!(Balances::free_balance(10), 100);535		assert!(Identity::super_of(20).is_none());536	});537}538539#[test]540fn killing_account_should_remove_subaccounts_and_not_refund() {541	new_test_ext().execute_with(|| {542		assert_ok!(Identity::set_identity(543			RuntimeOrigin::signed(10),544			Box::new(ten())545		));546		assert_ok!(Identity::set_subs(547			RuntimeOrigin::signed(10),548			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]549		));550		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));551		assert_eq!(Balances::free_balance(10), 80);552		assert!(Identity::super_of(20).is_none());553	});554}555556#[test]557fn cancelling_requested_judgement_should_work() {558	new_test_ext().execute_with(|| {559		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));560		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));561		assert_noop!(562			Identity::cancel_request(RuntimeOrigin::signed(10), 0),563			Error::<Test>::NoIdentity564		);565		assert_ok!(Identity::set_identity(566			RuntimeOrigin::signed(10),567			Box::new(ten())568		));569		assert_ok!(Identity::request_judgement(570			RuntimeOrigin::signed(10),571			0,572			10573		));574		assert_ok!(Identity::cancel_request(RuntimeOrigin::signed(10), 0));575		assert_eq!(Balances::free_balance(10), 90);576		assert_noop!(577			Identity::cancel_request(RuntimeOrigin::signed(10), 0),578			Error::<Test>::NotFound579		);580581		assert_ok!(Identity::provide_judgement(582			RuntimeOrigin::signed(3),583			0,584			10,585			Judgement::Reasonable,586			BlakeTwo256::hash_of(&ten())587		));588		assert_noop!(589			Identity::cancel_request(RuntimeOrigin::signed(10), 0),590			Error::<Test>::JudgementGiven591		);592	});593}594595#[test]596fn requesting_judgement_should_work() {597	new_test_ext().execute_with(|| {598		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));599		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));600		assert_ok!(Identity::set_identity(601			RuntimeOrigin::signed(10),602			Box::new(ten())603		));604		assert_noop!(605			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 9),606			Error::<Test>::FeeChanged607		);608		assert_ok!(Identity::request_judgement(609			RuntimeOrigin::signed(10),610			0,611			10612		));613		// 10 for the judgement request, 10 for the identity.614		assert_eq!(Balances::free_balance(10), 80);615616		// Re-requesting won't work as we already paid.617		assert_noop!(618			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),619			Error::<Test>::StickyJudgement620		);621		assert_ok!(Identity::provide_judgement(622			RuntimeOrigin::signed(3),623			0,624			10,625			Judgement::Erroneous,626			BlakeTwo256::hash_of(&ten())627		));628		// Registrar got their payment now.629		assert_eq!(Balances::free_balance(3), 20);630631		// Re-requesting still won't work as it's erroneous.632		assert_noop!(633			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),634			Error::<Test>::StickyJudgement635		);636637		// Requesting from a second registrar still works.638		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 4));639		assert_ok!(Identity::request_judgement(640			RuntimeOrigin::signed(10),641			1,642			10643		));644645		// Re-requesting after the judgement has been reduced works.646		assert_ok!(Identity::provide_judgement(647			RuntimeOrigin::signed(3),648			0,649			10,650			Judgement::OutOfDate,651			BlakeTwo256::hash_of(&ten())652		));653		assert_ok!(Identity::request_judgement(654			RuntimeOrigin::signed(10),655			0,656			10657		));658	});659}660661#[test]662fn provide_judgement_should_return_judgement_payment_failed_error() {663	new_test_ext().execute_with(|| {664		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));665		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));666		assert_ok!(Identity::set_identity(667			RuntimeOrigin::signed(10),668			Box::new(ten())669		));670		assert_ok!(Identity::request_judgement(671			RuntimeOrigin::signed(10),672			0,673			10674		));675		// 10 for the judgement request, 10 for the identity.676		assert_eq!(Balances::free_balance(10), 80);677678		// This forces judgement payment failed error679		Balances::make_free_balance_be(&3, 0);680		assert_noop!(681			Identity::provide_judgement(682				RuntimeOrigin::signed(3),683				0,684				10,685				Judgement::Erroneous,686				BlakeTwo256::hash_of(&ten())687			),688			Error::<Test>::JudgementPaymentFailed689		);690	});691}692693#[test]694fn field_deposit_should_work() {695	new_test_ext().execute_with(|| {696		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));697		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));698		assert_ok!(Identity::set_identity(699			RuntimeOrigin::signed(10),700			Box::new(IdentityInfo {701				additional: vec![702					(703						Data::Raw(b"number".to_vec().try_into().unwrap()),704						Data::Raw(10u32.encode().try_into().unwrap())705					),706					(707						Data::Raw(b"text".to_vec().try_into().unwrap()),708						Data::Raw(b"10".to_vec().try_into().unwrap())709					),710				]711				.try_into()712				.unwrap(),713				..Default::default()714			})715		));716		assert_eq!(Balances::free_balance(10), 70);717	});718}719720#[test]721fn setting_account_id_should_work() {722	new_test_ext().execute_with(|| {723		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));724		// account 4 cannot change the first registrar's identity since it's owned by 3.725		assert_noop!(726			Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3),727			Error::<Test>::InvalidIndex728		);729		// account 3 can, because that's the registrar's current account.730		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(3), 0, 4));731		// account 4 can now, because that's their new ID.732		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3));733	});734}735736#[test]737fn test_has_identity() {738	new_test_ext().execute_with(|| {739		assert_ok!(Identity::set_identity(740			RuntimeOrigin::signed(10),741			Box::new(ten())742		));743		assert!(Identity::has_identity(&10, IdentityField::Display as u64));744		assert!(Identity::has_identity(&10, IdentityField::Legal as u64));745		assert!(Identity::has_identity(746			&10,747			IdentityField::Display as u64 | IdentityField::Legal as u64748		));749		assert!(!Identity::has_identity(750			&10,751			IdentityField::Display as u64 | IdentityField::Legal as u64 | IdentityField::Web as u64752		));753	});754}
modifiedpallets/identity/src/types.rsdiffbeforeafterboth
--- a/pallets/identity/src/types.rs
+++ b/pallets/identity/src/types.rs
@@ -77,7 +77,9 @@
 }
 
 impl Decode for Data {
-	fn decode<I: codec::Input>(input: &mut I) -> sp_std::result::Result<Self, codec::Error> {
+	fn decode<I: parity_scale_codec::Input>(
+		input: &mut I,
+	) -> sp_std::result::Result<Self, parity_scale_codec::Error> {
 		let b = input.read_byte()?;
 		Ok(match b {
 			0 => Data::None,
@@ -92,7 +94,7 @@
 			35 => Data::Sha256(<[u8; 32]>::decode(input)?),
 			36 => Data::Keccak256(<[u8; 32]>::decode(input)?),
 			37 => Data::ShaThree256(<[u8; 32]>::decode(input)?),
-			_ => return Err(codec::Error::from("invalid leading byte")),
+			_ => return Err(parity_scale_codec::Error::from("invalid leading byte")),
 		})
 	}
 }
@@ -114,7 +116,7 @@
 		}
 	}
 }
-impl codec::EncodeLike for Data {}
+impl parity_scale_codec::EncodeLike for Data {}
 
 /// Add a Raw variant with the given index and a fixed sized byte array
 macro_rules! data_raw_variants {
@@ -284,7 +286,9 @@
 	}
 }
 impl Decode for IdentityFields {
-	fn decode<I: codec::Input>(input: &mut I) -> sp_std::result::Result<Self, codec::Error> {
+	fn decode<I: parity_scale_codec::Input>(
+		input: &mut I,
+	) -> sp_std::result::Result<Self, parity_scale_codec::Error> {
 		let field = u64::decode(input)?;
 		Ok(Self(
 			<BitFlags<IdentityField>>::from_bits(field).map_err(|_| "invalid value")?,
@@ -445,7 +449,9 @@
 		MaxAdditionalFields: Get<u32>,
 	> Decode for Registration<Balance, MaxJudgements, MaxAdditionalFields>
 {
-	fn decode<I: codec::Input>(input: &mut I) -> sp_std::result::Result<Self, codec::Error> {
+	fn decode<I: parity_scale_codec::Input>(
+		input: &mut I,
+	) -> sp_std::result::Result<Self, parity_scale_codec::Error> {
 		let (judgements, deposit, info) = Decode::decode(&mut AppendZerosInput::new(input))?;
 		Ok(Self {
 			judgements,
modifiedpallets/inflation/src/lib.rsdiffbeforeafterboth
--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -73,11 +73,11 @@
 		type TreasuryAccountId: Get<Self::AccountId>;
 
 		// The block number provider
-		type BlockNumberProvider: BlockNumberProvider<BlockNumber = Self::BlockNumber>;
+		type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
 
 		/// Number of blocks that pass between treasury balance updates due to inflation
 		#[pallet::constant]
-		type InflationBlockInterval: Get<Self::BlockNumber>;
+		type InflationBlockInterval: Get<BlockNumberFor<Self>>;
 	}
 
 	#[pallet::pallet]
@@ -95,22 +95,23 @@
 	/// Next target (relay) block when inflation will be applied
 	#[pallet::storage]
 	pub type NextInflationBlock<T: Config> =
-		StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
+		StorageValue<Value = BlockNumberFor<T>, QueryKind = ValueQuery>;
 
 	/// Next target (relay) block when inflation is recalculated
 	#[pallet::storage]
 	pub type NextRecalculationBlock<T: Config> =
-		StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
+		StorageValue<Value = BlockNumberFor<T>, QueryKind = ValueQuery>;
 
 	/// Relay block when inflation has started
 	#[pallet::storage]
-	pub type StartBlock<T: Config> = StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
+	pub type StartBlock<T: Config> =
+		StorageValue<Value = BlockNumberFor<T>, QueryKind = ValueQuery>;
 
 	#[pallet::hooks]
 	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
-		fn on_initialize(_: T::BlockNumber) -> Weight
+		fn on_initialize(_: BlockNumberFor<T>) -> Weight
 		where
-			<T as frame_system::Config>::BlockNumber: From<u32>,
+			BlockNumberFor<T>: From<u32>,
 		{
 			let mut consumed_weight = Weight::zero();
 			let mut add_weight = |reads, writes, weight| {
@@ -120,7 +121,7 @@
 
 			let block_interval: u32 = T::InflationBlockInterval::get().try_into().unwrap_or(0);
 			let current_relay_block = T::BlockNumberProvider::current_block_number();
-			let next_inflation: T::BlockNumber = <NextInflationBlock<T>>::get();
+			let next_inflation: BlockNumberFor<T> = <NextInflationBlock<T>>::get();
 			add_weight(1, 0, Weight::from_parts(5_000_000, 0));
 
 			// Apply inflation every InflationBlockInterval blocks
@@ -129,7 +130,7 @@
 				// Recalculate inflation on the first block of the year (or if it is not initialized yet)
 				// Do the "current_relay_block >= next_recalculation" check in the "current_relay_block >= next_inflation"
 				// block because it saves InflationBlockInterval DB reads for NextRecalculationBlock.
-				let next_recalculation: T::BlockNumber = <NextRecalculationBlock<T>>::get();
+				let next_recalculation: BlockNumberFor<T> = <NextRecalculationBlock<T>>::get();
 				add_weight(1, 0, Weight::zero());
 				if current_relay_block >= next_recalculation {
 					Self::recalculate_inflation(next_recalculation);
@@ -169,10 +170,10 @@
 		#[pallet::weight(Weight::from_parts(0, 0))]
 		pub fn start_inflation(
 			origin: OriginFor<T>,
-			inflation_start_relay_block: T::BlockNumber,
+			inflation_start_relay_block: BlockNumberFor<T>,
 		) -> DispatchResult
 		where
-			<T as frame_system::Config>::BlockNumber: From<u32>,
+			BlockNumberFor<T>: From<u32>,
 		{
 			ensure_root(origin)?;
 
@@ -200,9 +201,9 @@
 }
 
 impl<T: Config> Pallet<T> {
-	pub fn recalculate_inflation(recalculation_block: T::BlockNumber) {
+	pub fn recalculate_inflation(recalculation_block: BlockNumberFor<T>) {
 		let current_year: u32 = ((recalculation_block - <StartBlock<T>>::get())
-			/ T::BlockNumber::from(YEAR))
+			/ BlockNumberFor::<T>::from(YEAR))
 		.try_into()
 		.unwrap_or(0);
 		let block_interval: u32 = T::InflationBlockInterval::get().try_into().unwrap_or(0);
modifiedpallets/inflation/src/tests.rsdiffbeforeafterboth
--- a/pallets/inflation/src/tests.rs
+++ b/pallets/inflation/src/tests.rs
@@ -57,21 +57,16 @@
 	type MaxLocks = MaxLocks;
 	type MaxReserves = ();
 	type ReserveIdentifier = ();
-	type HoldIdentifier = ();
 	type FreezeIdentifier = ();
 	type MaxHolds = ();
 	type MaxFreezes = ();
 }
 
 frame_support::construct_runtime!(
-	pub enum Test where
-		Block = Block,
-		NodeBlock = Block,
-		UncheckedExtrinsic = UncheckedExtrinsic,
-	{
-		Balances: pallet_balances::{Pallet, Call, Storage},
-		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-		Inflation: pallet_inflation::{Pallet, Call, Storage},
+	pub enum Test {
+		Balances: pallet_balances,
+		System: frame_system,
+		Inflation: pallet_inflation,
 	}
 );
 
@@ -89,13 +84,11 @@
 	type DbWeight = ();
 	type RuntimeOrigin = RuntimeOrigin;
 	type RuntimeCall = RuntimeCall;
-	type Index = u64;
-	type BlockNumber = u64;
+	type Nonce = u64;
 	type Hash = H256;
 	type Hashing = BlakeTwo256;
 	type AccountId = u64;
 	type Lookup = IdentityLookup<Self::AccountId>;
-	type Header = Header;
 	type RuntimeEvent = ();
 	type BlockHashCount = BlockHashCount;
 	type Version = ();
@@ -112,11 +105,11 @@
 parameter_types! {
 	pub TreasuryAccountId: u64 = 1234;
 	pub const InflationBlockInterval: u32 = 100; // every time per how many blocks inflation is applied
-	pub static MockBlockNumberProvider: u64 = 0;
+	pub static MockBlockNumberProvider: u32 = 0;
 }
 
 impl BlockNumberProvider for MockBlockNumberProvider {
-	type BlockNumber = u64;
+	type BlockNumber = u32;
 
 	fn current_block_number() -> Self::BlockNumber {
 		Self::get()
@@ -131,8 +124,8 @@
 }
 
 pub fn new_test_ext() -> sp_io::TestExternalities {
-	frame_system::GenesisConfig::default()
-		.build_storage::<Test>()
+	<frame_system::GenesisConfig<Test>>::default()
+		.build_storage()
 		.unwrap()
 		.into()
 }
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -90,37 +90,37 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
+use core::ops::Deref;
+
 use erc::ERC721Events;
 use evm_coder::ToLog;
 use frame_support::{
-	BoundedVec, ensure, fail, transactional,
+	dispatch::{Pays, PostDispatchInfo},
+	ensure, fail,
+	pallet_prelude::*,
 	storage::with_transaction,
-	pallet_prelude::DispatchResultWithPostInfo,
-	pallet_prelude::Weight,
-	dispatch::{PostDispatchInfo, Pays},
-};
-use up_data_structs::{
-	AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
-	mapping::TokenAddressMapping, budget::Budget, Property, PropertyKey, PropertyValue,
-	PropertyKeyPermission, PropertyScope, TokenChild, AuxPropertyValue, PropertiesPermissionMap,
-	TokenProperties as TokenPropertiesT,
+	transactional, BoundedVec,
 };
-use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
+pub use pallet::*;
 use pallet_common::{
 	Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,
 	eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,
 	weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,
 };
-use pallet_structure::{Pallet as PalletStructure, Error as StructureError};
+use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
+use pallet_structure::{Error as StructureError, Pallet as PalletStructure};
+use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
+use scale_info::TypeInfo;
 use sp_core::{Get, H160};
 use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
-use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
-use core::ops::Deref;
-use codec::{Encode, Decode, MaxEncodedLen};
-use scale_info::TypeInfo;
-
-pub use pallet::*;
+use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
+use up_data_structs::{
+	AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
+	mapping::TokenAddressMapping, budget::Budget, Property, PropertyKey, PropertyValue,
+	PropertyKeyPermission, PropertyScope, TokenChild, AuxPropertyValue, PropertiesPermissionMap,
+	TokenProperties as TokenPropertiesT,
+};
 use weights::WeightInfo;
 #[cfg(feature = "runtime-benchmarks")]
 pub mod benchmarking;
@@ -147,13 +147,13 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use super::*;
 	use frame_support::{
-		Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key, traits::StorageVersion,
+		pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128Concat, Twox64Concat,
 	};
 	use up_data_structs::{CollectionId, TokenId};
-	use super::weights::WeightInfo;
 
+	use super::{weights::WeightInfo, *};
+
 	#[pallet::error]
 	pub enum Error<T> {
 		/// Not Nonfungible item data used to mint in Nonfungible collection.
@@ -285,7 +285,6 @@
 	#[pallet::genesis_config]
 	pub struct GenesisConfig<T>(PhantomData<T>);
 
-	#[cfg(feature = "std")]
 	impl<T: Config> Default for GenesisConfig<T> {
 		fn default() -> Self {
 			Self(Default::default())
@@ -293,7 +292,7 @@
 	}
 
 	#[pallet::genesis_build]
-	impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+	impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
 		fn build(&self) {
 			StorageVersion::new(1).put::<Pallet<T>>();
 		}
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -174,7 +174,7 @@
 	pub type CreateItemBasket<T: Config> = StorageMap<
 		Hasher = Blake2_128Concat,
 		Key = (CollectionId, T::AccountId),
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 	/// Collection id (controlled?2), token id (controlled?2)
@@ -185,7 +185,7 @@
 		Key1 = CollectionId,
 		Hasher2 = Blake2_128Concat,
 		Key2 = TokenId,
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 	/// Collection id (controlled?2), owning user (real)
@@ -196,7 +196,7 @@
 		Key1 = CollectionId,
 		Hasher2 = Twox64Concat,
 		Key2 = T::AccountId,
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 	/// Collection id (controlled?2), token id (controlled?2)
@@ -208,7 +208,7 @@
 			Key<Blake2_128Concat, TokenId>,
 			Key<Twox64Concat, T::AccountId>,
 		),
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 	//#endregion
@@ -221,7 +221,7 @@
 		Key1 = CollectionId,
 		Hasher2 = Blake2_128Concat,
 		Key2 = TokenId,
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 
@@ -233,7 +233,7 @@
 		Key1 = CollectionId,
 		Hasher2 = Blake2_128Concat,
 		Key2 = TokenId,
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 	/// Last sponsoring of fungible tokens approval in a collection
@@ -244,7 +244,7 @@
 		Key1 = CollectionId,
 		Hasher2 = Twox64Concat,
 		Key2 = T::AccountId,
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 	/// Last sponsoring of RFT approval in a collection
@@ -256,7 +256,7 @@
 			Key<Blake2_128Concat, TokenId>,
 			Key<Twox64Concat, T::AccountId>,
 		),
-		Value = T::BlockNumber,
+		Value = BlockNumberFor<T>,
 		QueryKind = OptionQuery,
 	>;
 
modifiedprimitives/common/src/constants.rsdiffbeforeafterboth
--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -28,14 +28,14 @@
 pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
 
 // These time units are defined in number of blocks.
-pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
-pub const HOURS: BlockNumber = MINUTES * 60;
-pub const DAYS: BlockNumber = HOURS * 24;
+pub const MINUTES: u32 = 60_000 / (MILLISECS_PER_BLOCK as u32);
+pub const HOURS: u32 = MINUTES * 60;
+pub const DAYS: u32 = HOURS * 24;
 
 // These time units are defined in number of relay blocks.
-pub const RELAY_MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_RELAY_BLOCK as BlockNumber);
-pub const RELAY_HOURS: BlockNumber = RELAY_MINUTES * 60;
-pub const RELAY_DAYS: BlockNumber = RELAY_HOURS * 24;
+pub const RELAY_MINUTES: u32 = 60_000 / (MILLISECS_PER_RELAY_BLOCK as u32);
+pub const RELAY_HOURS: u32 = RELAY_MINUTES * 60;
+pub const RELAY_DAYS: u32 = RELAY_HOURS * 24;
 
 pub const MICROUNIQUE: Balance = 1_000_000_000_000;
 pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;
modifiedprimitives/common/src/types.rsdiffbeforeafterboth
--- a/primitives/common/src/types.rs
+++ b/primitives/common/src/types.rs
@@ -37,10 +37,8 @@
 		Unknown(sp_std::vec::Vec<u8>),
 	}
 
-	/// Opaque block header type.
 	pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
 
-	/// Opaque block type.
 	pub type Block = generic::Block<Header, UncheckedExtrinsic>;
 
 	pub trait RuntimeInstance {
@@ -71,7 +69,7 @@
 pub type Balance = u128;
 
 /// Index of a transaction in the chain.
-pub type Index = u32;
+pub type Nonce = u32;
 
 /// A hash of some data used by the chain.
 pub type Hash = sp_core::H256;
modifiedprimitives/data-structs/src/bondrewd_codec.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/bondrewd_codec.rs
+++ b/primitives/data-structs/src/bondrewd_codec.rs
@@ -5,12 +5,14 @@
 macro_rules! bondrewd_codec {
 	($T:ty) => {
 		impl Encode for $T {
-			fn encode_to<O: codec::Output + ?Sized>(&self, dest: &mut O) {
+			fn encode_to<O: parity_scale_codec::Output + ?Sized>(&self, dest: &mut O) {
 				dest.write(&self.into_bytes())
 			}
 		}
-		impl codec::Decode for $T {
-			fn decode<I: codec::Input + ?Sized>(from: &mut I) -> Result<Self, codec::Error> {
+		impl parity_scale_codec::Decode for $T {
+			fn decode<I: parity_scale_codec::Input + ?Sized>(
+				from: &mut I,
+			) -> Result<Self, parity_scale_codec::Error> {
 				let mut bytes = [0; Self::BYTE_SIZE];
 				from.read(&mut bytes)?;
 				Ok(Self::from_bytes(bytes))
modifiedprimitives/data-structs/src/bounded.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/bounded.rs
+++ b/primitives/data-structs/src/bounded.rs
@@ -26,13 +26,13 @@
 };
 
 /// [`serde`] implementations for [`BoundedVec`].
-#[cfg(feature = "serde1")]
 pub mod vec_serde {
 	use core::convert::TryFrom;
-	use frame_support::{BoundedVec, traits::Get};
+
+	use frame_support::{traits::Get, BoundedVec};
 	use serde::{
-		ser::{self, Serialize},
 		de::{self, Deserialize, Error},
+		ser::{self, Serialize},
 	};
 	use sp_std::vec::Vec;
 
@@ -66,17 +66,17 @@
 	(v as &Vec<V>).fmt(f)
 }
 
-#[cfg(feature = "serde1")]
 #[allow(dead_code)]
 /// [`serde`] implementations for [`BoundedBTreeMap`].
 pub mod map_serde {
 	use core::convert::TryFrom;
-	use sp_std::collections::btree_map::BTreeMap;
-	use frame_support::{traits::Get, storage::bounded_btree_map::BoundedBTreeMap};
+
+	use frame_support::{storage::bounded_btree_map::BoundedBTreeMap, traits::Get};
 	use serde::{
+		de::{self, Deserialize, Error},
 		ser::{self, Serialize},
-		de::{self, Deserialize, Error},
 	};
+	use sp_std::collections::btree_map::BTreeMap;
 	pub fn serialize<D, K, V, S>(
 		value: &BoundedBTreeMap<K, V, S>,
 		serializer: D,
@@ -117,17 +117,17 @@
 	(v as &BTreeMap<K, V>).fmt(f)
 }
 
-#[cfg(feature = "serde1")]
 #[allow(dead_code)]
 /// [`serde`] implementations for [`BoundedBTreeSet`].
 pub mod set_serde {
 	use core::convert::TryFrom;
-	use sp_std::collections::btree_set::BTreeSet;
-	use frame_support::{traits::Get, storage::bounded_btree_set::BoundedBTreeSet};
+
+	use frame_support::{storage::bounded_btree_set::BoundedBTreeSet, traits::Get};
 	use serde::{
-		ser::{self, Serialize},
 		de::{self, Deserialize, Error},
+		ser::{self, Serialize},
 	};
+	use sp_std::collections::btree_set::BTreeSet;
 	pub fn serialize<D, K, S>(
 		value: &BoundedBTreeSet<K, S>,
 		serializer: D,
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -153,8 +153,9 @@
 	Default,
 	TypeInfo,
 	MaxEncodedLen,
+	Serialize,
+	Deserialize,
 )]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
 pub struct CollectionId(pub u32);
 impl EncodeLike<u32> for CollectionId {}
 impl EncodeLike<CollectionId> for u32 {}
@@ -187,8 +188,9 @@
 	Default,
 	TypeInfo,
 	MaxEncodedLen,
+	Serialize,
+	Deserialize,
 )]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
 pub struct TokenId(pub u32);
 impl EncodeLike<u32> for TokenId {}
 impl EncodeLike<TokenId> for u32 {}
@@ -221,8 +223,7 @@
 
 /// Token data.
 #[struct_versioning::versioned(version = 2, upper)]
-#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]
 pub struct TokenData<CrossAccountId> {
 	/// Properties of token.
 	pub properties: Vec<Property>,
@@ -251,8 +252,9 @@
 /// Collection can represent various types of tokens.
 /// Each collection can contain only one type of tokens at a time.
 /// This type helps to understand which tokens the collection contains.
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,
+)]
 pub enum CollectionMode {
 	/// Non fungible tokens.
 	NFT,
@@ -279,8 +281,19 @@
 }
 
 /// Access mode for some token operations.
-#[derive(Encode, Decode, Eq, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode,
+	Decode,
+	Eq,
+	Debug,
+	Clone,
+	Copy,
+	PartialEq,
+	TypeInfo,
+	MaxEncodedLen,
+	Serialize,
+	Deserialize,
+)]
 pub enum AccessMode {
 	/// Access grant for owner and admins. Used as default.
 	Normal,
@@ -294,8 +307,9 @@
 }
 
 // TODO: remove in future.
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,
+)]
 pub enum SchemaVersion {
 	ImageURL,
 	Unique,
@@ -307,16 +321,16 @@
 }
 
 // TODO: unused type
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]
 pub struct Ownership<AccountId> {
 	pub owner: AccountId,
 	pub fraction: u128,
 }
 
 /// The state of collection sponsorship.
-#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,
+)]
 pub enum SponsorshipState<AccountId> {
 	/// The fees are applied to the transaction sender.
 	Disabled,
@@ -444,8 +458,7 @@
 	pub meta_update_permission: MetaUpdatePermission,
 }
 
-#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]
 pub struct RpcCollectionFlags {
 	/// Is collection is foreign.
 	pub foreign: bool,
@@ -455,8 +468,7 @@
 
 /// Collection parameters, used in RPC calls (see [`Collection`] for the storage version).
 #[struct_versioning::versioned(version = 2, upper)]
-#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(Debug, Encode, Decode, Clone, PartialEq, TypeInfo, Serialize, Deserialize)]
 pub struct RpcCollection<AccountId> {
 	/// Collection owner account.
 	pub owner: AccountId,
@@ -538,8 +550,10 @@
 
 pub struct RawEncoded(Vec<u8>);
 
-impl codec::Decode for RawEncoded {
-	fn decode<I: codec::Input>(input: &mut I) -> Result<Self, codec::Error> {
+impl parity_scale_codec::Decode for RawEncoded {
+	fn decode<I: parity_scale_codec::Input>(
+		input: &mut I,
+	) -> Result<Self, parity_scale_codec::Error> {
 		let mut out = Vec::new();
 		while let Ok(v) = input.read_byte() {
 			out.push(v);
@@ -612,8 +626,18 @@
 ///
 /// Update with `pallet_common::Pallet::clamp_limits`.
 // IMPORTANT: When adding/removing fields from this struct - don't forget to also
-#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode,
+	Decode,
+	Debug,
+	Default,
+	Clone,
+	PartialEq,
+	TypeInfo,
+	MaxEncodedLen,
+	Serialize,
+	Deserialize,
+)]
 // When adding/removing fields from this struct - don't forget to also update with `pallet_common::Pallet::clamp_limits`.
 // TODO: move `pallet_common::Pallet::clamp_limits` into `impl CollectionLimits`.
 // TODO: may be remove [`Option`] and **pub** from fields and create struct with default values.
@@ -769,8 +793,18 @@
 /// Some fields are wrapped in [`Option`], where `None` means chain default.
 ///
 /// Update with `pallet_common::Pallet::clamp_permissions`.
-#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode,
+	Decode,
+	Debug,
+	Default,
+	Clone,
+	PartialEq,
+	TypeInfo,
+	MaxEncodedLen,
+	Serialize,
+	Deserialize,
+)]
 // When adding/removing fields from this struct - don't forget to also update `pallet_common::Pallet::clamp_permissions`.
 // TODO: move `pallet_common::Pallet::clamp_permissions` into `impl CollectionPermissions`.
 pub struct CollectionPermissions {
@@ -821,11 +855,12 @@
 type OwnerRestrictedSetInner = BoundedBTreeSet<CollectionId, ConstU32<16>>;
 
 /// Wraper for collections set allowing nest.
-#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative, Serialize, Deserialize,
+)]
 #[derivative(Debug)]
 pub struct OwnerRestrictedSet(
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::set_serde"))]
+	#[serde(with = "bounded::set_serde")]
 	#[derivative(Debug(format_with = "bounded::set_debug"))]
 	pub OwnerRestrictedSetInner,
 );
@@ -862,8 +897,9 @@
 }
 
 /// Part of collection permissions, if set, defines who is able to nest tokens into other tokens.
-#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative, Serialize, Deserialize,
+)]
 #[derivative(Debug)]
 pub struct NestingPermissions {
 	/// Owner of token can nest tokens under it.
@@ -881,8 +917,9 @@
 /// Enum denominating how often can sponsoring occur if it is enabled.
 ///
 /// Used for [`collection limits`](CollectionLimits).
-#[derive(Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,
+)]
 pub enum SponsoringRateLimit {
 	/// Sponsoring is disabled, and the collection sponsor will not pay for transactions
 	SponsoringDisabled,
@@ -891,42 +928,73 @@
 }
 
 /// Data used to describe an NFT at creation.
-#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode,
+	Decode,
+	MaxEncodedLen,
+	Default,
+	PartialEq,
+	Clone,
+	Derivative,
+	TypeInfo,
+	Serialize,
+	Deserialize,
+)]
 #[derivative(Debug)]
 pub struct CreateNftData {
 	/// Key-value pairs used to describe the token as metadata
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
+	#[serde(with = "bounded::vec_serde")]
 	#[derivative(Debug(format_with = "bounded::vec_debug"))]
 	/// Properties that wil be assignet to created item.
 	pub properties: CollectionPropertiesVec,
 }
 
 /// Data used to describe a Fungible token at creation.
-#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode,
+	Decode,
+	MaxEncodedLen,
+	Default,
+	Debug,
+	Clone,
+	PartialEq,
+	TypeInfo,
+	Serialize,
+	Deserialize,
+)]
 pub struct CreateFungibleData {
 	/// Number of fungible coins minted
 	pub value: u128,
 }
 
 /// Data used to describe a Refungible token at creation.
-#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode,
+	Decode,
+	MaxEncodedLen,
+	Default,
+	PartialEq,
+	Clone,
+	Derivative,
+	TypeInfo,
+	Serialize,
+	Deserialize,
+)]
 #[derivative(Debug)]
 pub struct CreateReFungibleData {
 	/// Number of pieces the RFT is split into
 	pub pieces: u128,
 
 	/// Key-value pairs used to describe the token as metadata
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
+	#[serde(with = "bounded::vec_serde")]
 	#[derivative(Debug(format_with = "bounded::vec_debug"))]
 	pub properties: CollectionPropertiesVec,
 }
 
 // TODO: remove this.
-#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen, Serialize, Deserialize,
+)]
 pub enum MetaUpdatePermission {
 	ItemOwner,
 	Admin,
@@ -935,8 +1003,9 @@
 
 /// Enum holding data used for creation of all three item types.
 /// Unified data for create item.
-#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,
+)]
 pub enum CreateItemData {
 	/// Data for create NFT.
 	NFT(CreateNftData),
@@ -1025,8 +1094,9 @@
 }
 
 /// Token's address, dictated by its collection and token IDs.
-#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,
+)]
 // todo possibly rename to be used generally as an address pair
 pub struct TokenChild {
 	/// Token id.
@@ -1037,8 +1107,9 @@
 }
 
 /// Collection statistics.
-#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo, Serialize, Deserialize,
+)]
 pub struct CollectionStats {
 	/// Number of created items.
 	pub created: u32,
@@ -1060,10 +1131,9 @@
 
 	fn type_info() -> scale_info::Type {
 		use scale_info::{
-			Type, Path,
 			build::{FieldsBuilder, UnnamedFields},
 			form::MetaForm,
-			type_params,
+			type_params, Path, Type,
 		};
 		Type::builder()
 			.path(Path::new("up_data_structs", "PhantomType"))
@@ -1092,8 +1162,18 @@
 pub type PropertyValue = BoundedBytes<ConstU32<MAX_PROPERTY_VALUE_LENGTH>>;
 
 /// Property permission.
-#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone, Default)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode,
+	Decode,
+	TypeInfo,
+	Debug,
+	MaxEncodedLen,
+	PartialEq,
+	Clone,
+	Default,
+	Serialize,
+	Deserialize,
+)]
 pub struct PropertyPermission {
 	/// Permission to change the property and property permission.
 	///
@@ -1119,15 +1199,16 @@
 }
 
 /// Property is simpl key-value record.
-#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen, Serialize, Deserialize,
+)]
 pub struct Property {
 	/// Property key.
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
+	#[serde(with = "bounded::vec_serde")]
 	pub key: PropertyKey,
 
 	/// Property value.
-	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
+	#[serde(with = "bounded::vec_serde")]
 	pub value: PropertyValue,
 }
 
@@ -1138,8 +1219,9 @@
 }
 
 /// Record for proprty key permission.
-#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone, Serialize, Deserialize,
+)]
 pub struct PropertyKeyPermission {
 	/// Key.
 	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
@@ -1362,7 +1444,7 @@
 	scoped_slice_size(PropertyScope::None, data)
 }
 fn scoped_slice_size(scope: PropertyScope, data: &[u8]) -> u32 {
-	use codec::Compact;
+	use parity_scale_codec::Compact;
 	let prefix = scope.prefix();
 	<Compact<u32>>::encoded_size(&Compact(data.len() as u32 + prefix.len() as u32)) as u32
 		+ data.len() as u32
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -82,7 +82,7 @@
 			collection: CollectionId,
 			token_id: TokenId,
 			keys: Option<Vec<Vec<u8>>>
-		) -> Result<TokenDataVersion1<CrossAccountId>>;
+		) -> Result<up_data_structs::TokenDataVersion1<CrossAccountId>>;
 
 		/// Total number of tokens in collection.
 		fn total_supply(collection: CollectionId) -> Result<u32>;
@@ -117,7 +117,7 @@
 		fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>>;
 
 		#[changed_in(3)]
-		fn collection_by_id(collection: CollectionId) -> Result<Option<RawEncoded>>;
+		fn collection_by_id(collection: CollectionId) -> Result<Option<up_data_structs::RawEncoded>>;
 
 		/// Get collection stats.
 		fn collection_stats() -> Result<CollectionStats>;
modifiedruntime/common/config/pallets/collator_selection.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/collator_selection.rs
+++ b/runtime/common/config/pallets/collator_selection.rs
@@ -107,6 +107,7 @@
 
 impl pallet_collator_selection::Config for Runtime {
 	type RuntimeEvent = RuntimeEvent;
+	type RuntimeHoldReason = RuntimeHoldReason;
 	type Currency = Balances;
 	// We allow root only to execute privileged collator selection operations.
 
@@ -128,7 +129,6 @@
 	type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
 	type ValidatorRegistration = Session;
 	type WeightInfo = pallet_collator_selection::weights::SubstrateWeight<Runtime>;
-	type LicenceBondIdentifier = LicenceBondIdentifier;
 	type DesiredCollators = DesiredCollators;
 	type LicenseBond = LicenseBond;
 	type KickThreshold = KickThreshold;
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -76,10 +76,10 @@
 	type BaseCallFilter = Everything;
 	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
 	type BlockHashCount = BlockHashCount;
+	/// The block type.
+	type Block = Block;
 	/// The maximum length of a block (in bytes).
 	type BlockLength = RuntimeBlockLength;
-	/// The index type for blocks.
-	type BlockNumber = BlockNumber;
 	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.
 	type BlockWeights = RuntimeBlockWeights;
 	/// The aggregated dispatch type that is available for extrinsics.
@@ -92,10 +92,8 @@
 	type Hash = Hash;
 	/// The hashing algorithm used.
 	type Hashing = BlakeTwo256;
-	/// The header type.
-	type Header = generic::Header<BlockNumber, BlakeTwo256>;
 	/// The index type for storing how many extrinsics an account has signed.
-	type Index = Index;
+	type Nonce = Nonce;
 	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
 	type Lookup = AccountIdLookup<AccountId, ()>;
 	/// What to do if an account is fully reaped from the system.
@@ -171,7 +169,7 @@
 	type ExistentialDeposit = ExistentialDeposit;
 	type AccountStore = System;
 	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
-	type HoldIdentifier = [u8; 16];
+	type RuntimeHoldReason = RuntimeHoldReason;
 	type FreezeIdentifier = [u8; 16];
 	type MaxHolds = MaxHolds;
 	type MaxFreezes = MaxFreezes;
@@ -247,6 +245,7 @@
 	type AuthorityId = AuraId;
 	type DisabledValidators = ();
 	type MaxAuthorities = MaxAuthorities;
+	type AllowMultipleBlocksPerSlot = ConstBool<true>;
 }
 
 impl pallet_utility::Config for Runtime {
modifiedruntime/common/config/xcm/foreignassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -36,17 +36,11 @@
 	pub CheckingAccount: AccountId = PolkadotXcm::check_account();
 }
 
-pub struct AsInnerId<AssetId, ConvertAssetId>(PhantomData<(AssetId, ConvertAssetId)>);
-impl<AssetId: Clone + PartialEq, ConvertAssetId: ConvertXcm<AssetId, AssetId>>
-	ConvertXcm<MultiLocation, AssetId> for AsInnerId<AssetId, ConvertAssetId>
-where
-	AssetId: Borrow<AssetId>,
-	AssetId: TryAsForeign<AssetId, ForeignAssetId>,
-	AssetIds: Borrow<AssetId>,
+pub struct AsInnerId<ConvertAssetId>(PhantomData<(AssetId, ConvertAssetId)>);
+impl<ConvertAssetId: MaybeEquivalence<AssetId, AssetId>> MaybeEquivalence<MultiLocation, AssetId>
+	for AsInnerId<ConvertAssetId>
 {
-	fn convert_ref(id: impl Borrow<MultiLocation>) -> Result<AssetId, ()> {
-		let id = id.borrow();
-
+	fn convert(id: &MultiLocation) -> Option<AssetId> {
 		log::trace!(
 			target: "xcm::AsInnerId::Convert",
 			"AsInnerId {:?}",
@@ -58,52 +52,46 @@
 		let self_location = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));
 
 		if *id == parent {
-			return ConvertAssetId::convert_ref(AssetIds::NativeAssetId(NativeCurrency::Parent));
+			return ConvertAssetId::convert(&AssetId::NativeAssetId(NativeCurrency::Parent));
 		}
 
 		if *id == here || *id == self_location {
-			return ConvertAssetId::convert_ref(AssetIds::NativeAssetId(NativeCurrency::Here));
+			return ConvertAssetId::convert(&AssetId::NativeAssetId(NativeCurrency::Here));
 		}
 
 		match XcmForeignAssetIdMapping::<Runtime>::get_currency_id(*id) {
-			Some(AssetIds::ForeignAssetId(foreign_asset_id)) => {
-				ConvertAssetId::convert_ref(AssetIds::ForeignAssetId(foreign_asset_id))
+			Some(AssetId::ForeignAssetId(foreign_asset_id)) => {
+				ConvertAssetId::convert(&AssetId::ForeignAssetId(foreign_asset_id))
 			}
-			_ => Err(()),
+			_ => None,
 		}
 	}
 
-	fn reverse_ref(what: impl Borrow<AssetId>) -> Result<MultiLocation, ()> {
+	fn convert_back(asset_id: &AssetId) -> Option<MultiLocation> {
 		log::trace!(
 			target: "xcm::AsInnerId::Reverse",
 			"AsInnerId",
 		);
-
-		let asset_id = what.borrow();
 
 		let parent_id =
-			ConvertAssetId::convert_ref(AssetIds::NativeAssetId(NativeCurrency::Parent)).unwrap();
+			ConvertAssetId::convert(&AssetId::NativeAssetId(NativeCurrency::Parent)).unwrap();
 		let here_id =
-			ConvertAssetId::convert_ref(AssetIds::NativeAssetId(NativeCurrency::Here)).unwrap();
+			ConvertAssetId::convert(&AssetId::NativeAssetId(NativeCurrency::Here)).unwrap();
 
 		if asset_id.clone() == parent_id {
-			return Ok(MultiLocation::parent());
+			return Some(MultiLocation::parent());
 		}
 
 		if asset_id.clone() == here_id {
-			return Ok(MultiLocation::new(
+			return Some(MultiLocation::new(
 				1,
 				X1(Parachain(ParachainInfo::get().into())),
 			));
 		}
 
-		match <AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(asset_id.clone()) {
-			Some(fid) => match XcmForeignAssetIdMapping::<Runtime>::get_multi_location(fid) {
-				Some(location) => Ok(location),
-				None => Err(()),
-			},
-			None => Err(()),
-		}
+		let fid =
+			<AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(asset_id.clone())?;
+		XcmForeignAssetIdMapping::<Runtime>::get_multi_location(fid)
 	}
 }
 
@@ -112,7 +100,7 @@
 	// Use this fungibles implementation:
 	ForeignAssets,
 	// Use this currency when it is a fungible asset matching the given location or name:
-	ConvertedConcreteId<AssetIds, Balance, AsInnerId<AssetIds, JustTry>, JustTry>,
+	ConvertedConcreteId<AssetId, Balance, AsInnerId<JustTry>, JustTry>,
 	// Convert an XCM MultiLocation into a local account id:
 	LocationToAccountId,
 	// Our chain's account ID type (we can't get away without mentioning it explicitly):
@@ -154,7 +142,7 @@
 		what: &MultiAsset,
 		who: &MultiLocation,
 		maybe_context: Option<&XcmContext>,
-	) -> Result<xcm_executor::Assets, XcmError> {
+	) -> Result<staging_xcm_executor::Assets, XcmError> {
 		FungiblesTransactor::withdraw_asset(what, who, maybe_context)
 	}
 
@@ -163,7 +151,7 @@
 		from: &MultiLocation,
 		to: &MultiLocation,
 		context: &XcmContext,
-	) -> Result<xcm_executor::Assets, XcmError> {
+	) -> Result<staging_xcm_executor::Assets, XcmError> {
 		FungiblesTransactor::internal_transfer_asset(what, from, to, context)
 	}
 }
@@ -179,15 +167,15 @@
 >;
 
 pub struct CurrencyIdConvert;
-impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
-	fn convert(id: AssetIds) -> Option<MultiLocation> {
+impl Convert<AssetId, Option<MultiLocation>> for CurrencyIdConvert {
+	fn convert(id: AssetId) -> Option<MultiLocation> {
 		match id {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
+			AssetId::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
 				1,
 				X1(Parachain(ParachainInfo::get().into())),
 			)),
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()),
-			AssetIds::ForeignAssetId(foreign_asset_id) => {
+			AssetId::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()),
+			AssetId::ForeignAssetId(foreign_asset_id) => {
 				XcmForeignAssetIdMapping::<Runtime>::get_multi_location(foreign_asset_id)
 			}
 		}
@@ -199,11 +187,11 @@
 		if location == MultiLocation::here()
 			|| location == MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())))
 		{
-			return Some(AssetIds::NativeAssetId(NativeCurrency::Here));
+			return Some(AssetId::NativeAssetId(NativeCurrency::Here));
 		}
 
 		if location == MultiLocation::parent() {
-			return Some(AssetIds::NativeAssetId(NativeCurrency::Parent));
+			return Some(AssetId::NativeAssetId(NativeCurrency::Parent));
 		}
 
 		if let Some(currency_id) = XcmForeignAssetIdMapping::<Runtime>::get_currency_id(location) {
modifiedruntime/common/config/xcm/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -153,10 +153,10 @@
 		origin: &MultiLocation,
 		message: &mut [Instruction<Call>],
 		max_weight: Weight,
-		weight_credit: &mut Weight,
+		properties: &mut Properties,
 	) -> Result<(), ProcessMessageError> {
 		Deny::try_pass(origin, message)?;
-		Allow::should_execute(origin, message, max_weight, weight_credit)
+		Allow::should_execute(origin, message, max_weight, properties)
 	}
 }
 
@@ -211,7 +211,7 @@
 }
 
 pub struct XcmExecutorConfig<T>(PhantomData<T>);
-impl<T> xcm_executor::Config for XcmExecutorConfig<T>
+impl<T> staging_xcm_executor::Config for XcmExecutorConfig<T>
 where
 	T: pallet_configuration::Config,
 {
@@ -240,6 +240,7 @@
 	type UniversalAliases = Nothing;
 	type CallDispatcher = RuntimeCall;
 	type SafeCallFilter = XcmCallFilter;
+	type Aliasers = Nothing;
 }
 
 #[cfg(feature = "runtime-benchmarks")]
modifiedruntime/common/config/xcm/nativeassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/nativeassets.rs
+++ b/runtime/common/config/xcm/nativeassets.rs
@@ -106,7 +106,12 @@
 		Self(Weight::from_parts(0, 0), Zero::zero(), PhantomData)
 	}
 
-	fn buy_weight(&mut self, _weight: Weight, payment: Assets) -> Result<Assets, XcmError> {
+	fn buy_weight(
+		&mut self,
+		_weight: Weight,
+		payment: Assets,
+		_xcm: &XcmContext,
+	) -> Result<Assets, XcmError> {
 		Ok(payment)
 	}
 }
modifiedruntime/common/construct_runtime.rsdiffbeforeafterboth
--- a/runtime/common/construct_runtime.rs
+++ b/runtime/common/construct_runtime.rs
@@ -19,11 +19,7 @@
 	() => {
 		frame_support::construct_runtime! {
 
-			pub enum Runtime where
-				Block = Block,
-				NodeBlock = opaque::Block,
-				UncheckedExtrinsic = UncheckedExtrinsic
-			{
+			pub enum Runtime {
 				System: frame_system = 0,
 				StateTrieMigration: pallet_state_trie_migration = 1,
 
modifiedruntime/common/mod.rsdiffbeforeafterboth
--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -63,12 +63,15 @@
 
 /// The address format for describing accounts.
 pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
-/// Block header type as expected by this runtime.
-pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
-/// Block type as expected by this runtime.
-pub type Block = generic::Block<Header, UncheckedExtrinsic>;
 /// A Block signed with a Justification
 pub type SignedBlock = generic::SignedBlock<Block>;
+/// Frontier wrapped extrinsic
+pub type UncheckedExtrinsic =
+	fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
+/// Header type.
+pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
+/// Block type.
+pub type Block = generic::Block<Header, UncheckedExtrinsic>;
 /// BlockId type as expected by this runtime.
 pub type BlockId = generic::BlockId<Block>;
 
@@ -102,14 +105,6 @@
 	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,
 	pallet_ethereum::FakeTransactionFinalizer<Runtime>,
 );
-
-/// Unchecked extrinsic type as expected by this runtime.
-pub type UncheckedExtrinsic =
-	fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
-
-/// Extrinsic type that has already been checked.
-pub type CheckedExtrinsic =
-	fp_self_contained::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra, H160>;
 
 /// Executive: handles dispatch to the various modules.
 pub type Executive = frame_executive::Executive<
modifiedruntime/common/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/sponsoring.rs
+++ b/runtime/common/sponsoring.rs
@@ -79,7 +79,7 @@
 		return None;
 	}
 
-	let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+	let block_number = <frame_system::Pallet<T>>::block_number() as BlockNumberFor<T>;
 	let limit = collection.limits.sponsored_data_rate_limit()?;
 
 	if let Some(last_tx_block) = TokenPropertyBasket::<T>::get(collection.id, item_id) {
@@ -123,7 +123,7 @@
 	}
 
 	// sponsor timeout
-	let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+	let block_number = <frame_system::Pallet<T>>::block_number() as BlockNumberFor<T>;
 	let limit = collection
 		.limits
 		.sponsor_transfer_timeout(match collection.mode {
@@ -169,7 +169,7 @@
 	properties: &CreateItemData,
 ) -> Option<()> {
 	// sponsor timeout
-	let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+	let block_number = <frame_system::Pallet<T>>::block_number() as BlockNumberFor<T>;
 	let limit = collection
 		.limits
 		.sponsor_transfer_timeout(match properties {
@@ -195,7 +195,7 @@
 	item_id: &TokenId,
 ) -> Option<()> {
 	// sponsor timeout
-	let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+	let block_number = <frame_system::Pallet<T>>::block_number() as BlockNumberFor<T>;
 	let limit = collection.limits.sponsor_approve_timeout();
 
 	let last_tx_block = match collection.mode {
@@ -307,7 +307,7 @@
 pub trait SponsorshipPredict<T: Config> {
 	fn predict(collection: CollectionId, account: T::CrossAccountId, token: TokenId) -> Option<u64>
 	where
-		u64: From<<T as frame_system::Config>::BlockNumber>;
+		u64: From<BlockNumberFor<T>>;
 }
 
 pub struct UniqueSponsorshipPredict<T>(PhantomData<T>);
@@ -315,13 +315,13 @@
 impl<T: Config> SponsorshipPredict<T> for UniqueSponsorshipPredict<T> {
 	fn predict(collection_id: CollectionId, who: T::CrossAccountId, token: TokenId) -> Option<u64>
 	where
-		u64: From<<T as frame_system::Config>::BlockNumber>,
+		u64: From<BlockNumberFor<T>>,
 	{
 		let collection = <CollectionHandle<T>>::try_get(collection_id).ok()?;
 		let _ = collection.sponsorship.sponsor()?;
 
 		// sponsor timeout
-		let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+		let block_number = <frame_system::Pallet<T>>::block_number() as BlockNumberFor<T>;
 		let limit = collection
 			.limits
 			.sponsor_transfer_timeout(match collection.mode {
modifiedruntime/common/tests/mod.rsdiffbeforeafterboth
--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -51,8 +51,8 @@
 fn new_test_ext(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities {
 	let mut storage = make_basic_storage();
 
-	pallet_balances::GenesisConfig::<Runtime> { balances }
-		.assimilate_storage(&mut storage)
+	pallet_balances::BuildGenesisConfig::<Runtime> { balances }
+		.build_storage(&mut storage)
 		.unwrap();
 
 	let mut ext = sp_io::TestExternalities::new(storage);
@@ -94,13 +94,14 @@
 		.map(|acc| get_account_id_from_seed::<sr25519::Public>(acc))
 		.collect::<Vec<_>>();
 
-	let cfg = GenesisConfig {
+	let cfg = BuildGenesisConfig {
 		collator_selection: CollatorSelectionConfig { invulnerables },
 		session: SessionConfig { keys },
 		parachain_info: ParachainInfoConfig {
 			parachain_id: PARA_ID.into(),
+			..Default::default()
 		},
-		..GenesisConfig::default()
+		..Default::default()
 	};
 
 	cfg.build_storage().unwrap()
@@ -110,7 +111,7 @@
 fn make_basic_storage() -> Storage {
 	use crate::AuraConfig;
 
-	let cfg = GenesisConfig {
+	let cfg = BuildGenesisConfig {
 		aura: AuraConfig {
 			authorities: vec![
 				get_from_seed::<AuraId>("Alice"),
@@ -119,8 +120,9 @@
 		},
 		parachain_info: ParachainInfoConfig {
 			parachain_id: PARA_ID.into(),
+			..Default::default()
 		},
-		..GenesisConfig::default()
+		..Default::default()
 	};
 
 	cfg.build_storage().unwrap().into()
modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -57,23 +57,19 @@
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-	pub enum Test where
-		Block = Block,
-		NodeBlock = Block,
-		UncheckedExtrinsic = UncheckedExtrinsic,
-	{
+	pub enum Test {
 		System: frame_system,
 		Timestamp: pallet_timestamp,
-		Unique: pallet_unique::{Pallet, Call, Storage},
-		Balances: pallet_balances::{Pallet, Call, Storage, Event<T>},
-		Common: pallet_common::{Pallet, Storage, Event<T>},
-		Fungible: pallet_fungible::{Pallet, Storage},
-		Refungible: pallet_refungible::{Pallet, Storage},
-		Nonfungible: pallet_nonfungible::{Pallet, Storage},
-		Structure: pallet_structure::{Pallet, Storage, Event<T>},
-		TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},
-		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin},
-		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>},
+		Unique: pallet_unique,
+		Balances: pallet_balances,
+		Common: pallet_common,
+		Fungible: pallet_fungible,
+		Refungible: pallet_refungible,
+		Nonfungible: pallet_nonfungible,
+		Structure: pallet_structure,
+		TransactionPayment: pallet_transaction_payment,
+		Ethereum: pallet_ethereum,
+		EVM: pallet_evm,
 	}
 );
 
@@ -90,13 +86,11 @@
 	type DbWeight = ();
 	type RuntimeOrigin = RuntimeOrigin;
 	type RuntimeCall = RuntimeCall;
-	type Index = u64;
-	type BlockNumber = u64;
+	type Nonce = u64;
 	type Hash = H256;
 	type Hashing = BlakeTwo256;
 	type AccountId = u64;
 	type Lookup = IdentityLookup<Self::AccountId>;
-	type Header = Header;
 	type BlockHashCount = BlockHashCount;
 	type Version = ();
 	type PalletInfo = PalletInfo;
@@ -127,7 +121,6 @@
 	type MaxFreezes = MaxLocks;
 	type FreezeIdentifier = [u8; 8];
 	type MaxHolds = MaxLocks;
-	type HoldIdentifier = [u8; 8];
 }
 
 parameter_types! {
@@ -242,7 +235,6 @@
 	type OnChargeTransaction = ();
 	type FindAuthor = ();
 	type BlockHashMapping = SubstrateBlockHashMapping<Self>;
-	type TransactionValidityHack = ();
 	type Timestamp = Timestamp;
 	type GasLimitPovSizeRatio = ConstU64<0>;
 }