From f370113e8de436ad2af5dd093b45366bc8ab352f Mon Sep 17 00:00:00 2001 From: AgusDuha <81362284+agusduha@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:35:38 -0300 Subject: [PATCH] test: fix superchain erc20 invariants (#11688) --------- Co-authored-by: 0xDiscotech <131301107+0xDiscotech@users.noreply.github.com> --- .../invariant-docs/OptimismSuperchainERC20.md | 4 ++-- .../test/invariants/OptimismSuperchainERC20.t.sol | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/contracts-bedrock/invariant-docs/OptimismSuperchainERC20.md b/packages/contracts-bedrock/invariant-docs/OptimismSuperchainERC20.md index 0e3150624da5..13d03f304d45 100644 --- a/packages/contracts-bedrock/invariant-docs/OptimismSuperchainERC20.md +++ b/packages/contracts-bedrock/invariant-docs/OptimismSuperchainERC20.md @@ -1,10 +1,10 @@ # `OptimismSuperchainERC20` Invariants ## Calls to sendERC20 should always succeed as long as the actor has enough balance. Actor's balance should also not increase out of nowhere but instead should decrease by the amount sent. -**Test:** [`OptimismSuperchainERC20.t.sol#L194`](../test/invariants/OptimismSuperchainERC20.t.sol#L194) +**Test:** [`OptimismSuperchainERC20.t.sol#L196`](../test/invariants/OptimismSuperchainERC20.t.sol#L196) ## Calls to relayERC20 should always succeeds when a message is received from another chain. Actor's balance should only increase by the amount relayed. -**Test:** [`OptimismSuperchainERC20.t.sol#L212`](../test/invariants/OptimismSuperchainERC20.t.sol#L212) +**Test:** [`OptimismSuperchainERC20.t.sol#L214`](../test/invariants/OptimismSuperchainERC20.t.sol#L214) diff --git a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20.t.sol b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20.t.sol index 028a0124e6ca..70081560c59f 100644 --- a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20.t.sol +++ b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20.t.sol @@ -62,6 +62,8 @@ contract OptimismSuperchainERC20_User is StdUtils { return; } + if (_chainId == block.chainid) return; + // Bound send amount to our ERC20 balance. _amount = bound(_amount, 0, superchainERC20.balanceOf(address(this)));