Skip to content

refactor(l1,l2): extract duplicate witness generation logic to helper #18501

refactor(l1,l2): extract duplicate witness generation logic to helper

refactor(l1,l2): extract duplicate witness generation logic to helper #18501

name: L2 Prover
on:
push:
branches: ["main"]
pull_request:
branches: ["**"]
workflow_dispatch:
permissions:
contents: read
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# Work around frequent libgit2/submodule fetch flakiness in CI.
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
CARGO_NET_RETRY: "10"
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.finish.outputs.run_tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
run_tests:
- '!docs/**'
- name: finish
id: finish
run: echo "run_tests=${{ steps.filter.outputs.run_tests }}" >> "$GITHUB_OUTPUT"
- name: Print result
run: echo "run_tests=${{ steps.finish.outputs.run_tests }}"
lint_zk:
name: Lint ${{ matrix.backend }} backend
needs: detect-changes
if: ${{ needs.detect-changes.outputs.run_tests == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
# Note: openvm backend linting is disabled due to a problem in the installation https://github.com/lambdaclass/ethrex/issues/5509
backend: ["sp1", "risc0", "zisk"]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Free Disk Space
uses: ./.github/actions/free-disk
- name: Add Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install RISC0
if: matrix.backend == 'risc0'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/actions/install-risc0
- name: RISC-V SP1 toolchain install
if: matrix.backend == 'sp1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up --version 5.0.8
- name: ZisK toolchain install
if: matrix.backend == 'zisk'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SETUP_KEY: none
run: |
sudo apt-get update
sudo apt-get install -y xz-utils jq curl build-essential qemu-system libomp-dev libgmp-dev nlohmann-json3-dev protobuf-compiler uuid-dev libgrpc++-dev libsecp256k1-dev libsodium-dev libpqxx-dev nasm libopenmpi-dev openmpi-bin openmpi-common libclang-dev clang gcc-riscv64-unknown-elf
curl https://raw.githubusercontent.com/0xPolygonHermez/zisk/main/ziskup/install.sh | bash
echo "$HOME/.zisk/bin" >> $GITHUB_PATH
- name: RISC-V OpenVM toolchain install
if: matrix.backend == 'openvm'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rustup install nightly-2025-02-14
rustup component add rust-src --toolchain nightly-2025-02-14
cargo +1.86 install --locked --git https://github.com/openvm-org/openvm.git --tag v1.4.1 cargo-openvm
- name: Check ${{ matrix.backend }} backend
run: |
cargo check -r -p ethrex-prover -F "${{ matrix.backend }},ci"
- name: Clippy ${{ matrix.backend }} backend
run: |
cargo clippy -r -p ethrex-prover --all-targets -F "${{ matrix.backend }},ci"
- name: Check ${{ matrix.backend }} Cargo.lock modified but not committed
run: |
git diff --exit-code -- crates/guest-program/bin/${{ matrix.backend }}/Cargo.lock
lint_exec:
name: Lint exec backend
needs: detect-changes
if: ${{ needs.detect-changes.outputs.run_tests == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Add Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check exec
run: |
cargo check -p ethrex-prover
- name: Clippy exec
run: |
cargo clippy -p ethrex-prover --all-targets
lint_tdx:
name: Lint tdx backend
needs: detect-changes
if: ${{ needs.detect-changes.outputs.run_tests == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Add Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check tdx
run: |
cd crates/l2/tee/quote-gen
cargo check
- name: Clippy tdx
run: |
cd crates/l2/tee/quote-gen
cargo clippy --all-targets
# The purpose of this job is to add it as a required check in GitHub so that we don't have to add every individual job as a required check
all-tests:
# "Lint" is a required check, don't change the name
name: Lint
runs-on: ubuntu-latest
needs: [detect-changes, lint_exec, lint_tdx, lint_zk]
# Make sure this job runs even if the previous jobs failed or were skipped
if: ${{ needs.detect-changes.outputs.run_tests == 'true' && always() && needs.lint_exec.result != 'skipped' && needs.lint_tdx.result != 'skipped' && needs.lint_zk.result != 'skipped' }}
steps:
- name: Check if any job failed
run: |
if [ "${{ needs.lint_exec.result }}" != "success" ]; then
echo "Job Lint exec Check failed"
exit 1
fi
if [ "${{ needs.lint_tdx.result }}" != "success" ]; then
echo "Job Lint TDX failed"
exit 1
fi
if [ "${{ needs.lint_zk.result }}" != "success" ]; then
echo "Job Lint ZK failed"
exit 1
fi