Skip to content

Commit

Permalink
Add gas snapshot check (#67)
Browse files Browse the repository at this point in the history
* chore: gas snapshot

* refactor: removed explicit return in _msgSender()

* test: added gas-snapshot check
  • Loading branch information
zlace0x authored Dec 13, 2022
1 parent a0f6ccc commit 97705e2
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
82 changes: 82 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
FunnelTest:testApprove() (gas: 143366)
FunnelTest:testApproveRenewable() (gas: 96870)
FunnelTest:testApproveRenewableAndCall() (gas: 92530)
FunnelTest:testApproveRenewableAndCallRevertNonContract() (gas: 84740)
FunnelTest:testApproveRenewableAndCallRevertNonReceiver() (gas: 85670)
FunnelTest:testApproveRenewableAndCallWithGasSnapshot() (gas: 121012)
FunnelTest:testBaseToken() (gas: 9905)
FunnelTest:testBaseTokenAllowance() (gas: 103961)
FunnelTest:testClearRenewableAllowanceOnNormalApprove() (gas: 143323)
FunnelTest:testExecuteMetaTransactionApproveRenewable() (gas: 211775)
FunnelTest:testExecuteMetaTransactionTransfer() (gas: 127828)
FunnelTest:testFallbackToBaseToken() (gas: 25840)
FunnelTest:testInfiniteApproveTransferFrom() (gas: 132794)
FunnelTest:testInsufficientAllowance() (gas: 21475)
FunnelTest:testInsufficientBaseAllowance() (gas: 113379)
FunnelTest:testOverflow() (gas: 115155)
FunnelTest:testOverflow2() (gas: 115176)
FunnelTest:testOverflow3() (gas: 128616)
FunnelTest:testOverriddenName() (gas: 20952)
FunnelTest:testOverriddenNameWithNoName() (gas: 2045242)
FunnelTest:testPermit() (gas: 159444)
FunnelTest:testPermitRenewable() (gas: 130905)
FunnelTest:testPermitRenewableContractWallet() (gas: 126685)
FunnelTest:testRecoveryRateCasting() (gas: 85918)
FunnelTest:testRecoveryRateExceeded() (gas: 13452)
FunnelTest:testRecoveryRateExceeded2() (gas: 13492)
FunnelTest:testRenewableAllowanceTransferFrom() (gas: 149827)
FunnelTest:testRenewableMaxAllowance() (gas: 98365)
FunnelTest:testRevertExecuteMetaTransactionBadNonce() (gas: 48705)
FunnelTest:testRevertExecuteMetaTransactionCallFailed() (gas: 55277)
FunnelTest:testRevertExecuteMetaTransactionInvalidSigner() (gas: 41411)
FunnelTest:testRevertExecuteMetaTransactionReplayProtection() (gas: 144440)
FunnelTest:testRevertPermitBadDeadline() (gas: 47105)
FunnelTest:testRevertPermitBadNonce() (gas: 47002)
FunnelTest:testRevertPermitPastDeadline() (gas: 16239)
FunnelTest:testRevertPermitRenewableBadDeadline() (gas: 49183)
FunnelTest:testRevertPermitRenewableBadNonce() (gas: 49146)
FunnelTest:testRevertPermitRenewableContractWalletBadSigner() (gas: 52942)
FunnelTest:testRevertPermitRenewablePastDeadline() (gas: 20595)
FunnelTest:testRevertPermitRenewableReplay() (gas: 126066)
FunnelTest:testRevertPermitReplay() (gas: 123961)
FunnelTest:testSupportInterface() (gas: 5700)
FunnelTest:testSupportsInterfacePayable() (gas: 5770)
FunnelTest:testSupportsInterfaceProxy() (gas: 5852)
FunnelTest:testTransfer() (gas: 62100)
FunnelTest:testTransferFromAndCall() (gas: 137404)
FunnelTest:testTransferFromAndCallRevertNonContract() (gas: 112100)
FunnelTest:testTransferFromAndCallRevertNonReceiver() (gas: 110453)
FunnelTest:testTransferFromAndCallWithGasSnapshot() (gas: 172942)
FunnelTest:testTransferFromWithSnapshot() (gas: 155381)
FunnelTest:testZeroAddressInitialise() (gas: 1787778)
FunnelERC20Test:testApproveFuzzing(uint256) (runs: 256, μ: 117723, ~: 119900)
FunnelERC20Test:testApproveMaxWithTransfer() (gas: 137307)
FunnelERC20Test:testApproveWithTransferFuzzing(uint256,uint256) (runs: 256, μ: 147561, ~: 149022)
FunnelERC20Test:testBalanceOfOnMint(uint256) (runs: 256, μ: 65881, ~: 67015)
FunnelERC20Test:testBalanceOfOnMintLargeAmount() (gas: 66981)
FunnelERC20Test:testBalanceOfOnTransfer(uint256,uint256) (runs: 256, μ: 104936, ~: 107372)
FunnelERC20Test:testBalanceOfOnTransferLargeAmount() (gas: 87476)
FunnelERC20Test:testBalanceOfReflectsSlot(uint256) (runs: 256, μ: 322, ~: 322)
FunnelERC20Test:testFailApproveWithTransferInsufficientApproval() (gas: 99082)
FunnelERC20Test:testFailApprovewithTransferInsufficientBalance() (gas: 106996)
FunnelERC20Test:testFailTransferExceedsBalance(uint256) (runs: 256, μ: 40574, ~: 40682)
FunnelERC20Test:testInitialAllowance() (gas: 25029)
FunnelERC20Test:testTotalSupply(uint256) (runs: 256, μ: 42734, ~: 42933)
FunnelERC20Test:testTransferFullBalance() (gas: 61369)
FunnelERC20Test:testTransferFuzzing(uint256) (runs: 256, μ: 68303, ~: 69678)
FunnelERC20Test:testTransferHalfBalance() (gas: 66255)
FunnelERC20Test:testTransferOneToken() (gas: 64089)
FunnelERC20Test:testTransferZeroTokens() (gas: 41433)
FunnelFactoryTest:testDeployFunnelForDifferentTokens() (gas: 298301)
FunnelFactoryTest:testDeployFunnelForToken() (gas: 190140)
FunnelFactoryTest:testDeployFunnelForTokenRevertsIfAlreadyDeployed() (gas: 156740)
FunnelFactoryTest:testDeployFunnelFromDifferentFactory() (gas: 558192)
FunnelFactoryTest:testGetFunnelForTokenRevertsIfNotDeployed() (gas: 12826)
FunnelFactoryTest:testIsFunnelFalseForDeployedFunnelFromDifferentFactory() (gas: 563344)
FunnelFactoryTest:testIsFunnelFalseForNonFunnel() (gas: 10897)
FunnelFactoryTest:testIsFunnelFalseForUndeployedFunnel() (gas: 8329)
FunnelFactoryTest:testIsFunnelTrueForDeployedFunnel() (gas: 155345)
FunnelFactoryTest:testNoCodeTokenReverts() (gas: 15454)
FunnelFactoryTest:testTransferFromFunnel() (gas: 291706)
MockSpenderReceiverTest:testSupportInterfaceReceiver() (gas: 5598)
MockSpenderReceiverTest:testSupportInterfaceSpender() (gas: 6567)
21 changes: 21 additions & 0 deletions .github/workflows/gas.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ node_modules/
artifacts/
cache_hardhat/
typechain-types/
.gas-snapshot
gas-snapshots/
report/

0 comments on commit 97705e2

Please sign in to comment.