Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Oct 4, 2024
1 parent 3e534d5 commit 4f678e9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions v2/contracts/evm/GatewayEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ contract GatewayEVM is
bytes32 public constant ASSET_HANDLER_ROLE = keccak256("ASSET_HANDLER_ROLE");
/// @notice New role identifier for pauser role.
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
/// @notice Max payload size.
uint256 public constant MAX_PAYLOAD_SIZE = 512;
/// @notice Max size of payload + revertOptions revert message.
uint256 public constant MAX_PAYLOAD_SIZE = 1024;

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions v2/contracts/zevm/GatewayZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ contract GatewayZEVM is
/// @notice New role identifier for pauser role.
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

/// @notice Max message size.
uint256 public constant MAX_MESSAGE_SIZE = 512;
/// @notice Max size of message + revertOptions revert message.
uint256 public constant MAX_MESSAGE_SIZE = 1024;

/// @dev Only protocol address allowed modifier.
modifier onlyProtocol() {
Expand Down
12 changes: 6 additions & 6 deletions v2/test/GatewayEVM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ contract GatewayEVMInboundTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IR

function testDepositERC20ToCustodyWithPayloadFailsIfPayloadSizeExceeded() public {
uint256 amount = 100_000;
bytes memory payload = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory payload = new bytes(512);
revertOptions.revertMessage = new bytes(512);

token.approve(address(gateway), amount);

Expand Down Expand Up @@ -571,8 +571,8 @@ contract GatewayEVMInboundTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IR

function testDepositEthToTssWithPayloadFailsIfPayloadSizeExceeded() public {
uint256 amount = 100_000;
bytes memory payload = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory payload = new bytes(512);
revertOptions.revertMessage = new bytes(512);

vm.expectRevert(PayloadSizeExceeded.selector);
gateway.depositAndCall{ value: amount }(destination, payload, revertOptions);
Expand Down Expand Up @@ -603,8 +603,8 @@ contract GatewayEVMInboundTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IR
}

function testCallWithPayloadFailsIfPayloadSizeExceeded() public {
bytes memory payload = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory payload = new bytes(512);
revertOptions.revertMessage = new bytes(512);

vm.expectRevert(PayloadSizeExceeded.selector);
gateway.call(destination, payload, revertOptions);
Expand Down
24 changes: 12 additions & 12 deletions v2/test/GatewayZEVM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
}

function testWithdrawAndCallZRC20FailsIfMessageSizeExceeded() public {
bytes memory message = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory message = new bytes(512);
revertOptions.revertMessage = new bytes(512);

vm.expectRevert(MessageSizeExceeded.selector);
gateway.withdrawAndCall(abi.encodePacked(addr1), 1, address(zrc20), message, 1, revertOptions);
Expand Down Expand Up @@ -222,8 +222,8 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
}

function testWithdrawAndCallZRC20WithCallOptsFailsIfMessageSizeExceeded() public {
bytes memory message = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory message = new bytes(512);
revertOptions.revertMessage = new bytes(512);
vm.expectRevert(MessageSizeExceeded.selector);
gateway.withdrawAndCall(abi.encodePacked(addr1), 1, address(zrc20), message, callOptions, revertOptions);
}
Expand Down Expand Up @@ -301,8 +301,8 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
}

function testWithdrawAndCallZETAFailsIfMessageSizeExceeded() public {
bytes memory message = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory message = new bytes(512);
revertOptions.revertMessage = new bytes(512);
vm.expectRevert(MessageSizeExceeded.selector);
gateway.withdrawAndCall(abi.encodePacked(addr1), 1, 1, message, revertOptions);
}
Expand All @@ -320,8 +320,8 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
}

function testWithdrawAndCallZETAWithCallOptsFailsIfMessageSizeExceeded() public {
bytes memory message = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory message = new bytes(512);
revertOptions.revertMessage = new bytes(512);
vm.expectRevert(MessageSizeExceeded.selector);
gateway.withdrawAndCall(abi.encodePacked(addr1), 1, 1, message, callOptions, revertOptions);
}
Expand Down Expand Up @@ -538,8 +538,8 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
}

function testCallFailsIfMessageSizeExceeded() public {
bytes memory message = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory message = new bytes(512);
revertOptions.revertMessage = new bytes(512);
vm.expectRevert(MessageSizeExceeded.selector);
gateway.call(abi.encodePacked(addr1), address(zrc20), message, 1, revertOptions);
}
Expand All @@ -565,8 +565,8 @@ contract GatewayZEVMInboundTest is Test, IGatewayZEVMEvents, IGatewayZEVMErrors
}

function testCallWithCallOptsFailsIfMessageSizeExceeded() public {
bytes memory message = new bytes(256);
revertOptions.revertMessage = new bytes(256);
bytes memory message = new bytes(512);
revertOptions.revertMessage = new bytes(512);
vm.expectRevert(MessageSizeExceeded.selector);
gateway.call(abi.encodePacked(addr1), address(zrc20), message, callOptions, revertOptions);
}
Expand Down

0 comments on commit 4f678e9

Please sign in to comment.