From e42821da8d85f721d0dd1670dfb23f4dd91bd3e8 Mon Sep 17 00:00:00 2001 From: eskimor Date: Sun, 10 Mar 2024 22:32:57 +0100 Subject: [PATCH] Refund leases that have not started. (#206) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed for a smooth migration to Coretime. --------- Co-authored-by: eskimor Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Bastian Köcher --- CHANGELOG.md | 1 + relay/kusama/src/lib.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b989e6b71..c57fa0ef99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Feature for enabling debug prints in the Polkadot and Kusama runtime ([polkadot-fellows/runtimes#85](https://github.com/polkadot-fellows/runtimes/pull/85)) - Added new "Wish for Change" track ([polkadot-fellows/runtimes#184](https://github.com/polkadot-fellows/runtimes/pull/184)) - Enable Coretime and on-demand on Kusama ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159)) +- Refund any leases that are not migrated to Coretime (have holes in them/have not yet started) ([polkadot-fellows/runtimes#206](https://github.com/polkadot-fellows/runtimes/pull/206)) - Enable Elastic Scaling node side feature for Kusama ([polkadot-fellows/runtimes#205](https://github.com/polkadot-fellows/runtimes/pull/205)) - Cancel Parachain Auctions ([polkadot-fellows/runtimes#215](https://github.com/polkadot-fellows/runtimes/pull/215)) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 6c9f821d80..e8e1a0b0a0 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1764,8 +1764,19 @@ pub mod migrations { if lease.is_empty() { return None } - // Lease not yet started, ignore: + // Lease not yet started/or having holes, refund (coretime can't handle this): if lease.iter().any(Option::is_none) { + if let Err(err) = slots::Pallet::::clear_all_leases( + frame_system::RawOrigin::Root.into(), + para, + ) { + log::error!( + target: "runtime", + "Clearing lease for para: {:?} failed, with error: {:?}", + para, + err + ); + }; return None } let (index, _) =