Skip to content

Commit

Permalink
chore: compile runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
wischli committed Aug 16, 2024
1 parent e5dedb2 commit 006c5a3
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pallets/liquidity-pools-forwarder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
>;

/// The entity which acts on unwrapped messages.
type Receiver: MessageReceiver<Middleware = Self::RouterId, Origin = Domain>;
type MessageReceiver: MessageReceiver<Middleware = Self::RouterId, Origin = DomainAddress>;

/// An identification of a router.
type RouterId: Parameter + MaxEncodedLen;
Expand Down Expand Up @@ -149,7 +149,7 @@ pub mod pallet {
RouterForwarding::<T>::insert(
&router_id,
ForwardInfo {
source_domain: source_domain.clone(),
source_domain,
contract: forwarding_contract,
},
);
Expand Down Expand Up @@ -203,7 +203,7 @@ pub mod pallet {
message.serialize()
};

T::Sender::send(router_id, origin, payload)
T::MessageSender::send(router_id, origin, payload)
}
}

Expand All @@ -225,17 +225,17 @@ 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::<T>::get(&router_id).is_some() {
return T::Receiver::receive(
return T::MessageReceiver::receive(
router_id,
domain_address.domain(),
domain_address,
lp_message.serialize(),
);
}
}

Err(Error::<T>::ForwardInfoNotFound.into())
} else {
T::Receiver::receive(router_id, domain_address.domain(), payload)
T::MessageReceiver::receive(router_id, domain_address, payload)
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions pallets/liquidity-pools-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ pub mod pallet {
+ FullCodec;

/// The target of the messages coming from this chain
type MessageSender: MessageSender<Middleware = Self::RouterId, Origin = DomainAddress>;
type MessageSender: MessageSender<
Middleware = Self::RouterId,
Origin = DomainAddress,
Message = Self::Message,
>;

/// An identification of a router
type RouterId: Parameter + MaxEncodedLen;
Expand Down Expand Up @@ -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),
}
Expand Down
6 changes: 3 additions & 3 deletions pallets/liquidity-pools/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ impl TryFrom<Message> for NonForwardMessage {
}
}

impl Into<Message> for NonForwardMessage {
fn into(self) -> Message {
*self.0
impl From<NonForwardMessage> for Message {
fn from(value: NonForwardMessage) -> Self {
*value.0
}
}

Expand Down
4 changes: 4 additions & 0 deletions runtime/altair/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
15 changes: 13 additions & 2 deletions runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,16 @@ impl pallet_liquidity_pools::Config for Runtime {
type WeightInfo = ();
}

impl pallet_liquidity_pools_forwarder::Config for Runtime {
type AdminOrigin = EnsureRootOr<HalfOfCouncil>;
type Message = pallet_liquidity_pools::Message;
type MessageReceiver = LiquidityPoolsGateway;
type MessageSender = RouterDispatcher<Runtime>;
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
}

parameter_types! {
pub Sender: DomainAddress = gateway::get_gateway_domain_address::<Runtime>();
pub const MaxIncomingMessageSize: u32 = 1024;
Expand All @@ -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<Runtime>;
type MessageSender = LiquidityPoolsForwarder;
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -1893,7 +1903,7 @@ impl pallet_axelar_router::Config for Runtime {
type AdminOrigin = EnsureRoot<AccountId>;
type EvmAccountCodeChecker = EvmAccountCodeChecker<Runtime>;
type Middleware = RouterId;
type Receiver = LiquidityPoolsGateway;
type Receiver = LiquidityPoolsForwarder;
type RuntimeEvent = RuntimeEvent;
type Transactor = EthereumTransaction;
}
Expand Down Expand Up @@ -2124,6 +2134,7 @@ construct_runtime!(
// Removed: Swaps = 200
TokenMux: pallet_token_mux::{Pallet, Call, Storage, Event<T>} = 201,
LiquidityPoolsGatewayQueue: pallet_liquidity_pools_gateway_queue::{Pallet, Call, Storage, Event<T>} = 202,
LiquidityPoolsForwarder: pallet_liquidity_pools_forwarder::{Pallet, Call, Storage, Event<T>} = 203,
}
);

Expand Down
4 changes: 4 additions & 0 deletions runtime/centrifuge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
15 changes: 13 additions & 2 deletions runtime/centrifuge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,16 @@ parameter_types! {
pub const MaxRouterCount: u32 = 8;
}

impl pallet_liquidity_pools_forwarder::Config for Runtime {
type AdminOrigin = EnsureAccountOrRootOr<LpAdminAccount, TwoThirdOfCouncil>;
type Message = pallet_liquidity_pools::Message;
type MessageReceiver = LiquidityPoolsGateway;
type MessageSender = RouterDispatcher<Runtime>;
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
Expand All @@ -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<Runtime>;
type MessageSender = LiquidityPoolsForwarder;
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -1992,7 +2002,7 @@ impl pallet_axelar_router::Config for Runtime {
type AdminOrigin = EnsureAccountOrRootOr<LpAdminAccount, TwoThirdOfCouncil>;
type EvmAccountCodeChecker = EvmAccountCodeChecker<Runtime>;
type Middleware = RouterId;
type Receiver = LiquidityPoolsGateway;
type Receiver = LiquidityPoolsForwarder;
type RuntimeEvent = RuntimeEvent;
type Transactor = EthereumTransaction;
}
Expand Down Expand Up @@ -2096,6 +2106,7 @@ construct_runtime!(
Remarks: pallet_remarks::{Pallet, Call, Event<T>} = 113,
PoolFees: pallet_pool_fees::{Pallet, Call, Storage, Event<T>} = 114,
LiquidityPoolsGatewayQueue: pallet_liquidity_pools_gateway_queue::{Pallet, Call, Storage, Event<T>} = 115,
LiquidityPoolsForwarder: pallet_liquidity_pools_forwarder::{Pallet, Call, Storage, Event<T>} = 116,

// XCM
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 120,
Expand Down
4 changes: 4 additions & 0 deletions runtime/development/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
15 changes: 13 additions & 2 deletions runtime/development/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,16 @@ impl pallet_liquidity_pools::Config for Runtime {
type WeightInfo = ();
}

impl pallet_liquidity_pools_forwarder::Config for Runtime {
type AdminOrigin = EnsureRootOr<HalfOfCouncil>;
type Message = pallet_liquidity_pools::Message;
type MessageReceiver = LiquidityPoolsGateway;
type MessageSender = RouterDispatcher<Runtime>;
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
}

parameter_types! {
pub Sender: DomainAddress = gateway::get_gateway_domain_address::<Runtime>();
pub const MaxIncomingMessageSize: u32 = 1024;
Expand All @@ -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<Runtime>;
type MessageSender = LiquidityPoolsForwarder;
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -1999,7 +2009,7 @@ impl pallet_axelar_router::Config for Runtime {
type AdminOrigin = EnsureRoot<AccountId>;
type EvmAccountCodeChecker = EvmAccountCodeChecker<Runtime>;
type Middleware = RouterId;
type Receiver = LiquidityPoolsGateway;
type Receiver = LiquidityPoolsForwarder;
type RuntimeEvent = RuntimeEvent;
type Transactor = EthereumTransaction;
}
Expand Down Expand Up @@ -2204,6 +2214,7 @@ construct_runtime!(
// our pallets part 2
AnchorsV2: pallet_anchors_v2::{Pallet, Call, Storage, Event<T>} = 130,
LiquidityPoolsGatewayQueue: pallet_liquidity_pools_gateway_queue::{Pallet, Call, Storage, Event<T>} = 131,
LiquidityPoolsForwarder: pallet_liquidity_pools_forwarder::{Pallet, Call, Storage, Event<T>} = 132,

// XCM
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 120,
Expand Down

0 comments on commit 006c5a3

Please sign in to comment.