From 70b9121bfaaa5168dc2fe18d9aa08d12c4555e06 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Wed, 3 May 2023 12:57:03 +0200 Subject: [PATCH 1/5] Sort migrations by release Signed-off-by: Oliver Tale-Yazdi --- runtime/kusama/src/lib.rs | 40 +++++++++++++++++++++++----------- runtime/polkadot/src/lib.rs | 43 +++++++++++++++++++++++++------------ runtime/rococo/src/lib.rs | 25 ++++++++++++++++----- runtime/westend/src/lib.rs | 40 +++++++++++++++++++++++----------- 4 files changed, 103 insertions(+), 45 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 5dd7819ea587..44e9d774387d 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1461,19 +1461,33 @@ impl Get 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. -#[allow(deprecated)] -pub type Migrations = ( - // 0.9.40 - pallet_nomination_pools::migration::v4::MigrateToV4< - Runtime, - NominationPoolsMigrationV4OldPallet, - >, - pallet_nomination_pools::migration::v5::MigrateToV5, - // Unreleased - add new migrations here: - parachains_configuration::migration::v5::MigrateToV5, - pallet_offences::migration::v1::MigrateToV1, - runtime_common::session::migration::ClearOldSessionStorage, -); +pub type Migrations = migrations::SinceV0940; + +/// The runtime migrations per release. +#[allow(deprecated, missing_docs)] +pub mod migrations { + use super::*; + + pub type V0940 = ( + pallet_nomination_pools::migration::v4::MigrateToV4< + Runtime, + NominationPoolsMigrationV4OldPallet, + >, + pallet_nomination_pools::migration::v5::MigrateToV5, + ); + pub type V0941 = (); // node only + pub type V0942 = ( + parachains_configuration::migration::v5::MigrateToV5, + pallet_offences::migration::v1::MigrateToV1, + runtime_common::session::migration::ClearOldSessionStorage, + ); + + /// Unreleased migrations. Add new ones here: + pub type Unreleased = (); + + /// All migrations that should run since (including) `0.9.40`. + pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); +} /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index b94a882be420..ed4061015e2a 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1416,20 +1416,35 @@ impl Get for NominationPoolsMigrationV4OldPallet { /// All migrations that will run on the next runtime upgrade. /// -/// This contains the combined migrations of the last 10 releases. It allows to skip runtime upgrades in case governance decides to do so. -#[allow(deprecated)] -pub type Migrations = ( - // 0.9.40 - pallet_nomination_pools::migration::v4::MigrateToV4< - Runtime, - NominationPoolsMigrationV4OldPallet, - >, - pallet_nomination_pools::migration::v5::MigrateToV5, - // Unreleased - add new migrations here: - parachains_configuration::migration::v5::MigrateToV5, - pallet_offences::migration::v1::MigrateToV1, - runtime_common::session::migration::ClearOldSessionStorage, -); +/// This contains the combined migrations of the last 10 releases. It allows to skip runtime +/// upgrades in case governance decides to do so. +pub type Migrations = migrations::SinceV0940; + +/// The runtime migrations per release. +#[allow(deprecated, missing_docs)] +pub mod migrations { + use super::*; + + pub type V0940 = ( + pallet_nomination_pools::migration::v4::MigrateToV4< + Runtime, + NominationPoolsMigrationV4OldPallet, + >, + pallet_nomination_pools::migration::v5::MigrateToV5, + ); + pub type V0941 = (); // node only + pub type V0942 = ( + parachains_configuration::migration::v5::MigrateToV5, + pallet_offences::migration::v1::MigrateToV1, + runtime_common::session::migration::ClearOldSessionStorage, + ); + + /// Unreleased migrations. Add new ones here: + pub type Unreleased = (); + + /// All migrations that should run since (including) `0.9.40`. + pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); +} /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index bc2e42d6ad3b..69fb63614aac 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1478,11 +1478,26 @@ pub type UncheckedExtrinsic = /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime /// upgrades in case governance decides to do so. -pub type Migrations = ( - // Unreleased - add new migrations here: - parachains_configuration::migration::v5::MigrateToV5, - pallet_offences::migration::v1::MigrateToV1, -); +pub type Migrations = migrations::SinceV0940; + +/// The runtime migrations per release. +#[allow(deprecated, missing_docs)] +pub mod migrations { + use super::*; + + pub type V0940 = (); + pub type V0941 = (); // node only + pub type V0942 = ( + parachains_configuration::migration::v5::MigrateToV5, + pallet_offences::migration::v1::MigrateToV1, + ); + + /// Unreleased migrations. Add new ones here: + pub type Unreleased = (); + + /// All migrations that should run since (including) `0.9.40`. + pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); +} /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index c4fcbc35e545..eb2ad5a037e4 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1213,19 +1213,33 @@ impl Get 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. -#[allow(deprecated)] -pub type Migrations = ( - // 0.9.40 - clean_state_migration::CleanMigrate, - pallet_nomination_pools::migration::v4::MigrateToV4< - Runtime, - NominationPoolsMigrationV4OldPallet, - >, - pallet_nomination_pools::migration::v5::MigrateToV5, - // Unreleased - add new migrations here: - parachains_configuration::migration::v5::MigrateToV5, - pallet_offences::migration::v1::MigrateToV1, -); +pub type Migrations = migrations::SinceV0940; + +/// The runtime migrations per release. +#[allow(deprecated, missing_docs)] +pub mod migrations { + use super::*; + + pub type V0940 = ( + clean_state_migration::CleanMigrate, + pallet_nomination_pools::migration::v4::MigrateToV4< + Runtime, + NominationPoolsMigrationV4OldPallet, + >, + pallet_nomination_pools::migration::v5::MigrateToV5, + ); + pub type V0941 = (); // node only + pub type V0942 = ( + parachains_configuration::migration::v5::MigrateToV5, + pallet_offences::migration::v1::MigrateToV1, + ); + + /// Unreleased migrations. Add new ones here: + pub type Unreleased = (); + + /// All migrations that should run since (including) `0.9.40`. + pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); +} /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = From 6ca491891f3f16c236450b3ed80e9f56860e697d Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Wed, 3 May 2023 15:56:31 +0200 Subject: [PATCH 2/5] Inline 'SinceV0940' Signed-off-by: Oliver Tale-Yazdi --- runtime/kusama/src/lib.rs | 5 +---- runtime/polkadot/src/lib.rs | 5 +---- runtime/rococo/src/lib.rs | 5 +---- runtime/westend/src/lib.rs | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 44e9d774387d..955978353b47 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1461,7 +1461,7 @@ impl Get 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. -pub type Migrations = migrations::SinceV0940; +pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] @@ -1484,9 +1484,6 @@ pub mod migrations { /// Unreleased migrations. Add new ones here: pub type Unreleased = (); - - /// All migrations that should run since (including) `0.9.40`. - pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); } /// Unchecked extrinsic type as expected by this runtime. diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index ed4061015e2a..18a603a52019 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1418,7 +1418,7 @@ impl Get 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. -pub type Migrations = migrations::SinceV0940; +pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] @@ -1441,9 +1441,6 @@ pub mod migrations { /// Unreleased migrations. Add new ones here: pub type Unreleased = (); - - /// All migrations that should run since (including) `0.9.40`. - pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); } /// Unchecked extrinsic type as expected by this runtime. diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 69fb63614aac..7bd9a209969b 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1478,7 +1478,7 @@ pub type UncheckedExtrinsic = /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime /// upgrades in case governance decides to do so. -pub type Migrations = migrations::SinceV0940; +pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] @@ -1494,9 +1494,6 @@ pub mod migrations { /// Unreleased migrations. Add new ones here: pub type Unreleased = (); - - /// All migrations that should run since (including) `0.9.40`. - pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); } /// Executive: handles dispatch to the various modules. diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index eb2ad5a037e4..48903ddc0840 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1213,7 +1213,7 @@ impl Get 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. -pub type Migrations = migrations::SinceV0940; +pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] @@ -1236,9 +1236,6 @@ pub mod migrations { /// Unreleased migrations. Add new ones here: pub type Unreleased = (); - - /// All migrations that should run since (including) `0.9.40`. - pub type SinceV0940 = (V0940, V0941, V0942, Unreleased); } /// Unchecked extrinsic type as expected by this runtime. From 098d1b29c5d37fb83876cb33b4e40f3f02e4cd9c Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Wed, 3 May 2023 15:58:04 +0200 Subject: [PATCH 3/5] Mention order Signed-off-by: Oliver Tale-Yazdi --- runtime/kusama/src/lib.rs | 2 +- runtime/polkadot/src/lib.rs | 2 +- runtime/rococo/src/lib.rs | 2 +- runtime/westend/src/lib.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 955978353b47..ee58fbd1be60 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1460,7 +1460,7 @@ impl Get for NominationPoolsMigrationV4OldPallet { /// All migrations that will run on the next runtime upgrade. /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime -/// upgrades in case governance decides to do so. +/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT. pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 18a603a52019..6f64be1ff92e 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1417,7 +1417,7 @@ impl Get for NominationPoolsMigrationV4OldPallet { /// All migrations that will run on the next runtime upgrade. /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime -/// upgrades in case governance decides to do so. +/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT. pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 7bd9a209969b..c9b354be8bfc 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1477,7 +1477,7 @@ pub type UncheckedExtrinsic = /// All migrations that will run on the next runtime upgrade. /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime -/// upgrades in case governance decides to do so. +/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT. pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 48903ddc0840..ecc078b5282c 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1212,7 +1212,7 @@ impl Get for NominationPoolsMigrationV4OldPallet { /// All migrations that will run on the next runtime upgrade. /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime -/// upgrades in case governance decides to do so. +/// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT. pub type Migrations = (V0940, V0941, V0942, Unreleased); /// The runtime migrations per release. From d416f9d6bf43c4bf4c305b43ca8a20a9f99dfe16 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Wed, 3 May 2023 16:00:14 +0200 Subject: [PATCH 4/5] Extend comment Signed-off-by: Oliver Tale-Yazdi --- runtime/kusama/src/lib.rs | 2 +- runtime/polkadot/src/lib.rs | 2 +- runtime/rococo/src/lib.rs | 2 +- runtime/westend/src/lib.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index ee58fbd1be60..093efb25241c 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1475,7 +1475,7 @@ pub mod migrations { >, pallet_nomination_pools::migration::v5::MigrateToV5, ); - pub type V0941 = (); // node only + pub type V0941 = (); // Node only release - no migrations. pub type V0942 = ( parachains_configuration::migration::v5::MigrateToV5, pallet_offences::migration::v1::MigrateToV1, diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 6f64be1ff92e..472000402fb6 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1432,7 +1432,7 @@ pub mod migrations { >, pallet_nomination_pools::migration::v5::MigrateToV5, ); - pub type V0941 = (); // node only + pub type V0941 = (); // Node only release - no migrations. pub type V0942 = ( parachains_configuration::migration::v5::MigrateToV5, pallet_offences::migration::v1::MigrateToV1, diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index c9b354be8bfc..a7c852c3251d 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1486,7 +1486,7 @@ pub mod migrations { use super::*; pub type V0940 = (); - pub type V0941 = (); // node only + pub type V0941 = (); // Node only release - no migrations. pub type V0942 = ( parachains_configuration::migration::v5::MigrateToV5, pallet_offences::migration::v1::MigrateToV1, diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index ecc078b5282c..cd171d61f34f 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1228,7 +1228,7 @@ pub mod migrations { >, pallet_nomination_pools::migration::v5::MigrateToV5, ); - pub type V0941 = (); // node only + pub type V0941 = (); // Node only release - no migrations. pub type V0942 = ( parachains_configuration::migration::v5::MigrateToV5, pallet_offences::migration::v1::MigrateToV1, From 04625bdeee777ea9833ed5614a3f89a9e7a64cac Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Wed, 3 May 2023 16:33:06 +0200 Subject: [PATCH 5/5] Fix compile Signed-off-by: Oliver Tale-Yazdi --- runtime/kusama/src/lib.rs | 3 ++- runtime/polkadot/src/lib.rs | 3 ++- runtime/rococo/src/lib.rs | 3 ++- runtime/westend/src/lib.rs | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 093efb25241c..57659f81cbdb 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1461,7 +1461,8 @@ impl Get 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 = (V0940, V0941, V0942, Unreleased); +pub type Migrations = + (migrations::V0940, migrations::V0941, migrations::V0942, migrations::Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 472000402fb6..7fe1e78c181f 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1418,7 +1418,8 @@ impl Get 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 = (V0940, V0941, V0942, Unreleased); +pub type Migrations = + (migrations::V0940, migrations::V0941, migrations::V0942, migrations::Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index a7c852c3251d..a02b98f86ed1 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1478,7 +1478,8 @@ pub type UncheckedExtrinsic = /// /// 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 = (V0940, V0941, V0942, Unreleased); +pub type Migrations = + (migrations::V0940, migrations::V0941, migrations::V0942, migrations::Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)] diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index cd171d61f34f..e7675c34fc91 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1213,7 +1213,8 @@ impl Get 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 = (V0940, V0941, V0942, Unreleased); +pub type Migrations = + (migrations::V0940, migrations::V0941, migrations::V0942, migrations::Unreleased); /// The runtime migrations per release. #[allow(deprecated, missing_docs)]