Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes already applied migrations #118

Merged
merged 13 commits into from
Jan 5, 2024
85 changes: 1 addition & 84 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, Get,
fungible::HoldConsideration, ConstU32, EitherOf, EitherOfDiverse, Get,
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
ProcessMessageError, WithdrawReasons,
},
Expand Down Expand Up @@ -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<Runtime>;
type DbWeight = <Runtime as frame_system::Config>::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 = <Runtime as frame_system::Config>::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<Runtime>;
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
type PalletName = TipsPalletName;
}

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

pub struct ParachainsToUnlock;
impl Contains<ParaId> 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<Runtime>,
parachains_configuration::migration::v7::MigrateToV7<Runtime>,
parachains_configuration::migration::v8::MigrateToV8<Runtime>,

// Gov v1 storage migrations
// https://github.com/paritytech/polkadot/issues/6749
pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
pallet_tips::migrations::unreserve_deposits::UnreserveDeposits<UnlockConfig, ()>,

// Delete all Gov v1 pallet storage key/values.
frame_support::migrations::RemovePallet<DemocracyPalletName, <Runtime as frame_system::Config>::DbWeight>,
frame_support::migrations::RemovePallet<CouncilPalletName, <Runtime as frame_system::Config>::DbWeight>,
frame_support::migrations::RemovePallet<TechnicalCommitteePalletName, <Runtime as frame_system::Config>::DbWeight>,
frame_support::migrations::RemovePallet<PhragmenElectionPalletName, <Runtime as frame_system::Config>::DbWeight>,
frame_support::migrations::RemovePallet<TechnicalMembershipPalletName, <Runtime as frame_system::Config>::DbWeight>,
frame_support::migrations::RemovePallet<TipsPalletName, <Runtime as frame_system::Config>::DbWeight>,

parachains_configuration::migration::v9::MigrateToV9<Runtime>,
// Migrate parachain info format
paras_registrar::migration::VersionCheckedMigrateToV1<Runtime, ParachainsToUnlock>,

// Upgrade SessionKeys to include BEEFY key
UpgradeSessionKeys,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an issue to track the removal of this in the next release so we don't forget?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we don't have an issue for this, but in the fellowship repo we can just remove always all the migrations.


pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>,
pallet_nomination_pools::migration::versioned_migrations::V6ToV7<Runtime>,

runtime_parachains::scheduler::migration::v1::MigrateToV1<Runtime>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how to check if this was already run on-chain, but I see it was added here after the last release:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added after the release, to switch back to the fixed upstream one. However, I had included the fixed upstream migration directly in this repo here: https://github.com/polkadot-fellows/runtimes/pull/26/files#diff-efa4caeb17487ecb13d8f5eb7863c3241d84afa2e73fbf25909a2ca89df0f362R1739

);
}

Expand Down
6 changes: 1 addition & 5 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,11 +909,7 @@ pub type SignedExtra = (
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Migrations to apply on runtime upgrade.
pub type Migrations = (
pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,
pallet_multisig::migrations::v1::MigrateToV1<Runtime>,
InitStorageVersions,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also remove struct InitStorageVersions defined and implemented below

(same for other system paras)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

);
pub type Migrations = ();

/// Migration to initialize storage versions for pallets added after genesis.
///
Expand Down
3 changes: 1 addition & 2 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,7 @@ pub type SignedExtra = (
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Migrations to apply on runtime upgrade.
pub type Migrations =
(pallet_collator_selection::migration::v1::MigrateToV1<Runtime>, InitStorageVersions);
pub type Migrations = ();

/// Migration to initialize storage versions for pallets added after genesis.
///
Expand Down
3 changes: 1 addition & 2 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

/// Migrations to apply on runtime upgrade.
pub type Migrations =
(pallet_collator_selection::migration::v1::MigrateToV1<Runtime>, InitStorageVersions);
pub type Migrations = ();

/// Migration to initialize storage versions for pallets added after genesis.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

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

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,7 @@ pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// 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<Runtime>,
InitStorageVersions,
);
type Migrations = ();

/// Migration to initialize storage versions for pallets added after genesis.
///
Expand Down
Loading