Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 71 additions & 1 deletion .github/workflows/tag_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,69 @@ jobs:
name: verification_keys
path: verification_keys/

# There's a separate job to build the guest programs for SP1 and RISC0 since
# they need to be built without the l2 features.
build-ethrex-guest:
strategy:
matrix:
zkvm:
- sp1
- risc0
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Free Disk Space
uses: ./.github/actions/free-disk

- name: Setup Rust Environment
uses: ./.github/actions/setup-rust

- name: Install SP1
if: ${{ matrix.zkvm == 'sp1' }}
env:
SHELL: /bin/bash
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L https://sp1up.succinct.xyz | bash
~/.sp1/bin/sp1up --version 5.0.8

- name: Install RISC0
if: ${{ matrix.zkvm == 'risc0' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L https://risczero.com/install | bash
~/.risc0/bin/rzup install cargo-risczero 3.0.3
~/.risc0/bin/rzup install risc0-groth16
~/.risc0/bin/rzup install rust

- name: Build ethrex ${{ matrix.zkvm }} elf
run: |
cargo build --release --package guest_program --features ${{ matrix.zkvm }}
mkdir -p ${{ matrix.zkvm }}_verification_keys
if [ "${{ matrix.zkvm }}" = "sp1" ]; then
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-succinct-zkvm-elf ethrex-riscv32im-sp1-elf-${{ github.ref_name }}
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-succinct-zkvm-vk-bn254 ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-sp1-vk-bn254-${{ github.ref_name }}
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-succinct-zkvm-vk-u32 ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-sp1-vk-u32-${{ github.ref_name }}
elif [ "${{ matrix.zkvm }}" = "risc0" ]; then
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-vk ethrex-riscv32im-risc0-elf-${{ github.ref_name}}
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-vk ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-risc0-vk-${{ github.ref_name}}
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing closing brace in template expression. Both lines should use ${{ github.ref_name }} with a closing brace, not ${{ github.ref_name}}.

Suggested change
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-vk ethrex-riscv32im-risc0-elf-${{ github.ref_name}}
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-vk ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-risc0-vk-${{ github.ref_name}}
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-vk ethrex-riscv32im-risc0-elf-${{ github.ref_name }}
mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-vk ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-risc0-vk-${{ github.ref_name }}

Copilot uses AI. Check for mistakes.
fi

- name: Upload ethrex guest elf artifact
uses: actions/upload-artifact@v4
with:
name: ethrex-riscv32im-${{ matrix.zkvm }}-elf-${{ github.ref_name }}
path: ethrex-riscv32im-${{ matrix.zkvm }}-elf-${{ github.ref_name }}

- name: Upload ethrex guest verification keys
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.zkvm }}_verification_keys
path: ${{ matrix.zkvm }}_verification_keys/

package-contracts:
needs:
- build-ethrex
Expand Down Expand Up @@ -221,6 +284,7 @@ jobs:
finalize-release:
needs:
- build-ethrex
- build-ethrex-guest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not needed since it is required in package-ethrex-guest

- build-docker
- package-contracts
runs-on: ubuntu-latest
Expand All @@ -234,7 +298,13 @@ jobs:
uses: actions/download-artifact@v4
with:
path: ./bin
pattern: "ethrex*"
pattern: "ethrex*" # This includes the binaries and elf files

- name: Download verification keys
uses: actions/download-artifact@v4
with:
path: ./bin
pattern: "*_verification_keys" # sp1_verification_keys, risc0_verification_keys
Copy link
Collaborator Author

@ilitteri ilitteri Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if the pattern needs to be instead "*_verification_keys/*"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put VKs and ELFs in a .tar file so we don't add 5 more files

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- name: Get previous tag
run: |
Expand Down
4 changes: 4 additions & 0 deletions crates/l2/prover/src/guest_program/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ fn build_risc0_program() {
"zkvm-risc0-program",
guest_options,
)]));
let elf = built_guests[0].elf.clone();
let image_id = built_guests[0].image_id;

// this errs if the dir already exists, so we don't handle an error.
let _ = std::fs::create_dir("./src/risc0/out");

std::fs::write("./src/risc0/out/riscv32im-risc0-elf", &elf)
.expect("could not write Risc0 elf to file");

std::fs::write(
"./src/risc0/out/riscv32im-risc0-vk",
format!("0x{}\n", hex::encode(image_id.as_bytes())),
Expand Down
Loading