|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <ultra_circuit_checker.hpp>
Classes | |
| struct | HashFunction |
| struct | MemoryCheckData |
| Struct for managing memory record data for ensuring RAM/ROM correctness. More... | |
| struct | TagCheckData |
| Struct for managing the running tag product data for ensuring tag correctness. More... | |
Public Types | |
| using | FF = bb::fr |
| using | Arithmetic = ArithmeticRelation< FF > |
| using | BilinearBatchedEq = BilinearOrBatchedEqCheckRelation< FF > |
| using | Elliptic = EllipticRelation< FF > |
| using | Memory = MemoryRelation< FF > |
| using | NonNativeField = NonNativeFieldRelation< FF > |
| using | DeltaRangeConstraint = DeltaRangeConstraintRelation< FF > |
| using | PoseidonExternal = Poseidon2ExternalRelation< FF > |
| using | PoseidonInitialExternal = Poseidon2InitialExternalRelation< FF > |
| using | PoseidonInternal = Poseidon2InternalRelation< FF > |
| using | PoseidonQuadInternal = Poseidon2QuadInternalRelation< FF > |
| using | PoseidonQuadInternalTerminal = Poseidon2QuadInternalTerminalRelation< FF > |
| using | PoseidonTransitionEntry = Poseidon2TransitionEntryRelation< FF > |
| using | Params = RelationParameters< FF > |
Static Public Member Functions | |
| template<typename Builder > | |
| static bool | check (const Builder &builder_in) |
| Check the correctness of a circuit witness. | |
| template<typename Relation , typename Builder , typename Block > | |
| static bool | check_relation_at_row (Builder &builder, Block &block, size_t row_idx) |
Evaluate a single Relation at block's row row_idx in isolation, returning true iff every subrelation vanishes. Unlike check, which short-circuits on the first failing relation, this attributes a constraint to a specific (relation, row) pair. The builder's gates must already be emitted (no finalization). | |
Private Types | |
| using | Key = std::array< FF, 4 > |
| using | LookupHashTable = std::unordered_set< Key, HashFunction > |
Static Private Member Functions | |
| template<typename Builder > | |
| static Builder | prepare_circuit (const Builder &builder_in) |
| Copy the builder and finalize it before checking its validity. | |
| template<typename Builder > | |
| static bool | check_block (Builder &builder, auto &block, TagCheckData &tag_data, MemoryCheckData &memory_data, LookupHashTable &lookup_hash_table) |
| Checks that the provided witness satisfies all gates contained in a single execution trace block. | |
| template<typename Relation > | |
| static bool | check_relation (auto &values, auto ¶ms) |
| Check that a given relation is satisfied for the provided inputs corresponding to a single row. | |
| template<typename Memory > | |
| static bool | check_memory_relation_with_logup (auto &values, auto ¶ms, MemoryCheckData &memory_data) |
| static bool | check_lookup (auto &values, auto &lookup_hash_table) |
| Check whether the values in a lookup gate are contained within a corresponding hash table. | |
| template<typename Builder > | |
| static bool | check_databus_read (auto &values, Builder &builder) |
| Check that the {index, value} pair contained in a databus read gate reflects the actual value present in the corresponding databus column at the given index. | |
| static bool | check_tag_data (const TagCheckData &tag_data) |
| Check whether the left and right running tag products are equal. | |
| template<typename Builder > | |
| static auto | init_empty_values () |
| Helper for initializing an empty AllValues container of the right Flavor based on Builder. | |
| template<typename Builder > | |
| static void | populate_values (Builder &builder, auto &block, auto &values, TagCheckData &tag_data, MemoryCheckData &memory_data, size_t idx) |
| Populate the values required to check the correctness of a single "row" of the circuit. | |
| template<> | |
| auto | init_empty_values () |
| template<> | |
| UltraCircuitBuilder_< UltraExecutionTraceBlocks > | prepare_circuit (const UltraCircuitBuilder_< UltraExecutionTraceBlocks > &builder_in) |
Definition at line 23 of file ultra_circuit_checker.hpp.
Definition at line 26 of file ultra_circuit_checker.hpp.
Definition at line 27 of file ultra_circuit_checker.hpp.
Definition at line 31 of file ultra_circuit_checker.hpp.
Definition at line 28 of file ultra_circuit_checker.hpp.
| using bb::UltraCircuitChecker::FF = bb::fr |
Definition at line 25 of file ultra_circuit_checker.hpp.
|
private |
Definition at line 65 of file ultra_circuit_checker.hpp.
|
private |
Definition at line 67 of file ultra_circuit_checker.hpp.
Definition at line 29 of file ultra_circuit_checker.hpp.
Definition at line 30 of file ultra_circuit_checker.hpp.
Definition at line 38 of file ultra_circuit_checker.hpp.
Definition at line 32 of file ultra_circuit_checker.hpp.
Definition at line 33 of file ultra_circuit_checker.hpp.
Definition at line 34 of file ultra_circuit_checker.hpp.
Definition at line 35 of file ultra_circuit_checker.hpp.
| using bb::UltraCircuitChecker::PoseidonQuadInternalTerminal = Poseidon2QuadInternalTerminalRelation<FF> |
Definition at line 36 of file ultra_circuit_checker.hpp.
Definition at line 37 of file ultra_circuit_checker.hpp.
|
static |
Check the correctness of a circuit witness.
Ensures that all relations for a given Ultra arithmetization are satisfied by the witness for each gate in the circuit.
| Builder |
| builder |
Definition at line 51 of file ultra_circuit_checker.cpp.
|
staticprivate |
Checks that the provided witness satisfies all gates contained in a single execution trace block.
| Builder |
| builder | |
| block | |
| tag_data | |
| memory_data | |
| lookup_hash_table |
Definition at line 117 of file ultra_circuit_checker.cpp.
|
staticprivate |
Check that the {index, value} pair contained in a databus read gate reflects the actual value present in the corresponding databus column at the given index.
| values | Inputs to a databus read gate |
Definition at line 320 of file ultra_circuit_checker.cpp.
|
staticprivate |
Check whether the values in a lookup gate are contained within a corresponding hash table.
| values | Inputs to a lookup gate |
| lookup_hash_table | Preconstructed hash table representing entries of all tables in circuit |
Definition at line 308 of file ultra_circuit_checker.cpp.
|
staticprivate |
Definition at line 284 of file ultra_circuit_checker.cpp.
|
staticprivate |
Check that a given relation is satisfied for the provided inputs corresponding to a single row.
| Relation |
| values | Values of the relation inputs at a single row |
| params |
Definition at line 253 of file ultra_circuit_checker.cpp.
|
static |
Evaluate a single Relation at block's row row_idx in isolation, returning true iff every subrelation vanishes. Unlike check, which short-circuits on the first failing relation, this attributes a constraint to a specific (relation, row) pair. The builder's gates must already be emitted (no finalization).
Definition at line 239 of file ultra_circuit_checker.cpp.
|
staticprivate |
Check whether the left and right running tag products are equal.
| tag_data |
Definition at line 345 of file ultra_circuit_checker.cpp.
|
staticprivate |
Definition at line 11 of file ultra_circuit_checker.cpp.
|
staticprivate |
Helper for initializing an empty AllValues container of the right Flavor based on Builder.
We construct a Flavor::AllValues object from each row of circuit data so that we can use the Relations to check correctness. UltraFlavor is used for the Ultra builder and MegaFlavor is used for the Mega builder
| Builder |
|
staticprivate |
Populate the values required to check the correctness of a single "row" of the circuit.
Populates all wire values (plus shifts) and selectors. Updates running tag product information. Populates 4th wire with memory records (as needed).
| Builder |
| builder | |
| values | |
| tag_data | |
| idx |
Definition at line 351 of file ultra_circuit_checker.cpp.
|
staticprivate |
Copy the builder and finalize it before checking its validity.
|
staticprivate |
Definition at line 16 of file ultra_circuit_checker.cpp.