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: Planned, auditors: [], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
28
29namespace bb {
30
32
33 public:
36 using PCS = KZG<Curve>;
44 using Codec = FrCodec;
47
48 // indicates when evaluating sumcheck, edges must be extended to be MAX_PARTIAL_RELATION_LENGTH
49 static constexpr bool USE_SHORT_MONOMIALS = false;
50
51 // Indicates that this flavor runs with ZK Sumcheck.
52 static constexpr bool HasZK = true;
53 // Translator proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
54 static constexpr bool USE_PADDING = false;
55 // Important: these constants cannot be arbitrarily changed - please consult with a member of the Crypto team if
56 // they become too small.
57
58 // The number of entities added for ZK (gemini_masking_poly)
59 static constexpr size_t NUM_MASKING_POLYNOMIALS = 1;
60
61 // None of this parameters can be changed
62 // Number of wires representing the op queue whose commitments are going to be checked against those from the
63 // final round of merge
64 static constexpr size_t NUM_OP_QUEUE_WIRES = 4;
65
66 // How many mini_circuit_size polynomials are interleaved in one interleaved_*
67 static constexpr size_t INTERLEAVING_GROUP_SIZE = 16;
68
69 // The fixed log size of Translator circuit determining the size most polynomials (except the ones
70 // involved in the interleaving subprotocol). It should be determined by the size of the EccOpQueue.
71 static constexpr size_t LOG_MINI_CIRCUIT_SIZE = CONST_TRANSLATOR_MINI_CIRCUIT_LOG_SIZE;
72
73 // Log of size of interleaved_* and ordered_* polynomials
75
76 // For the translator, the genuine and virtual log circuit size coincide
77 static constexpr size_t VIRTUAL_LOG_N = CONST_TRANSLATOR_LOG_N;
78
79 static constexpr size_t MINI_CIRCUIT_SIZE = 1UL << LOG_MINI_CIRCUIT_SIZE;
80
81 // The number of interleaved_* wires
82 static constexpr size_t NUM_INTERLEAVED_WIRES = 4;
83
84 // The step in the DeltaRangeConstraint relation i.e. the maximum difference between two consecutive values
85 static constexpr size_t SORT_STEP = 3;
86
87 // Number of wires
88 static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
89
90 // The result of evaluating the polynomials in the nonnative form in translator circuit, stored as limbs and
91 // referred to as accumulated_result. This is reconstructed in it's base field form and sent to the verifier
92 // responsible for checking it against the evaluations received from ECCVM.
93 static constexpr size_t RESULT_ROW = CircuitBuilder::RESULT_ROW;
94
95 // Number of random ops found at he end of Translator trace multiplied by 2 as each accumulation gates occupies two
96 // rows.
98
99 // Index at which random coefficients start (for zk) within Translator trace
101
102 // The bitness of the range constraint
104
105 // The number of "steps" inserted in ordered range constraint polynomials to ensure that the
106 // DeltaRangeConstraintRelation can always be satisfied if the polynomial is within the appropriate range.
107 static constexpr size_t SORTED_STEPS_COUNT = (1 << MICRO_LIMB_BITS) / SORT_STEP + 1;
109 "Translator circuit is too small for defined number of steps "
110 "(TranslatorDeltaRangeConstraintRelation). ");
111
112 // The limbs of the modulus we are emulating in the goblin translator. 4 binary 68-bit limbs and the prime one
114 {
116 }
117
118 // Number of bits in a binary limb
119 // This is not a configurable value. Relations are sepcifically designed for it to be 68
121
122 // Lowest possible size of the Translator mini circuit due to the desing of range constraints.
123 static constexpr size_t MINIMUM_MINI_CIRCUIT_SIZE = 2048;
125
126 // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We
127 // often need containers of this size to hold related data, so we choose a name more agnostic than
128 // `NUM_POLYNOMIALS`. Note: this number does not include the individual sorted list polynomials.
129 // Includes gemini_masking_poly for ZK (NUM_ALL_ENTITIES = 187 + NUM_MASKING_POLYNOMIALS)
130 static constexpr size_t NUM_ALL_ENTITIES = 188;
131 // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying
132 // assignment of witnesses. We again choose a neutral name.
133 static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 10;
134 // The total number of witness entities not including shifts.
135 // Includes gemini_masking_poly for ZK (NUM_WITNESS_ENTITIES = 90 + NUM_MASKING_POLYNOMIALS)
136 static constexpr size_t NUM_WITNESS_ENTITIES = 91;
137 static constexpr size_t NUM_WIRES_NON_SHIFTED = 1;
138 static constexpr size_t NUM_SHIFTED_ENTITIES = 86;
140 // Number of elements in WireToBeShiftedWithoutConcatenated
142 // The index of the first unshifted witness that is going to be shifted when AllEntities are partitioned into
143 // get_unshifted_without_interleaved(), get_to_be_shifted(), and get_groups_to_be_interleaved()
145 // The index of the shift of the first to be shifted witness
147 // The index of the first unshifted witness that is contained in the groups to be interleaved, when AllEntities are
148 // partitioned into get_unshifted_without_interleaved(), get_to_be_shifted(), and get_groups_to_be_interleaved()
149 static constexpr size_t TO_BE_INTERLEAVED_START =
151 // The index of the first interleaving groups element inside AllEntities
153 // A container to be fed to ShpleminiVerifier to avoid redundant scalar muls
162 // define the tuple of Relations that comprise the Sumcheck relation
163 template <typename FF>
172
173 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
174 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
175
176 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
177
178 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
179 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
180 // length = 3.
181 // The degree has to be further increased because the relation is multiplied by the Row Disabling Polynomial
184 "LIBRA_UNIVARIATES_LENGTH must be equal to Translator::BATCHED_RELATION_PARTIAL_LENGTH");
186
187 static constexpr size_t num_frs_comm = FrCodec::calc_num_fields<Commitment>();
188 static constexpr size_t num_frs_fr = FrCodec::calc_num_fields<FF>();
189 static constexpr size_t num_frs_fq = FrCodec::calc_num_fields<BF>();
190
191 // Proof length formula
192 static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS =
193 /* 1. NUM_WITNESS_ENTITIES commitments (minus gemini_masking_poly sent separately, z_perm sent separately,
194 and 4 op queue wires passed by merge protocol) */
196 /* 2. Libra concatenation commitment*/ (num_frs_comm) +
197 /* 3. Libra sum */ (num_frs_fr) +
198 /* 4. CONST_TRANSLATOR_LOG_N sumcheck univariates */
200 /* 5. NUM_ALL_ENTITIES sumcheck evaluations*/ (NUM_ALL_ENTITIES * num_frs_fr) +
201 /* 6. Libra claimed evaluation */ (num_frs_fr) +
202 /* 7. Libra grand sum commitment */ (num_frs_comm) +
203 /* 8. Libra quotient commitment */ (num_frs_comm) +
204 /* 9. CONST_TRANSLATOR_LOG_N - 1 Gemini Fold commitments */
206 /* 10. CONST_TRANSLATOR_LOG_N Gemini a evaluations */
208 /* 11. Gemini P pos evaluation */ (num_frs_fr) +
209 /* 12. Gemini P neg evaluation */ (num_frs_fr) +
210 /* 13. NUM_SMALL_IPA_EVALUATIONS libra evals */ (NUM_SMALL_IPA_EVALUATIONS * num_frs_fr) +
211 /* 14. Shplonk Q commitment */ (num_frs_comm) +
212 /* 15. KZG W commitment */ (num_frs_comm);
213
218 template <typename DataType_> class PrecomputedEntities {
219 public:
220 bool operator==(const PrecomputedEntities& other) const = default;
221 using DataType = DataType_;
223 ordered_extra_range_constraints_numerator, // column 0
224 lagrange_first, // column 1
225 lagrange_last, // column 2
226 // TODO(https://github.com/AztecProtocol/barretenberg/issues/758): Check if one of these
227 // can be replaced by shifts
228 lagrange_odd_in_minicircuit, // column 3
229 lagrange_even_in_minicircuit, // column 4
230 lagrange_result_row, // column 5
231 lagrange_last_in_minicircuit, // column 6
232 lagrange_masking, // column 7
233 lagrange_mini_masking, // column 8
234 lagrange_real_last); // column 9
235 };
236
237 template <typename DataType> class InterleavedRangeConstraints {
238 public:
239 DEFINE_FLAVOR_MEMBERS(DataType,
240 interleaved_range_constraints_0, // column 0
241 interleaved_range_constraints_1, // column 1
242 interleaved_range_constraints_2, // column 2
243 interleaved_range_constraints_3) // column 3
244 };
248 template <typename DataType> class NonOpQueueWiresToBeShiftedEntities {
249 public:
251 p_x_low_limbs, // column 0
252 p_x_high_limbs, // column 4
253 p_y_low_limbs, // column 5
254 p_y_high_limbs, // column 6
255 z_low_limbs, // column 7
256 z_high_limbs, // column 8
257 accumulators_binary_limbs_0, // column 9
258 accumulators_binary_limbs_1, // column 10
259 accumulators_binary_limbs_2, // column 11
260 accumulators_binary_limbs_3, // column 12
261 quotient_low_binary_limbs, // column 13
262 quotient_high_binary_limbs, // column 14
263 relation_wide_limbs, // column 15
264 p_x_low_limbs_range_constraint_0, // column 16
265 p_x_low_limbs_range_constraint_1, // column 17
266 p_x_low_limbs_range_constraint_2, // column 18
267 p_x_low_limbs_range_constraint_3, // column 19
268 p_x_low_limbs_range_constraint_4, // column 20
269 p_x_low_limbs_range_constraint_tail, // column 21
270 p_x_high_limbs_range_constraint_0, // column 22
271 p_x_high_limbs_range_constraint_1, // column 23
272 p_x_high_limbs_range_constraint_2, // column 24
273 p_x_high_limbs_range_constraint_3, // column 25
274 p_x_high_limbs_range_constraint_4, // column 26
275 p_x_high_limbs_range_constraint_tail, // column 27
276 p_y_low_limbs_range_constraint_0, // column 28
277 p_y_low_limbs_range_constraint_1, // column 29
278 p_y_low_limbs_range_constraint_2, // column 30
279 p_y_low_limbs_range_constraint_3, // column 31
280 p_y_low_limbs_range_constraint_4, // column 32
281 p_y_low_limbs_range_constraint_tail, // column 33
282 p_y_high_limbs_range_constraint_0, // column 34
283 p_y_high_limbs_range_constraint_1, // column 35
284 p_y_high_limbs_range_constraint_2, // column 36
285 p_y_high_limbs_range_constraint_3, // column 37
286 p_y_high_limbs_range_constraint_4, // column 38
287 p_y_high_limbs_range_constraint_tail, // column 39
288 z_low_limbs_range_constraint_0, // column 40
289 z_low_limbs_range_constraint_1, // column 41
290 z_low_limbs_range_constraint_2, // column 42
291 z_low_limbs_range_constraint_3, // column 43
292 z_low_limbs_range_constraint_4, // column 44
293 z_low_limbs_range_constraint_tail, // column 45
294 z_high_limbs_range_constraint_0, // column 46
295 z_high_limbs_range_constraint_1, // column 47
296 z_high_limbs_range_constraint_2, // column 48
297 z_high_limbs_range_constraint_3, // column 49
298 z_high_limbs_range_constraint_4, // column 50
299 z_high_limbs_range_constraint_tail, // column 51
300 accumulator_low_limbs_range_constraint_0, // column 52
301 accumulator_low_limbs_range_constraint_1, // column 53
302 accumulator_low_limbs_range_constraint_2, // column 54
303 accumulator_low_limbs_range_constraint_3, // column 55
304 accumulator_low_limbs_range_constraint_4, // column 56
305 accumulator_low_limbs_range_constraint_tail, // column 57
306 accumulator_high_limbs_range_constraint_0, // column 58
307 accumulator_high_limbs_range_constraint_1, // column 59
308 accumulator_high_limbs_range_constraint_2, // column 60
309 accumulator_high_limbs_range_constraint_3, // column 61
310 accumulator_high_limbs_range_constraint_4, // column 62
311 accumulator_high_limbs_range_constraint_tail, // column 63
312 quotient_low_limbs_range_constraint_0, // column 64
313 quotient_low_limbs_range_constraint_1, // column 65
314 quotient_low_limbs_range_constraint_2, // column 66
315 quotient_low_limbs_range_constraint_3, // column 67
316 quotient_low_limbs_range_constraint_4, // column 68
317 quotient_low_limbs_range_constraint_tail, // column 69
318 quotient_high_limbs_range_constraint_0, // column 70
319 quotient_high_limbs_range_constraint_1, // column 71
320 quotient_high_limbs_range_constraint_2, // column 72
321 quotient_high_limbs_range_constraint_3, // column 73
322 quotient_high_limbs_range_constraint_4, // column 74
323 quotient_high_limbs_range_constraint_tail, // column 75
324 relation_wide_limbs_range_constraint_0, // column 76
325 relation_wide_limbs_range_constraint_1, // column 77
326 relation_wide_limbs_range_constraint_2, // column 78
327 relation_wide_limbs_range_constraint_3); // column 79
328 };
329
333 template <typename DataType> class OpQueueWiresToBeShiftedEntities {
334 public:
335 DEFINE_FLAVOR_MEMBERS(DataType,
336 x_lo_y_hi, // column 0
337 x_hi_z_1, // column 1
338 y_lo_z_2) // column 2
339 };
340
344 template <typename DataType>
350
351 // TODO(https://github.com/AztecProtocol/barretenberg/issues/907)
352 // Note: These are technically derived from wires but do not depend on challenges (like z_perm). They are committed
353 // to in the wires commitment round.
354 template <typename DataType> class OrderedRangeConstraints {
355 public:
357 ordered_range_constraints_0, // column 0
358 ordered_range_constraints_1, // column 1
359 ordered_range_constraints_2, // column 2
360 ordered_range_constraints_3, // column 3
361 ordered_range_constraints_4); // column 4
362 };
363
367 template <typename DataType> class OpQueueWireNonshiftedEntities {
368 public:
370 op // column 0
371 );
372 };
373
377 template <typename DataType> class WireNonshiftedEntities : public OpQueueWireNonshiftedEntities<DataType> {
378 public:
380 };
381
382 template <typename DataType> class DerivedWitnessEntities {
383 public:
385 z_perm); // column 0
386 };
390 template <typename DataType>
391 class WitnessEntities : public WireNonshiftedEntities<DataType>,
392 public WireToBeShiftedEntities<DataType>,
393 public OrderedRangeConstraints<DataType>,
394 public DerivedWitnessEntities<DataType>,
395 public InterleavedRangeConstraints<DataType> {
396 public:
412
421
431
440
451
460
467
472
478 {
479 return {
480 {
481 this->p_x_low_limbs_range_constraint_0,
482 this->p_x_low_limbs_range_constraint_1,
483 this->p_x_low_limbs_range_constraint_2,
484 this->p_x_low_limbs_range_constraint_3,
485 this->p_x_low_limbs_range_constraint_4,
486 this->p_x_low_limbs_range_constraint_tail,
487 this->p_x_high_limbs_range_constraint_0,
488 this->p_x_high_limbs_range_constraint_1,
489 this->p_x_high_limbs_range_constraint_2,
490 this->p_x_high_limbs_range_constraint_3,
491 this->p_x_high_limbs_range_constraint_4,
492 this->p_x_high_limbs_range_constraint_tail,
493 this->p_y_low_limbs_range_constraint_0,
494 this->p_y_low_limbs_range_constraint_1,
495 this->p_y_low_limbs_range_constraint_2,
496 this->p_y_low_limbs_range_constraint_3,
497 },
498 {
499 this->p_y_low_limbs_range_constraint_4,
500 this->p_y_low_limbs_range_constraint_tail,
501 this->p_y_high_limbs_range_constraint_0,
502 this->p_y_high_limbs_range_constraint_1,
503 this->p_y_high_limbs_range_constraint_2,
504 this->p_y_high_limbs_range_constraint_3,
505 this->p_y_high_limbs_range_constraint_4,
506 this->p_y_high_limbs_range_constraint_tail,
507 this->z_low_limbs_range_constraint_0,
508 this->z_low_limbs_range_constraint_1,
509 this->z_low_limbs_range_constraint_2,
510 this->z_low_limbs_range_constraint_3,
511 this->z_low_limbs_range_constraint_4,
512 this->z_low_limbs_range_constraint_tail,
513 this->z_high_limbs_range_constraint_0,
514 this->z_high_limbs_range_constraint_1,
515 },
516 {
517 this->z_high_limbs_range_constraint_2,
518 this->z_high_limbs_range_constraint_3,
519 this->z_high_limbs_range_constraint_4,
520 this->z_high_limbs_range_constraint_tail,
521 this->accumulator_low_limbs_range_constraint_0,
522 this->accumulator_low_limbs_range_constraint_1,
523 this->accumulator_low_limbs_range_constraint_2,
524 this->accumulator_low_limbs_range_constraint_3,
525 this->accumulator_low_limbs_range_constraint_4,
526 this->accumulator_low_limbs_range_constraint_tail,
527 this->accumulator_high_limbs_range_constraint_0,
528 this->accumulator_high_limbs_range_constraint_1,
529 this->accumulator_high_limbs_range_constraint_2,
530 this->accumulator_high_limbs_range_constraint_3,
531 this->accumulator_high_limbs_range_constraint_4,
532 this->accumulator_high_limbs_range_constraint_tail,
533 },
534 {
535 this->quotient_low_limbs_range_constraint_0,
536 this->quotient_low_limbs_range_constraint_1,
537 this->quotient_low_limbs_range_constraint_2,
538 this->quotient_low_limbs_range_constraint_3,
539 this->quotient_low_limbs_range_constraint_4,
540 this->quotient_low_limbs_range_constraint_tail,
541 this->quotient_high_limbs_range_constraint_0,
542 this->quotient_high_limbs_range_constraint_1,
543 this->quotient_high_limbs_range_constraint_2,
544 this->quotient_high_limbs_range_constraint_3,
545 this->quotient_high_limbs_range_constraint_4,
546 this->quotient_high_limbs_range_constraint_tail,
547 this->relation_wide_limbs_range_constraint_0,
548 this->relation_wide_limbs_range_constraint_1,
549 this->relation_wide_limbs_range_constraint_2,
550 this->relation_wide_limbs_range_constraint_3,
551 },
552 };
553 };
554 };
555
559 template <typename DataType> class ShiftedEntities {
560 public:
561 DEFINE_FLAVOR_MEMBERS(DataType,
562 x_lo_y_hi_shift, // column 0
563 x_hi_z_1_shift, // column 1
564 y_lo_z_2_shift, // column 2
565 p_x_low_limbs_shift, // column 3
566 p_x_high_limbs_shift, // column 10
567 p_y_low_limbs_shift, // column 17
568 p_y_high_limbs_shift, // column 24
569 z_low_limbs_shift, // column 31
570 z_high_limbs_shift, // column 38
571 accumulators_binary_limbs_0_shift, // column 45
572 accumulators_binary_limbs_1_shift, // column 46
573 accumulators_binary_limbs_2_shift, // column 47
574 accumulators_binary_limbs_3_shift, // column 48
575 quotient_low_binary_limbs_shift, // column 61
576 quotient_high_binary_limbs_shift, // column 62
577 relation_wide_limbs_shift, // column 75
578 p_x_low_limbs_range_constraint_0_shift, // column 4
579 p_x_low_limbs_range_constraint_1_shift, // column 5
580 p_x_low_limbs_range_constraint_2_shift, // column 6
581 p_x_low_limbs_range_constraint_3_shift, // column 7
582 p_x_low_limbs_range_constraint_4_shift, // column 8
583 p_x_low_limbs_range_constraint_tail_shift, // column 9
584 p_x_high_limbs_range_constraint_0_shift, // column 11
585 p_x_high_limbs_range_constraint_1_shift, // column 12
586 p_x_high_limbs_range_constraint_2_shift, // column 13
587 p_x_high_limbs_range_constraint_3_shift, // column 14
588 p_x_high_limbs_range_constraint_4_shift, // column 15
589 p_x_high_limbs_range_constraint_tail_shift, // column 16
590 p_y_low_limbs_range_constraint_0_shift, // column 18
591 p_y_low_limbs_range_constraint_1_shift, // column 19
592 p_y_low_limbs_range_constraint_2_shift, // column 20
593 p_y_low_limbs_range_constraint_3_shift, // column 21
594 p_y_low_limbs_range_constraint_4_shift, // column 22
595 p_y_low_limbs_range_constraint_tail_shift, // column 23
596 p_y_high_limbs_range_constraint_0_shift, // column 25
597 p_y_high_limbs_range_constraint_1_shift, // column 26
598 p_y_high_limbs_range_constraint_2_shift, // column 27
599 p_y_high_limbs_range_constraint_3_shift, // column 28
600 p_y_high_limbs_range_constraint_4_shift, // column 29
601 p_y_high_limbs_range_constraint_tail_shift, // column 30
602 z_low_limbs_range_constraint_0_shift, // column 32
603 z_low_limbs_range_constraint_1_shift, // column 33
604 z_low_limbs_range_constraint_2_shift, // column 34
605 z_low_limbs_range_constraint_3_shift, // column 35
606 z_low_limbs_range_constraint_4_shift, // column 36
607 z_low_limbs_range_constraint_tail_shift, // column 37
608 z_high_limbs_range_constraint_0_shift, // column 39
609 z_high_limbs_range_constraint_1_shift, // column 40
610 z_high_limbs_range_constraint_2_shift, // column 41
611 z_high_limbs_range_constraint_3_shift, // column 42
612 z_high_limbs_range_constraint_4_shift, // column 43
613 z_high_limbs_range_constraint_tail_shift, // column 44
614 accumulator_low_limbs_range_constraint_0_shift, // column 49
615 accumulator_low_limbs_range_constraint_1_shift, // column 50
616 accumulator_low_limbs_range_constraint_2_shift, // column 51
617 accumulator_low_limbs_range_constraint_3_shift, // column 52
618 accumulator_low_limbs_range_constraint_4_shift, // column 53
619 accumulator_low_limbs_range_constraint_tail_shift, // column 54
620 accumulator_high_limbs_range_constraint_0_shift, // column 55
621 accumulator_high_limbs_range_constraint_1_shift, // column 56
622 accumulator_high_limbs_range_constraint_2_shift, // column 57
623 accumulator_high_limbs_range_constraint_3_shift, // column 58
624 accumulator_high_limbs_range_constraint_4_shift, // column 59
625 accumulator_high_limbs_range_constraint_tail_shift, // column 60
626 quotient_low_limbs_range_constraint_0_shift, // column 63
627 quotient_low_limbs_range_constraint_1_shift, // column 64
628 quotient_low_limbs_range_constraint_2_shift, // column 65
629 quotient_low_limbs_range_constraint_3_shift, // column 66
630 quotient_low_limbs_range_constraint_4_shift, // column 67
631 quotient_low_limbs_range_constraint_tail_shift, // column 68
632 quotient_high_limbs_range_constraint_0_shift, // column 69
633 quotient_high_limbs_range_constraint_1_shift, // column 70
634 quotient_high_limbs_range_constraint_2_shift, // column 71
635 quotient_high_limbs_range_constraint_3_shift, // column 72
636 quotient_high_limbs_range_constraint_4_shift, // column 73
637 quotient_high_limbs_range_constraint_tail_shift, // column 74
638 relation_wide_limbs_range_constraint_0_shift, // column 76
639 relation_wide_limbs_range_constraint_1_shift, // column 77
640 relation_wide_limbs_range_constraint_2_shift, // column 78
641 relation_wide_limbs_range_constraint_3_shift, // column 79
642 ordered_range_constraints_0_shift, // column 80
643 ordered_range_constraints_1_shift, // column 81
644 ordered_range_constraints_2_shift, // column 82
645 ordered_range_constraints_3_shift, // column 83
646 ordered_range_constraints_4_shift, // column 84
647 z_perm_shift) // column 85
648 };
649
654 template <typename DataType> class MaskingEntities {
655 public:
656 DEFINE_FLAVOR_MEMBERS(DataType, gemini_masking_poly)
657 };
658
667 template <typename DataType>
668 class AllEntities : public MaskingEntities<DataType>,
669 public PrecomputedEntities<DataType>,
670 public WitnessEntities<DataType>,
671 public ShiftedEntities<DataType> {
672 public:
679
684
690
697
704
706
707 friend std::ostream& operator<<(std::ostream& os, const AllEntities& a)
708 {
709 os << "{ ";
710 std::ios_base::fmtflags f(os.flags());
711 auto entities = a.get_all();
712 for (size_t i = 0; i < entities.size() - 1; i++) {
713 os << "e[" << std::setw(2) << i << "] = " << (entities[i]) << ",\n";
714 }
715 os << "e[" << std::setw(2) << (entities.size() - 1) << "] = " << entities[entities.size() - 1] << " }";
716
717 os.flags(f);
718 return os;
719 }
720 };
721
726 class AllValues : public AllEntities<FF> {
727 public:
729 using Base::Base;
730 };
734 class ProverPolynomials : public AllEntities<Polynomial> {
735 public:
741 {
742
743 const size_t circuit_size = 1 << CONST_TRANSLATOR_LOG_N;
744 const size_t circuit_size_without_masking = circuit_size - NUM_MASKED_ROWS_END * INTERLEAVING_GROUP_SIZE;
745 for (auto& ordered_range_constraint : get_ordered_range_constraints()) {
746 ordered_range_constraint = Polynomial{ /*size*/ circuit_size - 1,
747 /*largest possible index*/ circuit_size,
748 1 };
749 }
750
751 for (auto& interleaved : get_interleaved()) {
752 interleaved = Polynomial{ /*size*/ circuit_size, circuit_size };
753 }
754 z_perm = Polynomial{ /*size*/ circuit_size - 1,
755 /*virtual_size*/ circuit_size,
756 /*start_index*/ 1 };
757
758 op = Polynomial{ MINI_CIRCUIT_SIZE, circuit_size };
759
760 // All to_be_shifted witnesses except the ordered range constraints and z_perm are only non-zero in the mini
761 // circuit
762 for (auto& poly : get_to_be_shifted()) {
763 if (poly.is_empty()) {
764 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
765 /*virtual_size*/ circuit_size,
766 /*start_index*/ 1 };
767 }
768 }
769
770 // Initialize lagrange polynomialso and the ordered extra range constraints numerator (the precomputed
771 // polynomials) within the appropriate range they operate on
772 lagrange_first = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size };
773 lagrange_result_row = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size, /*start_index*/ RESULT_ROW };
774 lagrange_even_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW,
775 /*virtual_size*/ circuit_size,
776 /*start_index=*/RESULT_ROW };
777 lagrange_odd_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - 1,
778 /*virtual_size*/ circuit_size,
779 /*start_index=*/RESULT_ROW + 1 };
780 lagrange_last_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE,
781 /*virtual_size*/ circuit_size };
782 lagrange_mini_masking = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RANDOMNESS_START,
783 /*virtual_size*/ circuit_size,
784 /*start_index=*/RANDOMNESS_START };
785 lagrange_masking = Polynomial{ /*size*/ circuit_size - circuit_size_without_masking,
786 /*virtual_size*/ circuit_size,
787 /*start_index*/ circuit_size_without_masking };
788 lagrange_last = Polynomial{ /*size*/ 1,
789 /*virtual_size*/ circuit_size,
790 /*start_index*/ circuit_size - 1 };
791 lagrange_real_last = Polynomial{ /*size*/ 1,
792 /*virtual_size*/ circuit_size,
793 /*start_index*/ circuit_size_without_masking - 1 };
794 ordered_extra_range_constraints_numerator =
795 Polynomial{ SORTED_STEPS_COUNT * (NUM_INTERLEAVED_WIRES + 1), circuit_size };
796
797 set_shifted();
798 }
801 ProverPolynomials(ProverPolynomials&& o) noexcept = default;
804 [[nodiscard]] static size_t get_polynomial_size() { return 1UL << CONST_TRANSLATOR_LOG_N; }
809 [[nodiscard]] AllValues get_row(size_t row_idx) const
810 {
811 AllValues result;
812 for (auto [result_field, polynomial] : zip_view(result.get_all(), this->get_all())) {
813 result_field = polynomial[row_idx];
814 }
815 return result;
816 }
817 // Set all shifted polynomials based on their to-be-shifted counterpart
819 {
820 for (auto [shifted, to_be_shifted] : zip_view(get_shifted(), get_to_be_shifted())) {
821 shifted = to_be_shifted.shifted();
822 }
823 }
824 };
825
842
848
854
859
864
871 class CommitmentLabels : public AllEntities<std::string> {
872 public:
874 {
875 this->op = "OP";
876 this->x_lo_y_hi = "X_LO_Y_HI";
877 this->x_hi_z_1 = "X_HI_Z_1";
878 this->y_lo_z_2 = "Y_LO_Z_2";
879 this->p_x_low_limbs = "P_X_LOW_LIMBS";
880 this->p_x_high_limbs = "P_X_HIGH_LIMBS";
881 this->p_x_low_limbs_range_constraint_0 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_0";
882 this->p_x_low_limbs_range_constraint_1 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_1";
883 this->p_x_low_limbs_range_constraint_2 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_2";
884 this->p_x_low_limbs_range_constraint_3 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_3";
885 this->p_x_low_limbs_range_constraint_4 = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_4";
886 this->p_x_low_limbs_range_constraint_tail = "P_X_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
887 this->p_x_high_limbs_range_constraint_0 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_0";
888 this->p_x_high_limbs_range_constraint_1 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_1";
889 this->p_x_high_limbs_range_constraint_2 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_2";
890 this->p_x_high_limbs_range_constraint_3 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_3";
891 this->p_x_high_limbs_range_constraint_4 = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_4";
892 this->p_x_high_limbs_range_constraint_tail = "P_X_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
893 this->p_y_low_limbs = "P_Y_LOW_LIMBS";
894 this->p_y_low_limbs_range_constraint_0 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_0";
895 this->p_y_low_limbs_range_constraint_1 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_1";
896 this->p_y_low_limbs_range_constraint_2 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_2";
897 this->p_y_low_limbs_range_constraint_3 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_3";
898 this->p_y_low_limbs_range_constraint_4 = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_4";
899 this->p_y_low_limbs_range_constraint_tail = "P_Y_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
900 this->p_y_high_limbs = "P_Y_HIGH_LIMBS";
901 this->p_y_high_limbs_range_constraint_0 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_0";
902 this->p_y_high_limbs_range_constraint_1 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_1";
903 this->p_y_high_limbs_range_constraint_2 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_2";
904 this->p_y_high_limbs_range_constraint_3 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_3";
905 this->p_y_high_limbs_range_constraint_4 = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_4";
906 this->p_y_high_limbs_range_constraint_tail = "P_Y_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
907 this->z_low_limbs = "Z_LOw_LIMBS";
908 this->z_low_limbs_range_constraint_0 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_0";
909 this->z_low_limbs_range_constraint_1 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_1";
910 this->z_low_limbs_range_constraint_2 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_2";
911 this->z_low_limbs_range_constraint_3 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_3";
912 this->z_low_limbs_range_constraint_4 = "Z_LOW_LIMBS_RANGE_CONSTRAINT_4";
913 this->z_low_limbs_range_constraint_tail = "Z_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
914 this->z_high_limbs = "Z_HIGH_LIMBS";
915 this->z_high_limbs_range_constraint_0 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_0";
916 this->z_high_limbs_range_constraint_1 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_1";
917 this->z_high_limbs_range_constraint_2 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_2";
918 this->z_high_limbs_range_constraint_3 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_3";
919 this->z_high_limbs_range_constraint_4 = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_4";
920 this->z_high_limbs_range_constraint_tail = "Z_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
921 this->accumulators_binary_limbs_0 = "ACCUMULATORS_BINARY_LIMBS_0";
922 this->accumulators_binary_limbs_1 = "ACCUMULATORS_BINARY_LIMBS_1";
923 this->accumulators_binary_limbs_2 = "ACCUMULATORS_BINARY_LIMBS_2";
924 this->accumulators_binary_limbs_3 = "ACCUMULATORS_BINARY_LIMBS_3";
925 this->accumulator_low_limbs_range_constraint_0 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_0";
926 this->accumulator_low_limbs_range_constraint_1 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_1";
927 this->accumulator_low_limbs_range_constraint_2 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_2";
928 this->accumulator_low_limbs_range_constraint_3 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_3";
929 this->accumulator_low_limbs_range_constraint_4 = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_4";
930 this->accumulator_low_limbs_range_constraint_tail = "ACCUMULATOR_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
931 this->accumulator_high_limbs_range_constraint_0 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_0";
932 this->accumulator_high_limbs_range_constraint_1 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_1";
933 this->accumulator_high_limbs_range_constraint_2 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_2";
934 this->accumulator_high_limbs_range_constraint_3 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_3";
935 this->accumulator_high_limbs_range_constraint_4 = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_4";
936 this->accumulator_high_limbs_range_constraint_tail = "ACCUMULATOR_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
937 this->quotient_low_binary_limbs = "QUOTIENT_LOW_BINARY_LIMBS";
938 this->quotient_high_binary_limbs = "QUOTIENT_HIGH_BINARY_LIMBS";
939 this->quotient_low_limbs_range_constraint_0 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_0";
940 this->quotient_low_limbs_range_constraint_1 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_1";
941 this->quotient_low_limbs_range_constraint_2 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_2";
942 this->quotient_low_limbs_range_constraint_3 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_3";
943 this->quotient_low_limbs_range_constraint_4 = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_4";
944 this->quotient_low_limbs_range_constraint_tail = "QUOTIENT_LOW_LIMBS_RANGE_CONSTRAINT_TAIL";
945 this->quotient_high_limbs_range_constraint_0 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_0";
946 this->quotient_high_limbs_range_constraint_1 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_1";
947 this->quotient_high_limbs_range_constraint_2 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_2";
948 this->quotient_high_limbs_range_constraint_3 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_3";
949 this->quotient_high_limbs_range_constraint_4 = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_4";
950 this->quotient_high_limbs_range_constraint_tail = "QUOTIENT_HIGH_LIMBS_RANGE_CONSTRAINT_TAIL";
951 this->relation_wide_limbs = "RELATION_WIDE_LIMBS";
952 this->relation_wide_limbs_range_constraint_0 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_0";
953 this->relation_wide_limbs_range_constraint_1 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_1";
954 this->relation_wide_limbs_range_constraint_2 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_2";
955 this->relation_wide_limbs_range_constraint_3 = "RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_3";
956 this->ordered_range_constraints_0 = "ORDERED_RANGE_CONSTRAINTS_0";
957 this->ordered_range_constraints_1 = "ORDERED_RANGE_CONSTRAINTS_1";
958 this->ordered_range_constraints_2 = "ORDERED_RANGE_CONSTRAINTS_2";
959 this->ordered_range_constraints_3 = "ORDERED_RANGE_CONSTRAINTS_3";
960 this->ordered_range_constraints_4 = "ORDERED_RANGE_CONSTRAINTS_4";
961 this->z_perm = "Z_PERM";
962 this->interleaved_range_constraints_0 = "INTERLEAVED_RANGE_CONSTRAINTS_0";
963 this->interleaved_range_constraints_1 = "INTERLEAVED_RANGE_CONSTRAINTS_1";
964 this->interleaved_range_constraints_2 = "INTERLEAVED_RANGE_CONSTRAINTS_2";
965 this->interleaved_range_constraints_3 = "INTERLEAVED_RANGE_CONSTRAINTS_3";
966
967 // "__" are only used for debugging
968 this->lagrange_first = "__LAGRANGE_FIRST";
969 this->lagrange_last = "__LAGRANGE_LAST";
970 this->lagrange_odd_in_minicircuit = "__LAGRANGE_ODD_IN_MINICIRCUIT";
971 this->lagrange_even_in_minicircuit = "__LAGRANGE_EVEN_IN_MINICIRCUIT";
972 this->lagrange_result_row = "__LAGRANGE_RESULT_ROW";
973 this->lagrange_last_in_minicircuit = "__LAGRANGE_LAST_IN_MINICIRCUIT";
974 this->ordered_extra_range_constraints_numerator = "__ORDERED_EXTRA_RANGE_CONSTRAINTS_NUMERATOR";
975 this->lagrange_masking = "__LAGRANGE_MASKING";
976 this->lagrange_mini_masking = "__LAGRANGE_MINI_MASKING";
977 this->lagrange_real_last = "__LAGRANGE_REAL_LAST";
978 };
979 };
980
981 template <typename Commitment, typename VerificationKey>
982 class VerifierCommitments_ : public AllEntities<Commitment> {
983 public:
984 VerifierCommitments_(const std::shared_ptr<VerificationKey>& verification_key)
985 {
986 this->lagrange_first = verification_key->lagrange_first;
987 this->lagrange_last = verification_key->lagrange_last;
988 this->lagrange_odd_in_minicircuit = verification_key->lagrange_odd_in_minicircuit;
989 this->lagrange_even_in_minicircuit = verification_key->lagrange_even_in_minicircuit;
990 this->lagrange_result_row = verification_key->lagrange_result_row;
991 this->lagrange_last_in_minicircuit = verification_key->lagrange_last_in_minicircuit;
992 this->ordered_extra_range_constraints_numerator =
993 verification_key->ordered_extra_range_constraints_numerator;
994 this->lagrange_masking = verification_key->lagrange_masking;
995 this->lagrange_mini_masking = verification_key->lagrange_mini_masking;
996 this->lagrange_real_last = verification_key->lagrange_real_last;
997 }
998 };
999
1007 template <typename ProverPolynomialsOrPartiallyEvaluatedMultivariates, typename EdgeType>
1008 static bool skip_entire_row([[maybe_unused]] const ProverPolynomialsOrPartiallyEvaluatedMultivariates& polynomials,
1009 [[maybe_unused]] const EdgeType edge_idx)
1010 {
1011 // TODO(@Rumata888) do you know of a more efficient way of determining if we can skip a row?
1012 auto s0 = polynomials.ordered_range_constraints_0_shift[edge_idx];
1013 auto s1 = polynomials.ordered_range_constraints_1_shift[edge_idx];
1014 auto s2 = polynomials.ordered_range_constraints_2_shift[edge_idx];
1015 auto s3 = polynomials.ordered_range_constraints_3_shift[edge_idx];
1016 auto s4 = polynomials.ordered_range_constraints_4_shift[edge_idx];
1017 auto s5 = polynomials.ordered_range_constraints_0_shift[edge_idx + 1];
1018 auto s6 = polynomials.ordered_range_constraints_1_shift[edge_idx + 1];
1019 auto s7 = polynomials.ordered_range_constraints_2_shift[edge_idx + 1];
1020 auto s8 = polynomials.ordered_range_constraints_3_shift[edge_idx + 1];
1021 auto s9 = polynomials.ordered_range_constraints_4_shift[edge_idx + 1];
1022 auto shift_0 = (s0 == 0) && (s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 0) && (s5 == 0) && (s6 == 0) &&
1023 (s7 == 0) && (s8 == 0) && (s9 == 0);
1024 return shift_0 && (polynomials.z_perm[edge_idx] == polynomials.z_perm_shift[edge_idx]) &&
1025 (polynomials.z_perm[edge_idx + 1] == polynomials.z_perm_shift[edge_idx + 1]) &&
1026 polynomials.lagrange_last[edge_idx] == 0 && polynomials.lagrange_last[edge_idx + 1] == 0;
1027 }
1029};
1030
1031} // 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 𝔾₁.
Simple verification key class for fixed-size circuits (ECCVM, Translator).
Definition flavor.hpp:136
A container for storing the partially evaluated multivariates produced by sumcheck.
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)
DEFINE_COMPOUND_GET_ALL(MaskingEntities< DataType >, PrecomputedEntities< DataType >, WitnessEntities< DataType >, ShiftedEntities< DataType >) auto get_precomputed() const
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.
Container for ZK entities (gemini masking polynomial for ZK-PCS)
Non-op-queue wires that need to be shifted.
DEFINE_FLAVOR_MEMBERS(DataType, 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)
Op queue wires (non-shifted): these represent the op queue and are provided by the merge protocol.
Op queue wires (to be shifted): first 3 wires of the to-be-shifted group.
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 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...
VerifierCommitments_(const std::shared_ptr< VerificationKey > &verification_key)
All wire entities that are not shifted (currently just the op queue wire)
All wires to be shifted (op queue + non-op-queue)
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_non_opqueue_wires_and_ordered_range_constraints()
Non-op-queue wires and ordered range constraints (committed to by translator prover)
auto get_op_queue_wires()
Get only the op queue wires (provided by merge protocol, not committed to in translator)
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_MASKING_POLYNOMIALS
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 RANDOMNESS_START
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 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_MASKED_ROWS_END
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 NUM_SHIFTED_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 INTERLEAVING_GROUP_SIZE
static constexpr size_t num_frs_fr
static constexpr size_t INTERLEAVED_START
static constexpr size_t VIRTUAL_LOG_N
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
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
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.
Definition api.hpp:5
RefArray< T,(Ns+...)> constexpr concatenate(const RefArray< T, Ns > &... ref_arrays)
Concatenates multiple RefArray objects into a single RefArray.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Stores the fixed Translator VK commitments (to precomputed polynomials) that depend only on the circu...