Skip to content

Commit 3caec69

Browse files
authored
Removes already applied migrations (polkadot-fellows#118)
1 parent 101882e commit 3caec69

File tree

6 files changed

+13
-247
lines changed
  • relay/polkadot/src
  • system-parachains
    • asset-hubs
    • bridge-hubs
    • collectives/collectives-polkadot/src

6 files changed

+13
-247
lines changed

relay/polkadot/src/lib.rs

Lines changed: 3 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ use frame_support::{
5757
genesis_builder_helper::{build_config, create_default_config},
5858
parameter_types,
5959
traits::{
60-
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, Get,
61-
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
62-
ProcessMessageError, WithdrawReasons,
60+
fungible::HoldConsideration, ConstU32, EitherOf, EitherOfDiverse, Get, InstanceFilter,
61+
KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError,
62+
WithdrawReasons,
6363
},
6464
weights::{ConstantMultiplier, WeightMeter},
6565
PalletId,
@@ -1688,51 +1688,6 @@ pub type Migrations = migrations::Unreleased;
16881688
#[allow(deprecated, missing_docs)]
16891689
pub mod migrations {
16901690
use super::*;
1691-
use frame_support::traits::LockIdentifier;
1692-
use frame_system::pallet_prelude::BlockNumberFor;
1693-
1694-
parameter_types! {
1695-
pub const DemocracyPalletName: &'static str = "Democracy";
1696-
pub const CouncilPalletName: &'static str = "Council";
1697-
pub const TechnicalCommitteePalletName: &'static str = "TechnicalCommittee";
1698-
pub const PhragmenElectionPalletName: &'static str = "PhragmenElection";
1699-
pub const TechnicalMembershipPalletName: &'static str = "TechnicalMembership";
1700-
pub const TipsPalletName: &'static str = "Tips";
1701-
pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect";
1702-
}
1703-
1704-
// Special Config for Gov V1 pallets, allowing us to run migrations for them without
1705-
// implementing their configs on [`Runtime`].
1706-
pub struct UnlockConfig;
1707-
impl pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockConfig for UnlockConfig {
1708-
type Currency = Balances;
1709-
type MaxVotes = ConstU32<100>;
1710-
type MaxDeposits = ConstU32<100>;
1711-
type AccountId = AccountId;
1712-
type BlockNumber = BlockNumberFor<Runtime>;
1713-
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
1714-
type PalletName = DemocracyPalletName;
1715-
}
1716-
impl pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockConfig
1717-
for UnlockConfig
1718-
{
1719-
type Currency = Balances;
1720-
type MaxVotesPerVoter = ConstU32<16>;
1721-
type PalletId = PhragmenElectionPalletId;
1722-
type AccountId = AccountId;
1723-
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
1724-
type PalletName = PhragmenElectionPalletName;
1725-
}
1726-
impl pallet_tips::migrations::unreserve_deposits::UnlockConfig<()> for UnlockConfig {
1727-
type Currency = Balances;
1728-
type Hash = Hash;
1729-
type DataDepositPerByte = DataDepositPerByte;
1730-
type TipReportDepositBase = TipReportDepositBase;
1731-
type AccountId = AccountId;
1732-
type BlockNumber = BlockNumberFor<Runtime>;
1733-
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
1734-
type PalletName = TipsPalletName;
1735-
}
17361691

17371692
/// Upgrade Session keys to include BEEFY key.
17381693
/// When this is removed, should also remove `OldSessionKeys`.
@@ -1744,50 +1699,12 @@ pub mod migrations {
17441699
}
17451700
}
17461701

1747-
pub struct ParachainsToUnlock;
1748-
impl Contains<ParaId> for ParachainsToUnlock {
1749-
fn contains(id: &ParaId) -> bool {
1750-
let id: u32 = (*id).into();
1751-
// polkadot parachains/parathreads that are locked and never produced block
1752-
match id {
1753-
2003 | 2015 | 2017 | 2018 | 2025 | 2028 | 2036 | 2038 | 2053 | 2055 | 2090 |
1754-
2097 | 2106 | 3336 | 3338 | 3342 => true,
1755-
_ => false,
1756-
}
1757-
}
1758-
}
1759-
17601702
/// Unreleased migrations. Add new ones here:
17611703
pub type Unreleased = (
1762-
pallet_im_online::migration::v1::Migration<Runtime>,
1763-
parachains_configuration::migration::v7::MigrateToV7<Runtime>,
1764-
parachains_configuration::migration::v8::MigrateToV8<Runtime>,
1765-
1766-
// Gov v1 storage migrations
1767-
// https://github.com/paritytech/polkadot/issues/6749
1768-
pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
1769-
pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
1770-
pallet_tips::migrations::unreserve_deposits::UnreserveDeposits<UnlockConfig, ()>,
1771-
1772-
// Delete all Gov v1 pallet storage key/values.
1773-
frame_support::migrations::RemovePallet<DemocracyPalletName, <Runtime as frame_system::Config>::DbWeight>,
1774-
frame_support::migrations::RemovePallet<CouncilPalletName, <Runtime as frame_system::Config>::DbWeight>,
1775-
frame_support::migrations::RemovePallet<TechnicalCommitteePalletName, <Runtime as frame_system::Config>::DbWeight>,
1776-
frame_support::migrations::RemovePallet<PhragmenElectionPalletName, <Runtime as frame_system::Config>::DbWeight>,
1777-
frame_support::migrations::RemovePallet<TechnicalMembershipPalletName, <Runtime as frame_system::Config>::DbWeight>,
1778-
frame_support::migrations::RemovePallet<TipsPalletName, <Runtime as frame_system::Config>::DbWeight>,
1779-
1780-
parachains_configuration::migration::v9::MigrateToV9<Runtime>,
1781-
// Migrate parachain info format
1782-
paras_registrar::migration::VersionCheckedMigrateToV1<Runtime, ParachainsToUnlock>,
1783-
17841704
// Upgrade SessionKeys to include BEEFY key
17851705
UpgradeSessionKeys,
1786-
17871706
pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>,
17881707
pallet_nomination_pools::migration::versioned_migrations::V6ToV7<Runtime>,
1789-
1790-
runtime_parachains::scheduler::migration::v1::MigrateToV1<Runtime>
17911708
);
17921709
}
17931710

system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -910,50 +910,7 @@ pub type SignedExtra = (
910910
pub type UncheckedExtrinsic =
911911
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
912912
/// Migrations to apply on runtime upgrade.
913-
pub type Migrations = (
914-
pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,
915-
pallet_multisig::migrations::v1::MigrateToV1<Runtime>,
916-
InitStorageVersions,
917-
);
918-
919-
/// Migration to initialize storage versions for pallets added after genesis.
920-
///
921-
/// Ideally this would be done automatically (see
922-
/// <https://github.com/paritytech/polkadot-sdk/pull/1297>), but it probably won't be ready for some
923-
/// time and it's beneficial to get storage version issues smoothed over before merging
924-
/// <https://github.com/polkadot-fellows/runtimes/pull/28> so we're just setting them manually.
925-
pub struct InitStorageVersions;
926-
927-
impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions {
928-
fn on_runtime_upgrade() -> Weight {
929-
use frame_support::traits::{GetStorageVersion, StorageVersion};
930-
use sp_runtime::traits::Saturating;
931-
932-
let mut writes = 0;
933-
934-
if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) {
935-
PolkadotXcm::current_storage_version().put::<PolkadotXcm>();
936-
writes.saturating_inc();
937-
}
938-
939-
if Nfts::on_chain_storage_version() == StorageVersion::new(0) {
940-
Nfts::current_storage_version().put::<Nfts>();
941-
writes.saturating_inc();
942-
}
943-
944-
if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) {
945-
ForeignAssets::current_storage_version().put::<ForeignAssets>();
946-
writes.saturating_inc();
947-
}
948-
949-
if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) {
950-
PoolAssets::current_storage_version().put::<PoolAssets>();
951-
writes.saturating_inc();
952-
}
953-
954-
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(4, writes)
955-
}
956-
}
913+
pub type Migrations = ();
957914

958915
/// Executive: handles dispatch to the various modules.
959916
pub type Executive = frame_executive::Executive<

system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ use frame_support::{
8888
parameter_types,
8989
traits::{
9090
AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
91-
InstanceFilter,
91+
InstanceFilter, OnRuntimeUpgrade,
9292
},
9393
weights::{ConstantMultiplier, Weight},
9494
PalletId,
@@ -820,49 +820,14 @@ pub type UncheckedExtrinsic =
820820
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
821821
/// Migrations to apply on runtime upgrade.
822822
pub type Migrations =
823-
(pallet_collator_selection::migration::v1::MigrateToV1<Runtime>, InitStorageVersions);
823+
frame_support::migrations::VersionedMigration<0, 1, UniquesMigration, Uniques, RocksDbWeight>;
824824

825-
/// Migration to initialize storage versions for pallets added after genesis.
826-
///
827-
/// Ideally this would be done automatically (see
828-
/// <https://github.com/paritytech/polkadot-sdk/pull/1297>), but it probably won't be ready for some
829-
/// time and it's beneficial to get storage version issues smoothed over before merging
830-
/// <https://github.com/polkadot-fellows/runtimes/pull/28> so we're just setting them manually.
831-
pub struct InitStorageVersions;
825+
/// Migration for Uniques to V1
826+
pub struct UniquesMigration;
832827

833-
impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions {
828+
impl OnRuntimeUpgrade for UniquesMigration {
834829
fn on_runtime_upgrade() -> Weight {
835-
use frame_support::traits::{GetStorageVersion, StorageVersion};
836-
use sp_runtime::traits::Saturating;
837-
838-
let mut writes = 0;
839-
840-
if Multisig::on_chain_storage_version() == StorageVersion::new(0) {
841-
Multisig::current_storage_version().put::<Multisig>();
842-
writes.saturating_inc();
843-
}
844-
845-
if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) {
846-
PolkadotXcm::current_storage_version().put::<PolkadotXcm>();
847-
writes.saturating_inc();
848-
}
849-
850-
if Nfts::on_chain_storage_version() == StorageVersion::new(0) {
851-
Nfts::current_storage_version().put::<Nfts>();
852-
writes.saturating_inc();
853-
}
854-
855-
if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) {
856-
ForeignAssets::current_storage_version().put::<ForeignAssets>();
857-
writes.saturating_inc();
858-
}
859-
860-
if Uniques::on_chain_storage_version() == StorageVersion::new(0) {
861-
Uniques::current_storage_version().put::<Uniques>();
862-
writes.saturating_inc();
863-
}
864-
865-
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(4, writes)
830+
pallet_uniques::migration::migrate_to_v1::<Runtime, (), pallet_uniques::Pallet<Runtime>>()
866831
}
867832
}
868833

system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -108,32 +108,7 @@ pub type UncheckedExtrinsic =
108108
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
109109

110110
/// Migrations to apply on runtime upgrade.
111-
pub type Migrations =
112-
(pallet_collator_selection::migration::v1::MigrateToV1<Runtime>, InitStorageVersions);
113-
114-
/// Migration to initialize storage versions for pallets added after genesis.
115-
///
116-
/// Ideally this would be done automatically (see
117-
/// <https://github.com/paritytech/polkadot-sdk/pull/1297>), but it probably won't be ready for some
118-
/// time and it's beneficial to get storage version issues smoothed over before merging
119-
/// <https://github.com/polkadot-fellows/runtimes/pull/28> so we're just setting them manually.
120-
pub struct InitStorageVersions;
121-
122-
impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions {
123-
fn on_runtime_upgrade() -> Weight {
124-
use frame_support::traits::{GetStorageVersion, StorageVersion};
125-
use sp_runtime::traits::Saturating;
126-
127-
let mut writes = 0;
128-
129-
if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) {
130-
PolkadotXcm::current_storage_version().put::<PolkadotXcm>();
131-
writes.saturating_inc();
132-
}
133-
134-
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(1, writes)
135-
}
136-
}
111+
pub type Migrations = ();
137112

138113
/// Executive: handles dispatch to the various modules.
139114
pub type Executive = frame_executive::Executive<

system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub type UncheckedExtrinsic =
108108
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
109109

110110
/// Migrations to apply on runtime upgrade.
111-
pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,);
111+
pub type Migrations = ();
112112

113113
/// Executive: handles dispatch to the various modules.
114114
pub type Executive = frame_executive::Executive<

system-parachains/collectives/collectives-polkadot/src/lib.rs

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -683,55 +683,7 @@ pub type UncheckedExtrinsic =
683683
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
684684
/// All migrations executed on runtime upgrade as a nested tuple of types implementing
685685
/// `OnRuntimeUpgrade`. Included migrations must be idempotent.
686-
type Migrations = (
687-
// unreleased
688-
pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,
689-
InitStorageVersions,
690-
);
691-
692-
/// Migration to initialize storage versions for pallets added after genesis.
693-
///
694-
/// Ideally this would be done automatically (see
695-
/// <https://github.com/paritytech/polkadot-sdk/pull/1297>), but it probably won't be ready for some
696-
/// time and it's beneficial to get storage version issues smoothed over before merging
697-
/// <https://github.com/polkadot-fellows/runtimes/pull/28> so we're just setting them manually.
698-
pub struct InitStorageVersions;
699-
700-
impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions {
701-
fn on_runtime_upgrade() -> Weight {
702-
use frame_support::traits::{GetStorageVersion, StorageVersion};
703-
use sp_runtime::traits::Saturating;
704-
705-
let mut writes = 0;
706-
707-
if Multisig::on_chain_storage_version() == StorageVersion::new(0) {
708-
Multisig::current_storage_version().put::<Multisig>();
709-
writes.saturating_inc();
710-
}
711-
712-
if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) {
713-
PolkadotXcm::current_storage_version().put::<PolkadotXcm>();
714-
writes.saturating_inc();
715-
}
716-
717-
if Preimage::on_chain_storage_version() == StorageVersion::new(0) {
718-
Preimage::current_storage_version().put::<Preimage>();
719-
writes.saturating_inc();
720-
}
721-
722-
if Scheduler::on_chain_storage_version() == StorageVersion::new(0) {
723-
Scheduler::current_storage_version().put::<Scheduler>();
724-
writes.saturating_inc();
725-
}
726-
727-
if FellowshipReferenda::on_chain_storage_version() == StorageVersion::new(0) {
728-
FellowshipReferenda::current_storage_version().put::<FellowshipReferenda>();
729-
writes.saturating_inc();
730-
}
731-
732-
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(5, writes)
733-
}
734-
}
686+
type Migrations = ();
735687

736688
/// Executive: handles dispatch to the various modules.
737689
pub type Executive = frame_executive::Executive<

0 commit comments

Comments
 (0)