Skip to content

feat(leaf_prover): pad leaf circuit to fixed component sizes#406

Open
ilyalesokhin-starkware wants to merge 1 commit into
mainfrom
ilya/pad_leafs
Open

feat(leaf_prover): pad leaf circuit to fixed component sizes#406
ilyalesokhin-starkware wants to merge 1 commit into
mainfrom
ilya/pad_leafs

Conversation

@ilyalesokhin-starkware

@ilyalesokhin-starkware ilyalesokhin-starkware commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Replace the padding TODO in prove_leaf with a pad_to_targets call that pads each witness component of the leaf circuit up to a fixed power-of-two target, so every leaf proof has identical component sizes regardless of the program being proven.

The targets live in COMPONENT_SIZES — the next power of two of the leaf circuit's observed component sizes:

component target
eq 2^20
qm31_ops 2^23
m31_to_u32 2^20
triple_xor 2^19
blake_g_gate 2^23

These are hardcoded for now (TODO: load from file).

This change is Reviewable

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes leaf proof generation and circuit witness layout; incorrect targets could break validity or downstream verification, but scope is localized padding with fixed constants.

Overview
Leaf proofs now pad the Cairo verifier circuit to fixed witness component sizes before preprocessing and circuit proving, so different programs yield the same component dimensions (needed for multiverifier-style aggregation).

After build_fixed_cairo_circuit, prove_leaf calls pad_to_targets with DEFAULT_CONFIG_COMPONENT_SIZES in consts.rs — hardcoded powers of two for eq, qm31_ops, m31_to_u32, triple_xor, and blake_g_gate (with a TODO to load from file later). This replaces the previous padding TODO.

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

@ilyalesokhin-starkware ilyalesokhin-starkware changed the title feat(leaf_prover): pad leaf circuit to multiverifier component sizes feat(leaf_prover): pad leaf circuit to fixed component sizes Jul 22, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.85%. Comparing base (705ad6a) to head (aa83ee4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #406   +/-   ##
=======================================
  Coverage   67.85%   67.85%           
=======================================
  Files          42       42           
  Lines        5456     5457    +1     
=======================================
+ Hits         3702     3703    +1     
  Misses       1754     1754           
Files with missing lines Coverage Δ
crates/leaf_prover/src/prove_leaf.rs 97.08% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ilyalesokhin-starkware

Copy link
Copy Markdown
Contributor Author

Small PR in case #407 generates a long discussion.

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.

1 participant