Commit 101c119
perf: batching advice polynomials (#1172)
* first draft
* fmt
* clippy
* WIP
* fmt
* wired in new sumchecks
* more progress
* refactor: move RamHammingBooleanity to Stage 6 for unified r_cycle
- Move RamHammingBooleanity sumcheck from Stage 5 to Stage 6
This ensures RAM HW claims use r_cycle_stage6, matching HammingWeightClaimReduction
- Remove ram_hw_claims from JoltProof struct
RAM HW claims now flow through accumulator like all other claims
- Simplify HammingWeightClaimReduction params
- Fetch RAM HW claims from accumulator (VirtualPolynomial::RamHammingWeight)
- Remove separate ram_hw_claims handling in prover/verifier
- Update tracking document with new stage layout
All e2e tests pass when run individually.
* refactor(sumcheck): unify booleanity, consolidate claim reductions, remove opening reduction
This is a major refactoring of the sumcheck infrastructure for Jolt Stage 6-7.
1. Unified Booleanity Sumcheck
- Add unified_booleanity.rs to batch booleanity checks across all ra polynomials
(instruction, bytecode, ram) into a single sumcheck
- Replaces separate booleanity sumchecks per polynomial family
2. Claim Reductions Consolidation
- Move all claim reduction sumchecks into zkvm/claim_reductions/:
- hamming_weight.rs - fused HammingWeight + RA address reduction
- increments.rs - increment counter claim reduction
- instruction_lookups.rs - instruction lookups claim reduction
- ram_ra.rs - RAM RA claim reduction
- Remove scattered implementations from subprotocols/, zkvm/ram/, zkvm/spartan/
3. Remove Deprecated Opening Reduction (Old Stage 7)
- Delete subprotocols/opening_reduction.rs
- Delete subprotocols/hamming_weight.rs (replaced by fused version)
- Delete subprotocols/hamming_weight_claim_reduction.rs
- Delete subprotocols/inc_reduction.rs
- Delete zkvm/ram/ra_reduction.rs
- Delete zkvm/spartan/claim_reductions.rs
- Clean up deprecated Stage 7 methods from opening_proof.rs
The new architecture reduces the number of sumcheck instances and aligns all
ra polynomials to a common opening point for efficient batch opening proofs.
* Refactor: SharedRaPolynomials with shared eq table and non-transposed indices
- Add SharedRaPolynomials type that stores ONE shared eq table instead of N copies
- Store Vec<RaIndices> (non-transposed) instead of Vec<Vec<Option<u16>>>
- Implement Round1/Round2/Round3/RoundN state machine for delayed binding
- Add compute_all_G and compute_ra_indices for parallel computation
- Refactor UnifiedBooleanityProver to use SharedRaPolynomials
- Remove separate compute_instruction_G/bytecode_G/ram_G functions
- Use rayon::join for parallel G and ra_indices computation
* WIP: Stage 7 debugging - r_cycle source mismatch investigation
Debug state:
- SharedRaRound3::get_bound_coeff: Fixed LowToHigh offset ordering (F_10 <-> F_01)
- SharedRaRound3::bind: Fixed to create 8 separate F tables as in RaPolynomialRound3
- compute_all_G: Optimized to use flat N*K vector with unsafe_allocate_zero_vec
Current issue:
- HammingWeight's G·eq(r_addr) doesn't match UnifiedBooleanity's claims_bool
- Debug shows ~0.3% difference, suggesting r_cycle mismatch
- HammingWeight now extracts r_cycle from Stage 5 (same source as UnifiedBooleanity)
- eq_bool mle vs bound mismatch indicates potential endianness issue
Hypothesis:
- UnifiedBooleanity claims are at (ρ_addr, r_cycle_stage5) where:
- ρ_addr = sumcheck challenges for address
- r_cycle_stage5 = original r_cycle from Stage 5
- HammingWeight should use the same r_cycle for G computation
* more opt
* refactoring, still failing
* removing more dead code related to one hot polys
* fixed bug, add streaming VMV from materialized trace
* more fix
* Checkpoint before follow-up message
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* Checkpoint before follow-up message
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* Fix clippy warning: remove debug eprintln from sumcheck
Remove temporary Stage 7 debugging code that was causing clippy
uninlined_format_args warning.
* Checkpoint before follow-up message
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* Refactor: Rename UnifiedBooleanity to Booleanity
This commit renames the UnifiedBooleanity subprotocol to Booleanity to better reflect its purpose. The functionality remains the same.
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* Refactor: Improve code formatting and imports
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* feat: Add initial core functionality
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* Refactor: Integrate advice polynomial claim reduction
This commit refactors the advice polynomial handling by introducing a new claim reduction sumcheck. This sumcheck consolidates multiple advice claims into fewer claims, which are then batched into the Stage 8 opening proof. This change removes the need for separate advice opening proofs and simplifies the overall proof structure.
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* feat: Add trusted advice hint to prover and SDK
Co-authored-by: qvd <qvd@andrew.cmu.edu>
* optimize ra reduction init
* cleaning up
* turn remainder into bitmask in some places
* add documentation to eq poly
* added more inlines
* simpler split eq implementation of compute G
* optimization to streaming vmv
* final small change
* name change booleanity => booleanity sumcheck
* change back threshold
* clippy
* Fix advice claim reduction and Stage 8 batching issues
- Fixed AdviceClaimReductionParams::new to check if advice openings actually exist
in the accumulator, not just if memory layout allows advice. This fixes tests
like SHA3 that don't use advice.
- Fixed SDK macro typo: <<< -> << in OpeningProofHint type parameter
- Removed advice from Stage 8 batch opening: Advice is committed with different
dimensions (max_padded_trace_length) than main polynomials (actual padded_trace_len),
so they cannot be batched together. Advice claims are still reduced via
AdviceClaimReduction in Stage 6.
- Reverted advice test to use TrustedAdvice Dory context instead of Main context
* delete executable
* remove redundant stuff in booleanity params
* delete redundant split eq poly method
* I think everything is working?
* add advice for streaming rlc as well
* added more tests
* delete executable
* added extra e2e tests for advice
* clippy
* more clippy
* final clippy I swear
* okay final final clippy
* optimize rlc computation
* fmt
* can batch advice with arbitrary dimensions now?
* fmt
* revert to old unmodified batched sumcheck impl
* fmt
* append C_mid claim to transcript
* addressing comments (part 1)
* more cleanups
* more cleanup
* final changes
* small rename
* final removal of chunk ranges
* final changes
* reorganize sumcheck ids: remove old ones, rename some, and reorder according to appearance in stages
* no fixedbitset for ram sumcheck inits
* tidy up comments in prover & verifier
* final removal of chunk ranges & fixed bit set for compute G
* fix padding issue
* have unreduced addition in rlc accumulating ra poly evals
* increase threshold for increasing log_k_chunk (from 23 to 25)
* revert to FixedBitSet impl for compute G
* Fix test code to use new DoryOpeningState pattern
- Remove old test block that used dory_opening_state field
- Move joint_commitment_for_test computation into prove_stage8_impl
- Update advice_row_coords test to get opening_point from OpeningAccumulator
- Add missing imports (OpeningAccumulator, CommittedPolynomial)
* Simplify prove_stage8: remove unnecessary test scaffolding
The better-opening-reduction branch never actually sets joint_commitment_for_test,
so the verifier cross-check (if let Some...) never triggers. Match that pattern
by removing the commitments_map passing and the two-impl split.
* Remove dead joint_commitment_for_test field
This field was initialized to None and never set, so the verifier
cross-check never triggered. Remove from prover, verifier, and proof struct.
* fmt + minor refactor
* cleaned up tests
* clippy
* clippy
* Added test for advice polynomials size exceeding maximum and few other minor changes
* failure in building python files
* refactoring
* removed mds
* minor fix in comments
* more small fixes
* added serializer for max_padded_trace_length in shared preprocessing
* clippy
* removed extra advice constructors
* replaced manual eq zero_selector
---------
Co-authored-by: Quang Dao <quang.dao@layerzerolabs.org>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: qvd <qvd@andrew.cmu.edu>
Co-authored-by: Quang Dao <>1 parent 1889740 commit 101c119
File tree
28 files changed
+2135
-477
lines changed- examples
- merkle-tree/src
- recursion/src
- jolt-core
- benches
- src
- guest
- poly
- commitment/dory
- subprotocols
- zkvm
- claim_reductions
- ram
- jolt-sdk/macros/src
- scripts
- tracer/src
28 files changed
+2135
-477
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| 341 | + | |
341 | 342 | | |
342 | 343 | | |
343 | 344 | | |
| |||
511 | 512 | | |
512 | 513 | | |
513 | 514 | | |
| 515 | + | |
514 | 516 | | |
515 | 517 | | |
516 | 518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
214 | 215 | | |
215 | | - | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
| |||
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
| 270 | + | |
269 | 271 | | |
270 | | - | |
271 | | - | |
| 272 | + | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
| |||
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| 285 | + | |
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
61 | 100 | | |
62 | 101 | | |
63 | 102 | | |
| |||
182 | 221 | | |
183 | 222 | | |
184 | 223 | | |
185 | | - | |
186 | | - | |
| 224 | + | |
187 | 225 | | |
188 | 226 | | |
189 | 227 | | |
190 | 228 | | |
191 | 229 | | |
192 | 230 | | |
193 | | - | |
| 231 | + | |
194 | 232 | | |
195 | 233 | | |
196 | 234 | | |
197 | 235 | | |
| 236 | + | |
198 | 237 | | |
199 | 238 | | |
200 | 239 | | |
201 | 240 | | |
202 | | - | |
| 241 | + | |
203 | 242 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
209 | 246 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
218 | 251 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | 252 | | |
226 | 253 | | |
227 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
244 | | - | |
| 245 | + | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
| |||
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
388 | | - | |
| 389 | + | |
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
| |||
450 | 451 | | |
451 | 452 | | |
452 | 453 | | |
453 | | - | |
| 454 | + | |
454 | 455 | | |
455 | 456 | | |
456 | 457 | | |
| |||
534 | 535 | | |
535 | 536 | | |
536 | 537 | | |
537 | | - | |
| 538 | + | |
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
58 | 80 | | |
59 | 81 | | |
60 | 82 | | |
| |||
0 commit comments