Skip to content

Commit

Permalink
remove unnecessary alias origin
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Dec 4, 2024
1 parent c2804dc commit 02750d6
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions bridges/snowbridge/primitives/router/src/inbound/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ pub enum ConvertMessageError {
InvalidClaimer,
/// Invalid foreign ERC20 token ID
InvalidAsset,
/// The origin could not be added to the interior location of the origin location.
InvalidOrigin,
}

pub trait ConvertMessage {
Expand Down Expand Up @@ -176,17 +174,17 @@ where
instructions.push(SetAssetClaimer { location: claimer_location });
}

let mut origin_location = Location::new(2, [GlobalConsensus(network)]);
if message.origin == GatewayProxyAddress::get() {
// If the message origin is the gateway proxy contract, set the origin to
// Ethereum, for consistency with v1.
instructions.push(AliasOrigin(origin_location));
} else {
// Set the alias origin to the original sender on Ethereum. Important to be before the
// arbitrary XCM that is appended to the message on the next line.
origin_location
.push_interior(AccountKey20 { key: message.origin.into(), network: None })
.map_err(|_| ConvertMessageError::InvalidOrigin)?;
// If the message origin is not the gateway proxy contract, set the origin to
// the original sender on Ethereum. Important to be before the arbitrary XCM that is
// appended to the message on the next line.
if message.origin != GatewayProxyAddress::get() {
let origin_location = Location::new(
2,
[
GlobalConsensus(network),
AccountKey20 { key: message.origin.into(), network: None },
],
);
instructions.push(AliasOrigin(origin_location.into()));
}

Expand Down

0 comments on commit 02750d6

Please sign in to comment.