From dc6938ed4bdd077c73315fcc93578aa86a590529 Mon Sep 17 00:00:00 2001 From: onibakuchi Date: Wed, 29 May 2024 22:03:28 +0400 Subject: [PATCH] snapshot --- .gas-snapshot | 22 +++++++++++----------- README.md | 17 ++++++++++------- foundry.toml | 8 ++++++++ 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 0e92f17..b80845d 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -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) \ No newline at end of file +OptimizedGrimReaperSolTest:testRevertIfLiquidationFail() (gas: 52467) \ No newline at end of file diff --git a/README.md b/README.md index 8f4122f..8650fcd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/foundry.toml b/foundry.toml index 5e568db..3c688c8 100644 --- a/foundry.toml +++ b/foundry.toml @@ -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