From f63cba6fdca683677d2be4b07d82cd878170f322 Mon Sep 17 00:00:00 2001 From: Disco <131301107+0xDiscotech@users.noreply.github.com> Date: Wed, 4 Sep 2024 18:23:21 -0300 Subject: [PATCH] fix: flake tests (#11742) * fix: add optimism mintable check on assume address helper * fix: mock interfaces checks * chore: remove unused import --------- Co-authored-by: 0xng <87835144+0xng@users.noreply.github.com> --- .../test/L2/L2StandardBridgeInterop.t.sol | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/contracts-bedrock/test/L2/L2StandardBridgeInterop.t.sol b/packages/contracts-bedrock/test/L2/L2StandardBridgeInterop.t.sol index d60ceb264a73..0fe37f2cf7c2 100644 --- a/packages/contracts-bedrock/test/L2/L2StandardBridgeInterop.t.sol +++ b/packages/contracts-bedrock/test/L2/L2StandardBridgeInterop.t.sol @@ -17,6 +17,7 @@ import { import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import { IOptimismMintableERC20 } from "src/universal/IOptimismMintableERC20.sol"; +import { ILegacyMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; // TODO: Replace Predeploys.OPTIMISM_SUPERCHAIN_ERC20_FACTORY with optimismSuperchainERC20Factory import { Predeploys } from "src/libraries/Predeploys.sol"; @@ -80,7 +81,7 @@ contract L2StandardBridgeInterop_LegacyToSuper_Test is L2StandardBridgeInterop_T // Mock `_from` to be a legacy address _mockInterface(_from, type(IERC165).interfaceId, true); - _mockInterface(_from, type(IOptimismMintableERC20).interfaceId, true); + _mockInterface(_from, type(ILegacyMintableERC20).interfaceId, true); } /// @notice Test that the `convert` function with different decimals reverts @@ -230,6 +231,11 @@ contract L2StandardBridgeInterop_SuperToLegacy_Test is L2StandardBridgeInterop_T // Mock same decimals _mockDecimals(_from, 18); _mockDecimals(_to, 18); + + // Mock `_from` so it is not a LegacyMintableERC20 address + _mockInterface(_from, type(IERC165).interfaceId, true); + _mockInterface(_from, type(ILegacyMintableERC20).interfaceId, false); + _mockInterface(_from, type(IOptimismMintableERC20).interfaceId, false); } /// @notice Test that the `convert` function with different decimals reverts