From 41b53cb7485fd760d2ab5a2942bf4158407e3295 Mon Sep 17 00:00:00 2001 From: eskimor Date: Sun, 29 Sep 2024 19:40:35 +0200 Subject: [PATCH] More checks --- Cargo.lock | 1 + .../coretime/coretime-polkadot/src/migrations.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a34e028c5d..9009eb75c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2806,6 +2806,7 @@ dependencies = [ "serde", "serde_json", "sp-api", + "sp-arithmetic 26.0.0", "sp-block-builder", "sp-consensus-aura", "sp-core 34.0.0", diff --git a/system-parachains/coretime/coretime-polkadot/src/migrations.rs b/system-parachains/coretime/coretime-polkadot/src/migrations.rs index 43c77bba97..0baf278e7f 100644 --- a/system-parachains/coretime/coretime-polkadot/src/migrations.rs +++ b/system-parachains/coretime/coretime-polkadot/src/migrations.rs @@ -149,6 +149,10 @@ impl FixMigration { (2101, 298800), ]; + if PotentialRenewals::::iter().count() != premature_renewals.len() { + log::error!(target: TARGET, "Unexpected renewal state!"); + } + if PotentialRenewals::::clear(premature_renewals.len() as u32, None) .maybe_cursor .is_some() @@ -253,6 +257,9 @@ impl OnRuntimeUpgrade for FixMigration { let sale_info = SaleInfo::::get().unwrap(); let leases = Leases::::get(); let pre_upgrade_state = (sale_info, leases); + + assert_eq!(PotentialRenewals::::iter().count(), INCORRECT_RENEWAL_IDS.len()); + Ok(pre_upgrade_state.encode()) }