Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Enact ImOnline migration #7403

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1525,20 +1525,33 @@ pub mod migrations {
);

pub type V0943 = (
SetStorageVersions,
SetStorageVersionsV0943,
// Remove UMP dispatch queue <https://github.com/paritytech/polkadot/pull/6271>
parachains_configuration::migration::v6::MigrateToV6<Runtime>,
ump_migrations::UpdateUmpLimits,
);

/// Unreleased migrations. Add new ones here:
pub type Unreleased =
(pallet_society::migrations::MigrateToV2<Runtime, (), past_payouts::PastPayouts>,);
pub type Unreleased = (
pallet_society::migrations::MigrateToV2<Runtime, (), past_payouts::PastPayouts>,
SetStorageVersionsUnreleased,
);

/// Migrations that set `StorageVersion`s we missed to set.
pub struct SetStorageVersions;
pub struct SetStorageVersionsUnreleased;
impl OnRuntimeUpgrade for SetStorageVersionsUnreleased {
fn on_runtime_upgrade() -> Weight {
let storage_version = ImOnline::on_chain_storage_version();
if storage_version < 1 {
StorageVersion::new(1).put::<ImOnline>();
}

RocksDbWeight::get().reads_writes(1, 1)
}
}

impl OnRuntimeUpgrade for SetStorageVersions {
pub struct SetStorageVersionsV0943;
impl OnRuntimeUpgrade for SetStorageVersionsV0943 {
fn on_runtime_upgrade() -> Weight {
// The `NisCounterpartBalances` pallet was added to the chain after/with the migration.
// So, the migration never needed to be executed, but we also did not set the proper `StorageVersion`.
Expand Down
20 changes: 16 additions & 4 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1302,16 +1302,28 @@ pub mod migrations {
pallet_offences::migration::v1::MigrateToV1<Runtime>,
);
pub type V0943 = (
SetStorageVersions,
SetStorageVersionsV0943,
// Remove UMP dispatch queue <https://github.com/paritytech/polkadot/pull/6271>
parachains_configuration::migration::v6::MigrateToV6<Runtime>,
ump_migrations::UpdateUmpLimits,
);

/// Migrations that set `StorageVersion`s we missed to set.
pub struct SetStorageVersions;
/// Migrations that set `StorageVersion`s we missed to set.
pub struct SetStorageVersionsUnreleased;
impl OnRuntimeUpgrade for SetStorageVersionsUnreleased {
fn on_runtime_upgrade() -> Weight {
let storage_version = ImOnline::on_chain_storage_version();
if storage_version < 1 {
StorageVersion::new(1).put::<ImOnline>();
}

RocksDbWeight::get().reads_writes(1, 1)
}
}

impl OnRuntimeUpgrade for SetStorageVersions {
pub struct SetStorageVersionsV0943;
impl OnRuntimeUpgrade for SetStorageVersionsV0943 {
fn on_runtime_upgrade() -> Weight {
if FastUnstake::on_chain_storage_version() < 1 {
StorageVersion::new(1).put::<FastUnstake>();
Expand All @@ -1323,7 +1335,7 @@ pub mod migrations {
}

/// Unreleased migrations. Add new ones here:
pub type Unreleased = ();
pub type Unreleased = (SetStorageVersionsUnreleased);
}

/// Helpers to configure all migrations.
Expand Down
Loading