Skip to content

refactor(zkvm): canonicalize PI transcript/opening flow via instance_value + PublicValues#1277

Merged
hero78119 merged 12 commits into
masterfrom
feat/pi_observe
Apr 1, 2026
Merged

refactor(zkvm): canonicalize PI transcript/opening flow via instance_value + PublicValues#1277
hero78119 merged 12 commits into
masterfrom
feat/pi_observe

Conversation

@hero78119

@hero78119 hero78119 commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

This PR refactors how public inputs (PI) are represented and consumed across zkVM proving/verification so that PI handling is circuit-driven and consistent end-to-end.
Related to #1263.

Design rationale

Previously, PI transcript absorption and some verifier checks depended on broader/raw PI containers, which made ordering and indexing assumptions harder to audit and keep consistent across:

  • prover
  • rust verifier
  • recursion verifier.

This PR moves PI consumption to a canonical, circuit-defined path:

  • instance_values defines which scalar PI values a circuit observes (and in what order).
  • instance_openings defines which PI MLE columns are opened.
  • PI openings are derived from PublicValues MLEs, rather than ad-hoc/raw vectors.

This reduces ambiguity in PI ordering/indexing and aligns transcript-visible PI handling with circuit semantics.

pi update

Previous pi_update mechanism will trigger verifier failed if a identical public value used > 1 chip because they will be in different opening point, thus evaluation value will be different. This PR fixed the issue, and refactor public value check back to verify_chip_phase

soundness fix

This PR also fixed a soundness issue by removing wit_in_evals and fixed_in_evals from the proof payload. Instead of trusting prover-supplied values for these evaluations, the verifier now deterministically derives them from the sumcheck evaluations during verification. This prevents a malicious prover from introducing mismatches between claimed eval vectors and the actual sumcheck-consistent values.

Follow up

#1280

Replace raw public-input transcript absorption with circuit-driven instance_value indexing in prover, native verifier, and recursion verifier.

Also add instance_value tracking in ConstraintSystem::query_instance and fix mutability/borrow fallout in public-value query helpers and RAM table address setup.
@hero78119 hero78119 changed the title refactor: use instance_value-indexed PI evals in zkvm transcripts refactor(zkvm): canonicalize PI transcript/opening flow via instance_value + PublicValues Mar 26, 2026
This PR migrates public input/output handling from raw public-io memory
openings to a digest-based path and unifies PI plumbing across
prover/verifier/recursion.

## Design rationales
- Avoids carrying vector-style public-io MLE openings through
proving/verifying paths.
- Reduces PI plumbing complexity and duplicated logic between native
verifier and recursion verifier.
- Makes public output commitment explicit and uniform via digest
commitments.


## Changes Highlights
- Commit public IO as a Keccak-256 digest (8 x u32 words) instead of
opening raw public-io MLE columns.
- Add runtime commit APIs in `ceno_rt`:
  - `commit(data: &[u8])`
  - `commit_digest([u32; 8])`
  - `CommitCtx` for incremental accumulation + finalize.
- Add `PUB_IO_COMMIT` syscall support end-to-end:
- emulator syscall implementation in
`ceno_emul/src/syscalls/pubio_commit.rs`
- zkVM ecall instruction in
`ceno_zkvm/src/instructions/riscv/ecall/pubio_commit.rs`
  - RV32IM wiring and dispatch updates.
- Introduce digest limb layout/query path:
  - `PUBIO_DIGEST_IDX`, `PUBIO_DIGEST_U16_LIMBS`
  - `query_public_io_digest()` and `PubioCommitLayout`.
- Simplify PI representation:
  - `ProofInput.pi` replaces `pub_io_evals`/public-input MLE plumbing
- remove `pi_in_evals`, `instance_openings`, `raw_pi_num_variables`, and
related split/eval paths.
- Update recursion verifier/binding to consume scalar PI directly and
keep transcript order aligned with native verifier.
- Remove legacy public-io memory region usage from platform/linker init
flow (no preloaded pubio segment).

@kunxian-xia kunxian-xia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@kunxian-xia kunxian-xia added this pull request to the merge queue Mar 31, 2026
@hero78119 hero78119 removed this pull request from the merge queue due to a manual request Mar 31, 2026
@hero78119

Copy link
Copy Markdown
Collaborator Author

@hero78119 hero78119 added this pull request to the merge queue Apr 1, 2026
Merged via the queue into master with commit e33cca0 Apr 1, 2026
5 checks passed
@hero78119 hero78119 deleted the feat/pi_observe branch April 1, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants