From a35def251c807f3d6354fc807f7f4c6f61115689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Enrique=20Mu=C3=B1oz=20Mart=C3=ADn?= Date: Wed, 3 Apr 2024 11:36:21 +0200 Subject: [PATCH 1/2] correct feeder encoding (#1793) --- runtime/common/src/oracle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/common/src/oracle.rs b/runtime/common/src/oracle.rs index 8ecc509c92..6045f0ceec 100644 --- a/runtime/common/src/oracle.rs +++ b/runtime/common/src/oracle.rs @@ -52,7 +52,7 @@ impl Ord for Feeder { fn cmp(&self, other: &Self) -> sp_std::cmp::Ordering { // Since the inner object could not be Ord, // we compare their encoded representations - self.0.encode().cmp(&other.encode()) + self.0.encode().cmp(&other.0.encode()) } } From dc0952e432d62b71ed912fe2e8e2dacb968d0a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Enrique=20Mu=C3=B1oz=20Mart=C3=ADn?= Date: Wed, 3 Apr 2024 13:50:24 +0200 Subject: [PATCH 2/2] remove old migrations and bump up version for centrifuge runtime (#1794) --- Cargo.lock | 2 +- runtime/centrifuge/Cargo.toml | 2 +- runtime/centrifuge/src/lib.rs | 4 +- runtime/centrifuge/src/migrations.rs | 59 +--------------------------- 4 files changed, 5 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0341d6d683..827c6575a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -993,7 +993,7 @@ dependencies = [ [[package]] name = "centrifuge-runtime" -version = "0.10.28" +version = "0.10.29" dependencies = [ "axelar-gateway-precompile", "cfg-primitives", diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index dd12b292a4..dd54f8e4cd 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "centrifuge-runtime" -version = "0.10.28" +version = "0.10.29" build = "build.rs" authors.workspace = true edition.workspace = true diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 13444c3325..78dae5bc05 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -154,7 +154,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("centrifuge"), impl_name: create_runtime_str!("centrifuge"), authoring_version: 1, - spec_version: 1028, + spec_version: 1029, impl_version: 1, #[cfg(not(feature = "disable-runtime-api"))] apis: RUNTIME_API_VERSIONS, @@ -2062,7 +2062,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - migrations::UpgradeCentrifuge1028, + migrations::UpgradeCentrifuge1029, >; // 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 000570d373..a3be22e77a 100644 --- a/runtime/centrifuge/src/migrations.rs +++ b/runtime/centrifuge/src/migrations.rs @@ -12,61 +12,4 @@ /// The migration set for Centrifuge @ Polkadot. /// It includes all the migrations that have to be applied on that chain. -pub type UpgradeCentrifuge1028 = migrate_anemoy_external_prices::Migration; - -mod migrate_anemoy_external_prices { - use cfg_primitives::PoolId; - use cfg_traits::data::DataRegistry; - use cfg_types::oracles::OracleKey; - use frame_support::{traits::OnRuntimeUpgrade, weights::Weight}; - use pallet_loans::{entities::pricing::ActivePricing, WeightInfo}; - - const LOG_PREFIX: &str = "MigrateAnemoyPrices:"; - const ANEMOY_POOL_ID: PoolId = 4139607887; - /// Simply bumps the storage version of a pallet - /// - /// NOTE: Use with caution! Must ensure beforehand that a migration is not - /// necessary - pub struct Migration(sp_std::marker::PhantomData); - impl OnRuntimeUpgrade for Migration - where - R: pallet_loans::Config - + pallet_oracle_collection::Config, - { - fn on_runtime_upgrade() -> Weight { - log::info!("{LOG_PREFIX}: STARTING Migrating Anemoy Price Ids."); - let active_loans = pallet_loans::ActiveLoans::::get(ANEMOY_POOL_ID); - active_loans.clone().into_iter().for_each(|(_, loan)| { - if let ActivePricing::External(pricing) = loan.pricing() { - match pallet_oracle_collection::Pallet::::register_id( - &pricing.price_id(), - &ANEMOY_POOL_ID, - ) { - Ok(_) => { - log::info!("{LOG_PREFIX}: Registered PriceId: {:?}", pricing.price_id()) - } - Err(e) => log::info!( - "{LOG_PREFIX}: Failed to register PriceId: {:?}, with error: {:?}.", - pricing.price_id(), - e - ), - } - } - }); - - log::info!("{LOG_PREFIX}: FINISHED Migrating Anemoy Price Ids."); - ::WeightInfo::create() - .saturating_mul(active_loans.len() as u64) - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::DispatchError> { - Ok(sp_std::vec![]) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_: sp_std::vec::Vec) -> Result<(), sp_runtime::DispatchError> { - Ok(()) - } - } -} +pub type UpgradeCentrifuge1029 = ();