Skip to content

Commit

Permalink
Removed migrations from tag v1.1.2 (polkadot-fellows#195)
Browse files Browse the repository at this point in the history
Removed already applied migrations from release `v1.1.2`.

Relates to: polkadot-fellows#140

Patch generated from release branch
[v1.1.2](https://github.com/polkadot-fellows/runtimes/tree/v1.1.2):
```
diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs
index fd93687ad..11f299b71 100644
--- a/relay/kusama/src/lib.rs
+++ b/relay/kusama/src/lib.rs
@@ -1680,10 +1680,7 @@ pub mod migrations {
 	use super::Runtime;
 
 	/// Unreleased migrations. Add new ones here:
-	pub type Unreleased = (
-		pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>,
-		pallet_nomination_pools::migration::versioned_migrations::V6ToV7<Runtime>,
-	);
+	pub type Unreleased = ();
 }
 
 /// Unchecked extrinsic type as expected by this runtime.
diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs
index 97ce4dbd1..ea3019201 100644
--- a/relay/polkadot/src/lib.rs
+++ b/relay/polkadot/src/lib.rs
@@ -1689,23 +1689,8 @@ pub type Migrations = migrations::Unreleased;
 pub mod migrations {
 	use super::*;
 
-	/// Upgrade Session keys to include BEEFY key.
-	/// When this is removed, should also remove `OldSessionKeys`.
-	pub struct UpgradeSessionKeys;
-	impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys {
-		fn on_runtime_upgrade() -> Weight {
-			Session::upgrade_keys::<OldSessionKeys, _>(transform_session_keys);
-			Perbill::from_percent(50) * BlockWeights::get().max_block
-		}
-	}
-
 	/// Unreleased migrations. Add new ones here:
-	pub type Unreleased = (
-		// Upgrade SessionKeys to include BEEFY key
-		UpgradeSessionKeys,
-		pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>,
-		pallet_nomination_pools::migration::versioned_migrations::V6ToV7<Runtime>,
-	);
+	pub type Unreleased = ();
 }
 
 /// Unchecked extrinsic type as expected by this runtime.
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 c19c24e14..bb3e85845 100644
--- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
+++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
@@ -851,17 +851,7 @@ pub type SignedExtra = (
 pub type UncheckedExtrinsic =
 	generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
 /// Migrations to apply on runtime upgrade.
-pub type Migrations =
-	frame_support::migrations::VersionedMigration<0, 1, UniquesMigration, Uniques, RocksDbWeight>;
-
-/// Migration for Uniques to V1
-pub struct UniquesMigration;
-
-impl OnRuntimeUpgrade for UniquesMigration {
-	fn on_runtime_upgrade() -> Weight {
-		pallet_uniques::migration::migrate_to_v1::<Runtime, (), pallet_uniques::Pallet<Runtime>>()
-	}
-}
+pub type Migrations = ();
 
 /// Executive: handles dispatch to the various modules.
 pub type Executive = frame_executive::Executive<

```



<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [X] Does not require a CHANGELOG entry
  • Loading branch information
bkontur authored Feb 22, 2024
1 parent cacf8c0 commit 959b830
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 65 deletions.
2 changes: 1 addition & 1 deletion docs/removing-migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For some chain runtime `spec_version: a_bcd_efg,` (e.g. `spec_version: 1_000_001
2. Check-out **the released** code: `git checkout vX.Y.Z`,
- This is required to make sure you are not accidentally removing yet unreleased migrations (PRs merged between `X.Y.Z` release and when you are doing this).
3. Create patch with your changes: `git diff --patch > remove-migrations.patch`,
4. Now `git checkout main` and apply your patch `git am -3 remove-migrations.patch`,
4. Now `git checkout main` and apply your patch `git am -3 remove-migrations.patch` or `git apply -3 remove-migrations.patch`,
- thus ensuring you are not removing any migrations merged to main after the release.
5. `git checkout -b <PR-branch-bla>`, `git push --set-upstream origin <PR-branch-bla>`, then open PR.

Expand Down
2 changes: 0 additions & 2 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1671,8 +1671,6 @@ pub mod migrations {

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
pallet_nomination_pools::migration::versioned::V5toV6<Runtime>,
pallet_nomination_pools::migration::versioned::V6ToV7<Runtime>,
pallet_nomination_pools::migration::versioned::V7ToV8<Runtime>,
pallet_staking::migrations::v14::MigrateToV14<Runtime>,
parachains_configuration::migration::v10::MigrateToV10<Runtime>,
Expand Down
51 changes: 0 additions & 51 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,17 +429,6 @@ impl pallet_authorship::Config for Runtime {
type EventHandler = (Staking, ImOnline);
}

impl_opaque_keys! {
pub struct OldSessionKeys {
pub grandpa: Grandpa,
pub babe: Babe,
pub im_online: ImOnline,
pub para_validator: Initializer,
pub para_assignment: ParaSessionInfo,
pub authority_discovery: AuthorityDiscovery,
}
}

impl_opaque_keys! {
pub struct SessionKeys {
pub grandpa: Grandpa,
Expand All @@ -452,32 +441,6 @@ impl_opaque_keys! {
}
}

// remove this when removing `OldSessionKeys`
fn transform_session_keys(v: AccountId, old: OldSessionKeys) -> SessionKeys {
SessionKeys {
grandpa: old.grandpa,
babe: old.babe,
im_online: old.im_online,
para_validator: old.para_validator,
para_assignment: old.para_assignment,
authority_discovery: old.authority_discovery,
beefy: {
// From Session::upgrade_keys():
//
// Care should be taken that the raw versions of the
// added keys are unique for every `ValidatorId, KeyTypeId` combination.
// This is an invariant that the session pallet typically maintains internally.
//
// So, produce a dummy value that's unique for the `ValidatorId, KeyTypeId` combination.
let mut id: BeefyId = sp_application_crypto::ecdsa::Public::from_raw([0u8; 33]).into();
let id_raw: &mut [u8] = id.as_mut();
id_raw[1..33].copy_from_slice(v.as_ref());
id_raw[0..4].copy_from_slice(b"beef");
id
},
}
}

impl pallet_session::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ValidatorId = AccountId;
Expand Down Expand Up @@ -1690,22 +1653,8 @@ pub type Migrations = migrations::Unreleased;
pub mod migrations {
use super::*;

/// Upgrade Session keys to include BEEFY key.
/// When this is removed, should also remove `OldSessionKeys`.
pub struct UpgradeSessionKeys;
impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys {
fn on_runtime_upgrade() -> Weight {
Session::upgrade_keys::<OldSessionKeys, _>(transform_session_keys);
Perbill::from_percent(50) * BlockWeights::get().max_block
}
}

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
// Upgrade SessionKeys to include BEEFY key
UpgradeSessionKeys,
pallet_nomination_pools::migration::versioned::V5toV6<Runtime>,
pallet_nomination_pools::migration::versioned::V6ToV7<Runtime>,
pallet_nomination_pools::migration::versioned::V7ToV8<Runtime>,
pallet_staking::migrations::v14::MigrateToV14<Runtime>,
parachains_configuration::migration::v10::MigrateToV10<Runtime>,
Expand Down
12 changes: 1 addition & 11 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ use frame_support::{
parameter_types,
traits::{
AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Equals,
InstanceFilter, OnRuntimeUpgrade, TransformOrigin,
InstanceFilter, TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
PalletId,
Expand Down Expand Up @@ -884,20 +884,10 @@ pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Migrations to apply on runtime upgrade.
pub type Migrations = (
frame_support::migrations::VersionedMigration<0, 1, UniquesMigration, Uniques, RocksDbWeight>,
// unreleased
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
);

/// Migration for Uniques to V1
pub struct UniquesMigration;

impl OnRuntimeUpgrade for UniquesMigration {
fn on_runtime_upgrade() -> Weight {
pallet_uniques::migration::migrate_to_v1::<Runtime, (), pallet_uniques::Pallet<Runtime>>()
}
}

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Expand Down

0 comments on commit 959b830

Please sign in to comment.