diff --git a/Cargo.lock b/Cargo.lock index 0dd68ad34a..9ab9727cc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7752,6 +7752,7 @@ name = "pallet-balances" version = "37.0.0" dependencies = [ "docify", + "either", "frame-benchmarking", "frame-support", "frame-system", diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index c300e16ccd..e48c63719c 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -333,7 +333,7 @@ impl pallet_indices::Config for Runtime { type Deposit = IndexDeposit; type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::pallet_indices::WeightInfo; - type AhReserveMigrator = frame_support::ahm::NoopMigrator; + type AhReserveMigrator = frame_support::ahm::NoopMigrator<(), Self::AccountId, Balance>; } parameter_types! { diff --git a/relay/polkadot/tests/ahm_tests.rs b/relay/polkadot/tests/ahm_tests.rs index c063ad1897..2e372cd3ba 100644 --- a/relay/polkadot/tests/ahm_tests.rs +++ b/relay/polkadot/tests/ahm_tests.rs @@ -37,6 +37,7 @@ async fn ahm_indices_out() { ext.execute_with(|| { frame_system::Pallet::::set_block_number(1); + total_issuance_correct(); let ti = pallet_balances::TotalIssuance::::get(); loop { @@ -45,23 +46,42 @@ async fn ahm_indices_out() { }; calls.push(call); - /*log::error!("Number of events: {:?}", System::events().len()); + log::error!("Number of events: {:?}", System::events().len()); for event in System::events() { log::error!("Event: {:?}", event); } - System::reset_events();*/ + System::reset_events(); } + log::error!("Dispatched {} calls", calls.len()); for call in calls { let runtime_call: polkadot_runtime::RuntimeCall = call.into(); runtime_call.dispatch(frame_system::RawOrigin::Root.into()).unwrap(); } + log::error!("Number of events: {:?}", System::events().len()); + for event in System::events() { + log::error!("Event: {:?}", event); + } + + total_issuance_correct(); let ti2 = pallet_balances::TotalIssuance::::get(); assert_eq!(ti, ti2, "Total issuance must be the same after migration"); }); } +fn total_issuance_correct() { + println!("Checkig TI"); + let mut total = 0; + for acc in frame_system::Account::::iter_values() { + total += acc.data.free + acc.data.reserved; + } + + let known_bad_diff = 15153004468955758308u128 - 15152788105929904271u128; + let ti = pallet_balances::TotalIssuance::::get(); + assert_eq!(total + known_bad_diff, ti, "Total issuance must be the same as sum of all account balances"); +} + async fn remote_ext_test_setup() -> Option> { sp_tracing::try_init_simple(); let Some(snap) = std::env::var("SNAP").ok() else{