Skip to content

Commit

Permalink
Refund leases that have not started. (#206)
Browse files Browse the repository at this point in the history
Needed for a smooth migration to Coretime.

---------

Co-authored-by: eskimor <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
  • Loading branch information
4 people authored Mar 10, 2024
1 parent f5aeb7e commit e42821d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
13 changes: 12 additions & 1 deletion relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Runtime>::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, _) =
Expand Down

0 comments on commit e42821d

Please sign in to comment.