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-1975] TODO cleanup #49

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion script/InitializeChildContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ contract InitializeChildContracts is Script {
vm.createSelectFork(params.childRpcUrl);
vm.startBroadcast(params.deployerPrivateKey);

// TODO update
IChildERC20Bridge.InitializationRoles memory roles = IChildERC20Bridge.InitializationRoles({
defaultAdmin: params.childAdminAddress,
pauser: params.childPauserAddress,
Expand Down
2 changes: 0 additions & 2 deletions script/InitializeRootContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ contract InitializeRootContracts is Script {
vm.createSelectFork(params.rootRpcUrl);
vm.startBroadcast(params.rootPrivateKey);

// TODO add pauser, unpauser roles. variable manager and Adaptor manager will be privileged transaction multisg

IRootERC20Bridge.InitializationRoles memory roles = IRootERC20Bridge.InitializationRoles({
defaultAdmin: params.rootAdminAddress,
pauser: params.rootPauserAddress,
Expand Down
1 change: 0 additions & 1 deletion src/root/RootAxelarBridgeAdaptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ contract RootAxelarBridgeAdaptor is
string memory _childBridgeAdaptor = IRootERC20Bridge(rootBridge).childBridgeAdaptor();
string memory _childChain = childChain;

// TODO For `sender` (first param), should likely be refundRecipient (and in which case refundRecipient should be renamed to sender and used as refund recipient)
gasService.payNativeGasForContractCall{value: msg.value}(
address(this), _childChain, _childBridgeAdaptor, payload, refundRecipient
);
Expand Down
2 changes: 0 additions & 2 deletions src/root/RootERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ contract RootERC20Bridge is BridgeRoles, IRootERC20Bridge, IRootERC20BridgeEvent

bytes memory payload =
abi.encode(MAP_TOKEN_SIG, rootToken, rootToken.name(), rootToken.symbol(), rootToken.decimals());
// TODO investigate using delegatecall to keep the axelar message sender as the bridge contract, since adaptor can change.
rootBridgeAdaptor.sendMessage{value: msg.value}(payload, msg.sender);

emit L1TokenMapped(address(rootToken), childToken);
Expand Down Expand Up @@ -447,7 +446,6 @@ contract RootERC20Bridge is BridgeRoles, IRootERC20Bridge, IRootERC20BridgeEvent
// Deposit sig, root token address, depositor, receiver, amount
bytes memory payload = abi.encode(DEPOSIT_SIG, payloadToken, msg.sender, receiver, amount);

// TODO investigate using delegatecall to keep the axelar message sender as the bridge contract, since adaptor can change.
rootBridgeAdaptor.sendMessage{value: feeAmount}(payload, msg.sender);

if (address(rootToken) == NATIVE_ETH) {
Expand Down
20 changes: 18 additions & 2 deletions test/integration/child/ChildAxelarBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,6 @@ contract ChildERC20BridgeIntegrationTest is Test, IChildERC20BridgeEvents, IChil
);
}

// TODO add mapToken calls to these to isolate the specific error we are testing for vvvv

function test_RevertIf_depositWithRootTokenZeroAddress() public {
address rootTokenAddress = address(0);
address sender = address(0xff);
Expand All @@ -280,6 +278,15 @@ contract ChildERC20BridgeIntegrationTest is Test, IChildERC20BridgeEvents, IChil
bytes32 commandId = bytes32("testCommandId");
bytes32 depositSig = childERC20Bridge.DEPOSIT_SIG();

{
// Found by running `forge inspect src/child/ChildERC20Bridge.sol:ChildERC20Bridge storageLayout | grep -B3 -A5 -i "rootTokenToChildToken"`
uint256 rootTokenToChildTokenMappingSlot = 201;
address childAddress = address(444444);
bytes32 slot = getMappingStorageSlotFor(rootTokenAddress, rootTokenToChildTokenMappingSlot);
bytes32 data = bytes32(uint256(uint160(childAddress)));
vm.store(address(childERC20Bridge), slot, data);
}

vm.expectRevert(ZeroAddress.selector);
childAxelarBridgeAdaptor.execute(
commandId,
Expand All @@ -297,6 +304,15 @@ contract ChildERC20BridgeIntegrationTest is Test, IChildERC20BridgeEvents, IChil
bytes32 commandId = bytes32("testCommandId");
bytes32 depositSig = childERC20Bridge.DEPOSIT_SIG();

{
// Found by running `forge inspect src/child/ChildERC20Bridge.sol:ChildERC20Bridge storageLayout | grep -B3 -A5 -i "rootTokenToChildToken"`
uint256 rootTokenToChildTokenMappingSlot = 201;
address childAddress = address(444444);
bytes32 slot = getMappingStorageSlotFor(rootTokenAddress, rootTokenToChildTokenMappingSlot);
bytes32 data = bytes32(uint256(uint160(childAddress)));
vm.store(address(childERC20Bridge), slot, data);
}

vm.expectRevert(ZeroAddress.selector);
childAxelarBridgeAdaptor.execute(
commandId,
Expand Down
Loading
Loading