[DO NOT MERGE] bench: switch foundry-capable scenarios to forge commands - #8324
[DO NOT MERGE] bench: switch foundry-capable scenarios to forge commands#8324Wodann wants to merge 4 commits into
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR updates several end-to-end benchmark scenarios to run Foundry-native workloads by switching their benchmark commands from npx hardhat ... to forge ..., and adds scenario preinstall hooks to install Foundry before running benchmarks.
Changes:
- Switch benchmark phases (cold/warm compile + tests) to
forge build/forge testfor Foundry-capable scenarios. - Add per-scenario
preinstall-foundry.shscripts and ensurePATHincludes$HOME/.foundry/binsoforgeis available to benchmark commands. - Introduce a shared
end-to-end/_shared/foundry-install.shhelper to install Foundry viafoundryup.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| end-to-end/uniswap-x/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge. |
| end-to-end/uniswap-x/preinstall-foundry.sh | Installs Foundry via shared helper before existing scenario-specific setup. |
| end-to-end/uniswap-v4-core/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge. |
| end-to-end/uniswap-v4-core/preinstall-foundry.sh | New preinstall script to install a pinned Foundry version. |
| end-to-end/lidofinance-dual-governance/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge (including test filtering). |
| end-to-end/lidofinance-dual-governance/preinstall-foundry.sh | New preinstall script to install a pinned Foundry version. |
| end-to-end/ens-verifiable-factory/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge. |
| end-to-end/ens-verifiable-factory/preinstall-foundry.sh | New preinstall script to install a pinned Foundry version. |
| end-to-end/aave-v4/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge. |
| end-to-end/aave-v4/preinstall-foundry.sh | New preinstall script to install a pinned nightly Foundry build. |
| end-to-end/1inch-swap-vm/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge. |
| end-to-end/1inch-swap-vm/preinstall-foundry.sh | New preinstall script to install a pinned Foundry version. |
| end-to-end/1inch-cross-chain-swap/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge. |
| end-to-end/1inch-cross-chain-swap/preinstall-foundry.sh | New preinstall script to install a pinned Foundry version. |
| end-to-end/1inch-aqua/scenario.json | Adds Foundry PATH + preinstall; switches benchmark commands to forge. |
| end-to-end/1inch-aqua/preinstall-foundry.sh | New preinstall script to install a pinned Foundry version. |
| end-to-end/_shared/foundry-install.sh | New shared helper that installs Foundry via foundryup (currently using a remote installer script). |
| if ! command -v foundryup >/dev/null 2>&1; then | ||
| curl -L https://foundry.paradigm.xyz | bash | ||
| fi |
7ca9d7d to
018c7cd
Compare
| local version="$1" | ||
| local foundry_bin_dir="${FOUNDRY_DIR:-$HOME/.foundry}/bin" | ||
| local foundryup_path="$foundry_bin_dir/foundryup" | ||
|
|
| if [ ! -x "$foundryup_path" ]; then | ||
| mkdir -p "$foundry_bin_dir" | ||
| curl -sSfL \ | ||
| "https://raw.githubusercontent.com/foundry-rs/foundry/HEAD/foundryup/foundryup" \ | ||
| -o "$foundryup_path" | ||
| chmod +x "$foundryup_path" |
057c70c to
149bcde
Compare
| curl -sSfL \ | ||
| "https://raw.githubusercontent.com/foundry-rs/foundry/HEAD/foundryup/foundryup" \ | ||
| -o "$foundryup_path" |
| curl -sSfL \ | ||
| "https://raw.githubusercontent.com/foundry-rs/foundry/HEAD/foundryup/foundryup" \ | ||
| -o "$foundryup_path" | ||
| chmod +x "$foundryup_path" |
8493bcb to
570d091
Compare
570d091 to
68d3bae
Compare
|
Closing this as we have generated the Foundry baseline. If we need to generate Foundry baseline numbers for additional scenarios, we can re-use this PR. |
68d3bae to
d948195
Compare
|
Closing this as we have generated the Foundry baseline. If we need to generate Foundry baseline numbers for additional scenarios, we can re-use this PR. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
end-to-end/_shared/foundry-install.sh:33
foundryupis downloaded from a movingHEADURL. That makes benchmark runs non-reproducible (the installer script can change between runs) and increases supply-chain risk for CI. Consider pinning this download to a specific commit or release ref and (ideally) verifying the downloaded script (checksum/signature) before executing it.
if [ ! -x "$foundryup_path" ]; then
mkdir -p "$foundry_bin_dir"
curl -sSfL \
"https://raw.githubusercontent.com/foundry-rs/foundry/HEAD/foundryup/foundryup" \
-o "$foundryup_path"
| @@ -44,6 +44,18 @@ export function installDependencies( | |||
| ...process.env, | |||
| ...env, | |||
| COREPACK_ENABLE_DOWNLOAD_PROMPT: "0", | |||
| // actions/setup-node (with `registry-url`) writes $RUNNER_TEMP/.npmrc | |||
| // with an `_authToken` referencing ${NODE_AUTH_TOKEN}, and the CI clone | |||
| // dir ($RUNNER_TEMP/hardhat-e2e-clones) lives right under it. Yarn | |||
| // Classic registers every .npmrc in the cwd's ancestor directories and | |||
| // hard-fails on any unset variable in a config it reads (npm only | |||
| // warns). The variable is only set in publish jobs; setup-node ≤v6 | |||
| // exported a placeholder that kept the substitution working, v7 | |||
| // stopped, so provide the fallback here. The registry these installs | |||
| // actually use is unaffected: the Verdaccio config outranks any | |||
| // ambient npmrc. | |||
| NODE_AUTH_TOKEN: | |||
| env?.NODE_AUTH_TOKEN ?? process.env.NODE_AUTH_TOKEN ?? "", | |||
| npm_config_minimum_release_age: "0", | |||
| needs: tests | ||
| timeout-minutes: 180 | ||
| timeout-minutes: 900 | ||
| steps: |
Replace each Foundry-capable scenario's benchmark.commands with the forge equivalents so that pnpm bench:regression measures baseline Foundry performance on the same external repos and the same benchmark shape used for Hardhat regression. This mirrors main's per-scenario "compile sequence" (reset/clean -> cold compile -> edit & compile the min-deps test, max-deps test, and a contract) plus the warm-compile and test-solidity commands, keeping identical command/step names and run counts so the Hardhat and Foundry numbers line up entry-for-entry: npx hardhat clean -> forge clean npx hardhat compile -> forge build (cold, warm, and every edit & compile) hardhat test solidity --no-compile -> forge test ... --grep="^(...)" -> forge test --match-test "^(...)" (lidofinance) Each scenario now ships a preinstall-foundry.sh (sourcing the shared _shared/foundry-install.sh helper) that pins a specific Foundry release, and prepends $HOME/.foundry/bin to PATH via scenario.json env so forge is on PATH for the benchmark commands. aave-v4 keeps main's preinstall.sh fuzz-runs reduction and additionally installs Foundry there; uniswap-x's preinstall-foundry.sh also builds the calibur submodule and patches foundry.toml. defaultCommand is unchanged so pnpm e2e continues to run Hardhat. The four non-Foundry scenarios are not touched.
dff1b3f to
771ab69
Compare
|
/bench |
|
🚀 Starting regression benchmark for |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
end-to-end/_shared/foundry-install.sh:33
- Downloading the foundryup installer from the
HEADref makes benchmark runs non-reproducible and creates a supply-chain risk (the script’s contents can change without any change to this repo). Sinceinstall_foundryalready takes a specific version, fetch the installer from a stable ref (e.g. the same tag) instead ofHEAD.
curl -sSfL \
"https://raw.githubusercontent.com/foundry-rs/foundry/HEAD/foundryup/foundryup" \
-o "$foundryup_path"
| # against the configured alert-threshold. | ||
| runs-on: hardhat-linux-amd64-self-hosted | ||
| timeout-minutes: 180 | ||
| timeout-minutes: 900 |
|
❌ Regression benchmark failed for |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
Suppressed comments (2)
end-to-end/_shared/foundry-install.sh:34
- The Foundry installer downloads and executes
foundryupfrom theHEADof the foundry repo. This makes benchmark runs non-reproducible and introduces a supply-chain risk (a change toHEADcan alter what gets executed even when scenarios pin a Foundry version). Consider pinning the raw URL to a specific commit/tag and (ideally) verifying a checksum before executing it.
if [ ! -x "$foundryup_path" ]; then
mkdir -p "$foundry_bin_dir"
curl -sSfL \
"https://raw.githubusercontent.com/foundry-rs/foundry/HEAD/foundryup/foundryup" \
-o "$foundryup_path"
chmod +x "$foundryup_path"
.github/workflows/regression-benchmark.yml:96
timeout-minuteswas increased from 180 to 900 (15h). On a self-hosted runner this can tie up the machine for long periods if something hangs or run-counts increase further. Consider keeping a tighter timeout and/or splitting the Foundry-baseline run into a separate, explicitly long-running workflow so normal regression runs can fail fast.
# Use a self-hosted runner for stable benchmark measurements; the shared
# GitHub runners produce noisy results that will generate false positives
# against the configured alert-threshold.
runs-on: hardhat-linux-amd64-self-hosted
timeout-minutes: 900
permissions:
This is a draft PR, merely intended to run the performance regression benchmark suite for Foundry, to create a baseline for our performance comparisons.