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