Add the circuit-unpacking applicative bootloader's hints#395
Conversation
PR SummaryMedium Risk Overview Bootloader flow hints load program input and orchestrate phased runs: aggregator-only simple bootloader (output segment + saved applicative output builtin state), verifier-only run (stash aggregator fact topologies, switch output segment), unpack setup (restore output builtin, lay out tasks output + supported-roots
Extensive unit tests cover happy paths, malformed nodes/roots, missing ids, and fact-topology edge cases; Reviewed by Cursor Bugbot for commit 1c1713b. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 027b905. Configure here.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## yairv/add_mock_circuit_verifier_hint #395 +/- ##
========================================================================
+ Coverage 68.42% 72.24% +3.82%
========================================================================
Files 42 42
Lines 6011 6860 +849
========================================================================
+ Hits 4113 4956 +843
- Misses 1898 1904 +6
🚀 New features to boost your workflow:
|
027b905 to
fd3451a
Compare
d2650b2 to
646f18a
Compare
fd3451a to
0a74d65
Compare
Implements the hints of the circuit-unpacking applicative bootloader and its
circuit-tree unpacker
(starkware/cairo/bootloaders/circuit_applicative_bootloader/):
- Input loading and per-run setup: LOAD_CIRCUIT_APPLICATIVE_BOOTLOADER_INPUT,
CIRCUIT_APPLICATIVE_SETUP_VERIFIER_RUN (single-task simple bootloader runs
for the aggregator and the circuit verifier, saving/restoring the
applicative output builtin state), and CIRCUIT_APPLICATIVE_SETUP_UNPACK
(builds the unpacker's supported-roots config in Cairo memory and enters
the packed-output root node scope).
- The unpacker's node hints (CIRCUIT_UNPACK_*): tree navigation via nested
node scopes, leaf preimage reveal, nine-bit limb splitting, and
SET_ROOT_INDEX — each packed node carries its proof's preprocessed root,
which the hint locates in the supported-roots list (read back from Cairo
memory, matched across all eight words), keeping the hints role-agnostic.
- CIRCUIT_APPLICATIVE_WRITE_FACT_TOPOLOGY: the final fact topology (the
aggregator's, page 0 resized for the removed tasks output and the added
two-felt header).
The wire types mirror the recursive tree prover's: PackedNode (externally
tagged; `Composite { preprocessed_root, subtasks }` verifier nodes down to
each leaf's `Plain { output_preimage }` reveal — only underivable data, the
unpacker recomputes every digest from the preimages) and
CircuitApplicativeBootloaderInput.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
646f18a to
4fb6a87
Compare
0a74d65 to
1c1713b
Compare
OmriEshhar1
left a comment
There was a problem hiding this comment.
@OmriEshhar1 partially reviewed 4 files and made 1 comment.
Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on Gali-StarkWare and YairVaknin-starkware).
crates/cairo-program-runner-lib/src/hints/types.rs line 571 at r3 (raw file):
/// (the leaf's hashed output and each fold's circuit output) bottom-up from the preimages. #[derive(Debug, Clone, PartialEq, Deserialize)] pub enum PackedNode {
enum PackedNode already appears in stwo_run_and_prove_recursive_tree crate.
isn't there a shared location where you can define it?
(is this temporary until you'll merge both PR stacks?)
OmriEshhar1
left a comment
There was a problem hiding this comment.
@OmriEshhar1 reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on Gali-StarkWare and YairVaknin-starkware).
YairVaknin-starkware
left a comment
There was a problem hiding this comment.
@YairVaknin-starkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on Gali-StarkWare and OmriEshhar1).
crates/cairo-program-runner-lib/src/hints/types.rs line 571 at r3 (raw file):
Previously, OmriEshhar1 wrote…
enum PackedNode already appears in stwo_run_and_prove_recursive_tree crate.
isn't there a shared location where you can define it?
(is this temporary until you'll merge both PR stacks?)
Yes, basically until the first is merged. Didn't want to build 2 stacks on a commit that isn't on main.
OmriEshhar1
left a comment
There was a problem hiding this comment.
@OmriEshhar1 resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on Gali-StarkWare).

Implements the hints of the circuit-unpacking applicative bootloader and its circuit-tree unpacker (
starkware/cairo/bootloaders/circuit_applicative_bootloader/, added on the main-repo side):LOAD_CIRCUIT_APPLICATIVE_BOOTLOADER_INPUT,CIRCUIT_APPLICATIVE_SETUP_VERIFIER_RUN(single-task simple bootloader runs for the aggregator and the circuit verifier, saving/restoring the applicative output builtin state), andCIRCUIT_APPLICATIVE_SETUP_UNPACK(builds the unpacker's supported-roots config in Cairo memory and enters the packed-output root node scope).CIRCUIT_UNPACK_*): tree navigation via nested node scopes, leaf data reveal, nine-bit limb splitting, andSET_ROOT_INDEX— each packed node carries its proof's preprocessed root, which the hint locates in the supported-roots list (read back from Cairo memory, matched across all eight words), keeping the hints role-agnostic.CIRCUIT_APPLICATIVE_WRITE_FACT_TOPOLOGY: the final fact topology (the aggregator's, page 0 resized for the removed tasks output and the added two-felt header).The wire types mirror the recursive tree prover's:
PackedNode(externally tagged, one node per hash layer, see proving-utils #392) andCircuitApplicativeBootloaderInput. All hints are unit-tested; the full flow is exercised by the main-repo bootloader flow test.Stack (3/3): aggregator scope var (#393) ← mock verifier hint (#394) ← this.
🤖 Generated with Claude Code
This change is