Skip to content

feat: add Jolt witness crate#1604

Merged
moodlezoup merged 2 commits into
mainfrom
prover-stack/09-jolt-witness
Jun 23, 2026
Merged

feat: add Jolt witness crate#1604
moodlezoup merged 2 commits into
mainfrom
prover-stack/09-jolt-witness

Conversation

@markosg04

Copy link
Copy Markdown
Collaborator

Part of the draft Jolt prover stack.

Base: prover-stack/08-wrapper-verifier
Head: prover-stack/09-jolt-witness

Adds the standalone Jolt witness crate and protocol-specific witness providers.

Validation before submission:

  • cargo fmt -q -- --check
  • cargo metadata --no-deps --format-version 1
  • local gh stack push simulation against a temporary bare remote
  • forbidden-path scan for handoffs/, old STACK.md, stack/, and old stack workflow

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Warning

This PR has more than 500 changed lines and does not include a spec.

Large features and architectural changes benefit from a spec-driven workflow.
See CONTRIBUTING.md for details on how to create a spec.

If this PR is a bug fix, refactor, or doesn't warrant a spec, feel free to ignore this message.

@github-actions github-actions Bot added the no-spec PR has no spec file label Jun 9, 2026
@0xAndoroid

0xAndoroid commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Stack maintenance — Pika is rebasing this PR onto #1597 (prover-stack/02-jolt-claims-protocol-formulas) and fixing CI as part of the prover stack (#1596#1606). Rebase + CI summary to follow.

@0xAndoroid 0xAndoroid force-pushed the prover-stack/09-jolt-witness branch from 9df1b17 to aab0fc9 Compare June 17, 2026 05:14
@0xAndoroid 0xAndoroid changed the base branch from prover-stack/08-wrapper-verifier to prover-stack/02-jolt-claims-protocol-formulas June 17, 2026 05:15
@github-actions github-actions Bot added spec Tracking issue for a feature spec implementation PR contains implementation of a spec and removed no-spec PR has no spec file labels Jun 17, 2026
@0xAndoroid 0xAndoroid force-pushed the prover-stack/09-jolt-witness branch 2 times, most recently from f3b8924 to 57390c6 Compare June 17, 2026 05:33
@0xAndoroid 0xAndoroid marked this pull request as ready for review June 17, 2026 05:48
@0xAndoroid 0xAndoroid added the claude-review-request Request a review from Claude Code label Jun 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Claude code review session started: https://claude.ai/code/session_01CAbeAZB8bnAxaepDkaBMKN

@0xAndoroid

0xAndoroid commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Stack maintenance — rebased onto #1597 (prover-stack/02-jolt-claims-protocol-formulas); CI green. Ready for review.

📚 Stack A: #1596#1597#1598#1599#1600#1601#1602#1603
📚 Stack B: #1596#1597#1604 (this PR)#1605#1606

#1596 and #1597 are shared by both stacks; each PR targets the one before it.

Conflict resolution

Local validation

  • cargo fmt -q
  • cargo clippy --all --features host -q --all-targets -- -D warnings
  • cargo clippy --all --features host,zk -q --all-targets -- -D warnings
  • cargo build -q
  • cargo nextest run -p jolt-core muldiv --cargo-quiet --features host
  • cargo nextest run -p jolt-core muldiv --cargo-quiet --features host,zk

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

Reviewed the jolt-witness crate that this PR actually introduces. To get a tractable diff I reviewed the incremental range 81a7c62..57390c6 (the 6 witness commits) rather than the full GitHub diff — heads up that the PR base is set to prover-stack/02 while the description says 08, which inflates the displayed diff to 251 files / 64k lines. Re-targeting the base to 08 would make this reviewable.

No soundness issues. The booleanity address/cycle phase split is constraint-preserving (the combined output is reused verbatim, the degree-3 bound and round counts partition correctly, and the intermediate claim is bound across phases via the shared BooleanityAddrClaim opening). The crate is prover-side only, with no unsafe, no attacker-reachable panics, and dimension/overflow guards (checked_pow2, power_of_two_log_rows) used consistently.

Two latent correctness divergences flagged inline — both currently dormant (their stageN_rows have no consumer yet) but will produce wrong/malformed witness once wired into the prover.

Lower-priority notes (non-blocking):

  • Missing-PC handling diverges across paths. stage6.rs:39 (pc_for_row_optional(...).unwrap_or(0)) and streams.rs:493 (get_pc(...) → silent non-hot row) silently swallow a missing bytecode PC for a real instruction, whereas the fast path ra.rs::bytecode_pc_for_row errors via missing_pc_mapping. Unreachable for valid traces (every executed instruction is mapped; NoOp→Some(0)), so defensive consistency rather than a live bug — but worth unifying on the erroring path.
  • Speculative surface. MaterializationPolicy::Streaming is never constructed, and neither ViewRequirement.materialization nor .retention is read by any non-test logic (PolynomialView::Deferred is only constructed in tests). Per the repo's "abstractions must pay for themselves within the PR" guidance, consider trimming until a consumer exists — though this is forward-looking API for the stack, so reasonable to keep if a near-term consumer is planned.
  • Duplication of jolt-core. RaChunkSelector (ra.rs), JoltVmIncrementStreamKind::value_from_row (streams.rs:452), and the one-hot/compact expansion in streams.rs re-derive OneHotParams chunk math and witness.rs::stream_witness_and_commit_rows increment logic. Presumably intentional for the modular-crate migration; worth a note in the PR that the jolt-core versions are slated for deletion so this doesn't become permanent duplication.
  • Perf (when wired up). materialize_ram_val/materialize_ram_ra/RegistersVal are sequential O(K·T) loops; jolt-core parallelizes the equivalent generation. field_inline already uses rayon, so the gap is confined to the dense-materialization fallbacks.

Generated by Claude Code

Comment thread crates/jolt-witness/src/protocols/jolt_vm/stage2.rs Outdated
Comment thread crates/jolt-witness/src/protocols/jolt_vm/stage6.rs Outdated
moodlezoup added a commit that referenced this pull request Jun 23, 2026
… remap

Addresses review feedback on #1604:

- stage2: next_is_noop used is_none_or (-> true at the final cycle), inverting
  the boundary relative to the canonical is_some_and used by every other path
  (jolt-core r1cs/inputs.rs, spartan_outer.rs, trace.rs). It feeds
  ShouldJump = Jump*(1 - NextIsNoop), so the boundary value was inverted.
  Switch to is_some_and.
- stage6: remapped_ram_address was computed inline, skipping the >= ram_k
  bound that the shared remapped_ram_address() helper (ram.rs) enforces and
  that stage2 and every ram.rs path route through. An out-of-range remap would
  index past the ram_k one-hot domain. Route through the helper, keeping the
  ram_address binding (still needed for ram_access_nonzero).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@moodlezoup moodlezoup changed the base branch from prover-stack/02-jolt-claims-protocol-formulas to main June 23, 2026 17:16
@moodlezoup moodlezoup changed the base branch from main to prover-stack/02-jolt-claims-protocol-formulas June 23, 2026 17:17
moodlezoup and others added 2 commits June 23, 2026 13:39
Introduce the jolt-witness crate: the witness-generation layer producing
committed and virtual polynomials for the Jolt VM, dory-assist, wrapper, and
blindfold protocols.

Consolidates follow-up refactors:
- Split the jolt_vm witness module by stage and polynomial family
  (spartan_outer, stage2/3/6, registers, ra, ram, trace, streams, provider).
- Share require_unique_ids / power_of_two_log_rows helpers across the wrapper
  and dory_assist providers via protocols/util.rs.
- Tighten the core witness data-access API: log_rows-only WitnessDimensions,
  ViewRequirement-based oracle_view, and removal of dead encodings, policies,
  and builder indirection.
- Document the core witness vocabulary types.
- Restore the 1604 workspace build.
… remap

Addresses review feedback on #1604:

- stage2: next_is_noop used is_none_or (-> true at the final cycle), inverting
  the boundary relative to the canonical is_some_and used by every other path
  (jolt-core r1cs/inputs.rs, spartan_outer.rs, trace.rs). It feeds
  ShouldJump = Jump*(1 - NextIsNoop), so the boundary value was inverted.
  Switch to is_some_and.
- stage6: remapped_ram_address was computed inline, skipping the >= ram_k
  bound that the shared remapped_ram_address() helper (ram.rs) enforces and
  that stage2 and every ram.rs path route through. An out-of-range remap would
  index past the ram_k one-hot domain. Route through the helper, keeping the
  ram_address binding (still needed for ram_access_nonzero).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@moodlezoup moodlezoup force-pushed the prover-stack/09-jolt-witness branch from 98b6a4c to 70f872d Compare June 23, 2026 17:39
@github-actions github-actions Bot added spec Tracking issue for a feature spec and removed no-spec PR has no spec file labels Jun 23, 2026
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​itertools@​0.15.010010093100100
Addedcargo/​chrono@​0.4.459910093100100
Updatedcargo/​cc@​1.2.63 ⏵ 1.2.649910093100100
Addedcargo/​syn@​2.0.118100100100100100

View full report

@moodlezoup moodlezoup changed the base branch from prover-stack/02-jolt-claims-protocol-formulas to main June 23, 2026 17:45
@moodlezoup moodlezoup merged commit 07a8896 into main Jun 23, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-review-request Request a review from Claude Code implementation PR contains implementation of a spec spec Tracking issue for a feature spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants