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
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -297,7 +297,7 @@
 				default_runtime,
 				// Sudo account
 				get_account_id_from_seed::<sr25519::Public>("Alice"),
-				vec![
+				[
 					(
 						get_account_id_from_seed::<sr25519::Public>("Alice"),
 						get_from_seed::<AuraId>("Alice"),
@@ -371,7 +371,7 @@
 				default_runtime,
 				// Sudo account
 				get_account_id_from_seed::<sr25519::Public>("Alice"),
-				vec![
+				[
 					(
 						get_account_id_from_seed::<sr25519::Public>("Alice"),
 						get_from_seed::<AuraId>("Alice"),
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
after · pallets/identity/src/benchmarking.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) 2020-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//! Identity pallet benchmarking.3637#![cfg(feature = "runtime-benchmarks")]38#![allow(clippy::no_effect)]3940use super::*;4142use crate::Pallet as Identity;43use frame_benchmarking::{account, benchmarks, whitelisted_caller};44use frame_support::{45	ensure, assert_ok,46	traits::{EnsureOrigin, Get},47};48use frame_system::RawOrigin;49use sp_runtime::traits::Bounded;5051const SEED: u32 = 0;5253fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {54	frame_system::Pallet::<T>::assert_last_event(generic_event.into());55}5657// Adds `r` registrars to the Identity Pallet. These registrars will have set fees and fields.58fn add_registrars<T: Config>(r: u32) -> Result<(), &'static str> {59	for i in 0..r {60		let registrar: T::AccountId = account("registrar", i, SEED);61		let registrar_lookup = T::Lookup::unlookup(registrar.clone());62		let _ = T::Currency::make_free_balance_be(&registrar, BalanceOf::<T>::max_value());63		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();64		Identity::<T>::add_registrar(registrar_origin, registrar_lookup)?;65		Identity::<T>::set_fee(RawOrigin::Signed(registrar.clone()).into(), i, 10u32.into())?;66		let fields = IdentityFields(67			IdentityField::Display68				| IdentityField::Legal69				| IdentityField::Web70				| IdentityField::Riot71				| IdentityField::Email72				| IdentityField::PgpFingerprint73				| IdentityField::Image74				| IdentityField::Twitter,75		);76		Identity::<T>::set_fields(RawOrigin::Signed(registrar.clone()).into(), i, fields)?;77	}7879	assert_eq!(Registrars::<T>::get().len(), r as usize);80	Ok(())81}8283// Create `s` sub-accounts for the identity of `who` and return them.84// Each will have 32 bytes of raw data added to it.85fn create_sub_accounts<T: Config>(86	who: &T::AccountId,87	s: u32,88) -> Result<Vec<(T::AccountId, Data)>, &'static str> {89	let mut subs = Vec::new();90	let who_origin = RawOrigin::Signed(who.clone());91	let data = Data::Raw(vec![0; 32].try_into().unwrap());9293	for i in 0..s {94		let sub_account = account("sub", i, SEED);95		subs.push((sub_account, data.clone()));96	}9798	// Set identity so `set_subs` does not fail.99	if IdentityOf::<T>::get(who).is_none() {100		let _ = T::Currency::make_free_balance_be(who, BalanceOf::<T>::max_value() / 2u32.into());101		let info = create_identity_info::<T>(1);102		Identity::<T>::set_identity(who_origin.into(), Box::new(info))?;103	}104105	Ok(subs)106}107108// Adds `s` sub-accounts to the identity of `who`. Each will have 32 bytes of raw data added to it.109// This additionally returns the vector of sub-accounts so it can be modified if needed.110fn add_sub_accounts<T: Config>(111	who: &T::AccountId,112	s: u32,113) -> Result<Vec<(T::AccountId, Data)>, &'static str> {114	let who_origin = RawOrigin::Signed(who.clone());115	let subs = create_sub_accounts::<T>(who, s)?;116117	Identity::<T>::set_subs(who_origin.into(), subs.clone())?;118119	Ok(subs)120}121122// This creates an `IdentityInfo` object with `num_fields` extra fields.123// All data is pre-populated with some arbitrary bytes.124fn create_identity_info<T: Config>(num_fields: u32) -> IdentityInfo<T::MaxAdditionalFields> {125	let data = Data::Raw(vec![0; 32].try_into().unwrap());126127	IdentityInfo {128		additional: vec![(data.clone(), data.clone()); num_fields as usize]129			.try_into()130			.unwrap(),131		display: data.clone(),132		legal: data.clone(),133		web: data.clone(),134		riot: data.clone(),135		email: data.clone(),136		pgp_fingerprint: Some([0; 20]),137		image: data.clone(),138		twitter: data,139	}140}141142/// `Currency::minimum_balance` was used originally, but in unique-chain, we have143/// zero existential deposit, thus triggering zero bond assertion.144fn balance_unit<T: Config>() -> <T::Currency as Currency<T::AccountId>>::Balance {145	200u32.into()146}147148benchmarks! {149	add_registrar {150		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;151		ensure!(Registrars::<T>::get().len() as u32 == r, "Registrars not set up correctly.");152		let origin = T::RegistrarOrigin::try_successful_origin().unwrap();153		let account = T::Lookup::unlookup(account("registrar", r + 1, SEED));154	}: _<T::RuntimeOrigin>(origin, account)155	verify {156		ensure!(Registrars::<T>::get().len() as u32 == r + 1, "Registrars not added.");157	}158159	set_identity {160		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;161		let x in 0 .. T::MaxAdditionalFields::get();162		let caller = {163			// The target user164			let caller: T::AccountId = whitelisted_caller();165			let caller_lookup = T::Lookup::unlookup(caller.clone());166			let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into();167			let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());168169			// Add an initial identity170			let initial_info = create_identity_info::<T>(1);171			Identity::<T>::set_identity(caller_origin.clone(), Box::new(initial_info.clone()))?;172173			// User requests judgement from all the registrars, and they approve174			for i in 0..r {175				let registrar: T::AccountId = account("registrar", i, SEED);176				let registrar_lookup = T::Lookup::unlookup(registrar.clone());177				let balance_to_use =  balance_unit::<T>() * 10u32.into();178				let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);179180				Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;181				Identity::<T>::provide_judgement(182					RawOrigin::Signed(registrar).into(),183					i,184					caller_lookup.clone(),185					Judgement::Reasonable,186					T::Hashing::hash_of(&initial_info),187				)?;188			}189			caller190		};191	}: _(RawOrigin::Signed(caller.clone()), Box::new(create_identity_info::<T>(x)))192	verify {193		assert_last_event::<T>(Event::<T>::IdentitySet { who: caller }.into());194	}195196	// We need to split `set_subs` into two benchmarks to accurately isolate the potential197	// writes caused by new or old sub accounts. The actual weight should simply be198	// the sum of these two weights.199	set_subs_new {200		let caller: T::AccountId = whitelisted_caller();201		// Create a new subs vec with s sub accounts202		let s in 0 .. T::MaxSubAccounts::get() => ();203		let subs = create_sub_accounts::<T>(&caller, s)?;204		ensure!(SubsOf::<T>::get(&caller).1.len() == 0, "Caller already has subs");205	}: set_subs(RawOrigin::Signed(caller.clone()), subs)206	verify {207		ensure!(SubsOf::<T>::get(&caller).1.len() as u32 == s, "Subs not added");208	}209210	set_subs_old {211		let caller: T::AccountId = whitelisted_caller();212		// Give them p many previous sub accounts.213		let p in 0 .. T::MaxSubAccounts::get() => {214			let _ = add_sub_accounts::<T>(&caller, p)?;215		};216		// Remove all subs.217		let subs = create_sub_accounts::<T>(&caller, 0)?;218		ensure!(219			SubsOf::<T>::get(&caller).1.len() as u32 == p,220			"Caller does have subs",221		);222	}: set_subs(RawOrigin::Signed(caller.clone()), subs)223	verify {224		ensure!(SubsOf::<T>::get(&caller).1.len() == 0, "Subs not removed");225	}226227	clear_identity {228		let caller: T::AccountId = whitelisted_caller();229		let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));230		let caller_lookup = <T::Lookup as StaticLookup>::unlookup(caller.clone());231		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());232233		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;234		let s in 0 .. T::MaxSubAccounts::get() => {235			// Give them s many sub accounts236			let caller: T::AccountId = whitelisted_caller();237			let _ = add_sub_accounts::<T>(&caller, s)?;238		};239		let x in 0 .. T::MaxAdditionalFields::get();240241		// Create their main identity with x additional fields242		let info = create_identity_info::<T>(x);243		let caller: T::AccountId = whitelisted_caller();244		let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));245		Identity::<T>::set_identity(caller_origin.clone(), Box::new(info.clone()))?;246247		// User requests judgement from all the registrars, and they approve248		for i in 0..r {249			let registrar: T::AccountId = account("registrar", i, SEED);250			let balance_to_use =  balance_unit::<T>() * 10u32.into();251			let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);252253			Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;254			Identity::<T>::provide_judgement(255				RawOrigin::Signed(registrar).into(),256				i,257				caller_lookup.clone(),258				Judgement::Reasonable,259				T::Hashing::hash_of(&info),260			)?;261		}262		ensure!(IdentityOf::<T>::contains_key(&caller), "Identity does not exist.");263	}: _(RawOrigin::Signed(caller.clone()))264	verify {265		ensure!(!IdentityOf::<T>::contains_key(&caller), "Identity not cleared.");266	}267268	request_judgement {269		let caller: T::AccountId = whitelisted_caller();270		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());271272		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;273		let x in 0 .. T::MaxAdditionalFields::get() => {274			// Create their main identity with x additional fields275			let info = create_identity_info::<T>(x);276			let caller: T::AccountId = whitelisted_caller();277			let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller));278			Identity::<T>::set_identity(caller_origin, Box::new(info))?;279		};280	}: _(RawOrigin::Signed(caller.clone()), r - 1, 10u32.into())281	verify {282		assert_last_event::<T>(Event::<T>::JudgementRequested { who: caller, registrar_index: r-1 }.into());283	}284285	cancel_request {286		let caller: T::AccountId = whitelisted_caller();287		let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));288		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());289290		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;291		let x in 0 .. T::MaxAdditionalFields::get() => {292			// Create their main identity with x additional fields293			let info = create_identity_info::<T>(x);294			let caller: T::AccountId = whitelisted_caller();295			let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller));296			Identity::<T>::set_identity(caller_origin, Box::new(info))?;297		};298299		Identity::<T>::request_judgement(caller_origin, r - 1, 10u32.into())?;300	}: _(RawOrigin::Signed(caller.clone()), r - 1)301	verify {302		assert_last_event::<T>(Event::<T>::JudgementUnrequested { who: caller, registrar_index: r-1 }.into());303	}304305	set_fee {306		let caller: T::AccountId = whitelisted_caller();307		let caller_lookup = T::Lookup::unlookup(caller.clone());308309		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;310311		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();312		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;313		let registrars = Registrars::<T>::get();314		ensure!(registrars[r as usize].as_ref().unwrap().fee == 0u32.into(), "Fee already set.");315	}: _(RawOrigin::Signed(caller), r, 100u32.into())316	verify {317		let registrars = Registrars::<T>::get();318		ensure!(registrars[r as usize].as_ref().unwrap().fee == 100u32.into(), "Fee not changed.");319	}320321	set_account_id {322		let caller: T::AccountId = whitelisted_caller();323		let caller_lookup = T::Lookup::unlookup(caller.clone());324		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());325326		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;327328		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();329		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;330		let registrars = Registrars::<T>::get();331		ensure!(registrars[r as usize].as_ref().unwrap().account == caller, "id not set.");332		let new_account = T::Lookup::unlookup(account("new", 0, SEED));333	}: _(RawOrigin::Signed(caller), r, new_account)334	verify {335		let registrars = Registrars::<T>::get();336		ensure!(registrars[r as usize].as_ref().unwrap().account == account("new", 0, SEED), "id not changed.");337	}338339	set_fields {340		let caller: T::AccountId = whitelisted_caller();341		let caller_lookup = T::Lookup::unlookup(caller.clone());342		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());343344		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;345346		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();347		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;348		let fields = IdentityFields(349			IdentityField::Display | IdentityField::Legal | IdentityField::Web | IdentityField::Riot350			| IdentityField::Email | IdentityField::PgpFingerprint | IdentityField::Image | IdentityField::Twitter351		);352		let registrars = Registrars::<T>::get();353		ensure!(registrars[r as usize].as_ref().unwrap().fields == Default::default(), "fields already set.");354	}: _(RawOrigin::Signed(caller), r, fields)355	verify {356		let registrars = Registrars::<T>::get();357		ensure!(registrars[r as usize].as_ref().unwrap().fields != Default::default(), "fields not set.");358	}359360	provide_judgement {361		// The user362		let user: T::AccountId = account("user", r, SEED);363		let user_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(user.clone()));364		let user_lookup = <T::Lookup as StaticLookup>::unlookup(user.clone());365		let _ = T::Currency::make_free_balance_be(&user, BalanceOf::<T>::max_value());366367		let caller: T::AccountId = whitelisted_caller();368		let caller_lookup = T::Lookup::unlookup(caller.clone());369		let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());370371		let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;372		let x in 0 .. T::MaxAdditionalFields::get();373374		let info = create_identity_info::<T>(x);375		let info_hash = T::Hashing::hash_of(&info);376		Identity::<T>::set_identity(user_origin.clone(), Box::new(info))?;377378		let registrar_origin = T::RegistrarOrigin::try_successful_origin().unwrap();379		Identity::<T>::add_registrar(registrar_origin, caller_lookup)?;380		Identity::<T>::request_judgement(user_origin, r, 10u32.into())?;381	}: _(RawOrigin::Signed(caller), r, user_lookup, Judgement::Reasonable, info_hash)382	verify {383		assert_last_event::<T>(Event::<T>::JudgementGiven { target: user, registrar_index: r }.into())384	}385386	kill_identity {387		let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;388		let s in 0 .. T::MaxSubAccounts::get();389		let x in 0 .. T::MaxAdditionalFields::get();390391		let target: T::AccountId = account("target", 0, SEED);392		let target_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(target.clone()).into();393		let target_lookup = T::Lookup::unlookup(target.clone());394		let _ = T::Currency::make_free_balance_be(&target, BalanceOf::<T>::max_value());395396		let info = create_identity_info::<T>(x);397		Identity::<T>::set_identity(target_origin.clone(), Box::new(info.clone()))?;398		let _ = add_sub_accounts::<T>(&target, s)?;399400		// User requests judgement from all the registrars, and they approve401		for i in 0..r {402			let registrar: T::AccountId = account("registrar", i, SEED);403			let balance_to_use =  balance_unit::<T>() * 10u32.into();404			let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);405406			Identity::<T>::request_judgement(target_origin.clone(), i, 10u32.into())?;407			Identity::<T>::provide_judgement(408				RawOrigin::Signed(registrar).into(),409				i,410				target_lookup.clone(),411				Judgement::Reasonable,412				T::Hashing::hash_of(&info),413			)?;414		}415		ensure!(IdentityOf::<T>::contains_key(&target), "Identity not set");416		let origin = T::ForceOrigin::try_successful_origin().unwrap();417	}: _<T::RuntimeOrigin>(origin, target_lookup)418	verify {419		ensure!(!IdentityOf::<T>::contains_key(&target), "Identity not removed");420	}421422	force_insert_identities {423		let x in 0 .. T::MaxAdditionalFields::get();424		let n in 0..600;425		use frame_benchmarking::account;426		let identities = (0..n).map(|i| (427			account("caller", i, SEED),428			Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {429				judgements: Default::default(),430				deposit: Default::default(),431				info: create_identity_info::<T>(x),432			},433		)).collect::<Vec<_>>();434		let origin = T::ForceOrigin::try_successful_origin().unwrap();435	}: _<T::RuntimeOrigin>(origin, identities)436437	force_remove_identities {438		let x in 0 .. T::MaxAdditionalFields::get();439		let n in 0..600;440		use frame_benchmarking::account;441		let origin = T::ForceOrigin::try_successful_origin().unwrap();442		let identities = (0..n).map(|i| (443			account("caller", i, SEED),444			Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {445				judgements: Default::default(),446				deposit: Default::default(),447				info: create_identity_info::<T>(x),448			},449		)).collect::<Vec<_>>();450		assert_ok!(451			Identity::<T>::force_insert_identities(origin.clone(), identities.clone()),452		);453		let identities = identities.into_iter().map(|(acc, _)| acc).collect::<Vec<_>>();454	}: _<T::RuntimeOrigin>(origin, identities)455456	force_set_subs {457		let s in 0 .. T::MaxSubAccounts::get();458		let n in 0..600;459		use frame_benchmarking::account;460		let identities = (0..n).map(|i| {461			let caller: T::AccountId = account("caller", i, SEED);462			(463				caller.clone(),464				(465					BalanceOf::<T>::max_value(),466					create_sub_accounts::<T>(&caller, s).unwrap().try_into().unwrap(),467				),468			)469		}).collect::<Vec<_>>();470		let origin = T::ForceOrigin::try_successful_origin().unwrap();471	}: _<T::RuntimeOrigin>(origin, identities)472473	add_sub {474		let s in 0 .. T::MaxSubAccounts::get() - 1;475476		let caller: T::AccountId = whitelisted_caller();477		let _ = add_sub_accounts::<T>(&caller, s)?;478		let sub = account("new_sub", 0, SEED);479		let data = Data::Raw(vec![0; 32].try_into().unwrap());480		ensure!(SubsOf::<T>::get(&caller).1.len() as u32 == s, "Subs not set.");481	}: _(RawOrigin::Signed(caller.clone()), T::Lookup::unlookup(sub), data)482	verify {483		ensure!(SubsOf::<T>::get(&caller).1.len() as u32 == s + 1, "Subs not added.");484	}485486	rename_sub {487		let s in 1 .. T::MaxSubAccounts::get();488489		let caller: T::AccountId = whitelisted_caller();490		let (sub, _) = add_sub_accounts::<T>(&caller, s)?.remove(0);491		let data = Data::Raw(vec![1; 32].try_into().unwrap());492		ensure!(SuperOf::<T>::get(&sub).unwrap().1 != data, "data already set");493	}: _(RawOrigin::Signed(caller), T::Lookup::unlookup(sub.clone()), data.clone())494	verify {495		ensure!(SuperOf::<T>::get(&sub).unwrap().1 == data, "data not set");496	}497498	remove_sub {499		let s in 1 .. T::MaxSubAccounts::get();500501		let caller: T::AccountId = whitelisted_caller();502		let (sub, _) = add_sub_accounts::<T>(&caller, s)?.remove(0);503		ensure!(SuperOf::<T>::contains_key(&sub), "Sub doesn't exists");504	}: _(RawOrigin::Signed(caller), T::Lookup::unlookup(sub.clone()))505	verify {506		ensure!(!SuperOf::<T>::contains_key(&sub), "Sub not removed");507	}508509	quit_sub {510		let s in 0 .. T::MaxSubAccounts::get() - 1;511512		let caller: T::AccountId = whitelisted_caller();513		let sup = account("super", 0, SEED);514		let _ = add_sub_accounts::<T>(&sup, s)?;515		let sup_origin = RawOrigin::Signed(sup).into();516		Identity::<T>::add_sub(sup_origin, T::Lookup::unlookup(caller.clone()), Data::Raw(vec![0; 32].try_into().unwrap()))?;517		ensure!(SuperOf::<T>::contains_key(&caller), "Sub doesn't exists");518	}: _(RawOrigin::Signed(caller.clone()))519	verify {520		ensure!(!SuperOf::<T>::contains_key(&caller), "Sub not removed");521	}522523	impl_benchmark_test_suite!(Identity, crate::tests::new_test_ext(), crate::tests::Test);524}
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;