Skip to content

feat: extend Jolt claim protocol formulas#1597

Merged
moodlezoup merged 4 commits into
mainfrom
prover-stack/02-jolt-claims-protocol-formulas
Jun 23, 2026
Merged

feat: extend Jolt claim protocol formulas#1597
moodlezoup merged 4 commits into
mainfrom
prover-stack/02-jolt-claims-protocol-formulas

Conversation

@markosg04

Copy link
Copy Markdown
Collaborator

Part of the draft Jolt prover stack.

Base: prover-stack/01-field-inline-tracing
Head: prover-stack/02-jolt-claims-protocol-formulas

Extends the Jolt claim formulas, including field-inline protocol formulas and supporting specs.

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 added spec Tracking issue for a feature spec implementation PR contains implementation of a spec labels Jun 9, 2026
@0xAndoroid 0xAndoroid force-pushed the prover-stack/01-field-inline-tracing branch 3 times, most recently from 18ed880 to 9fba45a Compare June 15, 2026 21:52
@0xAndoroid 0xAndoroid force-pushed the prover-stack/01-field-inline-tracing branch from 27f1951 to 8f437ff Compare June 17, 2026 04:29
@0xAndoroid

0xAndoroid commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Stack maintenance — Pika is rebasing this PR onto #1596 (prover-stack/01-field-inline-tracing) and fixing CI as part of the prover stack (#1596#1606). Rebase + CI summary to follow.

@0xAndoroid 0xAndoroid force-pushed the prover-stack/02-jolt-claims-protocol-formulas branch from 941c1b4 to 4344fe3 Compare June 17, 2026 04:55
@0xAndoroid 0xAndoroid marked this pull request as ready for review June 17, 2026 05:08
@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_01FNR82Crof9atPbqeKS2a11

@0xAndoroid

0xAndoroid commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Stack maintenance — rebased onto #1596 (prover-stack/01-field-inline-tracing); CI green. Marked ready for review (claude-review-request).

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

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

Conflict resolution

Follow-up CI fix (4344fe392c) — restored stacked enum variants/helpers required by #1596's committed-program formulas, restored the split booleanity helpers expected by verifier code, and added the small jolt-poly helpers used by #1597's formula evaluators.

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 -p jolt-core -q
  • cargo nextest run -p jolt-core muldiv --cargo-quiet --features host
  • cargo nextest run -p jolt-core muldiv --cargo-quiet --features host,zk

cargo build --all --features host fails locally on macOS in zeroos-runtime-musl with a Mach-O section-specifier error. The targeted Jolt builds/checks above pass, and GitHub CI is green.

@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 Rust changes (specs/*.md skimmed as docs). This is verifier-side claim scaffolding for the prover stack; most new helpers are exercised only by their own tests so far. Opening-point orderings, the proof_commitment_order reorder (now matching the prover's all_committed_polynomials), and the SameEvaluationAs refactor all check out. A few notes below.

Minor / non-blocking:

  • jolt-poly/src/dense.rs: sumcheck_round_eval_with_order has no callers (all 25 sites use sumcheck_round_eval). Fine if a later stack entry needs it; otherwise drop it.
  • field_inline/formulas/dimensions.rs: read_write_opening_point / validate_phase_split / FieldRegistersReadWriteOpeningPoint are a near-verbatim copy of the jolt-side ReadWriteDimensions versions. Consider sharing the phase-split helper.
  • jolt-poly/src/eq.rs: boolean_index_msb's index.checked_shl(1)? guards the shift amount (always 1), not value overflow, so it never returns None on >64-var points. Not reachable from current callers, but the guard is misleading.

Generated by Claude Code

where
F: Field,
{
Polynomial::new(EqPolynomial::<F>::evals(stage1_cycle_binding, None))

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.

hamming_booleanity_eq_cycle_polynomial builds the eq table without reversing its cycle point, unlike every sibling (ra_virtualization_eq_cycle_polynomial here at L363, the instruction version, and eq_address_cycle_polynomial), which all .rev() first. The prover treats RAM hamming-booleanity and RAM ra-virtualization identically (both GruenSplitEqPolynomial::new(&params.r_cycle.r, LowToHigh) over a big-endian r_cycle), so the verifier helpers should be symmetric. The only test here is tautological (evals(x) == evals(x)) and there's no live caller yet. Please confirm the intended orientation of stage1_cycle_binding before this is wired up — if the caller passes the same big-endian point the other helpers receive, this table will be bit-reversed relative to the hamming_weight polynomial it multiplies.


Generated by Claude Code

Comment on lines +33 to +63
[
outer_opening(FieldInlineVirtualPolynomial::FieldRs1Value),
outer_opening(FieldInlineVirtualPolynomial::FieldRs2Value),
outer_opening(FieldInlineVirtualPolynomial::FieldRdValue),
outer_opening(FieldInlineVirtualPolynomial::FieldProduct),
outer_opening(FieldInlineVirtualPolynomial::FieldInvProduct),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Add,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Sub,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Mul,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Inv,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::AssertEq,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::LoadFromX,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::StoreToX,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::LoadImm,
)),
]

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.

This re-types the exact 13-entry sequence already declared in FIELD_INLINE_SPARTAN_OUTER_R1CS_INPUTS above, and the test just asserts the two are equal via map. Map the const directly:

Suggested change
[
outer_opening(FieldInlineVirtualPolynomial::FieldRs1Value),
outer_opening(FieldInlineVirtualPolynomial::FieldRs2Value),
outer_opening(FieldInlineVirtualPolynomial::FieldRdValue),
outer_opening(FieldInlineVirtualPolynomial::FieldProduct),
outer_opening(FieldInlineVirtualPolynomial::FieldInvProduct),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Add,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Sub,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Mul,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::Inv,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::AssertEq,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::LoadFromX,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::StoreToX,
)),
outer_opening(FieldInlineVirtualPolynomial::FieldOpFlag(
FieldInlineOpFlag::LoadImm,
)),
]
FIELD_INLINE_SPARTAN_OUTER_R1CS_INPUTS.map(outer_opening)

Generated by Claude Code

///
/// Consumers must enforce these in the same constraint system as the input and output
/// claims; treating them as metadata can leave alternate opening chains unbound.
pub consistency: Vec<JoltConsistencyClaim<F>>,

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.

This drops the soundness-contract warning that previously documented consistency (consumers must enforce these in the same constraint system; treating them as metadata can leave alternate opening chains unbound). The field's behavior is unchanged, but that's a load-bearing, easy-to-misuse invariant — worth keeping the doc comment.


Generated by Claude Code

Base automatically changed from prover-stack/01-field-inline-tracing to main June 17, 2026 15:53
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Benchmark comparison (crates)

group                           main_run                               pr_run
-----                           --------                               ------
EqPolynomial::evals/17          1.09      2.1±0.03ms        ? ?/sec    1.00  1912.8±22.16µs        ? ?/sec
EqPolynomial::evals/19          1.09      7.9±0.06ms        ? ?/sec    1.00      7.3±0.08ms        ? ?/sec
EqPolynomial::evals/20          1.07     16.4±0.19ms        ? ?/sec    1.00     15.3±0.15ms        ? ?/sec
EqPolynomial::evals/22          1.09     62.9±0.44ms        ? ?/sec    1.00     57.5±0.28ms        ? ?/sec
EqPolynomial::evaluations/14    1.00   622.6±11.08µs        ? ?/sec    1.26   787.0±17.78µs        ? ?/sec
EqPolynomial::evaluations/18    1.10      7.2±0.10ms        ? ?/sec    1.00      6.5±0.07ms        ? ?/sec
EqPolynomial::evaluations/20    1.07     30.6±0.14ms        ? ?/sec    1.00     28.6±0.28ms        ? ?/sec
Fr::mul_u128                    1.16     25.0±0.11ns        ? ?/sec    1.00     21.5±0.17ns        ? ?/sec
Fr::mul_u64                     1.00     12.3±0.05ns        ? ?/sec    1.08     13.3±0.12ns        ? ?/sec
Fr::to_bytes                    1.13     20.1±0.32ns        ? ?/sec    1.00     17.7±0.22ns        ? ?/sec
Polynomial::bind/14             1.19    154.4±2.99µs        ? ?/sec    1.00    130.2±5.10µs        ? ?/sec
Polynomial::bind/18             1.11      2.2±0.03ms        ? ?/sec    1.00  1953.4±76.56µs        ? ?/sec
Polynomial::bind/20             1.10      8.5±0.05ms        ? ?/sec    1.00      7.7±0.07ms        ? ?/sec
Polynomial::evaluate/20         1.08     44.4±0.99ms        ? ?/sec    1.00     40.9±1.04ms        ? ?/sec
append_bytes/Blake2b/32B        1.00     49.1±2.22ns        ? ?/sec    1.10     53.9±4.45ns        ? ?/sec
append_bytes/Keccak/256B        1.10   914.2±19.32ns        ? ?/sec    1.00   832.5±20.28ns        ? ?/sec
append_bytes/Keccak/32B         1.00     42.9±0.46ns        ? ?/sec    1.13     48.3±3.87ns        ? ?/sec
append_bytes/Poseidon/32B       1.05     97.3±0.75µs        ? ?/sec    1.00     92.3±3.10µs        ? ?/sec
challenge/Blake2b               1.14   734.2±47.59ns        ? ?/sec    1.00   645.3±12.24ns        ? ?/sec
challenge/Keccak                1.11    439.6±7.61ns        ? ?/sec    1.00    395.9±5.94ns        ? ?/sec
challenge/Poseidon              1.07     48.8±0.37µs        ? ?/sec    1.00     45.6±0.60µs        ? ?/sec
g1_add                          1.12    464.3±2.22ns        ? ?/sec    1.00    414.7±5.31ns        ? ?/sec
g1_deserialize_bincode          1.05      9.7±0.09µs        ? ?/sec    1.00      9.2±0.15µs        ? ?/sec
g1_double                       1.10    233.6±1.72ns        ? ?/sec    1.00    212.0±1.93ns        ? ?/sec
g1_msm/1024                     1.10     14.0±0.03ms        ? ?/sec    1.00     12.8±0.28ms        ? ?/sec
g1_msm/16                       1.11   598.5±10.52µs        ? ?/sec    1.00   539.3±18.17µs        ? ?/sec
g1_msm/256                      1.11      4.7±0.01ms        ? ?/sec    1.00      4.3±0.01ms        ? ?/sec
g1_msm/4                        1.12    284.6±2.92µs        ? ?/sec    1.00    254.2±3.16µs        ? ?/sec
g1_scalar_mul                   1.11     72.2±0.90µs        ? ?/sec    1.00     65.1±1.40µs        ? ?/sec
g1_serialize_bincode            1.10    120.9±2.04ns        ? ?/sec    1.00    109.9±1.53ns        ? ?/sec
g2_msm/256                      1.12     17.5±0.22ms        ? ?/sec    1.00     15.6±0.06ms        ? ?/sec
g2_msm/4                        1.11    865.5±7.70µs        ? ?/sec    1.00    782.0±9.77µs        ? ?/sec
g2_msm/64                       1.12      6.3±0.02ms        ? ?/sec    1.00      5.6±0.01ms        ? ?/sec
g2_scalar_mul                   1.14   366.1±13.10µs        ? ?/sec    1.00    321.4±2.04µs        ? ?/sec
gt_scalar_mul                   1.00    777.8±9.26µs        ? ?/sec    1.15    892.0±6.27µs        ? ?/sec
multi_pairing/16                1.09      6.4±0.01ms        ? ?/sec    1.00      5.8±0.14ms        ? ?/sec
multi_pairing/2                 1.00  1071.9±22.49µs        ? ?/sec    1.17  1251.1±26.60µs        ? ?/sec
multi_pairing/4                 1.07  1972.6±18.05µs        ? ?/sec    1.00  1846.3±33.22µs        ? ?/sec
multi_pairing/8                 1.09      3.5±0.01ms        ? ?/sec    1.00      3.2±0.07ms        ? ?/sec
pairing                         1.00   810.7±42.29µs        ? ?/sec    1.14    923.8±8.00µs        ? ?/sec
pedersen_commit/1024            1.10     14.1±0.04ms        ? ?/sec    1.00     12.8±0.13ms        ? ?/sec
pedersen_commit/16              1.11    672.9±4.10µs        ? ?/sec    1.00    607.8±9.07µs        ? ?/sec
pedersen_commit/256             1.10      4.8±0.01ms        ? ?/sec    1.00      4.3±0.02ms        ? ?/sec
pedersen_commit/4               1.12    356.2±2.30µs        ? ?/sec    1.00    318.7±3.26µs        ? ?/sec

@moodlezoup moodlezoup merged commit caa7a07 into main Jun 23, 2026
28 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