Skip to content

Commit

Permalink
Add older OpenZeppelin and Uniswap versions to external benchmarks
Browse files Browse the repository at this point in the history
- Also use explicit versions for all projects
  • Loading branch information
cameel committed Nov 1, 2024
1 parent 897dbcc commit ad51668
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
33 changes: 25 additions & 8 deletions test/benchmarks/external-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function setup_foundry_project {
"$install_function"
fi

neutralize_via_ir
[[ ! -e foundry.toml ]] || neutralize_via_ir
neutralize_version_pragmas
popd
echo
Expand All @@ -79,6 +79,13 @@ function install_liquity {
forge install
}

function install_old_uniswap {
openzeppelin_version=$(sed -n 's|\s\+"@openzeppelin/contracts": "\([0-9.]\+\)"|\1|p' package.json)
rm package.json
rm yarn.lock
npm install "@openzeppelin/contracts@${openzeppelin_version}"
}

function install_sablier {
# NOTE: To avoid hard-coding dependency versions here we'd have to install them from npm
forge install --no-commit \
Expand All @@ -101,11 +108,21 @@ EOF
mkdir -p "$BENCHMARK_DIR"
cd "$BENCHMARK_DIR"

setup_foundry_project openzeppelin/ tag v5.0.2 https://github.com/OpenZeppelin/openzeppelin-contracts
setup_foundry_project liquity/ commit 7f93a3f1781dfce2c4e0b6a7262deddd8a10e45b https://github.com/liquity/V2-gov install_liquity
setup_foundry_project uniswap-v4/ commit ae86975b058d386c9be24e8994236f662affacdb https://github.com/Uniswap/v4-core
setup_foundry_project openzeppelin-5.0.2/ tag v5.0.2 https://github.com/OpenZeppelin/openzeppelin-contracts
setup_foundry_project openzeppelin-4.9.0/ tag v4.9.0 https://github.com/OpenZeppelin/openzeppelin-contracts
setup_foundry_project openzeppelin-4.8.0/ tag v4.8.0 https://github.com/OpenZeppelin/openzeppelin-contracts
setup_foundry_project openzeppelin-4.7.0/ tag v4.7.0 https://github.com/OpenZeppelin/openzeppelin-contracts

setup_foundry_project liquity-2024-10-30/ commit 7f93a3f1781dfce2c4e0b6a7262deddd8a10e45b https://github.com/liquity/V2-gov install_liquity

setup_foundry_project uniswap-v4-2024-06-06/ commit ae86975b058d386c9be24e8994236f662affacdb https://github.com/Uniswap/v4-core
setup_foundry_project uniswap-v4-2022-06-16/ commit 9aeddf76e1b8646908fbcc7519c882bf458b794d https://github.com/Uniswap/v4-core install_old_uniswap

setup_foundry_project farcaster-3.1.0/ tag v3.1.0 https://github.com/farcasterxyz/contracts

# NOTE: Can't select the tag with `git clone` because a branch of the same name exists.
setup_foundry_project seaport/ commit tags/1.6 https://github.com/ProjectOpenSea/seaport
setup_foundry_project eigenlayer/ tag v0.3.0-holesky-rewards https://github.com/Layr-Labs/eigenlayer-contracts
setup_foundry_project farcaster/ tag v3.1.0 https://github.com/farcasterxyz/contracts
setup_foundry_project sablier-v2/ tag v1.1.2 https://github.com/sablier-labs/v2-core install_sablier
setup_foundry_project seaport-1.6/ commit tags/1.6 https://github.com/ProjectOpenSea/seaport

setup_foundry_project eigenlayer-0.3.0/ tag v0.3.0-holesky-rewards https://github.com/Layr-Labs/eigenlayer-contracts

setup_foundry_project sablier-v2-1.1.2/ tag v1.1.2 https://github.com/sablier-labs/v2-core install_sablier
24 changes: 14 additions & 10 deletions test/benchmarks/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function benchmark_project {
> /dev/null \
2> "../stderr-${project}-${pipeline}.log" || true

printf '| %-20s | %8s | %6d s | %9d MiB | %9d |\n' \
printf '| %-21s | %8s | %6d s | %9d MiB | %9d |\n' \
"$project" \
"$pipeline" \
"$(jq '(.user + .sys) | round' "$time_file")" \
Expand All @@ -76,20 +76,24 @@ function benchmark_project {

benchmarks=(
# Fastest ones first so that we get *some* output quickly
openzeppelin
liquity
uniswap-v4
eigenlayer
seaport
farcaster
sablier-v2
uniswap-v4-2022-06-16 # compiles via IR with solc >=0.8.12
openzeppelin-5.0.2 # compiles via IR with solc >=0.8.26
openzeppelin-4.9.0 # compiles via IR with solc 0.8.10-0.8.14 and >=0.8.26
openzeppelin-4.7.0 # compiles via IR with solc >=0.8.10
openzeppelin-4.8.0 # compiles via IR with solc >=0.8.10
liquity-2024-10-30 # compiles via IR with solc >=0.8.24
uniswap-v4-2024-06-06 # compiles via IR with solc >=0.8.24
eigenlayer-0.3.0 # compiles via IR with solc >=0.8.18
seaport-1.6 # StackTooDeep via IR
farcaster-3.1.0 # StackTooDeep via IR
sablier-v2-1.1.2 # StackTooDeep via IR
)

mkdir -p "$BENCHMARK_DIR"
cd "$BENCHMARK_DIR"

echo "| File | Pipeline | Time | Memory (peak) | Exit code |"
echo "|----------------------|----------|---------:|--------------:|----------:|"
echo "| File | Pipeline | Time | Memory (peak) | Exit code |"
echo "|-----------------------|----------|---------:|--------------:|----------:|"

for project in "${benchmarks[@]}"; do
benchmark_project legacy "$project"
Expand Down

0 comments on commit ad51668

Please sign in to comment.