Skip to content

Commit bed451c

Browse files
authored
[Fix] Auto release guest program (#159)
* fix broken action * temp trigger for tests * update build-guest scripts and ci * update readme * fix ci * fix ci * fix ci * switch the represent of vk to raw hex * purge dep * update readme * more robust release.sh * restore commitment * resume aggregation src to avoid commit change * apply raw hex encoding to vk * remove the trigger for testing purpose * prune unused base64 convertion * version tag normalize * fix * revert version normalize
1 parent 37a6678 commit bed451c

File tree

19 files changed

+126
-92
lines changed

19 files changed

+126
-92
lines changed

.github/workflows/build-guest-release.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ name: Build ZKVM-Prover Guest
33
on:
44
push:
55
tags:
6-
- **
6+
- 'v0.[0-9]+.[0-9]+'
77

88
jobs:
99
build-guest:
1010
runs-on: ubuntu-latest
1111
env:
1212
SCROLL_ZKVM_VERSION: ${{ github.ref_name }}
13-
DIR_OUTPUT: releases/dev
13+
DIR_OUTPUT: releases
1414
AWS_REGION: us-west-2
1515

1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@v4
1919

20-
- name: Install xxd
21-
run: sudo apt-get update && sudo apt-get install -y vim-common
20+
- name: Install xxd and jq
21+
run: sudo apt-get update && sudo apt-get install -y vim-common jq
2222

2323
- name: Install Rust nightly toolchain
2424
uses: actions-rs/toolchain@v1
@@ -41,9 +41,7 @@ jobs:
4141
run: make build-guest
4242

4343
- name: Prepare release
44-
run: |
45-
# checksum for assets
46-
find $DIR_OUTPUT -type f ! -name sha256sums.txt -exec sha256sum {} \; > $DIR_OUTPUT/sha256sums.txt
44+
run: sh release.sh
4745

4846
- id: install-aws-cli
4947
uses: unfor19/install-aws-cli-action@v1
@@ -61,4 +59,4 @@ jobs:
6159

6260
- name: Upload releases to S3
6361
run: |
64-
aws s3 cp $DIR_OUTPUT s3://circuit-release/scroll-zkvm/${{ github.ref_name }} --recursive
62+
aws s3 cp $DIR_OUTPUT s3://circuit-release/scroll-zkvm --recursive

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ eyre = "0.6"
7777
halo2curves-axiom = { version = "0.5.3" }
7878
itertools = "0.14"
7979
hex-literal = { version = "0.4.1", default-features = false }
80+
hex = "0.4"
8081
metrics = "0.23.0"
8182
metrics-util = "0.17"
8283
metrics-tracing-context = "0.16.0"

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ RUN wget https://github.com/ethereum/solc-bin/raw/refs/heads/gh-pages/linux-amd6
77

88
COPY . .
99

10-
ENTRYPOINT ["/app/build-guest-actions-entrypoint.sh"]

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ $ make test-e2e-bundle
6060

6161
*Note*: Configure `RUST_LOG=debug` for debug logs or `RUST_LOG=none,scroll_zkvm_prover=debug` for logs specifically from the `scroll-zkvm-prover` crate.
6262

63+
## Release of prover circuits
64+
65+
All apps of circuits are uploaded into aws s3 storage, and can be download via following urls:
66+
67+
`<s3 base url>/scroll-zkvm/releases/<fork name>/<chunk|batch|bundle>/<vk>`
68+
69+
+ Current the url for s3 storage is `https://circuit-release.s3.us-west-2.amazonaws.com`
70+
+ The fork name can be read via [release-fork](./release-fork) file
71+
+ The circuit app has to be accessed by specifying its proof type (chunk/batch/bundle) and the vk of the circuit.
72+
6373
## Usage of Prover API
6474

6575
### Dependency

build-guest-actions-entrypoint.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

build-guest.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -ex
33

44
mkdir -p releases
5-
rm -rf releases/dev
5+
rm -rf releases/*
66

77
[ -f "crates/build-guest/.env" ] && . crates/build-guest/.env
88

@@ -14,8 +14,24 @@ fi
1414
# build docker image
1515
docker build --platform linux/amd64 -t build-guest:local .
1616

17+
# cleanup function
18+
cleanup() {
19+
20+
if [ -f ./build-guest.cid ]; then
21+
docker rm -f $(cat ./build-guest.cid) 2>/dev/null || true
22+
fi
23+
rm -f ./build-guest.cid
24+
25+
}
26+
27+
# set trap to cleanup on exit
28+
trap cleanup EXIT
29+
1730
# run docker image
18-
docker run --cidfile ./build-guest.cid --platform linux/amd64 -e FEATURE=${FEATURE} build-guest:local
31+
docker run --cidfile ./build-guest.cid --platform linux/amd64\
32+
-e BUILD_STAGES=${BUILD_STAGES}\
33+
build-guest:local\
34+
cargo run --release -p scroll-zkvm-build-guest
1935
container_id=$(cat ./build-guest.cid)
2036

2137
if [ -n "$(echo ${BUILD_STAGES} | grep stage1)" ]; then
@@ -41,12 +57,5 @@ if [ -n "$(echo ${BUILD_STAGES} | grep stage3)" ]; then
4157
done
4258
fi
4359

44-
4560
# copy release files from container to local
46-
mkdir -p releases
47-
rm -rf releases/dev
4861
docker cp ${container_id}:/app/releases/dev releases/dev
49-
50-
# remove docker container
51-
docker rm ${container_id}
52-
rm ./build-guest.cid

crates/build-guest/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,20 @@ openvm-circuit = { workspace = true }
2121
tracing.workspace = true
2222
tracing-subscriber.workspace = true
2323

24-
base64.workspace = true
2524
bitcode.workspace = true
2625
halo2curves-axiom.workspace = true
2726
eyre.workspace = true
2827
p3-field.workspace = true
2928
serde.workspace = true
3029
hex-literal.workspace = true
30+
hex.workspace = true
3131
serde_json.workspace = true
3232
serde_with.workspace = true
3333
snark-verifier-sdk.workspace = true
3434
toml.workspace = true
3535

3636
cargo_metadata = "0.19.1"
3737
dotenv = "0.15.0"
38-
hex = "0.4.3"
3938

4039
[features]
4140
default = []

crates/build-guest/src/main.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,13 @@ fn run_stage4_dump_vk_json(
291291
if let (Some(exe), Some(leaf)) =
292292
(exe_commitments.get(circuit), leaf_commitments.get(circuit))
293293
{
294-
let app_vk = scroll_zkvm_types::types_agg::ProgramCommitment {
294+
use scroll_zkvm_types::{types_agg::ProgramCommitment, utils::serialize_vk};
295+
let app_vk = serialize_vk::serialize(&ProgramCommitment {
295296
exe: *exe,
296297
vm: *leaf,
297-
}
298-
.serialize();
298+
});
299299

300-
use base64::{Engine, prelude::BASE64_STANDARD};
301-
let app_vk = BASE64_STANDARD.encode(app_vk);
300+
let app_vk = hex::encode(&app_vk);
302301
println!("{circuit}: {app_vk}");
303302
app_vk
304303
} else {

crates/integration/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ openvm-native-transpiler = { workspace = true, default-features = false }
2323
openvm-transpiler = { workspace = true, default-features = false }
2424

2525
alloy-primitives.workspace = true
26-
base64.workspace = true
2726
cargo_metadata.workspace = true
2827
eyre.workspace = true
2928
rayon.workspace = true
3029
serde.workspace = true
3130
vm-zstd = { workspace = true, features = ["zstd"] }
3231

32+
hex.workspace = true
3333
chrono = "0.4"
3434
ff = "0.13"
3535
glob = "0.3"

0 commit comments

Comments
 (0)