From 9a09ff85217c9e8573815afeb2ff67e2f57c519a Mon Sep 17 00:00:00 2001 From: Sara Reynolds Date: Tue, 12 Sep 2023 12:45:42 -0400 Subject: [PATCH] try snapshot --- ...e-DutchOrder-BaseExecuteSingleWithFee.snap | 2 +- .../Base-LimitOrderReactor-ExecuteSingle.snap | 2 +- .gas-snapshot | 173 ++++++++++++++++++ .github/workflows/gas.yml | 21 +++ 4 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 .gas-snapshot create mode 100644 .github/workflows/gas.yml diff --git a/.forge-snapshots/Base-DutchOrder-BaseExecuteSingleWithFee.snap b/.forge-snapshots/Base-DutchOrder-BaseExecuteSingleWithFee.snap index dac02a99..e77e2b32 100644 --- a/.forge-snapshots/Base-DutchOrder-BaseExecuteSingleWithFee.snap +++ b/.forge-snapshots/Base-DutchOrder-BaseExecuteSingleWithFee.snap @@ -1 +1 @@ -150417 \ No newline at end of file +181978 \ No newline at end of file diff --git a/.forge-snapshots/Base-LimitOrderReactor-ExecuteSingle.snap b/.forge-snapshots/Base-LimitOrderReactor-ExecuteSingle.snap index e0b0c878..f2fd2a74 100644 --- a/.forge-snapshots/Base-LimitOrderReactor-ExecuteSingle.snap +++ b/.forge-snapshots/Base-LimitOrderReactor-ExecuteSingle.snap @@ -1 +1 @@ -124433 \ No newline at end of file +144333 \ No newline at end of file diff --git a/.gas-snapshot b/.gas-snapshot new file mode 100644 index 00000000..6b9e71b5 --- /dev/null +++ b/.gas-snapshot @@ -0,0 +1,173 @@ +DeployDutchTest:testDeploy() (gas: 3429000) +DeployExclusiveDutchTest:testDeploy() (gas: 3532081) +DirectFillerFillMacroTest:testFillDataPassed() (gas: 203257) +DirectFillerFillMacroTest:testFillerHasInsufficientOutput() (gas: 205252) +DirectFillerFillMacroTest:testFillerLacksApproval() (gas: 206354) +DirectFillerFillMacroTest:testSingleOrder() (gas: 263644) +DirectFillerFillMacroTest:testSingleOrderWithFee() (gas: 1053057) +DirectFillerFillMacroTest:testThreeOrdersWithFees() (gas: 1550847) +DirectFillerFillMacroTest:testTwoOrders() (gas: 465436) +DutchDecayLibTest:testDutchDecay() (gas: 5442) +DutchDecayLibTest:testDutchDecayBounded(uint256,uint256,uint256,uint256) (runs: 256, μ: 3829, ~: 3817) +DutchDecayLibTest:testDutchDecayFullyDecayed() (gas: 3734) +DutchDecayLibTest:testDutchDecayFullyDecayedNegative() (gas: 3722) +DutchDecayLibTest:testDutchDecayInvalidTimes(uint256,uint256,uint256,uint256) (runs: 256, μ: 3596, ~: 3596) +DutchDecayLibTest:testDutchDecayNegative() (gas: 5505) +DutchDecayLibTest:testDutchDecayNegative(uint256,uint256,uint256,uint256) (runs: 256, μ: 3827, ~: 3815) +DutchDecayLibTest:testDutchDecayNoDecay(uint256,uint256,uint256) (runs: 256, μ: 3373, ~: 3364) +DutchDecayLibTest:testDutchDecayNoDecayYet() (gas: 3778) +DutchDecayLibTest:testDutchDecayNoDecayYetNegative() (gas: 3779) +DutchOrderReactorExecuteTest:testBaseExecute(uint128,uint128,uint256) (runs: 256, μ: 330047, ~: 334478) +DutchOrderReactorExecuteTest:testBaseExecuteBatch() (gas: 377063) +DutchOrderReactorExecuteTest:testBaseExecuteBatchMultipleOutputs() (gas: 440076) +DutchOrderReactorExecuteTest:testBaseExecuteBatchMultipleOutputsDifferentTokens() (gas: 526289) +DutchOrderReactorExecuteTest:testBaseExecuteBatchNativeOutput() (gas: 382804) +DutchOrderReactorExecuteTest:testBaseExecuteDeadlinePassed(uint128,uint128,uint256) (runs: 256, μ: 175366, ~: 182751) +DutchOrderReactorExecuteTest:testBaseExecuteInvalidReactor(address,uint128,uint128,uint256) (runs: 256, μ: 186945, ~: 190988) +DutchOrderReactorExecuteTest:testBaseExecuteNativeOutput(uint128,uint128,uint256) (runs: 256, μ: 317016, ~: 320999) +DutchOrderReactorExecuteTest:testBaseExecuteSignatureReplay() (gas: 381116) +DutchOrderReactorExecuteTest:testBaseExecuteTwoReactorsAtOnce() (gas: 3563529) +DutchOrderReactorExecuteTest:testBaseExecuteValidationContract(uint128,uint128,uint256) (runs: 256, μ: 385424, ~: 390788) +DutchOrderReactorExecuteTest:testBaseExecuteValidationContractFail(uint128,uint128,uint256) (runs: 256, μ: 194555, ~: 198909) +DutchOrderReactorExecuteTest:testBaseExecuteWithFee(uint128,uint128,uint256,uint8) (runs: 256, μ: 444191, ~: 446859) +DutchOrderReactorExecuteTest:testBaseNonceReuse() (gas: 367330) +DutchOrderReactorExecuteTest:testExecuteBatchInsufficientOutput() (gas: 365314) +DutchOrderReactorExecuteTest:testExecuteBatchInsufficientOutputSent() (gas: 1078467) +DutchOrderReactorExecuteTest:testExecuteBatchInsufficientOutputSentNative() (gas: 1024928) +DutchOrderReactorExecuteTest:testExecuteBatchMultipleOutputs() (gas: 538035) +DutchOrderReactorValidationTest:testBothInputAndOutputDecay() (gas: 22343) +DutchOrderReactorValidationTest:testDecayNeverOutOfBounds(uint256,uint256,uint256,uint256) (runs: 256, μ: 27475, ~: 27458) +DutchOrderReactorValidationTest:testInputDecayIncorrectAmounts() (gas: 21287) +DutchOrderReactorValidationTest:testInputDecayNowBetweenStartAndEnd() (gas: 27394) +DutchOrderReactorValidationTest:testInputDecayStartTimeAfterNow() (gas: 27151) +DutchOrderReactorValidationTest:testInputDecaysCorrectlyWhenEndtimeLtNowLtDeadline() (gas: 27292) +DutchOrderReactorValidationTest:testInputDecaysCorrectlyWhenNowLtEndtimeLtDeadline() (gas: 27651) +DutchOrderReactorValidationTest:testOutputDecayIncorrectAmounts() (gas: 21862) +DutchOrderReactorValidationTest:testOutputDecaysCorrectlyWhenEndtimeEqNowLtDeadline() (gas: 26978) +DutchOrderReactorValidationTest:testOutputDecaysCorrectlyWhenEndtimeLtNowLtDeadline() (gas: 27010) +DutchOrderReactorValidationTest:testOutputDecaysCorrectlyWhenNowLtEndtimeLtDeadline() (gas: 27388) +DutchOrderReactorValidationTest:testResolveEndTimeAfterNow() (gas: 27392) +DutchOrderReactorValidationTest:testResolveFirstDecay() (gas: 45546) +DutchOrderReactorValidationTest:testResolveMultipleDutchOutputs() (gas: 34164) +DutchOrderReactorValidationTest:testResolveStartTimeEqualsNow() (gas: 27047) +DutchOrderReactorValidationTest:testStartAmountLessThanEndAmount() (gas: 21900) +DutchOrderReactorValidationTest:testValidateDutchEndTimeAfterStart() (gas: 23802) +DutchOrderReactorValidationTest:testValidateDutchEndTimeBeforeStart() (gas: 21208) +DutchOrderReactorValidationTest:testValidateEndTimeAfterDeadline() (gas: 20769) +EthOutputDirectFillerTest:test2EthOutputOrdersButOnlyEnoughEthToFill1() (gas: 243383) +EthOutputDirectFillerTest:test3OrdersWithEthAndERC20OutputsDirectFill() (gas: 444264) +EthOutputDirectFillerTest:testEth1Output() (gas: 264834) +EthOutputDirectFillerTest:testEth1OutputInsufficientEthSent() (gas: 188867) +EthOutputDirectFillerTest:testEth2Outputs() (gas: 319420) +EthOutputDirectFillerTest:testExcessETHIsReturned() (gas: 222087) +EthOutputMockFillContractTest:test3OrdersWithEthAndERC20Outputs() (gas: 573349) +EthOutputMockFillContractTest:test3OrdersWithEthAndERC20OutputsWithInsufficientEth() (gas: 429049) +EthOutputMockFillContractTest:test3OrdersWithEthAndERC20OutputsWithInsufficientEthInFillContractButEnoughInReactor() (gas: 427122) +EthOutputMockFillContractTest:testEthOutput() (gas: 229208) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecute(uint128,uint128,uint256) (runs: 256, μ: 374993, ~: 379424) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteBatch() (gas: 422248) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteBatchMultipleOutputs() (gas: 440603) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteBatchMultipleOutputsDifferentTokens() (gas: 549240) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteBatchNativeOutput() (gas: 383392) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteDeadlinePassed(uint128,uint128,uint256) (runs: 256, μ: 175382, ~: 182767) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteInvalidReactor(address,uint128,uint128,uint256) (runs: 256, μ: 188242, ~: 191896) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteNativeOutput(uint128,uint128,uint256) (runs: 256, μ: 317260, ~: 321309) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteSignatureReplay() (gas: 381704) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteTwoReactorsAtOnce() (gas: 3667300) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteValidationContract(uint128,uint128,uint256) (runs: 256, μ: 386222, ~: 391120) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteValidationContractFail(uint128,uint128,uint256) (runs: 256, μ: 195386, ~: 199817) +ExclusiveDutchOrderReactorExecuteTest:testBaseExecuteWithFee(uint128,uint128,uint256,uint8) (runs: 256, μ: 445550, ~: 447261) +ExclusiveDutchOrderReactorExecuteTest:testBaseNonceReuse() (gas: 367876) +ExclusiveDutchOrderReactorExecuteTest:testExclusivityMultipleOutputs(address,address,uint256,uint128[],uint256) (runs: 256, μ: 1972492, ~: 1961793) +ExclusiveDutchOrderReactorExecuteTest:testExclusivityOverride(address,address,uint256,uint128,uint256) (runs: 256, μ: 295835, ~: 296768) +ExclusiveDutchOrderReactorExecuteTest:testExclusivitySucceeds(address,uint128,uint128) (runs: 256, μ: 258971, ~: 262547) +ExclusiveDutchOrderReactorExecuteTest:testExecuteBatchInsufficientOutput() (gas: 365382) +ExclusiveDutchOrderReactorExecuteTest:testExecuteBatchInsufficientOutputSent() (gas: 1056489) +ExclusiveDutchOrderReactorExecuteTest:testExecuteBatchInsufficientOutputSentNative() (gas: 979232) +ExclusiveDutchOrderReactorExecuteTest:testExecuteBatchMultipleOutputs() (gas: 538721) +ExclusiveFillerValidationTest:testExclusiveFillerSucceeds() (gas: 306407) +ExclusiveFillerValidationTest:testNonExclusiveFillerFails() (gas: 191618) +ExclusiveFillerValidationTest:testNonExclusiveFillerFailsOnLastExclusiveTimestamp() (gas: 191545) +ExclusiveFillerValidationTest:testNonExclusiveFillerSucceedsPastExclusiveTimestamp() (gas: 276074) +ExclusivityOverrideLibTest:testExclusivity(address) (runs: 256, μ: 9247, ~: 9247) +ExclusivityOverrideLibTest:testExclusivityFail(address,address,uint256,uint256) (runs: 256, μ: 10295, ~: 10295) +ExclusivityOverrideLibTest:testExclusivityPeriodOver(address,uint256,uint256) (runs: 256, μ: 9471, ~: 9471) +ExclusivityOverrideLibTest:testHandleOverride() (gas: 22549) +ExclusivityOverrideLibTest:testHandleOverrideApplied(address,address,uint256,uint128) (runs: 256, μ: 24300, ~: 24300) +ExclusivityOverrideLibTest:testHandleOverrideAppliedMultiOutput(address,address,uint256,uint128[]) (runs: 256, μ: 422640, ~: 417800) +ExclusivityOverrideLibTest:testHandleOverridePass(address,uint256,uint128) (runs: 256, μ: 22831, ~: 22832) +ExclusivityOverrideLibTest:testHandleOverridePassNoExclusivity(address,uint256,uint128) (runs: 256, μ: 22785, ~: 22785) +ExclusivityOverrideLibTest:testHandleOverridePassWindowPassed(address,address,uint256,uint128) (runs: 256, μ: 23858, ~: 23858) +ExclusivityOverrideLibTest:testHandleOverrideStrict(address,address,uint128) (runs: 256, μ: 23226, ~: 23226) +ExclusivityOverrideLibTest:testNoExclusivity(address,uint256,uint256) (runs: 256, μ: 9132, ~: 9132) +LimitOrderReactorTest:testBaseExecute(uint128,uint128,uint256) (runs: 256, μ: 301158, ~: 303151) +LimitOrderReactorTest:testBaseExecuteBatch() (gas: 372014) +LimitOrderReactorTest:testBaseExecuteBatchMultipleOutputs() (gas: 388677) +LimitOrderReactorTest:testBaseExecuteBatchMultipleOutputsDifferentTokens() (gas: 495642) +LimitOrderReactorTest:testBaseExecuteBatchNativeOutput() (gas: 350302) +LimitOrderReactorTest:testBaseExecuteDeadlinePassed(uint128,uint128,uint256) (runs: 256, μ: 113249, ~: 115691) +LimitOrderReactorTest:testBaseExecuteInvalidReactor(address,uint128,uint128,uint256) (runs: 256, μ: 114815, ~: 116086) +LimitOrderReactorTest:testBaseExecuteNativeOutput(uint128,uint128,uint256) (runs: 256, μ: 276856, ~: 279253) +LimitOrderReactorTest:testBaseExecuteSignatureReplay() (gas: 297423) +LimitOrderReactorTest:testBaseExecuteTwoReactorsAtOnce() (gas: 3149068) +LimitOrderReactorTest:testBaseExecuteValidationContract(uint128,uint128,uint256) (runs: 256, μ: 312692, ~: 314884) +LimitOrderReactorTest:testBaseExecuteValidationContractFail(uint128,uint128,uint256) (runs: 256, μ: 122766, ~: 123981) +LimitOrderReactorTest:testBaseExecuteWithFee(uint128,uint128,uint256,uint8) (runs: 256, μ: 374436, ~: 370934) +LimitOrderReactorTest:testBaseNonceReuse() (gas: 283570) +LimitOrderReactorTest:testExecuteIncorrectSpender() (gas: 120111) +LimitOrderReactorTest:testExecuteIncorrectToken() (gas: 119439) +LimitOrderReactorTest:testExecuteInsufficientOutput() (gas: 946724) +LimitOrderReactorTest:testExecuteInsufficientPermit() (gas: 119467) +LimitOrderReactorTest:testExecuteWithDuplicateOutputs() (gas: 223102) +LimitOrderReactorTest:testExecuteWithFeeOutput() (gas: 976974) +LimitOrderReactorTest:testExecuteWithValidationContract() (gas: 211439) +LimitOrderReactorTest:testExecuteWithValidationContractChangeSig() (gas: 121706) +OrderQuoterTest:testGetReactorDutchOrder() (gas: 14476) +OrderQuoterTest:testGetReactorLimitOrder() (gas: 15969) +OrderQuoterTest:testGetReactorMockOrder() (gas: 9210) +OrderQuoterTest:testQuoteDutchOrder() (gas: 174565) +OrderQuoterTest:testQuoteDutchOrderAfterInputDecay() (gas: 175709) +OrderQuoterTest:testQuoteDutchOrderAfterOutputDecay() (gas: 175503) +OrderQuoterTest:testQuoteDutchOrderEndBeforeStart() (gas: 84814) +OrderQuoterTest:testQuoteLimitOrder() (gas: 168374) +OrderQuoterTest:testQuoteLimitOrderDeadlinePassed() (gas: 88091) +OrderQuoterTest:testQuoteLimitOrderInsufficientBalance() (gas: 127675) +ProtocolFeesGasComparisonTest:testInterfaceAndProtocolFee() (gas: 342064) +ProtocolFeesGasComparisonTest:testInterfaceAndProtocolFeeEthOutput() (gas: 293380) +ProtocolFeesGasComparisonTest:testInterfaceFee() (gas: 300011) +ProtocolFeesGasComparisonTest:testInterfaceFeeEthOutput() (gas: 247254) +ProtocolFeesGasComparisonTest:testNoFees() (gas: 261899) +ProtocolFeesGasComparisonTest:testNoFeesEthOutput() (gas: 224870) +ProtocolFeesTest:testSetFeeController() (gas: 22579) +ProtocolFeesTest:testSetFeeControllerOnlyOwner() (gas: 16924) +ProtocolFeesTest:testTakeFees() (gas: 62126) +ProtocolFeesTest:testTakeFeesDuplicate() (gas: 704622) +ProtocolFeesTest:testTakeFeesFuzzOutputs(uint128,uint128[],uint256) (runs: 256, μ: 649797, ~: 595500) +ProtocolFeesTest:testTakeFeesInvalidFeeToken() (gas: 624249) +ProtocolFeesTest:testTakeFeesMultipleOutputTokens() (gas: 93990) +ProtocolFeesTest:testTakeFeesMultipleOutputTokensWithInterfaceFee() (gas: 76778) +ProtocolFeesTest:testTakeFeesMultipleOutputTokensWithInterfaceFeeBothFees() (gas: 103164) +ProtocolFeesTest:testTakeFeesMultipleOutputTokensWithInterfaceFeeBothFeesChangeOrder() (gas: 103358) +ProtocolFeesTest:testTakeFeesMultipleOutputTokensWithInterfaceFeeChangeOrder() (gas: 76799) +ProtocolFeesTest:testTakeFeesNoFees() (gas: 33331) +ProtocolFeesTest:testTakeFeesTooMuch() (gas: 67028) +ProtocolFeesTest:testTakeFeesWithInterfaceFee() (gas: 66563) +ResolvedOrderLibTest:testDeadlinePassed() (gas: 79950) +ResolvedOrderLibTest:testExclusiveFillerValidationInvalidFiller() (gas: 330847) +ResolvedOrderLibTest:testExclusiveFillerValidationInvalidFillerPastTimestamp() (gas: 329958) +ResolvedOrderLibTest:testExclusiveFillerValidationValidFillerPastTimestamp() (gas: 330016) +ResolvedOrderLibTest:testInvalidReactor() (gas: 59161) +ResolvedOrderLibTest:testValid() (gas: 76439) +ResolvedOrderLibTest:testValidationContractInvalid() (gas: 419592) +ResolvedOrderLibTest:testValidationContractValid() (gas: 436660) +SwapRouter02ExecutorTest:testExecute() (gas: 351736) +SwapRouter02ExecutorTest:testExecuteAlreadyApproved() (gas: 494272) +SwapRouter02ExecutorTest:testExecuteBatch() (gas: 420871) +SwapRouter02ExecutorTest:testExecuteInsufficientOutput() (gas: 352828) +SwapRouter02ExecutorTest:testMsgSenderNotReactor() (gas: 126721) +SwapRouter02ExecutorTest:testNotWhitelistedCaller() (gas: 143385) +SwapRouter02ExecutorTest:testReactorCallback() (gas: 209950) +SwapRouter02ExecutorTest:testUnwrapWETH() (gas: 183032) +SwapRouter02ExecutorTest:testUnwrapWETHNotOwner() (gas: 10957) +SwapRouter02ExecutorTest:testWithdrawETH() (gas: 15240) +SwapRouter02ExecutorTest:testWithdrawETHNotOwner() (gas: 10922) \ No newline at end of file diff --git a/.github/workflows/gas.yml b/.github/workflows/gas.yml new file mode 100644 index 00000000..97d55deb --- /dev/null +++ b/.github/workflows/gas.yml @@ -0,0 +1,21 @@ +name: Gas + +on: + push: + branches: + - main + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Check gas snapshots + run: forge snapshot --check \ No newline at end of file