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