Skip to content

Commit

Permalink
fix(evm): ucs01: revert invalid change in denom prefixing (#2729)
Browse files Browse the repository at this point in the history
Revert changes made in #2672
where we wrongly switched the prefixing. See `onRecvPacket` function in
https://github.com/cosmos/ibc/tree/main/spec/app/ics-020-fungible-token-transfer:
```js
    // we are the source if the packets were prefixed by the sending chain
    // if the sender sends the tokens prefixed with their channel end's
    // port and channel identifiers then we are receiving tokens we 
    // previously had sent to the sender, thus we are receiving the tokens
    // as a source zone
    if isTracePrefixed(packet.sourcePort, packet.sourceChannel, token) {
```
  • Loading branch information
hussein-aitlahcen authored Aug 12, 2024
2 parents e08f625 + 8821b4e commit 1e76e15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion evm/contracts/apps/ucs/01-relay/Relay.sol
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ contract UCS01Relay is
}
RelayPacket calldata packet = RelayPacketLib.decode(ibcPacket.data);
string memory prefix = RelayLib.makeDenomPrefix(
ibcPacket.destination_port, ibcPacket.destination_channel
ibcPacket.source_port, ibcPacket.source_channel
);
uint256 packetTokensLength = packet.tokens.length;
for (uint256 i; i < packetTokensLength; i++) {
Expand Down
10 changes: 4 additions & 6 deletions evm/tests/src/apps/ucs/01-relay/Relay.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ contract RelayTests is Test {
// Receive a token that hasn't been escrowed
Token[] memory tokens = new Token[](1);
tokens[0].denom = RelayLib.makeForeignDenom(
destinationPort, destinationChannel, denom.toHexString()
sourcePort, sourceChannel, denom.toHexString()
);
tokens[0].amount = amount;

Expand Down Expand Up @@ -709,9 +709,7 @@ contract RelayTests is Test {

Token[] memory tokens = new Token[](1);
tokens[0].denom = RelayLib.makeForeignDenom(
args.destinationPort,
args.destinationChannel,
denomAddress.toHexString()
args.sourcePort, args.sourceChannel, denomAddress.toHexString()
);
tokens[0].amount = args.amount;

Expand Down Expand Up @@ -1111,7 +1109,7 @@ contract RelayTests is Test {
args.receiver,
args.relayer,
RelayLib.makeForeignDenom(
args.sourcePort, args.sourceChannel, args.denomName
args.destinationPort, "channel-1", args.denomName
),
args.amount,
args.extension
Expand All @@ -1130,7 +1128,7 @@ contract RelayTests is Test {
args.receiver,
args.relayer,
RelayLib.makeForeignDenom(
args.sourcePort, args.sourceChannel, args.denomName
args.destinationPort, "channel-2", args.denomName
),
args.amount,
args.extension
Expand Down

0 comments on commit 1e76e15

Please sign in to comment.