Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel auctions on Coretime launch #215

Merged
20 changes: 20 additions & 0 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,8 @@ pub type Migrations = migrations::Unreleased;
#[allow(deprecated, missing_docs)]
pub mod migrations {
use super::*;
use frame_support::traits::OnRuntimeUpgrade;
use runtime_common::auctions::WeightInfo;
#[cfg(feature = "try-runtime")]
use sp_core::crypto::ByteArray;

Expand Down Expand Up @@ -1849,6 +1851,23 @@ pub mod migrations {
}
}

/// Cancel all ongoing auctions.
///
/// Any leases that come into existance, after coretime was launched will not be served. Yet,
/// any still ongoing auctions must be cancelled.
eskimor marked this conversation as resolved.
Show resolved Hide resolved
///
/// Safety: After coretime is launched, there are no auctions anymore. So if this forgotten to
/// be removed after the runtime upgrade, running this again on the next one is harmless.
pub struct CancelAuctions;
impl OnRuntimeUpgrade for CancelAuctions {
fn on_runtime_upgrade() -> Weight {
if let Err(err) = Auctions::cancel_auction(frame_system::RawOrigin::Root.into()) {
eskimor marked this conversation as resolved.
Show resolved Hide resolved
log::error!("Cancelling auctions failed: {:?}", err);
}
weights::runtime_common_auctions::WeightInfo::<Runtime>::cancel_auction()
}
}

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
pallet_nomination_pools::migration::versioned::V7ToV8<Runtime>,
Expand All @@ -1872,6 +1891,7 @@ pub mod migrations {
ImOnlinePalletName,
<Runtime as frame_system::Config>::DbWeight,
>,
CancelAuctions,
);
}

Expand Down
Loading