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

difftreelog

test fix build

Yaroslav Bolyukin2023-10-09parent: #22a5178.patch.diff
in: master

9 files changed

modifiedpallets/collator-selection/src/mock.rsdiffbeforeafterboth
3232
33use frame_support::{33use frame_support::{
34 ord_parameter_types, parameter_types,34 ord_parameter_types, parameter_types,
35 traits::{FindAuthor, GenesisBuild, ValidatorRegistration},35 traits::{ConstU32, FindAuthor, ValidatorRegistration},
36 PalletId,36 PalletId,
37};37};
38use frame_system as system;38use frame_system as system;
39use frame_system::EnsureSignedBy;39use frame_system::EnsureSignedBy;
40use sp_core::H256;40use sp_core::{ConstBool, H256};
41use sp_runtime::{41use sp_runtime::{
42 testing::{Header, UintAuthorityId},42 testing::UintAuthorityId,
43 traits::{BlakeTwo256, IdentityLookup, OpaqueKeys},43 traits::{BlakeTwo256, IdentityLookup, OpaqueKeys},
44 Perbill, RuntimeAppPublic,44 BuildStorage, Perbill, RuntimeAppPublic,
45};45};
4646
47use super::*;47use super::*;
48use crate as collator_selection;48use crate as collator_selection;
4949
50type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
51type Block = frame_system::mocking::MockBlock<Test>;50type Block = frame_system::mocking::MockBlockU32<Test>;
5251
53// Configure a mock runtime to test the pallet.52// Configure a mock runtime to test the pallet.
54frame_support::construct_runtime!(53frame_support::construct_runtime!(
64);63);
6564
66parameter_types! {65parameter_types! {
67 pub const BlockHashCount: u64 = 250;66 pub const BlockHashCount: u32 = 250;
68 pub const SS58Prefix: u8 = 42;67 pub const SS58Prefix: u8 = 42;
69}68}
7069
71impl system::Config for Test {70impl system::Config for Test {
72 type BaseCallFilter = frame_support::traits::Everything;71 type BaseCallFilter = frame_support::traits::Everything;
72 type Block = Block;
73 type BlockWeights = ();73 type BlockWeights = ();
74 type BlockLength = ();74 type BlockLength = ();
75 type DbWeight = ();75 type DbWeight = ();
90 type SystemWeightInfo = ();90 type SystemWeightInfo = ();
91 type SS58Prefix = SS58Prefix;91 type SS58Prefix = SS58Prefix;
92 type OnSetCode = ();92 type OnSetCode = ();
93 type MaxConsumers = frame_support::traits::ConstU32<16>;93 type MaxConsumers = ConstU32<16>;
94}94}
9595
96parameter_types! {96parameter_types! {
113 type FreezeIdentifier = [u8; 16];113 type FreezeIdentifier = [u8; 16];
114 type MaxHolds = MaxHolds;114 type MaxHolds = MaxHolds;
115 type MaxFreezes = MaxFreezes;115 type MaxFreezes = MaxFreezes;
116 type RuntimeHoldReason = RuntimeHoldReason;
116}117}
117118
118pub struct Author4;119pub struct Author4;
145 type AuthorityId = sp_consensus_aura::sr25519::AuthorityId;146 type AuthorityId = sp_consensus_aura::sr25519::AuthorityId;
146 type MaxAuthorities = MaxAuthorities;147 type MaxAuthorities = MaxAuthorities;
147 type DisabledValidators = ();148 type DisabledValidators = ();
149 type AllowMultipleBlocksPerSlot = ConstBool<true>;
148}150}
149151
150sp_runtime::impl_opaque_keys! {152sp_runtime::impl_opaque_keys! {
162164
163parameter_types! {165parameter_types! {
164 pub static SessionHandlerCollators: Vec<u64> = Vec::new();166 pub static SessionHandlerCollators: Vec<u64> = Vec::new();
165 pub static SessionChangeBlock: u64 = 0;167 pub static SessionChangeBlock: u32 = 0;
166}168}
167169
168pub struct TestSessionHandler;170pub struct TestSessionHandler;
169impl pallet_session::SessionHandler<u64> for TestSessionHandler {171impl pallet_session::SessionHandler<u64> for TestSessionHandler {
170 const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = &[UintAuthorityId::ID];172 const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = &[UintAuthorityId::ID];
171 fn on_genesis_session<Ks: OpaqueKeys>(keys: &[(u64, Ks)]) {173 fn on_genesis_session<Ks: OpaqueKeys>(keys: &[(u64, Ks)]) {
172 SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::<Vec<_>>())174 SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::<Vec<_>>())
173 }175 }
174 fn on_new_session<Ks: OpaqueKeys>(_: bool, keys: &[(u64, Ks)], _: &[(u64, Ks)]) {176 fn on_new_session<Ks: OpaqueKeys>(_: bool, keys: &[(u64, Ks)], _: &[(u64, Ks)]) {
175 SessionChangeBlock::set(System::block_number());177 SessionChangeBlock::set(System::block_number());
176 dbg!(keys.len());178 dbg!(keys.len());
177 SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::<Vec<_>>())179 SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::<Vec<_>>())
178 }180 }
179 fn on_before_session_ending() {}181 fn on_before_session_ending() {}
180 fn on_disabled(_: u32) {}182 fn on_disabled(_: u32) {}
181}183}
182184
183parameter_types! {185parameter_types! {
184 pub const Offset: u64 = 0;186 pub const Offset: u32 = 0;
185 pub const Period: u64 = 10;187 pub const Period: u32 = 10;
186}188}
187189
188impl pallet_session::Config for Test {190impl pallet_session::Config for Test {
201parameter_types! {203parameter_types! {
202 pub const MaxCollators: u32 = 5;204 pub const MaxCollators: u32 = 5;
203 pub const LicenseBond: u64 = 10;205 pub const LicenseBond: u64 = 10;
204 pub const KickThreshold: u64 = 10;206 pub const KickThreshold: u32 = 10;
205 // the following values do not matter and are meaningless, etc.207 // the following values do not matter and are meaningless, etc.
206 pub const DefaultWeightToFeeCoefficient: u64 = 100_000;208 pub const DefaultWeightToFeeCoefficient: u64 = 100_000;
207 pub const DefaultMinGasPrice: u64 = 100_000;209 pub const DefaultMinGasPrice: u64 = 100_000;
230232
231impl Config for Test {233impl Config for Test {
232 type RuntimeEvent = RuntimeEvent;234 type RuntimeEvent = RuntimeEvent;
235 type RuntimeHoldReason = RuntimeHoldReason;
233 type UpdateOrigin = EnsureSignedBy<RootAccount, u64>;236 type UpdateOrigin = EnsureSignedBy<RootAccount, u64>;
234 type PotId = PotId;237 type PotId = PotId;
235 type MaxCollators = MaxCollators;238 type MaxCollators = MaxCollators;
238 type ValidatorId = <Self as frame_system::Config>::AccountId;241 type ValidatorId = <Self as frame_system::Config>::AccountId;
239 type ValidatorIdOf = IdentityCollator;242 type ValidatorIdOf = IdentityCollator;
240 type ValidatorRegistration = IsRegistered;243 type ValidatorRegistration = IsRegistered;
241 type LicenceBondIdentifier = LicenceBondIdentifier;
242 type Currency = Balances;244 type Currency = Balances;
243 type DesiredCollators = MaxCollators;245 type DesiredCollators = MaxCollators;
244 type LicenseBond = LicenseBond;246 type LicenseBond = LicenseBond;
248250
249pub fn new_test_ext() -> sp_io::TestExternalities {251pub fn new_test_ext() -> sp_io::TestExternalities {
250 sp_tracing::try_init_simple();252 sp_tracing::try_init_simple();
251 let mut t = frame_system::GenesisConfig::default()253 let mut t = <frame_system::GenesisConfig<Test>>::default()
252 .build_storage::<Test>()254 .build_storage()
253 .unwrap();255 .unwrap();
254 let invulnerables = vec![1, 2];256 let invulnerables = vec![1, 2];
255257
284 t.into()286 t.into()
285}287}
286288
287pub fn initialize_to_block(n: u64) {289pub fn initialize_to_block(n: u32) {
288 for i in System::block_number() + 1..=n {290 for i in System::block_number() + 1..=n {
289 System::set_block_number(i);291 System::set_block_number(i);
290 <AllPalletsWithSystem as frame_support::traits::OnInitialize<u64>>::on_initialize(i);292 <AllPalletsWithSystem as frame_support::traits::OnInitialize<u32>>::on_initialize(i);
291 }293 }
292}294}
293295
modifiedpallets/collator-selection/src/tests.rsdiffbeforeafterboth
3232
33use frame_support::{33use frame_support::{
34 assert_noop, assert_ok,34 assert_noop, assert_ok,
35 traits::{fungible, GenesisBuild, OnInitialize},35 traits::{fungible, OnInitialize},
36};36};
37use scale_info::prelude::*;37use scale_info::prelude::*;
38use sp_runtime::{traits::BadOrigin, TokenError};38use sp_runtime::{traits::BadOrigin, BuildStorage, TokenError};
3939
40use crate::{self as collator_selection, mock::*, Config, Error};40use crate::{self as collator_selection, mock::*, Config, Error};
4141
464#[should_panic = "duplicate invulnerables in genesis."]464#[should_panic = "duplicate invulnerables in genesis."]
465fn cannot_set_genesis_value_twice() {465fn cannot_set_genesis_value_twice() {
466 sp_tracing::try_init_simple();466 sp_tracing::try_init_simple();
467 let mut t = frame_system::GenesisConfig::default()467 let mut t = <frame_system::GenesisConfig<Test>>::default()
468 .build_storage::<Test>()468 .build_storage()
469 .unwrap();469 .unwrap();
470 let invulnerables = vec![1, 1];470 let invulnerables = vec![1, 1];
471471
modifiedpallets/identity/src/tests.rsdiffbeforeafterboth
43use parity_scale_codec::{Decode, Encode};43use parity_scale_codec::{Decode, Encode};
44use sp_core::H256;44use sp_core::H256;
45use sp_runtime::{45use sp_runtime::{
46 testing::Header,
47 traits::{BadOrigin, BlakeTwo256, IdentityLookup},46 traits::{BadOrigin, BlakeTwo256, IdentityLookup},
48 BuildStorage,47 BuildStorage,
49};48};
5049
51use super::*;50use super::*;
52use crate as pallet_identity;51use crate as pallet_identity;
5352
54type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
55type Block = frame_system::mocking::MockBlock<Test>;53type Block = frame_system::mocking::MockBlockU32<Test>;
5654
57frame_support::construct_runtime!(55frame_support::construct_runtime!(
58 pub enum Test {56 pub enum Test {
79 type AccountId = u64;77 type AccountId = u64;
80 type Lookup = IdentityLookup<Self::AccountId>;78 type Lookup = IdentityLookup<Self::AccountId>;
81 type RuntimeEvent = RuntimeEvent;79 type RuntimeEvent = RuntimeEvent;
82 type BlockHashCount = ConstU64<250>;80 type BlockHashCount = ConstU32<250>;
83 type DbWeight = ();81 type DbWeight = ();
84 type Version = ();82 type Version = ();
85 type PalletInfo = PalletInfo;83 type PalletInfo = PalletInfo;
modifiedpallets/inflation/src/tests.rsdiffbeforeafterboth
3434
35use crate as pallet_inflation;35use crate as pallet_inflation;
3636
37type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
38type Block = frame_system::mocking::MockBlock<Test>;37type Block = frame_system::mocking::MockBlockU32<Test>;
3938
39// 6-second blocks
40// const YEAR: u32 = 2_629_800; // 12-second blocks
41// Expected 100-block inflation for year 1 is 100 * 100_000_000 / YEAR = FIRST_YEAR_BLOCK_INFLATION
40const YEAR: u64 = 5_259_600; // 6-second blocks42const YEAR: u32 = 5_259_600;
41 // const YEAR: u64 = 2_629_800; // 12-second blocks
42 // Expected 100-block inflation for year 1 is 100 * 100_000_000 / YEAR = FIRST_YEAR_BLOCK_INFLATION
43const FIRST_YEAR_BLOCK_INFLATION: u64 = 1901;43const FIRST_YEAR_BLOCK_INFLATION: u64 = 1901;
4444
45parameter_types! {45parameter_types! {
60 type FreezeIdentifier = ();60 type FreezeIdentifier = ();
61 type MaxHolds = ();61 type MaxHolds = ();
62 type MaxFreezes = ();62 type MaxFreezes = ();
63 type RuntimeHoldReason = RuntimeHoldReason;
63}64}
6465
65frame_support::construct_runtime!(66frame_support::construct_runtime!(
71);72);
7273
73parameter_types! {74parameter_types! {
74 pub const BlockHashCount: u64 = 250;75 pub const BlockHashCount: u32 = 250;
75 pub BlockWeights: frame_system::limits::BlockWeights =76 pub BlockWeights: frame_system::limits::BlockWeights =
76 frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));77 frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0));
77 pub const SS58Prefix: u8 = 42;78 pub const SS58Prefix: u8 = 42;
78}79}
7980
80impl frame_system::Config for Test {81impl frame_system::Config for Test {
81 type BaseCallFilter = Everything;82 type BaseCallFilter = Everything;
83 type Block = Block;
82 type BlockWeights = ();84 type BlockWeights = ();
83 type BlockLength = ();85 type BlockLength = ();
84 type DbWeight = ();86 type DbWeight = ();
187fn inflation_second_deposit() {189fn inflation_second_deposit() {
188 new_test_ext().execute_with(|| {190 new_test_ext().execute_with(|| {
189 // Total issuance = 1_000_000_000191 // Total issuance = 1_000_000_000
190 let initial_issuance: u64 = 1_000_000_000;192 let initial_issuance = 1_000_000_000;
191 let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);193 let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);
192 assert_eq!(Balances::free_balance(1234), initial_issuance);194 assert_eq!(Balances::free_balance(1234), initial_issuance);
193 MockBlockNumberProvider::set(1);195 MockBlockNumberProvider::set(1);
196 assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));198 assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));
197199
198 // Next inflation deposit happens when block is greater then or equal to NextInflationBlock200 // Next inflation deposit happens when block is greater then or equal to NextInflationBlock
199 let mut block: u64 = 2;201 let mut block = 2;
200 let balance_before: u64 = Balances::free_balance(1234);202 let balance_before = Balances::free_balance(1234);
201 while block < <pallet_inflation::NextInflationBlock<Test>>::get() {203 while block < <pallet_inflation::NextInflationBlock<Test>>::get() {
202 MockBlockNumberProvider::set(block as u64);204 MockBlockNumberProvider::set(block);
203 Inflation::on_initialize(0);205 Inflation::on_initialize(0);
204 block += 1;206 block += 1;
205 }207 }
206 let balance_just_before: u64 = Balances::free_balance(1234);208 let balance_just_before = Balances::free_balance(1234);
207 assert_eq!(balance_before, balance_just_before);209 assert_eq!(balance_before, balance_just_before);
208210
209 // The block with inflation211 // The block with inflation
210 MockBlockNumberProvider::set(block as u64);212 MockBlockNumberProvider::set(block);
211 Inflation::on_initialize(0);213 Inflation::on_initialize(0);
212 let balance_after: u64 = Balances::free_balance(1234);214 let balance_after = Balances::free_balance(1234);
213 assert_eq!(balance_after - balance_just_before, block_inflation!());215 assert_eq!(balance_after - balance_just_before, block_inflation!());
214 });216 });
215}217}
234 Inflation::on_initialize(0);236 Inflation::on_initialize(0);
235 }237 }
236 assert_eq!(238 assert_eq!(
237 initial_issuance + (FIRST_YEAR_BLOCK_INFLATION * (YEAR / 100)),239 initial_issuance + (FIRST_YEAR_BLOCK_INFLATION * ((YEAR as u64) / 100)),
238 <Balances as Inspect<_>>::total_issuance()240 <Balances as Inspect<_>>::total_issuance()
239 );241 );
240242
243 let block_inflation_year_2 = block_inflation!();245 let block_inflation_year_2 = block_inflation!();
244 // Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR == 1951246 // Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR == 1951
245 let expecter_year_2_inflation: u64 = (initial_issuance247 let expecter_year_2_inflation: u64 = (initial_issuance
246 + FIRST_YEAR_BLOCK_INFLATION * YEAR / 100)248 + FIRST_YEAR_BLOCK_INFLATION * (YEAR as u64) / 100)
247 * 933 * 100 / (10000 * YEAR);249 * 933 * 100 / (10000 * (YEAR as u64));
248 assert_eq!(block_inflation_year_2 / 10, expecter_year_2_inflation / 10); // divide by 10 for approx. equality250 assert_eq!(block_inflation_year_2 / 10, expecter_year_2_inflation / 10); // divide by 10 for approx. equality
249 });251 });
250}252}
253fn inflation_start_large_kusama_block() {255fn inflation_start_large_kusama_block() {
254 new_test_ext().execute_with(|| {256 new_test_ext().execute_with(|| {
255 // Total issuance = 1_000_000_000257 // Total issuance = 1_000_000_000
256 let initial_issuance: u64 = 1_000_000_000;258 let initial_issuance = 1_000_000_000;
257 let start_block: u64 = 10457457;259 let start_block = 10457457;
258 let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);260 let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);
259 assert_eq!(Balances::free_balance(1234), initial_issuance);261 assert_eq!(Balances::free_balance(1234), initial_issuance);
260 MockBlockNumberProvider::set(start_block);262 MockBlockNumberProvider::set(start_block);
273 Inflation::on_initialize(0);275 Inflation::on_initialize(0);
274 }276 }
275 assert_eq!(277 assert_eq!(
276 initial_issuance + (FIRST_YEAR_BLOCK_INFLATION * (YEAR / 100)),278 initial_issuance + (FIRST_YEAR_BLOCK_INFLATION * ((YEAR as u64) / 100)),
277 <Balances as Inspect<_>>::total_issuance()279 <Balances as Inspect<_>>::total_issuance()
278 );280 );
279281
282 let block_inflation_year_2 = block_inflation!();284 let block_inflation_year_2 = block_inflation!();
283 // Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR == 1951285 // Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR == 1951
284 let expecter_year_2_inflation: u64 = (initial_issuance286 let expecter_year_2_inflation: u64 = (initial_issuance
285 + FIRST_YEAR_BLOCK_INFLATION * YEAR / 100)287 + FIRST_YEAR_BLOCK_INFLATION * (YEAR as u64) / 100)
286 * 933 * 100 / (10000 * YEAR);288 * 933 * 100 / (10000 * (YEAR as u64));
287 assert_eq!(block_inflation_year_2 / 10, expecter_year_2_inflation / 10); // divide by 10 for approx. equality289 assert_eq!(block_inflation_year_2 / 10, expecter_year_2_inflation / 10); // divide by 10 for approx. equality
288 });290 });
289}291}
320#[test]322#[test]
321fn inflation_rate_by_year() {323fn inflation_rate_by_year() {
322 new_test_ext().execute_with(|| {324 new_test_ext().execute_with(|| {
323 let payouts: u64 = YEAR / InflationBlockInterval::get() as u64;325 let payouts = (YEAR / InflationBlockInterval::get()) as u64;
324326
325 // Inflation starts at 10% and does down by 2/3% every year until year 9 (included),327 // Inflation starts at 10% and does down by 2/3% every year until year 9 (included),
326 // then it is flat.328 // then it is flat.
327 let payout_by_year: [u64; 11] = [1000, 933, 867, 800, 733, 667, 600, 533, 467, 400, 400];329 let payout_by_year: [u64; 11] = [1000, 933, 867, 800, 733, 667, 600, 533, 467, 400, 400];
328330
329 // For accuracy total issuance = payout0 * payouts * 10;331 // For accuracy total issuance = payout0 * payouts * 10;
330 let initial_issuance: u64 = payout_by_year[0] * payouts * 10;332 let initial_issuance = payout_by_year[0] * payouts * 10;
331 let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);333 let _ = <Balances as Balanced<_>>::deposit(&1234, initial_issuance, Precision::Exact);
332 assert_eq!(Balances::free_balance(1234), initial_issuance);334 assert_eq!(Balances::free_balance(1234), initial_issuance);
333335
modifiedruntime/common/tests/mod.rsdiffbeforeafterboth
19use sp_runtime::{BuildStorage, Storage};19use sp_runtime::{BuildStorage, Storage};
20use up_common::types::AuraId;20use up_common::types::AuraId;
2121
22use crate::{BuildGenesisConfig, ParachainInfoConfig, Runtime, RuntimeEvent, System};22use crate::{ParachainInfoConfig, Runtime, RuntimeEvent, RuntimeGenesisConfig, System};
23pub type Balance = u128;23pub type Balance = u128;
2424
25pub mod xcm;25pub mod xcm;
51fn new_test_ext(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities {51fn new_test_ext(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities {
52 let mut storage = make_basic_storage();52 let mut storage = make_basic_storage();
5353
54 pallet_balances::BuildGenesisConfig::<Runtime> { balances }54 pallet_balances::GenesisConfig::<Runtime> { balances }
55 .build_storage(&mut storage)55 .assimilate_storage(&mut storage)
56 .unwrap();56 .unwrap();
5757
58 let mut ext = sp_io::TestExternalities::new(storage);58 let mut ext = sp_io::TestExternalities::new(storage);
95 .map(|acc| get_account_id_from_seed::<sr25519::Public>(acc))95 .map(|acc| get_account_id_from_seed::<sr25519::Public>(acc))
96 .collect::<Vec<_>>();96 .collect::<Vec<_>>();
9797
98 let cfg = BuildGenesisConfig {98 let cfg = RuntimeGenesisConfig {
99 collator_selection: CollatorSelectionConfig { invulnerables },99 collator_selection: CollatorSelectionConfig { invulnerables },
100 session: SessionConfig { keys },100 session: SessionConfig { keys },
101 parachain_info: ParachainInfoConfig {101 parachain_info: ParachainInfoConfig {
112fn make_basic_storage() -> Storage {112fn make_basic_storage() -> Storage {
113 use crate::AuraConfig;113 use crate::AuraConfig;
114114
115 let cfg = BuildGenesisConfig {115 let cfg = RuntimeGenesisConfig {
116 aura: AuraConfig {116 aura: AuraConfig {
117 authorities: vec![117 authorities: vec![
118 get_from_seed::<AuraId>("Alice"),118 get_from_seed::<AuraId>("Alice"),
modifiedruntime/common/tests/xcm.rsdiffbeforeafterboth
5252
53 let xcm_event = &last_events(1)[0];53 let xcm_event = &last_events(1)[0];
54 match xcm_event {54 match xcm_event {
55 RuntimeEvent::PolkadotXcm(pallet_xcm::Event::<Runtime>::Attempted(55 RuntimeEvent::PolkadotXcm(pallet_xcm::Event::<Runtime>::Attempted {
56 Outcome::Incomplete(_weight, Error::NoPermission),56 outcome: Outcome::Incomplete(_weight, Error::NoPermission),
57 )) => { /* Pass */ }57 }) => { /* Pass */ }
58 _ => panic!(58 _ => panic!(
59 "Expected PolkadotXcm.Attempted(Incomplete(_weight, NoPermission)),\59 "Expected PolkadotXcm.Attempted(Incomplete(_weight, NoPermission)),\
60 found: {xcm_event:#?}"60 found: {xcm_event:#?}"
addedruntime/tests/src/dispatch.rsdiffbeforeafterboth

no changes

modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
33use scale_info::TypeInfo;33use scale_info::TypeInfo;
34use sp_core::{H160, H256, U256};34use sp_core::{H160, H256, U256};
35use sp_runtime::{35use sp_runtime::{
36 testing::Header,
37 traits::{BlakeTwo256, IdentityLookup},36 traits::{BlakeTwo256, IdentityLookup},
37 BuildStorage,
38};38};
39use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};39use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};
4040
41#[path = "../../common/dispatch.rs"]
42mod dispatch;41mod dispatch;
4342
44use dispatch::CollectionDispatchT;43use dispatch::CollectionDispatchT;
4544
46#[path = "../../common/weights/mod.rs"]
47mod weights;45mod weights;
4846
49use weights::CommonWeights;47use weights::CommonWeights;
5048
51type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
52type Block = frame_system::mocking::MockBlock<Test>;49type Block = frame_system::mocking::MockBlockU32<Test>;
5350
54#[cfg(test)]51#[cfg(test)]
55mod tests;52mod tests;
73);70);
7471
75parameter_types! {72parameter_types! {
76 pub const BlockHashCount: u64 = 250;73 pub const BlockHashCount: u32 = 250;
77 pub const SS58Prefix: u8 = 42;74 pub const SS58Prefix: u8 = 42;
78}75}
7976
80impl system::Config for Test {77impl system::Config for Test {
81 type RuntimeEvent = RuntimeEvent;78 type RuntimeEvent = RuntimeEvent;
82 type BaseCallFilter = Everything;79 type BaseCallFilter = Everything;
80 type Block = Block;
83 type BlockWeights = ();81 type BlockWeights = ();
84 type BlockLength = ();82 type BlockLength = ();
85 type DbWeight = ();83 type DbWeight = ();
120 type MaxFreezes = MaxLocks;118 type MaxFreezes = MaxLocks;
121 type FreezeIdentifier = [u8; 8];119 type FreezeIdentifier = [u8; 8];
122 type MaxHolds = MaxLocks;120 type MaxHolds = MaxLocks;
121 type RuntimeHoldReason = RuntimeHoldReason;
123}122}
124123
125parameter_types! {124parameter_types! {
232 type OnMethodCall = ();231 type OnMethodCall = ();
233 type OnCreate = ();232 type OnCreate = ();
234 type OnChargeTransaction = ();233 type OnChargeTransaction = ();
234 type OnCheckEvmTransaction = ();
235 type FindAuthor = ();235 type FindAuthor = ();
236 type BlockHashMapping = SubstrateBlockHashMapping<Self>;236 type BlockHashMapping = SubstrateBlockHashMapping<Self>;
237 type Timestamp = Timestamp;237 type Timestamp = Timestamp;
296296
297// Build genesis storage according to the mock runtime.297// Build genesis storage according to the mock runtime.
298pub fn new_test_ext() -> sp_io::TestExternalities {298pub fn new_test_ext() -> sp_io::TestExternalities {
299 system::GenesisConfig::default()299 <system::GenesisConfig<Test>>::default()
300 .build_storage::<Test>()300 .build_storage()
301 .unwrap()301 .unwrap()
302 .into()302 .into()
303}303}
addedruntime/tests/src/weightsdiffbeforeafterboth

no changes