git.delta.rocks / unique-network / refs/commits / 369a51ded768

difftreelog

Merge pull request #974 from UniqueNetwork/fix/evm-coder-leftovers

Yaroslav Bolyukin2023-08-30parents: #0ce92f0 #c466f2a.patch.diff
in: master

25 files changed

modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -528,7 +528,7 @@
 				|r: sc_service::Result<
 					up_data_structs::TokenDataVersion1<CrossAccountId>,
 					sp_runtime::DispatchError,
-				>| r.and_then(|value| Ok(value.into())),
+				>| r.map(|value| value.into()),
 			)
 			.or_else(|_| {
 				Ok(api
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
before · node/cli/src/chain_spec.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/>.1617use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};18use sc_service::ChainType;19use sp_core::{sr25519, Pair, Public};20use sp_runtime::traits::{IdentifyAccount, Verify};21use std::collections::BTreeMap;2223use serde::{Deserialize, Serialize};24use serde_json::map::Map;2526use up_common::types::opaque::*;2728#[cfg(feature = "unique-runtime")]29pub use unique_runtime as default_runtime;3031#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]32pub use quartz_runtime as default_runtime;3334#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]35pub use opal_runtime as default_runtime;3637/// The `ChainSpec` parameterized for the unique runtime.38#[cfg(feature = "unique-runtime")]39pub type UniqueChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;4041/// The `ChainSpec` parameterized for the quartz runtime.42#[cfg(feature = "quartz-runtime")]43pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;4445/// The `ChainSpec` parameterized for the opal runtime.46pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;4748#[cfg(feature = "unique-runtime")]49pub type DefaultChainSpec = UniqueChainSpec;5051#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]52pub type DefaultChainSpec = QuartzChainSpec;5354#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]55pub type DefaultChainSpec = OpalChainSpec;5657#[cfg(not(feature = "unique-runtime"))]58/// PARA_ID for Opal/Sapphire/Quartz59const PARA_ID: u32 = 2095;6061#[cfg(feature = "unique-runtime")]62/// PARA_ID for Unique63const PARA_ID: u32 = 2037;6465pub trait RuntimeIdentification {66	fn runtime_id(&self) -> RuntimeId;67}6869impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {70	fn runtime_id(&self) -> RuntimeId {71		#[cfg(feature = "unique-runtime")]72		if self.id().starts_with("unique") || self.id().starts_with("unq") {73			return RuntimeId::Unique;74		}7576		#[cfg(feature = "quartz-runtime")]77		if self.id().starts_with("quartz")78			|| self.id().starts_with("qtz")79			|| self.id().starts_with("sapphire")80		{81			return RuntimeId::Quartz;82		}8384		if self.id().starts_with("opal") || self.id() == "dev" || self.id() == "local_testnet" {85			return RuntimeId::Opal;86		}8788		RuntimeId::Unknown(self.id().into())89	}90}9192pub enum ServiceId {93	Prod,94	Dev,95}9697pub trait ServiceIdentification {98	fn service_id(&self) -> ServiceId;99}100101impl ServiceIdentification for Box<dyn sc_service::ChainSpec> {102	fn service_id(&self) -> ServiceId {103		if self.id().ends_with("dev") {104			ServiceId::Dev105		} else {106			ServiceId::Prod107		}108	}109}110111/// Helper function to generate a crypto pair from seed112pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {113	TPublic::Pair::from_string(&format!("//{seed}"), None)114		.expect("static values are valid; qed")115		.public()116}117118/// The extensions for the [`DefaultChainSpec`].119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]120#[serde(deny_unknown_fields)]121pub struct Extensions {122	/// The relay chain of the Parachain.123	pub relay_chain: String,124	/// The id of the Parachain.125	pub para_id: u32,126}127128impl Extensions {129	/// Try to get the extension from the given `ChainSpec`.130	pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {131		sc_chain_spec::get_extension(chain_spec.extensions())132	}133}134135type AccountPublic = <Signature as Verify>::Signer;136137/// Helper function to generate an account ID from seed138pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId139where140	AccountPublic: From<<TPublic::Pair as Pair>::Public>,141{142	AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()143}144145#[cfg(not(feature = "unique-runtime"))]146macro_rules! testnet_genesis {147	(148		$runtime:path,149		$root_key:expr,150		$initial_invulnerables:expr,151		$endowed_accounts:expr,152		$id:expr153	) => {{154		use $runtime::*;155156		GenesisConfig {157			system: SystemConfig {158				code: WASM_BINARY159					.expect("WASM binary was not build, please build it!")160					.to_vec(),161			},162			balances: BalancesConfig {163				balances: $endowed_accounts164					.iter()165					.cloned()166					// 1e13 UNQ167					.map(|k| (k, 1 << 100))168					.collect(),169			},170			common: Default::default(),171			configuration: Default::default(),172			nonfungible: Default::default(),173			treasury: Default::default(),174			tokens: TokensConfig { balances: vec![] },175			sudo: SudoConfig {176				key: Some($root_key),177			},178179			vesting: VestingConfig { vesting: vec![] },180			parachain_info: ParachainInfoConfig {181				parachain_id: $id.into(),182			},183			parachain_system: Default::default(),184			collator_selection: CollatorSelectionConfig {185				invulnerables: $initial_invulnerables186					.iter()187					.cloned()188					.map(|(acc, _)| acc)189					.collect(),190			},191			session: SessionConfig {192				keys: $initial_invulnerables193					.into_iter()194					.map(|(acc, aura)| {195						(196							acc.clone(),          // account id197							acc,                  // validator id198							SessionKeys { aura }, // session keys199						)200					})201					.collect(),202			},203			aura: Default::default(),204			aura_ext: Default::default(),205			evm: EVMConfig {206				accounts: BTreeMap::new(),207			},208			ethereum: EthereumConfig {},209			polkadot_xcm: Default::default(),210			transaction_payment: Default::default(),211			..Default::default()212		}213	}};214}215216#[cfg(feature = "unique-runtime")]217macro_rules! testnet_genesis {218	(219		$runtime:path,220		$root_key:expr,221		$initial_invulnerables:expr,222		$endowed_accounts:expr,223		$id:expr224	) => {{225		use $runtime::*;226227		GenesisConfig {228			system: SystemConfig {229				code: WASM_BINARY230					.expect("WASM binary was not build, please build it!")231					.to_vec(),232			},233			common: Default::default(),234			configuration: Default::default(),235			nonfungible: Default::default(),236			balances: BalancesConfig {237				balances: $endowed_accounts238					.iter()239					.cloned()240					// 1e13 UNQ241					.map(|k| (k, 1 << 100))242					.collect(),243			},244			treasury: Default::default(),245			tokens: TokensConfig { balances: vec![] },246			sudo: SudoConfig {247				key: Some($root_key),248			},249			vesting: VestingConfig { vesting: vec![] },250			parachain_info: ParachainInfoConfig {251				parachain_id: $id.into(),252			},253			parachain_system: Default::default(),254			aura: AuraConfig {255				authorities: $initial_invulnerables256					.into_iter()257					.map(|(_, aura)| aura)258					.collect(),259			},260			aura_ext: Default::default(),261			evm: EVMConfig {262				accounts: BTreeMap::new(),263			},264			ethereum: EthereumConfig {},265			polkadot_xcm: Default::default(),266			transaction_payment: Default::default(),267		}268	}};269}270271pub fn development_config() -> DefaultChainSpec {272	let mut properties = Map::new();273	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());274	properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());275	properties.insert(276		"ss58Format".into(),277		default_runtime::SS58Prefix::get().into(),278	);279280	DefaultChainSpec::from_genesis(281		// Name282		format!(283			"{}{}",284			default_runtime::RUNTIME_NAME.to_uppercase(),285			if cfg!(feature = "unique-runtime") {286				""287			} else {288				" by UNIQUE"289			}290		)291		.as_str(),292		// ID293		format!("{}_dev", default_runtime::RUNTIME_NAME).as_str(),294		ChainType::Local,295		move || {296			testnet_genesis!(297				default_runtime,298				// Sudo account299				get_account_id_from_seed::<sr25519::Public>("Alice"),300				vec![301					(302						get_account_id_from_seed::<sr25519::Public>("Alice"),303						get_from_seed::<AuraId>("Alice"),304					),305					(306						get_account_id_from_seed::<sr25519::Public>("Bob"),307						get_from_seed::<AuraId>("Bob"),308					),309				],310				// Pre-funded accounts311				vec![312					get_account_id_from_seed::<sr25519::Public>("Alice"),313					get_account_id_from_seed::<sr25519::Public>("Bob"),314					get_account_id_from_seed::<sr25519::Public>("Charlie"),315					get_account_id_from_seed::<sr25519::Public>("Dave"),316					get_account_id_from_seed::<sr25519::Public>("Eve"),317					get_account_id_from_seed::<sr25519::Public>("Ferdie"),318					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),319					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),320					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),321					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),322					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),323					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),324				],325				PARA_ID326			)327		},328		// Bootnodes329		vec![],330		// Telemetry331		None,332		// Protocol ID333		None,334		None,335		// Properties336		Some(properties),337		// Extensions338		Extensions {339			relay_chain: "rococo-dev".into(),340			para_id: PARA_ID,341		},342	)343}344345pub fn local_testnet_config() -> DefaultChainSpec {346	let mut properties = Map::new();347	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());348	properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());349	properties.insert(350		"ss58Format".into(),351		default_runtime::SS58Prefix::get().into(),352	);353354	DefaultChainSpec::from_genesis(355		// Name356		format!(357			"{}{}",358			default_runtime::RUNTIME_NAME.to_uppercase(),359			if cfg!(feature = "unique-runtime") {360				""361			} else {362				" by UNIQUE"363			}364		)365		.as_str(),366		// ID367		format!("{}_local", default_runtime::RUNTIME_NAME).as_str(),368		ChainType::Local,369		move || {370			testnet_genesis!(371				default_runtime,372				// Sudo account373				get_account_id_from_seed::<sr25519::Public>("Alice"),374				vec![375					(376						get_account_id_from_seed::<sr25519::Public>("Alice"),377						get_from_seed::<AuraId>("Alice"),378					),379					(380						get_account_id_from_seed::<sr25519::Public>("Bob"),381						get_from_seed::<AuraId>("Bob"),382					),383				],384				// Pre-funded accounts385				vec![386					get_account_id_from_seed::<sr25519::Public>("Alice"),387					get_account_id_from_seed::<sr25519::Public>("Bob"),388					get_account_id_from_seed::<sr25519::Public>("Charlie"),389					get_account_id_from_seed::<sr25519::Public>("Dave"),390					get_account_id_from_seed::<sr25519::Public>("Eve"),391					get_account_id_from_seed::<sr25519::Public>("Ferdie"),392					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),393					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),394					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),395					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),396					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),397					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),398				],399				PARA_ID400			)401		},402		// Bootnodes403		vec![],404		// Telemetry405		None,406		// Protocol ID407		None,408		None,409		// Properties410		Some(properties),411		// Extensions412		Extensions {413			relay_chain: "westend-local".into(),414			para_id: PARA_ID,415		},416	)417}
after · node/cli/src/chain_spec.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/>.1617use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};18use sc_service::ChainType;19use sp_core::{sr25519, Pair, Public};20use sp_runtime::traits::{IdentifyAccount, Verify};21use std::collections::BTreeMap;2223use serde::{Deserialize, Serialize};24use serde_json::map::Map;2526use up_common::types::opaque::*;2728#[cfg(feature = "unique-runtime")]29pub use unique_runtime as default_runtime;3031#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]32pub use quartz_runtime as default_runtime;3334#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]35pub use opal_runtime as default_runtime;3637/// The `ChainSpec` parameterized for the unique runtime.38#[cfg(feature = "unique-runtime")]39pub type UniqueChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;4041/// The `ChainSpec` parameterized for the quartz runtime.42#[cfg(feature = "quartz-runtime")]43pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;4445/// The `ChainSpec` parameterized for the opal runtime.46pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;4748#[cfg(feature = "unique-runtime")]49pub type DefaultChainSpec = UniqueChainSpec;5051#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]52pub type DefaultChainSpec = QuartzChainSpec;5354#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]55pub type DefaultChainSpec = OpalChainSpec;5657#[cfg(not(feature = "unique-runtime"))]58/// PARA_ID for Opal/Sapphire/Quartz59const PARA_ID: u32 = 2095;6061#[cfg(feature = "unique-runtime")]62/// PARA_ID for Unique63const PARA_ID: u32 = 2037;6465pub trait RuntimeIdentification {66	fn runtime_id(&self) -> RuntimeId;67}6869impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {70	fn runtime_id(&self) -> RuntimeId {71		#[cfg(feature = "unique-runtime")]72		if self.id().starts_with("unique") || self.id().starts_with("unq") {73			return RuntimeId::Unique;74		}7576		#[cfg(feature = "quartz-runtime")]77		if self.id().starts_with("quartz")78			|| self.id().starts_with("qtz")79			|| self.id().starts_with("sapphire")80		{81			return RuntimeId::Quartz;82		}8384		if self.id().starts_with("opal") || self.id() == "dev" || self.id() == "local_testnet" {85			return RuntimeId::Opal;86		}8788		RuntimeId::Unknown(self.id().into())89	}90}9192pub enum ServiceId {93	Prod,94	Dev,95}9697pub trait ServiceIdentification {98	fn service_id(&self) -> ServiceId;99}100101impl ServiceIdentification for Box<dyn sc_service::ChainSpec> {102	fn service_id(&self) -> ServiceId {103		if self.id().ends_with("dev") {104			ServiceId::Dev105		} else {106			ServiceId::Prod107		}108	}109}110111/// Helper function to generate a crypto pair from seed112pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {113	TPublic::Pair::from_string(&format!("//{seed}"), None)114		.expect("static values are valid; qed")115		.public()116}117118/// The extensions for the [`DefaultChainSpec`].119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]120#[serde(deny_unknown_fields)]121pub struct Extensions {122	/// The relay chain of the Parachain.123	pub relay_chain: String,124	/// The id of the Parachain.125	pub para_id: u32,126}127128impl Extensions {129	/// Try to get the extension from the given `ChainSpec`.130	pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {131		sc_chain_spec::get_extension(chain_spec.extensions())132	}133}134135type AccountPublic = <Signature as Verify>::Signer;136137/// Helper function to generate an account ID from seed138pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId139where140	AccountPublic: From<<TPublic::Pair as Pair>::Public>,141{142	AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()143}144145#[cfg(not(feature = "unique-runtime"))]146macro_rules! testnet_genesis {147	(148		$runtime:path,149		$root_key:expr,150		$initial_invulnerables:expr,151		$endowed_accounts:expr,152		$id:expr153	) => {{154		use $runtime::*;155156		GenesisConfig {157			system: SystemConfig {158				code: WASM_BINARY159					.expect("WASM binary was not build, please build it!")160					.to_vec(),161			},162			balances: BalancesConfig {163				balances: $endowed_accounts164					.iter()165					.cloned()166					// 1e13 UNQ167					.map(|k| (k, 1 << 100))168					.collect(),169			},170			common: Default::default(),171			configuration: Default::default(),172			nonfungible: Default::default(),173			treasury: Default::default(),174			tokens: TokensConfig { balances: vec![] },175			sudo: SudoConfig {176				key: Some($root_key),177			},178179			vesting: VestingConfig { vesting: vec![] },180			parachain_info: ParachainInfoConfig {181				parachain_id: $id.into(),182			},183			parachain_system: Default::default(),184			collator_selection: CollatorSelectionConfig {185				invulnerables: $initial_invulnerables186					.iter()187					.cloned()188					.map(|(acc, _)| acc)189					.collect(),190			},191			session: SessionConfig {192				keys: $initial_invulnerables193					.into_iter()194					.map(|(acc, aura)| {195						(196							acc.clone(),          // account id197							acc,                  // validator id198							SessionKeys { aura }, // session keys199						)200					})201					.collect(),202			},203			aura: Default::default(),204			aura_ext: Default::default(),205			evm: EVMConfig {206				accounts: BTreeMap::new(),207			},208			ethereum: EthereumConfig {},209			polkadot_xcm: Default::default(),210			transaction_payment: Default::default(),211			..Default::default()212		}213	}};214}215216#[cfg(feature = "unique-runtime")]217macro_rules! testnet_genesis {218	(219		$runtime:path,220		$root_key:expr,221		$initial_invulnerables:expr,222		$endowed_accounts:expr,223		$id:expr224	) => {{225		use $runtime::*;226227		GenesisConfig {228			system: SystemConfig {229				code: WASM_BINARY230					.expect("WASM binary was not build, please build it!")231					.to_vec(),232			},233			common: Default::default(),234			configuration: Default::default(),235			nonfungible: Default::default(),236			balances: BalancesConfig {237				balances: $endowed_accounts238					.iter()239					.cloned()240					// 1e13 UNQ241					.map(|k| (k, 1 << 100))242					.collect(),243			},244			treasury: Default::default(),245			tokens: TokensConfig { balances: vec![] },246			sudo: SudoConfig {247				key: Some($root_key),248			},249			vesting: VestingConfig { vesting: vec![] },250			parachain_info: ParachainInfoConfig {251				parachain_id: $id.into(),252			},253			parachain_system: Default::default(),254			aura: AuraConfig {255				authorities: $initial_invulnerables256					.into_iter()257					.map(|(_, aura)| aura)258					.collect(),259			},260			aura_ext: Default::default(),261			evm: EVMConfig {262				accounts: BTreeMap::new(),263			},264			ethereum: EthereumConfig {},265			polkadot_xcm: Default::default(),266			transaction_payment: Default::default(),267		}268	}};269}270271pub fn development_config() -> DefaultChainSpec {272	let mut properties = Map::new();273	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());274	properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());275	properties.insert(276		"ss58Format".into(),277		default_runtime::SS58Prefix::get().into(),278	);279280	DefaultChainSpec::from_genesis(281		// Name282		format!(283			"{}{}",284			default_runtime::RUNTIME_NAME.to_uppercase(),285			if cfg!(feature = "unique-runtime") {286				""287			} else {288				" by UNIQUE"289			}290		)291		.as_str(),292		// ID293		format!("{}_dev", default_runtime::RUNTIME_NAME).as_str(),294		ChainType::Local,295		move || {296			testnet_genesis!(297				default_runtime,298				// Sudo account299				get_account_id_from_seed::<sr25519::Public>("Alice"),300				[301					(302						get_account_id_from_seed::<sr25519::Public>("Alice"),303						get_from_seed::<AuraId>("Alice"),304					),305					(306						get_account_id_from_seed::<sr25519::Public>("Bob"),307						get_from_seed::<AuraId>("Bob"),308					),309				],310				// Pre-funded accounts311				vec![312					get_account_id_from_seed::<sr25519::Public>("Alice"),313					get_account_id_from_seed::<sr25519::Public>("Bob"),314					get_account_id_from_seed::<sr25519::Public>("Charlie"),315					get_account_id_from_seed::<sr25519::Public>("Dave"),316					get_account_id_from_seed::<sr25519::Public>("Eve"),317					get_account_id_from_seed::<sr25519::Public>("Ferdie"),318					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),319					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),320					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),321					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),322					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),323					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),324				],325				PARA_ID326			)327		},328		// Bootnodes329		vec![],330		// Telemetry331		None,332		// Protocol ID333		None,334		None,335		// Properties336		Some(properties),337		// Extensions338		Extensions {339			relay_chain: "rococo-dev".into(),340			para_id: PARA_ID,341		},342	)343}344345pub fn local_testnet_config() -> DefaultChainSpec {346	let mut properties = Map::new();347	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());348	properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());349	properties.insert(350		"ss58Format".into(),351		default_runtime::SS58Prefix::get().into(),352	);353354	DefaultChainSpec::from_genesis(355		// Name356		format!(357			"{}{}",358			default_runtime::RUNTIME_NAME.to_uppercase(),359			if cfg!(feature = "unique-runtime") {360				""361			} else {362				" by UNIQUE"363			}364		)365		.as_str(),366		// ID367		format!("{}_local", default_runtime::RUNTIME_NAME).as_str(),368		ChainType::Local,369		move || {370			testnet_genesis!(371				default_runtime,372				// Sudo account373				get_account_id_from_seed::<sr25519::Public>("Alice"),374				[375					(376						get_account_id_from_seed::<sr25519::Public>("Alice"),377						get_from_seed::<AuraId>("Alice"),378					),379					(380						get_account_id_from_seed::<sr25519::Public>("Bob"),381						get_from_seed::<AuraId>("Bob"),382					),383				],384				// Pre-funded accounts385				vec![386					get_account_id_from_seed::<sr25519::Public>("Alice"),387					get_account_id_from_seed::<sr25519::Public>("Bob"),388					get_account_id_from_seed::<sr25519::Public>("Charlie"),389					get_account_id_from_seed::<sr25519::Public>("Dave"),390					get_account_id_from_seed::<sr25519::Public>("Eve"),391					get_account_id_from_seed::<sr25519::Public>("Ferdie"),392					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),393					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),394					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),395					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),396					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),397					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),398				],399				PARA_ID400			)401		},402		// Bootnodes403		vec![],404		// Telemetry405		None,406		// Protocol ID407		None,408		None,409		// Properties410		Some(properties),411		// Extensions412		Extensions {413			relay_chain: "westend-local".into(),414			para_id: PARA_ID,415		},416	)417}
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -63,7 +63,7 @@
 	}
 	let bytes = id.to_string();
 	let len = data.len();
-	data[len - bytes.len()..].copy_from_slice(&bytes.as_bytes());
+	data[len - bytes.len()..].copy_from_slice(bytes.as_bytes());
 	data
 }
 pub fn property_value() -> PropertyValue {
@@ -80,7 +80,7 @@
 	cast: impl FnOnce(CollectionHandle<T>) -> R,
 ) -> Result<R, DispatchError> {
 	let imbalance = <T as Config>::Currency::deposit(
-		&owner.as_sub(),
+		owner.as_sub(),
 		T::CollectionCreationPrice::get(),
 		Precision::Exact,
 	)?;
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -2420,7 +2420,8 @@
 	}
 }
 
-#[cfg(feature = "tests")]
+#[cfg(any(feature = "tests", test))]
+#[allow(missing_docs)]
 pub mod tests {
 	use crate::{DispatchResult, DispatchError, LazyValue, Config};
 
@@ -2456,7 +2457,7 @@
 	}
 
 	#[rustfmt::skip]
-	pub const table: [TestCase; 16] = [
+	pub const TABLE: [TestCase; 16] = [
 		//                    ┌╴collection_admin
 		//                    │  ┌╴is_collection_admin
 		//                    │  │   ┌╴token_owner
modifiedpallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-coder-substrate/src/lib.rs
+++ b/pallets/evm-coder-substrate/src/lib.rs
@@ -286,7 +286,14 @@
 {
 	let call = C::parse_full(input)?;
 	if call.is_none() {
-		return Err("unrecognized selector".into());
+		let selector = if input.len() >= 4 {
+			let mut selector = [0; 4];
+			selector.copy_from_slice(&input[..4]);
+			u32::from_be_bytes(selector)
+		} else {
+			0
+		};
+		return Err(format!("unrecognized selector: 0x{selector:0>8x}").into());
 	}
 	let call = call.unwrap();
 
@@ -329,7 +336,7 @@
 		ERC165Call(ERC165Call, PhantomData<fn() -> T>),
 		OtherCall(ERC165Call),
 
-		#[weight(Weight::from_ref_time(a + b))]
+		#[weight(Weight::from_parts(a + b, 0))]
 		Example {
 			a: u64,
 			b: u64,
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -53,7 +53,7 @@
 		let data = (0..b).map(|i| {
 			bench_init!(to: cross_sub(i););
 			(to, 200)
-		}).collect::<BTreeMap<_, _>>().try_into().unwrap();
+		}).collect::<BTreeMap<_, _>>();
 	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	burn_item {
modifiedpallets/identity/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/identity/src/benchmarking.rs
+++ b/pallets/identity/src/benchmarking.rs
@@ -35,6 +35,7 @@
 //! Identity pallet benchmarking.
 
 #![cfg(feature = "runtime-benchmarks")]
+#![allow(clippy::no_effect)]
 
 use super::*;
 
modifiedpallets/identity/src/tests.rsdiffbeforeafterboth
--- a/pallets/identity/src/tests.rs
+++ b/pallets/identity/src/tests.rs
@@ -67,7 +67,7 @@
 
 parameter_types! {
 	pub BlockWeights: frame_system::limits::BlockWeights =
-		frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
+		frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_parts(1024, 0));
 }
 impl frame_system::Config for Test {
 	type BaseCallFilter = frame_support::traits::Everything;
modifiedpallets/identity/src/types.rsdiffbeforeafterboth
--- a/pallets/identity/src/types.rs
+++ b/pallets/identity/src/types.rs
@@ -481,7 +481,7 @@
 		let mut registry = scale_info::Registry::new();
 		let type_id = registry.register_type(&scale_info::meta_type::<Data>());
 		let registry: scale_info::PortableRegistry = registry.into();
-		let type_info = registry.resolve(type_id.id()).unwrap();
+		let type_info = registry.resolve(type_id.id).unwrap();
 
 		let check_type_info = |data: &Data| {
 			let variant_name = match data {
@@ -492,20 +492,20 @@
 				Data::ShaThree256(_) => "ShaThree256".to_string(),
 				Data::Raw(bytes) => format!("Raw{}", bytes.len()),
 			};
-			if let scale_info::TypeDef::Variant(variant) = type_info.type_def() {
+			if let scale_info::TypeDef::Variant(variant) = &type_info.type_def {
 				let variant = variant
-					.variants()
+					.variants
 					.iter()
-					.find(|v| v.name() == &variant_name)
+					.find(|v| v.name == variant_name)
 					.expect(&format!("Expected to find variant {}", variant_name));
 
 				let field_arr_len = variant
-					.fields()
+					.fields
 					.first()
-					.and_then(|f| registry.resolve(f.ty().id()))
+					.and_then(|f| registry.resolve(f.ty.id))
 					.map(|ty| {
-						if let scale_info::TypeDef::Array(arr) = ty.type_def() {
-							arr.len()
+						if let scale_info::TypeDef::Array(arr) = &ty.type_def {
+							arr.len
 						} else {
 							panic!("Should be an array type")
 						}
@@ -513,7 +513,7 @@
 					.unwrap_or(0);
 
 				let encoded = data.encode();
-				assert_eq!(encoded[0], variant.index());
+				assert_eq!(encoded[0], variant.index);
 				assert_eq!(encoded.len() as u32 - 1, field_arr_len);
 			} else {
 				panic!("Should be a variant type")
modifiedpallets/inflation/src/tests.rsdiffbeforeafterboth
--- a/pallets/inflation/src/tests.rs
+++ b/pallets/inflation/src/tests.rs
@@ -78,7 +78,7 @@
 parameter_types! {
 	pub const BlockHashCount: u64 = 250;
 	pub BlockWeights: frame_system::limits::BlockWeights =
-		frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024));
+		frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
 	pub const SS58Prefix: u8 = 42;
 }
 
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -43,12 +43,12 @@
 	owner: T::CrossAccountId,
 ) -> Result<TokenId, DispatchError> {
 	<Pallet<T>>::create_item(
-		&collection,
+		collection,
 		sender,
 		create_max_item_data::<T>(owner),
 		&Unlimited,
 	)?;
-	Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))
+	Ok(TokenId(<TokensMinted<T>>::get(collection.id)))
 }
 
 fn create_collection<T: Config>(
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -51,8 +51,8 @@
 	users: impl IntoIterator<Item = (T::CrossAccountId, u128)>,
 ) -> Result<TokenId, DispatchError> {
 	let data: CreateItemData<T> = create_max_item_data::<T>(users);
-	<Pallet<T>>::create_item(&collection, sender, data, &Unlimited)?;
-	Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))
+	<Pallet<T>>::create_item(collection, sender, data, &Unlimited)?;
+	Ok(TokenId(<TokensMinted<T>>::get(collection.id)))
 }
 
 fn create_collection<T: Config>(
@@ -104,7 +104,7 @@
 		let data = vec![create_max_item_data::<T>((0..b).map(|u| {
 			bench_init!(to: cross_sub(u););
 			(to, 200)
-		}))].try_into().unwrap();
+		}))];
 	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	// Other user left, token data is kept
modifiedpallets/scheduler-v2/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/benchmarking.rs
+++ b/pallets/scheduler-v2/src/benchmarking.rs
@@ -83,11 +83,11 @@
 ///
 /// # Arguments
 /// * `periodic` - makes the task periodic.
-/// 	Sets the task's period and repetition count to `100`.
+///     Sets the task's period and repetition count to `100`.
 /// * `named` - gives a name to the task: `u32_to_name(0)`.
 /// * `signed` - determines the origin of the task.
-/// 	If true, it will have the Signed origin. Otherwise it will have the Root origin.
-/// 	See [`make_origin`] for details.
+///     If true, it will have the Signed origin. Otherwise it will have the Root origin.
+///     See [`make_origin`] for details.
 /// * maybe_lookup_len - sets optional lookup length. It is used to benchmark task fetching from the `Preimages` store.
 /// * priority - the task's priority.
 fn make_task<T: Config>(
@@ -155,12 +155,10 @@
 		}
 		if maybe_lookup_len.is_some() {
 			len += 1;
+		} else if len > 0 {
+			len -= 1;
 		} else {
-			if len > 0 {
-				len -= 1;
-			} else {
-				break c;
-			}
+			break c;
 		}
 	}
 }
modifiedpallets/scheduler-v2/src/mock.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/mock.rs
+++ b/pallets/scheduler-v2/src/mock.rs
@@ -33,6 +33,7 @@
 // limitations under the License.
 
 //! # Scheduler test environment.
+#![allow(deprecated)]
 
 use super::*;
 
@@ -229,6 +230,10 @@
 			r => Err(O::from(r)),
 		})
 	}
+	#[cfg(feature = "runtime-benchmarks")]
+	fn try_successful_origin() -> Result<O, ()> {
+		Ok(O::from(RawOrigin::Root))
+	}
 }
 
 pub struct Executor;
modifiedpallets/scheduler-v2/src/tests.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/tests.rs
+++ b/pallets/scheduler-v2/src/tests.rs
@@ -33,6 +33,7 @@
 // limitations under the License.
 
 //! # Scheduler tests.
+#![allow(deprecated)]
 
 use super::*;
 use crate::mock::{
modifiedpallets/structure/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/structure/src/benchmarking.rs
+++ b/pallets/structure/src/benchmarking.rs
@@ -19,8 +19,7 @@
 use frame_benchmarking::{benchmarks, account};
 use frame_support::traits::{fungible::Balanced, Get, tokens::Precision};
 use up_data_structs::{
-	CreateCollectionData, CollectionMode, CreateItemData, CollectionFlags, CreateNftData,
-	budget::Unlimited,
+	CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,
 };
 use pallet_common::Config as CommonConfig;
 use pallet_evm::account::CrossAccountId;
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -24,8 +24,7 @@
 		weights::CommonWeights,
 		RelayChainBlockNumberProvider,
 	},
-	Runtime, RuntimeEvent, RuntimeCall, RUNTIME_NAME, TOKEN_SYMBOL, DECIMALS,
-	Balances,
+	Runtime, RuntimeEvent, RuntimeCall, RUNTIME_NAME, TOKEN_SYMBOL, DECIMALS, Balances,
 };
 use frame_support::traits::{ConstU32, ConstU64, Currency};
 use up_common::{
modifiedruntime/common/ethereum/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring.rs
+++ b/runtime/common/ethereum/sponsoring.rs
@@ -161,7 +161,8 @@
 					}
 				}
 				CollectionMode::ReFungible => {
-					let call = <UniqueRefungibleCall<T>>::parse_full(&call_context.input).ok()??;
+					let call =
+						<UniqueRefungibleCall<T>>::parse_full(&call_context.input).ok()??;
 					refungible::call_sponsor(call, collection, who).map(|()| sponsor)
 				}
 				CollectionMode::Fungible(_) => {
modifiedruntime/common/tests/mod.rsdiffbeforeafterboth
--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -16,7 +16,6 @@
 
 use sp_runtime::{BuildStorage, Storage};
 use sp_core::{Public, Pair};
-use sp_std::vec;
 use up_common::types::AuraId;
 use crate::{Runtime, GenesisConfig, ParachainInfoConfig, RuntimeEvent, System};
 
@@ -76,7 +75,7 @@
 		AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
 	}
 
-	let accounts = vec!["Alice", "Bob"];
+	let accounts = ["Alice", "Bob"];
 	let keys = accounts
 		.iter()
 		.map(|&acc| {
@@ -104,7 +103,7 @@
 		..GenesisConfig::default()
 	};
 
-	cfg.build_storage().unwrap().into()
+	cfg.build_storage().unwrap()
 }
 
 #[cfg(not(feature = "collator-selection"))]
modifiedruntime/common/tests/xcm.rsdiffbeforeafterboth
--- a/runtime/common/tests/xcm.rs
+++ b/runtime/common/tests/xcm.rs
@@ -26,7 +26,7 @@
 const ALICE: AccountId = AccountId::new([0u8; 32]);
 const BOB: AccountId = AccountId::new([1u8; 32]);
 
-const INITIAL_BALANCE: u128 = 1000000000000000000_0000; // 1000 UNQ
+const INITIAL_BALANCE: u128 = 10_000_000_000_000_000_000_000; // 10_000 UNQ
 
 #[test]
 pub fn xcm_transact_is_forbidden() {
modifiedruntime/tests/Cargo.tomldiffbeforeafterboth
--- a/runtime/tests/Cargo.toml
+++ b/runtime/tests/Cargo.toml
@@ -5,7 +5,6 @@
 
 [features]
 default = ['refungible']
-tests = ['pallet-common/tests']
 
 refungible = []
 
@@ -44,3 +43,6 @@
 evm-coder = { workspace = true }
 up-sponsorship = { workspace = true }
 xcm = { workspace = true }
+
+[dev-dependencies]
+pallet-common = { workspace = true, features = ["tests"] }
modifiedruntime/tests/src/tests.rsdiffbeforeafterboth
--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -99,7 +99,7 @@
 	.try_into()
 	.unwrap();
 
-	let data: CreateCollectionData<u64> = CreateCollectionData {
+	let data = CreateCollectionData {
 		name: col_name1.try_into().unwrap(),
 		description: col_desc1.try_into().unwrap(),
 		token_prefix: token_prefix1.try_into().unwrap(),
@@ -204,14 +204,13 @@
 		let description: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
 		let token_prefix: Vec<u8> = b"token_prefix1\0".to_vec();
 
-		let data: CreateCollectionData<<Test as frame_system::Config>::AccountId> =
-			CreateCollectionData {
-				name: name.try_into().unwrap(),
-				description: description.try_into().unwrap(),
-				token_prefix: token_prefix.try_into().unwrap(),
-				mode: CollectionMode::NFT,
-				..Default::default()
-			};
+		let data = CreateCollectionData {
+			name: name.try_into().unwrap(),
+			description: description.try_into().unwrap(),
+			token_prefix: token_prefix.try_into().unwrap(),
+			mode: CollectionMode::NFT,
+			..Default::default()
+		};
 
 		let result = Unique::create_collection_ex(RuntimeOrigin::signed(acc), data);
 		assert_err!(result, <CommonError<Test>>::NotSufficientFounds);
@@ -225,7 +224,7 @@
 		let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
 		let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
 
-		let data: CreateCollectionData<u64> = CreateCollectionData {
+		let data = CreateCollectionData {
 			name: col_name1.try_into().unwrap(),
 			description: col_desc1.try_into().unwrap(),
 			token_prefix: token_prefix1.try_into().unwrap(),
@@ -2364,7 +2363,7 @@
 		let col_desc1: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();
 		let token_prefix1: Vec<u8> = b"token_prefix1\0".to_vec();
 
-		let data: CreateCollectionData<u64> = CreateCollectionData {
+		let data = CreateCollectionData {
 			name: col_name1.try_into().unwrap(),
 			description: col_desc1.try_into().unwrap(),
 			token_prefix: token_prefix1.try_into().unwrap(),
@@ -2618,9 +2617,7 @@
 
 mod check_token_permissions {
 	use super::*;
-	use frame_support::once_cell::sync::Lazy;
 	use pallet_common::LazyValue;
-	use sp_runtime::DispatchError;
 
 	fn test<FTE: FnOnce() -> bool>(
 		i: usize,
@@ -2662,7 +2659,7 @@
 	fn no_permission_only() {
 		new_test_ext().execute_with(|| {
 			let mut check_token_existence = LazyValue::new(|| true);
-			for (i, row) in pallet_common::tests::table.iter().enumerate() {
+			for (i, row) in pallet_common::tests::TABLE.iter().enumerate() {
 				test(i, row, &mut check_token_existence);
 			}
 		});
@@ -2671,7 +2668,7 @@
 	#[test]
 	fn no_permission_and_token_not_found() {
 		new_test_ext().execute_with(|| {
-			for (i, row) in pallet_common::tests::table.iter().enumerate() {
+			for (i, row) in pallet_common::tests::TABLE.iter().enumerate() {
 				// This is inside the loop to keep track of whether the lambda was called
 				let mut check_token_existence = LazyValue::new(|| false);
 				test(i, row, &mut check_token_existence);
modifiedtests/src/createCollection.test.tsdiffbeforeafterboth
--- a/tests/src/createCollection.test.ts
+++ b/tests/src/createCollection.test.ts
@@ -106,15 +106,17 @@
       flags: [CollectionFlag.Erc721metadata],
     }, 'nft');
 
-    await mintCollectionHelper(helper, alice, {
+    // User can not set Foreign flag itself
+
+    await expect(mintCollectionHelper(helper, alice, {
       name: 'name', description: 'descr', tokenPrefix: 'COL',
       flags: [CollectionFlag.Foreign],
-    }, 'nft');
+    }, 'nft')).to.be.rejectedWith(/common.NoPermission/);
 
-    await mintCollectionHelper(helper, alice, {
+    await expect(mintCollectionHelper(helper, alice, {
       name: 'name', description: 'descr', tokenPrefix: 'COL',
       flags: [CollectionFlag.Erc721metadata, CollectionFlag.Foreign],
-    }, 'nft');
+    }, 'nft')).to.be.rejectedWith(/common.NoPermission/);
   });
 
   itSub('Create new collection with extra fields', async ({helper}) => {
modifiedtests/src/eth/collectionLimits.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionLimits.test.ts
+++ b/tests/src/eth/collectionLimits.test.ts
@@ -106,7 +106,7 @@
 
       // Cannot disable limits
       await expect(collectionEvm.methods
-        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, value: {status: false, value: 200}})
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, value: {status: false, value: 0}})
         .call()).to.be.rejectedWith('user can\'t disable limits');
 
       await expect(collectionEvm.methods
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -41,7 +41,7 @@
       for(const arg of args) {
         if(typeof arg !== 'string')
           continue;
-        const skippedWarnings = ['1000:: Normal connection closure', 'Not decorating unknown runtime apis:', 'RPC methods not decorated:', 'Not decorating runtime apis'];
+        const skippedWarnings = ['1000:: Normal connection closure', 'Not decorating unknown runtime apis:', 'RPC methods not decorated:', 'Not decorating runtime apis', 'Bad input data provided to validate_transaction', 'account balance too low', '1006:: Abnormal Closure'];
         const needToSkip = skippedWarnings.reduce((a,  b) => a || arg.includes(b), false);
         if(needToSkip || arg === 'Normal connection closure')
           return;