Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

fix migrations (also companion for #14421) #7454

Merged
merged 17 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,11 @@ pub mod migrations {

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
pallet_society::migrations::MigrateToV2<Runtime, (), past_payouts::PastPayouts>,
pallet_society::migrations::VersionCheckedMigrateToV2<
Runtime,
(),
past_payouts::PastPayouts,
>,
pallet_im_online::migration::v1::Migration<Runtime>,
);

Expand Down
2 changes: 1 addition & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ pub mod migrations {
use frame_support::traits::{GetStorageVersion, OnRuntimeUpgrade, StorageVersion};

pub type V0938 = (
pallet_xcm::migration::v1::MigrateToV1<Runtime>,
pallet_xcm::migration::v1::VersionCheckedMigrateToV1<Runtime>,
// The UMP pallet got deleted in <https://github.com/paritytech/polkadot/pull/6271>
// parachains_ump::migration::v1::MigrateToV1<Runtime>,
);
Expand Down
2 changes: 1 addition & 1 deletion runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,7 @@ pub mod migrations {

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
pallet_society::migrations::MigrateToV2<Runtime, (), ()>,
pallet_society::migrations::VersionCheckedMigrateToV2<Runtime, (), ()>,
pallet_im_online::migration::v1::Migration<Runtime>,
);
}
Expand Down
2 changes: 1 addition & 1 deletion xcm/pallet-xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ serde = { version = "1.0.163", optional = true, features = ["derive"] }
log = { version = "0.4.17", default-features = false }

frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master", features = ["experimental"] }
liamaharon marked this conversation as resolved.
Show resolved Hide resolved
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
Expand Down
13 changes: 11 additions & 2 deletions xcm/pallet-xcm/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ const DEFAULT_PROOF_SIZE: u64 = 64 * 1024;

pub mod v1 {
use super::*;
use frame_support::migrations::VersionedRuntimeUpgrade;

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>);
liamaharon marked this conversation as resolved.
Show resolved Hide resolved
impl<T: Config> OnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<sp_std::vec::Vec<u8>, sp_runtime::TryRuntimeError> {
ensure!(StorageVersion::get::<Pallet<T>>() == 0, "must upgrade linearly");
Expand Down Expand Up @@ -58,4 +59,12 @@ pub mod v1 {
}
}
}

pub type VersionCheckedMigrateToV1<T> = VersionedRuntimeUpgrade<
0,
1,
VersionUncheckedMigrateToV1<T>,
crate::pallet::Pallet<T>,
<T as frame_system::Config>::DbWeight,
>;
}