From 7cbbb9cdf065398cc97f9f474c727ce00668beb2 Mon Sep 17 00:00:00 2001 From: lemunozm Date: Mon, 20 May 2024 12:49:58 +0200 Subject: [PATCH] remove old development migrations --- Cargo.lock | 2 +- runtime/development/Cargo.toml | 2 +- runtime/development/src/lib.rs | 4 +- runtime/development/src/migrations.rs | 114 +------------------------- 4 files changed, 5 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5174d7d93f..6aa6b1071d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2951,7 +2951,7 @@ dependencies = [ [[package]] name = "development-runtime" -version = "0.10.46" +version = "0.10.48" dependencies = [ "axelar-gateway-precompile", "cfg-primitives", diff --git a/runtime/development/Cargo.toml b/runtime/development/Cargo.toml index 17cc6bd48d..d736bfad0d 100644 --- a/runtime/development/Cargo.toml +++ b/runtime/development/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "development-runtime" -version = "0.10.46" +version = "0.10.48" build = "build.rs" authors.workspace = true edition.workspace = true diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index 72d939c146..841f872732 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -156,7 +156,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("centrifuge-devel"), impl_name: create_runtime_str!("centrifuge-devel"), authoring_version: 1, - spec_version: 1047, + spec_version: 1048, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 2, @@ -1994,7 +1994,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - crate::migrations::UpgradeDevelopment1047, + crate::migrations::UpgradeDevelopment1048, >; // Frame Order in this block dictates the index of each one in the metadata diff --git a/runtime/development/src/migrations.rs b/runtime/development/src/migrations.rs index 105b1ac17e..a0ce812373 100644 --- a/runtime/development/src/migrations.rs +++ b/runtime/development/src/migrations.rs @@ -10,118 +10,6 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -use sp_core::parameter_types; -parameter_types! { - pub const CollatorReward: cfg_primitives::Balance = cfg_primitives::constants::CFG; - pub const AnnualTreasuryInflationPercent: u32 = 3; -} - /// The migration set for Development & Demo. /// It includes all the migrations that have to be applied on that chain. -pub type UpgradeDevelopment1047 = ( - pallet_collator_selection::migration::v1::MigrateToV1, - cleanup_foreign_investments::Migration, - // v0 -> v1 - pallet_multisig::migrations::v1::MigrateToV1, - // v0 -> v1 - pallet_balances::migration::MigrateToTrackInactive, - // v0 -> v1 - runtime_common::migrations::nuke::ResetPallet, - // v0 -> v1 - runtime_common::migrations::nuke::ResetPallet, - // v0 -> v1 - pallet_xcm::migration::v1::VersionUncheckedMigrateToV1, - runtime_common::migrations::increase_storage_version::Migration, - runtime_common::migrations::increase_storage_version::Migration, - runtime_common::migrations::increase_storage_version::Migration, - runtime_common::migrations::increase_storage_version::Migration, - runtime_common::migrations::increase_storage_version::Migration, - runtime_common::migrations::increase_storage_version::Migration< - crate::OraclePriceCollection, - 0, - 1, - >, - runtime_common::migrations::increase_storage_version::Migration, - // Reset Block rewards - runtime_common::migrations::nuke::ResetPallet, - pallet_block_rewards::migrations::init::InitBlockRewards< - crate::Runtime, - CollatorReward, - AnnualTreasuryInflationPercent, - >, -); - -mod cleanup_foreign_investments { - use cfg_types::tokens::CurrencyId; - use frame_support::{ - storage::StoragePrefixedMap, - traits::{Get, OnRuntimeUpgrade}, - weights::Weight, - }; - #[cfg(feature = "try-runtime")] - use runtime_common::migrations::utils::count_storage_keys; - use runtime_common::migrations::utils::remove_undecodable_storage_keys; - #[cfg(feature = "try-runtime")] - use sp_runtime::DispatchError; - #[cfg(feature = "try-runtime")] - use sp_runtime::SaturatedConversion; - - pub struct Migration(sp_std::marker::PhantomData); - - const LOG_PREFIX: &str = "CleanupForeignInvestments"; - impl OnRuntimeUpgrade for Migration - where - T: pallet_foreign_investments::Config + frame_system::Config, - { - fn on_runtime_upgrade() -> Weight { - log::info!("{LOG_PREFIX} Initiating removal of undecodable keys"); - let (reads, writes) = remove_undecodable_storage_keys::( - pallet_foreign_investments::ForeignInvestmentInfo::::final_prefix(), - ); - - log::info!("{LOG_PREFIX} Removed {writes} undecodable keys"); - - T::DbWeight::get().reads_writes(reads, writes) - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, DispatchError> { - let n: u32 = count_storage_keys( - pallet_foreign_investments::ForeignInvestmentInfo::::final_prefix(), - ); - let n_count: u32 = pallet_foreign_investments::ForeignInvestmentInfo::::iter_keys() - .count() - .saturated_into(); - - if n == n_count { - log::info!( - "{LOG_PREFIX} Storage cleanup can be skipped because all keys can be decoded" - ); - } else { - log::info!( - "{LOG_PREFIX} Failed to decode {} keys, cleanup necessary", - n.saturating_sub(n_count) - ); - } - - log::info!("{LOG_PREFIX} pre_upgrade done!",); - - Ok(sp_std::vec![]) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), DispatchError> { - let n: u32 = count_storage_keys( - pallet_foreign_investments::ForeignInvestmentInfo::::final_prefix(), - ); - let n_count: u32 = pallet_foreign_investments::ForeignInvestmentInfo::::iter_keys() - .count() - .saturated_into(); - assert_eq!(n, n_count); - - log::info!("{LOG_PREFIX} post_upgrade done with {n} remaining storage keys!",); - - Ok(()) - } - } -} +pub type UpgradeDevelopment1048 = ();