diff --git a/Cargo.lock b/Cargo.lock index 525ea3542b..6f8e3a8859 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,7 +180,6 @@ dependencies = [ "pallet-investments", "pallet-keystore", "pallet-liquidity-pools", - "pallet-liquidity-pools-forwarder", "pallet-liquidity-pools-gateway", "pallet-liquidity-pools-gateway-queue", "pallet-liquidity-rewards", @@ -1503,7 +1502,6 @@ dependencies = [ "pallet-investments", "pallet-keystore", "pallet-liquidity-pools", - "pallet-liquidity-pools-forwarder", "pallet-liquidity-pools-gateway", "pallet-liquidity-pools-gateway-queue", "pallet-liquidity-rewards", @@ -3117,7 +3115,6 @@ dependencies = [ "pallet-investments", "pallet-keystore", "pallet-liquidity-pools", - "pallet-liquidity-pools-forwarder", "pallet-liquidity-pools-gateway", "pallet-liquidity-pools-gateway-queue", "pallet-liquidity-rewards", diff --git a/pallets/axelar-router/src/lib.rs b/pallets/axelar-router/src/lib.rs index 5f9ffd3009..de789ef8fd 100644 --- a/pallets/axelar-router/src/lib.rs +++ b/pallets/axelar-router/src/lib.rs @@ -116,7 +116,10 @@ pub struct FeeValues { pub mod pallet { use super::*; + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::config] diff --git a/runtime/altair/Cargo.toml b/runtime/altair/Cargo.toml index 9393852b18..ea5009dd4e 100644 --- a/runtime/altair/Cargo.toml +++ b/runtime/altair/Cargo.toml @@ -105,7 +105,6 @@ pallet-interest-accrual = { workspace = true } pallet-investments = { workspace = true } pallet-keystore = { workspace = true } pallet-liquidity-pools = { workspace = true } -pallet-liquidity-pools-forwarder = { workspace = true } pallet-liquidity-pools-gateway = { workspace = true } pallet-liquidity-pools-gateway-queue = { workspace = true } pallet-liquidity-rewards = { workspace = true } @@ -235,7 +234,6 @@ std = [ "pallet-investments/std", "pallet-keystore/std", "pallet-liquidity-pools/std", - "pallet-liquidity-pools-forwarder/std", "pallet-liquidity-pools-gateway/std", "pallet-liquidity-rewards/std", "pallet-loans/std", @@ -323,7 +321,6 @@ runtime-benchmarks = [ "pallet-investments/runtime-benchmarks", "pallet-keystore/runtime-benchmarks", "pallet-liquidity-pools/runtime-benchmarks", - "pallet-liquidity-pools-forwarder/runtime-benchmarks", "pallet-liquidity-pools-gateway/runtime-benchmarks", "pallet-liquidity-rewards/runtime-benchmarks", "pallet-loans/runtime-benchmarks", @@ -410,7 +407,6 @@ try-runtime = [ "pallet-investments/try-runtime", "pallet-keystore/try-runtime", "pallet-liquidity-pools/try-runtime", - "pallet-liquidity-pools-forwarder/try-runtime", "pallet-liquidity-pools-gateway/try-runtime", "pallet-liquidity-rewards/try-runtime", "pallet-loans/try-runtime", diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index 549f6756df..b4265f14f7 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -1755,15 +1755,6 @@ impl pallet_liquidity_pools::Config for Runtime { type WeightInfo = (); } -impl pallet_liquidity_pools_forwarder::Config for Runtime { - type AdminOrigin = EnsureRootOr; - type Message = pallet_liquidity_pools::Message; - type MessageReceiver = LiquidityPoolsGateway; - type MessageSender = MessageSerializer, LiquidityPoolsForwarder>; - type RouterId = RouterId; - type RuntimeEvent = RuntimeEvent; -} - parameter_types! { pub Sender: DomainAddress = gateway::get_gateway_domain_address::(); pub const MaxIncomingMessageSize: u32 = 1024; @@ -1777,7 +1768,7 @@ impl pallet_liquidity_pools_gateway::Config for Runtime { type MaxRouterCount = MaxRouterCount; type Message = pallet_liquidity_pools::Message; type MessageQueue = LiquidityPoolsGatewayQueue; - type MessageSender = LiquidityPoolsForwarder; + type MessageSender = MessageSerializer, ()>; type RouterId = RouterId; type RouterProvider = LPGatewayRouterProvider; type RuntimeEvent = RuntimeEvent; @@ -1900,7 +1891,7 @@ impl pallet_ethereum_transaction::Config for Runtime {} impl pallet_axelar_router::Config for Runtime { type AdminOrigin = EnsureRoot; type Middleware = RouterId; - type Receiver = MessageSerializer, LiquidityPoolsForwarder>; + type Receiver = MessageSerializer<(), LiquidityPoolsGateway>; type RuntimeEvent = RuntimeEvent; type Transactor = EthereumTransaction; } @@ -2131,7 +2122,6 @@ construct_runtime!( // Removed: Swaps = 200 TokenMux: pallet_token_mux::{Pallet, Call, Storage, Event} = 201, LiquidityPoolsGatewayQueue: pallet_liquidity_pools_gateway_queue::{Pallet, Call, Storage, Event} = 202, - LiquidityPoolsForwarder: pallet_liquidity_pools_forwarder::{Pallet, Call, Storage, Event} = 203, } ); diff --git a/runtime/altair/src/migrations.rs b/runtime/altair/src/migrations.rs index 2b08b593c2..7afdd9df0c 100644 --- a/runtime/altair/src/migrations.rs +++ b/runtime/altair/src/migrations.rs @@ -11,13 +11,18 @@ // GNU General Public License for more details. use frame_support::migrations::VersionedMigration; +use sp_core::parameter_types; use crate::Runtime; +parameter_types! { + pub PalletLiquidityPoolsAxelarGateway: &'static str = "LiquidityPoolsAxelarGateway"; +} + /// The migration set for Altair @ Kusama. /// It includes all the migrations that have to be applied on that chain. pub type UpgradeAltair1403 = ( - // Clear v0 RelayerList storage + // Remove deprecated LiquidityPoolsGateway::{v0, v1, v2}::RelayerList storage runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration, // Clear OutboundMessageNonceStore and migrate outbound storage to LP queue runtime_common::migrations::liquidity_pools_v2::v0_init_message_queue::Migration, @@ -49,4 +54,9 @@ pub type UpgradeAltair1403 = ( pallet_permissions::Pallet, ::DbWeight, >, + // Remove deprecated LiquidityPoolsAxelarGateway + runtime_common::migrations::nuke::KillPallet< + PalletLiquidityPoolsAxelarGateway, + ::DbWeight, + >, ); diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index 4fb42616de..0a4f83b50f 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -102,7 +102,6 @@ pallet-interest-accrual = { workspace = true } pallet-investments = { workspace = true } pallet-keystore = { workspace = true } pallet-liquidity-pools = { workspace = true } -pallet-liquidity-pools-forwarder = { workspace = true } pallet-liquidity-pools-gateway = { workspace = true } pallet-liquidity-pools-gateway-queue = { workspace = true } pallet-liquidity-rewards = { workspace = true } @@ -227,7 +226,6 @@ std = [ "pallet-investments/std", "pallet-keystore/std", "pallet-liquidity-pools/std", - "pallet-liquidity-pools-forwarder/std", "pallet-liquidity-pools-gateway/std", "pallet-liquidity-rewards/std", "pallet-loans/std", @@ -311,7 +309,6 @@ runtime-benchmarks = [ "pallet-investments/runtime-benchmarks", "pallet-keystore/runtime-benchmarks", "pallet-liquidity-pools/runtime-benchmarks", - "pallet-liquidity-pools-forwarder/runtime-benchmarks", "pallet-liquidity-pools-gateway/runtime-benchmarks", "pallet-liquidity-rewards/runtime-benchmarks", "pallet-loans/runtime-benchmarks", @@ -394,7 +391,6 @@ try-runtime = [ "pallet-investments/try-runtime", "pallet-keystore/try-runtime", "pallet-liquidity-pools/try-runtime", - "pallet-liquidity-pools-forwarder/try-runtime", "pallet-liquidity-pools-gateway/try-runtime", "pallet-liquidity-rewards/try-runtime", "pallet-loans/try-runtime", diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index eb1683262e..503d9c02a7 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -1843,15 +1843,6 @@ parameter_types! { pub const MaxRouterCount: u32 = 8; } -impl pallet_liquidity_pools_forwarder::Config for Runtime { - type AdminOrigin = EnsureAccountOrRootOr; - type Message = pallet_liquidity_pools::Message; - type MessageReceiver = LiquidityPoolsGateway; - type MessageSender = MessageSerializer, LiquidityPoolsForwarder>; - type RouterId = RouterId; - type RuntimeEvent = RuntimeEvent; -} - parameter_types! { // A temporary admin account for the LP logic // This is a multi-sig controlled pure proxy on mainnet @@ -1875,7 +1866,7 @@ impl pallet_liquidity_pools_gateway::Config for Runtime { type MaxRouterCount = MaxRouterCount; type Message = pallet_liquidity_pools::Message; type MessageQueue = LiquidityPoolsGatewayQueue; - type MessageSender = LiquidityPoolsForwarder; + type MessageSender = MessageSerializer, ()>; type RouterId = RouterId; type RouterProvider = LPGatewayRouterProvider; type RuntimeEvent = RuntimeEvent; @@ -1998,7 +1989,7 @@ impl pallet_ethereum_transaction::Config for Runtime {} impl pallet_axelar_router::Config for Runtime { type AdminOrigin = EnsureAccountOrRootOr; type Middleware = RouterId; - type Receiver = MessageSerializer, LiquidityPoolsForwarder>; + type Receiver = MessageSerializer<(), LiquidityPoolsGateway>; type RuntimeEvent = RuntimeEvent; type Transactor = EthereumTransaction; } @@ -2102,7 +2093,6 @@ construct_runtime!( Remarks: pallet_remarks::{Pallet, Call, Event} = 113, PoolFees: pallet_pool_fees::{Pallet, Call, Storage, Event} = 114, LiquidityPoolsGatewayQueue: pallet_liquidity_pools_gateway_queue::{Pallet, Call, Storage, Event} = 115, - LiquidityPoolsForwarder: pallet_liquidity_pools_forwarder::{Pallet, Call, Storage, Event} = 116, // XCM XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 120, @@ -2126,7 +2116,8 @@ construct_runtime!( BaseFee: pallet_base_fee::{Pallet, Call, Config, Storage, Event} = 162, Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 163, EthereumTransaction: pallet_ethereum_transaction::{Pallet, Storage} = 164, - AxelarRouter: pallet_axelar_router::{Pallet, Call, Storage, Event} = 165, + // Removed: LiquidityPoolsAxelarGateway = 165 + AxelarRouter: pallet_axelar_router::{Pallet, Call, Storage, Event} = 166, // Synced pallets across all runtimes - Range: 180-240 // WHY: * integrations like fireblocks will need to know the index in the enum diff --git a/runtime/centrifuge/src/migrations.rs b/runtime/centrifuge/src/migrations.rs index 36f6728690..78ff224746 100644 --- a/runtime/centrifuge/src/migrations.rs +++ b/runtime/centrifuge/src/migrations.rs @@ -11,13 +11,18 @@ // GNU General Public License for more details. use frame_support::migrations::VersionedMigration; +use sp_core::parameter_types; use crate::Runtime; +parameter_types! { + pub PalletLiquidityPoolsAxelarGateway: &'static str = "LiquidityPoolsAxelarGateway"; +} + /// The migration set for Centrifuge @ Polkadot. /// It includes all the migrations that have to be applied on that chain. pub type UpgradeCentrifuge1403 = ( - // Clear v0 RelayerList storage + // Remove deprecated LiquidityPoolsGateway::{v0, v1, v2}::RelayerList storage runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration, // Clear OutboundMessageNonceStore and migrate outbound storage to LP queue runtime_common::migrations::liquidity_pools_v2::v0_init_message_queue::Migration, @@ -29,8 +34,8 @@ pub type UpgradeCentrifuge1403 = ( pallet_liquidity_pools_gateway::Pallet, ::DbWeight, >, - // Remove deprecated RelayerList storage - runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration, + // Remove deprecated LiquidityPoolsGateway::{v0, v1, v2}::Allowlist storage + runtime_common::migrations::liquidity_pools_v2::kill_allowlist::Migration, // Remove undecodable ForeignInvestmentInfo v0 entries runtime_common::migrations::foreign_investments_v2::Migration, // Bump to v1 @@ -51,4 +56,9 @@ pub type UpgradeCentrifuge1403 = ( pallet_permissions::Pallet, ::DbWeight, >, + // Remove deprecated LiquidityPoolsAxelarGateway + runtime_common::migrations::nuke::KillPallet< + PalletLiquidityPoolsAxelarGateway, + ::DbWeight, + >, ); diff --git a/runtime/common/src/migrations/liquidity_pools_v2.rs b/runtime/common/src/migrations/liquidity_pools_v2.rs index 690800df5a..dc9d69fd3f 100644 --- a/runtime/common/src/migrations/liquidity_pools_v2.rs +++ b/runtime/common/src/migrations/liquidity_pools_v2.rs @@ -97,6 +97,63 @@ pub mod kill_relayer_list { } } +pub mod kill_allowlist { + use frame_support::traits::OnRuntimeUpgrade; + #[cfg(feature = "try-runtime")] + use frame_support::{dispatch::DispatchResult, storage::with_storage_layer}; + #[cfg(feature = "try-runtime")] + use sp_arithmetic::traits::Zero; + #[cfg(feature = "try-runtime")] + use sp_std::vec; + + use super::{types::v0, *}; + use crate::migrations::nuke::storage_clean_res_log; + + const LOG_PREFIX: &str = "ClearAllowlist"; + + pub struct Migration(PhantomData); + + impl OnRuntimeUpgrade for Migration + where + T: pallet_liquidity_pools_gateway::Config, + { + fn on_runtime_upgrade() -> Weight { + let res = v0::Allowlist::::clear(REMOVAL_ITEM_LIMIT, None); + storage_clean_res_log(&res, "Allowlist", LOG_PREFIX); + + log::info!("{LOG_PREFIX}: Migration done!"); + + T::DbWeight::get().reads_writes(res.loops.into(), res.unique.into()) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + let mut cleared: bool = false; + + // Need to rollback in order to be NOOP + let _ = with_storage_layer(|| -> DispatchResult { + cleared = v0::Allowlist::::clear(REMOVAL_ITEM_LIMIT, None) + .maybe_cursor + .is_none(); + Err(DispatchError::Other("Reverting on purpose")) + }); + assert!(cleared); + + log::info!("{LOG_PREFIX}: Pre checks done!"); + + Ok(vec![]) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_: Vec) -> Result<(), sp_runtime::TryRuntimeError> { + assert!(v0::Allowlist::::iter_keys().count().is_zero()); + log::info!("{LOG_PREFIX}: Post checks done!"); + + Ok(()) + } + } +} + pub mod v2_update_message_queue { use pallet_liquidity_pools::Message; use pallet_liquidity_pools_gateway::message::GatewayMessage; @@ -108,7 +165,7 @@ pub mod v2_update_message_queue { pub struct Migration(PhantomData); - impl OnRuntimeUpgrade for v2_update_message_queue::Migration + impl OnRuntimeUpgrade for Migration where T: pallet_liquidity_pools_gateway::Config + frame_system::Config @@ -142,10 +199,6 @@ pub mod v2_update_message_queue { fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { assert!( v2::MessageQueue::::iter_values().all(|message| match message { - // TODO: Investigate whether current GatewayMessage should contain domain - // instead (newer commit than on public) - // Ref public: https://github.com/centrifuge/centrifuge-chain/blame/main/pallets/liquidity-pools-gateway/src/message.rs#L8 - // Ref internal: https://github.com/centrifuge/centrifuge-chain-internal/blame/main/pallets/liquidity-pools-gateway/src/message.rs#L8 v2::GatewayMessage::::Inbound { domain_address, .. } => maybe_router_id(domain_address.domain()).is_some(), @@ -157,7 +210,6 @@ pub mod v2_update_message_queue { assert!(v2::FailedMessageQueue::::iter_values() .into_iter() .all(|(message, _)| match message { - // TODO: See above v2::GatewayMessage::::Inbound { domain_address, .. } => maybe_router_id(domain_address.domain()).is_some(), @@ -371,13 +423,12 @@ pub mod v0_init_message_queue { } pub mod init_axelar_router { - use cfg_types::EVMChainId; + use cfg_types::{domain_address::DomainAddress, EVMChainId}; + #[cfg(feature = "try-runtime")] + use frame_support::dispatch::DispatchResult; #[cfg(feature = "try-runtime")] use frame_support::storage::transactional; - use frame_support::{ - dispatch::DispatchResult, - traits::{GetStorageVersion, OriginTrait, StorageVersion}, - }; + use frame_support::traits::{GetStorageVersion, OriginTrait, StorageVersion}; use frame_system::pallet_prelude::OriginFor; #[cfg(feature = "try-runtime")] use sp_arithmetic::traits::SaturatedConversion; @@ -410,7 +461,7 @@ pub mod init_axelar_router { fn on_runtime_upgrade() -> Weight { let (reads, writes) = Self::migrate_domain_routers().unwrap_or_default(); log::info!( - "{LOG_PREFIX} ON_RUNTIME_UPGRADE: Migration done with {writes:?} updated domains!" + "{LOG_PREFIX} ON_RUNTIME_UPGRADE: Migration done with {writes:?} updated domain addresses!" ); T::DbWeight::get().reads_writes(reads, writes.saturating_add(1)) @@ -423,7 +474,7 @@ pub mod init_axelar_router { // Need to rollback in order to be NOOP let _ = transactional::with_storage_layer(|| -> DispatchResult { let (r, w) = Self::migrate_domain_routers()?; - log::info!("{LOG_PREFIX} PRE Migration counts {w:?} updated domains and {} removed domains", r.saturating_sub(w)); + log::info!("{LOG_PREFIX} PRE Migration counts {w:?} updated domain addresses and {} removed domains", r.saturating_sub(w)); writes = w; Err(DispatchError::Other("Reverting on purpose")) }); @@ -500,8 +551,9 @@ pub mod init_axelar_router { match val { v0::DomainRouter::AxelarEVM(axelar) => { - Self::migrate_axelar_evm(axelar, chain_id, &domain)?; - writes.saturating_accrue(1); + let (r, w) = Self::migrate_axelar_evm(axelar, chain_id, &domain)?; + reads.saturating_accrue(r); + writes.saturating_accrue(w); } v0::DomainRouter::EthereumXCM(_) => { log::info!( @@ -535,8 +587,9 @@ pub mod init_axelar_router { } Some(id) => id, }; - Self::migrate_axelar_evm(domain_router.into(), chain_id, &domain)?; - writes.saturating_accrue(1); + let (r, w) = Self::migrate_axelar_evm(domain_router.into(), chain_id, &domain)?; + reads.saturating_accrue(r); + writes.saturating_accrue(w); } Ok((reads, writes)) @@ -546,20 +599,46 @@ pub mod init_axelar_router { router: v0::AxelarEVMRouter, chain_id: EVMChainId, domain: &Domain, - ) -> DispatchResult { - pallet_axelar_router::Pallet::::set_config( - T::RuntimeOrigin::root(), - router.evm_chain.clone(), - Box::new(router.migrate_to_domain_config(chain_id)), - ) - .map_err(|e| { - log::error!( - "{LOG_PREFIX}: Failed to set axelar config for {domain:?} due to error \n{e:?}" - ); - e - })?; + ) -> Result<(u64, u64), DispatchError> { + let mut reads = 1u64; + let mut writes = 0u64; - Ok(()) + let outbound_contract_address = v0::GatewayContract::get(); + + if let Some((whitelisted_domain_address, _)) = + v0::Allowlist::::iter_prefix(domain).last() + { + log::info!("{LOG_PREFIX}: Migrating {domain:?} domain with allowlist domain address {whitelisted_domain_address:?}"); + + if let DomainAddress::Evm(_, app_contract_address) = whitelisted_domain_address { + pallet_axelar_router::Pallet::::set_config( + T::RuntimeOrigin::root(), + router.evm_chain.clone(), + Box::new(router.migrate_to_domain_config( + chain_id, + // Read v0::gateway::AllowList storage => addr1 + app_contract_address, + // Read v0::axelar-gateway-precompile::GatewayContract => addr 2 + outbound_contract_address, + )), + ) + .map_err(|e| { + log::error!( + "{LOG_PREFIX}: Failed to set axelar config for {domain:?} due to error \n{e:?}" + ); + e + })?; + + writes += 1; + } else { + log::error!( + "{LOG_PREFIX}: Failed to retrieve EVM domain_address from {whitelisted_domain_address:?}" + ); + reads += 1; + } + } + + Ok((reads.saturating_add(writes), writes)) } } } @@ -693,9 +772,7 @@ mod types { BoundedVec, }; use frame_system::pallet_prelude::OriginFor; - // TODO: Re-enable after AxelarConfig fix - // use pallet_axelar_router::{AxelarConfig, DomainConfig, EvmConfig, FeeValues}; - use pallet_axelar_router::{AxelarConfig, FeeValues}; + use pallet_axelar_router::{AxelarConfig, DomainConfig, EvmConfig, FeeValues}; use pallet_liquidity_pools::Message; use sp_core::{H160, H256}; use staging_xcm::VersionedLocation; @@ -763,6 +840,29 @@ mod types { AxelarXCM(AxelarXCMRouter), } + struct LiquidityPoolsAxelarGatewayPrefix; + impl frame_support::traits::StorageInstance for LiquidityPoolsAxelarGatewayPrefix { + const STORAGE_PREFIX: &'static str = "GatewayContract"; + + fn pallet_prefix() -> &'static str { + "LiquidityPoolsAxelarGateway" + } + } + + #[storage_alias] + pub type GatewayContract = + StorageValue; + + #[storage_alias] + pub type Allowlist = StorageDoubleMap< + pallet_liquidity_pools_gateway::Pallet, + Blake2_128Concat, + Domain, + Blake2_128Concat, + DomainAddress, + (), + >; + #[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)] pub struct AxelarEVMRouter where @@ -781,19 +881,21 @@ mod types { OriginFor: From + Into>>, { - pub(crate) fn migrate_to_domain_config(&self, _chain_id: EVMChainId) -> AxelarConfig { - todo!() - /* + pub(crate) fn migrate_to_domain_config( + &self, + chain_id: EVMChainId, + app_contract_address: H160, + inbound_contract_address: H160, + ) -> AxelarConfig { AxelarConfig { - liquidity_pools_contract_address: self.liquidity_pools_contract_address, + app_contract_address, + inbound_contract_address, + outbound_contract_address: self.liquidity_pools_contract_address, domain: DomainConfig::Evm(EvmConfig { chain_id, - target_contract_address: self.router.evm_domain.target_contract_address, - target_contract_hash: self.router.evm_domain.target_contract_hash, - fee_values: self.router.evm_domain.fee_values.clone(), + outbound_fee_values: self.router.evm_domain.fee_values.clone(), }), } - */ } } diff --git a/runtime/development/Cargo.toml b/runtime/development/Cargo.toml index 8391926851..ac92c94e31 100644 --- a/runtime/development/Cargo.toml +++ b/runtime/development/Cargo.toml @@ -106,7 +106,6 @@ pallet-interest-accrual = { workspace = true } pallet-investments = { workspace = true } pallet-keystore = { workspace = true } pallet-liquidity-pools = { workspace = true } -pallet-liquidity-pools-forwarder = { workspace = true } pallet-liquidity-pools-gateway = { workspace = true } pallet-liquidity-pools-gateway-queue = { workspace = true } pallet-liquidity-rewards = { workspace = true } @@ -237,7 +236,6 @@ std = [ "pallet-investments/std", "pallet-keystore/std", "pallet-liquidity-pools/std", - "pallet-liquidity-pools-forwarder/std", "pallet-liquidity-pools-gateway/std", "pallet-liquidity-rewards/std", "pallet-loans/std", @@ -325,7 +323,6 @@ runtime-benchmarks = [ "pallet-investments/runtime-benchmarks", "pallet-keystore/runtime-benchmarks", "pallet-liquidity-pools/runtime-benchmarks", - "pallet-liquidity-pools-forwarder/runtime-benchmarks", "pallet-liquidity-pools-gateway/runtime-benchmarks", "pallet-liquidity-rewards/runtime-benchmarks", "pallet-loans/runtime-benchmarks", @@ -413,7 +410,6 @@ try-runtime = [ "pallet-investments/try-runtime", "pallet-keystore/try-runtime", "pallet-liquidity-pools/try-runtime", - "pallet-liquidity-pools-forwarder/try-runtime", "pallet-liquidity-pools-gateway/try-runtime", "pallet-liquidity-rewards/try-runtime", "pallet-loans/try-runtime", diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index 4c8ee882b8..2b157632df 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -1859,15 +1859,6 @@ impl pallet_liquidity_pools::Config for Runtime { type WeightInfo = (); } -impl pallet_liquidity_pools_forwarder::Config for Runtime { - type AdminOrigin = EnsureRootOr; - type Message = pallet_liquidity_pools::Message; - type MessageReceiver = LiquidityPoolsGateway; - type MessageSender = MessageSerializer, LiquidityPoolsForwarder>; - type RouterId = RouterId; - type RuntimeEvent = RuntimeEvent; -} - parameter_types! { pub Sender: DomainAddress = gateway::get_gateway_domain_address::(); pub const MaxIncomingMessageSize: u32 = 1024; @@ -1881,7 +1872,7 @@ impl pallet_liquidity_pools_gateway::Config for Runtime { type MaxRouterCount = MaxRouterCount; type Message = pallet_liquidity_pools::Message; type MessageQueue = LiquidityPoolsGatewayQueue; - type MessageSender = LiquidityPoolsForwarder; + type MessageSender = MessageSerializer, ()>; type RouterId = RouterId; type RouterProvider = LPGatewayRouterProvider; type RuntimeEvent = RuntimeEvent; @@ -2005,7 +1996,7 @@ impl pallet_ethereum_transaction::Config for Runtime {} impl pallet_axelar_router::Config for Runtime { type AdminOrigin = EnsureRoot; type Middleware = RouterId; - type Receiver = MessageSerializer, LiquidityPoolsForwarder>; + type Receiver = MessageSerializer<(), LiquidityPoolsGateway>; type RuntimeEvent = RuntimeEvent; type Transactor = EthereumTransaction; } @@ -2210,7 +2201,6 @@ construct_runtime!( // our pallets part 2 AnchorsV2: pallet_anchors_v2::{Pallet, Call, Storage, Event} = 130, LiquidityPoolsGatewayQueue: pallet_liquidity_pools_gateway_queue::{Pallet, Call, Storage, Event} = 131, - LiquidityPoolsForwarder: pallet_liquidity_pools_forwarder::{Pallet, Call, Storage, Event} = 132, // XCM XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 120, diff --git a/runtime/development/src/migrations.rs b/runtime/development/src/migrations.rs index 19ec695e22..4c4c59f8ce 100644 --- a/runtime/development/src/migrations.rs +++ b/runtime/development/src/migrations.rs @@ -11,12 +11,18 @@ // GNU General Public License for more details. use frame_support::migrations::VersionedMigration; +use sp_core::parameter_types; use crate::Runtime; +parameter_types! { + pub PalletLiquidityPoolsAxelarGateway: &'static str = "LiquidityPoolsAxelarGateway"; +} + pub type UpgradeDevelopment1403 = ( - runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration, + // Clear OutboundMessageNonceStore and migrate outbound storage to LP queue runtime_common::migrations::liquidity_pools_v2::v2_update_message_queue::Migration, + // Remove deprecated DomainRouters entries and migrate relevant ones to Axelar Router Config VersionedMigration< 2, 3, @@ -24,4 +30,13 @@ pub type UpgradeDevelopment1403 = ( pallet_liquidity_pools_gateway::Pallet, ::DbWeight, >, + // Remove deprecated LiquidityPoolsGateway::{v0, v1, v2}::RelayerList storag + runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration, + // Remove deprecated LiquidityPoolsGateway::{v0, v1, v2}::Allowlist storage + runtime_common::migrations::liquidity_pools_v2::kill_allowlist::Migration, + // Remove deprecated LiquidityPoolsAxelarGateway + runtime_common::migrations::nuke::KillPallet< + PalletLiquidityPoolsAxelarGateway, + ::DbWeight, + >, ); diff --git a/runtime/integration-tests/src/cases.rs b/runtime/integration-tests/src/cases.rs index 5804e2b963..6a79cd5c84 100644 --- a/runtime/integration-tests/src/cases.rs +++ b/runtime/integration-tests/src/cases.rs @@ -5,7 +5,6 @@ mod currency_conversions; mod ethereum_transaction; mod example; mod foreign_investments; -mod forwarder; mod investments; mod loans; mod lp; diff --git a/runtime/integration-tests/src/cases/forwarder.rs b/runtime/integration-tests/src/cases/forwarder.rs deleted file mode 100644 index fc9b2a1967..0000000000 --- a/runtime/integration-tests/src/cases/forwarder.rs +++ /dev/null @@ -1,45 +0,0 @@ -use cfg_traits::liquidity_pools::MessageProcessor; -use cfg_types::{domain_address::Domain, EVMChainId}; -use frame_support::{assert_err, assert_ok, dispatch::RawOrigin, BoundedVec}; -use pallet_liquidity_pools::Message; -use pallet_liquidity_pools_gateway::message::GatewayMessage; -use runtime_common::routing::{AxelarId, RouterId}; -use sp_core::H160; - -use crate::{config::Runtime, env::Env, envs::runtime_env::RuntimeEnv}; - -const CHAIN_ID: EVMChainId = 1; -const FORWARDED_CONTRACT: H160 = H160::repeat_byte(1); -const ROUTER_ID: RouterId = RouterId::Axelar(AxelarId::Evm(CHAIN_ID)); - -#[test_runtimes(all)] -fn send() { - let mut env = RuntimeEnv::::default(); - - env.parachain_state_mut(|| { - assert_ok!(pallet_liquidity_pools_gateway::Pallet::::set_routers( - RawOrigin::Root.into(), - BoundedVec::try_from(vec![ROUTER_ID]).unwrap(), - )); - - assert_ok!( - pallet_liquidity_pools_forwarder::Pallet::::set_forwarder( - RawOrigin::Root.into(), - ROUTER_ID, - Domain::Centrifuge, // NOTE: this parameter will be removed - FORWARDED_CONTRACT, - ) - ); - - let gateway_message = GatewayMessage::Outbound { - router_id: ROUTER_ID, - message: Message::Invalid, - }; - - // If the message reach the router, it worked - assert_err!( - pallet_liquidity_pools_gateway::Pallet::::process(gateway_message).0, - pallet_axelar_router::Error::::RouterConfigurationNotFound - ); - }); -} diff --git a/runtime/integration-tests/src/config.rs b/runtime/integration-tests/src/config.rs index e68dcbef93..2898b6e1ef 100644 --- a/runtime/integration-tests/src/config.rs +++ b/runtime/integration-tests/src/config.rs @@ -183,7 +183,6 @@ pub trait Runtime: Balance = Balance, Rewards = pallet_rewards::Pallet, > + pallet_axelar_router::Config - + pallet_liquidity_pools_forwarder::Config + pallet_token_mux::Config< BalanceIn = Balance, BalanceOut = Balance,