From c1d0523dcdff2d20d041a3bcac490c8564c3a4f3 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 12 May 2023 13:24:24 +0200 Subject: [PATCH 1/9] Fixes --- pallets/dmp-queue/src/migration.rs | 11 +++++++++-- pallets/parachain-system/src/lib.rs | 2 +- pallets/parachain-system/src/migration.rs | 10 +++++++++- pallets/xcmp-queue/src/migration.rs | 11 +++++++++-- .../runtimes/contracts/contracts-rococo/Cargo.toml | 1 + .../runtimes/contracts/contracts-rococo/src/lib.rs | 10 +++++++++- .../contracts/contracts-rococo/src/xcm_config.rs | 1 + 7 files changed, 39 insertions(+), 7 deletions(-) diff --git a/pallets/dmp-queue/src/migration.rs b/pallets/dmp-queue/src/migration.rs index 5e1d357e142..c98359bd9f0 100644 --- a/pallets/dmp-queue/src/migration.rs +++ b/pallets/dmp-queue/src/migration.rs @@ -19,12 +19,12 @@ use crate::{Config, Configuration, Overweight, Pallet, DEFAULT_POV_SIZE}; use frame_support::{ pallet_prelude::*, - traits::StorageVersion, + traits::{OnRuntimeUpgrade, StorageVersion}, weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight}, }; /// The current storage version. -pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); /// Migrates the pallet storage to the most recent version, checking and setting the /// `StorageVersion`. @@ -46,6 +46,13 @@ pub fn migrate_to_latest() -> Weight { weight } +pub struct Migration(PhantomData); +impl OnRuntimeUpgrade for Migration { + fn on_runtime_upgrade() -> Weight { + migrate_to_latest::() + } +} + mod v0 { use super::*; use codec::{Decode, Encode}; diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index 36ef8d57195..333e27eef2e 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -57,7 +57,7 @@ use sp_runtime::{ use sp_std::{cmp, collections::btree_map::BTreeMap, prelude::*}; use xcm::latest::XcmHash; -mod migration; +pub mod migration; mod relay_state_snapshot; #[macro_use] pub mod validate_block; diff --git a/pallets/parachain-system/src/migration.rs b/pallets/parachain-system/src/migration.rs index e3d1e11a51b..f9ef9b720cf 100644 --- a/pallets/parachain-system/src/migration.rs +++ b/pallets/parachain-system/src/migration.rs @@ -16,7 +16,8 @@ use crate::{Config, Pallet, ReservedDmpWeightOverride, ReservedXcmpWeightOverride}; use frame_support::{ - traits::{Get, StorageVersion}, + pallet_prelude::*, + traits::{Get, OnRuntimeUpgrade, StorageVersion}, weights::Weight, }; @@ -44,6 +45,13 @@ pub fn on_runtime_upgrade() -> Weight { weight } +pub struct Migration(PhantomData); +impl OnRuntimeUpgrade for Migration { + fn on_runtime_upgrade() -> Weight { + on_runtime_upgrade::() + } +} + /// V2: Migrate to 2D weights for ReservedXcmpWeightOverride and ReservedDmpWeightOverride. mod v2 { use super::*; diff --git a/pallets/xcmp-queue/src/migration.rs b/pallets/xcmp-queue/src/migration.rs index fd1301b9491..9839fec296f 100644 --- a/pallets/xcmp-queue/src/migration.rs +++ b/pallets/xcmp-queue/src/migration.rs @@ -19,12 +19,12 @@ use crate::{Config, Overweight, Pallet, QueueConfig, DEFAULT_POV_SIZE}; use frame_support::{ pallet_prelude::*, - traits::StorageVersion, + traits::{OnRuntimeUpgrade, StorageVersion}, weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight}, }; /// The current storage version. -pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); /// Migrates the pallet storage to the most recent version, checking and setting the /// `StorageVersion`. @@ -46,6 +46,13 @@ pub fn migrate_to_latest() -> Weight { weight } +pub struct Migration(PhantomData); +impl OnRuntimeUpgrade for Migration { + fn on_runtime_upgrade() -> Weight { + migrate_to_latest::() + } +} + mod v1 { use super::*; use codec::{Decode, Encode}; diff --git a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index 1bbf4b09294..49a939c068d 100644 --- a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -86,6 +86,7 @@ std = [ "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", + "frame-try-runtime/std", "kusama-runtime-constants/std", "pallet-aura/std", "pallet-authorship/std", diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 38d32895363..386819ac0c0 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -97,7 +97,15 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; -pub type Migrations = (pallet_contracts::Migration,); +pub type Migrations = ( + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, + pallet_balances::migration::MigrateToTrackInactive, + pallet_multisig::migrations::v1::MigrateToV1, + pallet_contracts::Migration, + pallet_xcm::migration::v1::MigrateToV1, + cumulus_pallet_dmp_queue::migration::Migration, +); type EventRecord = frame_system::EventRecord< ::RuntimeEvent, diff --git a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs index e79d06b1aa1..fa1d2db3db7 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs @@ -43,6 +43,7 @@ parameter_types! { pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); pub const ExecutiveBody: BodyId = BodyId::Executive; + pub CheckingAccount: AccountId = PolkadotXcm::check_account(); } /// We allow root and the Relay Chain council to execute privileged collator selection operations. From 8b78c9f406e95900636f499fb55c33d984eddd72 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 12 May 2023 14:50:12 +0200 Subject: [PATCH 2/9] Remove on_runtime_upgrade hook --- pallets/dmp-queue/src/lib.rs | 4 ---- pallets/dmp-queue/src/migration.rs | 2 +- pallets/parachain-system/src/lib.rs | 4 ---- pallets/parachain-system/src/migration.rs | 2 +- pallets/xcmp-queue/src/lib.rs | 4 ---- pallets/xcmp-queue/src/migration.rs | 2 +- 6 files changed, 3 insertions(+), 15 deletions(-) diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index 082fceaf14c..3b5f1a4faa4 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -139,10 +139,6 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_runtime_upgrade() -> Weight { - migration::migrate_to_latest::() - } - fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight { // on_idle processes additional messages with any remaining block weight. Self::service_queue(max_weight) diff --git a/pallets/dmp-queue/src/migration.rs b/pallets/dmp-queue/src/migration.rs index c98359bd9f0..fec84beb45a 100644 --- a/pallets/dmp-queue/src/migration.rs +++ b/pallets/dmp-queue/src/migration.rs @@ -28,7 +28,7 @@ pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); /// Migrates the pallet storage to the most recent version, checking and setting the /// `StorageVersion`. -pub fn migrate_to_latest() -> Weight { +fn migrate_to_latest() -> Weight { let mut weight = T::DbWeight::get().reads(1); if StorageVersion::get::>() == 0 { diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index 333e27eef2e..d746e8644f3 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -197,10 +197,6 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_runtime_upgrade() -> Weight { - migration::on_runtime_upgrade::() - } - fn on_finalize(_: T::BlockNumber) { >::kill(); >::kill(); diff --git a/pallets/parachain-system/src/migration.rs b/pallets/parachain-system/src/migration.rs index f9ef9b720cf..0085bdaf4ba 100644 --- a/pallets/parachain-system/src/migration.rs +++ b/pallets/parachain-system/src/migration.rs @@ -25,7 +25,7 @@ use frame_support::{ pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); /// Call this during the next runtime upgrade for this module. -pub fn on_runtime_upgrade() -> Weight { +fn on_runtime_upgrade() -> Weight { let mut weight: Weight = T::DbWeight::get().reads(2); if StorageVersion::get::>() == 0 { diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index 0dc76aa80a1..f4ef4ffb813 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -115,10 +115,6 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_runtime_upgrade() -> Weight { - migration::migrate_to_latest::() - } - fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight { // on_idle processes additional messages with any remaining block weight. Self::service_xcmp_queue(max_weight) diff --git a/pallets/xcmp-queue/src/migration.rs b/pallets/xcmp-queue/src/migration.rs index 9839fec296f..07c69496f8b 100644 --- a/pallets/xcmp-queue/src/migration.rs +++ b/pallets/xcmp-queue/src/migration.rs @@ -28,7 +28,7 @@ pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); /// Migrates the pallet storage to the most recent version, checking and setting the /// `StorageVersion`. -pub fn migrate_to_latest() -> Weight { +fn migrate_to_latest() -> Weight { let mut weight = T::DbWeight::get().reads(1); if StorageVersion::get::>() == 1 { From af04ad24f3aaeeeee06a22adf09d359ba5b3535f Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 12 May 2023 23:14:07 +0200 Subject: [PATCH 3/9] remove upgrade_fn / add doc to Migration struct --- pallets/dmp-queue/src/migration.rs | 38 ++++++++++----------- pallets/parachain-system/src/migration.rs | 41 +++++++++++------------ pallets/xcmp-queue/src/migration.rs | 38 ++++++++++----------- 3 files changed, 53 insertions(+), 64 deletions(-) diff --git a/pallets/dmp-queue/src/migration.rs b/pallets/dmp-queue/src/migration.rs index fec84beb45a..b2323f6a60f 100644 --- a/pallets/dmp-queue/src/migration.rs +++ b/pallets/dmp-queue/src/migration.rs @@ -26,30 +26,26 @@ use frame_support::{ /// The current storage version. pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); -/// Migrates the pallet storage to the most recent version, checking and setting the -/// `StorageVersion`. -fn migrate_to_latest() -> Weight { - let mut weight = T::DbWeight::get().reads(1); - - if StorageVersion::get::>() == 0 { - weight.saturating_accrue(migrate_to_v1::()); - StorageVersion::new(1).put::>(); - weight.saturating_accrue(T::DbWeight::get().writes(1)); - } - - if StorageVersion::get::>() == 1 { - weight.saturating_accrue(migrate_to_v2::()); - StorageVersion::new(2).put::>(); - weight.saturating_accrue(T::DbWeight::get().writes(1)); - } - - weight -} - +/// Migrates the pallet storage to the most recent version. pub struct Migration(PhantomData); + impl OnRuntimeUpgrade for Migration { fn on_runtime_upgrade() -> Weight { - migrate_to_latest::() + let mut weight = T::DbWeight::get().reads(1); + + if StorageVersion::get::>() == 0 { + weight.saturating_accrue(migrate_to_v1::()); + StorageVersion::new(1).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); + } + + if StorageVersion::get::>() == 1 { + weight.saturating_accrue(migrate_to_v2::()); + StorageVersion::new(2).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); + } + + weight } } diff --git a/pallets/parachain-system/src/migration.rs b/pallets/parachain-system/src/migration.rs index 0085bdaf4ba..5e0b6fd93cd 100644 --- a/pallets/parachain-system/src/migration.rs +++ b/pallets/parachain-system/src/migration.rs @@ -24,31 +24,28 @@ use frame_support::{ /// The current storage version. pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); -/// Call this during the next runtime upgrade for this module. -fn on_runtime_upgrade() -> Weight { - let mut weight: Weight = T::DbWeight::get().reads(2); - - if StorageVersion::get::>() == 0 { - weight = weight - .saturating_add(v1::migrate::()) - .saturating_add(T::DbWeight::get().writes(1)); - StorageVersion::new(1).put::>(); - } - - if StorageVersion::get::>() == 1 { - weight = weight - .saturating_add(v2::migrate::()) - .saturating_add(T::DbWeight::get().writes(1)); - STORAGE_VERSION.put::>(); - } - - weight -} - +/// Migrates the pallet storage to the most recent version. pub struct Migration(PhantomData); + impl OnRuntimeUpgrade for Migration { fn on_runtime_upgrade() -> Weight { - on_runtime_upgrade::() + let mut weight: Weight = T::DbWeight::get().reads(2); + + if StorageVersion::get::>() == 0 { + weight = weight + .saturating_add(v1::migrate::()) + .saturating_add(T::DbWeight::get().writes(1)); + StorageVersion::new(1).put::>(); + } + + if StorageVersion::get::>() == 1 { + weight = weight + .saturating_add(v2::migrate::()) + .saturating_add(T::DbWeight::get().writes(1)); + STORAGE_VERSION.put::>(); + } + + weight } } diff --git a/pallets/xcmp-queue/src/migration.rs b/pallets/xcmp-queue/src/migration.rs index 07c69496f8b..bda54620cd9 100644 --- a/pallets/xcmp-queue/src/migration.rs +++ b/pallets/xcmp-queue/src/migration.rs @@ -26,30 +26,26 @@ use frame_support::{ /// The current storage version. pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); -/// Migrates the pallet storage to the most recent version, checking and setting the -/// `StorageVersion`. -fn migrate_to_latest() -> Weight { - let mut weight = T::DbWeight::get().reads(1); - - if StorageVersion::get::>() == 1 { - weight.saturating_accrue(migrate_to_v2::()); - StorageVersion::new(2).put::>(); - weight.saturating_accrue(T::DbWeight::get().writes(1)); - } - - if StorageVersion::get::>() == 2 { - weight.saturating_accrue(migrate_to_v3::()); - StorageVersion::new(3).put::>(); - weight.saturating_accrue(T::DbWeight::get().writes(1)); - } - - weight -} - +/// Migrates the pallet storage to the most recent version. pub struct Migration(PhantomData); + impl OnRuntimeUpgrade for Migration { fn on_runtime_upgrade() -> Weight { - migrate_to_latest::() + let mut weight = T::DbWeight::get().reads(1); + + if StorageVersion::get::>() == 1 { + weight.saturating_accrue(migrate_to_v2::()); + StorageVersion::new(2).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); + } + + if StorageVersion::get::>() == 2 { + weight.saturating_accrue(migrate_to_v3::()); + StorageVersion::new(3).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); + } + + weight } } From 43f2a5ed972561ddf8af96044514cf23c4022be5 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 15 May 2023 13:45:05 +0200 Subject: [PATCH 4/9] Add cumulus_pallet_*::migration to Migrations type --- parachain-template/runtime/src/lib.rs | 6 ++++++ parachains/runtimes/assets/statemine/src/lib.rs | 6 +++++- parachains/runtimes/assets/statemint/src/lib.rs | 6 +++++- parachains/runtimes/assets/westmint/src/lib.rs | 7 ++++++- .../runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs | 7 +++++++ .../runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs | 7 +++++++ .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 7 +++++++ .../runtimes/collectives/collectives-polkadot/src/lib.rs | 7 ++++++- parachains/runtimes/contracts/contracts-rococo/src/lib.rs | 4 ++-- parachains/runtimes/testing/penpal/src/lib.rs | 8 ++++++-- 10 files changed, 57 insertions(+), 8 deletions(-) diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 7a847fc5118..03a54865fe9 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -113,6 +113,12 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type Migrations = ( + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, +); + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, diff --git a/parachains/runtimes/assets/statemine/src/lib.rs b/parachains/runtimes/assets/statemine/src/lib.rs index eacd865200b..561346f38fe 100644 --- a/parachains/runtimes/assets/statemine/src/lib.rs +++ b/parachains/runtimes/assets/statemine/src/lib.rs @@ -768,7 +768,11 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (); +pub type Migrations = ( + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/parachains/runtimes/assets/statemint/src/lib.rs b/parachains/runtimes/assets/statemint/src/lib.rs index b697a7902a7..1e248f83c14 100644 --- a/parachains/runtimes/assets/statemint/src/lib.rs +++ b/parachains/runtimes/assets/statemint/src/lib.rs @@ -674,7 +674,11 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (); +pub type Migrations = ( + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, + cumulus_pallet_xcm::migration::Migration, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index d5ac6103d97..21884fece3c 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -736,7 +736,12 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (pallet_nfts::migration::v1::MigrateToV1,); +pub type Migrations = ( + pallet_nfts::migration::v1::MigrateToV1, + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index ec9d9f09e41..e2208a0f858 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -108,6 +108,12 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type Migrations = ( + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, +); + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -115,6 +121,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + Migrations, >; impl_opaque_keys! { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs index b701645ed17..a562ab7743d 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -108,6 +108,12 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type Migrations = ( + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, +); + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -115,6 +121,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + Migrations, >; impl_opaque_keys! { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 15e34472fc6..b607ed68eb5 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -127,6 +127,12 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type Migrations = ( + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, +); + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -134,6 +140,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + Migrations, >; impl_opaque_keys! { diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index b902e694a15..45efe82fcdb 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -627,7 +627,12 @@ pub type UncheckedExtrinsic = pub type CheckedExtrinsic = generic::CheckedExtrinsic; // All migrations executed on runtime upgrade as a nested tuple of types implementing // `OnRuntimeUpgrade`. Included migrations must be idempotent. -type Migrations = import_kusama_fellowship::Migration; +type Migrations = ( + import_kusama_fellowship::Migration, + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_dmp_queue::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 386819ac0c0..44563708f45 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -98,13 +98,13 @@ pub type UncheckedExtrinsic = pub type CheckedExtrinsic = generic::CheckedExtrinsic; pub type Migrations = ( + cumulus_pallet_dmp_queue::migration::Migration, cumulus_pallet_parachain_system::migration::Migration, cumulus_pallet_xcmp_queue::migration::Migration, pallet_balances::migration::MigrateToTrackInactive, - pallet_multisig::migrations::v1::MigrateToV1, pallet_contracts::Migration, + pallet_multisig::migrations::v1::MigrateToV1, pallet_xcm::migration::v1::MigrateToV1, - cumulus_pallet_dmp_queue::migration::Migration, ); type EventRecord = frame_system::EventRecord< diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index 0158f3b336f..03ce6be945c 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -126,8 +126,12 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; -pub type Migrations = - (pallet_balances::migration::MigrateToTrackInactive,); +pub type Migrations = ( + pallet_balances::migration::MigrateToTrackInactive, + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_parachain_system::migration::Migration, + cumulus_pallet_xcmp_queue::migration::Migration, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< From 1252054af1f2eaa591bf18fd9c0140e2efa1e082 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 15 May 2023 13:48:49 +0200 Subject: [PATCH 5/9] add docstring --- parachain-template/runtime/src/lib.rs | 1 + parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs | 1 + parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs | 1 + parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 1 + parachains/runtimes/contracts/contracts-rococo/src/lib.rs | 1 + parachains/runtimes/testing/penpal/src/lib.rs | 1 + 6 files changed, 6 insertions(+) diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 03a54865fe9..9bf130edf80 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -113,6 +113,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. pub type Migrations = ( cumulus_pallet_parachain_system::migration::Migration, cumulus_pallet_xcmp_queue::migration::Migration, diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index e2208a0f858..dd271fe8c63 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -108,6 +108,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. pub type Migrations = ( cumulus_pallet_parachain_system::migration::Migration, cumulus_pallet_xcmp_queue::migration::Migration, diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs index a562ab7743d..d1efa82df7e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -108,6 +108,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. pub type Migrations = ( cumulus_pallet_parachain_system::migration::Migration, cumulus_pallet_xcmp_queue::migration::Migration, diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index b607ed68eb5..6d258290e2d 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -127,6 +127,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. pub type Migrations = ( cumulus_pallet_parachain_system::migration::Migration, cumulus_pallet_xcmp_queue::migration::Migration, diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 44563708f45..ccf259d4a5f 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -97,6 +97,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. pub type Migrations = ( cumulus_pallet_dmp_queue::migration::Migration, cumulus_pallet_parachain_system::migration::Migration, diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index 03ce6be945c..0679495c9d2 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -126,6 +126,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. pub type Migrations = ( pallet_balances::migration::MigrateToTrackInactive, cumulus_pallet_parachain_system::migration::Migration, From e9cee7f3b2285a5282e09ee91a35dac9a2f74765 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 15 May 2023 14:03:32 +0200 Subject: [PATCH 6/9] fix --- parachains/runtimes/assets/statemint/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parachains/runtimes/assets/statemint/src/lib.rs b/parachains/runtimes/assets/statemint/src/lib.rs index 1e248f83c14..fe2eb73606e 100644 --- a/parachains/runtimes/assets/statemint/src/lib.rs +++ b/parachains/runtimes/assets/statemint/src/lib.rs @@ -676,8 +676,8 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic, + cumulus_pallet_xcmp_queue::migration::Migration, cumulus_pallet_dmp_queue::migration::Migration, - cumulus_pallet_xcm::migration::Migration, ); /// Executive: handles dispatch to the various modules. From b8e507e55a4898505e933c7b478486d624dae9e1 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 30 May 2023 09:33:13 +0200 Subject: [PATCH 7/9] Update parachain-template/runtime/src/lib.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- parachain-template/runtime/src/lib.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 48b10e9356f..b87445826a1 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -113,13 +113,6 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; -/// Migrations to apply on runtime upgrade. -pub type Migrations = ( - cumulus_pallet_parachain_system::migration::Migration, - cumulus_pallet_xcmp_queue::migration::Migration, - cumulus_pallet_dmp_queue::migration::Migration, -); - /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, From 15c18b66be748801c16d3c9ad37954e5b0b0fe72 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 30 May 2023 09:34:35 +0200 Subject: [PATCH 8/9] Update parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs --- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index d17781ad80f..ef645b93b55 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -125,13 +125,6 @@ pub type UncheckedExtrinsic = /// Migrations to apply on runtime upgrade. pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); -/// Migrations to apply on runtime upgrade. -pub type Migrations = ( - cumulus_pallet_parachain_system::migration::Migration, - cumulus_pallet_xcmp_queue::migration::Migration, - cumulus_pallet_dmp_queue::migration::Migration, -); - /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, From 40c1cb2d7466ee7eacda573f628b18e456215d96 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 30 May 2023 09:36:41 +0200 Subject: [PATCH 9/9] Update pallets/parachain-system/src/migration.rs --- pallets/parachain-system/src/migration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/parachain-system/src/migration.rs b/pallets/parachain-system/src/migration.rs index 5e0b6fd93cd..17dce3a11a9 100644 --- a/pallets/parachain-system/src/migration.rs +++ b/pallets/parachain-system/src/migration.rs @@ -42,7 +42,7 @@ impl OnRuntimeUpgrade for Migration { weight = weight .saturating_add(v2::migrate::()) .saturating_add(T::DbWeight::get().writes(1)); - STORAGE_VERSION.put::>(); + StorageVersion::new(2).put::>(); } weight