Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
translator_circuit_checker.hpp
Go to the documentation of this file.
1#pragma once
8namespace bb {
12 using Fr = Flavor::FF;
13 using Fq = Flavor::BF;
17
18 // Number of limbs used to decompose a 254-bit value for modular arithmetic
20
21 static constexpr size_t RESULT_ROW = Builder::RESULT_ROW;
22
23 public:
25
30 static Fq get_computation_result(const Builder& circuit)
31 {
33 return Fq(
34 circuit.get_variable(circuit.wires[WireIds::ACCUMULATORS_BINARY_LIMBS_0][RESULT_ROW]) +
35 circuit.get_variable(circuit.wires[WireIds::ACCUMULATORS_BINARY_LIMBS_1][RESULT_ROW]) * Builder::SHIFT_1 +
36 circuit.get_variable(circuit.wires[WireIds::ACCUMULATORS_BINARY_LIMBS_2][RESULT_ROW]) * Builder::SHIFT_2 +
37 circuit.get_variable(circuit.wires[WireIds::ACCUMULATORS_BINARY_LIMBS_3][RESULT_ROW]) * Builder::SHIFT_3);
38 }
39
53 static bool check(const Builder& circuit);
54
55 private:
62 static Params compute_relation_params(const Builder& circuit);
63
70 static void populate_values(const Builder& circuit, AllValues& values, size_t row_idx);
71
77 template <typename Relation> static bool check_relation(const AllValues& values, const Params& params)
78 {
80 for (auto& e : evals) {
81 e = Fr(0);
82 }
83 Relation::accumulate(evals, values, params, Fr(1));
84 for (auto& e : evals) {
85 if (e != Fr(0)) {
86 return false;
87 }
88 }
89 return true;
90 }
91};
92} // namespace bb
#define BB_ASSERT_GT(left, right,...)
Definition assert.hpp:113
FF get_variable(const uint32_t index) const
Get the value of the variable v_{index}.
ArrayOfValues< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckArrayOfValuesOverSubrelations
TranslatorCircuitBuilder creates a circuit that evaluates the correctness of the evaluation of EccOpQ...
WireIds
There are so many wires that naming them has no sense, it is easier to access them with enums.
std::array< std::vector< uint32_t >, NUM_WIRES > wires
static void populate_values(const Builder &circuit, AllValues &values, size_t row_idx)
Populate an AllValues struct for a single row of the circuit.
static Fq get_computation_result(const Builder &circuit)
Get the result of accumulation, stored as 4 binary limbs in the first row of the circuit.
static Params compute_relation_params(const Builder &circuit)
Build the RelationParameters from the circuit's public inputs.
static bool check_relation(const AllValues &values, const Params &params)
Check that a given relation evaluates to zero for the provided row values.
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
Curve::ScalarField FF
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
Container for parameters used by the grand product (permutation, lookup) Honk relations.