build: gate Rust verifier build behind -Dverify (default off)#84
Merged
Conversation
Add `-Dverify=<bool>` build option (default false). When disabled,
`zig build` and `zig build test` skip the cargo compile of
jolt-verifier entirely, and `src/commands/verify.zig` compiles to a
stub that prints a helpful message and exits with `VerifierNotEnabled`.
The `extern fn jolt_verify` declaration lives inside a comptime-`if`
struct so it literally doesn't exist when the flag is off — no link
dependency on libjolt_verifier.a, no requirement to have cargo or the
Rust toolchain installed for the common case.
Most CI jobs (Zig Tests, CLI Smoke, Release Build, …) build and test
without ever touching cargo. Only the prove+verify jobs need to opt in
via `zig build -Dverify=true`.
Verified locally:
- default: 539/539 tests pass, no cargo run, binary 9.8 MB
- -Dverify=true: 539/539 tests pass + verify command works
end-to-end against a real proof, binary 39 MB
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the Rust
jolt-verifierstaticlib build opt-in via a new-Dverifybuild flag (defaultfalse). Most CI jobs and localzig build/zig build testruns no longer pay the ~2 minute cargo compile cost they don't need.How it works
zig build -Dverify=true(defaultfalse)linkJoltVerifieris never called.src/commands/verify.zigselects a stub impl via comptime-if, so theextern fn jolt_verifydeclaration literally does not exist — zero link dependency onlibjolt_verifier.a, no requirement to have cargo or the Rust toolchain installed for the common case.zolt verifyworks end-to-end).Verified locally
-Dverify=truezig buildzig build testzolt)zolt verifyCI follow-up
To realize the speedup, the
Prove + Verify (Linux/macOS)jobs need-Dverify=trueadded to theirzig buildinvocation. Every other CI job works as-is and will skip the cargo compile automatically. Happy to do this in a follow-up PR — wanted to keep this one focused on the build mechanism.Test plan
zig build(no flag) — succeeds, no cargozig build test(no flag) — 539/539 pass./zolt verify ...(no flag) — prints stub message, exits 1zig build -Dverify=true— cargo runs, link succeedszig build test -Dverify=true— 539/539 pass./zolt verify ...(with flag) — VERIFIED in ~90 ms against a real proof