feat(verifier-ray): verify R5 Ray proof in verifier-Ray (RISC-V) - #3832
Open
YaoJGalteland wants to merge 11 commits into
Open
feat(verifier-ray): verify R5 Ray proof in verifier-Ray (RISC-V)#3832YaoJGalteland wants to merge 11 commits into
YaoJGalteland wants to merge 11 commits into
Conversation
YaoJGalteland
changed the base branch from
feat/prover-ray-proof-serde
to
fixup/bug-in-proofserialization-roundcount
August 24, 2026 09:03
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
YaoJGalteland
force-pushed
the
verifier-ray/riscv-toy-round-trip
branch
from
August 24, 2026 09:29
b579005 to
77f4a19
Compare
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
Signed-off-by: Yao Galteland <yaoj.galteland@gmail.com>
…-extension + custom-precompile instruction surface Signed-off-by: Yao Galteland <yaoj.galteland@gmail.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.
Wires verifier-ray up to verify a real, honest RISC-V proof end-to-end: compiling the actual
arithmetization/src/main/riscv/main.zkcentrypoint into awiop.System, proving a minimal real guest ELF that exits successfully, and verifying that proof through the Zig verifier instead of relying only on synthetic scenario fixtures.verifier-ray/codegen/riscv_bootstrap.go(new): compilesmain.zkc, runs the full compiler pipeline (nonnative → rangecheck → lookuptologderivsum → messagebus → grandproduct → logderivativesum → localvanishing → global → pcs), and exposesBuildHonestRiscvArtifacts()— the compiledcodegen.CompiledSystemplus the projectedVerifyInputfor one honest proof.verifier-ray/codegen/generate-riscv-system(new): drives the above and emitstestdata/generated/riscv_system.zigandtestdata/proof_image.bin, which are consumed bymain.zig,proof_image_test.zig, andriscv_system_test.zig.prover-ray/internal/minimal-elf/prover-ray/backend/zkc-r5: addsExitZeroGuestELF, a minimal valid RISC-V ELF that halts through the guest exit syscall and serves as the honest witness.verifier-ray/src/main.zig: native and R5-zkVM entry points now load and verify this real proof image — via mmap on native and linked memory on R5 — instead of only embedded synthetic fixtures.verifier-ray/test/proof_image_test.zig: replaces the old hand-built-fixture byte-reading test with a real end-to-endverifier.verify()call against the honest proof.verifier-ray/test/riscv_system_test.zig(new): smoke-tests that the generated system type-checks asverifier.Systems.Architecture: how main.zkc and the guest ELF become a verified proof
main.zkccompiles once into a generic RISC-V interpreter circuit (every instruction's AIR logic — ADD, SUB, branches, memory, ...); it never encodes any specific program. The guest ELF supplies the specific program as public input (raw instruction/data bytes), and only running the interpreter against those bytes produces the witness (the actual execution trace) that gets proven.So the verifier needs exactly two things, from two independent supply chains that only meet at verify-time:
verifier.Systems— "What is the protocol?" Compiled once frommain.zkc; identical for every RISC-V guest ELF ever run through it.verifier.VerifyInput— "What proof/instance should I verify?" Specific to one guest ELF's honest execution (here,ExitZeroGuestELF).Bugs found and fixed along the way
Running a real full-scale proof through the Zig verifier surfaced several latent correctness issues that the smaller synthetic fixtures did not expose. Two of them (the Montgomery field-encoding bug and a related proof-serialization round-count bug) were split out and landed separately in #3829; the remaining issue is fixed here:
PCS aliasing-shift false rejection (
verifier-ray/src/query/pcs.zig)reconstruct()rejected honest dynamic-module sizes when two raw shifts aliased to the same domain point, while prover-ray’sRecoverBatchClaimslegitimately deduplicates them. Fixed by applying matching deduplication inreconstructQueryValueAt.Comptime monomorphization blowup in vanishing evaluation (
verifier-ray/src/query/vanishing.zig)evalExpr/evalOptook the expression-tree index as acomptimeparameter, causing Zig to generate a distinct function for every node. Real arithmetization modules contain thousands of nodes, which led to runtime stack overflow.expr_indexandopare now ordinary runtime parameters, whilemodule/static_nremain comptime, keeping recursion bounded by the actual shallow expression-tree depth.Also closed a smaller transcript gap:
protocol/root.zig::replayWithTranscriptdid not replayRound.PreSamplingHooks, including the shared-randomnessγoverride used by sharded protocols. It now mirrors prover-ray’sRuntime.AdvanceRound. This is inert for the current single-shard proof but required for future sharded proofs.Testing
zig build test: 77/77 passingzig build test -Dverifier-profiling=true: 77/77 passinggo test ./...green in:prover-ray/wiop/proofserializationprover-ray/zkcdriververifier-ray/codegen