From 9e12a47a5d99dce4b7aaccb3f432eba14847c087 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Wed, 30 Oct 2024 16:08:11 +0100 Subject: [PATCH] update migrations --- runtime/vara/src/migrations.rs | 56 ++-------------------------------- 1 file changed, 3 insertions(+), 53 deletions(-) diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index ad77b0ba53b..3ae1693b1f9 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -22,60 +22,10 @@ const IDENTITY_MIGRATION_KEY_LIMIT: u64 = u64::MAX; /// All migrations that will run on the next runtime upgrade. pub type Migrations = ( - // migration for added section sizes - pallet_gear_program::migrations::add_section_sizes::AddSectionSizesMigration, - // substrate v1.4.0 - staking::MigrateToV14, - pallet_grandpa::migrations::MigrateV4ToV5, // move allocations to a separate storage item and remove pages_with_data field from program pallet_gear_program::migrations::allocations::MigrateAllocations, // Migrate Identity pallet for Usernames pallet_identity::migration::versioned::V0ToV1, -); - -mod staking { - use frame_support::{ - pallet_prelude::Weight, - traits::{GetStorageVersion, OnRuntimeUpgrade}, - }; - use pallet_staking::*; - use sp_core::Get; - - #[cfg(feature = "try-runtime")] - use sp_std::vec::Vec; - - #[cfg(feature = "try-runtime")] - use sp_runtime::TryRuntimeError; - - pub struct MigrateToV14(sp_std::marker::PhantomData); - impl OnRuntimeUpgrade for MigrateToV14 { - fn on_runtime_upgrade() -> Weight { - let current = Pallet::::in_code_storage_version(); - let on_chain = Pallet::::on_chain_storage_version(); - - if current == 14 && on_chain == 13 { - current.put::>(); - - log::info!("v14 applied successfully."); - T::DbWeight::get().reads_writes(1, 1) - } else { - log::warn!("v14 not applied."); - T::DbWeight::get().reads(1) - } - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - Ok(Default::default()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: Vec) -> Result<(), TryRuntimeError> { - frame_support::ensure!( - Pallet::::on_chain_storage_version() == 14, - "v14 not applied" - ); - Ok(()) - } - } -} + pallet_staking::migrations::v15::MigrateV14ToV15, + pallet_nomination_pools::migration::versioned::V7ToV8, +); \ No newline at end of file