Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
translator_flavor.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8
27
28namespace bb {
29
31
32 public:
35 using PCS = KZG<Curve>;
44
45 // indicates when evaluating sumcheck, edges must be extended to be MAX_TOTAL_RELATION_LENGTH
46 static constexpr bool USE_SHORT_MONOMIALS = false;
47
48 // Indicates that this flavor runs with ZK Sumcheck.
49 static constexpr bool HasZK = true;
50 // Translator proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
51 static constexpr bool USE_PADDING = false;
52 // Important: these constants cannot be arbitrarily changed - please consult with a member of the Crypto team if
53 // they become too small.
54
55 // None of this parameters can be changed
56 // Number of wires representing the op queue whose commitments are going to be checked against those from the
57 // final round of merge
58 static constexpr size_t NUM_OP_QUEUE_WIRES = 4;
59
60 // How many mini_circuit_size polynomials are interleaved in one interleaved_*
61 static constexpr size_t INTERLEAVING_GROUP_SIZE = 16;
62
63 // The fixed log size of Translator circuit determining the size most polynomials (except the ones
64 // involved in the interleaving subprotocol). It should be determined by the size of the EccOpQueue.
65 static constexpr size_t LOG_MINI_CIRCUIT_SIZE = 14;
66
67 // Log of size of interleaved_* and ordered_* polynomials
69
70 // For the translator, the genuine and virtual log circuit size coincide
71 static constexpr size_t VIRTUAL_LOG_N = CONST_TRANSLATOR_LOG_N;
72
73 static constexpr size_t MINI_CIRCUIT_SIZE = 1UL << LOG_MINI_CIRCUIT_SIZE;
74
75 // The number of interleaved_* wires
76 static constexpr size_t NUM_INTERLEAVED_WIRES = 4;
77
78 // The step in the DeltaRangeConstraint relation i.e. the maximum difference between two consecutive values
79 static constexpr size_t SORT_STEP = 3;
80
81 // Number of wires
82 static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
83
84 // The result of evaluating the polynomials in the nonnative form in translator circuit, stored as limbs and
85 // referred to as accumulated_result. This is reconstructed in it's base field form and sent to the verifier
86 // responsible for checking it against the evaluations received from ECCVM.
87 static constexpr size_t RESULT_ROW = CircuitBuilder::RESULT_ROW;
88
89 // The bitness of the range constraint
91
92 // The number of "steps" inserted in ordered range constraint polynomials to ensure that the
93 // DeltaRangeConstraintRelation can always be satisfied if the polynomial is within the appropriate range.
94 static constexpr size_t SORTED_STEPS_COUNT = (1 << MICRO_LIMB_BITS) / SORT_STEP + 1;
96 "Translator circuit is too small for defined number of steps "
97 "(TranslatorDeltaRangeConstraintRelation). ");
98
99 // The limbs of the modulus we are emulating in the goblin translator. 4 binary 68-bit limbs and the prime one
101 {
103 }
104
105 // Number of bits in a binary limb
106 // This is not a configurable value. Relations are sepcifically designed for it to be 68
108
109 // Lowest possible size of the Translator mini circuit due to the desing of range constraints.
110 static constexpr size_t MINIMUM_MINI_CIRCUIT_SIZE = 2048;
112
113 // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We
114 // often need containers of this size to hold related data, so we choose a name more agnostic than
115 // `NUM_POLYNOMIALS`. Note: this number does not include the individual sorted list polynomials.
116 static constexpr size_t NUM_ALL_ENTITIES = 187;
117 // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying
118 // assignment of witnesses. We again choose a neutral name.
119 static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 10;
120 // The total number of witness entities not including shifts.
121 static constexpr size_t NUM_WITNESS_ENTITIES = 91;
122 static constexpr size_t NUM_WIRES_NON_SHIFTED = 1;
123 static constexpr size_t NUM_SHIFTED_WITNESSES = 86;
125 // Number of elements in WireToBeShiftedWithoutConcatenated
127 // The index of the first unshifted witness that is going to be shifted when AllEntities are partitioned into
128 // get_unshifted_without_interleaved(), get_to_be_shifted(), and get_groups_to_be_interleaved()
130 // The index of the shift of the first to be shifted witness
132 // The index of the first unshifted witness that is contained in the groups to be interleaved, when AllEntities are
133 // partitioned into get_unshifted_without_interleaved(), get_to_be_shifted(), and get_groups_to_be_interleaved()
134 static constexpr size_t TO_BE_INTERLEAVED_START =
136 // The index of the first interleaving groups element inside AllEntities
138 // A container to be fed to ShpleminiVerifier to avoid redundant scalar muls
147 // define the tuple of Relations that comprise the Sumcheck relation
148 template <typename FF>
157
158 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
159 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
160
161 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
162 static constexpr size_t MAX_TOTAL_RELATION_LENGTH = compute_max_total_relation_length<Relations>();
163
164 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
165 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
166 // length = 3.
167 // The degree has to be further increased because the relation is multiplied by the Row Disabling Polynomial
170 "LIBRA_UNIVARIATES_LENGTH must be equal to Translator::BATCHED_RELATION_PARTIAL_LENGTH");
172
173 static constexpr size_t num_frs_comm = bb::field_conversion::calc_num_bn254_frs<Commitment>();
174 static constexpr size_t num_frs_fr = bb::field_conversion::calc_num_bn254_frs<FF>();
175 static constexpr size_t num_frs_fq = bb::field_conversion::calc_num_bn254_frs<BF>();
176
177 // Proof length formula
178 static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS =
179 /* 1. accumulated_result */ (num_frs_fq) +
180 /* 1. NUM_WITNESS_ENTITIES commitments */ ((NUM_WITNESS_ENTITIES - 4) * num_frs_comm) +
181 /* 2. Libra concatenation commitment*/ (num_frs_comm) +
182 /* 3. Libra sum */ (num_frs_fr) +
183 /* 4. CONST_TRANSLATOR_LOG_N sumcheck univariates */
185 /* 5. NUM_ALL_ENTITIES sumcheck evaluations*/ (NUM_ALL_ENTITIES * num_frs_fr) +
186 /* 6. Libra claimed evaluation */ (num_frs_fr) +
187 /* 7. Libra grand sum commitment */ (num_frs_comm) +
188 /* 8. Libra quotient commitment */ (num_frs_comm) +
189 /* 9. Gemini masking commitment */ (num_frs_comm) +
190 /* 10. Gemini masking evaluation */ (num_frs_fr) +
191 /* 11. CONST_TRANSLATOR_LOG_N - 1 Gemini Fold commitments */
193 /* 12. CONST_TRANSLATOR_LOG_N Gemini a evaluations */
195 /* 13. Gemini P pos evaluation */ (num_frs_fr) +
196 /* 14. Gemini P neg evaluation */ (num_frs_fr) +
197 /* 15. NUM_SMALL_IPA_EVALUATIONS libra evals */ (NUM_SMALL_IPA_EVALUATIONS * num_frs_fr) +
198 /* 16. Shplonk Q commitment */ (num_frs_comm) +
199 /* 17. KZG W commitment */ (num_frs_comm);
200
205 template <typename DataType_> class PrecomputedEntities {
206 public:
207 bool operator==(const PrecomputedEntities& other) const = default;
208 using DataType = DataType_;
210 ordered_extra_range_constraints_numerator, // column 0
211 lagrange_first, // column 1
212 lagrange_last, // column 2
213 // TODO(https://github.com/AztecProtocol/barretenberg/issues/758): Check if one of these
214 // can be replaced by shifts
215 lagrange_odd_in_minicircuit, // column 3
216 lagrange_even_in_minicircuit, // column 4
217 lagrange_result_row, // column 5
218 lagrange_last_in_minicircuit, // column 6
219 lagrange_masking, // column 7
220 lagrange_mini_masking, // column 8
221 lagrange_real_last); // column 9
222 };
223
224 template <typename DataType> class InterleavedRangeConstraints {
225 public:
226 DEFINE_FLAVOR_MEMBERS(DataType,
227 interleaved_range_constraints_0, // column 0
228 interleaved_range_constraints_1, // column 1
229 interleaved_range_constraints_2, // column 2
230 interleaved_range_constraints_3) // column 3
231 };
232 template <typename DataType> class WireToBeShiftedEntities {
233 public:
235 x_lo_y_hi, // column 0
236 x_hi_z_1, // column 1
237 y_lo_z_2, // column 2
238 p_x_low_limbs, // column 3
239 p_x_high_limbs, // column 4
240 p_y_low_limbs, // column 5
241 p_y_high_limbs, // column 6
242 z_low_limbs, // column 7
243 z_high_limbs, // column 8
244 accumulators_binary_limbs_0, // column 9
245 accumulators_binary_limbs_1, // column 10
246 accumulators_binary_limbs_2, // column 11
247 accumulators_binary_limbs_3, // column 12
248 quotient_low_binary_limbs, // column 13
249 quotient_high_binary_limbs, // column 14
250 relation_wide_limbs, // column 15
251 p_x_low_limbs_range_constraint_0, // column 16
252 p_x_low_limbs_range_constraint_1, // column 17
253 p_x_low_limbs_range_constraint_2, // column 18
254 p_x_low_limbs_range_constraint_3, // column 19
255 p_x_low_limbs_range_constraint_4, // column 20
256 p_x_low_limbs_range_constraint_tail, // column 21
257 p_x_high_limbs_range_constraint_0, // column 22
258 p_x_high_limbs_range_constraint_1, // column 23
259 p_x_high_limbs_range_constraint_2, // column 24
260 p_x_high_limbs_range_constraint_3, // column 25
261 p_x_high_limbs_range_constraint_4, // column 26
262 p_x_high_limbs_range_constraint_tail, // column 27
263 p_y_low_limbs_range_constraint_0, // column 28
264 p_y_low_limbs_range_constraint_1, // column 29
265 p_y_low_limbs_range_constraint_2, // column 30
266 p_y_low_limbs_range_constraint_3, // column 31
267 p_y_low_limbs_range_constraint_4, // column 32
268 p_y_low_limbs_range_constraint_tail, // column 33
269 p_y_high_limbs_range_constraint_0, // column 34
270 p_y_high_limbs_range_constraint_1, // column 35
271 p_y_high_limbs_range_constraint_2, // column 36
272 p_y_high_limbs_range_constraint_3, // column 37
273 p_y_high_limbs_range_constraint_4, // column 38
274 p_y_high_limbs_range_constraint_tail, // column 39
275 z_low_limbs_range_constraint_0, // column 40
276 z_low_limbs_range_constraint_1, // column 41
277 z_low_limbs_range_constraint_2, // column 42
278 z_low_limbs_range_constraint_3, // column 43
279 z_low_limbs_range_constraint_4, // column 44
280 z_low_limbs_range_constraint_tail, // column 45
281 z_high_limbs_range_constraint_0, // column 46
282 z_high_limbs_range_constraint_1, // column 47
283 z_high_limbs_range_constraint_2, // column 48
284 z_high_limbs_range_constraint_3, // column 49
285 z_high_limbs_range_constraint_4, // column 50
286 z_high_limbs_range_constraint_tail, // column 51
287 accumulator_low_limbs_range_constraint_0, // column 52
288 accumulator_low_limbs_range_constraint_1, // column 53
289 accumulator_low_limbs_range_constraint_2, // column 54
290 accumulator_low_limbs_range_constraint_3, // column 55
291 accumulator_low_limbs_range_constraint_4, // column 56
292 accumulator_low_limbs_range_constraint_tail, // column 57
293 accumulator_high_limbs_range_constraint_0, // column 58
294 accumulator_high_limbs_range_constraint_1, // column 59
295 accumulator_high_limbs_range_constraint_2, // column 60
296 accumulator_high_limbs_range_constraint_3, // column 61
297 accumulator_high_limbs_range_constraint_4, // column 62
298 accumulator_high_limbs_range_constraint_tail, // column 63
299 quotient_low_limbs_range_constraint_0, // column 64
300 quotient_low_limbs_range_constraint_1, // column 65
301 quotient_low_limbs_range_constraint_2, // column 66
302 quotient_low_limbs_range_constraint_3, // column 67
303 quotient_low_limbs_range_constraint_4, // column 68
304 quotient_low_limbs_range_constraint_tail, // column 69
305 quotient_high_limbs_range_constraint_0, // column 70
306 quotient_high_limbs_range_constraint_1, // column 71
307 quotient_high_limbs_range_constraint_2, // column 72
308 quotient_high_limbs_range_constraint_3, // column 73
309 quotient_high_limbs_range_constraint_4, // column 74
310 quotient_high_limbs_range_constraint_tail, // column 75
311 relation_wide_limbs_range_constraint_0, // column 76
312 relation_wide_limbs_range_constraint_1, // column 77
313 relation_wide_limbs_range_constraint_2, // column 78
314 relation_wide_limbs_range_constraint_3); // column 79
315 };
316 // TODO(https://github.com/AztecProtocol/barretenberg/issues/907)
317 // Note: These are technically derived from wires but do not depend on challenges (like z_perm). They are committed
318 // to in the wires commitment round.
319 template <typename DataType> class OrderedRangeConstraints {
320 public:
322 ordered_range_constraints_0, // column 0
323 ordered_range_constraints_1, // column 1
324 ordered_range_constraints_2, // column 2
325 ordered_range_constraints_3, // column 3
326 ordered_range_constraints_4); // column 4
327 };
328
329 template <typename DataType> class WireNonshiftedEntities {
330 public:
332 op // column 0
333 );
334 };
335 template <typename DataType> class DerivedWitnessEntities {
336 public:
338 z_perm); // column 0
339 };
343 template <typename DataType>
344 class WitnessEntities : public WireNonshiftedEntities<DataType>,
345 public WireToBeShiftedEntities<DataType>,
346 public OrderedRangeConstraints<DataType>,
347 public DerivedWitnessEntities<DataType>,
348 public InterleavedRangeConstraints<DataType> {
349 public:
365
367
377
388
397
404
409
415 {
416 return {
417 {
418 this->p_x_low_limbs_range_constraint_0,
419 this->p_x_low_limbs_range_constraint_1,
420 this->p_x_low_limbs_range_constraint_2,
421 this->p_x_low_limbs_range_constraint_3,
422 this->p_x_low_limbs_range_constraint_4,
423 this->p_x_low_limbs_range_constraint_tail,
424 this->p_x_high_limbs_range_constraint_0,
425 this->p_x_high_limbs_range_constraint_1,
426 this->p_x_high_limbs_range_constraint_2,
427 this->p_x_high_limbs_range_constraint_3,
428 this->p_x_high_limbs_range_constraint_4,
429 this->p_x_high_limbs_range_constraint_tail,
430 this->p_y_low_limbs_range_constraint_0,
431 this->p_y_low_limbs_range_constraint_1,
432 this->p_y_low_limbs_range_constraint_2,
433 this->p_y_low_limbs_range_constraint_3,
434 },
435 {
436 this->p_y_low_limbs_range_constraint_4,
437 this->p_y_low_limbs_range_constraint_tail,
438 this->p_y_high_limbs_range_constraint_0,
439 this->p_y_high_limbs_range_constraint_1,
440 this->p_y_high_limbs_range_constraint_2,
441 this->p_y_high_limbs_range_constraint_3,
442 this->p_y_high_limbs_range_constraint_4,
443 this->p_y_high_limbs_range_constraint_tail,
444 this->z_low_limbs_range_constraint_0,
445 this->z_low_limbs_range_constraint_1,
446 this->z_low_limbs_range_constraint_2,
447 this->z_low_limbs_range_constraint_3,
448 this->z_low_limbs_range_constraint_4,
449 this->z_low_limbs_range_constraint_tail,
450 this->z_high_limbs_range_constraint_0,
451 this->z_high_limbs_range_constraint_1,
452 },
453 {
454 this->z_high_limbs_range_constraint_2,
455 this->z_high_limbs_range_constraint_3,
456 this->z_high_limbs_range_constraint_4,
457 this->z_high_limbs_range_constraint_tail,
458 this->accumulator_low_limbs_range_constraint_0,
459 this->accumulator_low_limbs_range_constraint_1,
460 this->accumulator_low_limbs_range_constraint_2,
461 this->accumulator_low_limbs_range_constraint_3,
462 this->accumulator_low_limbs_range_constraint_4,
463 this->accumulator_low_limbs_range_constraint_tail,
464 this->accumulator_high_limbs_range_constraint_0,
465 this->accumulator_high_limbs_range_constraint_1,
466 this->accumulator_high_limbs_range_constraint_2,
467 this->accumulator_high_limbs_range_constraint_3,
468 this->accumulator_high_limbs_range_constraint_4,
469 this->accumulator_high_limbs_range_constraint_tail,
470 },
471 {
472 this->quotient_low_limbs_range_constraint_0,
473 this->quotient_low_limbs_range_constraint_1,
474 this->quotient_low_limbs_range_constraint_2,
475 this->quotient_low_limbs_range_constraint_3,
476 this->quotient_low_limbs_range_constraint_4,
477 this->quotient_low_limbs_range_constraint_tail,
478 this->quotient_high_limbs_range_constraint_0,
479 this->quotient_high_limbs_range_constraint_1,
480 this->quotient_high_limbs_range_constraint_2,
481 this->quotient_high_limbs_range_constraint_3,
482 this->quotient_high_limbs_range_constraint_4,
483 this->quotient_high_limbs_range_constraint_tail,
484 this->relation_wide_limbs_range_constraint_0,
485 this->relation_wide_limbs_range_constraint_1,
486 this->relation_wide_limbs_range_constraint_2,
487 this->relation_wide_limbs_range_constraint_3,
488 },
489 };
490 };
491 };
492
496 template <typename DataType> class ShiftedEntities {
497 public:
498 DEFINE_FLAVOR_MEMBERS(DataType,
499 x_lo_y_hi_shift, // column 0
500 x_hi_z_1_shift, // column 1
501 y_lo_z_2_shift, // column 2
502 p_x_low_limbs_shift, // column 3
503 p_x_high_limbs_shift, // column 10
504 p_y_low_limbs_shift, // column 17
505 p_y_high_limbs_shift, // column 24
506 z_low_limbs_shift, // column 31
507 z_high_limbs_shift, // column 38
508 accumulators_binary_limbs_0_shift, // column 45
509 accumulators_binary_limbs_1_shift, // column 46
510 accumulators_binary_limbs_2_shift, // column 47
511 accumulators_binary_limbs_3_shift, // column 48
512 quotient_low_binary_limbs_shift, // column 61
513 quotient_high_binary_limbs_shift, // column 62
514 relation_wide_limbs_shift, // column 75
515 p_x_low_limbs_range_constraint_0_shift, // column 4
516 p_x_low_limbs_range_constraint_1_shift, // column 5
517 p_x_low_limbs_range_constraint_2_shift, // column 6
518 p_x_low_limbs_range_constraint_3_shift, // column 7
519 p_x_low_limbs_range_constraint_4_shift, // column 8
520 p_x_low_limbs_range_constraint_tail_shift, // column 9
521 p_x_high_limbs_range_constraint_0_shift, // column 11
522 p_x_high_limbs_range_constraint_1_shift, // column 12
523 p_x_high_limbs_range_constraint_2_shift, // column 13
524 p_x_high_limbs_range_constraint_3_shift, // column 14
525 p_x_high_limbs_range_constraint_4_shift, // column 15
526 p_x_high_limbs_range_constraint_tail_shift, // column 16
527 p_y_low_limbs_range_constraint_0_shift, // column 18
528 p_y_low_limbs_range_constraint_1_shift, // column 19
529 p_y_low_limbs_range_constraint_2_shift, // column 20
530 p_y_low_limbs_range_constraint_3_shift, // column 21
531 p_y_low_limbs_range_constraint_4_shift, // column 22
532 p_y_low_limbs_range_constraint_tail_shift, // column 23
533 p_y_high_limbs_range_constraint_0_shift, // column 25
534 p_y_high_limbs_range_constraint_1_shift, // column 26
535 p_y_high_limbs_range_constraint_2_shift, // column 27
536 p_y_high_limbs_range_constraint_3_shift, // column 28
537 p_y_high_limbs_range_constraint_4_shift, // column 29
538 p_y_high_limbs_range_constraint_tail_shift, // column 30
539 z_low_limbs_range_constraint_0_shift, // column 32
540 z_low_limbs_range_constraint_1_shift, // column 33
541 z_low_limbs_range_constraint_2_shift, // column 34
542 z_low_limbs_range_constraint_3_shift, // column 35
543 z_low_limbs_range_constraint_4_shift, // column 36
544 z_low_limbs_range_constraint_tail_shift, // column 37
545 z_high_limbs_range_constraint_0_shift, // column 39
546 z_high_limbs_range_constraint_1_shift, // column 40
547 z_high_limbs_range_constraint_2_shift, // column 41
548 z_high_limbs_range_constraint_3_shift, // column 42
549 z_high_limbs_range_constraint_4_shift, // column 43
550 z_high_limbs_range_constraint_tail_shift, // column 44
551 accumulator_low_limbs_range_constraint_0_shift, // column 49
552 accumulator_low_limbs_range_constraint_1_shift, // column 50
553 accumulator_low_limbs_range_constraint_2_shift, // column 51
554 accumulator_low_limbs_range_constraint_3_shift, // column 52
555 accumulator_low_limbs_range_constraint_4_shift, // column 53
556 accumulator_low_limbs_range_constraint_tail_shift, // column 54
557 accumulator_high_limbs_range_constraint_0_shift, // column 55
558 accumulator_high_limbs_range_constraint_1_shift, // column 56
559 accumulator_high_limbs_range_constraint_2_shift, // column 57
560 accumulator_high_limbs_range_constraint_3_shift, // column 58
561 accumulator_high_limbs_range_constraint_4_shift, // column 59
562 accumulator_high_limbs_range_constraint_tail_shift, // column 60
563 quotient_low_limbs_range_constraint_0_shift, // column 63
564 quotient_low_limbs_range_constraint_1_shift, // column 64
565 quotient_low_limbs_range_constraint_2_shift, // column 65
566 quotient_low_limbs_range_constraint_3_shift, // column 66
567 quotient_low_limbs_range_constraint_4_shift, // column 67
568 quotient_low_limbs_range_constraint_tail_shift, // column 68
569 quotient_high_limbs_range_constraint_0_shift, // column 69
570 quotient_high_limbs_range_constraint_1_shift, // column 70
571 quotient_high_limbs_range_constraint_2_shift, // column 71
572 quotient_high_limbs_range_constraint_3_shift, // column 72
573 quotient_high_limbs_range_constraint_4_shift, // column 73
574 quotient_high_limbs_range_constraint_tail_shift, // column 74
575 relation_wide_limbs_range_constraint_0_shift, // column 76
576 relation_wide_limbs_range_constraint_1_shift, // column 77
577 relation_wide_limbs_range_constraint_2_shift, // column 78
578 relation_wide_limbs_range_constraint_3_shift, // column 79
579 ordered_range_constraints_0_shift, // column 80
580 ordered_range_constraints_1_shift, // column 81
581 ordered_range_constraints_2_shift, // column 82
582 ordered_range_constraints_3_shift, // column 83
583 ordered_range_constraints_4_shift, // column 84
584 z_perm_shift) // column 85
585 };
586
595 template <typename DataType>
596 class AllEntities : public PrecomputedEntities<DataType>,
597 public WitnessEntities<DataType>,
598 public ShiftedEntities<DataType> {
599 public:
601
603
608
614
619
625
627
628 friend std::ostream& operator<<(std::ostream& os, const AllEntities& a)
629 {
630 os << "{ ";
631 std::ios_base::fmtflags f(os.flags());
632 auto entities = a.get_all();
633 for (size_t i = 0; i < entities.size() - 1; i++) {
634 os << "e[" << std::setw(2) << i << "] = " << (entities[i]) << ",\n";
635 }
636 os << "e[" << std::setw(2) << (entities.size() - 1) << "] = " << entities[entities.size() - 1] << " }";
637
638 os.flags(f);
639 return os;
640 }
641 };
642
647 class AllValues : public AllEntities<FF> {
648 public:
650 using Base::Base;
651 };
655 class ProverPolynomials : public AllEntities<Polynomial> {
656 public:
662 {
663
664 const size_t circuit_size = 1 << CONST_TRANSLATOR_LOG_N;
665 for (auto& ordered_range_constraint : get_ordered_range_constraints()) {
666 ordered_range_constraint = Polynomial{ /*size*/ circuit_size - 1,
667 /*largest possible index*/ circuit_size,
668 1 };
669 }
670
671 for (auto& interleaved : get_interleaved()) {
672 interleaved = Polynomial{ /*size*/ circuit_size, circuit_size };
673 }
674 z_perm = Polynomial{ /*size*/ circuit_size - 1,
675 /*virtual_size*/ circuit_size,
676 /*start_index*/ 1 };
677
678 // All to_be_shifted witnesses except the ordered range constraints and z_perm are only non-zero in the mini
679 // circuit
680 for (auto& poly : get_to_be_shifted()) {
681 if (poly.is_empty()) {
682 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
683 /*virtual_size*/ circuit_size,
684 /*start_index*/ 1 };
685 }
686 }
687
688 // Initialize some one-off polys with special structure
689 lagrange_first = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size };
690 lagrange_result_row = Polynomial{ /*size*/ 3, /*virtual_size*/ circuit_size };
691 lagrange_even_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE, /*virtual_size*/ circuit_size };
692 lagrange_odd_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE, /*virtual_size*/ circuit_size };
693
694 for (auto& poly : get_unshifted()) {
695 if (poly.is_empty()) {
696 // Not set above
697 poly = Polynomial{ circuit_size };
698 }
699 }
700 set_shifted();
701 }
704 ProverPolynomials(ProverPolynomials&& o) noexcept = default;
707 [[nodiscard]] size_t get_polynomial_size() const { return this->op.size(); }
712 [[nodiscard]] AllValues get_row(size_t row_idx) const
713 {
714 AllValues result;
715 for (auto [result_field, polynomial] : zip_view(result.get_all(), this->get_all())) {
716 result_field = polynomial[row_idx];
717 }
718 return result;
719 }
720 // Set all shifted polynomials based on their to-be-shifted counterpart
722 {
723 for (auto [shifted, to_be_shifted] : zip_view(get_shifted(), get_to_be_shifted())) {
724 shifted = to_be_shifted.shifted();
725 }
726 }
727 };
728
745
754 class VerificationKey : public NativeVerificationKey_<PrecomputedEntities<Commitment>, Transcript> {
755 public:
756 // Serialized Verification Key length in fields
757 static constexpr size_t VERIFICATION_KEY_LENGTH =
758 /* 1. NUM_PRECOMPUTED_ENTITIES commitments */ (NUM_PRECOMPUTED_ENTITIES * num_frs_comm);
759
760 // Default constuct the fixed VK based on circuit size 1 << CONST_TRANSLATOR_LOG_N
762 : NativeVerificationKey_(1UL << CONST_TRANSLATOR_LOG_N, /*num_public_inputs=*/0)
763 {
764 this->pub_inputs_offset = 0;
765
766 // Populate the commitments of the precomputed polynomials
767 for (auto [vk_commitment, fixed_commitment] :
769 vk_commitment = fixed_commitment;
770 }
771 }
772
773 VerificationKey(const std::shared_ptr<ProvingKey>& proving_key)
774 {
775 this->log_circuit_size = CONST_TRANSLATOR_LOG_N;
776 this->num_public_inputs = 0;
777 this->pub_inputs_offset = 0;
778
779 for (auto [polynomial, commitment] :
780 zip_view(proving_key->polynomials.get_precomputed(), this->get_all())) {
781 commitment = proving_key->commitment_key.commit(polynomial);
782 }
783 }
784
790 std::vector<fr> to_field_elements() const override
791 {
792 using namespace bb::field_conversion;
793
794 auto serialize_to_field_buffer = []<typename T>(const T& input, std::vector<fr>& buffer) {
795 std::vector<fr> input_fields = convert_to_bn254_frs<T>(input);
796 buffer.insert(buffer.end(), input_fields.begin(), input_fields.end());
797 };
798
799 std::vector<fr> elements;
800 for (const Commitment& commitment : this->get_all()) {
801 serialize_to_field_buffer(commitment, elements);
802 }
803 return elements;
804 }
805
812 fr hash_through_transcript([[maybe_unused]] const std::string& domain_separator,
813 [[maybe_unused]] Transcript& transcript) const override
814 {
815 throw_or_abort("Not intended to be used because vk is hardcoded in circuit.");
816 }
817
818 // Don't statically check for object completeness.
819 using MSGPACK_NO_STATIC_CHECK = std::true_type;
820
823 ordered_extra_range_constraints_numerator,
824 lagrange_first,
825 lagrange_last,
826 lagrange_odd_in_minicircuit,
827 lagrange_even_in_minicircuit,
828 lagrange_result_row,
829 lagrange_last_in_minicircuit,
830 lagrange_masking,
831 lagrange_mini_masking,
832 lagrange_real_last);
833 };
834
838 class PartiallyEvaluatedMultivariates : public AllEntities<Polynomial> {
839 public:
841 PartiallyEvaluatedMultivariates(const size_t circuit_size)
842 {
843 // Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2)
844 for (auto& poly : this->get_all()) {
845 poly = Polynomial(circuit_size / 2);
846 }
847 }
848 PartiallyEvaluatedMultivariates(const ProverPolynomials& full_polynomials, size_t circuit_size)
849 {
850 for (auto [poly, full_poly] : zip_view(get_all(), full_polynomials.get_all())) {
851 // After the initial sumcheck round, the new size is CEIL(size/2).
852 size_t desired_size = full_poly.end_index() / 2 + full_poly.end_index() % 2;
853 poly = Polynomial(desired_size, circuit_size / 2);
854 }
855 }
856 };
857
862
867
874 class CommitmentLabels : public AllEntities<std::string> {
875 public:
877 {
878 this->op = "OP";
879 this->x_lo_y_hi = "X_LO_Y_HI";
880 this->x_hi_z_1 = "X_HI_Z_1";
881 this->y_lo_z_2 = "Y_LO_Z_2";
882 this->p_x_low_limbs = "P_X_LOW_LIMBS";
883 this->p_x_high_limbs = "P_X_HIGH_LIMBS";
884 this->p_x_low_limbs_range_constraint_0 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_0";
885 this->p_x_low_limbs_range_constraint_1 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_1";
886 this->p_x_low_limbs_range_constraint_2 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_2";
887 this->p_x_low_limbs_range_constraint_3 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_3";
888 this->p_x_low_limbs_range_constraint_4 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_4";
889 this->p_x_low_limbs_range_constraint_tail = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
890 this->p_x_high_limbs_range_constraint_0 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_0";
891 this->p_x_high_limbs_range_constraint_1 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_1";
892 this->p_x_high_limbs_range_constraint_2 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_2";
893 this->p_x_high_limbs_range_constraint_3 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_3";
894 this->p_x_high_limbs_range_constraint_4 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_4";
895 this->p_x_high_limbs_range_constraint_tail = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
896 this->p_y_low_limbs = "P_Y_LOW_LIMBS";
897 this->p_y_low_limbs_range_constraint_0 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_0";
898 this->p_y_low_limbs_range_constraint_1 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_1";
899 this->p_y_low_limbs_range_constraint_2 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_2";
900 this->p_y_low_limbs_range_constraint_3 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_3";
901 this->p_y_low_limbs_range_constraint_4 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_4";
902 this->p_y_low_limbs_range_constraint_tail = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
903 this->p_y_high_limbs = "P_Y_HIGH_LIMBS";
904 this->p_y_high_limbs_range_constraint_0 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_0";
905 this->p_y_high_limbs_range_constraint_1 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_1";
906 this->p_y_high_limbs_range_constraint_2 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_2";
907 this->p_y_high_limbs_range_constraint_3 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_3";
908 this->p_y_high_limbs_range_constraint_4 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_4";
909 this->p_y_high_limbs_range_constraint_tail = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
910 this->z_low_limbs = "Z_LOw_LIMBS";
911 this->z_low_limbs_range_constraint_0 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_0";
912 this->z_low_limbs_range_constraint_1 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_1";
913 this->z_low_limbs_range_constraint_2 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_2";
914 this->z_low_limbs_range_constraint_3 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_3";
915 this->z_low_limbs_range_constraint_4 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_4";
916 this->z_low_limbs_range_constraint_tail = "Z_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
917 this->z_high_limbs = "Z_HIGH_LIMBS";
918 this->z_high_limbs_range_constraint_0 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_0";
919 this->z_high_limbs_range_constraint_1 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_1";
920 this->z_high_limbs_range_constraint_2 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_2";
921 this->z_high_limbs_range_constraint_3 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_3";
922 this->z_high_limbs_range_constraint_4 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_4";
923 this->z_high_limbs_range_constraint_tail = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
924 this->accumulators_binary_limbs_0 = "ACCUMULATORS_BINARY_LIMBS_0";
925 this->accumulators_binary_limbs_1 = "ACCUMULATORS_BINARY_LIMBS_1";
926 this->accumulators_binary_limbs_2 = "ACCUMULATORS_BINARY_LIMBS_2";
927 this->accumulators_binary_limbs_3 = "ACCUMULATORS_BINARY_LIMBS_3";
928 this->accumulator_low_limbs_range_constraint_0 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_0";
929 this->accumulator_low_limbs_range_constraint_1 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_1";
930 this->accumulator_low_limbs_range_constraint_2 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_2";
931 this->accumulator_low_limbs_range_constraint_3 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_3";
932 this->accumulator_low_limbs_range_constraint_4 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_4";
933 this->accumulator_low_limbs_range_constraint_tail = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
934 this->accumulator_high_limbs_range_constraint_0 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_0";
935 this->accumulator_high_limbs_range_constraint_1 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_1";
936 this->accumulator_high_limbs_range_constraint_2 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_2";
937 this->accumulator_high_limbs_range_constraint_3 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_3";
938 this->accumulator_high_limbs_range_constraint_4 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_4";
939 this->accumulator_high_limbs_range_constraint_tail = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
940 this->quotient_low_binary_limbs = "QUOTIENT_LOW_BINARY_LIMBS";
941 this->quotient_high_binary_limbs = "QUOTIENT_HIGH_BINARY_LIMBS";
942 this->quotient_low_limbs_range_constraint_0 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_0";
943 this->quotient_low_limbs_range_constraint_1 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_1";
944 this->quotient_low_limbs_range_constraint_2 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_2";
945 this->quotient_low_limbs_range_constraint_3 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_3";
946 this->quotient_low_limbs_range_constraint_4 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_4";
947 this->quotient_low_limbs_range_constraint_tail = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
948 this->quotient_high_limbs_range_constraint_0 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_0";
949 this->quotient_high_limbs_range_constraint_1 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_1";
950 this->quotient_high_limbs_range_constraint_2 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_2";
951 this->quotient_high_limbs_range_constraint_3 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_3";
952 this->quotient_high_limbs_range_constraint_4 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_4";
953 this->quotient_high_limbs_range_constraint_tail = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
954 this->relation_wide_limbs = "RELATION_WIDE_LIMBS";
955 this->relation_wide_limbs_range_constraint_0 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_0";
956 this->relation_wide_limbs_range_constraint_1 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_1";
957 this->relation_wide_limbs_range_constraint_2 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_2";
958 this->relation_wide_limbs_range_constraint_3 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_2";
959 this->ordered_range_constraints_0 = "ORDERED_RANGE_CONSTRAINTS_0";
960 this->ordered_range_constraints_1 = "ORDERED_RANGE_CONSTRAINTS_1";
961 this->ordered_range_constraints_2 = "ORDERED_RANGE_CONSTRAINTS_2";
962 this->ordered_range_constraints_3 = "ORDERED_RANGE_CONSTRAINTS_3";
963 this->ordered_range_constraints_4 = "ORDERED_RANGE_CONSTRAINTS_4";
964 this->interleaved_range_constraints_0 = "INTERLEAVED_RANGE_CONSTRAINTS_0";
965 this->interleaved_range_constraints_1 = "INTERLEAVED_RANGE_CONSTRAINTS_1";
966 this->interleaved_range_constraints_2 = "INTERLEAVED_RANGE_CONSTRAINTS_2";
967 this->interleaved_range_constraints_3 = "INTERLEAVED_RANGE_CONSTRAINTS_3";
968 this->z_perm = "Z_PERM";
969 // "__" are only used for debugging
970 this->lagrange_first = "__LAGRANGE_FIRST";
971 this->lagrange_last = "__LAGRANGE_LAST";
972 this->lagrange_odd_in_minicircuit = "__LAGRANGE_ODD_IN_MINICIRCUIT";
973 this->lagrange_even_in_minicircuit = "__LAGRANGE_EVEN_IN_MINICIRCUIT";
974 this->lagrange_result_row = "__LAGRANGE_RESULT_ROW";
975 this->lagrange_last_in_minicircuit = "__LAGRANGE_LAST_IN_MINICIRCUIT";
976 this->ordered_extra_range_constraints_numerator = "__ORDERED_EXTRA_RANGE_CONSTRAINTS_NUMERATOR";
977 this->lagrange_masking = "__LAGRANGE_MASKING";
978 this->lagrange_mini_masking = "__LAGRANGE_MINI_MASKING";
979 this->lagrange_real_last = "__LAGRANGE_REAL_LAST";
980 };
981 };
982
983 template <typename Commitment, typename VerificationKey>
984 class VerifierCommitments_ : public AllEntities<Commitment> {
985 public:
986 VerifierCommitments_(const std::shared_ptr<VerificationKey>& verification_key)
987 {
988 this->lagrange_first = verification_key->lagrange_first;
989 this->lagrange_last = verification_key->lagrange_last;
990 this->lagrange_odd_in_minicircuit = verification_key->lagrange_odd_in_minicircuit;
991 this->lagrange_even_in_minicircuit = verification_key->lagrange_even_in_minicircuit;
992 this->lagrange_result_row = verification_key->lagrange_result_row;
993 this->lagrange_last_in_minicircuit = verification_key->lagrange_last_in_minicircuit;
994 this->ordered_extra_range_constraints_numerator =
995 verification_key->ordered_extra_range_constraints_numerator;
996 this->lagrange_masking = verification_key->lagrange_masking;
997 this->lagrange_mini_masking = verification_key->lagrange_mini_masking;
998 this->lagrange_real_last = verification_key->lagrange_real_last;
999 }
1000 };
1001
1009 template <typename ProverPolynomialsOrPartiallyEvaluatedMultivariates, typename EdgeType>
1010 static bool skip_entire_row([[maybe_unused]] const ProverPolynomialsOrPartiallyEvaluatedMultivariates& polynomials,
1011 [[maybe_unused]] const EdgeType edge_idx)
1012 {
1013 // TODO(@Rumata888) do you know of a more efficient way of determining if we can skip a row?
1014 auto s0 = polynomials.ordered_range_constraints_0_shift[edge_idx];
1015 auto s1 = polynomials.ordered_range_constraints_1_shift[edge_idx];
1016 auto s2 = polynomials.ordered_range_constraints_2_shift[edge_idx];
1017 auto s3 = polynomials.ordered_range_constraints_3_shift[edge_idx];
1018 auto s4 = polynomials.ordered_range_constraints_4_shift[edge_idx];
1019 auto s5 = polynomials.ordered_range_constraints_0_shift[edge_idx + 1];
1020 auto s6 = polynomials.ordered_range_constraints_1_shift[edge_idx + 1];
1021 auto s7 = polynomials.ordered_range_constraints_2_shift[edge_idx + 1];
1022 auto s8 = polynomials.ordered_range_constraints_3_shift[edge_idx + 1];
1023 auto s9 = polynomials.ordered_range_constraints_4_shift[edge_idx + 1];
1024 auto shift_0 = (s0 == 0) && (s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 0) && (s5 == 0) && (s6 == 0) &&
1025 (s7 == 0) && (s8 == 0) && (s9 == 0);
1026 return shift_0 && (polynomials.z_perm[edge_idx] == polynomials.z_perm_shift[edge_idx]) &&
1027 (polynomials.z_perm[edge_idx + 1] == polynomials.z_perm_shift[edge_idx + 1]) &&
1028 polynomials.lagrange_last[edge_idx] == 0 && polynomials.lagrange_last[edge_idx + 1] == 0;
1029 }
1031};
1032} // namespace bb
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
CommitmentKey object over a pairing group 𝔾₁.
Base Native verification key class.
Definition flavor.hpp:152
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
TranslatorCircuitBuilder creates a circuit that evaluates the correctness of the evaluation of EccOpQ...
static constexpr std::array< Fr, 5 > NEGATIVE_MODULUS_LIMBS
A base class labelling all entities (for instance, all of the polynomials used by the prover during s...
auto get_interleaved()
Getter for entities constructed by interleaving.
friend std::ostream & operator<<(std::ostream &os, const AllEntities &a)
auto get_ordered_range_constraints()
Getter for the ordered entities used in computing the denominator of the grand product in the permuta...
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
A container for commitment labels.
DEFINE_FLAVOR_MEMBERS(DataType, ordered_range_constraints_0, ordered_range_constraints_1, ordered_range_constraints_2, ordered_range_constraints_3, ordered_range_constraints_4)
A container for storing the partially evaluated multivariates produced by sumcheck.
PartiallyEvaluatedMultivariates(const ProverPolynomials &full_polynomials, size_t circuit_size)
A base class labelling precomputed entities and (ordered) subsets of interest.
bool operator==(const PrecomputedEntities &other) const =default
DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator, lagrange_first, lagrange_last, lagrange_odd_in_minicircuit, lagrange_even_in_minicircuit, lagrange_result_row, lagrange_last_in_minicircuit, lagrange_masking, lagrange_mini_masking, lagrange_real_last)
A container for the prover polynomials handles.
ProverPolynomials(const ProverPolynomials &o)=delete
ProverPolynomials(ProverPolynomials &&o) noexcept=default
ProverPolynomials & operator=(const ProverPolynomials &)=delete
AllValues get_row(size_t row_idx) const
Returns the evaluations of all prover polynomials at one point on the boolean hypercube,...
ProverPolynomials()
ProverPolynomials constructor.
ProverPolynomials & operator=(ProverPolynomials &&o) noexcept=default
The proving key is responsible for storing the polynomials used by the prover.
ProvingKey(const CommitmentKey &commitment_key=CommitmentKey())
Represents polynomials shifted by 1 or their evaluations, defined relative to WireToBeShiftedEntities...
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
std::vector< fr > to_field_elements() const override
Serialize verification key to field elements.
MSGPACK_FIELDS(num_public_inputs, pub_inputs_offset, ordered_extra_range_constraints_numerator, lagrange_first, lagrange_last, lagrange_odd_in_minicircuit, lagrange_even_in_minicircuit, lagrange_result_row, lagrange_last_in_minicircuit, lagrange_masking, lagrange_mini_masking, lagrange_real_last)
VerificationKey(const std::shared_ptr< ProvingKey > &proving_key)
fr hash_through_transcript(const std::string &domain_separator, Transcript &transcript) const override
Unused function because vk is hardcoded in recursive verifier, so no transcript hashing is needed.
static constexpr size_t VERIFICATION_KEY_LENGTH
VerifierCommitments_(const std::shared_ptr< VerificationKey > &verification_key)
DEFINE_FLAVOR_MEMBERS(DataType, x_lo_y_hi, x_hi_z_1, y_lo_z_2, p_x_low_limbs, p_x_high_limbs, p_y_low_limbs, p_y_high_limbs, z_low_limbs, z_high_limbs, accumulators_binary_limbs_0, accumulators_binary_limbs_1, accumulators_binary_limbs_2, accumulators_binary_limbs_3, quotient_low_binary_limbs, quotient_high_binary_limbs, relation_wide_limbs, p_x_low_limbs_range_constraint_0, p_x_low_limbs_range_constraint_1, p_x_low_limbs_range_constraint_2, p_x_low_limbs_range_constraint_3, p_x_low_limbs_range_constraint_4, p_x_low_limbs_range_constraint_tail, p_x_high_limbs_range_constraint_0, p_x_high_limbs_range_constraint_1, p_x_high_limbs_range_constraint_2, p_x_high_limbs_range_constraint_3, p_x_high_limbs_range_constraint_4, p_x_high_limbs_range_constraint_tail, p_y_low_limbs_range_constraint_0, p_y_low_limbs_range_constraint_1, p_y_low_limbs_range_constraint_2, p_y_low_limbs_range_constraint_3, p_y_low_limbs_range_constraint_4, p_y_low_limbs_range_constraint_tail, p_y_high_limbs_range_constraint_0, p_y_high_limbs_range_constraint_1, p_y_high_limbs_range_constraint_2, p_y_high_limbs_range_constraint_3, p_y_high_limbs_range_constraint_4, p_y_high_limbs_range_constraint_tail, z_low_limbs_range_constraint_0, z_low_limbs_range_constraint_1, z_low_limbs_range_constraint_2, z_low_limbs_range_constraint_3, z_low_limbs_range_constraint_4, z_low_limbs_range_constraint_tail, z_high_limbs_range_constraint_0, z_high_limbs_range_constraint_1, z_high_limbs_range_constraint_2, z_high_limbs_range_constraint_3, z_high_limbs_range_constraint_4, z_high_limbs_range_constraint_tail, accumulator_low_limbs_range_constraint_0, accumulator_low_limbs_range_constraint_1, accumulator_low_limbs_range_constraint_2, accumulator_low_limbs_range_constraint_3, accumulator_low_limbs_range_constraint_4, accumulator_low_limbs_range_constraint_tail, accumulator_high_limbs_range_constraint_0, accumulator_high_limbs_range_constraint_1, accumulator_high_limbs_range_constraint_2, accumulator_high_limbs_range_constraint_3, accumulator_high_limbs_range_constraint_4, accumulator_high_limbs_range_constraint_tail, quotient_low_limbs_range_constraint_0, quotient_low_limbs_range_constraint_1, quotient_low_limbs_range_constraint_2, quotient_low_limbs_range_constraint_3, quotient_low_limbs_range_constraint_4, quotient_low_limbs_range_constraint_tail, quotient_high_limbs_range_constraint_0, quotient_high_limbs_range_constraint_1, quotient_high_limbs_range_constraint_2, quotient_high_limbs_range_constraint_3, quotient_high_limbs_range_constraint_4, quotient_high_limbs_range_constraint_tail, relation_wide_limbs_range_constraint_0, relation_wide_limbs_range_constraint_1, relation_wide_limbs_range_constraint_2, relation_wide_limbs_range_constraint_3)
Container for all witness polynomials used/constructed by the prover.
auto get_unshifted_without_interleaved()
Witness Entities on which Shplemini operates in the default manner.
std::vector< RefVector< DataType > > get_groups_to_be_interleaved()
Get the entities interleaved for the permutation relation.
DEFINE_COMPOUND_GET_ALL(WireNonshiftedEntities< DataType >, WireToBeShiftedEntities< DataType >, OrderedRangeConstraints< DataType >, DerivedWitnessEntities< DataType >, InterleavedRangeConstraints< DataType >) auto get_wires()
Entities constructed from circuit data.
auto get_wires_and_ordered_range_constraints()
Witness Entities to which the prover commits and do not require challenges (i.e. not derived).
auto get_interleaved()
Get the entities constructed by interleaving.
static constexpr size_t MINI_CIRCUIT_SIZE
static constexpr size_t MICRO_LIMB_BITS
std::tuple< TranslatorPermutationRelation< FF > > GrandProductRelations
static constexpr size_t num_frs_fq
static constexpr size_t NUM_WIRES_TO_BE_SHIFTED_WITHOUT_INTERLEAVED
static bool skip_entire_row(const ProverPolynomialsOrPartiallyEvaluatedMultivariates &polynomials, const EdgeType edge_idx)
When evaluating the sumcheck protocol - can we skip evaluation of all relations for a given row?
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t NUM_WIRES
static constexpr size_t SORT_STEP
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
static constexpr size_t num_frs_comm
static constexpr size_t TO_BE_SHIFTED_WITNESSES_START
static constexpr size_t NUM_INTERLEAVED_WIRES
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t CONST_TRANSLATOR_LOG_N
static constexpr size_t NUM_OP_QUEUE_WIRES
Curve::ScalarField FF
static constexpr size_t NUM_INTERLEAVED
Curve::AffineElement Commitment
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
static constexpr size_t MINIMUM_MINI_CIRCUIT_SIZE
static constexpr size_t LOG_MINI_CIRCUIT_SIZE
static constexpr bool USE_PADDING
static constexpr bool HasZK
static constexpr size_t NUM_SHIFTED_WITNESSES
static constexpr const std::array< FF, 5 > & negative_modulus_limbs()
static constexpr size_t NUM_LIMB_BITS
static constexpr size_t RESULT_ROW
static constexpr size_t NUM_RELATIONS
static constexpr bool USE_SHORT_MONOMIALS
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
std::tuple< TranslatorPermutationRelation< FF >, TranslatorDeltaRangeConstraintRelation< FF >, TranslatorOpcodeConstraintRelation< FF >, TranslatorAccumulatorTransferRelation< FF >, TranslatorDecompositionRelation< FF >, TranslatorNonNativeFieldRelation< FF >, TranslatorZeroConstraintsRelation< FF > > Relations_
bb::CommitmentKey< Curve > CommitmentKey
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
static constexpr size_t TO_BE_INTERLEAVED_START
static constexpr size_t SHIFTED_WITNESSES_START
static constexpr size_t SORTED_STEPS_COUNT
static constexpr size_t NUM_SUBRELATIONS
static constexpr size_t NUM_WIRES_NON_SHIFTED
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t MAX_TOTAL_RELATION_LENGTH
bb::Polynomial< FF > Polynomial
static constexpr size_t INTERLEAVING_GROUP_SIZE
static constexpr size_t num_frs_fr
static constexpr size_t INTERLEAVED_START
static constexpr size_t VIRTUAL_LOG_N
typename Group::element Element
Definition bn254.hpp:21
bb::fq BaseField
Definition bn254.hpp:19
typename Group::affine_element AffineElement
Definition bn254.hpp:22
static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH
Definition bn254.hpp:46
bb::fr ScalarField
Definition bn254.hpp:18
FF a
uint8_t buffer[RANDOM_BUFFER_SIZE]
Definition engine.cpp:34
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
#define DEFINE_FLAVOR_MEMBERS(DataType,...)
Define the body of a flavor class, included each member and a pointer view with which to iterate the ...
#define DEFINE_COMPOUND_GET_ALL(...)
constexpr T get_msb(const T in)
Definition get_msb.hpp:47
Entry point for Barretenberg command-line interface.
RefArray< T,(Ns+...)> constexpr concatenate(const RefArray< T, Ns > &... ref_arrays)
Concatenates multiple RefArray objects into a single RefArray.
BaseTranscript< NativeTranscriptParams > NativeTranscript
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
static std::vector< Commitment > get_all()
void throw_or_abort(std::string const &err)