feat(verifier-ray) - implement stub Zig verifier#3115
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
coordinator Changelog Preview (informational)[Unreleased] diff (commits touching
|
linea-besu Changelog Preview (informational)[Unreleased] diff (commits touching
|
postman Changelog Preview (informational)[Unreleased] diff (commits touching
|
tx-exclusion-api Changelog Preview (informational)[Unreleased] diff (commits touching
|
prover Changelog Preview (informational)[Unreleased] diff (commits touching
|
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial verifier-ray/ Zig package intended to verify Ray proofs, including core Koalabear field/extension arithmetic, Poseidon2 + Fiat–Shamir transcript primitives, polynomial evaluation helpers, and a stubbed verifier/codegen pipeline. It also adds prover-ray–backed golden vector generation/consumption and a dedicated GitHub Actions workflow for formatting/building/testing this new package.
Changes:
- Added Zig implementations for Koalabear base/extension fields, Poseidon2 (width-16) compression + Merkle–Damgård hashing, Fiat–Shamir transcript, and polynomial evaluation (canonical + Lagrange).
- Added testdata generation (Go) that imports
prover-rayto emit deterministic Zig golden vectors, plus Zig tests that validate the implementation against those vectors. - Added scaffolding for verifier runtime, generated verifier stub/codegen skeleton, vortex placeholders, and CI/Makefile/build wiring for
verifier-ray.
Reviewed changes
Copilot reviewed 44 out of 50 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| verifier-ray/testdata/vortex/.gitkeep | Keeps testdata/vortex/ tracked for future fixtures. |
| verifier-ray/testdata/transcript/.gitkeep | Keeps testdata/transcript/ tracked for future fixtures. |
| verifier-ray/testdata/README.md | Documents intended fixture layout and refresh/verification make targets. |
| verifier-ray/testdata/generated/vectors.zig | Checked-in prover-ray-derived golden vectors consumed by Zig tests. |
| verifier-ray/testdata/generated/.gitkeep | Ensures generated fixture directory exists in git. |
| verifier-ray/testdata/generate/main.go | Go generator producing Zig golden vectors by calling prover-ray code. |
| verifier-ray/testdata/generate/go.sum | Go module lockfile for testdata generator. |
| verifier-ray/testdata/generate/go.mod | Go module for testdata generator with local replace to prover-ray. |
| verifier-ray/testdata/field/.gitkeep | Keeps testdata/field/ tracked for future fixtures. |
| verifier-ray/test/vortex_test.zig | Validates vortex verifier currently returns Unsupported. |
| verifier-ray/test/transcript_test.zig | Basic determinism test for transcript absorption/challenge derivation. |
| verifier-ray/test/golden_test.zig | Golden tests comparing Zig arithmetic/crypto/poly ops vs generated vectors. |
| verifier-ray/test/generated_stub_test.zig | Ensures generated stub advances runtime and returns Unsupported. |
| verifier-ray/test/field_test.zig | Unit tests for base field ops and extension lifting. |
| verifier-ray/test/all.zig | Aggregates Zig test modules for zig build test. |
| verifier-ray/src/vortex/verifier.zig | Vortex verifier placeholder returning Unsupported. |
| verifier-ray/src/vortex/smt.zig | Sparse Merkle proof structure + placeholder verify. |
| verifier-ray/src/vortex/ringsis.zig | RingSIS hash placeholder. |
| verifier-ray/src/vortex/reed_solomon.zig | Reed–Solomon check placeholder. |
| verifier-ray/src/verifier.zig | Top-level verifier entrypoint that routes to generated stub. |
| verifier-ray/src/runtime.zig | Runtime state (Fiat–Shamir transcript + round counter). |
| verifier-ray/src/proof.zig | Proof container types and Proof.empty(). |
| verifier-ray/src/precompiles/riscv.zig | Selects a precompile backend (currently native). |
| verifier-ray/src/precompiles/native.zig | Native precompile backend wiring (currently Poseidon2 only). |
| verifier-ray/src/precompiles/interface.zig | Defines precompile backend interface types. |
| verifier-ray/src/pcs/polynomial.zig | Canonical Horner evaluation + batch evaluation helpers. |
| verifier-ray/src/pcs/lagrange.zig | Lagrange evaluation routines + batch variants. |
| verifier-ray/src/main.zig | Minimal executable entrypoint (currently a no-op verify call). |
| verifier-ray/src/lib.zig | Public library surface/module exports for verifier-ray. |
| verifier-ray/src/generated/stub.zig | Generated verifier stub placeholder advancing the runtime. |
| verifier-ray/src/field/vec.zig | Slice aliases and batch invert helpers. |
| verifier-ray/src/field/koalabear.zig | Koalabear base field implementation + serialization/utilities. |
| verifier-ray/src/field/koalabear_ext.zig | Degree-4 extension field implementation + serialization. |
| verifier-ray/src/crypto/poseidon2.zig | Poseidon2 permutation/compress + MD hasher implementation. |
| verifier-ray/src/crypto/poseidon2_constants.zig | Poseidon2 round keys/constants for width-16 Koalabear parameters. |
| verifier-ray/src/crypto/fiat_shamir.zig | Transcript built on Poseidon2 MD hashing. |
| verifier-ray/README.md | Package overview, layout, and local check commands. |
| verifier-ray/Makefile | Local developer targets for fmt/build/test/testdata verification. |
| verifier-ray/codegen/internal/generator/writer.go | Helper for emitting indented Zig source. |
| verifier-ray/codegen/internal/generator/options.go | Codegen option defaults placeholder. |
| verifier-ray/codegen/internal/generator/generator.go | Minimal Zig verifier stub generator. |
| verifier-ray/codegen/internal/generator/generator_test.go | Unit tests for codegen output structure/entrypoint naming. |
| verifier-ray/codegen/internal/generator/emitters.go | Reserved placeholder for future action emitters. |
| verifier-ray/codegen/go.mod | Go module for the codegen tool. |
| verifier-ray/codegen/cmd/ray-zig-codegen/main.go | CLI wrapper for stub code generation. |
| verifier-ray/build.zig.zon | Zig package manifest for verifier-ray. |
| verifier-ray/build.zig | Zig build script wiring library, exe, and unit tests. |
| verifier-ray/.gitignore | Ignores Zig build outputs for verifier-ray. |
| .gitignore | Un-ignores verifier-ray generated directories under a global generated/ ignore. |
| .github/workflows/verifier-ray.yml | CI workflow for formatting, regenerating vectors, building, and testing verifier-ray. |
Files not reviewed (1)
- verifier-ray/codegen/internal/generator/generator.go: Language not supported
Comments suppressed due to low confidence (3)
verifier-ray/src/pcs/lagrange.zig:41
- Same domain-point edge case as
evaluateBaseAtBase: invertingpoint - omega_iwill crash whenpointequalsomega_i(now in extension form). Add a check fordenom.isZero()/ equality with the liftedomega_iand return the matchingvalues[i]lifted intoExtinstead of inverting.
var omega_i = field.Element.one();
var sum = ext.Ext.zero();
for (values) |value| {
const weighted = omega_i.mul(inv_n).mul(value);
const denom = point.sub(ext.Ext.lift(omega_i));
sum = sum.add(denom.inverse().mulByBase(weighted));
omega_i = omega_i.mul(omega);
}
verifier-ray/src/pcs/lagrange.zig:61
- Same domain-point edge case as
evaluateBaseAtBase: ifpoint == omega_i,inv_denombecomes an inverse of zero andinverse()will hitunreachable. Add a fast path to return the correspondingvalues[i](asext.Ext) whenpoint.eql(omega_i)before performing any inversions.
var omega_i = field.Element.one();
var sum = ext.Ext.zero();
for (values) |value| {
const weighted = value.mulByBase(omega_i.mul(inv_n));
const inv_denom = point.sub(omega_i).inverse();
sum = sum.add(weighted.mulByBase(inv_denom));
omega_i = omega_i.mul(omega);
}
verifier-ray/src/pcs/lagrange.zig:81
- Same domain-point edge case as the other Lagrange evaluators:
denom.inverse()will crash whenpointequals a domain point (lift(omega_i)). Add an equality/zero-denominator check and return the matchingvalues[i]directly in that case.
var omega_i = field.Element.one();
var sum = ext.Ext.zero();
for (values) |value| {
const weighted = value.mulByBase(omega_i.mul(inv_n));
const denom = point.sub(ext.Ext.lift(omega_i));
sum = sum.add(weighted.mul(denom.inverse()));
omega_i = omega_i.mul(omega);
}
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a1879f4. Configure here.

This PR adds an initial Ray verifier for verifying the proofs produced by Ray prover.
It already has Koalabear/extension support and arithmetic implemented. It currently performs computations natively in Zig instead of offloading to zkVM precompiles. Also adds testing between the Ray prover by generating test vectors and then verifying the computation results in Zig.
Also include some github actions for verifying that the sources compile and lint. I added two build targets -- debug version with all debug symbols etc. but also a release version with everything stripped, this leads to a quite small binary (4KB for now).
Resolves #3106 and #3107
@claude-review
Checklist
PR.
Note
Medium Risk
Introduces new cryptographic and field arithmetic code plus proof-verification scaffolding; subtle math/serialization mismatches could cause false accepts/rejects despite golden tests. Also adds a new CI workflow and generated testdata that may impact build reliability if toolchain versions drift.
Overview
Adds a new
verifier-rayZig package with a minimalverifyentrypoint that delegates to a generated stub (VerifyError.Unsupportedfor now) plus runtime/transcript scaffolding.Implements core Koalabear primitives in Zig (base/extension field ops, polynomial & Lagrange evaluation, Poseidon2 compression + Merkle–Damgård hasher, Fiat–Shamir transcript) and wires a simple precompile backend interface.
Adds Go-based tooling to generate prover-aligned golden vectors (
testdata/generate), checks them in undertestdata/generated, and adds Zig/Go unit tests to validate against those vectors. Introduces a dedicated GitHub Actions workflow (verifier-ray.yml) and updates.gitignoreto allow committing generated verifier/testdata outputs.Reviewed by Cursor Bugbot for commit 1f7c173. Bugbot is set up for automated code reviews on this repo. Configure here.