2#include "barretenberg/commitment_schemes/commitment_key.hpp"
3#include "barretenberg/commitment_schemes/kzg/kzg.hpp"
4#include "barretenberg/ecc/curves/bn254/g1.hpp"
6#include "barretenberg/flavor/flavor_macros.hpp"
7#include "barretenberg/flavor/ultra.hpp"
8#include "barretenberg/polynomials/barycentric.hpp"
9#include "barretenberg/polynomials/evaluation_domain.hpp"
10#include "barretenberg/polynomials/polynomial.hpp"
11#include "barretenberg/polynomials/univariate.hpp"
12#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
13#include "barretenberg/relations/auxiliary_relation.hpp"
14#include "barretenberg/relations/elliptic_relation.hpp"
15#include "barretenberg/relations/gen_perm_sort_relation.hpp"
16#include "barretenberg/relations/lookup_relation.hpp"
17#include "barretenberg/relations/permutation_relation.hpp"
18#include "barretenberg/relations/ultra_arithmetic_relation.hpp"
19#include "barretenberg/srs/factories/crs_factory.hpp"
20#include "barretenberg/stdlib/recursion/honk/transcript/transcript.hpp"
21#include "barretenberg/transcript/transcript.hpp"
30#include "barretenberg/stdlib/primitives/curves/bn254.hpp"
31#include "barretenberg/stdlib/primitives/field/field.hpp"
33namespace proof_system::honk::flavor {
51 using CircuitBuilder = BuilderType;
62 static constexpr size_t NUM_WIRES = flavor::Ultra::NUM_WIRES;
66 static constexpr size_t NUM_ALL_ENTITIES = 43;
69 static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 25;
71 static constexpr size_t NUM_WITNESS_ENTITIES = 7;
74 using Relations = std::tuple<proof_system::UltraArithmeticRelation<FF>,
81 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
86 static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = MAX_PARTIAL_RELATION_LENGTH + 1;
87 static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;
90 using SumcheckTupleOfTuplesOfUnivariates =
decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
91 using TupleOfArraysOfValues =
decltype(create_tuple_of_arrays_of_values<Relations>());
94 template <
typename DataType>
101 DEFINE_FLAVOR_MEMBERS(DataType,
130 return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, q_elliptic, q_aux, q_lookup };
132 RefVector<DataType> get_sigma_polynomials() {
return { sigma_1, sigma_2, sigma_3, sigma_4 }; };
135 RefVector<DataType> get_table_polynomials() {
return { table_1, table_2, table_3, table_4 }; };
142 template <
typename DataType>
class WitnessEntities {
144 DEFINE_FLAVOR_MEMBERS(DataType,
167 template <
typename DataType>
class AllEntities {
169 DEFINE_FLAVOR_MEMBERS(DataType,
219 return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort,
220 q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1,
221 id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first,
222 lagrange_last, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup
228 return { table_1, table_2, table_3, table_4, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup };
232 return { table_1_shift, table_2_shift, table_3_shift, table_4_shift, w_l_shift, w_r_shift,
233 w_o_shift, w_4_shift, sorted_accum_shift, z_perm_shift, z_lookup_shift };
254 VerificationKey(CircuitBuilder* builder,
const std::shared_ptr<NativeVerificationKey>& native_key)
255 :
VerificationKey_<PrecomputedEntities<Commitment>>(native_key->circuit_size, native_key->num_public_inputs)
257 this->q_m = Commitment::from_witness(builder, native_key->q_m);
258 this->q_l = Commitment::from_witness(builder, native_key->q_l);
259 this->q_r = Commitment::from_witness(builder, native_key->q_r);
260 this->q_o = Commitment::from_witness(builder, native_key->q_o);
261 this->q_4 = Commitment::from_witness(builder, native_key->q_4);
262 this->q_c = Commitment::from_witness(builder, native_key->q_c);
263 this->q_arith = Commitment::from_witness(builder, native_key->q_arith);
264 this->q_sort = Commitment::from_witness(builder, native_key->q_sort);
265 this->q_elliptic = Commitment::from_witness(builder, native_key->q_elliptic);
266 this->q_aux = Commitment::from_witness(builder, native_key->q_aux);
267 this->q_lookup = Commitment::from_witness(builder, native_key->q_lookup);
268 this->sigma_1 = Commitment::from_witness(builder, native_key->sigma_1);
269 this->sigma_2 = Commitment::from_witness(builder, native_key->sigma_2);
270 this->sigma_3 = Commitment::from_witness(builder, native_key->sigma_3);
271 this->sigma_4 = Commitment::from_witness(builder, native_key->sigma_4);
272 this->id_1 = Commitment::from_witness(builder, native_key->id_1);
273 this->id_2 = Commitment::from_witness(builder, native_key->id_2);
274 this->id_3 = Commitment::from_witness(builder, native_key->id_3);
275 this->id_4 = Commitment::from_witness(builder, native_key->id_4);
276 this->table_1 = Commitment::from_witness(builder, native_key->table_1);
277 this->table_2 = Commitment::from_witness(builder, native_key->table_2);
278 this->table_3 = Commitment::from_witness(builder, native_key->table_3);
279 this->table_4 = Commitment::from_witness(builder, native_key->table_4);
280 this->lagrange_first = Commitment::from_witness(builder, native_key->lagrange_first);
281 this->lagrange_last = Commitment::from_witness(builder, native_key->lagrange_last);
291 using Base = AllEntities<FF>;
293 AllValues(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
310 this->z_perm =
"Z_PERM";
311 this->z_lookup =
"Z_LOOKUP";
312 this->sorted_accum =
"SORTED_ACCUM";
321 this->q_arith =
"__Q_ARITH";
322 this->q_sort =
"__Q_SORT";
323 this->q_elliptic =
"__Q_ELLIPTIC";
324 this->q_aux =
"__Q_AUX";
325 this->q_lookup =
"__Q_LOOKUP";
326 this->sigma_1 =
"__SIGMA_1";
327 this->sigma_2 =
"__SIGMA_2";
328 this->sigma_3 =
"__SIGMA_3";
329 this->sigma_4 =
"__SIGMA_4";
330 this->id_1 =
"__ID_1";
331 this->id_2 =
"__ID_2";
332 this->id_3 =
"__ID_3";
333 this->id_4 =
"__ID_4";
334 this->table_1 =
"__TABLE_1";
335 this->table_2 =
"__TABLE_2";
336 this->table_3 =
"__TABLE_3";
337 this->table_4 =
"__TABLE_4";
338 this->lagrange_first =
"__LAGRANGE_FIRST";
339 this->lagrange_last =
"__LAGRANGE_LAST";
347 this->q_m = verification_key->q_m;
348 this->q_l = verification_key->q_l;
349 this->q_r = verification_key->q_r;
350 this->q_o = verification_key->q_o;
351 this->q_4 = verification_key->q_4;
352 this->q_c = verification_key->q_c;
353 this->q_arith = verification_key->q_arith;
354 this->q_sort = verification_key->q_sort;
355 this->q_elliptic = verification_key->q_elliptic;
356 this->q_aux = verification_key->q_aux;
357 this->q_lookup = verification_key->q_lookup;
358 this->sigma_1 = verification_key->sigma_1;
359 this->sigma_2 = verification_key->sigma_2;
360 this->sigma_3 = verification_key->sigma_3;
361 this->sigma_4 = verification_key->sigma_4;
362 this->id_1 = verification_key->id_1;
363 this->id_2 = verification_key->id_2;
364 this->id_3 = verification_key->id_3;
365 this->id_4 = verification_key->id_4;
366 this->table_1 = verification_key->table_1;
367 this->table_2 = verification_key->table_2;
368 this->table_3 = verification_key->table_3;
369 this->table_4 = verification_key->table_4;
370 this->lagrange_first = verification_key->lagrange_first;
371 this->lagrange_last = verification_key->lagrange_last;
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
Definition: ref_vector.hpp:20
The templates defined herein facilitate sharing the relation arithmetic between the prover and the ve...
Definition: relation_types.hpp:121
Base class template containing circuit-specifying data.
Definition: flavor.hpp:85
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
Definition: ultra_recursive.hpp:289
A container for commitment labels.
Definition: ultra_recursive.hpp:302
The verification key is responsible for storing the the commitments to the precomputed (non-witnessk)...
Definition: ultra_recursive.hpp:246
VerificationKey(CircuitBuilder *builder, const std::shared_ptr< NativeVerificationKey > &native_key)
Construct a new Verification Key with stdlib types from a provided native verification key.
Definition: ultra_recursive.hpp:254
Definition: ultra_recursive.hpp:343
The recursive counterpart to the "native" Ultra flavor.
Definition: ultra_recursive.hpp:49
VerificationKey_< PrecomputedEntities< Commitment > > VerificationKey
The verification key is responsible for storing the the commitments to the precomputed (non-witnessk)...
Definition: ultra.hpp:290
Definition: verification_key.hpp:25
Definition: biggroup.hpp:22
Definition: transcript.hpp:17
Base class templates for structures that contain data parameterized by the fundamental polynomials of...