-
Notifications
You must be signed in to change notification settings - Fork 101
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
Changes from 8 commits
4056dc1
b900d75
dd23159
71a0af4
b4e8bd9
a4d1504
3334957
fb34ebc
39e40f5
3005a97
89d3471
3bf86dc
96dc830
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<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`. | ||
|
@@ -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, | ||
|
||
pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>, | ||
pallet_nomination_pools::migration::versioned_migrations::V6ToV7<Runtime>, | ||
|
||
runtime_parachains::scheduler::migration::v1::MigrateToV1<Runtime> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -909,50 +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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe also remove (same for other system paras) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
); | ||
|
||
/// Migration to initialize storage versions for pallets added after genesis. | ||
/// | ||
/// Ideally this would be done automatically (see | ||
/// <https://github.com/paritytech/polkadot-sdk/pull/1297>), but it probably won't be ready for some | ||
/// time and it's beneficial to get storage version issues smoothed over before merging | ||
/// <https://github.com/polkadot-fellows/runtimes/pull/28> 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::<PolkadotXcm>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
if Nfts::on_chain_storage_version() == StorageVersion::new(0) { | ||
Nfts::current_storage_version().put::<Nfts>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { | ||
ForeignAssets::current_storage_version().put::<ForeignAssets>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) { | ||
PoolAssets::current_storage_version().put::<PoolAssets>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(4, writes) | ||
} | ||
} | ||
pub type Migrations = (); | ||
|
||
/// Executive: handles dispatch to the various modules. | ||
pub type Executive = frame_executive::Executive< | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ use frame_support::{ | |
parameter_types, | ||
traits::{ | ||
AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, | ||
InstanceFilter, | ||
InstanceFilter, OnRuntimeUpgrade, | ||
}, | ||
weights::{ConstantMultiplier, Weight}, | ||
PalletId, | ||
|
@@ -817,49 +817,14 @@ 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); | ||
frame_support::migrations::VersionedMigration<0, 1, UniquesMigration, Uniques, RocksDbWeight>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No this init was never executed on chain. This was the reason the CI was failing for this pr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder why it was not, I can see it here - https://github.com/polkadot-fellows/runtimes/blob/v1.0.0/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs#L799 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes the migration was there. But the init of Uniques was added here: https://github.com/polkadot-fellows/runtimes/pull/87/files#diff-2dc481414ffabfb3b0b2c24f3c0cfc8a8b3ed6b56689a696d02be635795f5cb6R857 |
||
|
||
/// Migration to initialize storage versions for pallets added after genesis. | ||
/// | ||
/// Ideally this would be done automatically (see | ||
/// <https://github.com/paritytech/polkadot-sdk/pull/1297>), but it probably won't be ready for some | ||
/// time and it's beneficial to get storage version issues smoothed over before merging | ||
/// <https://github.com/polkadot-fellows/runtimes/pull/28> 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::<Multisig>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { | ||
PolkadotXcm::current_storage_version().put::<PolkadotXcm>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
if Nfts::on_chain_storage_version() == StorageVersion::new(0) { | ||
Nfts::current_storage_version().put::<Nfts>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { | ||
ForeignAssets::current_storage_version().put::<ForeignAssets>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
if Uniques::on_chain_storage_version() == StorageVersion::new(0) { | ||
Uniques::current_storage_version().put::<Uniques>(); | ||
writes.saturating_inc(); | ||
} | ||
|
||
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(4, writes) | ||
pallet_uniques::migration::migrate_to_v1::<Runtime, (), pallet_uniques::Pallet<Runtime>>() | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.