circuit_unpacker: dummy-leaf support for non-power-of-two N#359
circuit_unpacker: dummy-leaf support for non-power-of-two N#359anatgstarkware wants to merge 1 commit into
Conversation
PR SummaryMedium Risk Overview The previous power-of-two-only path and documentation about precomputed dummy-subtree hashes (skipping recursion into dummy subtrees) are replaced: dummy slots are now ordinary leaves in Tests add Reviewed by Cursor Bugbot for commit 3ddf623. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## anatg/unpacker_impl_test1 #359 +/- ##
=============================================================
+ Coverage 59.43% 59.56% +0.12%
=============================================================
Files 36 36
Lines 5367 5366 -1
=============================================================
+ Hits 3190 3196 +6
+ Misses 2177 2170 -7
🚀 New features to boost your workflow:
|
72d9fee to
11cff94
Compare
dc9e591 to
df33de0
Compare
4ce8cdc to
0aa5854
Compare
run_unpacker right-pads hints.leaf_outputs with dummy_leaf_output() up to next_power_of_2(N) before driving the recursion, then truncates the returned Vec<Vec<Var>> back to N entries. Dummy slots are indistinguishable from real leaves to compute_subtree_hash: their constant output is guessed into the circuit and Blake-bound like any other leaf, so the prover cannot substitute different values without falsifying the root hash. Updates the crate-level "Dummy leaves" doc and the Cairo-unpacker comparison table to reflect the padding approach. Covered by unpacker_n3_one_dummy (N=3, N_total=4, slot 3 dummy). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0aa5854 to
a62182d
Compare
df33de0 to
3ddf623
Compare
Summary
Adds support for
Nthat isn't a power of two by right-paddinghints.leaf_outputsinternally withdummy_leaf_output()up tonext_power_of_2(N), and truncating the returnedVec<Vec<Var>>back toNentries.Dummy slots are indistinguishable from real leaves to
compute_subtree_hash: their constant output is guessed into the circuit and Blake-bound just like any other leaf, so the prover cannot substitute different values without falsifying the root hash. The crate-level "Dummy leaves" doc and the Cairo-unpacker comparison table are updated to reflect the padding approach.Covered by
unpacker_n3_one_dummy(N=3, N_total=4, slot 3 dummy).This change is