-
Notifications
You must be signed in to change notification settings - Fork 845
[ci] Support running re-execution benchmark with arbitrary version of Firewood #4650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Elvis339
wants to merge
64
commits into
master
Choose a base branch
from
es/enable-firewood-dev-workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
d0155dd
ci(c-chain-reexecution-firewood)
Elvis339 e851903
lint
Elvis339 49b7fc3
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 2feeda4
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 6f21231
ci(firewood-benchmark): try go get first, fall back to Nix on failure
Elvis339 b3cc8ed
Merge branch 'es/enable-firewood-dev-workflow' of github.com:ava-labs…
Elvis339 e437658
refactor(build-firewood): move default config to script, simplify task
Elvis339 15b52ee
ci(firewood-benchmark): test workflow without the commit step
Elvis339 999c3f4
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 34a331f
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 cb5e59a
ci(c-chain-reexecution): add custom firewood/libevm support to reexec…
Elvis339 e0e784b
Merge branch 'es/enable-firewood-dev-workflow' of github.com:ava-labs…
Elvis339 cab333e
fix(c-chain-reexecution): add nix build env vars for self-hosted runners
Elvis339 c131420
lint(c-chain-reexecution): set 10 input params per gh workflow limit
Elvis339 f79c8d5
docs
Elvis339 c4561be
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 a89c44e
ci(c-chain-reexecution): skip benchmark comparison for custom firewoo…
Elvis339 d428155
ci(c-chain-reexecution): rename libevm and firewood inputs to libevm-…
Elvis339 87b3d4c
docs
Elvis339 6f5502b
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 6493598
ci(c-chain-reexecution): clarify firewood-ref skips benchmark comparison
Elvis339 0451870
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 8cf656d
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 cfe4960
lint
Elvis339 1416e52
refactor(ci): combine dep refs into 'with' input, restore push-post-s…
Elvis339 0a7185a
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 48bdef7
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 279e120
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 325e42b
Merge branch 'es/enable-firewood-dev-workflow' of github.com:ava-labs…
Elvis339 a2d7b8c
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 73d4057
ci(c-chain-reexecution): rename 'with' input to 'with-dependencies' f…
Elvis339 4c4d3eb
ci(c-chain-reexecution): reduce diff caused by workflow inputs order
Elvis339 af62634
Merge branch 'es/enable-firewood-dev-workflow' of github.com:ava-labs…
Elvis339 b81d12f
docs
Elvis339 2ecec16
ci(reexecution): support genesis start by making state-dir optional
Elvis339 cd4a9d7
feat(reexecution): support genesis start for c-chain benchmarks
Elvis339 1ef0920
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 05c1b8d
chore(Taskfile): define global genesis sentinel value for c-chain-ree…
Elvis339 e1be9e1
docs
Elvis339 5426ee8
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 2b86559
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 90fd09a
Merge branch 'es/enable-firewood-dev-workflow' of github.com:ava-labs…
Elvis339 73c876e
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 a92e465
ci(c-chain-reexecution): remove unused libevm and firewood refs from …
Elvis339 81b88b6
chore(Taskfile): add `setup-reexecution-deps` task to configure depen…
Elvis339 6f944d1
ci(c-chain-reexecution): add `setup-reexecution-deps` step, improve i…
Elvis339 8a92625
docs
Elvis339 db41178
Merge branch 'master' into es/enable-firewood-dev-workflow
Elvis339 f410444
ci(c-chain-reexecution): unique artifact upload name
Elvis339 d619a21
ci(c-chain-reexecution): unique name
Elvis339 954121b
refactor(scripts): consolidate dep setup into run_polyrepo.sh
Elvis339 d9b2717
docs:
Elvis339 6076c4f
refactor(ci): simplify dependency configuration for benchmarks
Elvis339 221157a
fix(ci): Simplify artifact name to test + runner_type (sufficient for…
Elvis339 6aef9df
fix(ci): Simplify artifact name to test + runner_type (sufficient for…
Elvis339 c28cd33
lint
Elvis339 2ac5157
fix(reexecution-container): add tmpdir and nix build top to tmp fixin…
Elvis339 1f06a14
refactor(ci): simplify dependency setup in reexecution benchmarks
Elvis339 6ad2f13
lint
Elvis339 e3ab8ad
fix(ci): skip benchmark comparison when using custom dependencies
Elvis339 01da31a
fix(ci): skip benchmark comparison when custom deps modify go.mod
Elvis339 e463b6a
fix(ci): add skip-benchmark-comparison input for custom deps
Elvis339 dac5262
docs(ci): document Nix installation idempotency in reexec workflows
Elvis339 a29c22c
ci(reexecution): use env vars for custom dependency setup in reexec b…
Elvis339 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
.github/workflows/c-chain-reexecution-benchmark-firewood.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| # Firewood Reexecution Benchmark | ||
| # | ||
| # This workflow runs C-Chain reexecution benchmarks with custom Firewood builds. | ||
| # It's designed to be triggered by the Firewood repository to track performance. | ||
| # | ||
| # Firewood input modes: | ||
| # - Versioned (v0.0.15): Uses `go get` to fetch published version (fast) | ||
| # - Branch/commit (main, abc123): Builds from source using Nix (slower) | ||
| # | ||
| # Results are uploaded as artifacts for Firewood to download and publish | ||
| # to their own GitHub Pages dashboard. | ||
|
|
||
| name: Firewood Reexecution Benchmark | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| firewood: | ||
| description: 'Firewood commit/branch/tag to build and test' | ||
| required: true | ||
| libevm: | ||
maru-ava marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description: 'libevm commit/branch/tag (optional)' | ||
| default: '' | ||
| task: | ||
| description: 'Taskfile task to execute (e.g., c-chain-reexecution-firewood-101-250k, if present custom inputs below are ignored)' | ||
| default: 'c-chain-reexecution-firewood-101-250k' | ||
| config: | ||
| default: '' | ||
| start-block: | ||
| default: '' | ||
| end-block: | ||
| default: '' | ||
| block-dir-src: | ||
| default: '' | ||
| current-state-dir-src: | ||
| default: '' | ||
| runner: | ||
| description: 'Runner to execute the benchmark. Input to the runs-on field of the job.' | ||
| required: true | ||
| push-post-state: | ||
| default: '' | ||
|
|
||
| jobs: | ||
| determine-build-type: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| from-source: ${{ steps.check.outputs.from-source }} | ||
| steps: | ||
| - name: Check Firewood input | ||
| id: check | ||
| run: | | ||
| # Semantic versions (vX.Y.Z) are published to Go module registry | ||
maru-ava marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Branches/commits need to be built from source using Nix | ||
| if [[ "${{ inputs.firewood }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "from-source=false" >> "$GITHUB_OUTPUT" | ||
| echo "Firewood version detected: ${{ inputs.firewood }}" | ||
| else | ||
| echo "from-source=true" >> "$GITHUB_OUTPUT" | ||
| echo "Firewood branch/commit detected: ${{ inputs.firewood }}" | ||
| fi | ||
| c-chain-reexecution: | ||
| needs: determine-build-type | ||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
| runs-on: ${{ inputs.runner }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Go | ||
| uses: ./.github/actions/setup-go-for-project | ||
| - name: Install Nix dependencies | ||
| shell: bash | ||
| run: | | ||
| if ! command -v xz &> /dev/null; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y xz-utils | ||
| fi | ||
| - name: Install Nix | ||
| if: needs.determine-build-type.outputs.from-source == 'true' | ||
| uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31 | ||
| with: | ||
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Update libevm | ||
| if: inputs.libevm != '' | ||
| shell: bash | ||
| run: | | ||
| echo "Updating libevm to: ${{ inputs.libevm }}" | ||
maru-ava marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| go get github.com/ava-labs/libevm@${{ inputs.libevm }} | ||
| cd graft/coreth | ||
| go get github.com/ava-labs/libevm@${{ inputs.libevm }} | ||
| - name: Fetch Firewood (versioned) | ||
| if: needs.determine-build-type.outputs.from-source == 'false' | ||
| shell: bash | ||
| run: | | ||
| cd graft/coreth | ||
| echo "Fetching published Firewood: ${{ inputs.firewood }}" | ||
| go get github.com/ava-labs/firewood-go-ethhash/ffi@${{ inputs.firewood }} | ||
| - name: Build Firewood (from source) | ||
| if: needs.determine-build-type.outputs.from-source == 'true' | ||
| shell: bash | ||
| run: ./scripts/run_task.sh build-firewood FIREWOOD_REF="${{ inputs.firewood }}" DIRTY=true | ||
| env: | ||
| TMPDIR: /tmp | ||
| NIX_BUILD_TOP: /tmp | ||
| # Commit go.mod changes locally to keep working tree clean | ||
maru-ava marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # (required for github-action-benchmark branch switching) | ||
| - name: Commit go.mod changes | ||
| shell: bash | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add go.mod go.sum graft/coreth/go.mod graft/coreth/go.sum | ||
| git diff --staged --quiet || git commit -m "temp: Firewood/libevm for benchmark" | ||
| - name: Run C-Chain Re-Execution Benchmark | ||
| uses: ./.github/actions/c-chain-reexecution-benchmark | ||
| with: | ||
| task: ${{ inputs.task }} | ||
| config: ${{ inputs.config }} | ||
| start-block: ${{ inputs.start-block }} | ||
| end-block: ${{ inputs.end-block }} | ||
| block-dir-src: ${{ inputs.block-dir-src }} | ||
| current-state-dir-src: ${{ inputs.current-state-dir-src }} | ||
| prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }} | ||
| prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }} | ||
| prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }} | ||
| prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} | ||
| push-github-action-benchmark: false # Firewood downloads artifact and publishes to their gh-pages | ||
| aws-role: ${{ inputs.push-post-state != '' && secrets.AWS_S3_RW_ROLE || secrets.AWS_S3_READ_ONLY_ROLE }} | ||
| aws-region: 'us-east-2' | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| push-post-state: ${{ inputs.push-post-state }} | ||
| runner_name: ${{ inputs.runner }} | ||
| - name: Upload benchmark results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: benchmark-output | ||
| path: ${{ github.workspace }}/benchmark-output.txt | ||
| retention-days: 30 | ||
| if-no-files-found: error | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| print_usage() { | ||
| printf "Usage: build_firewood.sh [FIREWOOD_COMMIT] [--dirty] | ||
| Build Firewood FFI from source for testing with Coreth. | ||
| Arguments: | ||
| FIREWOOD_COMMIT Git commit or branch to build (default: main) | ||
| Options: | ||
| --dirty Update go.mod after building (dirties working tree) | ||
maru-ava marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| (default: only print path) | ||
| Examples: | ||
| # Build from commit and capture FFI path | ||
| FIREWOOD_FFI_PATH=\$(./scripts/build_firewood.sh abc123def) | ||
| # Build from main and update go.mod (dirties tree) | ||
| ./scripts/build_firewood.sh main --dirty | ||
Elvis339 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Note: To use a published Firewood version (e.g., v0.0.15) run go get -u github.com/ava-labs/firewood-go-ethhash/ffi@{version} | ||
| " | ||
| } | ||
|
|
||
| FIREWOOD_COMMIT="main" | ||
| UPDATE_GO_MOD=false | ||
|
|
||
| while [[ $# -gt 0 ]]; do | ||
| case $1 in | ||
| -h|--help) | ||
| print_usage | ||
| exit 0 | ||
| ;; | ||
| --dirty) | ||
| UPDATE_GO_MOD=true | ||
| shift | ||
| ;; | ||
| *) | ||
| FIREWOOD_COMMIT="$1" | ||
| shift | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| CORETH_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) | ||
| FIREWOOD_DIR="${CORETH_PATH}/build/firewood" | ||
|
|
||
| echo "Building Firewood FFI from source at: ${FIREWOOD_COMMIT}" >&2 | ||
|
|
||
| if ! command -v nix &> /dev/null; then | ||
| echo "Error: nix command not found" >&2 | ||
| echo "Nix is required to build Firewood. To install it, run:" >&2 | ||
| echo " ./scripts/run_task.sh install-nix" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -d "${FIREWOOD_DIR}/.git" ]; then | ||
| cd "${FIREWOOD_DIR}" | ||
| git fetch origin | ||
| git checkout "${FIREWOOD_COMMIT}" | ||
| git pull --ff-only 2>/dev/null || true | ||
Elvis339 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| else | ||
| mkdir -p "${CORETH_PATH}/build" | ||
| git clone https://github.com/ava-labs/firewood.git "${FIREWOOD_DIR}" | ||
| cd "${FIREWOOD_DIR}" | ||
| git checkout "${FIREWOOD_COMMIT}" | ||
| fi | ||
|
|
||
| cd "${FIREWOOD_DIR}/ffi" | ||
| nix build 2>&1 | ||
|
|
||
| FIREWOOD_FFI_PATH="${FIREWOOD_DIR}/ffi/result/ffi" | ||
| export FIREWOOD_FFI_PATH | ||
|
|
||
| if [ ! -d "${FIREWOOD_FFI_PATH}" ]; then | ||
| echo "Error: Build succeeded but result not found at ${FIREWOOD_FFI_PATH}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Firewood built successfully at: ${FIREWOOD_FFI_PATH}" >&2 | ||
|
|
||
| if [ "${UPDATE_GO_MOD}" = true ]; then | ||
| echo "Updating go.mod..." >&2 | ||
|
|
||
| cd "${CORETH_PATH}" | ||
| go mod edit -replace "github.com/ava-labs/firewood-go-ethhash/ffi=${FIREWOOD_FFI_PATH}" | ||
| go mod tidy | ||
|
|
||
| echo "Updated go.mod successfully" >&2 | ||
| fi | ||
|
|
||
| # Output path to stdout for capture | ||
| echo "${FIREWOOD_FFI_PATH}" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.