Skip to content

Commit

Permalink
lp-forwarder: Always use Centrifuge domain when wrapping outbound mes…
Browse files Browse the repository at this point in the history
…sages
  • Loading branch information
cdamian committed Aug 19, 2024
1 parent c55e74f commit 173c44f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
6 changes: 1 addition & 5 deletions libs/traits/src/liquidity_pools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ pub trait LpMessageForwarded: Sized {
fn unwrap_forwarded(self) -> Option<(Self::Domain, H160, Self)>;

/// Attempts to wrap into a forwarded message.
fn try_wrap_forward(
domain: Self::Domain,
forwarding_contract: H160,
message: Self,
) -> Result<Self, DispatchError>;
fn try_wrap_forward(forwarding_contract: H160, message: Self) -> Result<Self, DispatchError>;
}

pub trait RouterProvider<Domain>: Sized {
Expand Down
4 changes: 1 addition & 3 deletions pallets/liquidity-pools-forwarder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ pub mod pallet {
message: T::Message,
) -> DispatchResult {
let msg = RouterForwarding::<T>::get(&router_id)
.map(|info| {
T::Message::try_wrap_forward(info.source_domain, info.contract, message.clone())
})
.map(|info| T::Message::try_wrap_forward(info.contract, message.clone()))
.unwrap_or_else(|| {
ensure!(!message.is_forwarded(), Error::<T>::ForwardInfoNotFound);
Ok(message)
Expand Down
2 changes: 1 addition & 1 deletion pallets/liquidity-pools-forwarder/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl LpMessageForwarded for Message {
}
}

fn try_wrap_forward(_: Self::Domain, _: H160, message: Self) -> Result<Self, DispatchError> {
fn try_wrap_forward(_: H160, message: Self) -> Result<Self, DispatchError> {
match message {
Self::Forward => Err(ERROR_NESTING),
Self::NonForward => Ok(Self::Forward),
Expand Down
8 changes: 2 additions & 6 deletions pallets/liquidity-pools/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,13 +659,9 @@ impl LpMessageForwarded for Message {
}
}

fn try_wrap_forward(
source_domain: Domain,
forwarding_contract: H160,
message: Self,
) -> Result<Self, DispatchError> {
fn try_wrap_forward(forwarding_contract: H160, message: Self) -> Result<Self, DispatchError> {
Ok(Self::Forwarded {
source_domain: source_domain.into(),
source_domain: Domain::Centrifuge.into(),
forwarding_contract,
message: message.try_into().map_err(|_| {
DispatchError::Other(
Expand Down

0 comments on commit 173c44f

Please sign in to comment.