From 9dfc4376acac14faf6df04ab9542ebd938ea5013 Mon Sep 17 00:00:00 2001 From: Zehui Zheng Date: Tue, 7 Nov 2023 17:43:59 +0800 Subject: [PATCH] fix: portal tests address overlaps --- onchain/rollups/test/foundry/portals/ERC20Portal.t.sol | 4 +++- onchain/rollups/test/foundry/portals/EtherPortal.t.sol | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/onchain/rollups/test/foundry/portals/ERC20Portal.t.sol b/onchain/rollups/test/foundry/portals/ERC20Portal.t.sol index 8fc454e4..fdaf70ec 100644 --- a/onchain/rollups/test/foundry/portals/ERC20Portal.t.sol +++ b/onchain/rollups/test/foundry/portals/ERC20Portal.t.sol @@ -304,7 +304,9 @@ contract ERC20PortalHandler is Test { if ( _dapp == address(0) || sender == address(0) || - _dapp == address(this) + _dapp == address(this) || + sender == address(portal) || + _dapp == address(portal) ) return; _amount = bound(_amount, 0, token.balanceOf(address(this))); diff --git a/onchain/rollups/test/foundry/portals/EtherPortal.t.sol b/onchain/rollups/test/foundry/portals/EtherPortal.t.sol index 90816aba..d77c74e4 100644 --- a/onchain/rollups/test/foundry/portals/EtherPortal.t.sol +++ b/onchain/rollups/test/foundry/portals/EtherPortal.t.sol @@ -160,6 +160,10 @@ contract EtherPortalHandler is Test { _amount = bound(_amount, 0, type(uint128).max); // fund sender + // sender address should not overlap with portal or dapp addresses + if (sender == address(portal)) { + return; + } for (uint256 i; i < dapps.length; ++i) { if (sender == dapps[i]) { return;