Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lp-forwarder: Always use Centrifuge domain when wrapping outbound mes… #1980

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(),
cdamian marked this conversation as resolved.
Show resolved Hide resolved
forwarding_contract,
message: message.try_into().map_err(|_| {
DispatchError::Other(
Expand Down
Loading