From ca8bb41c317861cc7fe28d6c78e37d418f382f7e Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Thu, 01 Jun 2023 12:08:16 +0000 Subject: [PATCH] test: fix unit --- --- a/Cargo.lock +++ b/Cargo.lock @@ -12941,6 +12941,7 @@ "pallet-timestamp", "pallet-transaction-payment", "pallet-unique", + "pallet-xcm", "parity-scale-codec", "scale-info", "sp-core", --- 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 } --- 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}, Common: pallet_common::{Pallet, Storage, Event}, @@ -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; type PostLogContent = PostBlockAndTxnHashes; + type ExtraDataLength = ConstU32<32>; } impl pallet_evm::Config for Test { + type WeightInfo = pallet_evm::weights::SubstrateWeight; type CrossAccountId = TestCrossAccountId; type AddressMapping = TestEvmAddressMapping; type BackwardsAddressMapping = TestEvmBackwardsAddressMapping; @@ -236,6 +243,7 @@ type FindAuthor = (); type BlockHashMapping = SubstrateBlockHashMapping; 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 = >::Balance; type Decimals = Decimals; type Name = Name; --- 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!(>::set_balance( + assert_ok!(>::force_set_balance( RuntimeOrigin::root(), DONOR_USER, value, - 0 )); assert_ok!(>::force_transfer( RuntimeOrigin::root(), @@ -199,7 +198,7 @@ fn check_not_sufficient_founds() { new_test_ext().execute_with(|| { let acc: u64 = 1; - >::set_balance(RuntimeOrigin::root(), acc, 0, 0).unwrap(); + >::force_set_balance(RuntimeOrigin::root(), acc, 0).unwrap(); let name: Vec = "Test1\0".encode_utf16().collect::>(); let description: Vec = "TestDescription1\0".encode_utf16().collect::>(); -- gitstuff