This repository benchmarks performance of various Ethereum development
frameworks by simulating a call to Convex's systemShutdown method. This method
uses about 16M gas and performs a number of token transfers
-
Run
cp .env.example .env, and in the resulting.envfile enter a URL to an Ethereum archive node in theETH_RPC_URLenvironment variable. (Alchemy provides free archive node data). Also fill out theTENDERLY_*variables to benchmark the Tenderly API -
Run
yarnto install dependencies for Ganache and Hardhat -
Install Foundry's forge and Dapptools using the installation instructionshere and here respectively
-
Run
dapp updateto install dependencies for Dapptools and Foundry -
Run any command in the
Makefileto benchmark that tool. For example, usemake benchmark-hardhatto run the simulation against Hardhat. Alternatively, runmake benchmark-allto run all tools
- Set
export CLEAR_CACHE=1in your.envfile to clear the Ganache and Hardhat caches - Consider running the benchmarks via Docker. See the comment header in the Dockerfile for details.
Notes:
- "Local, No Cache" refers to tools run on a local machine with a local node, where all data needed from the node is fetched on-demand
- "Local, With Cache" refers to tools run on a local machine with a local node, where all data needed from the node was cached to disk on a previous run
- "Cloud Based" refers to services that provide an API and run the simulation on their servers
- Foundry does not cache RPC results to disk between runs, so the "Local, With Cache" column has been left as N/A
- Ganache results are currently not shown due to a bug documented in issue #7
- If Tenderly returns a 400, it's because the simulation timed out which may happen if they don't have data cached on the servers. Attempting to run the simulation in their UI seems to resolve this
- Blocknative simulates on tip block height currently, with archival node simulations are planned for historical simulation.
- Local benchmarks were run against a local Erigon node on macOS 11.6.2 with a 2.3 GHz 8-Core Intel Core i9 and 32 GB 2667 MHz DDR4 (The goal is to benchmark tool performance, which is why a local node is used—if benchmarking against a remote node such as Infura or Alchemy, network calls become the driver of execution time)
- Just because gas used differs between tools does not mean only one is correct. For example, Foundry and Dapptools exclude the 21,064 intrinsic gas from the reported gas used, but other tools may not. However, at this time it is not known which value is the truth value. Similarly, dapptools does not include refunds in their reported gas used
| Framework | Local, No Cache | Local, With Cache | Cloud Based |
|---|---|---|---|
| Dapptools | TODO | TODO | N/A |
| Ganache | TBD | TBD | N/A |
| Hardhat | TODO | TODO | N/A |
| Foundry | TODO | N/A | N/A |
| Tenderly | N/A | N/A | TODO |
| Framework | Gas Used |
|---|---|
| Dapptools | 16,770,582 |
| Ganache | TBD |
| Hardhat | 15,344,483 |
| Foundry | 15,515,306 |
| Tenderly | 15,537,677 |