mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 03:41:06 +00:00
Improve VersionedMigration naming conventions (#2264)
As suggested by @ggwpez (https://github.com/paritytech/polkadot-sdk/pull/2142#discussion_r1388145872), remove the `VersionChecked` prefix from version checked migrations (but leave `VersionUnchecked` prefixes) --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -25,8 +25,8 @@ use sp_std::vec::Vec;
|
||||
pub mod v1 {
|
||||
|
||||
use super::*;
|
||||
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
|
||||
pub struct VersionUncheckedMigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
|
||||
let onchain_version = Pallet::<T>::on_chain_storage_version();
|
||||
@@ -60,13 +60,13 @@ pub mod v1 {
|
||||
}
|
||||
}
|
||||
|
||||
/// [`MigrateToV1`] wrapped in a
|
||||
/// [`VersionUncheckedMigrateToV1`] wrapped in a
|
||||
/// [`VersionedMigration`](frame_support::migrations::VersionedMigration), ensuring the
|
||||
/// migration is only performed when on-chain version is 0.
|
||||
pub type VersionCheckedMigrateToV1<T> = frame_support::migrations::VersionedMigration<
|
||||
pub type MigrateToV1<T> = frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
MigrateToV1<T>,
|
||||
VersionUncheckedMigrateToV1<T>,
|
||||
Pallet<T>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -60,11 +60,10 @@ impl<T: Config, UnlockParaIds: Contains<ParaId>> OnRuntimeUpgrade
|
||||
}
|
||||
}
|
||||
|
||||
pub type VersionCheckedMigrateToV1<T, UnlockParaIds> =
|
||||
frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
VersionUncheckedMigrateToV1<T, UnlockParaIds>,
|
||||
super::Pallet<T>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
pub type MigrateToV1<T, UnlockParaIds> = frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
VersionUncheckedMigrateToV1<T, UnlockParaIds>,
|
||||
super::Pallet<T>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -1472,14 +1472,14 @@ pub mod migrations {
|
||||
|
||||
/// Unreleased migrations. Add new ones here:
|
||||
pub type Unreleased = (
|
||||
pallet_society::migrations::VersionCheckedMigrateToV2<Runtime, (), ()>,
|
||||
pallet_society::migrations::MigrateToV2<Runtime, (), ()>,
|
||||
pallet_im_online::migration::v1::Migration<Runtime>,
|
||||
parachains_configuration::migration::v7::MigrateToV7<Runtime>,
|
||||
assigned_slots::migration::v1::VersionCheckedMigrateToV1<Runtime>,
|
||||
assigned_slots::migration::v1::MigrateToV1<Runtime>,
|
||||
parachains_scheduler::migration::v1::MigrateToV1<Runtime>,
|
||||
parachains_configuration::migration::v8::MigrateToV8<Runtime>,
|
||||
parachains_configuration::migration::v9::MigrateToV9<Runtime>,
|
||||
paras_registrar::migration::VersionCheckedMigrateToV1<Runtime, ()>,
|
||||
paras_registrar::migration::MigrateToV1<Runtime, ()>,
|
||||
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, ()>,
|
||||
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, pallet_referenda::Instance2>,
|
||||
|
||||
|
||||
@@ -1549,12 +1549,12 @@ pub mod migrations {
|
||||
pallet_im_online::migration::v1::Migration<Runtime>,
|
||||
parachains_configuration::migration::v7::MigrateToV7<Runtime>,
|
||||
pallet_staking::migrations::v14::MigrateToV14<Runtime>,
|
||||
assigned_slots::migration::v1::VersionCheckedMigrateToV1<Runtime>,
|
||||
assigned_slots::migration::v1::MigrateToV1<Runtime>,
|
||||
parachains_scheduler::migration::v1::MigrateToV1<Runtime>,
|
||||
parachains_configuration::migration::v8::MigrateToV8<Runtime>,
|
||||
UpgradeSessionKeys,
|
||||
parachains_configuration::migration::v9::MigrateToV9<Runtime>,
|
||||
paras_registrar::migration::VersionCheckedMigrateToV1<Runtime, ()>,
|
||||
paras_registrar::migration::MigrateToV1<Runtime, ()>,
|
||||
pallet_nomination_pools::migration::versioned_migrations::V5toV6<Runtime>,
|
||||
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, ()>,
|
||||
pallet_nomination_pools::migration::versioned_migrations::V6ToV7<Runtime>,
|
||||
|
||||
@@ -31,7 +31,7 @@ pub mod v1 {
|
||||
/// checking, the version checking is not complete as it will begin failing after the upgrade is
|
||||
/// enacted on-chain.
|
||||
///
|
||||
/// Use experimental [`VersionCheckedMigrateToV1`] instead.
|
||||
/// Use experimental [`MigrateToV1`] instead.
|
||||
pub struct VersionUncheckedMigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
@@ -65,7 +65,7 @@ pub mod v1 {
|
||||
///
|
||||
/// Wrapped in [`frame_support::migrations::VersionedMigration`] so the pre/post checks don't
|
||||
/// begin failing after the upgrade is enacted on-chain.
|
||||
pub type VersionCheckedMigrateToV1<T> = frame_support::migrations::VersionedMigration<
|
||||
pub type MigrateToV1<T> = frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
VersionUncheckedMigrateToV1<T>,
|
||||
|
||||
@@ -95,14 +95,13 @@ impl<
|
||||
|
||||
/// [`VersionUncheckedMigrateToV2`] wrapped in a [`frame_support::migrations::VersionedMigration`],
|
||||
/// ensuring the migration is only performed when on-chain version is 0.
|
||||
pub type VersionCheckedMigrateToV2<T, I, PastPayouts> =
|
||||
frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
2,
|
||||
VersionUncheckedMigrateToV2<T, I, PastPayouts>,
|
||||
crate::pallet::Pallet<T, I>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
pub type MigrateToV2<T, I, PastPayouts> = frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
2,
|
||||
VersionUncheckedMigrateToV2<T, I, PastPayouts>,
|
||||
crate::pallet::Pallet<T, I>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
pub(crate) mod old {
|
||||
use super::*;
|
||||
|
||||
@@ -51,7 +51,7 @@ use sp_std::marker::PhantomData;
|
||||
/// // OnRuntimeUpgrade implementation...
|
||||
/// }
|
||||
///
|
||||
/// pub type VersionCheckedMigrateV5ToV6<T, I> =
|
||||
/// pub type MigrateV5ToV6<T, I> =
|
||||
/// VersionedMigration<
|
||||
/// 5,
|
||||
/// 6,
|
||||
@@ -63,7 +63,7 @@ use sp_std::marker::PhantomData;
|
||||
/// // Migrations tuple to pass to the Executive pallet:
|
||||
/// pub type Migrations = (
|
||||
/// // other migrations...
|
||||
/// VersionCheckedMigrateV5ToV6<T, ()>,
|
||||
/// MigrateV5ToV6<T, ()>,
|
||||
/// // other migrations...
|
||||
/// );
|
||||
/// ```
|
||||
|
||||
Reference in New Issue
Block a user