Skip to content

Commit

Permalink
Remove Executed Migrations (#7495)
Browse files Browse the repository at this point in the history
* Polkadot is at .42

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Kusama is on .43

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Westend is at .43

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Rococo is at .42

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Make UMP limits migration more idempotentish

Already 100% idempotent per design, but not it wont try to schedule
an unneeded upgrade. Note that the case that the new upgrade is
already scheduled is not checked. In that case it will still upgrade
the same thing again, but should be no problem.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Clippy

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Delete old migration code

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* fmt

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Remove old tests

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Polkadot is at .43

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Remove a ton of shit

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Remove more

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Remove unused code

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Rococo is NOT yet at .43, but remove anyway

Rococo is the only runtime that is not yet at .43, but keeping
the migration code just for it is not worth it since devops
can just apply it at any time.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Remove old test

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: parity-processbot <>
  • Loading branch information
ggwpez authored Jul 19, 2023
1 parent a1eadbf commit 3bbb336
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 1,340 deletions.
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub mod impls;
pub mod paras_registrar;
pub mod paras_sudo_wrapper;
pub mod purchase;
pub mod session;
pub mod slot_range;
pub mod slots;
pub mod traits;
Expand Down
70 changes: 0 additions & 70 deletions polkadot/runtime/common/src/session/migration.rs

This file was deleted.

17 changes: 0 additions & 17 deletions polkadot/runtime/common/src/session/mod.rs

This file was deleted.

70 changes: 1 addition & 69 deletions polkadot/runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,40 +1521,12 @@ impl Get<Perbill> for NominationPoolsMigrationV4OldPallet {
///
/// This contains the combined migrations of the last 10 releases. It allows to skip runtime
/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT.
pub type Migrations = (
migrations::V0940,
migrations::V0941,
migrations::V0942,
migrations::V0943,
migrations::Unreleased,
);
pub type Migrations = (migrations::Unreleased,);

/// The runtime migrations per release.
#[allow(deprecated, missing_docs)]
pub mod migrations {
use super::*;
use frame_support::traits::{GetStorageVersion, OnRuntimeUpgrade, StorageVersion};

pub type V0940 = (
pallet_nomination_pools::migration::v4::MigrateToV4<
Runtime,
NominationPoolsMigrationV4OldPallet,
>,
pallet_nomination_pools::migration::v5::MigrateToV5<Runtime>,
);
pub type V0941 = (); // Node only release - no migrations.
pub type V0942 = (
parachains_configuration::migration::v5::MigrateToV5<Runtime>,
pallet_offences::migration::v1::MigrateToV1<Runtime>,
runtime_common::session::migration::ClearOldSessionStorage<Runtime>,
);

pub type V0943 = (
SetStorageVersions,
// 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 = (
Expand All @@ -1567,46 +1539,6 @@ pub mod migrations {
pallet_im_online::migration::v1::Migration<Runtime>,
parachains_configuration::migration::v7::MigrateToV7<Runtime>,
);

/// Migrations that set `StorageVersion`s we missed to set.
pub struct SetStorageVersions;

impl OnRuntimeUpgrade for SetStorageVersions {
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`.
let storage_version = NisCounterpartBalances::on_chain_storage_version();
if storage_version < 1 {
StorageVersion::new(1).put::<NisCounterpartBalances>();
}

// Was missed as part of: `runtime_common::session::migration::ClearOldSessionStorage<Runtime>`.
let storage_version = Historical::on_chain_storage_version();
if storage_version < 1 {
StorageVersion::new(1).put::<Historical>();
}

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

/// Helpers to configure the ump migrations.
pub mod ump_migrations {
use runtime_parachains::configuration::migration_ump;

pub const MAX_UPWARD_QUEUE_SIZE: u32 = 4 * 1024 * 1024;
pub const MAX_UPWARD_QUEUE_COUNT: u32 = 699050;
pub const MAX_UPWARD_MESSAGE_SIZE: u32 = (1 << 16) - 5; // Checked in test `max_upward_message_size`.
pub const MAX_UPWARD_MESSAGE_NUM_PER_CANDIDATE: u32 = 128;

pub type UpdateUmpLimits = migration_ump::latest::ScheduleConfigUpdate<
super::Runtime,
MAX_UPWARD_QUEUE_SIZE,
MAX_UPWARD_QUEUE_COUNT,
MAX_UPWARD_MESSAGE_SIZE,
MAX_UPWARD_MESSAGE_NUM_PER_CANDIDATE,
>;
}

/// Unchecked extrinsic type as expected by this runtime.
Expand Down
8 changes: 0 additions & 8 deletions polkadot/runtime/kusama/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,3 @@ fn nominator_limit() {
fn call_size() {
RuntimeCall::assert_size_under(230);
}

#[test]
fn max_upward_message_size() {
assert_eq!(
ump_migrations::MAX_UPWARD_MESSAGE_SIZE,
pallet_message_queue::MaxMessageLenOf::<Runtime>::get()
);
}
1 change: 0 additions & 1 deletion polkadot/runtime/parachains/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ mod tests;
mod benchmarking;

pub mod migration;
pub mod migration_ump;

pub use pallet::*;

Expand Down
3 changes: 0 additions & 3 deletions polkadot/runtime/parachains/src/configuration/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@

//! A module that is responsible for migration of storage.
use primitives::ExecutorParams;

pub mod v5;
pub mod v6;
pub mod v7;
Loading

0 comments on commit 3bbb336

Please sign in to comment.