Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"crates/vm_runner",
"crates/privacy_prove",
"crates/privacy_circuit_verify",
"crates/circuit_registry",
"crates/circuit_params",
]
resolver = "2"
Expand Down Expand Up @@ -85,6 +86,7 @@ circuits = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "7bb

# local crates
cairo-program-runner-lib = { path = "crates/cairo-program-runner-lib", version = "1.0.0" }
circuit-registry = { path = "crates/circuit_registry" }
leaf-prover = { path = "crates/leaf_prover" }
leaf-proof-format = { path = "crates/leaf_proof_format" }
privacy-circuit-verify = { path = "crates/privacy_circuit_verify", version = "1.0.0" }
Expand Down
6 changes: 6 additions & 0 deletions crates/circuit_params/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ edition.workspace = true
license.workspace = true
description = "Compute the leaf-prover verifier circuit's per-component sizes for a range of trace sizes"

[features]
# Gates the json CLI test, which builds and Merkle-commits a large preprocessed trace.
slow-tests = []

[dependencies]
clap.workspace = true
indexmap = { version = "2.10.0", default-features = false, features = ["std"] }
serde_json.workspace = true

circuit-registry.workspace = true
leaf-prover.workspace = true

cairo-air.workspace = true
Expand Down
58 changes: 58 additions & 0 deletions crates/circuit_params/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# circuit-params

Computes the per-component sizes of the leaf-prover verifier circuit for a range of verified trace
sizes, using the CANONICAL preprocessed trace config. It reports two circuits:

- the **leaf verifier** circuit, which verifies one Cairo proof (reported for every trace size), and
- the **multiverifier** circuit, which verifies two proofs of the leaf verifier circuit (reported
once, for the largest trace size).

Entry point: `crates/circuit_params/src/main.rs`

## Build & run

cargo run -p circuit-params -- --help

## Usage

Required flags:

- `--min_trace_log_size <N>`: smallest verified trace log size to measure (inclusive). A canonical
Cairo trace commits its preprocessed sequence columns at `MAX_SEQUENCE_LOG_SIZE = 25`, so a real
canonical leaf proof has `log_trace_size >= 25`.
- `--max_trace_log_size <N>`: largest verified trace log size to measure (inclusive).

Optional:

- `--log_blowup_factor <N>`: log blowup factor of the verified Cairo proof (1, 2, or 3, default 1).
- `--registry`: output a JSON circuit registry (see below). If omitted, prints the human-readable
report instead.
- `--output_path <PATH>`: file to write the output to. Prints to stdout if omitted.

Example:

cargo run -p circuit-params -- \
--min_trace_log_size 25 \
--max_trace_log_size 25 \
--registry \
--output_path /abs/path/to/params.json

## Output formats

### Default (human-readable)

One line per circuit and trace size, giving each AIR component's padded log size and its usage
percentage (how much of the padded power-of-two component is actually used).

Can be used to choose circuit configurations and to find components whose size can be reduced.

### `--registry` (JSON)

A JSON circuit registry, with three top-level fields:

- `circuit_configs`: a map from a config id (a string) to a config — its `log_blowup_factor`
and padded `component_log_sizes`. Circuits sharing a config produce proofs a common AIR can verify.
- `leaf_verifiers`: the leaf verifier circuits, each referencing its `config` (by id), its
`trace_log_size`, the verified proof's `log_blowup_factor`, and its `preprocessed_root`.
- `multiverifiers`: the multiverifier circuits, each referencing its own `config` (by id), the
`input_configs` (by id) of the circuits whose proofs it verifies, and its `preprocessed_root`.
Loading
Loading