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 = UltraArithmeticRelation< FF > |
using | Elliptic = EllipticRelation< FF > |
using | Memory = MemoryRelation< FF > |
using | NonNativeField = NonNativeFieldRelation< FF > |
using | DeltaRangeConstraint = DeltaRangeConstraintRelation< FF > |
using | PoseidonExternal = Poseidon2ExternalRelation< FF > |
using | PoseidonInternal = Poseidon2InternalRelation< 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. | |
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. | |
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 18 of file ultra_circuit_checker.hpp.
Definition at line 21 of file ultra_circuit_checker.hpp.
Definition at line 25 of file ultra_circuit_checker.hpp.
Definition at line 22 of file ultra_circuit_checker.hpp.
using bb::UltraCircuitChecker::FF = bb::fr |
Definition at line 20 of file ultra_circuit_checker.hpp.
|
private |
Definition at line 47 of file ultra_circuit_checker.hpp.
|
private |
Definition at line 49 of file ultra_circuit_checker.hpp.
Definition at line 23 of file ultra_circuit_checker.hpp.
Definition at line 24 of file ultra_circuit_checker.hpp.
Definition at line 28 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.
|
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 46 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 101 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 227 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 215 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 194 of file ultra_circuit_checker.cpp.
|
staticprivate |
Check whether the left and right running tag products are equal.
tag_data |
Definition at line 259 of file ultra_circuit_checker.cpp.
|
staticprivate |
Definition at line 9 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 265 of file ultra_circuit_checker.cpp.
|
staticprivate |
Copy the builder and finalize it before checking its validity.
|
staticprivate |
Definition at line 14 of file ultra_circuit_checker.cpp.