Skip to main content

zerostyl-debug

zerostyl-debug inspects circuits and validates witnesses. Its core command runs the halo2 MockProver against a witness and reports exactly which constraint fails, in which region — far more readably than bare halo2 — so you can catch mistakes before generating a real proof.


Synopsis

zerostyl-debug <COMMAND> [OPTIONS]
CommandPurpose
inspectCircuit structure: columns, gates, degree, k
schemaExpected witness schema and a copy-pastable template
debugRun the MockProver against a witness and surface failing constraints
witnessPretty-print a witness file alongside the circuit's schema

The --circuit value must be a registered circuit: example, state_mask, tx_privacy, or private_vote.


debug

zerostyl-debug debug --circuit <CIRCUIT> --witnesses <FILE> [--k <K>] [--format <FORMAT>]
FlagShortDefaultDescription
--circuit-cCircuit name (required)
--witnesses-wPath to the witness JSON file (required)
--k-kcircuit defaultOverride the circuit size parameter k
--format-ftextOutput format: text or json
zerostyl-debug debug --circuit state_mask --witnesses state_mask.json
=== Debug Report: state_mask ===

Circuit: state_mask k=10

Result: ALL CONSTRAINTS SATISFIED

When a constraint fails, the report lists each failure with its region and column:

Result: 2 FAILURE(S)

--- Failure 1 [permutation] ---
Region: in Region 17 ('range check 16 bits') at offset 16
Column: Column('Advice', 4)
Details: Equality constraint not satisfied ...

The region name (here range check 16 bits) points straight at the constraint that rejected the witness.


inspect

zerostyl-debug inspect --circuit <CIRCUIT>
Circuit: state_mask
k: 10 (2^k = 1024 rows)
Columns: 20 total
advice: 11
instance: 1
fixed: 8
Selectors: 16
Max degree: 6

schema

Prints the witness schema and a template you can copy, fill, and save as <circuit>.json:

zerostyl-debug schema --circuit state_mask

witness

Pretty-prints a witness file next to the circuit's schema, so you can confirm each field is present and well-typed before proving:

zerostyl-debug witness --circuit state_mask --witnesses state_mask.json