Add multiverifier folding to the recursive tree prover#381
Add multiverifier folding to the recursive tree prover#381YairVaknin-starkware wants to merge 1 commit into
Conversation
PR SummaryHigh Risk Overview
Reviewed by Cursor Bugbot for commit b7e0fd0. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## adar/leaf_prover #381 +/- ##
====================================================
- Coverage 65.62% 64.04% -1.59%
====================================================
Files 41 45 +4
Lines 5775 5777 +2
====================================================
- Hits 3790 3700 -90
- Misses 1985 2077 +92
🚀 New features to boost your workflow:
|
558da8a to
985cba7
Compare
50c33f4 to
dd68cc3
Compare
Gali-StarkWare
left a comment
There was a problem hiding this comment.
You have all the leaf prover stuff here, rebase it on Adar's branch
@Gali-StarkWare partially reviewed 7 files and made 1 comment.
Reviewable status: 5 of 19 files reviewed, all discussions resolved (waiting on OmriEshhar1).
6cced69 to
229036b
Compare
ed97add to
33675fe
Compare
229036b to
1b1121a
Compare
f9ad153 to
74b51d2
Compare
74b51d2 to
fb876d7
Compare
Replace the per-pair Cairo simple-bootloader run with a circuit-world fold:
for each pair, build a `circuit_multiverifier` circuit that verifies both
child circuit proofs, prove it, and make the resulting proof the parent for
the next layer. The tree is balanced with odd-carry; there is no Cairo
bootloader or wrapping step anymore.
The tree is homogeneous: the leaf cairo-verifier circuit and the multiverifier
circuit are both padded to one shared `TARGET_PADDING_SIZES`, so they share a
preprocessed-trace layout and a single `SharedConfig` verifies every layer
(leaf proofs at layer 0, multiverifier proofs above).
Module layout:
- canonical: one-time `CanonicalCircuit` setup (circuit shape + shared config).
- fold: `LayerEntry` + `reduce_pair` (deserialize children, build/prove the
multiverifier, reserialize the parent proof in memory) plus the `PackedNode`
output tree, a `Plain`/`Composite` enum mirroring Cairo `PackedOutput`.
- leaf_io: leaves are `leaf_proof_format::SerializedLeafProof` (the shared
output type `leaf_prover` produces — program output, circuit outputs,
preprocessed root, and the serialized `Proof<QM31>` inline as base64), loaded
from a `{"leaves": ["<path>", ...]}` manifest of per-leaf output files.
`LeafProofExt` adds the fold-side conversions. Each leaf declares its own
preprocessed root, so the fold is agnostic to the leaf's circuit type.
- output: root proof + flat circuit-output JSON + the nested `PackedNode` tree.
Each leaf becomes `Composite(circuit_out, [Plain(program_output)])` and every
fold builds `Composite(mv_hash, [left, right])`, so the packed tree carries each
leaf's Cairo program output down to its `Plain` node for a future per-leaf
unpacker.
Intermediate proofs are held in memory (no scratch dir). Drops the Cairo
bootloader machinery and its `resources/`.
The circuit is TEMPORARILY configured to the privacy cairo-verifier fixture so
the `slow-tests` e2e can fold a pre-generated leaf proof (duped 2/3/4x) without
running `leaf_prover`; wiring in `leaf_prover` as the real leaf producer is the
follow-up.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1b1121a to
b7e0fd0
Compare
Replace the per-pair Cairo simple-bootloader run with a circuit-world fold: for each pair, build a
circuit_multiverifiercircuit that verifies both child circuit proofs, prove it, and make the resulting proof the parent for the next layer. The tree is balanced with odd-carry; there is no Cairo bootloader or wrapping step anymore.The tree is homogeneous: the leaf cairo-verifier circuit and the multiverifier circuit are both padded to one shared
TARGET_PADDING_SIZES, so they share a preprocessed-trace layout and a singleSharedConfigverifies every layer (leaf proofs at layer 0, multiverifier proofs above).Module layout:
CanonicalCircuitsetup (circuit shape + shared config).LayerEntry+reduce_pair(deserialize children, build/prove the multiverifier, reserialize the parent proof in memory).LeafInputmanifest — inlineoutput_valuesandpreprocessed_rootplus a path to a pureProof<QM31>. Both are inline because neither is recoverable from the serialized proof; the per-leaf root also keeps the fold agnostic to the leaf's circuit type.PackedNodetree.Intermediate proofs are held in memory (no scratch dir). Drops the Cairo bootloader machinery and its
resources/.The circuit is TEMPORARILY configured to the privacy cairo-verifier fixture so the
slow-testse2e can fold a pre-generated leaf proof (duped 2/3/4x) without runningleaf_prover; wiring inleaf_proveras the real leaf producer is the follow-up.Type
Description
Breaking changes?
This change is