Add_run_and_prove_recursive_tree#348
Open
YairVaknin-starkware wants to merge 1 commit into
Open
Conversation
Adds a new crate (crates/stwo_run_and_prove_recursive_tree) that folds an entire applicative recursive proof tree above N leaf STWO proofs into a single root proof in one binary invocation. Used by SHARP's GPS prover when the parent CairoJob's spec is `StwoInBinaryRecursiveTree` (gated by `enable_in_binary_recursive_tree`), to skip O(n) per-node bootloader round-trips through the GPS pipeline. Crate (876 LOC across lib.rs/main.rs/tests.rs): - `stwo_run_and_prove_recursive_tree()` performs layered 2-to-1 reductions: at each layer pairs of children are verified by a `no-builtin-simulation` simple-bootloader run (Cairo1Executable verifier tasks); odd entries are carried unchanged to the next layer. Outputs the single root proof, its flat program output, its root fact_topologies, and a nested `CompositePackedOutput` JSON for the on-chain unpacker bootloader. - `LeafInput` carries each leaf's proof_path, fact_topology, outputs, Python-computed per-leaf stats (`n_non_recursive_jobs` etc.), and a pre-computed `PackedOutput` so the binary doesn't have to know about whether each leaf is recursive — Python's `packed_output_from_data` handles that and the binary propagates it verbatim. - `LayerEntry.fact_topologies` mirrors what `stwo_run_and_prove` would have written (per-task entries from the bootloader hint), kept on the layer entry for the root disk write only — children's per-task fact_topologies in `CompositePackedOutput` come from the per-layer fact_topologies file written by the bootloader, not from a fabricated trivial value. - `single_page=true` is set on every reduce_pair's bootloader input. cairo-program-runner-lib (`hints/types.rs`): - Adds `Serialize` to `PackedOutput`/`CompositePackedOutput` with `#[serde(tag = "type")]` discriminator matching Python's marshmallow `PackedOutputSchema` (`PlainPackedOutput`/`CompositePackedOutput` rename pairs). - Adds `felt_decimal_vec::serialize` so `CompositePackedOutput.outputs` emits decimal strings (Python's `marshmallow.fields.Integer` chokes on hex and on numbers exceeding the JSON safe-integer range). Wiring: - Cargo workspace registers the new crate. - CI workflow uploads `target/release/stwo_run_and_prove_recursive_tree` to the GCS bucket `stwo_run_and_prove_recursive_tree`.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (15.84%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #348 +/- ##
==========================================
- Coverage 53.16% 51.65% -1.51%
==========================================
Files 35 37 +2
Lines 5295 5606 +311
==========================================
+ Hits 2815 2896 +81
- Misses 2480 2710 +230
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new crate (crates/stwo_run_and_prove_recursive_tree) that folds an entire applicative recursive proof tree above N leaf STWO proofs into a single root proof in one binary invocation. Used by SHARP's GPS prover when the parent CairoJob's spec is
StwoInBinaryRecursiveTree(gated byenable_in_binary_recursive_tree), to skip O(n) per-node bootloader round-trips through the GPS pipeline.Crate (876 LOC across lib.rs/main.rs/tests.rs):
stwo_run_and_prove_recursive_tree()performs layered 2-to-1 reductions: at each layer pairs of children are verified by ano-builtin-simulationsimple-bootloader run (Cairo1Executable verifier tasks); odd entries are carried unchanged to the next layer. Outputs the single root proof, its flat program output, its root fact_topologies, and a nestedCompositePackedOutputJSON for the on-chain unpacker bootloader.LeafInputcarries each leaf's proof_path, fact_topology, outputs, Python-computed per-leaf stats (n_non_recursive_jobsetc.), and a pre-computedPackedOutputso the binary doesn't have to know about whether each leaf is recursive — Python'spacked_output_from_datahandles that and the binary propagates it verbatim.LayerEntry.fact_topologiesmirrors whatstwo_run_and_provewould have written (per-task entries from the bootloader hint), kept on the layer entry for the root disk write only — children's per-task fact_topologies inCompositePackedOutputcome from the per-layer fact_topologies file written by the bootloader, not from a fabricated trivial value.single_page=trueis set on every reduce_pair's bootloader input.cairo-program-runner-lib (
hints/types.rs):SerializetoPackedOutput/CompositePackedOutputwith#[serde(tag = "type")]discriminator matching Python's marshmallowPackedOutputSchema(PlainPackedOutput/CompositePackedOutputrename pairs).felt_decimal_vec::serializesoCompositePackedOutput.outputsemits decimal strings (Python'smarshmallow.fields.Integerchokes on hex and on numbers exceeding the JSON safe-integer range).Wiring:
target/release/stwo_run_and_prove_recursive_treeto the GCS bucketstwo_run_and_prove_recursive_tree.Type
Description
Breaking changes?
This change is