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
--- 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
before · pallets/inflation/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#![cfg(test)]18#![allow(clippy::from_over_into)]19use crate as pallet_inflation;2021use frame_support::{22	assert_ok, parameter_types,23	traits::{24		fungible::{Balanced, Inspect},25		OnInitialize, Everything, ConstU32,26		tokens::Precision,27	},28	weights::Weight,29};30use frame_system::RawOrigin;31use sp_core::H256;32use sp_runtime::{33	traits::{BlakeTwo256, BlockNumberProvider, IdentityLookup},34	testing::Header,35};3637type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;38type Block = frame_system::mocking::MockBlock<Test>;3940const YEAR: u64 = 5_259_600; // 6-second blocks41							 // const YEAR: u64 = 2_629_800; // 12-second blocks42							 // Expected 100-block inflation for year 1 is 100 * 100_000_000 / YEAR = FIRST_YEAR_BLOCK_INFLATION43const FIRST_YEAR_BLOCK_INFLATION: u64 = 1901;4445parameter_types! {46	pub const ExistentialDeposit: u64 = 1;47	pub const MaxLocks: u32 = 50;48}4950impl pallet_balances::Config for Test {51	type AccountStore = System;52	type Balance = u64;53	type DustRemoval = ();54	type RuntimeEvent = ();55	type ExistentialDeposit = ExistentialDeposit;56	type WeightInfo = ();57	type MaxLocks = MaxLocks;58	type MaxReserves = ();59	type ReserveIdentifier = ();60	type HoldIdentifier = ();61	type FreezeIdentifier = ();62	type MaxHolds = ();63	type MaxFreezes = ();64}6566frame_support::construct_runtime!(67	pub enum Test where68		Block = Block,69		NodeBlock = Block,70		UncheckedExtrinsic = UncheckedExtrinsic,71	{72		Balances: pallet_balances::{Pallet, Call, Storage},73		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},74		Inflation: pallet_inflation::{Pallet, Call, Storage},75	}76);7778parameter_types! {79	pub const BlockHashCount: u64 = 250;80	pub BlockWeights: frame_system::limits::BlockWeights =81		frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024));82	pub const SS58Prefix: u8 = 42;83}8485impl frame_system::Config for Test {86	type BaseCallFilter = Everything;87	type BlockWeights = ();88	type BlockLength = ();89	type DbWeight = ();90	type RuntimeOrigin = RuntimeOrigin;91	type RuntimeCall = RuntimeCall;92	type Index = u64;93	type BlockNumber = u64;94	type Hash = H256;95	type Hashing = BlakeTwo256;96	type AccountId = u64;97	type Lookup = IdentityLookup<Self::AccountId>;98	type Header = Header;99	type RuntimeEvent = ();100	type BlockHashCount = BlockHashCount;101	type Version = ();102	type PalletInfo = PalletInfo;103	type AccountData = pallet_balances::AccountData<u64>;104	type OnNewAccount = ();105	type OnKilledAccount = ();106	type SystemWeightInfo = ();107	type SS58Prefix = SS58Prefix;108	type OnSetCode = ();109	type MaxConsumers = ConstU32<16>;110}111112parameter_types! {113	pub TreasuryAccountId: u64 = 1234;114	pub const InflationBlockInterval: u32 = 100; // every time per how many blocks inflation is applied115	pub static MockBlockNumberProvider: u64 = 0;116}117118impl BlockNumberProvider for MockBlockNumberProvider {119	type BlockNumber = u64;120121	fn current_block_number() -> Self::BlockNumber {122		Self::get()123	}124}125126impl pallet_inflation::Config for Test {127	type Currency = Balances;128	type TreasuryAccountId = TreasuryAccountId;129	type InflationBlockInterval = InflationBlockInterval;130	type BlockNumberProvider = MockBlockNumberProvider;131}132133pub fn new_test_ext() -> sp_io::TestExternalities {134	frame_system::GenesisConfig::default()135		.build_storage::<Test>()136		.unwrap()137		.into()138}139140macro_rules! block_inflation {141	// Block inflation doesn't have any argumets142	() => {143		// Return BlockInflation state variable current value144		<pallet_inflation::BlockInflation<Test>>::get()145	};146}147148#[test]149fn uninitialized_inflation() {150	new_test_ext().execute_with(|| {151		let initial_issuance: u64 = 1_000_000_000;152		let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);153		assert_eq!(Balances::free_balance(1234), initial_issuance);154155		// BlockInflation should be set after inflation is started156		// first inflation deposit should be equal to BlockInflation157		MockBlockNumberProvider::set(1);158159		assert_eq!(block_inflation!(), 0);160	});161}162163#[test]164fn inflation_works() {165	new_test_ext().execute_with(|| {166		// Total issuance = 1_000_000_000167		let initial_issuance: u64 = 1_000_000_000;168		let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);169		assert_eq!(Balances::free_balance(1234), initial_issuance);170171		// BlockInflation should be set after inflation is started172		// first inflation deposit should be equal to BlockInflation173		MockBlockNumberProvider::set(1);174175		// Start inflation as sudo176		assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));177		assert_eq!(block_inflation!(), FIRST_YEAR_BLOCK_INFLATION);178		assert_eq!(179			Balances::free_balance(1234) - initial_issuance,180			block_inflation!()181		);182183		// Trigger inflation184		MockBlockNumberProvider::set(102);185		Inflation::on_initialize(0);186		assert_eq!(187			Balances::free_balance(1234) - initial_issuance,188			2 * block_inflation!()189		);190	});191}192193#[test]194fn inflation_second_deposit() {195	new_test_ext().execute_with(|| {196		// Total issuance = 1_000_000_000197		let initial_issuance: u64 = 1_000_000_000;198		let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);199		assert_eq!(Balances::free_balance(1234), initial_issuance);200		MockBlockNumberProvider::set(1);201202		// Start inflation as sudo203		assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));204205		// Next inflation deposit happens when block is greater then or equal to NextInflationBlock206		let mut block: u64 = 2;207		let balance_before: u64 = Balances::free_balance(1234);208		while block < <pallet_inflation::NextInflationBlock<Test>>::get() {209			MockBlockNumberProvider::set(block as u64);210			Inflation::on_initialize(0);211			block += 1;212		}213		let balance_just_before: u64 = Balances::free_balance(1234);214		assert_eq!(balance_before, balance_just_before);215216		// The block with inflation217		MockBlockNumberProvider::set(block as u64);218		Inflation::on_initialize(0);219		let balance_after: u64 = Balances::free_balance(1234);220		assert_eq!(balance_after - balance_just_before, block_inflation!());221	});222}223224#[test]225fn inflation_in_1_year() {226	new_test_ext().execute_with(|| {227		// Total issuance = 1_000_000_000228		let initial_issuance: u64 = 1_000_000_000;229		let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);230		assert_eq!(Balances::free_balance(1234), initial_issuance);231		MockBlockNumberProvider::set(1);232233		// Start inflation as sudo234		assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));235236		// Go through all the block inflations for year 1,237		// total issuance will be updated accordingly238		// Inflation is set to start in block 1, so first iteration is block 101239		for block in (101..YEAR).step_by(100) {240			MockBlockNumberProvider::set(block);241			Inflation::on_initialize(0);242		}243		assert_eq!(244			initial_issuance + (FIRST_YEAR_BLOCK_INFLATION * (YEAR / 100)),245			<Balances as Inspect<_>>::total_issuance()246		);247248		MockBlockNumberProvider::set(YEAR + 1);249		Inflation::on_initialize(0);250		let block_inflation_year_2 = block_inflation!();251		// Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR == 1951252		let expecter_year_2_inflation: u64 = (initial_issuance253			+ FIRST_YEAR_BLOCK_INFLATION * YEAR / 100)254			* 933 * 100 / (10000 * YEAR);255		assert_eq!(block_inflation_year_2 / 10, expecter_year_2_inflation / 10); // divide by 10 for approx. equality256	});257}258259#[test]260fn inflation_start_large_kusama_block() {261	new_test_ext().execute_with(|| {262		// Total issuance = 1_000_000_000263		let initial_issuance: u64 = 1_000_000_000;264		let start_block: u64 = 10457457;265		let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);266		assert_eq!(Balances::free_balance(1234), initial_issuance);267		MockBlockNumberProvider::set(start_block);268269		// Start inflation as sudo270		assert_ok!(Inflation::start_inflation(271			RawOrigin::Root.into(),272			start_block273		));274275		// Go through all the block inflations for year 1,276		// total issuance will be updated accordingly277		// Inflation is set to start in block 1, so first iteration is block 101278		for block in (101..YEAR).step_by(100) {279			MockBlockNumberProvider::set(start_block + block);280			Inflation::on_initialize(0);281		}282		assert_eq!(283			initial_issuance + (FIRST_YEAR_BLOCK_INFLATION * (YEAR / 100)),284			<Balances as Inspect<_>>::total_issuance()285		);286287		MockBlockNumberProvider::set(start_block + YEAR + 1);288		Inflation::on_initialize(0);289		let block_inflation_year_2 = block_inflation!();290		// Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR == 1951291		let expecter_year_2_inflation: u64 = (initial_issuance292			+ FIRST_YEAR_BLOCK_INFLATION * YEAR / 100)293			* 933 * 100 / (10000 * YEAR);294		assert_eq!(block_inflation_year_2 / 10, expecter_year_2_inflation / 10); // divide by 10 for approx. equality295	});296}297298#[test]299fn inflation_after_year_10_is_flat() {300	new_test_ext().execute_with(|| {301		// Total issuance = 1_000_000_000302		let initial_issuance: u64 = 1_000_000_000;303		let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);304		assert_eq!(Balances::free_balance(1234), initial_issuance);305		MockBlockNumberProvider::set(YEAR * 9 + 1);306307		// Start inflation as sudo308		assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));309310		// Let inflation catch up311		for _year in 1..=9 {312			Inflation::on_initialize(0);313		}314315		for year in 10..=20 {316			let block_inflation_year_before = block_inflation!();317			MockBlockNumberProvider::set(YEAR * year + 1);318			Inflation::on_initialize(0);319			let block_inflation_year_after = block_inflation!();320321			// Assert that next year inflation is equal to previous year inflation322			assert_eq!(block_inflation_year_before, block_inflation_year_after);323		}324	});325}326327#[test]328fn inflation_rate_by_year() {329	new_test_ext().execute_with(|| {330		let payouts: u64 = YEAR / InflationBlockInterval::get() as u64;331332		// Inflation starts at 10% and does down by 2/3% every year until year 9 (included),333		// then it is flat.334		let payout_by_year: [u64; 11] = [1000, 933, 867, 800, 733, 667, 600, 533, 467, 400, 400];335336		// For accuracy total issuance = payout0 * payouts * 10;337		let initial_issuance: u64 = payout_by_year[0] * payouts * 10;338		let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);339		assert_eq!(Balances::free_balance(1234), initial_issuance);340341		// Start inflation as sudo342		assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));343344		for year in 0..=10 {345			// Year first block346			MockBlockNumberProvider::set(YEAR * year + 1);347			Inflation::on_initialize(0);348			let mut actual_payout = block_inflation!();349			assert_eq!(actual_payout, payout_by_year[year as usize]);350351			// Year second block352			MockBlockNumberProvider::set(YEAR * year + 2);353			Inflation::on_initialize(0);354			actual_payout = block_inflation!();355			assert_eq!(actual_payout, payout_by_year[year as usize]);356357			// Year middle block358			MockBlockNumberProvider::set(year * YEAR + YEAR / 2);359			Inflation::on_initialize(0);360			actual_payout = block_inflation!();361			assert_eq!(actual_payout, payout_by_year[year as usize]);362363			// Year last block364			MockBlockNumberProvider::set((year + 1) * YEAR);365			Inflation::on_initialize(0);366			actual_payout = block_inflation!();367			assert_eq!(actual_payout, payout_by_year[year as usize]);368		}369	});370}
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;