Skip to content

Commit

Permalink
re add the migration checks for staking (paritytech#12330)
Browse files Browse the repository at this point in the history
Co-authored-by: parity-processbot <>
  • Loading branch information
Ank4n authored and ark0f committed Feb 27, 2023
1 parent 44391df commit 652ab48
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frame/staking/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ pub mod v12 {
impl<T: Config> OnRuntimeUpgrade for MigrateToV12<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
frame_support::ensure!(
StorageVersion::<T>::get() == Releases::V11_0_0,
"Expected v11 before upgrading to v12"
);

frame_support::ensure!(
T::HistoryDepth::get() == HistoryDepth::<T>::get(),
"Provided value of HistoryDepth should be same as the existing storage value"
Expand Down Expand Up @@ -129,6 +134,11 @@ pub mod v11 {

#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
frame_support::ensure!(
StorageVersion::<T>::get() == crate::Releases::V11_0_0,
"wrong version after the upgrade"
);

let old_pallet_name = N::get();
let new_pallet_name = <P as PalletInfoAccess>::name();

Expand Down

0 comments on commit 652ab48

Please sign in to comment.