From e7b54c91b52dc02697d8aafc0f10282e7f095a37 Mon Sep 17 00:00:00 2001 From: William Freudenberger Date: Wed, 26 Jun 2024 21:00:17 +0200 Subject: [PATCH] v0.11.3-rc1: revert checkmetadata ext --- Cargo.toml | 2 +- runtime/altair/src/lib.rs | 4 +- runtime/altair/src/migrations.rs | 2 +- runtime/centrifuge/src/lib.rs | 4 +- runtime/centrifuge/src/migrations.rs | 2 +- runtime/development/src/lib.rs | 4 +- runtime/development/src/migrations.rs | 138 +------------------------- 7 files changed, 10 insertions(+), 146 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ef64dff8f3..4c854938e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ license = "LGPL-3.0" homepage = "https://centrifuge.io/" repository = "https://github.com/centrifuge/centrifuge-chain" documentation = "https://reference.centrifuge.io/centrifuge_chain/index.html" -version = "0.11.1" +version = "0.11.3" [workspace.dependencies] hex-literal = { version = "0.4.1" } diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index 3eff1662f3..736cbcd370 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -163,7 +163,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("altair"), impl_name: create_runtime_str!("altair"), authoring_version: 1, - spec_version: 1101, + spec_version: 1103, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 2, @@ -1965,7 +1965,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - migrations::UpgradeAltair1101, + migrations::UpgradeAltair1103, >; // Frame Order in this block dictates the index of each one in the metadata diff --git a/runtime/altair/src/migrations.rs b/runtime/altair/src/migrations.rs index f6300273dc..20726a13cf 100644 --- a/runtime/altair/src/migrations.rs +++ b/runtime/altair/src/migrations.rs @@ -17,7 +17,7 @@ const IDENTITY_MIGRATION_KEY_LIMIT: u64 = 1000; /// The migration set for Altair @ Kusama. /// It includes all the migrations that have to be applied on that chain. -pub type UpgradeAltair1101 = ( +pub type UpgradeAltair1103 = ( runtime_common::migrations::increase_storage_version::Migration, runtime_common::migrations::increase_storage_version::Migration, runtime_common::migrations::increase_storage_version::Migration, diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index a14e51ecb8..988d83b1a3 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -165,7 +165,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("centrifuge"), impl_name: create_runtime_str!("centrifuge"), authoring_version: 1, - spec_version: 1101, + spec_version: 1103, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 2, @@ -2078,7 +2078,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - migrations::UpgradeCentrifuge1101, + migrations::UpgradeCentrifuge1103, >; // Frame Order in this block dictates the index of each one in the metadata diff --git a/runtime/centrifuge/src/migrations.rs b/runtime/centrifuge/src/migrations.rs index 369271582c..05cabf53aa 100644 --- a/runtime/centrifuge/src/migrations.rs +++ b/runtime/centrifuge/src/migrations.rs @@ -32,7 +32,7 @@ parameter_types! { /// The migration set for Centrifuge @ Polkadot. /// It includes all the migrations that have to be applied on that chain. -pub type UpgradeCentrifuge1101 = ( +pub type UpgradeCentrifuge1103 = ( runtime_common::migrations::increase_storage_version::Migration, runtime_common::migrations::increase_storage_version::Migration, pallet_collator_selection::migration::v1::MigrateToV1, diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index 86b9d9d1d2..0a147349c3 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -167,7 +167,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: 1101, + spec_version: 1103, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 2, @@ -2068,7 +2068,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - crate::migrations::UpgradeDevelopment1101, + crate::migrations::UpgradeDevelopment1103, >; // 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 ac3c9da378..dd18836530 100644 --- a/runtime/development/src/migrations.rs +++ b/runtime/development/src/migrations.rs @@ -10,142 +10,6 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -use cfg_primitives::AccountId; -use sp_core::parameter_types; -use sp_std::{vec, vec::Vec}; - -parameter_types! { - pub const CollatorReward: cfg_primitives::Balance = cfg_primitives::constants::CFG; - pub const AnnualTreasuryInflationPercent: u32 = 3; - pub AccountMap: Vec<(AccountId, AccountId)> = vec![]; - -} - -// Number of identities on Dev and Demo Chain on 30.05.2024 was both 0 -const IDENTITY_MIGRATION_KEY_LIMIT: u64 = 1000; - /// The migration set for Development & Demo. /// It includes all the migrations that have to be applied on that chain. -pub type UpgradeDevelopment1101 = ( - pallet_collator_selection::migration::v1::MigrateToV1, - pallet_collator_selection::migration::v2::MigrationToV2, - 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 - runtime_common::migrations::nuke::ResetPallet, - 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 on Demo which is at v0 - runtime_common::migrations::nuke::ResetPallet, - // Reset Block rewards on Dev which is at v2 - runtime_common::migrations::nuke::ResetPallet, - pallet_block_rewards::migrations::init::InitBlockRewards< - crate::Runtime, - CollatorReward, - AnnualTreasuryInflationPercent, - >, - runtime_common::migrations::restricted_location::MigrateRestrictedTransferLocation< - crate::Runtime, - AccountMap, - >, - runtime_common::migrations::loans::AddWithLinearPricing, - runtime_common::migrations::hold_reason::MigrateTransferAllowListHolds< - crate::Runtime, - crate::RuntimeHoldReason, - >, - // Migrations below this comment originate from Polkadot SDK - pallet_xcm::migration::MigrateToLatestXcmVersion, - cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_identity::migration::versioned::V0ToV1, - pallet_uniques::migration::MigrateV0ToV1, -); - -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 UpgradeDevelopment1103 = ();