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

difftreelog

test fix unit

Yaroslav Bolyukin2023-06-01parent: #54a000e.patch.diff
in: master

4 files changed

modifiedCargo.lockdiffbeforeafterboth
12941 "pallet-timestamp",12941 "pallet-timestamp",
12942 "pallet-transaction-payment",12942 "pallet-transaction-payment",
12943 "pallet-unique",12943 "pallet-unique",
12944 "pallet-xcm",
12944 "parity-scale-codec",12945 "parity-scale-codec",
12945 "scale-info",12946 "scale-info",
12946 "sp-core",12947 "sp-core",
modifiedruntime/tests/Cargo.tomldiffbeforeafterboth
--- a/runtime/tests/Cargo.toml
+++ b/runtime/tests/Cargo.toml
@@ -18,6 +18,7 @@
 
 frame-support = { workspace = true }
 frame-system = { workspace = true }
+pallet-xcm = { workspace = true }
 
 pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
 pallet-timestamp = { workspace = true }
@@ -36,7 +37,7 @@
 
 pallet-evm-coder-substrate = { workspace = true }
 
-codec = { workspace = true }
+codec = { workspace = true, package = "parity-scale-codec" }
 scale-info = { workspace = true }
 
 evm-coder = { workspace = true }
modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -34,7 +34,7 @@
 	BackwardsAddressMapping,
 };
 use pallet_ethereum::PostLogContent;
-use parity_scale_codec::{Encode, Decode, MaxEncodedLen};
+use codec::{Encode, Decode, MaxEncodedLen};
 use scale_info::TypeInfo;
 
 use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};
@@ -63,6 +63,7 @@
 		UncheckedExtrinsic = UncheckedExtrinsic,
 	{
 		System: frame_system,
+		Timestamp: pallet_timestamp,
 		Unique: pallet_unique::{Pallet, Call, Storage},
 		Balances: pallet_balances::{Pallet, Call, Storage, Event<T>},
 		Common: pallet_common::{Pallet, Storage, Event<T>},
@@ -123,6 +124,10 @@
 	type MaxLocks = MaxLocks;
 	type MaxReserves = ();
 	type ReserveIdentifier = [u8; 8];
+	type MaxFreezes = MaxLocks;
+	type FreezeIdentifier = [u8; 8];
+	type MaxHolds = MaxLocks;
+	type HoldIdentifier = [u8; 8];
 }
 
 parameter_types! {
@@ -212,9 +217,11 @@
 	type RuntimeEvent = RuntimeEvent;
 	type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;
 	type PostLogContent = PostBlockAndTxnHashes;
+	type ExtraDataLength = ConstU32<32>;
 }
 
 impl pallet_evm::Config for Test {
+	type WeightInfo = pallet_evm::weights::SubstrateWeight<Self>;
 	type CrossAccountId = TestCrossAccountId;
 	type AddressMapping = TestEvmAddressMapping;
 	type BackwardsAddressMapping = TestEvmBackwardsAddressMapping;
@@ -236,6 +243,7 @@
 	type FindAuthor = ();
 	type BlockHashMapping = SubstrateBlockHashMapping<Self>;
 	type TransactionValidityHack = ();
+	type Timestamp = Timestamp;
 }
 impl pallet_evm_coder_substrate::Config for Test {}
 
@@ -272,7 +280,8 @@
 	pub Symbol: String = "TST".to_string();
 }
 impl pallet_balances_adapter::Config for Test {
-	type Currency = Balances;
+	type Inspect = Balances;
+	type Mutate = Balances;
 	type CurrencyBalance = <Balances as Currency<Self::AccountId>>::Balance;
 	type Decimals = Decimals;
 	type Name = Name;
modifiedruntime/tests/src/tests.rsdiffbeforeafterboth
--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -31,11 +31,10 @@
 
 fn add_balance(user: u64, value: u64) {
 	const DONOR_USER: u64 = 999;
-	assert_ok!(<pallet_balances::Pallet<Test>>::set_balance(
+	assert_ok!(<pallet_balances::Pallet<Test>>::force_set_balance(
 		RuntimeOrigin::root(),
 		DONOR_USER,
 		value,
-		0
 	));
 	assert_ok!(<pallet_balances::Pallet<Test>>::force_transfer(
 		RuntimeOrigin::root(),
@@ -199,7 +198,7 @@
 fn check_not_sufficient_founds() {
 	new_test_ext().execute_with(|| {
 		let acc: u64 = 1;
-		<pallet_balances::Pallet<Test>>::set_balance(RuntimeOrigin::root(), acc, 0, 0).unwrap();
+		<pallet_balances::Pallet<Test>>::force_set_balance(RuntimeOrigin::root(), acc, 0).unwrap();
 
 		let name: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
 		let description: Vec<u16> = "TestDescription1\0".encode_utf16().collect::<Vec<u16>>();