diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 03ed0a78cb..4fd2d286fc 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -57,9 +57,9 @@ use frame_support::{ genesis_builder_helper::{build_config, create_default_config}, parameter_types, traits::{ - fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, Get, - InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, - ProcessMessageError, WithdrawReasons, + fungible::HoldConsideration, ConstU32, EitherOf, EitherOfDiverse, Get, InstanceFilter, + KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, + WithdrawReasons, }, weights::{ConstantMultiplier, WeightMeter}, PalletId, @@ -1688,51 +1688,6 @@ pub type Migrations = migrations::Unreleased; #[allow(deprecated, missing_docs)] pub mod migrations { use super::*; - use frame_support::traits::LockIdentifier; - use frame_system::pallet_prelude::BlockNumberFor; - - parameter_types! { - pub const DemocracyPalletName: &'static str = "Democracy"; - pub const CouncilPalletName: &'static str = "Council"; - pub const TechnicalCommitteePalletName: &'static str = "TechnicalCommittee"; - pub const PhragmenElectionPalletName: &'static str = "PhragmenElection"; - pub const TechnicalMembershipPalletName: &'static str = "TechnicalMembership"; - pub const TipsPalletName: &'static str = "Tips"; - pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; - } - - // Special Config for Gov V1 pallets, allowing us to run migrations for them without - // implementing their configs on [`Runtime`]. - pub struct UnlockConfig; - impl pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockConfig for UnlockConfig { - type Currency = Balances; - type MaxVotes = ConstU32<100>; - type MaxDeposits = ConstU32<100>; - type AccountId = AccountId; - type BlockNumber = BlockNumberFor; - type DbWeight = ::DbWeight; - type PalletName = DemocracyPalletName; - } - impl pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockConfig - for UnlockConfig - { - type Currency = Balances; - type MaxVotesPerVoter = ConstU32<16>; - type PalletId = PhragmenElectionPalletId; - type AccountId = AccountId; - type DbWeight = ::DbWeight; - type PalletName = PhragmenElectionPalletName; - } - impl pallet_tips::migrations::unreserve_deposits::UnlockConfig<()> for UnlockConfig { - type Currency = Balances; - type Hash = Hash; - type DataDepositPerByte = DataDepositPerByte; - type TipReportDepositBase = TipReportDepositBase; - type AccountId = AccountId; - type BlockNumber = BlockNumberFor; - type DbWeight = ::DbWeight; - type PalletName = TipsPalletName; - } /// Upgrade Session keys to include BEEFY key. /// When this is removed, should also remove `OldSessionKeys`. @@ -1744,50 +1699,12 @@ pub mod migrations { } } - pub struct ParachainsToUnlock; - impl Contains for ParachainsToUnlock { - fn contains(id: &ParaId) -> bool { - let id: u32 = (*id).into(); - // polkadot parachains/parathreads that are locked and never produced block - match id { - 2003 | 2015 | 2017 | 2018 | 2025 | 2028 | 2036 | 2038 | 2053 | 2055 | 2090 | - 2097 | 2106 | 3336 | 3338 | 3342 => true, - _ => false, - } - } - } - /// Unreleased migrations. Add new ones here: pub type Unreleased = ( - pallet_im_online::migration::v1::Migration, - parachains_configuration::migration::v7::MigrateToV7, - parachains_configuration::migration::v8::MigrateToV8, - - // Gov v1 storage migrations - // https://github.com/paritytech/polkadot/issues/6749 - pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds, - pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds, - pallet_tips::migrations::unreserve_deposits::UnreserveDeposits, - - // Delete all Gov v1 pallet storage key/values. - frame_support::migrations::RemovePallet::DbWeight>, - frame_support::migrations::RemovePallet::DbWeight>, - frame_support::migrations::RemovePallet::DbWeight>, - frame_support::migrations::RemovePallet::DbWeight>, - frame_support::migrations::RemovePallet::DbWeight>, - frame_support::migrations::RemovePallet::DbWeight>, - - parachains_configuration::migration::v9::MigrateToV9, - // Migrate parachain info format - paras_registrar::migration::VersionCheckedMigrateToV1, - // Upgrade SessionKeys to include BEEFY key UpgradeSessionKeys, - pallet_nomination_pools::migration::versioned_migrations::V5toV6, pallet_nomination_pools::migration::versioned_migrations::V6ToV7, - - runtime_parachains::scheduler::migration::v1::MigrateToV1 ); } diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 45baa5a16e..5c93017890 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -910,50 +910,7 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = ( - pallet_collator_selection::migration::v1::MigrateToV1, - pallet_multisig::migrations::v1::MigrateToV1, - InitStorageVersions, -); - -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get storage version issues smoothed over before merging -/// so we're just setting them manually. -pub struct InitStorageVersions; - -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { - fn on_runtime_upgrade() -> Weight { - use frame_support::traits::{GetStorageVersion, StorageVersion}; - use sp_runtime::traits::Saturating; - - let mut writes = 0; - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - PolkadotXcm::current_storage_version().put::(); - writes.saturating_inc(); - } - - if Nfts::on_chain_storage_version() == StorageVersion::new(0) { - Nfts::current_storage_version().put::(); - writes.saturating_inc(); - } - - if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { - ForeignAssets::current_storage_version().put::(); - writes.saturating_inc(); - } - - if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) { - PoolAssets::current_storage_version().put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(4, writes) - } -} +pub type Migrations = (); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index 8dc01e93e3..7bdffa19bb 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -88,7 +88,7 @@ use frame_support::{ parameter_types, traits::{ AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, - InstanceFilter, + InstanceFilter, OnRuntimeUpgrade, }, weights::{ConstantMultiplier, Weight}, PalletId, @@ -820,49 +820,14 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. pub type Migrations = - (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); + frame_support::migrations::VersionedMigration<0, 1, UniquesMigration, Uniques, RocksDbWeight>; -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get storage version issues smoothed over before merging -/// so we're just setting them manually. -pub struct InitStorageVersions; +/// Migration for Uniques to V1 +pub struct UniquesMigration; -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { +impl OnRuntimeUpgrade for UniquesMigration { fn on_runtime_upgrade() -> Weight { - use frame_support::traits::{GetStorageVersion, StorageVersion}; - use sp_runtime::traits::Saturating; - - let mut writes = 0; - - if Multisig::on_chain_storage_version() == StorageVersion::new(0) { - Multisig::current_storage_version().put::(); - writes.saturating_inc(); - } - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - PolkadotXcm::current_storage_version().put::(); - writes.saturating_inc(); - } - - if Nfts::on_chain_storage_version() == StorageVersion::new(0) { - Nfts::current_storage_version().put::(); - writes.saturating_inc(); - } - - if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { - ForeignAssets::current_storage_version().put::(); - writes.saturating_inc(); - } - - if Uniques::on_chain_storage_version() == StorageVersion::new(0) { - Uniques::current_storage_version().put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(4, writes) + pallet_uniques::migration::migrate_to_v1::>() } } diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index d8ae0d3f08..5e5f7e9e0e 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -108,32 +108,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = - (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); - -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get storage version issues smoothed over before merging -/// so we're just setting them manually. -pub struct InitStorageVersions; - -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { - fn on_runtime_upgrade() -> Weight { - use frame_support::traits::{GetStorageVersion, StorageVersion}; - use sp_runtime::traits::Saturating; - - let mut writes = 0; - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - PolkadotXcm::current_storage_version().put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(1, writes) - } -} +pub type Migrations = (); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 425cd1fe20..c18dcc3d2f 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -108,7 +108,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); +pub type Migrations = (); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 4e3d34d9eb..9e29e0a077 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -683,55 +683,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// All migrations executed on runtime upgrade as a nested tuple of types implementing /// `OnRuntimeUpgrade`. Included migrations must be idempotent. -type Migrations = ( - // unreleased - pallet_collator_selection::migration::v1::MigrateToV1, - InitStorageVersions, -); - -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get storage version issues smoothed over before merging -/// so we're just setting them manually. -pub struct InitStorageVersions; - -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { - fn on_runtime_upgrade() -> Weight { - use frame_support::traits::{GetStorageVersion, StorageVersion}; - use sp_runtime::traits::Saturating; - - let mut writes = 0; - - if Multisig::on_chain_storage_version() == StorageVersion::new(0) { - Multisig::current_storage_version().put::(); - writes.saturating_inc(); - } - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - PolkadotXcm::current_storage_version().put::(); - writes.saturating_inc(); - } - - if Preimage::on_chain_storage_version() == StorageVersion::new(0) { - Preimage::current_storage_version().put::(); - writes.saturating_inc(); - } - - if Scheduler::on_chain_storage_version() == StorageVersion::new(0) { - Scheduler::current_storage_version().put::(); - writes.saturating_inc(); - } - - if FellowshipReferenda::on_chain_storage_version() == StorageVersion::new(0) { - FellowshipReferenda::current_storage_version().put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(5, writes) - } -} +type Migrations = (); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive<