Skip to content

feat(leaf_prover): pad and validate the leaf circuit against the registry#407

Open
ilyalesokhin-starkware wants to merge 1 commit into
ilya/circuit-params-formatfrom
ilya/leaf-registry-padding
Open

feat(leaf_prover): pad and validate the leaf circuit against the registry#407
ilyalesokhin-starkware wants to merge 1 commit into
ilya/circuit-params-formatfrom
ilya/leaf-registry-padding

Conversation

@ilyalesokhin-starkware

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

Copy link
Copy Markdown
Contributor

Type

  • feature
  • bugfix
  • dev (no functional changes, no API changes)
  • fmt (formatting, renaming)
  • build
  • docs
  • testing

Description

Breaking changes?

  • yes
  • no

This change is Reviewable

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Breaking CLI/API change and proof output depends on registry correctness; wrong registry or mismatch fails at runtime via panic/assert.

Overview
leaf-prover now requires a circuit registry JSON file and uses it to pad the leaf verifier circuit and confirm the proved circuit matches a known leaf entry.

The CLI gains --circuit-registry-json. After the Cairo proof is produced, the prover resolves the leaf by trace_log_size and log_blowup_factor, pads the verifier circuit with pad_to_targets to that config’s component sizes (replacing the old multiverifier padding TODO), and asserts the circuit’s preprocessed root equals the registry’s preprocessed_root.

circuit-registry adds LogSizesComponentSizes, RootHex::to_le_bytes, and lookup helpers leaf_verifier / config_pad_target. Tests add registry.json, wire it into the slow CLI test, and add a fast registry_fixture_test that keeps the fixture aligned with expected output.

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

ilyalesokhin-starkware commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@ilyalesokhin-starkware

Copy link
Copy Markdown
Contributor Author

an alternative to #406

@ilyalesokhin-starkware
ilyalesokhin-starkware changed the base branch from ilya/circuit-params-format to graphite-base/407 July 23, 2026 06:46
…stry

Pad the leaf verifier circuit to a target read from a circuit registry rather
than a hardcoded constant, and validate the result against the registry.

`prove_leaf` takes a `&CircuitRegistry`: it looks up the leaf verifier for the
verified Cairo proof's (trace_log_size, log_blowup_factor), pads the verifier
circuit to that entry's config component sizes, and after proving asserts the
circuit's preprocessed root equals the entry's root. A leaf not listed in the
registry (or whose root differs) is rejected. The `leaf-prover` binary gains a
required `--circuit-registry-json` argument.

Adds `CircuitRegistry::leaf_verifier` / `config_pad_target`, the
`LogSizes -> ComponentSizes` conversion and `RootHex::to_le_bytes` to
`circuit-registry`, plus a fast fixture test; the slow e2e `cli_test` passes a
registry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ilyalesokhin-starkware
ilyalesokhin-starkware force-pushed the ilya/leaf-registry-padding branch from 7efc4c4 to 52e86fa Compare July 23, 2026 06:46
@ilyalesokhin-starkware
ilyalesokhin-starkware changed the base branch from graphite-base/407 to ilya/circuit-params-format July 23, 2026 06:46
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