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

Smr 1935 erc20 withdraw l1 #18

Merged
merged 13 commits into from
Nov 6, 2023
Merged

Conversation

Benjimmutable
Copy link
Contributor

The L1 side of ERC20 Withdrawals.

Blocked by #16

@Benjimmutable Benjimmutable self-assigned this Nov 3, 2023
@Benjimmutable Benjimmutable changed the base branch from main to smr-1813-withdraw-erc20s November 3, 2023 03:22
@Benjimmutable Benjimmutable changed the base branch from smr-1813-withdraw-erc20s to main November 3, 2023 04:55
@Benjimmutable Benjimmutable marked this pull request as ready for review November 3, 2023 04:56
Comment on lines 64 to 82
function test_RevertsIf_WithdrawWithInvalidSourceAddress() public {
bytes memory data = abi.encode(WITHDRAW_SIG, address(token), address(this), address(this), withdrawAmount);

bytes32 commandId = bytes32("testCommandId");
string memory sourceAddress = rootBridge.childBridgeAdaptor();

vm.expectRevert(InvalidSourceChain.selector);
axelarAdaptor.execute(commandId, "INVALID", sourceAddress, data);
}

function test_RevertsIf_WithdrawWithInvalidSourceChain() public {
bytes memory data = abi.encode(WITHDRAW_SIG, address(token), address(this), address(this), withdrawAmount);

bytes32 commandId = bytes32("testCommandId");
string memory sourceAddress = Strings.toHexString(address(123));

vm.expectRevert(InvalidSourceAddress.selector);
axelarAdaptor.execute(commandId, CHILD_CHAIN_NAME, sourceAddress, data);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these two tests, swapped? the test...InvalidSourceAddress test seems to test for invalid source chain id, and the test...InvalidSourceChain test for invalid source address

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes they are. Good catch thanks

src/root/RootERC20Bridge.sol Outdated Show resolved Hide resolved
@@ -79,7 +77,17 @@ contract RootAxelarBridgeAdaptor is
address(this), _childChain, _childBridgeAdaptor, payload, refundRecipient
);

axelarGateway.callContract(_childChain, _childBridgeAdaptor, payload);
gateway.callContract(_childChain, _childBridgeAdaptor, payload);
emit AxelarMessage(_childChain, _childBridgeAdaptor, payload);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

  • for better observability, should we have a corresponding event when a message is received (in _execute())?
  • suggest we rename AxelarMessage to AxelarMessageSent so its a bit more descriptive

@Benjimmutable Benjimmutable merged commit e678f72 into main Nov 6, 2023
3 checks passed
@Benjimmutable Benjimmutable deleted the smr-1935-erc20-withdraw-L1 branch November 6, 2023 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants