@@ -149,6 +149,111 @@ jobs:
149149 name : verification_keys
150150 path : verification_keys/
151151
152+ # There's a separate job to build the guest programs for SP1 and RISC0 since
153+ # they need to be built without the l2 features.
154+ build-ethrex-guest :
155+ strategy :
156+ matrix :
157+ zkvm :
158+ - sp1
159+ - risc0
160+ runs-on : ubuntu-latest
161+ steps :
162+ - name : Checkout code
163+ uses : actions/checkout@v4
164+
165+ - name : Free Disk Space
166+ uses : ./.github/actions/free-disk
167+
168+ - name : Setup Rust Environment
169+ uses : ./.github/actions/setup-rust
170+
171+ - name : Install SP1
172+ if : ${{ matrix.zkvm == 'sp1' }}
173+ env :
174+ SHELL : /bin/bash
175+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
176+ run : |
177+ curl -L https://sp1up.succinct.xyz | bash
178+ ~/.sp1/bin/sp1up --version 5.0.8
179+
180+ - name : Install RISC0
181+ if : ${{ matrix.zkvm == 'risc0' }}
182+ env :
183+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
184+ run : |
185+ curl -L https://risczero.com/install | bash
186+ ~/.risc0/bin/rzup install cargo-risczero 3.0.3
187+ ~/.risc0/bin/rzup install risc0-groth16
188+ ~/.risc0/bin/rzup install rust
189+
190+ - name : Build ethrex elf - ${{ matrix.zkvm }}
191+ run : |
192+ cargo build --release --package guest_program --features ${{ matrix.zkvm }}
193+ mkdir -p ${{ matrix.zkvm }}_verification_keys
194+ if [ "${{ matrix.zkvm }}" = "sp1" ]; then
195+ mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-succinct-zkvm-elf ethrex-riscv32im-${{ matrix.zkvm }}-elf-${{ github.ref_name }}
196+ mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-succinct-zkvm-vk-bn254 ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-${{ matrix.zkvm }}-vk-bn254-${{ github.ref_name }}
197+ mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-succinct-zkvm-vk-u32 ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-${{ matrix.zkvm }}-vk-u32-${{ github.ref_name }}
198+ elif [ "${{ matrix.zkvm }}" = "risc0" ]; then
199+ mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-elf ethrex-riscv32im-${{ matrix.zkvm }}-elf-${{ github.ref_name}}
200+ mv crates/l2/prover/src/guest_program/src/${{ matrix.zkvm }}/out/riscv32im-risc0-vk ${{ matrix.zkvm }}_verification_keys/ethrex-riscv32im-${{ matrix.zkvm }}-vk-${{ github.ref_name}}
201+ fi
202+
203+ - name : Upload ethrex guest elf artifact - ${{ matrix.zkvm }}
204+ uses : actions/upload-artifact@v4
205+ with :
206+ name : ethrex-riscv32im-${{ matrix.zkvm }}-elf-${{ github.ref_name }}
207+ path : ethrex-riscv32im-${{ matrix.zkvm }}-elf-${{ github.ref_name }}
208+
209+ - name : Upload ethrex guest verification keys - ${{ matrix.zkvm }}
210+ uses : actions/upload-artifact@v4
211+ with :
212+ name : ${{ matrix.zkvm }}_verification_keys
213+ path : ${{ matrix.zkvm }}_verification_keys/
214+
215+ # Creates ethrex-guests.tar.gz artifact including both SP1 and
216+ # RISC0 elf and verification keys.
217+ package-ethrex-guest :
218+ needs :
219+ - build-ethrex-guest
220+ runs-on : ubuntu-latest
221+ steps :
222+ - name : Download SP1 elf artifact
223+ uses : actions/download-artifact@v4
224+ with :
225+ name : ethrex-riscv32im-sp1-elf-${{ github.ref_name }}
226+ path : ethrex_guests/sp1/
227+
228+ - name : Download SP1 verification keys artifacts
229+ uses : actions/download-artifact@v4
230+ with :
231+ name : sp1_verification_keys
232+ path : ethrex_guests/sp1/
233+
234+ - name : Download RISC0 elf artifact
235+ uses : actions/download-artifact@v4
236+ with :
237+ name : ethrex-riscv32im-risc0-elf-${{ github.ref_name }}
238+ path : ethrex_guests/risc0/
239+
240+ - name : Download RISC0 verification keys artifacts
241+ uses : actions/download-artifact@v4
242+ with :
243+ name : risc0_verification_keys
244+ path : ethrex_guests/risc0/
245+
246+ - name : Archive ethrex guests
247+ run : |
248+ cd ethrex_guests/
249+ tar -czvf ../ethrex-guests.tar.gz .
250+
251+ - name : Upload ethrex guests artifact
252+ uses : actions/upload-artifact@v4
253+ with :
254+ name : ethrex-guests.tar.gz
255+ path : ethrex-guests.tar.gz
256+
152257 package-contracts :
153258 needs :
154259 - build-ethrex
@@ -221,8 +326,10 @@ jobs:
221326 finalize-release :
222327 needs :
223328 - build-ethrex
329+ - build-ethrex-guest
224330 - build-docker
225331 - package-contracts
332+ - package-ethrex-guest
226333 runs-on : ubuntu-latest
227334 steps :
228335 - name : Checkout Code
@@ -234,7 +341,7 @@ jobs:
234341 uses : actions/download-artifact@v4
235342 with :
236343 path : ./bin
237- pattern : " ethrex*"
344+ pattern : " ethrex*" # This includes the binaries, elf files, ethrex-verification-keys.tar.gz, and ethrex-contracts.tar.gz
238345
239346 - name : Get previous tag
240347 run : |
0 commit comments