Skip to content

refactor(verifier-ray): BuildPcsSystem not to take in a runtime - #3752

Open
Tabaie wants to merge 2 commits into
mainfrom
verifier-ray/fix/runtime-use
Open

refactor(verifier-ray): BuildPcsSystem not to take in a runtime#3752
Tabaie wants to merge 2 commits into
mainfrom
verifier-ray/fix/runtime-use

Conversation

@Tabaie

@Tabaie Tabaie commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Currently, BuildPcsSystem requires a dummy runtime from which to extract column sizes and shift schedules via calling GetLayout on the runtime. This design is conceptually incorrect, as a runtime is by definition a proving/verifying time object. This PR instead extracts that information from wiop.System.

Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
@Tabaie
Tabaie requested review from YaoJGalteland and arijitdutta67 and a lite review from Copilot August 9, 2026 19:02

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.

Pull request overview

This PR refactors verifier-ray PCS codegen so that BuildPcsSystem no longer depends on a proving/verifying-time wiop.Runtime. Instead, compile-time PCS invariants are derived solely from wiop.System, and proof-specific entry_claims are extracted per-proof via a new helper.

Changes:

  • Refactors BuildPcsSystem to be runtime-independent and moves proof-specific claimed evaluations into ExtractPcsOpening.
  • Updates fixture generation to bake one PcsSystem per case while extracting per-proof entry_claims for honest/invalid/alt proofs.
  • Adds utilities/tests around dynamic-module sizing and canonical PCS entry ordering.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
verifier-ray/testdata/generate/pcs_emit.go Emits PCS opening fixtures from explicit entryClaims instead of reading them from PcsSystem.
verifier-ray/testdata/generate/main.go Bakes one compile-time PCS system per case and extracts per-proof openings via ExtractPcsOpening.
verifier-ray/codegen/pcs.go Refactors PCS system extraction to depend only on wiop.System; introduces shift-slot derivation from sys.LagrangeEvals.
verifier-ray/codegen/pcs_zig_test.go Updates tests to reflect the split between system extraction and proof opening extraction.
verifier-ray/codegen/pcs_opening.go New: per-proof extraction of PCS entry_claims in verifier canonical entry order.
verifier-ray/codegen/pcs_opening_test.go New: unit test for canonical PCS entry ordering logic.
verifier-ray/codegen/coin_routing.go Adds DynamicModuleSizes helper shared by codegen and fixture generation.
verifier-ray/codegen/actions.go Updates action mapping documentation to include ExtractPcsOpening.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +149 to 155
func pcsShiftFor(cv *wiop.ColumnView) (isDynamic bool, shift int) {
if cv.Column.Module.IsDynamic() {
return true, cv.ShiftingOffset
}
size := 1 << loc.SizeID
size := cv.Column.Module.Size()
return false, ((cv.ShiftingOffset % size) + size) % size
}
Comment on lines +312 to 319
// Static column: size_log2 is the padded, fixed module size. SetSize
// already rounds it up to a power of two, so log2 is exact.
if !col.Module.IsSized() {
return PcsSystem{}, fmt.Errorf("codegen: BuildPcsSystem: static module %q of committed column %q has no size set",
col.Module.Context.Path(), col.Context.Path())
}
desc.SizeLog2 = bits.Len(uint(col.Module.Size())) - 1
}
Comment on lines +23 to +27
colDeclByID := pcsColumnDeclIndex(sys)
if len(colDeclByID) != len(pcs.Columns) {
return nil, fmt.Errorf("codegen: ExtractPcsOpening: sys has %d committed columns, pcs has %d; built from a different sys?",
len(colDeclByID), len(pcs.Columns))
}
Comment on lines +46 to +50
size := moduleSizes[col.DynamicIndex]
sizeLog2 := bits.Len(uint(size)) - 1
if size <= 0 || 1<<sizeLog2 != size {
return nil, fmt.Errorf("codegen: ExtractPcsOpening: dynamic column %d proved at non-power-of-two size %d", c, size)
}

@YaoJGalteland YaoJGalteland 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.

Thanks for removing the runtime from BuildPcsSystem. I just have a few restructuring suggestions to make the full pipeline a bit clearer.

if len(vanishingSystem.Modules) == 0 {
return nil
}
honestRt := runProver(sys, honest)

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.

A small restructure: build all sys-derived compile-time systems (routing, vanishingSystem, logDeriv, pcs) are built first, then each proof's runProver + ExtractPcsOpening + view-extraction happens as one contiguous block (honest, then invalid) — matching addMultiSize's existing shape.

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.

how about extract the shared runProver → ExtractPcsOpening → extractVanishingProofView block into a new buildProofFixture(sys, pcs, assign, source, name, label) helper (returning a proofFixture{view, entryClaims, openingProof}), and rewrote add and addMultiSize to call it once per proof (honest/invalid/alt) instead of inlining the block three times?

honestProof := extractVanishingProofView(sys, honestRt)

tc := fixtureCase{name: name, honest: honestProof}
pcs, err := codegen.BuildPcsSystem(sys, routing)

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.

I think it would be nice to have a single BuildAllSystems function in verifier-ray/codegen/system.go, that builds all the compile-time systems together (coin routing, vanishing, log-derivative, and PCS).

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.

4 participants