Skip to content

Commit

Permalink
snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
massun-onibakuchi committed May 29, 2024
1 parent cedb0e3 commit dc6938e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
22 changes: 11 additions & 11 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
GrimReaperHuffTest:testLiquidate() (gas: 389224)
GrimReaperHuffTest:testLiquidate(uint256,address) (runs: 256, μ: 388798, ~: 389315)
GrimReaperHuffTest:testOnlyOwner(address) (runs: 256, μ: 20257, ~: 20257)
GrimReaperHuffTest:testRecoverERC20() (gas: 330803)
GrimReaperHuffTest:testRevertIfLiquidationFail() (gas: 52429)
GrimReaperSolTest:testLiquidate() (gas: 389616)
GrimReaperSolTest:testLiquidate(uint256,address) (runs: 256, μ: 389191, ~: 389708)
GrimReaperHuffTest:testLiquidate() (gas: 390422)
GrimReaperHuffTest:testLiquidate(uint256,address) (runs: 256, μ: 390244, ~: 390512)
GrimReaperHuffTest:testOnlyOwner(address) (runs: 256, μ: 20247, ~: 20247)
GrimReaperHuffTest:testRecoverERC20() (gas: 330912)
GrimReaperHuffTest:testRevertIfLiquidationFail() (gas: 52419)
GrimReaperSolTest:testLiquidate() (gas: 390820)
GrimReaperSolTest:testLiquidate(uint256,address) (runs: 256, μ: 390395, ~: 390912)
GrimReaperSolTest:testOnlyOwner(address) (runs: 256, μ: 18934, ~: 18934)
GrimReaperSolTest:testRecoverERC20() (gas: 331740)
GrimReaperSolTest:testRevertIfLiquidationFail() (gas: 51145)
OptimizedGrimReaperSolTest:testLiquidate() (gas: 389287)
OptimizedGrimReaperSolTest:testLiquidate(uint256,address) (runs: 256, μ: 388861, ~: 389378)
OptimizedGrimReaperSolTest:testOnlyOwner(address) (runs: 256, μ: 20402, ~: 20402)
OptimizedGrimReaperSolTest:testLiquidate() (gas: 390477)
OptimizedGrimReaperSolTest:testLiquidate(uint256,address) (runs: 256, μ: 390299, ~: 390562)
OptimizedGrimReaperSolTest:testOnlyOwner(address) (runs: 256, μ: 20400, ~: 20400)
OptimizedGrimReaperSolTest:testRecoverERC20() (gas: 330864)
OptimizedGrimReaperSolTest:testRevertIfLiquidationFail() (gas: 52485)
OptimizedGrimReaperSolTest:testRevertIfLiquidationFail() (gas: 52467)
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ For more information on how to use Foundry, check out the [Foundry Github Reposi

| Single Liquidation | Gas Used | Bytecode Size (kB) |
| ---------------------------------------------- | -------- | ------------------ |
| Solidity Contract (Optimizer runs: 200) | 97944 | 1.005 |
| Assembly (Optimizer runs: 200) | 97319 | 0.313 |
| Huff Contract (Optimizer runs: 200) | 97261 | 0.256 |
| Solidity Contract (Optimizer runs: 10_000_000) | 97350 | 1.308 |
| Assembly (Optimizer runs: 10_000_000) | 96779 | 0.372 |
| Huff Contract (Optimizer runs: 10_000_000) | 96733 | 0.256 |
| Solidity Contract (Optimizer runs: 200) | 97933 | 1.005 |
| Assembly (Optimizer runs: 200) | 97295 | 0.306 |
| Huff Contract (Optimizer runs: 200) | 97246 | 0.254 |
| Solidity Contract (Optimizer runs: 10_000_000) | 97339 | 1.308 |
| Assembly (Optimizer runs: 10_000_000) | 96755 | 0.327 |
| Huff Contract (Optimizer runs: 10_000_000) | 96718 | 0.254 |

> `66270` gas is used for the liquidation logic itself on mock Aave v3 pool.
> Note: Optimizer runs affects how well the compiler optimizes tests contract as well. So, it affects measurements.
- solc version: 0.8.24, evm version: cancun with `bytecode_hash = "none"` and `cbor_metadata = false`
- solc version: 0.8.24, evm version: cancun with `bytecode_hash = "none"` and `cbor_metadata = false`.
- `forge snapshot --fuzz-seed=111 -vv`

## Acknowledgements

Expand Down
8 changes: 8 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@ remappings = [
bytecode_hash = "none"
cbor_metadata = false

ignored_error_codes = [
"license",
"code-size",
"init-code-size",
"transient-storage",
3628,
]

[profile.release]
optimizer_runs = 10_000_000

0 comments on commit dc6938e

Please sign in to comment.