From c5004178f2e8af23cac118adc7603a83b829ce70 Mon Sep 17 00:00:00 2001 From: Goran Vladika Date: Thu, 26 Oct 2023 11:32:13 +0200 Subject: [PATCH] Don't use fuzzer for bytes4 argument It's seems to be broken in latest nightly Foundry version --- test-foundry/L1ArbitrumExtendedGateway.t.sol | 22 +++++++++++--------- test-foundry/L1GatewayRouter.t.sol | 20 ++++++++++-------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/test-foundry/L1ArbitrumExtendedGateway.t.sol b/test-foundry/L1ArbitrumExtendedGateway.t.sol index 128e5b86db..0f7007110e 100644 --- a/test-foundry/L1ArbitrumExtendedGateway.t.sol +++ b/test-foundry/L1ArbitrumExtendedGateway.t.sol @@ -186,16 +186,18 @@ abstract contract L1ArbitrumExtendedGatewayTest is Test { ); } - function test_supportsInterface(bytes4 iface) public { - bool expected = false; - if ( - iface == type(IERC165).interfaceId || - iface == IL1ArbitrumGateway.outboundTransferCustomRefund.selector - ) { - expected = true; - } - - assertEq(l1Gateway.supportsInterface(iface), expected, "Interface shouldn't be supported"); + function test_supportsInterface() public { + bytes4 iface = type(IERC165).interfaceId; + assertEq(l1Gateway.supportsInterface(iface), true, "Interface should be supported"); + + iface = IL1ArbitrumGateway.outboundTransferCustomRefund.selector; + assertEq(l1Gateway.supportsInterface(iface), true, "Interface should be supported"); + + iface = bytes4(0); + assertEq(l1Gateway.supportsInterface(iface), false, "Interface shouldn't be supported"); + + iface = IL1ArbitrumGateway.inbox.selector; + assertEq(l1Gateway.supportsInterface(iface), false, "Interface shouldn't be supported"); } function test_transferExitAndCall_EmptyData_NotRedirected( diff --git a/test-foundry/L1GatewayRouter.t.sol b/test-foundry/L1GatewayRouter.t.sol index ad53629525..53f9d9f0e9 100644 --- a/test-foundry/L1GatewayRouter.t.sol +++ b/test-foundry/L1GatewayRouter.t.sol @@ -664,16 +664,18 @@ contract L1GatewayRouterTest is GatewayRouterTest { l1Router.setOwner(address(300)); } - function test_supportsInterface(bytes4 iface) public { - bool expected = false; - if ( - iface == type(IERC165).interfaceId || - iface == L1GatewayRouter.outboundTransferCustomRefund.selector - ) { - expected = true; - } + function test_supportsInterface() public { + bytes4 iface = type(IERC165).interfaceId; + assertEq(l1Router.supportsInterface(iface), true, "Interface should be supported"); + + iface = L1GatewayRouter.outboundTransferCustomRefund.selector; + assertEq(l1Router.supportsInterface(iface), true, "Interface should be supported"); + + iface = bytes4(0); + assertEq(l1Router.supportsInterface(iface), false, "Interface shouldn't be supported"); - assertEq(l1Router.supportsInterface(iface), expected, "Interface shouldn't be supported"); + iface = L1GatewayRouter.setGateways.selector; + assertEq(l1Router.supportsInterface(iface), false, "Interface shouldn't be supported"); } function test_outboundTransfer() public virtual {