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
before · pallets/identity/src/tests.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// This file is part of Substrate.1920// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// 	http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435// Tests for Identity Pallet3637use super::*;38use crate as pallet_identity;3940use codec::{Decode, Encode};41use frame_support::{42	assert_noop, assert_ok, ord_parameter_types, parameter_types,43	traits::{ConstU32, ConstU64, EitherOfDiverse},44	BoundedVec,45};46use frame_system::{EnsureRoot, EnsureSignedBy};47use sp_core::H256;48use sp_runtime::{49	testing::Header,50	traits::{BadOrigin, BlakeTwo256, IdentityLookup},51};5253type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;54type Block = frame_system::mocking::MockBlock<Test>;5556frame_support::construct_runtime!(57	pub enum Test where58		Block = Block,59		NodeBlock = Block,60		UncheckedExtrinsic = UncheckedExtrinsic,61	{62		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},63		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},64		Identity: pallet_identity::{Pallet, Call, Storage, Event<T>},65	}66);6768parameter_types! {69	pub BlockWeights: frame_system::limits::BlockWeights =70		frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));71}72impl frame_system::Config for Test {73	type BaseCallFilter = frame_support::traits::Everything;74	type BlockWeights = ();75	type BlockLength = ();76	type RuntimeOrigin = RuntimeOrigin;77	type Index = u64;78	type BlockNumber = u64;79	type Hash = H256;80	type RuntimeCall = RuntimeCall;81	type Hashing = BlakeTwo256;82	type AccountId = u64;83	type Lookup = IdentityLookup<Self::AccountId>;84	type Header = Header;85	type RuntimeEvent = RuntimeEvent;86	type BlockHashCount = ConstU64<250>;87	type DbWeight = ();88	type Version = ();89	type PalletInfo = PalletInfo;90	type AccountData = pallet_balances::AccountData<u64>;91	type OnNewAccount = ();92	type OnKilledAccount = ();93	type SystemWeightInfo = ();94	type SS58Prefix = ();95	type OnSetCode = ();96	type MaxConsumers = ConstU32<16>;97}9899impl pallet_balances::Config for Test {100	type Balance = u64;101	type RuntimeEvent = RuntimeEvent;102	type DustRemoval = ();103	type ExistentialDeposit = ConstU64<1>;104	type AccountStore = System;105	type MaxLocks = ();106	type MaxReserves = ();107	type ReserveIdentifier = [u8; 8];108	type WeightInfo = ();109	type HoldIdentifier = ();110	type FreezeIdentifier = ();111	type MaxHolds = ();112	type MaxFreezes = ();113}114115parameter_types! {116	pub const MaxAdditionalFields: u32 = 2;117	pub const MaxRegistrars: u32 = 20;118}119120ord_parameter_types! {121	pub const One: u64 = 1;122	pub const Two: u64 = 2;123}124type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<One, u64>>;125type EnsureTwoOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<Two, u64>>;126impl pallet_identity::Config for Test {127	type RuntimeEvent = RuntimeEvent;128	type Currency = Balances;129	type Slashed = ();130	type BasicDeposit = ConstU64<10>;131	type FieldDeposit = ConstU64<10>;132	type SubAccountDeposit = ConstU64<10>;133	type MaxSubAccounts = ConstU32<2>;134	type MaxAdditionalFields = MaxAdditionalFields;135	type MaxRegistrars = MaxRegistrars;136	type RegistrarOrigin = EnsureOneOrRoot;137	type ForceOrigin = EnsureTwoOrRoot;138	type WeightInfo = ();139}140141pub fn new_test_ext() -> sp_io::TestExternalities {142	let mut t = frame_system::GenesisConfig::default()143		.build_storage::<Test>()144		.unwrap();145	pallet_balances::GenesisConfig::<Test> {146		balances: vec![(1, 10), (2, 10), (3, 10), (10, 100), (20, 100), (30, 100)],147	}148	.assimilate_storage(&mut t)149	.unwrap();150	t.into()151}152153fn ten() -> IdentityInfo<MaxAdditionalFields> {154	IdentityInfo {155		display: Data::Raw(b"ten".to_vec().try_into().unwrap()),156		legal: Data::Raw(b"The Right Ordinal Ten, Esq.".to_vec().try_into().unwrap()),157		..Default::default()158	}159}160161fn twenty() -> IdentityInfo<MaxAdditionalFields> {162	IdentityInfo {163		display: Data::Raw(b"twenty".to_vec().try_into().unwrap()),164		legal: Data::Raw(165			b"The Right Ordinal Twenty, Esq."166				.to_vec()167				.try_into()168				.unwrap(),169		),170		..Default::default()171	}172}173174#[test]175fn editing_subaccounts_should_work() {176	new_test_ext().execute_with(|| {177		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());178179		assert_noop!(180			Identity::add_sub(RuntimeOrigin::signed(10), 20, data(1)),181			Error::<Test>::NoIdentity182		);183184		assert_ok!(Identity::set_identity(185			RuntimeOrigin::signed(10),186			Box::new(ten())187		));188189		// first sub account190		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));191		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));192		assert_eq!(Balances::free_balance(10), 80);193194		// second sub account195		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 2, data(2)));196		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));197		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));198		assert_eq!(Balances::free_balance(10), 70);199200		// third sub account is too many201		assert_noop!(202			Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)),203			Error::<Test>::TooManySubAccounts204		);205206		// rename first sub account207		assert_ok!(Identity::rename_sub(RuntimeOrigin::signed(10), 1, data(11)));208		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(11))));209		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));210		assert_eq!(Balances::free_balance(10), 70);211212		// remove first sub account213		assert_ok!(Identity::remove_sub(RuntimeOrigin::signed(10), 1));214		assert_eq!(SuperOf::<Test>::get(1), None);215		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));216		assert_eq!(Balances::free_balance(10), 80);217218		// add third sub account219		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)));220		assert_eq!(SuperOf::<Test>::get(1), None);221		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));222		assert_eq!(SuperOf::<Test>::get(3), Some((10, data(3))));223		assert_eq!(Balances::free_balance(10), 70);224	});225}226227#[test]228fn resolving_subaccount_ownership_works() {229	new_test_ext().execute_with(|| {230		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());231232		assert_ok!(Identity::set_identity(233			RuntimeOrigin::signed(10),234			Box::new(ten())235		));236		assert_ok!(Identity::set_identity(237			RuntimeOrigin::signed(20),238			Box::new(twenty())239		));240241		// 10 claims 1 as a subaccount242		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));243		assert_eq!(Balances::free_balance(1), 10);244		assert_eq!(Balances::free_balance(10), 80);245		assert_eq!(Balances::reserved_balance(10), 20);246		// 20 cannot claim 1 now247		assert_noop!(248			Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)),249			Error::<Test>::AlreadyClaimed250		);251		// 1 wants to be with 20 so it quits from 10252		assert_ok!(Identity::quit_sub(RuntimeOrigin::signed(1)));253		// 1 gets the 10 that 10 paid.254		assert_eq!(Balances::free_balance(1), 20);255		assert_eq!(Balances::free_balance(10), 80);256		assert_eq!(Balances::reserved_balance(10), 10);257		// 20 can claim 1 now258		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)));259	});260}261262#[test]263fn trailing_zeros_decodes_into_default_data() {264	let encoded = Data::Raw(b"Hello".to_vec().try_into().unwrap()).encode();265	assert!(<(Data, Data)>::decode(&mut &encoded[..]).is_err());266	let input = &mut &encoded[..];267	let (a, b) = <(Data, Data)>::decode(&mut AppendZerosInput::new(input)).unwrap();268	assert_eq!(a, Data::Raw(b"Hello".to_vec().try_into().unwrap()));269	assert_eq!(b, Data::None);270}271272#[test]273fn adding_registrar_should_work() {274	new_test_ext().execute_with(|| {275		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));276		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));277		let fields = IdentityFields(IdentityField::Display | IdentityField::Legal);278		assert_ok!(Identity::set_fields(RuntimeOrigin::signed(3), 0, fields));279		assert_eq!(280			Identity::registrars(),281			vec![Some(RegistrarInfo {282				account: 3,283				fee: 10,284				fields285			})]286		);287	});288}289290#[test]291fn amount_of_registrars_is_limited() {292	new_test_ext().execute_with(|| {293		for i in 1..MaxRegistrars::get() + 1 {294			assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), i as u64));295		}296		let last_registrar = MaxRegistrars::get() as u64 + 1;297		assert_noop!(298			Identity::add_registrar(RuntimeOrigin::signed(1), last_registrar),299			Error::<Test>::TooManyRegistrars300		);301	});302}303304#[test]305fn registration_should_work() {306	new_test_ext().execute_with(|| {307		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));308		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));309		let mut three_fields = ten();310		three_fields311			.additional312			.try_push(Default::default())313			.unwrap();314		three_fields315			.additional316			.try_push(Default::default())317			.unwrap();318		assert!(three_fields319			.additional320			.try_push(Default::default())321			.is_err());322		assert_ok!(Identity::set_identity(323			RuntimeOrigin::signed(10),324			Box::new(ten())325		));326		assert_eq!(Identity::identity(10).unwrap().info, ten());327		assert_eq!(Balances::free_balance(10), 90);328		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));329		assert_eq!(Balances::free_balance(10), 100);330		assert_noop!(331			Identity::clear_identity(RuntimeOrigin::signed(10)),332			Error::<Test>::NotNamed333		);334	});335}336337#[test]338fn uninvited_judgement_should_work() {339	new_test_ext().execute_with(|| {340		assert_noop!(341			Identity::provide_judgement(342				RuntimeOrigin::signed(3),343				0,344				10,345				Judgement::Reasonable,346				H256::random()347			),348			Error::<Test>::InvalidIndex349		);350351		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));352		assert_noop!(353			Identity::provide_judgement(354				RuntimeOrigin::signed(3),355				0,356				10,357				Judgement::Reasonable,358				H256::random()359			),360			Error::<Test>::InvalidTarget361		);362363		assert_ok!(Identity::set_identity(364			RuntimeOrigin::signed(10),365			Box::new(ten())366		));367		assert_noop!(368			Identity::provide_judgement(369				RuntimeOrigin::signed(3),370				0,371				10,372				Judgement::Reasonable,373				H256::random()374			),375			Error::<Test>::JudgementForDifferentIdentity376		);377378		let identity_hash = BlakeTwo256::hash_of(&ten());379380		assert_noop!(381			Identity::provide_judgement(382				RuntimeOrigin::signed(10),383				0,384				10,385				Judgement::Reasonable,386				identity_hash387			),388			Error::<Test>::InvalidIndex389		);390		assert_noop!(391			Identity::provide_judgement(392				RuntimeOrigin::signed(3),393				0,394				10,395				Judgement::FeePaid(1),396				identity_hash397			),398			Error::<Test>::InvalidJudgement399		);400401		assert_ok!(Identity::provide_judgement(402			RuntimeOrigin::signed(3),403			0,404			10,405			Judgement::Reasonable,406			identity_hash407		));408		assert_eq!(409			Identity::identity(10).unwrap().judgements,410			vec![(0, Judgement::Reasonable)]411		);412	});413}414415#[test]416fn clearing_judgement_should_work() {417	new_test_ext().execute_with(|| {418		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));419		assert_ok!(Identity::set_identity(420			RuntimeOrigin::signed(10),421			Box::new(ten())422		));423		assert_ok!(Identity::provide_judgement(424			RuntimeOrigin::signed(3),425			0,426			10,427			Judgement::Reasonable,428			BlakeTwo256::hash_of(&ten())429		));430		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));431		assert_eq!(Identity::identity(10), None);432	});433}434435#[test]436fn killing_slashing_should_work() {437	new_test_ext().execute_with(|| {438		assert_ok!(Identity::set_identity(439			RuntimeOrigin::signed(10),440			Box::new(ten())441		));442		assert_noop!(443			Identity::kill_identity(RuntimeOrigin::signed(1), 10),444			BadOrigin445		);446		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));447		assert_eq!(Identity::identity(10), None);448		assert_eq!(Balances::free_balance(10), 90);449		assert_noop!(450			Identity::kill_identity(RuntimeOrigin::signed(2), 10),451			Error::<Test>::NotNamed452		);453	});454}455456#[test]457fn setting_subaccounts_should_work() {458	new_test_ext().execute_with(|| {459		let mut subs = vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))];460		assert_noop!(461			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),462			Error::<Test>::NotFound463		);464465		assert_ok!(Identity::set_identity(466			RuntimeOrigin::signed(10),467			Box::new(ten())468		));469		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));470		assert_eq!(Balances::free_balance(10), 80);471		assert_eq!(Identity::subs_of(10), (10, vec![20].try_into().unwrap()));472		assert_eq!(473			Identity::super_of(20),474			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))475		);476477		// push another item and re-set it.478		subs.push((30, Data::Raw(vec![50; 1].try_into().unwrap())));479		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));480		assert_eq!(Balances::free_balance(10), 70);481		assert_eq!(482			Identity::subs_of(10),483			(20, vec![20, 30].try_into().unwrap())484		);485		assert_eq!(486			Identity::super_of(20),487			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))488		);489		assert_eq!(490			Identity::super_of(30),491			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))492		);493494		// switch out one of the items and re-set.495		subs[0] = (40, Data::Raw(vec![60; 1].try_into().unwrap()));496		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));497		assert_eq!(Balances::free_balance(10), 70); // no change in the balance498		assert_eq!(499			Identity::subs_of(10),500			(20, vec![40, 30].try_into().unwrap())501		);502		assert_eq!(Identity::super_of(20), None);503		assert_eq!(504			Identity::super_of(30),505			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))506		);507		assert_eq!(508			Identity::super_of(40),509			Some((10, Data::Raw(vec![60; 1].try_into().unwrap())))510		);511512		// clear513		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), vec![]));514		assert_eq!(Balances::free_balance(10), 90);515		assert_eq!(Identity::subs_of(10), (0, BoundedVec::default()));516		assert_eq!(Identity::super_of(30), None);517		assert_eq!(Identity::super_of(40), None);518519		subs.push((20, Data::Raw(vec![40; 1].try_into().unwrap())));520		assert_noop!(521			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),522			Error::<Test>::TooManySubAccounts523		);524	});525}526527#[test]528fn clearing_account_should_remove_subaccounts_and_refund() {529	new_test_ext().execute_with(|| {530		assert_ok!(Identity::set_identity(531			RuntimeOrigin::signed(10),532			Box::new(ten())533		));534		assert_ok!(Identity::set_subs(535			RuntimeOrigin::signed(10),536			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]537		));538		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));539		assert_eq!(Balances::free_balance(10), 100);540		assert!(Identity::super_of(20).is_none());541	});542}543544#[test]545fn killing_account_should_remove_subaccounts_and_not_refund() {546	new_test_ext().execute_with(|| {547		assert_ok!(Identity::set_identity(548			RuntimeOrigin::signed(10),549			Box::new(ten())550		));551		assert_ok!(Identity::set_subs(552			RuntimeOrigin::signed(10),553			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]554		));555		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));556		assert_eq!(Balances::free_balance(10), 80);557		assert!(Identity::super_of(20).is_none());558	});559}560561#[test]562fn cancelling_requested_judgement_should_work() {563	new_test_ext().execute_with(|| {564		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));565		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));566		assert_noop!(567			Identity::cancel_request(RuntimeOrigin::signed(10), 0),568			Error::<Test>::NoIdentity569		);570		assert_ok!(Identity::set_identity(571			RuntimeOrigin::signed(10),572			Box::new(ten())573		));574		assert_ok!(Identity::request_judgement(575			RuntimeOrigin::signed(10),576			0,577			10578		));579		assert_ok!(Identity::cancel_request(RuntimeOrigin::signed(10), 0));580		assert_eq!(Balances::free_balance(10), 90);581		assert_noop!(582			Identity::cancel_request(RuntimeOrigin::signed(10), 0),583			Error::<Test>::NotFound584		);585586		assert_ok!(Identity::provide_judgement(587			RuntimeOrigin::signed(3),588			0,589			10,590			Judgement::Reasonable,591			BlakeTwo256::hash_of(&ten())592		));593		assert_noop!(594			Identity::cancel_request(RuntimeOrigin::signed(10), 0),595			Error::<Test>::JudgementGiven596		);597	});598}599600#[test]601fn requesting_judgement_should_work() {602	new_test_ext().execute_with(|| {603		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));604		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));605		assert_ok!(Identity::set_identity(606			RuntimeOrigin::signed(10),607			Box::new(ten())608		));609		assert_noop!(610			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 9),611			Error::<Test>::FeeChanged612		);613		assert_ok!(Identity::request_judgement(614			RuntimeOrigin::signed(10),615			0,616			10617		));618		// 10 for the judgement request, 10 for the identity.619		assert_eq!(Balances::free_balance(10), 80);620621		// Re-requesting won't work as we already paid.622		assert_noop!(623			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),624			Error::<Test>::StickyJudgement625		);626		assert_ok!(Identity::provide_judgement(627			RuntimeOrigin::signed(3),628			0,629			10,630			Judgement::Erroneous,631			BlakeTwo256::hash_of(&ten())632		));633		// Registrar got their payment now.634		assert_eq!(Balances::free_balance(3), 20);635636		// Re-requesting still won't work as it's erroneous.637		assert_noop!(638			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),639			Error::<Test>::StickyJudgement640		);641642		// Requesting from a second registrar still works.643		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 4));644		assert_ok!(Identity::request_judgement(645			RuntimeOrigin::signed(10),646			1,647			10648		));649650		// Re-requesting after the judgement has been reduced works.651		assert_ok!(Identity::provide_judgement(652			RuntimeOrigin::signed(3),653			0,654			10,655			Judgement::OutOfDate,656			BlakeTwo256::hash_of(&ten())657		));658		assert_ok!(Identity::request_judgement(659			RuntimeOrigin::signed(10),660			0,661			10662		));663	});664}665666#[test]667fn provide_judgement_should_return_judgement_payment_failed_error() {668	new_test_ext().execute_with(|| {669		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));670		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));671		assert_ok!(Identity::set_identity(672			RuntimeOrigin::signed(10),673			Box::new(ten())674		));675		assert_ok!(Identity::request_judgement(676			RuntimeOrigin::signed(10),677			0,678			10679		));680		// 10 for the judgement request, 10 for the identity.681		assert_eq!(Balances::free_balance(10), 80);682683		// This forces judgement payment failed error684		Balances::make_free_balance_be(&3, 0);685		assert_noop!(686			Identity::provide_judgement(687				RuntimeOrigin::signed(3),688				0,689				10,690				Judgement::Erroneous,691				BlakeTwo256::hash_of(&ten())692			),693			Error::<Test>::JudgementPaymentFailed694		);695	});696}697698#[test]699fn field_deposit_should_work() {700	new_test_ext().execute_with(|| {701		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));702		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));703		assert_ok!(Identity::set_identity(704			RuntimeOrigin::signed(10),705			Box::new(IdentityInfo {706				additional: vec![707					(708						Data::Raw(b"number".to_vec().try_into().unwrap()),709						Data::Raw(10u32.encode().try_into().unwrap())710					),711					(712						Data::Raw(b"text".to_vec().try_into().unwrap()),713						Data::Raw(b"10".to_vec().try_into().unwrap())714					),715				]716				.try_into()717				.unwrap(),718				..Default::default()719			})720		));721		assert_eq!(Balances::free_balance(10), 70);722	});723}724725#[test]726fn setting_account_id_should_work() {727	new_test_ext().execute_with(|| {728		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));729		// account 4 cannot change the first registrar's identity since it's owned by 3.730		assert_noop!(731			Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3),732			Error::<Test>::InvalidIndex733		);734		// account 3 can, because that's the registrar's current account.735		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(3), 0, 4));736		// account 4 can now, because that's their new ID.737		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3));738	});739}740741#[test]742fn test_has_identity() {743	new_test_ext().execute_with(|| {744		assert_ok!(Identity::set_identity(745			RuntimeOrigin::signed(10),746			Box::new(ten())747		));748		assert!(Identity::has_identity(&10, IdentityField::Display as u64));749		assert!(Identity::has_identity(&10, IdentityField::Legal as u64));750		assert!(Identity::has_identity(751			&10,752			IdentityField::Display as u64 | IdentityField::Legal as u64753		));754		assert!(!Identity::has_identity(755			&10,756			IdentityField::Display as u64 | IdentityField::Legal as u64 | IdentityField::Web as u64757		));758	});759}
after · pallets/identity/src/tests.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// This file is part of Substrate.1920// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// 	http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435// Tests for Identity Pallet3637use super::*;38use crate as pallet_identity;3940use codec::{Decode, Encode};41use frame_support::{42	assert_noop, assert_ok, ord_parameter_types, parameter_types,43	traits::{ConstU32, ConstU64, EitherOfDiverse},44	BoundedVec,45};46use frame_system::{EnsureRoot, EnsureSignedBy};47use sp_core::H256;48use sp_runtime::{49	testing::Header,50	traits::{BadOrigin, BlakeTwo256, IdentityLookup},51};5253type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;54type Block = frame_system::mocking::MockBlock<Test>;5556frame_support::construct_runtime!(57	pub enum Test where58		Block = Block,59		NodeBlock = Block,60		UncheckedExtrinsic = UncheckedExtrinsic,61	{62		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},63		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},64		Identity: pallet_identity::{Pallet, Call, Storage, Event<T>},65	}66);6768parameter_types! {69	pub BlockWeights: frame_system::limits::BlockWeights =70		frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_parts(1024, 0));71}72impl frame_system::Config for Test {73	type BaseCallFilter = frame_support::traits::Everything;74	type BlockWeights = ();75	type BlockLength = ();76	type RuntimeOrigin = RuntimeOrigin;77	type Index = u64;78	type BlockNumber = u64;79	type Hash = H256;80	type RuntimeCall = RuntimeCall;81	type Hashing = BlakeTwo256;82	type AccountId = u64;83	type Lookup = IdentityLookup<Self::AccountId>;84	type Header = Header;85	type RuntimeEvent = RuntimeEvent;86	type BlockHashCount = ConstU64<250>;87	type DbWeight = ();88	type Version = ();89	type PalletInfo = PalletInfo;90	type AccountData = pallet_balances::AccountData<u64>;91	type OnNewAccount = ();92	type OnKilledAccount = ();93	type SystemWeightInfo = ();94	type SS58Prefix = ();95	type OnSetCode = ();96	type MaxConsumers = ConstU32<16>;97}9899impl pallet_balances::Config for Test {100	type Balance = u64;101	type RuntimeEvent = RuntimeEvent;102	type DustRemoval = ();103	type ExistentialDeposit = ConstU64<1>;104	type AccountStore = System;105	type MaxLocks = ();106	type MaxReserves = ();107	type ReserveIdentifier = [u8; 8];108	type WeightInfo = ();109	type HoldIdentifier = ();110	type FreezeIdentifier = ();111	type MaxHolds = ();112	type MaxFreezes = ();113}114115parameter_types! {116	pub const MaxAdditionalFields: u32 = 2;117	pub const MaxRegistrars: u32 = 20;118}119120ord_parameter_types! {121	pub const One: u64 = 1;122	pub const Two: u64 = 2;123}124type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<One, u64>>;125type EnsureTwoOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<Two, u64>>;126impl pallet_identity::Config for Test {127	type RuntimeEvent = RuntimeEvent;128	type Currency = Balances;129	type Slashed = ();130	type BasicDeposit = ConstU64<10>;131	type FieldDeposit = ConstU64<10>;132	type SubAccountDeposit = ConstU64<10>;133	type MaxSubAccounts = ConstU32<2>;134	type MaxAdditionalFields = MaxAdditionalFields;135	type MaxRegistrars = MaxRegistrars;136	type RegistrarOrigin = EnsureOneOrRoot;137	type ForceOrigin = EnsureTwoOrRoot;138	type WeightInfo = ();139}140141pub fn new_test_ext() -> sp_io::TestExternalities {142	let mut t = frame_system::GenesisConfig::default()143		.build_storage::<Test>()144		.unwrap();145	pallet_balances::GenesisConfig::<Test> {146		balances: vec![(1, 10), (2, 10), (3, 10), (10, 100), (20, 100), (30, 100)],147	}148	.assimilate_storage(&mut t)149	.unwrap();150	t.into()151}152153fn ten() -> IdentityInfo<MaxAdditionalFields> {154	IdentityInfo {155		display: Data::Raw(b"ten".to_vec().try_into().unwrap()),156		legal: Data::Raw(b"The Right Ordinal Ten, Esq.".to_vec().try_into().unwrap()),157		..Default::default()158	}159}160161fn twenty() -> IdentityInfo<MaxAdditionalFields> {162	IdentityInfo {163		display: Data::Raw(b"twenty".to_vec().try_into().unwrap()),164		legal: Data::Raw(165			b"The Right Ordinal Twenty, Esq."166				.to_vec()167				.try_into()168				.unwrap(),169		),170		..Default::default()171	}172}173174#[test]175fn editing_subaccounts_should_work() {176	new_test_ext().execute_with(|| {177		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());178179		assert_noop!(180			Identity::add_sub(RuntimeOrigin::signed(10), 20, data(1)),181			Error::<Test>::NoIdentity182		);183184		assert_ok!(Identity::set_identity(185			RuntimeOrigin::signed(10),186			Box::new(ten())187		));188189		// first sub account190		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));191		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));192		assert_eq!(Balances::free_balance(10), 80);193194		// second sub account195		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 2, data(2)));196		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(1))));197		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));198		assert_eq!(Balances::free_balance(10), 70);199200		// third sub account is too many201		assert_noop!(202			Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)),203			Error::<Test>::TooManySubAccounts204		);205206		// rename first sub account207		assert_ok!(Identity::rename_sub(RuntimeOrigin::signed(10), 1, data(11)));208		assert_eq!(SuperOf::<Test>::get(1), Some((10, data(11))));209		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));210		assert_eq!(Balances::free_balance(10), 70);211212		// remove first sub account213		assert_ok!(Identity::remove_sub(RuntimeOrigin::signed(10), 1));214		assert_eq!(SuperOf::<Test>::get(1), None);215		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));216		assert_eq!(Balances::free_balance(10), 80);217218		// add third sub account219		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 3, data(3)));220		assert_eq!(SuperOf::<Test>::get(1), None);221		assert_eq!(SuperOf::<Test>::get(2), Some((10, data(2))));222		assert_eq!(SuperOf::<Test>::get(3), Some((10, data(3))));223		assert_eq!(Balances::free_balance(10), 70);224	});225}226227#[test]228fn resolving_subaccount_ownership_works() {229	new_test_ext().execute_with(|| {230		let data = |x| Data::Raw(vec![x; 1].try_into().unwrap());231232		assert_ok!(Identity::set_identity(233			RuntimeOrigin::signed(10),234			Box::new(ten())235		));236		assert_ok!(Identity::set_identity(237			RuntimeOrigin::signed(20),238			Box::new(twenty())239		));240241		// 10 claims 1 as a subaccount242		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(10), 1, data(1)));243		assert_eq!(Balances::free_balance(1), 10);244		assert_eq!(Balances::free_balance(10), 80);245		assert_eq!(Balances::reserved_balance(10), 20);246		// 20 cannot claim 1 now247		assert_noop!(248			Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)),249			Error::<Test>::AlreadyClaimed250		);251		// 1 wants to be with 20 so it quits from 10252		assert_ok!(Identity::quit_sub(RuntimeOrigin::signed(1)));253		// 1 gets the 10 that 10 paid.254		assert_eq!(Balances::free_balance(1), 20);255		assert_eq!(Balances::free_balance(10), 80);256		assert_eq!(Balances::reserved_balance(10), 10);257		// 20 can claim 1 now258		assert_ok!(Identity::add_sub(RuntimeOrigin::signed(20), 1, data(1)));259	});260}261262#[test]263fn trailing_zeros_decodes_into_default_data() {264	let encoded = Data::Raw(b"Hello".to_vec().try_into().unwrap()).encode();265	assert!(<(Data, Data)>::decode(&mut &encoded[..]).is_err());266	let input = &mut &encoded[..];267	let (a, b) = <(Data, Data)>::decode(&mut AppendZerosInput::new(input)).unwrap();268	assert_eq!(a, Data::Raw(b"Hello".to_vec().try_into().unwrap()));269	assert_eq!(b, Data::None);270}271272#[test]273fn adding_registrar_should_work() {274	new_test_ext().execute_with(|| {275		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));276		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));277		let fields = IdentityFields(IdentityField::Display | IdentityField::Legal);278		assert_ok!(Identity::set_fields(RuntimeOrigin::signed(3), 0, fields));279		assert_eq!(280			Identity::registrars(),281			vec![Some(RegistrarInfo {282				account: 3,283				fee: 10,284				fields285			})]286		);287	});288}289290#[test]291fn amount_of_registrars_is_limited() {292	new_test_ext().execute_with(|| {293		for i in 1..MaxRegistrars::get() + 1 {294			assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), i as u64));295		}296		let last_registrar = MaxRegistrars::get() as u64 + 1;297		assert_noop!(298			Identity::add_registrar(RuntimeOrigin::signed(1), last_registrar),299			Error::<Test>::TooManyRegistrars300		);301	});302}303304#[test]305fn registration_should_work() {306	new_test_ext().execute_with(|| {307		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));308		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));309		let mut three_fields = ten();310		three_fields311			.additional312			.try_push(Default::default())313			.unwrap();314		three_fields315			.additional316			.try_push(Default::default())317			.unwrap();318		assert!(three_fields319			.additional320			.try_push(Default::default())321			.is_err());322		assert_ok!(Identity::set_identity(323			RuntimeOrigin::signed(10),324			Box::new(ten())325		));326		assert_eq!(Identity::identity(10).unwrap().info, ten());327		assert_eq!(Balances::free_balance(10), 90);328		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));329		assert_eq!(Balances::free_balance(10), 100);330		assert_noop!(331			Identity::clear_identity(RuntimeOrigin::signed(10)),332			Error::<Test>::NotNamed333		);334	});335}336337#[test]338fn uninvited_judgement_should_work() {339	new_test_ext().execute_with(|| {340		assert_noop!(341			Identity::provide_judgement(342				RuntimeOrigin::signed(3),343				0,344				10,345				Judgement::Reasonable,346				H256::random()347			),348			Error::<Test>::InvalidIndex349		);350351		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));352		assert_noop!(353			Identity::provide_judgement(354				RuntimeOrigin::signed(3),355				0,356				10,357				Judgement::Reasonable,358				H256::random()359			),360			Error::<Test>::InvalidTarget361		);362363		assert_ok!(Identity::set_identity(364			RuntimeOrigin::signed(10),365			Box::new(ten())366		));367		assert_noop!(368			Identity::provide_judgement(369				RuntimeOrigin::signed(3),370				0,371				10,372				Judgement::Reasonable,373				H256::random()374			),375			Error::<Test>::JudgementForDifferentIdentity376		);377378		let identity_hash = BlakeTwo256::hash_of(&ten());379380		assert_noop!(381			Identity::provide_judgement(382				RuntimeOrigin::signed(10),383				0,384				10,385				Judgement::Reasonable,386				identity_hash387			),388			Error::<Test>::InvalidIndex389		);390		assert_noop!(391			Identity::provide_judgement(392				RuntimeOrigin::signed(3),393				0,394				10,395				Judgement::FeePaid(1),396				identity_hash397			),398			Error::<Test>::InvalidJudgement399		);400401		assert_ok!(Identity::provide_judgement(402			RuntimeOrigin::signed(3),403			0,404			10,405			Judgement::Reasonable,406			identity_hash407		));408		assert_eq!(409			Identity::identity(10).unwrap().judgements,410			vec![(0, Judgement::Reasonable)]411		);412	});413}414415#[test]416fn clearing_judgement_should_work() {417	new_test_ext().execute_with(|| {418		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));419		assert_ok!(Identity::set_identity(420			RuntimeOrigin::signed(10),421			Box::new(ten())422		));423		assert_ok!(Identity::provide_judgement(424			RuntimeOrigin::signed(3),425			0,426			10,427			Judgement::Reasonable,428			BlakeTwo256::hash_of(&ten())429		));430		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));431		assert_eq!(Identity::identity(10), None);432	});433}434435#[test]436fn killing_slashing_should_work() {437	new_test_ext().execute_with(|| {438		assert_ok!(Identity::set_identity(439			RuntimeOrigin::signed(10),440			Box::new(ten())441		));442		assert_noop!(443			Identity::kill_identity(RuntimeOrigin::signed(1), 10),444			BadOrigin445		);446		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));447		assert_eq!(Identity::identity(10), None);448		assert_eq!(Balances::free_balance(10), 90);449		assert_noop!(450			Identity::kill_identity(RuntimeOrigin::signed(2), 10),451			Error::<Test>::NotNamed452		);453	});454}455456#[test]457fn setting_subaccounts_should_work() {458	new_test_ext().execute_with(|| {459		let mut subs = vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))];460		assert_noop!(461			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),462			Error::<Test>::NotFound463		);464465		assert_ok!(Identity::set_identity(466			RuntimeOrigin::signed(10),467			Box::new(ten())468		));469		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));470		assert_eq!(Balances::free_balance(10), 80);471		assert_eq!(Identity::subs_of(10), (10, vec![20].try_into().unwrap()));472		assert_eq!(473			Identity::super_of(20),474			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))475		);476477		// push another item and re-set it.478		subs.push((30, Data::Raw(vec![50; 1].try_into().unwrap())));479		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));480		assert_eq!(Balances::free_balance(10), 70);481		assert_eq!(482			Identity::subs_of(10),483			(20, vec![20, 30].try_into().unwrap())484		);485		assert_eq!(486			Identity::super_of(20),487			Some((10, Data::Raw(vec![40; 1].try_into().unwrap())))488		);489		assert_eq!(490			Identity::super_of(30),491			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))492		);493494		// switch out one of the items and re-set.495		subs[0] = (40, Data::Raw(vec![60; 1].try_into().unwrap()));496		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()));497		assert_eq!(Balances::free_balance(10), 70); // no change in the balance498		assert_eq!(499			Identity::subs_of(10),500			(20, vec![40, 30].try_into().unwrap())501		);502		assert_eq!(Identity::super_of(20), None);503		assert_eq!(504			Identity::super_of(30),505			Some((10, Data::Raw(vec![50; 1].try_into().unwrap())))506		);507		assert_eq!(508			Identity::super_of(40),509			Some((10, Data::Raw(vec![60; 1].try_into().unwrap())))510		);511512		// clear513		assert_ok!(Identity::set_subs(RuntimeOrigin::signed(10), vec![]));514		assert_eq!(Balances::free_balance(10), 90);515		assert_eq!(Identity::subs_of(10), (0, BoundedVec::default()));516		assert_eq!(Identity::super_of(30), None);517		assert_eq!(Identity::super_of(40), None);518519		subs.push((20, Data::Raw(vec![40; 1].try_into().unwrap())));520		assert_noop!(521			Identity::set_subs(RuntimeOrigin::signed(10), subs.clone()),522			Error::<Test>::TooManySubAccounts523		);524	});525}526527#[test]528fn clearing_account_should_remove_subaccounts_and_refund() {529	new_test_ext().execute_with(|| {530		assert_ok!(Identity::set_identity(531			RuntimeOrigin::signed(10),532			Box::new(ten())533		));534		assert_ok!(Identity::set_subs(535			RuntimeOrigin::signed(10),536			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]537		));538		assert_ok!(Identity::clear_identity(RuntimeOrigin::signed(10)));539		assert_eq!(Balances::free_balance(10), 100);540		assert!(Identity::super_of(20).is_none());541	});542}543544#[test]545fn killing_account_should_remove_subaccounts_and_not_refund() {546	new_test_ext().execute_with(|| {547		assert_ok!(Identity::set_identity(548			RuntimeOrigin::signed(10),549			Box::new(ten())550		));551		assert_ok!(Identity::set_subs(552			RuntimeOrigin::signed(10),553			vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]554		));555		assert_ok!(Identity::kill_identity(RuntimeOrigin::signed(2), 10));556		assert_eq!(Balances::free_balance(10), 80);557		assert!(Identity::super_of(20).is_none());558	});559}560561#[test]562fn cancelling_requested_judgement_should_work() {563	new_test_ext().execute_with(|| {564		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));565		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));566		assert_noop!(567			Identity::cancel_request(RuntimeOrigin::signed(10), 0),568			Error::<Test>::NoIdentity569		);570		assert_ok!(Identity::set_identity(571			RuntimeOrigin::signed(10),572			Box::new(ten())573		));574		assert_ok!(Identity::request_judgement(575			RuntimeOrigin::signed(10),576			0,577			10578		));579		assert_ok!(Identity::cancel_request(RuntimeOrigin::signed(10), 0));580		assert_eq!(Balances::free_balance(10), 90);581		assert_noop!(582			Identity::cancel_request(RuntimeOrigin::signed(10), 0),583			Error::<Test>::NotFound584		);585586		assert_ok!(Identity::provide_judgement(587			RuntimeOrigin::signed(3),588			0,589			10,590			Judgement::Reasonable,591			BlakeTwo256::hash_of(&ten())592		));593		assert_noop!(594			Identity::cancel_request(RuntimeOrigin::signed(10), 0),595			Error::<Test>::JudgementGiven596		);597	});598}599600#[test]601fn requesting_judgement_should_work() {602	new_test_ext().execute_with(|| {603		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));604		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));605		assert_ok!(Identity::set_identity(606			RuntimeOrigin::signed(10),607			Box::new(ten())608		));609		assert_noop!(610			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 9),611			Error::<Test>::FeeChanged612		);613		assert_ok!(Identity::request_judgement(614			RuntimeOrigin::signed(10),615			0,616			10617		));618		// 10 for the judgement request, 10 for the identity.619		assert_eq!(Balances::free_balance(10), 80);620621		// Re-requesting won't work as we already paid.622		assert_noop!(623			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),624			Error::<Test>::StickyJudgement625		);626		assert_ok!(Identity::provide_judgement(627			RuntimeOrigin::signed(3),628			0,629			10,630			Judgement::Erroneous,631			BlakeTwo256::hash_of(&ten())632		));633		// Registrar got their payment now.634		assert_eq!(Balances::free_balance(3), 20);635636		// Re-requesting still won't work as it's erroneous.637		assert_noop!(638			Identity::request_judgement(RuntimeOrigin::signed(10), 0, 10),639			Error::<Test>::StickyJudgement640		);641642		// Requesting from a second registrar still works.643		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 4));644		assert_ok!(Identity::request_judgement(645			RuntimeOrigin::signed(10),646			1,647			10648		));649650		// Re-requesting after the judgement has been reduced works.651		assert_ok!(Identity::provide_judgement(652			RuntimeOrigin::signed(3),653			0,654			10,655			Judgement::OutOfDate,656			BlakeTwo256::hash_of(&ten())657		));658		assert_ok!(Identity::request_judgement(659			RuntimeOrigin::signed(10),660			0,661			10662		));663	});664}665666#[test]667fn provide_judgement_should_return_judgement_payment_failed_error() {668	new_test_ext().execute_with(|| {669		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));670		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));671		assert_ok!(Identity::set_identity(672			RuntimeOrigin::signed(10),673			Box::new(ten())674		));675		assert_ok!(Identity::request_judgement(676			RuntimeOrigin::signed(10),677			0,678			10679		));680		// 10 for the judgement request, 10 for the identity.681		assert_eq!(Balances::free_balance(10), 80);682683		// This forces judgement payment failed error684		Balances::make_free_balance_be(&3, 0);685		assert_noop!(686			Identity::provide_judgement(687				RuntimeOrigin::signed(3),688				0,689				10,690				Judgement::Erroneous,691				BlakeTwo256::hash_of(&ten())692			),693			Error::<Test>::JudgementPaymentFailed694		);695	});696}697698#[test]699fn field_deposit_should_work() {700	new_test_ext().execute_with(|| {701		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));702		assert_ok!(Identity::set_fee(RuntimeOrigin::signed(3), 0, 10));703		assert_ok!(Identity::set_identity(704			RuntimeOrigin::signed(10),705			Box::new(IdentityInfo {706				additional: vec![707					(708						Data::Raw(b"number".to_vec().try_into().unwrap()),709						Data::Raw(10u32.encode().try_into().unwrap())710					),711					(712						Data::Raw(b"text".to_vec().try_into().unwrap()),713						Data::Raw(b"10".to_vec().try_into().unwrap())714					),715				]716				.try_into()717				.unwrap(),718				..Default::default()719			})720		));721		assert_eq!(Balances::free_balance(10), 70);722	});723}724725#[test]726fn setting_account_id_should_work() {727	new_test_ext().execute_with(|| {728		assert_ok!(Identity::add_registrar(RuntimeOrigin::signed(1), 3));729		// account 4 cannot change the first registrar's identity since it's owned by 3.730		assert_noop!(731			Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3),732			Error::<Test>::InvalidIndex733		);734		// account 3 can, because that's the registrar's current account.735		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(3), 0, 4));736		// account 4 can now, because that's their new ID.737		assert_ok!(Identity::set_account_id(RuntimeOrigin::signed(4), 0, 3));738	});739}740741#[test]742fn test_has_identity() {743	new_test_ext().execute_with(|| {744		assert_ok!(Identity::set_identity(745			RuntimeOrigin::signed(10),746			Box::new(ten())747		));748		assert!(Identity::has_identity(&10, IdentityField::Display as u64));749		assert!(Identity::has_identity(&10, IdentityField::Legal as u64));750		assert!(Identity::has_identity(751			&10,752			IdentityField::Display as u64 | IdentityField::Legal as u64753		));754		assert!(!Identity::has_identity(755			&10,756			IdentityField::Display as u64 | IdentityField::Legal as u64 | IdentityField::Web as u64757		));758	});759}
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;