|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Structural comparison between ACIR-level and circuit-level connected components. More...
#include <components_check.hpp>
Public Member Functions | |
| ComponentsChecker_ (const Acir::Circuit &acir_circuit, Builder &builder) | |
| std::vector< Error > | check () |
| Run the full check. Returns list of errors (empty = pass). | |
Private Member Functions | |
| void | build_acir_component_map () |
| Build ACIR-level witness → component mapping. | |
| void | build_circuit_component_map () |
| Build circuit-level witness → component mapping. Runs the static analyzer, then classifies each ACIR witness as: | |
| std::vector< Error > | compare_components () const |
| Compare the two maps structurally. | |
| std::string | format_witness_debug (uint32_t witness_idx) const |
| Format details about an unconstrained witness for error reporting. | |
Private Attributes | |
| const Acir::Circuit & | acir_circuit_ |
| Builder & | builder_ |
| std::unordered_map< uint32_t, size_t > | acir_witness_map_ |
ACIR witness index → id of its connected component in AcirGraph. | |
| std::unordered_map< uint32_t, size_t > | circuit_witness_map_ |
| std::unordered_map< uint32_t, size_t > | circuit_var_to_cc_ |
| Real circuit variable index → connected component id from the static analyzer. | |
| std::unordered_set< uint32_t > | constant_var_set_ |
builder.constant_variable_indices: real variables that represent compile-time constants. | |
| std::unordered_set< uint32_t > | range_list_vars_ |
Real variables referenced from builder.range_lists (delta-range / lookup plumbing). | |
| std::unordered_map< uint32_t, size_t > | gate_counts_ |
| Per-variable gate participation counts from the analyzer (detects singletons). | |
Structural comparison between ACIR-level and circuit-level connected components.
Verifies that every pair of ACIR witnesses in the same ACIR component maps to the same circuit component. Detects two kinds of errors:
Templated on Builder (typically bb::UltraCircuitBuilder or bb::MegaCircuitBuilder). The builder type must expose real_variable_index, range_lists, and constant_variable_indices (both Ultra and Mega satisfy this since MegaCircuitBuilder_ inherits from UltraCircuitBuilder_).
The constructor takes the raw Acir::Circuit used for AcirGraph and the builder produced by create_circuit for the same program; both must stay valid through check().
Definition at line 64 of file components_check.hpp.
|
inline |
Definition at line 66 of file components_check.hpp.
|
private |
Build ACIR-level witness → component mapping.
Definition at line 21 of file components_check.cpp.
|
private |
Build circuit-level witness → component mapping. Runs the static analyzer, then classifies each ACIR witness as:
Definition at line 28 of file components_check.cpp.
| std::vector< Error > acir_components_check::ComponentsChecker_< Builder >::check | ( | ) |
Run the full check. Returns list of errors (empty = pass).
Definition at line 14 of file components_check.cpp.
|
private |
Compare the two maps structurally.
Definition at line 100 of file components_check.cpp.
|
private |
Format details about an unconstrained witness for error reporting.
Definition at line 152 of file components_check.cpp.
|
private |
Definition at line 77 of file components_check.hpp.
|
private |
ACIR witness index → id of its connected component in AcirGraph.
Definition at line 81 of file components_check.hpp.
|
private |
Definition at line 78 of file components_check.hpp.
|
private |
Real circuit variable index → connected component id from the static analyzer.
Definition at line 88 of file components_check.hpp.
|
private |
ACIR witness index → circuit-side component id (real CC from analyzer, virtual id for constants/singletons, or sentinel meaning "no circuit role" — see .cpp).
Definition at line 85 of file components_check.hpp.
|
private |
builder.constant_variable_indices: real variables that represent compile-time constants.
Definition at line 91 of file components_check.hpp.
|
private |
Per-variable gate participation counts from the analyzer (detects singletons).
Definition at line 97 of file components_check.hpp.
|
private |
Real variables referenced from builder.range_lists (delta-range / lookup plumbing).
Definition at line 94 of file components_check.hpp.