cgewecke / hardhat-gas-reporter

Gas Usage Analytics for Hardhat
MIT License
409 stars 56 forks source link

Add support for Optimism gas costs (bedrock & ecotone) #180

Closed cgewecke closed 6 months ago

cgewecke commented 6 months ago

Checked output vs some tx on Etherscan - variance is < 1%

Call type PR L1 Etherscan L1 % Total Tx Cost Diff
small fn 2324 2340 0.72%
large fn 21144 21176 0.15%
deployment 47948 47980 0.06%

NOTE: There's a weird thing with the hardhat projects template where testFiles paths resolve incorrectly on linux. This doesn't happen on MacOS though... e.g

/home/circleci/project/test/projects/options/test/variableCosts.ts

TODO

cgewecke commented 6 months ago

Methods

Min Max L2 Avg (Exec) L1 Avg (Data) Calls chf avg
VariableCosts
       addToMap 45,059 135,939 101,859 2,739 4 0.24
       methodThatThrows - - 43,727 2,064 1 0.18
       otherContractMethod - - 49,939 1,932 1 0.17
       removeFromMap 25,069 36,253 29,263 2,598 4 0.23
       sendPayment - - 33,312 2,456 1 0.22
       transferPayment - - 33,302 2,456 1 0.22
Wallet
       sendPayment - - 33,268 2,456 1 0.22
       transferPayment - - 33,257 2,456 1 0.22

Deployments

Min Max L2 Avg (Exec) L1 Avg (Data) Block % chf avg
VariableCosts - - 753,821 49,848 2.5 % 4.41
Wallet - - 213,658 13,420 0.7 % 1.19

Solidity and Network Config

Option Settings
Solidity: version 0.8.24
Solidity: optimized false
Solidity: runs 200
Solidity: viaIR false
Block Limit 30,000,000
L1 Base Fee 46 gwei
L2 Gas Price 0.00332 gwei
Token Price 2806.78 chf/eth
Network optimism
cgewecke commented 6 months ago

Screen Shot 2024-02-26 at 1 49 09 PM