Skip to content

Commit

Permalink
fix: remove unnecessary base snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
marktoda committed Oct 24, 2024
1 parent 55294fb commit 02b0a42
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 106 deletions.
18 changes: 9 additions & 9 deletions snapshots/DutchOrderReactorTest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"Base-DutchOrder-BaseExecuteSingleWithFee": "181438",
"Base-DutchOrder-ExecuteBatch": "196244",
"Base-DutchOrder-ExecuteBatchMultipleOutputs": "205893",
"Base-DutchOrder-ExecuteBatchMultipleOutputsDifferentTokens": "259435",
"Base-DutchOrder-ExecuteBatchNativeOutput": "189770",
"Base-DutchOrder-ExecuteSingle": "147820",
"Base-DutchOrder-ExecuteSingleNativeOutput": "133383",
"Base-DutchOrder-ExecuteSingleValidation": "157131",
"Base-DutchOrder-RevertInvalidNonce": "26372"
"BaseExecuteSingleWithFee": "176379",
"ExecuteBatch": "188624",
"ExecuteBatchMultipleOutputs": "197968",
"ExecuteBatchMultipleOutputsDifferentTokens": "251215",
"ExecuteBatchNativeOutput": "184650",
"ExecuteSingle": "142762",
"ExecuteSingleNativeOutput": "130824",
"ExecuteSingleValidation": "152072",
"RevertInvalidNonce": "22192"
}
18 changes: 9 additions & 9 deletions snapshots/ExclusiveDutchOrderReactorTest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"Base-ExclusiveDutchOrder-BaseExecuteSingleWithFee": "181682",
"Base-ExclusiveDutchOrder-ExecuteBatch": "196730",
"Base-ExclusiveDutchOrder-ExecuteBatchMultipleOutputs": "206374",
"Base-ExclusiveDutchOrder-ExecuteBatchMultipleOutputsDifferentTokens": "259924",
"Base-ExclusiveDutchOrder-ExecuteBatchNativeOutput": "190250",
"Base-ExclusiveDutchOrder-ExecuteSingle": "148073",
"Base-ExclusiveDutchOrder-ExecuteSingleNativeOutput": "133635",
"Base-ExclusiveDutchOrder-ExecuteSingleValidation": "157383",
"Base-ExclusiveDutchOrder-RevertInvalidNonce": "26629"
"BaseExecuteSingleWithFee": "176480",
"ExecuteBatch": "188814",
"ExecuteBatchMultipleOutputs": "198158",
"ExecuteBatchMultipleOutputsDifferentTokens": "251405",
"ExecuteBatchNativeOutput": "184840",
"ExecuteSingle": "142871",
"ExecuteSingleNativeOutput": "130933",
"ExecuteSingleValidation": "152181",
"RevertInvalidNonce": "22290"
}
18 changes: 9 additions & 9 deletions snapshots/LimitOrderReactorTest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"Base-LimitOrderReactor-BaseExecuteSingleWithFee": "177666",
"Base-LimitOrderReactor-ExecuteBatch": "188610",
"Base-LimitOrderReactor-ExecuteBatchMultipleOutputs": "197369",
"Base-LimitOrderReactor-ExecuteBatchMultipleOutputsDifferentTokens": "250029",
"Base-LimitOrderReactor-ExecuteBatchNativeOutput": "182131",
"Base-LimitOrderReactor-ExecuteSingle": "144054",
"Base-LimitOrderReactor-ExecuteSingleNativeOutput": "129612",
"Base-LimitOrderReactor-ExecuteSingleValidation": "153360",
"Base-LimitOrderReactor-RevertInvalidNonce": "22590"
"BaseExecuteSingleWithFee": "172831",
"ExecuteBatch": "181452",
"ExecuteBatchMultipleOutputs": "189990",
"ExecuteBatchMultipleOutputsDifferentTokens": "242428",
"ExecuteBatchNativeOutput": "177478",
"ExecuteSingle": "139215",
"ExecuteSingleNativeOutput": "127277",
"ExecuteSingleValidation": "148525",
"RevertInvalidNonce": "18656"
}
26 changes: 13 additions & 13 deletions snapshots/PriorityOrderReactorTest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"Base-PriorityOrderReactor-BaseExecuteSingleWithFee": "184270",
"Base-PriorityOrderReactor-ExecuteBatch": "201986",
"Base-PriorityOrderReactor-ExecuteBatchMultipleOutputs": "211513",
"Base-PriorityOrderReactor-ExecuteBatchMultipleOutputsDifferentTokens": "264944",
"Base-PriorityOrderReactor-ExecuteBatchNativeOutput": "195506",
"Base-PriorityOrderReactor-ExecuteSingle": "150656",
"Base-PriorityOrderReactor-ExecuteSingleNativeOutput": "136223",
"Base-PriorityOrderReactor-ExecuteSingleValidation": "159971",
"Base-PriorityOrderReactor-InputPriorityFee": "152964",
"Base-PriorityOrderReactor-OutputPriorityFee": "152968",
"Base-PriorityOrderReactor-OutputPriorityFeeAndBaselinePriorityFee": "152962",
"Base-PriorityOrderReactor-OverrideAuctionTargetBlock": "130099",
"Base-PriorityOrderReactor-RevertInvalidNonce": "13608"
"BaseExecuteSingleWithFee": "178696",
"ExecuteBatch": "193279",
"ExecuteBatchMultipleOutputs": "202497",
"ExecuteBatchMultipleOutputsDifferentTokens": "255617",
"ExecuteBatchNativeOutput": "189305",
"ExecuteSingle": "145087",
"ExecuteSingleNativeOutput": "133149",
"ExecuteSingleValidation": "154397",
"InputPriorityFee": "147392",
"OutputPriorityFee": "147396",
"OutputPriorityFeeAndBaselinePriorityFee": "147396",
"OverrideAuctionTargetBlock": "124529",
"RevertInvalidNonce": "8853"
}
24 changes: 12 additions & 12 deletions snapshots/V2DutchOrderTest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"Base-V2DutchOrder-BaseExecuteSingleWithFee": "188471",
"Base-V2DutchOrder-ExclusiveFiller": "158619",
"Base-V2DutchOrder-ExecuteBatch": "210402",
"Base-V2DutchOrder-ExecuteBatchMultipleOutputs": "220620",
"Base-V2DutchOrder-ExecuteBatchMultipleOutputsDifferentTokens": "274747",
"Base-V2DutchOrder-ExecuteBatchNativeOutput": "203928",
"Base-V2DutchOrder-ExecuteSingle": "154854",
"Base-V2DutchOrder-ExecuteSingleNativeOutput": "140416",
"Base-V2DutchOrder-ExecuteSingleValidation": "164166",
"Base-V2DutchOrder-InputOverride": "158697",
"Base-V2DutchOrder-OutputOverride": "158646",
"Base-V2DutchOrder-RevertInvalidNonce": "33425"
"BaseExecuteSingleWithFee": "182480",
"ExclusiveFiller": "152632",
"ExecuteBatch": "200865",
"ExecuteBatchMultipleOutputs": "210701",
"ExecuteBatchMultipleOutputsDifferentTokens": "264440",
"ExecuteBatchNativeOutput": "196891",
"ExecuteSingle": "148863",
"ExecuteSingleNativeOutput": "136925",
"ExecuteSingleValidation": "158173",
"InputOverride": "152710",
"OutputOverride": "152659",
"RevertInvalidNonce": "28213"
}
24 changes: 12 additions & 12 deletions snapshots/V3DutchOrderTest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"Base-V3DutchOrder-BaseExecuteSingleWithFee": "199526",
"Base-V3DutchOrder-ExecuteBatch": "232823",
"Base-V3DutchOrder-ExecuteBatchMultipleOutputs": "246882",
"Base-V3DutchOrder-ExecuteBatchMultipleOutputsDifferentTokens": "304875",
"Base-V3DutchOrder-ExecuteBatchNativeOutput": "226350",
"Base-V3DutchOrder-ExecuteSingle": "165913",
"Base-V3DutchOrder-ExecuteSingleNativeOutput": "151470",
"Base-V3DutchOrder-ExecuteSingleValidation": "175219",
"Base-V3DutchOrder-RevertInvalidNonce": "44536",
"Base-V3DutchOrder-V3-ExclusiveFiller": "169849",
"Base-V3DutchOrder-V3-InputOverride": "169930",
"Base-V3DutchOrder-V3-OutputOverride": "169873"
"BaseExecuteSingleWithFee": "192645",
"ExecuteBatch": "221374",
"ExecuteBatchMultipleOutputs": "234559",
"ExecuteBatchMultipleOutputsDifferentTokens": "291665",
"ExecuteBatchNativeOutput": "217400",
"ExecuteSingle": "159027",
"ExecuteSingleNativeOutput": "147089",
"ExecuteSingleValidation": "168337",
"RevertInvalidNonce": "38303",
"V3-ExclusiveFiller": "162895",
"V3-InputOverride": "162976",
"V3-OutputOverride": "162919"
}
31 changes: 9 additions & 22 deletions test/base/BaseReactor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("ExecuteSingle");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExecuteSingle");

assertEq(tokenIn.balanceOf(address(swapper)), swapperInputBalanceStart - inputAmount);
assertEq(tokenIn.balanceOf(address(fillContract)), fillContractInputBalanceStart + inputAmount);
Expand Down Expand Up @@ -162,9 +161,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("BaseExecuteSingleWithFee");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("BaseExecuteSingleWithFee");

uint256 feeAmount = uint256(outputAmount) * feeBps / 10000;
assertEq(tokenIn.balanceOf(address(swapper)), swapperInputBalanceStart - inputAmount);
Expand Down Expand Up @@ -202,9 +200,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("ExecuteSingleNativeOutput");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExecuteSingleNativeOutput");

assertEq(tokenIn.balanceOf(address(swapper)), swapperInputBalanceStart - inputAmount);
assertEq(tokenIn.balanceOf(address(fillContract)), fillContractInputBalanceStart + inputAmount);
Expand Down Expand Up @@ -246,9 +243,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("ExecuteSingleValidation");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExecuteSingleValidation");

assertEq(tokenIn.balanceOf(address(swapper)), swapperInputBalanceStart - inputAmount);
assertEq(tokenIn.balanceOf(address(fillContract)), fillContractInputBalanceStart + inputAmount);
Expand Down Expand Up @@ -297,9 +293,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true);
emit Fill(orderHashes[1], address(fillContract), swapper, orders[1].info.nonce);

_snapStart("ExecuteBatch");
fillContract.executeBatch(signedOrders);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExecuteBatch");

assertEq(tokenOut.balanceOf(swapper), totalOutputAmount);
assertEq(tokenIn.balanceOf(address(fillContract)), totalInputAmount);
Expand Down Expand Up @@ -345,9 +340,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true);
emit Fill(orderHashes[1], address(fillContract), swapper, orders[1].info.nonce);

_snapStart("ExecuteBatchNativeOutput");
fillContract.executeBatch(signedOrders);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExecuteBatchNativeOutput");

assertEq(swapper.balance, totalOutputAmount);
assertEq(tokenIn.balanceOf(address(fillContract)), totalInputAmount);
Expand Down Expand Up @@ -397,9 +391,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true);
emit Fill(orderHashes[1], address(fillContract), swapper, orders[1].info.nonce);

_snapStart("ExecuteBatchMultipleOutputs");
fillContract.executeBatch(signedOrders);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExecuteBatchMultipleOutputs");

assertEq(tokenOut.balanceOf(swapper), totalOutputAmount);
assertEq(tokenIn.balanceOf(address(fillContract)), totalInputAmount);
Expand Down Expand Up @@ -454,9 +447,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
vm.expectEmit(true, true, true, true);
emit Fill(orderHashes[1], address(fillContract), swapper, orders[1].info.nonce);

_snapStart("ExecuteBatchMultipleOutputsDifferentTokens");
fillContract.executeBatch(signedOrders);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExecuteBatchMultipleOutputsDifferentTokens");

assertEq(tokenOut.balanceOf(swapper), totalOutputAmount1);
assertEq(tokenOut2.balanceOf(swapper), totalOutputAmount2);
Expand Down Expand Up @@ -555,9 +547,8 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
? OrderAlreadyFilled.selector
: InvalidNonce.selector;
vm.expectRevert(revertData);
_snapStart("RevertInvalidNonce");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("RevertInvalidNonce");
}

/// @dev Test executing two orders on two reactors at once
Expand Down Expand Up @@ -856,8 +847,4 @@ abstract contract BaseReactorTest is ReactorEvents, Test, DeployPermit2 {
swapperOutputBalanceStart = tokenOut.balanceOf(address(swapper));
fillContractOutputBalanceStart = tokenOut.balanceOf(address(fillContract));
}

function _snapStart(string memory testName) internal {
vm.startSnapshotGas(string.concat("Base-", name(), "-", testName));
}
}
12 changes: 4 additions & 8 deletions test/reactors/PriorityOrderReactor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ contract PriorityOrderReactorTest is PermitSignature, DeployPermit2, BaseReactor
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("OutputPriorityFee");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("OutputPriorityFee");

assertEq(tokenOut.balanceOf(address(swapper)), swapperOutputBalanceStart + scaledOutputAmount);
assertEq(tokenIn.balanceOf(address(swapper)), swapperInputBalanceStart - inputAmount);
Expand Down Expand Up @@ -182,9 +181,8 @@ contract PriorityOrderReactorTest is PermitSignature, DeployPermit2, BaseReactor
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("OutputPriorityFeeAndBaselinePriorityFee");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("OutputPriorityFeeAndBaselinePriorityFee");

assertEq(tokenOut.balanceOf(address(swapper)), swapperOutputBalanceStart + scaledOutputAmount);
assertEq(tokenIn.balanceOf(address(swapper)), swapperInputBalanceStart - inputAmount);
Expand Down Expand Up @@ -286,9 +284,8 @@ contract PriorityOrderReactorTest is PermitSignature, DeployPermit2, BaseReactor
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("InputPriorityFee");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("InputPriorityFee");

assertEq(tokenIn.balanceOf(address(swapper)), swapperInputBalanceStart - scaledInputAmount);
assertEq(tokenOut.balanceOf(address(swapper)), swapperOutputBalanceStart + outputAmount);
Expand Down Expand Up @@ -321,9 +318,8 @@ contract PriorityOrderReactorTest is PermitSignature, DeployPermit2, BaseReactor
vm.expectEmit(true, true, true, true, address(reactor));
emit Fill(orderHash, address(fillContract), swapper, order.info.nonce);
// execute order
_snapStart("OverrideAuctionTargetBlock");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("OverrideAuctionTargetBlock");
}

/// @notice an order can be filled at any time after the auctionStartBlock and before the deadline
Expand Down
9 changes: 3 additions & 6 deletions test/reactors/V2DutchOrderReactor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,8 @@ contract V2DutchOrderTest is PermitSignature, DeployPermit2, BaseDutchOrderReact
SignedOrder memory signedOrder =
SignedOrder(abi.encode(order), signOrder(swapperPrivateKey, address(permit2), order));

_snapStart("InputOverride");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("InputOverride");

assertEq(tokenIn.balanceOf(swapper), 0);
assertEq(tokenOut.balanceOf(swapper), outputAmount);
Expand Down Expand Up @@ -311,9 +310,8 @@ contract V2DutchOrderTest is PermitSignature, DeployPermit2, BaseDutchOrderReact
SignedOrder memory signedOrder =
SignedOrder(abi.encode(order), signOrder(swapperPrivateKey, address(permit2), order));

_snapStart("OutputOverride");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("OutputOverride");

assertEq(tokenIn.balanceOf(swapper), 0);
assertEq(tokenOut.balanceOf(swapper), overriddenOutputAmount);
Expand Down Expand Up @@ -377,9 +375,8 @@ contract V2DutchOrderTest is PermitSignature, DeployPermit2, BaseDutchOrderReact
SignedOrder(abi.encode(order), signOrder(swapperPrivateKey, address(permit2), order));
vm.prank(address(1));

_snapStart("ExclusiveFiller");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("ExclusiveFiller");

assertEq(tokenIn.balanceOf(swapper), 0);
assertEq(tokenOut.balanceOf(swapper), outputAmount);
Expand Down
9 changes: 3 additions & 6 deletions test/reactors/V3DutchOrderReactor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,8 @@ contract V3DutchOrderTest is PermitSignature, DeployPermit2, BaseReactorTest {
SignedOrder memory signedOrder =
SignedOrder(abi.encode(order), signOrder(swapperPrivateKey, address(permit2), order));

_snapStart("V3-InputOverride");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("V3-InputOverride");

assertEq(tokenIn.balanceOf(swapper), 0);
assertEq(tokenOut.balanceOf(swapper), outputAmount);
Expand Down Expand Up @@ -256,9 +255,8 @@ contract V3DutchOrderTest is PermitSignature, DeployPermit2, BaseReactorTest {
SignedOrder memory signedOrder =
SignedOrder(abi.encode(order), signOrder(swapperPrivateKey, address(permit2), order));

_snapStart("V3-OutputOverride");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("V3-OutputOverride");

assertEq(tokenIn.balanceOf(swapper), 0);
assertEq(tokenOut.balanceOf(swapper), overriddenOutputAmount);
Expand Down Expand Up @@ -326,9 +324,8 @@ contract V3DutchOrderTest is PermitSignature, DeployPermit2, BaseReactorTest {
SignedOrder(abi.encode(order), signOrder(swapperPrivateKey, address(permit2), order));
vm.prank(address(1));

_snapStart("V3-ExclusiveFiller");
fillContract.execute(signedOrder);
vm.stopSnapshotGas();
vm.snapshotGasLastCall("V3-ExclusiveFiller");

assertEq(tokenIn.balanceOf(swapper), 0);
assertEq(tokenOut.balanceOf(swapper), outputAmount);
Expand Down

0 comments on commit 02b0a42

Please sign in to comment.