Skip to content

Add recursive-tree e2e goldens over the leaf bootloader#388

Open
YairVaknin-starkware wants to merge 1 commit into
yairv/packed_node_preprocessed_rootfrom
yairv/recursive_tree_leaf_bl_goldens_e2e
Open

Add recursive-tree e2e goldens over the leaf bootloader#388
YairVaknin-starkware wants to merge 1 commit into
yairv/packed_node_preprocessed_rootfrom
yairv/recursive_tree_leaf_bl_goldens_e2e

Conversation

@YairVaknin-starkware

@YairVaknin-starkware YairVaknin-starkware commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Add goldens at test_data/goldens/four_leaves/: a real leaf (the leaf simple bootloader running a simple-output task, proven end-to-end by leaf_prover, wrapped into a LeafInput with the hashed-output preimage injected the way the backend does) duplicated 4x and folded. supported_preprocessed_roots.json is the unpacker's trust-anchor list (the circuit-world analogue of the supported program hash lists). The committed leaf_simple_bootloader_compiled.json (landed in #391) is compiled from the main starkware repo revision that moves run_simple_bootloader_single_task into run_simple_bootloader.cairo (the goldens are proven against it).

The new test_golden_four_leaves_e2e test is the true end-to-end AND the goldens generator: it runs leaf_prover itself (via prove_leaf_from_files), folds 4 copies, and asserts both the independently recomputed hash tree (every hash layer, from the raw preimage up) and equality with the committed goldens; run with FIX=1 to regenerate them (see the e2e module docs). The fold e2e tests switch from the interim leaf_fixture.json (same content, removed here) to the golden leaf.

Stack (4/4): prove_leaf_from_files (#390) ← retarget canonical (#391) ← PackedNode roots (#392) ← this.

🤖 Generated with Claude Code


This change is Reviewable

@cursor

cursor Bot commented Jul 13, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are confined to test fixtures, dev-dependencies, and slow-test documentation; production fold/prove binaries are unchanged.

Overview
Adds committed regression goldens under test_data/goldens/four_leaves/ (leaf proof, preimage dump, 4-leaf fold outputs, manifest, and supported_preprocessed_roots.json) and wires slow e2e tests to that tree instead of the removed interim leaf_fixture.json.

test_golden_four_leaves_e2e runs leaf_prover on the leaf simple bootloader + simple-output task, injects the hashed-output preimage like the backend (hex dump → decimal felts via num-bigint), folds four copies, and asserts byte-for-byte JSON equality with the goldens; FIX=1 on that test refreshes all golden files including the trust-anchor roots list. The lighter test_fold_two_leaves / test_fold_three_leaves_with_carry cases now duplicate goldens/four_leaves/leaf.json while still independently recomputing the packed hash tree.

dupe_and_fold returns the multiverifier preprocessed root so the generator can write supported_preprocessed_roots.json.

Reviewed by Cursor Bugbot for commit f2839a4. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.88%. Comparing base (ae52f97) to head (f2839a4).

Additional details and impacted files
@@                           Coverage Diff                           @@
##           yairv/packed_node_preprocessed_root     #388      +/-   ##
=======================================================================
+ Coverage                                65.59%   65.88%   +0.28%     
=======================================================================
  Files                                       45       45              
  Lines                                     5906     5906              
=======================================================================
+ Hits                                      3874     3891      +17     
+ Misses                                    2032     2015      -17     

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch 2 times, most recently from 83cda2e to 4ce7228 Compare July 14, 2026 19:20

@OmriEshhar1 OmriEshhar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OmriEshhar1 made 1 comment.
Reviewable status: 0 of 21 files reviewed, 1 unresolved discussion (waiting on Gali-StarkWare and YairVaknin-starkware).


a discussion (no related file):
it looks like there are at least 3 separate changes here:

  1. refactor in leaf_prover (prove_leaf_from_files)
  2. changes to canonical
  3. 'golden' test
    Consider separating to 3 (or more) more manageable PRs.

@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from 4ce7228 to 8d5a7ef Compare July 15, 2026 14:33
@YairVaknin-starkware
YairVaknin-starkware changed the base branch from yairv/add_multiverifier_support_for_recursive_tree_prover to yairv/packed_node_preprocessed_root July 15, 2026 14:37
@YairVaknin-starkware YairVaknin-starkware changed the title Retarget the recursive tree to the leaf bootloader; add e2e goldens Add recursive-tree e2e goldens over the leaf bootloader Jul 15, 2026
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/packed_node_preprocessed_root branch from 2e6febc to e833b2d Compare July 15, 2026 18:45
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from 8d5a7ef to 22adf2a Compare July 15, 2026 18:46

@YairVaknin-starkware YairVaknin-starkware left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YairVaknin-starkware made 1 comment.
Reviewable status: 0 of 22 files reviewed, 1 unresolved discussion (waiting on Gali-StarkWare and OmriEshhar1).


a discussion (no related file):

Previously, OmriEshhar1 wrote…

it looks like there are at least 3 separate changes here:

  1. refactor in leaf_prover (prove_leaf_from_files)
  2. changes to canonical
  3. 'golden' test
    Consider separating to 3 (or more) more manageable PRs.

Done.

@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/packed_node_preprocessed_root branch from e833b2d to 7eb6b56 Compare July 16, 2026 09:20
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from 22adf2a to fc028e9 Compare July 16, 2026 09:20
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/packed_node_preprocessed_root branch from 7eb6b56 to a8e328f Compare July 16, 2026 09:25
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from fc028e9 to 976e3e6 Compare July 16, 2026 09:25
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/packed_node_preprocessed_root branch from a8e328f to 982b962 Compare July 16, 2026 10:04
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from 976e3e6 to 1bec20e Compare July 16, 2026 10:04

@OmriEshhar1 OmriEshhar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OmriEshhar1 reviewed 22 files and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Gali-StarkWare).

@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from 1bec20e to 5059e8a Compare July 16, 2026 21:20
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/packed_node_preprocessed_root branch from 982b962 to 83646a1 Compare July 16, 2026 21:20
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from 5059e8a to fa3345e Compare July 17, 2026 08:07

@OmriEshhar1 OmriEshhar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OmriEshhar1 reviewed 12 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Gali-StarkWare).

Add goldens at `test_data/goldens/four_leaves/`: a real leaf (the leaf simple
bootloader running a simple-output task, proven end-to-end by `leaf_prover`,
wrapped into a `LeafInput` with the hashed-output preimage injected the way
the backend does) duplicated 4x and folded. `root_outputs.json` is the root's
eight raw u32 digest words; `root_packed.json` carries only per-node
preprocessed roots down to each leaf's `Plain` preimage reveal (every digest
in between is recomputable). `supported_preprocessed_roots.json` is the
unpacker's trust-anchor list (the circuit-world analogue of the supported
program hash lists). The committed `leaf_simple_bootloader_compiled.json` is
compiled from the main starkware repo revision that moves
`run_simple_bootloader_single_task` into `run_simple_bootloader.cairo` (the
goldens are proven against it).

The new `test_golden_four_leaves_e2e` test is the true end-to-end AND the
goldens generator: it runs `leaf_prover` itself (via `prove_leaf_from_files`),
folds 4 copies, and asserts both the independently recomputed hash tree (every
hash layer, from the raw preimage up) and equality with the committed goldens;
run with `FIX=1` to regenerate them (see the e2e module docs). The fold e2e
tests load the golden leaf, replacing the interim `leaf_fixture.json` (same
content), which is removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/packed_node_preprocessed_root branch from 83646a1 to ae52f97 Compare July 20, 2026 08:50
@YairVaknin-starkware
YairVaknin-starkware force-pushed the yairv/recursive_tree_leaf_bl_goldens_e2e branch from fa3345e to f2839a4 Compare July 20, 2026 08:50

@Gali-StarkWare Gali-StarkWare left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gali-StarkWare reviewed 22 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on YairVaknin-starkware).


crates/stwo_run_and_prove_recursive_tree/src/tests.rs line 211 at r5 (raw file):

    }

    /// The golden `leaf_prover` output the cheaper e2e folds duplicate their leaves from: the leaf

I didn't know we're in ancient greece :)

Code quote:

The golden `leaf_prover`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants