From 006c5a39f0845c304feee0858c599f3b8e9f26b7 Mon Sep 17 00:00:00 2001 From: William Freudenberger Date: Fri, 16 Aug 2024 22:40:24 +0200 Subject: [PATCH] chore: compile runtimes --- Cargo.lock | 3 +++ pallets/liquidity-pools-forwarder/src/lib.rs | 14 +++++++------- pallets/liquidity-pools-gateway/src/lib.rs | 8 ++++++-- pallets/liquidity-pools/src/message.rs | 6 +++--- runtime/altair/Cargo.toml | 4 ++++ runtime/altair/src/lib.rs | 15 +++++++++++++-- runtime/centrifuge/Cargo.toml | 4 ++++ runtime/centrifuge/src/lib.rs | 15 +++++++++++++-- runtime/development/Cargo.toml | 4 ++++ runtime/development/src/lib.rs | 15 +++++++++++++-- 10 files changed, 70 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6df85e79f6..f7c390f229 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,6 +180,7 @@ dependencies = [ "pallet-investments", "pallet-keystore", "pallet-liquidity-pools", + "pallet-liquidity-pools-forwarder", "pallet-liquidity-pools-gateway", "pallet-liquidity-pools-gateway-queue", "pallet-liquidity-rewards", @@ -1502,6 +1503,7 @@ dependencies = [ "pallet-investments", "pallet-keystore", "pallet-liquidity-pools", + "pallet-liquidity-pools-forwarder", "pallet-liquidity-pools-gateway", "pallet-liquidity-pools-gateway-queue", "pallet-liquidity-rewards", @@ -3115,6 +3117,7 @@ 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/liquidity-pools-forwarder/src/lib.rs b/pallets/liquidity-pools-forwarder/src/lib.rs index 1e3801d92e..f795d039ca 100644 --- a/pallets/liquidity-pools-forwarder/src/lib.rs +++ b/pallets/liquidity-pools-forwarder/src/lib.rs @@ -81,14 +81,14 @@ pub mod pallet { + FullCodec; /// The entity of the messages coming from this chain. - type Sender: MessageSender< + type MessageSender: MessageSender< Middleware = Self::RouterId, Origin = DomainAddress, Message = Vec, >; /// The entity which acts on unwrapped messages. - type Receiver: MessageReceiver; + type MessageReceiver: MessageReceiver; /// An identification of a router. type RouterId: Parameter + MaxEncodedLen; @@ -149,7 +149,7 @@ pub mod pallet { RouterForwarding::::insert( &router_id, ForwardInfo { - source_domain: source_domain.clone(), + source_domain, contract: forwarding_contract, }, ); @@ -203,7 +203,7 @@ pub mod pallet { message.serialize() }; - T::Sender::send(router_id, origin, payload) + T::MessageSender::send(router_id, origin, payload) } } @@ -225,9 +225,9 @@ pub mod pallet { // NOTE: We can rely on EVM side to ensure forwarded messages are valid such // that it suffices to filter for the existence of forwarding info if RouterForwarding::::get(&router_id).is_some() { - return T::Receiver::receive( + return T::MessageReceiver::receive( router_id, - domain_address.domain(), + domain_address, lp_message.serialize(), ); } @@ -235,7 +235,7 @@ pub mod pallet { Err(Error::::ForwardInfoNotFound.into()) } else { - T::Receiver::receive(router_id, domain_address.domain(), payload) + T::MessageReceiver::receive(router_id, domain_address, payload) } } } diff --git a/pallets/liquidity-pools-gateway/src/lib.rs b/pallets/liquidity-pools-gateway/src/lib.rs index 0e7dfb39ce..23572c3bb3 100644 --- a/pallets/liquidity-pools-gateway/src/lib.rs +++ b/pallets/liquidity-pools-gateway/src/lib.rs @@ -105,7 +105,11 @@ pub mod pallet { + FullCodec; /// The target of the messages coming from this chain - type MessageSender: MessageSender; + type MessageSender: MessageSender< + Middleware = Self::RouterId, + Origin = DomainAddress, + Message = Self::Message, + >; /// An identification of a router type RouterId: Parameter + MaxEncodedLen; @@ -525,7 +529,7 @@ pub mod pallet { } => { let weight = LP_DEFENSIVE_WEIGHT; - match T::MessageSender::send(router_id, sender, message.serialize()) { + match T::MessageSender::send(router_id, sender, message) { Ok(_) => (Ok(()), weight), Err(e) => (Err(e), weight), } diff --git a/pallets/liquidity-pools/src/message.rs b/pallets/liquidity-pools/src/message.rs index a1ed535070..c40755c382 100644 --- a/pallets/liquidity-pools/src/message.rs +++ b/pallets/liquidity-pools/src/message.rs @@ -212,9 +212,9 @@ impl TryFrom for NonForwardMessage { } } -impl Into for NonForwardMessage { - fn into(self) -> Message { - *self.0 +impl From for Message { + fn from(value: NonForwardMessage) -> Self { + *value.0 } } diff --git a/runtime/altair/Cargo.toml b/runtime/altair/Cargo.toml index ea5009dd4e..9393852b18 100644 --- a/runtime/altair/Cargo.toml +++ b/runtime/altair/Cargo.toml @@ -105,6 +105,7 @@ 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 } @@ -234,6 +235,7 @@ 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", @@ -321,6 +323,7 @@ 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", @@ -407,6 +410,7 @@ 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 4c809605ef..ac9ba978bf 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -1754,6 +1754,16 @@ 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 = RouterDispatcher; + type RouterId = RouterId; + type RouterProvider = LPGatewayRouterProvider; + type RuntimeEvent = RuntimeEvent; +} + parameter_types! { pub Sender: DomainAddress = gateway::get_gateway_domain_address::(); pub const MaxIncomingMessageSize: u32 = 1024; @@ -1768,7 +1778,7 @@ impl pallet_liquidity_pools_gateway::Config for Runtime { type MaxRouterCount = MaxRouterCount; type Message = pallet_liquidity_pools::Message; type MessageQueue = LiquidityPoolsGatewayQueue; - type MessageSender = RouterDispatcher; + type MessageSender = LiquidityPoolsForwarder; type RouterId = RouterId; type RouterProvider = LPGatewayRouterProvider; type RuntimeEvent = RuntimeEvent; @@ -1893,7 +1903,7 @@ impl pallet_axelar_router::Config for Runtime { type AdminOrigin = EnsureRoot; type EvmAccountCodeChecker = EvmAccountCodeChecker; type Middleware = RouterId; - type Receiver = LiquidityPoolsGateway; + type Receiver = LiquidityPoolsForwarder; type RuntimeEvent = RuntimeEvent; type Transactor = EthereumTransaction; } @@ -2124,6 +2134,7 @@ 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/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index 0a4f83b50f..4fb42616de 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -102,6 +102,7 @@ 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 } @@ -226,6 +227,7 @@ 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", @@ -309,6 +311,7 @@ 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", @@ -391,6 +394,7 @@ 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 7aaf756c4d..2512fc843d 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -1843,6 +1843,16 @@ 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 = RouterDispatcher; + type RouterId = RouterId; + type RouterProvider = LPGatewayRouterProvider; + type RuntimeEvent = RuntimeEvent; +} + parameter_types! { // A temporary admin account for the LP logic // This is a multi-sig controlled pure proxy on mainnet @@ -1867,7 +1877,7 @@ impl pallet_liquidity_pools_gateway::Config for Runtime { type MaxRouterCount = MaxRouterCount; type Message = pallet_liquidity_pools::Message; type MessageQueue = LiquidityPoolsGatewayQueue; - type MessageSender = RouterDispatcher; + type MessageSender = LiquidityPoolsForwarder; type RouterId = RouterId; type RouterProvider = LPGatewayRouterProvider; type RuntimeEvent = RuntimeEvent; @@ -1992,7 +2002,7 @@ impl pallet_axelar_router::Config for Runtime { type AdminOrigin = EnsureAccountOrRootOr; type EvmAccountCodeChecker = EvmAccountCodeChecker; type Middleware = RouterId; - type Receiver = LiquidityPoolsGateway; + type Receiver = LiquidityPoolsForwarder; type RuntimeEvent = RuntimeEvent; type Transactor = EthereumTransaction; } @@ -2096,6 +2106,7 @@ 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, diff --git a/runtime/development/Cargo.toml b/runtime/development/Cargo.toml index ac92c94e31..8391926851 100644 --- a/runtime/development/Cargo.toml +++ b/runtime/development/Cargo.toml @@ -106,6 +106,7 @@ 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 } @@ -236,6 +237,7 @@ 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,6 +325,7 @@ 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,6 +413,7 @@ 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 ed499ffe89..bda5f844d3 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -1859,6 +1859,16 @@ 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 = RouterDispatcher; + type RouterId = RouterId; + type RouterProvider = LPGatewayRouterProvider; + type RuntimeEvent = RuntimeEvent; +} + parameter_types! { pub Sender: DomainAddress = gateway::get_gateway_domain_address::(); pub const MaxIncomingMessageSize: u32 = 1024; @@ -1873,7 +1883,7 @@ impl pallet_liquidity_pools_gateway::Config for Runtime { type MaxRouterCount = MaxRouterCount; type Message = pallet_liquidity_pools::Message; type MessageQueue = LiquidityPoolsGatewayQueue; - type MessageSender = RouterDispatcher; + type MessageSender = LiquidityPoolsForwarder; type RouterId = RouterId; type RouterProvider = LPGatewayRouterProvider; type RuntimeEvent = RuntimeEvent; @@ -1999,7 +2009,7 @@ impl pallet_axelar_router::Config for Runtime { type AdminOrigin = EnsureRoot; type EvmAccountCodeChecker = EvmAccountCodeChecker; type Middleware = RouterId; - type Receiver = LiquidityPoolsGateway; + type Receiver = LiquidityPoolsForwarder; type RuntimeEvent = RuntimeEvent; type Transactor = EthereumTransaction; } @@ -2204,6 +2214,7 @@ 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,