From 8e9b07c32507d16bb11f238e839b248304015201 Mon Sep 17 00:00:00 2001 From: Anna Carroll Date: Tue, 15 Oct 2024 17:15:36 -0500 Subject: [PATCH 1/2] tweak rollup tests for inheritability --- test/Orders.t.sol | 18 ++++++++---------- test/Passage.t.sol | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/test/Orders.t.sol b/test/Orders.t.sol index 6133e9d..06aa0a8 100644 --- a/test/Orders.t.sol +++ b/test/Orders.t.sol @@ -15,9 +15,8 @@ contract OrdersTest is Test { IOrders.Input[] public inputs; IOrders.Output[] public outputs; - mapping(address => bool) isToken; - address token; + address token2; uint32 chainId = 3; address recipient = address(0x123); uint256 amount = 200; @@ -29,16 +28,20 @@ contract OrdersTest is Test { event Sweep(address indexed recipient, address indexed token, uint256 amount); - function setUp() public { + function setUp() public virtual { target = new RollupOrders(address(0)); // setup token token = address(new TestERC20("hi", "HI")); TestERC20(token).mint(address(this), amount * 10000); TestERC20(token).approve(address(target), amount * 10000); - isToken[token] = true; - // setup Order Inputs/Outputs + // setup second token + token2 = address(new TestERC20("bye", "BYE")); + TestERC20(token2).mint(address(this), amount * 10000); + TestERC20(token2).approve(address(target), amount * 10000); + + // setup simple Order Inputs/Outputs IOrders.Input memory input = IOrders.Input(token, amount); inputs.push(input); @@ -90,11 +93,6 @@ contract OrdersTest is Test { // input multiple ERC20s function test_initiate_multiERC20() public { - // setup second token - address token2 = address(new TestERC20("bye", "BYE")); - TestERC20(token2).mint(address(this), amount * 10000); - TestERC20(token2).approve(address(target), amount * 10000); - // add second token input inputs.push(IOrders.Input(token2, amount * 2)); diff --git a/test/Passage.t.sol b/test/Passage.t.sol index e49a231..f48dab5 100644 --- a/test/Passage.t.sol +++ b/test/Passage.t.sol @@ -177,7 +177,7 @@ contract RollupPassageTest is Test { event ExitToken(address indexed hostRecipient, address indexed token, uint256 amount); - function setUp() public { + function setUp() public virtual { // deploy target target = new RollupPassage(address(0)); From 2cddd51b3659fcb7a11d5a8b998d8caa9006f538 Mon Sep 17 00:00:00 2001 From: Anna Carroll Date: Tue, 15 Oct 2024 17:19:09 -0500 Subject: [PATCH 2/2] snapshot --- .gas-snapshot | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index c0a4b27..536845e 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,23 +1,23 @@ GnosisSafeTest:test_gnosis_receive() (gas: 15927) OrderOriginPermit2Test:test_fillPermit2() (gas: 223464) -OrderOriginPermit2Test:test_fillPermit2_multi() (gas: 1007964) +OrderOriginPermit2Test:test_fillPermit2_multi() (gas: 1005464) OrderOriginPermit2Test:test_initiatePermit2() (gas: 233946) -OrderOriginPermit2Test:test_initiatePermit2_multi() (gas: 981706) +OrderOriginPermit2Test:test_initiatePermit2_multi() (gas: 982006) OrdersTest:test_fill_ERC20() (gas: 71459) OrdersTest:test_fill_ETH() (gas: 69090) -OrdersTest:test_fill_both() (gas: 167814) +OrdersTest:test_fill_both() (gas: 169814) OrdersTest:test_fill_multiETH() (gas: 132830) OrdersTest:test_fill_underflowETH() (gas: 115817) OrdersTest:test_initiate_ERC20() (gas: 82526) OrdersTest:test_initiate_ETH() (gas: 45597) OrdersTest:test_initiate_both() (gas: 119816) -OrdersTest:test_initiate_multiERC20() (gas: 719353) +OrdersTest:test_initiate_multiERC20() (gas: 175432) OrdersTest:test_initiate_multiETH() (gas: 76000) OrdersTest:test_orderExpired() (gas: 28383) -OrdersTest:test_sweepERC20() (gas: 60698) +OrdersTest:test_sweepERC20() (gas: 60695) OrdersTest:test_sweepETH() (gas: 83379) OrdersTest:test_underflowETH() (gas: 63976) -PassagePermit2Test:test_disallowedEnterPermit2() (gas: 691528) +PassagePermit2Test:test_disallowedEnterPermit2() (gas: 689028) PassagePermit2Test:test_enterTokenPermit2() (gas: 144090) PassageTest:test_configureEnter() (gas: 128735) PassageTest:test_disallowedEnter() (gas: 57503)