Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ Dockerfile.backup

docs

releases
#releases

*.yml

*.sh
!build-guest-actions-entrypoint.sh

*.log
*.md
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions Cargo.toml.gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[patch."https://github.com/openvm-org/openvm.git"]
openvm-build = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-circuit = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-continuations = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-instructions ={ git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-native-circuit = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-native-compiler = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-native-recursion = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-native-transpiler = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-rv32im-transpiler = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }
openvm-sdk = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false, features = ["parallel", "bench-metrics", "evm-prove"] }
openvm-transpiler = { git = "ssh://git@github.com/scroll-tech/openvm-gpu.git", branch = "patch-v1.4.0-c033e18-pipe", default-features = false }

[patch."https://github.com/openvm-org/stark-backend.git"]
openvm-stark-backend = { git = "ssh://git@github.com/scroll-tech/openvm-stark-gpu.git", branch = "update-p3-gpu-v0.2.2", features = ["gpu"] }
openvm-stark-sdk = { git = "ssh://git@github.com/scroll-tech/openvm-stark-gpu.git", branch = "update-p3-gpu-v0.2.2", features = ["gpu"] }

[patch."https://github.com/Plonky3/Plonky3.git"]
p3-air = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-field = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-commit = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-matrix = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-baby-bear = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", features = [
"nightly-features",
], tag = "v0.2.2" }
p3-koala-bear = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-util = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-challenger = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-dft = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-fri = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-goldilocks = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-keccak = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-keccak-air = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-blake3 = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-mds = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-merkle-tree = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-monty-31 = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-poseidon = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-poseidon2 = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-poseidon2-air = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-symmetric = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-uni-stark = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
p3-maybe-rayon = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" } # the "parallel" feature is NOT on by default to allow single-threaded benchmarking
p3-bn254-fr = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", tag = "v0.2.2" }
53 changes: 24 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export RUST_LOG
OPENVM_RUST_TOOLCHAIN ?= nightly-2025-08-18
export OPENVM_RUST_TOOLCHAIN

TESTDATA_PATH := crates/integration/testdata/phase2
CHUNK_PROOF := 1-4

$(info TESTDATA_PATH set to: $(TESTDATA_PATH))
# Set GPU config if GPU=1 is set
ifeq ($(GPU),1)
CARGO_CONFIG_FLAG = --config Cargo.toml.gpu
else
CARGO_CONFIG_FLAG =
endif

download-release:
sh download-release.sh
Expand All @@ -40,54 +42,47 @@ build-guest-local:

clean-build-guest: clean-guest build-guest

clean-test-cache:
@rm -f $(TESTDATA_PATH)/proofs/*.json

$(TESTDATA_PATH)/proofs/chunk-%.json:
@OUTPUT_DIR=$(realpath $(TESTDATA_PATH)/proofs) $(MAKE) test-single-chunk
cp -f $(TESTDATA_PATH)/proofs/chunk/proofs/*.json $(TESTDATA_PATH)/proofs

profile-chunk:
@GUEST_PROFILING=true cargo test --release -p scroll-zkvm-integration --test chunk_circuit guest_profiling -- --exact --nocapture
@GUEST_PROFILING=true cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test chunk_circuit guest_profiling -- --exact --nocapture

export-onchain-verifier:
@cargo test --release -p scroll-zkvm-integration --test onchain_verifier export_onchain_verifier -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test onchain_verifier export_onchain_verifier -- --exact --nocapture

test-execute-chunk:
@cargo test --release -p scroll-zkvm-integration --test chunk_circuit test_execute -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test chunk_circuit test_execute -- --exact --nocapture

test-execute-chunk-multi:
@cargo test --release -p scroll-zkvm-integration --test chunk_circuit test_execute_multi -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test chunk_circuit test_execute_multi -- --exact --nocapture

test-cycle:
@cargo test --release -p scroll-zkvm-integration --test chunk_circuit test_cycle -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test chunk_circuit test_cycle -- --exact --nocapture

test-execute-batch: $(TESTDATA_PATH)/proofs/chunk-$(CHUNK_PROOF).json
@cargo test --release -p scroll-zkvm-integration --test batch_circuit test_e2e_execute -- --exact --nocapture
test-execute-batch:
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test batch_circuit test_e2e_execute -- --exact --nocapture

test-execute-batch-fast: $(TESTDATA_PATH)/tasks/batch-task.json
@cargo test --release -p scroll-zkvm-integration --test batch_circuit test_execute -- --exact --nocapture
test-execute-batch-fast:
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test batch_circuit test_execute -- --exact --nocapture

test-execute-bundle:
@cargo test --release -p scroll-zkvm-integration --test bundle_circuit test_execute -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test bundle_circuit test_execute -- --exact --nocapture

test-single-chunk:
@cargo test --release -p scroll-zkvm-integration --test chunk_circuit setup_prove_verify_single -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test chunk_circuit setup_prove_verify_single -- --exact --nocapture

test-multi-chunk:
@cargo test --release -p scroll-zkvm-integration --test chunk_circuit setup_prove_verify_multi -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test chunk_circuit setup_prove_verify_multi -- --exact --nocapture

test-single-batch: $(TESTDATA_PATH)/tasks/batch-task.json
@cargo test --release -p scroll-zkvm-integration --test batch_circuit setup_prove_verify_single -- --exact --nocapture
test-single-batch:
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test batch_circuit setup_prove_verify_single -- --exact --nocapture

test-e2e-batch:
@cargo test --release -p scroll-zkvm-integration --test batch_circuit e2e -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test batch_circuit e2e -- --exact --nocapture

test-bundle:
@cargo test --release -p scroll-zkvm-integration --test bundle_circuit setup_prove_verify -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test bundle_circuit setup_prove_verify -- --exact --nocapture

test-bundle-local:
@cargo test --release -p scroll-zkvm-integration --test bundle_circuit setup_prove_verify_local_task -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test bundle_circuit setup_prove_verify_local_task -- --exact --nocapture

test-e2e-bundle:
@cargo test --release -p scroll-zkvm-integration --test bundle_circuit e2e -- --exact --nocapture
@cargo test $(CARGO_CONFIG_FLAG) --release -p scroll-zkvm-integration --test bundle_circuit e2e -- --exact --nocapture
54 changes: 19 additions & 35 deletions build-guest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
set -ex

mkdir -p releases
rm -rf releases/*

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

# if BUILD_STAGES if empty, set it to stage1,stage2,stage3
if [ -z "${BUILD_STAGES}" ]; then
BUILD_STAGES="stage1,stage2,stage3"
fi
#rm -rf releases/*

# build docker image
docker build --platform linux/amd64 -t build-guest:local .
Expand All @@ -21,41 +14,32 @@ cleanup() {
docker rm -f $(cat ./build-guest.cid) 2>/dev/null || true
fi
rm -f ./build-guest.cid

}

# set trap to cleanup on exit
trap cleanup EXIT

# run docker image
docker run --cidfile ./build-guest.cid --platform linux/amd64\
-e BUILD_STAGES=${BUILD_STAGES}\
build-guest:local\
make build-guest-local
docker run --cidfile ./build-guest.cid --platform linux/amd64 build-guest:local make build-guest-local
container_id=$(cat ./build-guest.cid)

if [ -n "$(echo ${BUILD_STAGES} | grep stage1)" ]; then
# copy leaf commitments from container to local
for f in chunk-circuit/chunk_leaf_commit.rs \
batch-circuit/batch_leaf_commit.rs \
bundle-circuit/bundle_leaf_commit.rs; do
docker cp ${container_id}:/app/crates/circuits/${f} crates/circuits/${f}
done
fi

if [ -n "$(echo ${BUILD_STAGES} | grep stage2)" ]; then
# copy root verifier
docker cp ${container_id}:/app/crates/build-guest/root_verifier.asm crates/build-guest/root_verifier.asm
fi

if [ -n "$(echo ${BUILD_STAGES} | grep stage3)" ]; then
# copy exe commitments from container to local
for f in chunk-circuit/chunk_exe_commit.rs \
batch-circuit/batch_exe_commit.rs \
bundle-circuit/bundle_exe_commit.rs; do
docker cp ${container_id}:/app/crates/circuits/${f} crates/circuits/${f}
done
fi
# copy vm commitments from container to local
for f in chunk-circuit/chunk_vm_commit.rs \
batch-circuit/batch_vm_commit.rs \
bundle-circuit/bundle_vm_commit.rs; do
docker cp ${container_id}:/app/crates/circuits/${f} crates/circuits/${f}
done

# copy root verifier
docker cp ${container_id}:/app/crates/build-guest/root_verifier.asm crates/build-guest/root_verifier.asm

# copy exe commitments from container to local
for f in chunk-circuit/chunk_exe_commit.rs \
batch-circuit/batch_exe_commit.rs \
bundle-circuit/bundle_exe_commit.rs; do
docker cp ${container_id}:/app/crates/circuits/${f} crates/circuits/${f}
done

# copy release files from container to local
docker cp ${container_id}:/app/releases/dev releases/dev
2 changes: 1 addition & 1 deletion crates/build-guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ openvm-build = { workspace = true, default-features = false }
openvm-circuit = { workspace = true }

eyre.workspace = true
serde.workspace = true
hex.workspace = true
serde_json.workspace = true
snark-verifier-sdk.workspace = true
toml.workspace = true

cargo_metadata = "0.19.1"
dotenv = "0.15.0"
clap = { version = "4.0", features = ["derive"] }

[features]
default = []
Loading