Skip to content

feat(verifier-ray): complete verifier - #3683

Draft
YaoJGalteland wants to merge 8 commits into
mainfrom
verifier-ray/fri-pcs
Draft

feat(verifier-ray): complete verifier#3683
YaoJGalteland wants to merge 8 commits into
mainfrom
verifier-ray/fri-pcs

Conversation

@YaoJGalteland

Copy link
Copy Markdown
Contributor

Ports the FRI-based polynomial commitment scheme (PCS) verifier from prover-ray into the Zig verifier-ray, and wires it into the top-level verifier.verify as a mandatory, transcript-bound opening layer. The verifier now authenticates committed claims via a real FRI opening instead of trusting proof-supplied values, and the PCS-authenticated entry_claims are the single source the vanishing sub-verifier re-slices — closing the gap where a prover could feed PCS and vanishing different values for the same column.

Key changes

  • New PCS verifier (src/pcs/, 8 files): verify, layout, paired_leaf, reconstruct, fold, tree, params, root — DEEP-quotient reconstruction, Merkle input-tree authentication, and FRI fold/query checks, byte-faithful to prover-ray.
  • Fiat-Shamir coin binding (src/verifier.zig, src/protocol/root.zig): a single shared eval coin (zeta) is derived from the transcript at zeta_coin_index and used for all openings; Merkle roots are rebound to the round oracle commitments (not read from the proof). Verified end-to-end: prover-committed zeta matches the verifier's transcript-derived zeta byte-for-byte.
  • Codegen (codegen/, +1,134 lines): new pcs.go / pcs_zig.go / actions.go compile a protocol's batch shapes, shift schedules, claim maps, and coin routing into the comptime System the Zig verifier consumes.
  • Robustness fixes: DoS guard on round-root counts, dynamic per-module size absorption, OOB guards.

Testing

  • End-to-end: pcs_realpcs_test.zig runs a genuine prover-ray protocol (arithmetization + pcs.Compile) through the full verifier.verify; plus coexist (vanishing+PCS link), frip (real FRI opening), and endpoint_binding integration tests, each with tamper-rejection cases.
  • Test suite leaned to the e2e path: removed granular internal-helper unit tests and cases already subsumed by golden-vector conformance + e2e coverage (82 → 36 tests). Retained prover-ray conformance vectors and the profiling build canary.

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>
…itment

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>
Copilot AI review requested due to automatic review settings July 31, 2026 13:05
@YaoJGalteland
YaoJGalteland marked this pull request as draft July 31, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Human review recommended

It introduces a large, security-critical cryptographic verification stack (FRI/PCS) and rewires verifier trust/binding semantics, which warrants careful human review even with strong new fixtures/tests.

Pull request overview

Ports and integrates a FRI-based PCS verifier into verifier-ray, making PCS openings transcript-bound and making PCS-authenticated entry_claims the single source of truth for downstream query sub-verifiers (notably vanishing), with new codegen + fixtures to validate end-to-end parity against prover-ray.

Changes:

  • Adds a full allocation-free FRI/PCS verifier under verifier-ray/src/pcs/ and wires it into verifier-ray/src/verifier.zig so PCS runs first and routes authenticated claims into vanishing.
  • Refactors protocol replay to be transcript-continuing (replayWithTranscript) and binds dynamic module sizes into Fiat–Shamir via a codegen-emitted absorb schedule.
  • Introduces Go-based fixture generators + new Zig integration tests (FRI opening cross-check, coexistence, real-protocol PCS, endpoint-cell binding), plus supporting codegen enhancements.
File summaries
File Description
verifier-ray/testdata/generated/realpcs.zig New generated “real protocol” PCS+vanishing fixture used for end-to-end verifier tests.
verifier-ray/testdata/generated/frip.zig New generated FRI/PCS opening-proof fixture emitted from prover-ray for byte-level cross-checking.
verifier-ray/testdata/generated/coexist.zig New generated coexistence fixture proving PCS-authenticated claims feed vanishing.
verifier-ray/testdata/generate/realpcs.go Generator for the “real protocol” PCS fixture (runs full arithmetization + pcs.Compile).
verifier-ray/testdata/generate/go.sum Updates generator module sums after generator dependency changes.
verifier-ray/testdata/generate/go.mod Adds deps/replace directives so generators build against local prover-ray APIs.
verifier-ray/testdata/generate/frip.go Generator producing a real multi-round FRI/PCS opening proof via prover-ray/fri.
verifier-ray/testdata/generate/frip_emit.go Serialization logic to emit frip.zig in the shapes verifier-ray consumes.
verifier-ray/test/verifier_test.zig Removes minimal verifier smoke tests superseded by PCS-backed end-to-end tests.
verifier-ray/test/vanishing_test.zig Updates replay API usage and adds OOB safety test for cell_value refs.
verifier-ray/test/transcript_test.zig Removes transcript unit tests (coverage now comes via golden + PCS tests).
verifier-ray/test/pcs_realpcs_test.zig New end-to-end test: PCS deployed on a real protocol fixture.
verifier-ray/test/pcs_frip_test.zig New cross-check: verifier-ray PCS verifier accepts/rejects a real prover-ray opening proof.
verifier-ray/test/pcs_endpoint_binding_test.zig New integration test proving endpoint-cell soundness via transcript + vanishing binding.
verifier-ray/test/pcs_coexist_test.zig New end-to-end coexistence test proving PCS↔vanishing claim linkage.
verifier-ray/test/logderivativesum_test.zig Adds OOB safety tests for cell refs via bounds-checked access.
verifier-ray/test/golden_test.zig Comment update reflecting replay API naming.
verifier-ray/test/field_test.zig Removes basic field unit tests (coverage now via PCS/FRI arithmetic + higher-level tests).
verifier-ray/test/all.zig Updates the test suite entrypoint to include new PCS tests.
verifier-ray/src/verifier.zig Wires PCS as mandatory, transcript-continuing phase; routes PCS-authenticated claims into vanishing.
verifier-ray/src/query/vanishing.zig Uses bounds-checked ctx.cell(...) for cell_value and surfaces OOB as a clean error.
verifier-ray/src/query/logderivativesum.zig Uses bounds-checked ctx.cell(...) and extends error set accordingly.
verifier-ray/src/protocol/root.zig Adds transcript-continuing replay, dynamic-size absorption schedule, and bounds-checked cell accessor.
verifier-ray/src/pcs/tree.zig New Merkle branch verification for running-layer trees.
verifier-ray/src/pcs/root.zig New PCS barrel re-export module for public API convenience.
verifier-ray/src/pcs/reconstruct.zig New DEEP-quotient reconstruction logic at query points.
verifier-ray/src/pcs/params.zig New FRI parameter validation + domain-point arithmetic (bit-reversed addressing).
verifier-ray/src/pcs/paired_leaf.zig New multi-size paired-leaf Merkle opening verification and hashing contract.
verifier-ray/src/pcs/layout.zig New canonical layout builder from shapes/shifts, including shift validation rules.
verifier-ray/src/pcs/fold.zig New fold-recurrence checker and octuplet decoding for FRI verification.
verifier-ray/src/pcs/verify.zig New top-level PCS verification orchestration + transcript-derived challenges.
verifier-ray/src/lib.zig Exposes PCS modules through the library’s public API surface.
verifier-ray/src/field/koalabear_ext.zig Adds Ext.halve() support required by the FRI fold recurrence.
verifier-ray/src/crypto/fiat_shamir.zig Adds transcript snapshot/restore + integer sampling used by PCS challenge derivation.
verifier-ray/docs/fri-pcs-plan.md New design/implementation plan documenting constraints and module map.
verifier-ray/docs/fri-pcs-link-pr-split.md New PR-splitting plan documenting how to slice the change safely.
verifier-ray/docs/binding-analysis.md New binding/soundness analysis documenting trust anchors and enforced bindings.
verifier-ray/codegen/vanishing.go Aligns dynamic-module indexing with FS absorb schedule; adds generation-time guardrails.
verifier-ray/codegen/system.go Adds PCS system emission and combined verifier.Systems literal generation.
verifier-ray/codegen/spec_zig.go Emits dynamic size absorb schedule into protocol.Spec.
verifier-ray/codegen/spec_zig_test.go Tests for dynamic-size schedule emission in generated Spec.
verifier-ray/codegen/pcs.go New PCS system extraction from compiled+proven prover-ray protocols (shapes/shifts/maps/roots).
verifier-ray/codegen/pcs_zig.go New Zig emitter for pcs.verify.System literals (params/shapes/shifts/maps/root provenance).
verifier-ray/codegen/pcs_test.go New tests validating PCS extraction and Zig emission invariants.
verifier-ray/codegen/go.mod Builds codegen against local prover-ray APIs via replace directive.
verifier-ray/codegen/coin_routing.go Emits FS dynamic-size absorb schedule and shared dynamic-module rank mapping.
verifier-ray/codegen/actions.go New fail-closed guard ensuring all verifier actions are handled/emitted.
verifier-ray/codegen/actions_test.go Tests that unhandled verifier actions (e.g., grandproduct) are rejected at codegen time.
verifier-ray/build.zig Adds Zig build modules for new generated fixtures used by the new tests.
prover-ray/wiop/compilers/pcs/pcs.go Exposes PCS compiler internals needed by verifier-ray codegen/fixtures (CommittedBatches, GetLayout, etc.).
.gitignore Ignores generator build artifact under verifier-ray/testdata/generate/.
Review details
  • Files reviewed: 48/55 changed files
  • Comments generated: 1
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +397 to +400
const round = system.params.log_plaintext_size - bundle.size_log2;
const card = @as(u64, 1) << @intCast(system.params.log_codeword_size - round);
if (pointInDomain(zeta, card)) return Error.ClaimPointInDomain;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants