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
30
31namespace bb {
32
34
35 public:
38 using PCS = KZG<Curve>;
46 using Codec = FrCodec;
49
50 // indicates when evaluating sumcheck, edges must be extended to be MAX_PARTIAL_RELATION_LENGTH
51 static constexpr bool USE_SHORT_MONOMIALS = false;
52
53 // Indicates that this flavor runs with ZK Sumcheck.
54 static constexpr bool HasZK = true;
55 // Translator has no disabled rows at the top of the trace.
56 static constexpr size_t TRACE_OFFSET = 0;
57 // Translator proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
58 static constexpr bool USE_PADDING = false;
59 // Important: these constants cannot be arbitrarily changed - please consult with a member of the Crypto team if
60 // they become too small.
61
62 // The number of entities added for ZK (gemini_masking_poly)
63 static constexpr size_t NUM_MASKING_POLYNOMIALS = 1;
64
65 // None of this parameters can be changed
66 // Number of wires representing the op queue whose commitments are going to be checked against those from the
67 // final round of merge
68 static constexpr size_t NUM_OP_QUEUE_WIRES = 4;
69
70 // How many mini_circuit_size polynomials are concatenated in one concatenated poly
71 static constexpr size_t CONCATENATION_GROUP_SIZE = 16;
72
73 // The fixed log size of Translator mini circuit. It should be determined by the size of the EccOpQueue.
74 static constexpr size_t LOG_MINI_CIRCUIT_SIZE = CONST_TRANSLATOR_MINI_CIRCUIT_LOG_SIZE;
75
76 // Log of size of concatenated and ordered polynomials
78
79 // For the translator, the genuine and virtual log circuit size coincide
80 static constexpr size_t VIRTUAL_LOG_N = CONST_TRANSLATOR_LOG_N;
81
82 static constexpr size_t MINI_CIRCUIT_SIZE = 1UL << LOG_MINI_CIRCUIT_SIZE;
83
84 // The number of concatenated polynomials (4 range constraint groups + 1 non-range group)
85 static constexpr size_t NUM_CONCATENATED_POLYS = 5;
86
87 // The step in the DeltaRangeConstraint relation i.e. the maximum difference between two consecutive values
88 static constexpr size_t SORT_STEP = 3;
89
90 // Number of wires
91 static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
92
93 // The result of evaluating the polynomials in the nonnative form in translator circuit, stored as limbs and
94 // referred to as accumulated_result. This is reconstructed in it's base field form and sent to the verifier
95 // responsible for checking it against the evaluations received from ECCVM.
96 static constexpr size_t RESULT_ROW = CircuitBuilder::RESULT_ROW;
97
98 // Number of random ops found at he end of Translator trace multiplied by 2 as each accumulation gates occupies two
99 // rows.
101
102 // Maximum number of random masking values any ordered polynomial will have at the end
103 // Total scattered masking positions = CONCATENATION_GROUP_SIZE * NUM_MASKED_ROWS_END
104 // This is the space reserved at the end of each ordered polynomial (contiguous)
106
107 // Index at which random coefficients start (for zk) within Translator trace.
108 // The first 2 rows are zeros for polynomial shiftability (one op's worth of rows).
109 static constexpr size_t RANDOMNESS_START = 2;
110
111 // The bitness of the range constraint
113
114 // Number of bits in a binary limb
115 // This is not a configurable value. Relations are sepcifically designed for it to be 68
117
119 // define the tuple of Relations that comprise the Sumcheck relation
120 template <typename FF>
129
130 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
131 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
132
133 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
134
135 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
136 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
137 // length = 3.
138 // The degree has to be further increased because the relation is multiplied by the Row Disabling Polynomial
139 // total degree = sumcheck relation degree + 1 (PowZeta) + 1 (masking)
142 "LIBRA_UNIVARIATES_LENGTH must be equal to Translator::BATCHED_RELATION_PARTIAL_LENGTH");
144
145 static constexpr size_t num_frs_comm = FrCodec::calc_num_fields<Commitment>();
146 static constexpr size_t num_frs_fr = FrCodec::calc_num_fields<FF>();
147 static constexpr size_t num_frs_fq = FrCodec::calc_num_fields<BF>();
148
153 template <typename DataType_> class PrecomputedEntities {
154 public:
155 bool operator==(const PrecomputedEntities& other) const = default;
156 using DataType = DataType_;
158 ordered_extra_range_constraints_numerator, // column 0
159 lagrange_first, // column 1
160 lagrange_last, // column 2
161 lagrange_odd_in_minicircuit, // column 3
162 lagrange_even_in_minicircuit, // column 4
163 lagrange_result_row, // column 5
164 lagrange_last_in_minicircuit, // column 6
165 lagrange_masking, // column 7
166 lagrange_mini_masking, // column 8
167 lagrange_real_last, // column 9
168 lagrange_ordered_masking); // column 10
169 };
170
171 template <typename DataType> class ConcatenatedPolynomials {
172 public:
173 DEFINE_FLAVOR_MEMBERS(DataType,
174 concatenated_range_constraints_0, // column 0
175 concatenated_range_constraints_1, // column 1
176 concatenated_range_constraints_2, // column 2
177 concatenated_range_constraints_3, // column 3
178 concatenated_non_range) // column 4
179 };
183 template <typename DataType> class NonRangeMainWires {
184 public:
185 DEFINE_FLAVOR_MEMBERS(DataType,
186 p_x_low_limbs, // column 0
187 p_x_high_limbs, // column 1
188 p_y_low_limbs, // column 2
189 p_y_high_limbs, // column 3
190 z_low_limbs, // column 4
191 z_high_limbs, // column 5
192 accumulators_binary_limbs_0, // column 6
193 accumulators_binary_limbs_1, // column 7
194 accumulators_binary_limbs_2, // column 8
195 accumulators_binary_limbs_3, // column 9
196 quotient_low_binary_limbs, // column 10
197 quotient_high_binary_limbs, // column 11
198 relation_wide_limbs) // column 12
199 };
200
204 template <typename DataType> class RangeConstraintWires {
205 public:
207 p_x_low_limbs_range_constraint_0, // column 0
208 p_x_low_limbs_range_constraint_1, // column 17
209 p_x_low_limbs_range_constraint_2, // column 18
210 p_x_low_limbs_range_constraint_3, // column 19
211 p_x_low_limbs_range_constraint_4, // column 20
212 p_x_low_limbs_range_constraint_tail, // column 21
213 p_x_high_limbs_range_constraint_0, // column 22
214 p_x_high_limbs_range_constraint_1, // column 23
215 p_x_high_limbs_range_constraint_2, // column 24
216 p_x_high_limbs_range_constraint_3, // column 25
217 p_x_high_limbs_range_constraint_4, // column 26
218 p_x_high_limbs_range_constraint_tail, // column 27
219 p_y_low_limbs_range_constraint_0, // column 28
220 p_y_low_limbs_range_constraint_1, // column 29
221 p_y_low_limbs_range_constraint_2, // column 30
222 p_y_low_limbs_range_constraint_3, // column 31
223 p_y_low_limbs_range_constraint_4, // column 32
224 p_y_low_limbs_range_constraint_tail, // column 33
225 p_y_high_limbs_range_constraint_0, // column 34
226 p_y_high_limbs_range_constraint_1, // column 35
227 p_y_high_limbs_range_constraint_2, // column 36
228 p_y_high_limbs_range_constraint_3, // column 37
229 p_y_high_limbs_range_constraint_4, // column 38
230 p_y_high_limbs_range_constraint_tail, // column 39
231 z_low_limbs_range_constraint_0, // column 40
232 z_low_limbs_range_constraint_1, // column 41
233 z_low_limbs_range_constraint_2, // column 42
234 z_low_limbs_range_constraint_3, // column 43
235 z_low_limbs_range_constraint_4, // column 44
236 z_low_limbs_range_constraint_tail, // column 45
237 z_high_limbs_range_constraint_0, // column 46
238 z_high_limbs_range_constraint_1, // column 47
239 z_high_limbs_range_constraint_2, // column 48
240 z_high_limbs_range_constraint_3, // column 49
241 z_high_limbs_range_constraint_4, // column 50
242 z_high_limbs_range_constraint_tail, // column 51
243 accumulator_low_limbs_range_constraint_0, // column 52
244 accumulator_low_limbs_range_constraint_1, // column 53
245 accumulator_low_limbs_range_constraint_2, // column 54
246 accumulator_low_limbs_range_constraint_3, // column 55
247 accumulator_low_limbs_range_constraint_4, // column 56
248 accumulator_low_limbs_range_constraint_tail, // column 57
249 accumulator_high_limbs_range_constraint_0, // column 58
250 accumulator_high_limbs_range_constraint_1, // column 59
251 accumulator_high_limbs_range_constraint_2, // column 60
252 accumulator_high_limbs_range_constraint_3, // column 61
253 accumulator_high_limbs_range_constraint_4, // column 62
254 accumulator_high_limbs_range_constraint_tail, // column 63
255 quotient_low_limbs_range_constraint_0, // column 64
256 quotient_low_limbs_range_constraint_1, // column 65
257 quotient_low_limbs_range_constraint_2, // column 66
258 quotient_low_limbs_range_constraint_3, // column 67
259 quotient_low_limbs_range_constraint_4, // column 68
260 quotient_low_limbs_range_constraint_tail, // column 69
261 quotient_high_limbs_range_constraint_0, // column 70
262 quotient_high_limbs_range_constraint_1, // column 71
263 quotient_high_limbs_range_constraint_2, // column 72
264 quotient_high_limbs_range_constraint_3, // column 73
265 quotient_high_limbs_range_constraint_4, // column 74
266 quotient_high_limbs_range_constraint_tail, // column 75
267 relation_wide_limbs_range_constraint_0, // column 76
268 relation_wide_limbs_range_constraint_1, // column 77
269 relation_wide_limbs_range_constraint_2, // column 62
270 relation_wide_limbs_range_constraint_3); // column 63
271 };
272
276 template <typename DataType>
282
286 template <typename DataType> class OpQueueWiresToBeShiftedEntities {
287 public:
288 DEFINE_FLAVOR_MEMBERS(DataType,
289 x_lo_y_hi, // column 0
290 x_hi_z_1, // column 1
291 y_lo_z_2) // column 2
292 };
293
297 template <typename DataType>
303
304 // Note: These are technically derived from wires but do not depend on challenges (like z_perm). They are committed
305 // to in the wires commitment round.
306 template <typename DataType> class OrderedRangeConstraints {
307 public:
309 ordered_range_constraints_0, // column 0
310 ordered_range_constraints_1, // column 1
311 ordered_range_constraints_2, // column 2
312 ordered_range_constraints_3, // column 3
313 ordered_range_constraints_4); // column 4
314 };
315
319 template <typename DataType> class OpQueueWireNonshiftedEntities {
320 public:
322 op // column 0
323 );
324 };
325
329 template <typename DataType> class WireNonshiftedEntities : public OpQueueWireNonshiftedEntities<DataType> {
330 public:
332 };
333
334 template <typename DataType> class DerivedWitnessEntities {
335 public:
337 z_perm); // column 0
338 };
342 template <typename DataType>
403
407 template <typename DataType> class OpQueueShiftedEntities {
408 public:
409 DEFINE_FLAVOR_MEMBERS(DataType,
410 x_lo_y_hi_shift, // column 0
411 x_hi_z_1_shift, // column 1
412 y_lo_z_2_shift) // column 2
413 };
414
418 template <typename DataType> class NonOpQueueShiftedEntities {
419 public:
420 DEFINE_FLAVOR_MEMBERS(DataType,
421 p_x_low_limbs_shift, // column 3
422 p_x_high_limbs_shift, // column 10
423 p_y_low_limbs_shift, // column 17
424 p_y_high_limbs_shift, // column 24
425 z_low_limbs_shift, // column 31
426 z_high_limbs_shift, // column 38
427 accumulators_binary_limbs_0_shift, // column 45
428 accumulators_binary_limbs_1_shift, // column 46
429 accumulators_binary_limbs_2_shift, // column 47
430 accumulators_binary_limbs_3_shift, // column 48
431 quotient_low_binary_limbs_shift, // column 61
432 quotient_high_binary_limbs_shift, // column 62
433 relation_wide_limbs_shift, // column 75
434 p_x_low_limbs_range_constraint_0_shift, // column 4
435 p_x_low_limbs_range_constraint_1_shift, // column 5
436 p_x_low_limbs_range_constraint_2_shift, // column 6
437 p_x_low_limbs_range_constraint_3_shift, // column 7
438 p_x_low_limbs_range_constraint_4_shift, // column 8
439 p_x_low_limbs_range_constraint_tail_shift, // column 9
440 p_x_high_limbs_range_constraint_0_shift, // column 11
441 p_x_high_limbs_range_constraint_1_shift, // column 12
442 p_x_high_limbs_range_constraint_2_shift, // column 13
443 p_x_high_limbs_range_constraint_3_shift, // column 14
444 p_x_high_limbs_range_constraint_4_shift, // column 15
445 p_x_high_limbs_range_constraint_tail_shift, // column 16
446 p_y_low_limbs_range_constraint_0_shift, // column 18
447 p_y_low_limbs_range_constraint_1_shift, // column 19
448 p_y_low_limbs_range_constraint_2_shift, // column 20
449 p_y_low_limbs_range_constraint_3_shift, // column 21
450 p_y_low_limbs_range_constraint_4_shift, // column 22
451 p_y_low_limbs_range_constraint_tail_shift, // column 23
452 p_y_high_limbs_range_constraint_0_shift, // column 25
453 p_y_high_limbs_range_constraint_1_shift, // column 26
454 p_y_high_limbs_range_constraint_2_shift, // column 27
455 p_y_high_limbs_range_constraint_3_shift, // column 28
456 p_y_high_limbs_range_constraint_4_shift, // column 29
457 p_y_high_limbs_range_constraint_tail_shift, // column 30
458 z_low_limbs_range_constraint_0_shift, // column 32
459 z_low_limbs_range_constraint_1_shift, // column 33
460 z_low_limbs_range_constraint_2_shift, // column 34
461 z_low_limbs_range_constraint_3_shift, // column 35
462 z_low_limbs_range_constraint_4_shift, // column 36
463 z_low_limbs_range_constraint_tail_shift, // column 37
464 z_high_limbs_range_constraint_0_shift, // column 39
465 z_high_limbs_range_constraint_1_shift, // column 40
466 z_high_limbs_range_constraint_2_shift, // column 41
467 z_high_limbs_range_constraint_3_shift, // column 42
468 z_high_limbs_range_constraint_4_shift, // column 43
469 z_high_limbs_range_constraint_tail_shift, // column 44
470 accumulator_low_limbs_range_constraint_0_shift, // column 49
471 accumulator_low_limbs_range_constraint_1_shift, // column 50
472 accumulator_low_limbs_range_constraint_2_shift, // column 51
473 accumulator_low_limbs_range_constraint_3_shift, // column 52
474 accumulator_low_limbs_range_constraint_4_shift, // column 53
475 accumulator_low_limbs_range_constraint_tail_shift, // column 54
476 accumulator_high_limbs_range_constraint_0_shift, // column 55
477 accumulator_high_limbs_range_constraint_1_shift, // column 56
478 accumulator_high_limbs_range_constraint_2_shift, // column 57
479 accumulator_high_limbs_range_constraint_3_shift, // column 58
480 accumulator_high_limbs_range_constraint_4_shift, // column 59
481 accumulator_high_limbs_range_constraint_tail_shift, // column 60
482 quotient_low_limbs_range_constraint_0_shift, // column 63
483 quotient_low_limbs_range_constraint_1_shift, // column 64
484 quotient_low_limbs_range_constraint_2_shift, // column 65
485 quotient_low_limbs_range_constraint_3_shift, // column 66
486 quotient_low_limbs_range_constraint_4_shift, // column 67
487 quotient_low_limbs_range_constraint_tail_shift, // column 68
488 quotient_high_limbs_range_constraint_0_shift, // column 69
489 quotient_high_limbs_range_constraint_1_shift, // column 70
490 quotient_high_limbs_range_constraint_2_shift, // column 71
491 quotient_high_limbs_range_constraint_3_shift, // column 72
492 quotient_high_limbs_range_constraint_4_shift, // column 73
493 quotient_high_limbs_range_constraint_tail_shift, // column 74
494 relation_wide_limbs_range_constraint_0_shift, // column 76
495 relation_wide_limbs_range_constraint_1_shift, // column 77
496 relation_wide_limbs_range_constraint_2_shift, // column 78
497 relation_wide_limbs_range_constraint_3_shift) // column 79
498 };
499
503 template <typename DataType> class DerivedShiftedEntities {
504 public:
505 DEFINE_FLAVOR_MEMBERS(DataType,
506 ordered_range_constraints_0_shift, // column 80
507 ordered_range_constraints_1_shift, // column 81
508 ordered_range_constraints_2_shift, // column 82
509 ordered_range_constraints_3_shift, // column 83
510 ordered_range_constraints_4_shift, // column 84
511 z_perm_shift) // column 85
512 };
513
517 template <typename DataType>
518 class ShiftedEntities : public OpQueueShiftedEntities<DataType>,
519 public NonOpQueueShiftedEntities<DataType>,
520 public DerivedShiftedEntities<DataType> {
521 public:
535
541 {
542 static DataType zero_value = DataType(0);
543 return partition_minicircuit_wires_into_groups<DataType>(NonOpQueueShiftedEntities<DataType>::get_all(),
544 zero_value);
545 };
546 };
547
552 template <typename DataType> class MaskingEntities {
553 public:
554 DEFINE_FLAVOR_MEMBERS(DataType, gemini_masking_poly)
555 };
556
565 template <typename DataType>
566 class AllEntities : public MaskingEntities<DataType>,
567 public PrecomputedEntities<DataType>,
568 public WitnessEntities<DataType>,
569 public ShiftedEntities<DataType> {
570 public:
580
586
592 {
593 return concatenate(
594 MaskingEntities<DataType>::get_all(), // gemini_masking_poly
595 RefArray<DataType, 1>{ this->ordered_extra_range_constraints_numerator }, // non-computable precomputed
596 WireNonshiftedEntities<DataType>::get_all(), // op (from merge protocol)
600 }
601
613
616
633
638
643
644 friend std::ostream& operator<<(std::ostream& os, const AllEntities& a)
645 {
646 os << "{ ";
647 std::ios_base::fmtflags f(os.flags());
648 auto entities = a.get_all();
649 for (size_t i = 0; i < entities.size() - 1; i++) {
650 os << "e[" << std::setw(2) << i << "] = " << (entities[i]) << ",\n";
651 }
652 os << "e[" << std::setw(2) << (entities.size() - 1) << "] = " << entities[entities.size() - 1] << " }";
653
654 os.flags(f);
655 return os;
656 }
657 };
658
663 class AllValues : public AllEntities<FF> {
664 public:
666 using Base::Base;
667 };
668
669 // ========================================
670 // Derived entity counts (from entity class sizes)
671 // ========================================
675
676 // Witness = WireNonshifted + WireToBeShifted + OrderedRange + Derived + Concatenated
677 static constexpr size_t NUM_WITNESS_ENTITIES =
682
683 // Shifted = OpQueueShifted + NonOpQueueShifted + DerivedShifted
687
688 static constexpr size_t NUM_ALL_ENTITIES =
690
691 // All precomputed selectors except ordered_extra_range_constraints_numerator are computable
693
694 // Minicircuit wires: NonRangeMain + RangeConstraint (the non-op-queue wires that get shifted)
695 static constexpr size_t NUM_MINICIRCUIT_WIRES =
698 "Shifted minicircuit wires must match unshifted");
699 // 77 unshifted + 77 shifted minicircuit wire evaluations are sent mid-sumcheck
701
702 // Number of evaluations sent in proof (all minus computable precomputed minus reconstructed concat evals)
703 static constexpr size_t NUM_SENT_EVALUATIONS =
706
707 // Total number of minicircuit wires across all concatenation groups
711 "Range constraint wires must fill exactly 4 concatenation groups");
712
713 // PCS batch sizes
720 static constexpr size_t NUM_PCS_UNSHIFTED = NUM_MASKING_POLYNOMIALS +
724
725 // Indices for partitioning AllEntities
728
729 // Commitments sent in wire round: concatenated + ordered range constraints
731
732 // A container to be fed to ShpleminiVerifier to avoid redundant scalar muls.
733 // Identifies commitments that appear in both the unshifted and shifted batches:
734 // Unshifted batch: masking(1) + ordered_extra(1) + op(1) + ordered(5) + z_perm(1) + concat(5) = 14
735 // Shifted batch: op_queue(3) + ordered(5) + z_perm(1) + concat(5) = 14
736 // Range 1: ordered(5) + z_perm(1) — stored indices 2..7 (unshifted) ↔ 16..21 (shifted)
737 // Range 2: concatenated(5) — stored indices 8..12 (unshifted) ↔ 22..26 (shifted)
738 // (Stored indices are 0-based after ZK offset; offset=2 accounts for Q_commitment + gemini_masking_poly)
743 2 + NUM_ORDERED_RANGE + 1,
746
747 static constexpr size_t PROOF_LENGTH =
748 /* 1. Gemini masking poly commitment */ (num_frs_comm) +
749 /* 2. Wire commitments: concatenated + ordered */
751 /* 3. Z_PERM commitment */ (num_frs_comm) +
752 /* 4. Libra concatenation commitment */ (num_frs_comm) +
753 /* 5. Libra sum */ (num_frs_fr) +
754 /* 6. CONST_TRANSLATOR_LOG_N sumcheck univariates */
756 /* 7. sumcheck evaluations (computable precomputed and concat evals excluded) */
758 /* 8. Libra claimed evaluation */ (num_frs_fr) +
759 /* 9. Libra grand sum commitment */ (num_frs_comm) +
760 /* 10. Libra quotient commitment */ (num_frs_comm) +
761 /* 11. CONST_TRANSLATOR_LOG_N - 1 Gemini Fold commitments */
763 /* 12. CONST_TRANSLATOR_LOG_N Gemini a evaluations */
765 /* 13. NUM_SMALL_IPA_EVALUATIONS libra evals */ (NUM_SMALL_IPA_EVALUATIONS * num_frs_fr) +
766 /* 14. Shplonk Q commitment */ (num_frs_comm) +
767 /* 15. KZG W commitment */ (num_frs_comm);
768
769 // Proof length when using committed sumcheck: each round sends a commitment + 2 scalar evaluations
770 // instead of BATCHED_RELATION_PARTIAL_LENGTH scalars.
771 static constexpr size_t COMMITTED_SUMCHECK_PROOF_LENGTH =
774
775 // ===== Static assert to ensure a valid trace can be proven ======
776
777 // The number of "steps" inserted in ordered range constraint polynomials to ensure that the
778 // DeltaRangeConstraintRelation can always be satisfied if the polynomial is within the appropriate range.
779 static constexpr size_t SORTED_STEPS_COUNT = ((1 << MICRO_LIMB_BITS) / SORT_STEP) + 1;
780
781 // The number of masking values in the overflow columns used for the ordered range constraint
782 static constexpr size_t MASKING_OVERFLOW_COLUMN =
784
787 "Translator circuit is too small for defined number of steps "
788 "(TranslatorDeltaRangeConstraintRelation). ");
789
790 // ================================================================
791
799 template <typename DataType, typename WireRefs>
801 DataType& zero_value)
802 {
803 constexpr size_t num_non_range = NonRangeMainWires<DataType>::_members_size;
804 constexpr size_t num_range = RangeConstraintWires<DataType>::_members_size;
805 static_assert(num_range % CONCATENATION_GROUP_SIZE == 0);
806 constexpr size_t num_range_groups = num_range / CONCATENATION_GROUP_SIZE;
807
809 // Groups 0..num_range_groups-1: sequential chunks of range constraint wires
810 for (size_t g = 0; g < num_range_groups; g++) {
812 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
813 group.push_back(wire_refs[num_non_range + g * CONCATENATION_GROUP_SIZE + j]);
814 }
815 groups.push_back(std::move(group));
816 }
817 // Last group: non-range main wires + zero padding
819 for (size_t j = 0; j < num_non_range; j++) {
820 group.push_back(wire_refs[j]);
821 }
822 for (size_t j = num_non_range; j < CONCATENATION_GROUP_SIZE; j++) {
823 group.push_back(zero_value);
824 }
825 groups.push_back(std::move(group));
826 return groups;
827 }
828
832 template <typename FFType>
837
843 template <typename PolyContainer>
845 {
847 size_t dst = 0;
848 for (auto& wire : polys.get_minicircuit_wires()) {
849 result[dst++] = wire[0];
850 }
851 for (auto& wire : polys.get_minicircuit_wires_shifted()) {
852 result[dst++] = wire[0];
853 }
854 return result;
855 }
856
862 template <typename FFType>
865 {
866 size_t src = 0;
867 for (auto& wire : evals.get_minicircuit_wires()) {
868 wire = mid[src++];
869 }
870 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
871 wire = mid[src++];
872 }
873 }
874
883 template <typename FFType>
885 {
886 // 1. Compute the computable precomputed selector evaluations
887 compute_computable_precomputed(evals, challenge);
888
889 // 2. Scale minicircuit wire evaluations by L_0(u_top) = Π_{i=0}^{3} (1 - u_{LOG_MINI + i})
890 FFType l0 = FFType(1);
891 for (size_t i = 0; i < CONST_TRANSLATOR_LOG_N - LOG_MINI_CIRCUIT_SIZE; i++) {
892 l0 *= (FFType(1) - challenge[LOG_MINI_CIRCUIT_SIZE + i]);
893 }
894 for (auto& wire : evals.get_minicircuit_wires()) {
895 wire *= l0;
896 }
897 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
898 wire *= l0;
899 }
900 }
901
910 template <typename FFType>
913 std::span<const FFType> challenge)
914 {
915 set_full_circuit_evaluations(evals, full_circuit);
916 complete_claimed_evaluations(evals, challenge);
917
918 // Reconstruct the 5 concatenated polynomial evaluations from (now L0-scaled) wire evaluations
919 auto groups = evals.get_groups_to_be_concatenated();
920 auto concat_evals = reconstruct_concatenated_evaluations(groups, challenge);
921 auto concat_refs = evals.get_concatenated();
922 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
923 concat_refs[g] = concat_evals[g];
924 }
925 }
926
939 template <typename FFType>
941 const std::vector<RefVector<FFType>>& groups, std::span<const FFType> challenge)
942 {
943 static constexpr size_t NUM_TOP_BITS = numeric::get_msb(CONCATENATION_GROUP_SIZE);
944
945 // Compute CONCATENATION_GROUP_SIZE-point Lagrange basis over the top challenges
946 // a = u[N - 4], b = u[N - 3], c = u[N - 2], d = u[N - 1]
947 // L(0) = (1 - d) * (1 - c) * (1 - b) * (1 - a)
948 // L(1) = (1 - d) * (1 - c) * (1 - b) * ( a)
949 // L(2) = (1 - d) * (1 - c) * ( b) * (1 - a)
950 // L(3) = (1 - d) * (1 - c) * ( b) * ( a)
951 // ...
953 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
954 lagrange_basis[j] = FFType(1);
955 for (size_t bit = 0; bit < NUM_TOP_BITS; bit++) {
956 const FFType& u = challenge[CONST_TRANSLATOR_LOG_N - NUM_TOP_BITS + bit];
957 lagrange_basis[j] *= ((j >> bit) & 1) ? u : (FFType(1) - u);
958 }
959 }
960
961 // L_0 is the "padding" factor from wires having support in [1, MINI)
962 // The reason we need to divide by L_0 is because L_j(u) already accounts for the challenges a, b, c, d:
963 // L_j(u) = (1 - d) * (1 - c) * (1 - b) * (1 - a) * L_j(0, u_bottom)
964 FFType padding_inv = lagrange_basis[0].invert();
965
966 auto reconstruct = [&](const auto& group) -> FFType {
967 FFType result = FFType(0);
968 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
969 result += lagrange_basis[j] * group[j];
970 }
971 return result * padding_inv;
972 };
973
975 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
976 result[g] = reconstruct(groups[g]);
977 }
978 return result;
979 }
980
984 template <typename FFType>
986 {
988 size_t dst = 0;
989 for (auto& entity : evals.get_full_circuit_entities()) {
990 result[dst++] = entity;
991 }
992 return result;
993 }
994
998 template <typename FFType>
1001 {
1002 size_t src = 0;
1003 for (auto& entity : evals.get_full_circuit_entities()) {
1004 entity = full_circuit[src++];
1005 }
1006 }
1007
1011 class ProverPolynomials : public AllEntities<Polynomial> {
1012 public:
1018 {
1019
1020 const size_t circuit_size = 1 << CONST_TRANSLATOR_LOG_N;
1021 for (auto& ordered_range_constraint : get_ordered_range_constraints()) {
1022 ordered_range_constraint = Polynomial{ /*size*/ circuit_size - 1,
1023 /*largest possible index*/ circuit_size,
1024 1 };
1025 }
1026
1027 // Initialize 5 concatenated polynomials (full circuit_size, shiftable with start_index=1)
1028 // Row 0 of block 0 is the no-op row where all values are zero.
1029 for (auto& concat_poly : get_concatenated()) {
1030 concat_poly = Polynomial{ /*size*/ circuit_size - 1,
1031 /*virtual_size*/ circuit_size,
1032 /*start_index*/ 1 };
1033 }
1034 z_perm = Polynomial{ /*size*/ circuit_size - 1,
1035 /*virtual_size*/ circuit_size,
1036 /*start_index*/ 1 };
1037
1038 op = Polynomial{ MINI_CIRCUIT_SIZE, circuit_size };
1039
1040 // All minicircuit wires (non-op-queue) are only non-zero in [1, MINI_CIRCUIT_SIZE)
1042 if (poly.is_empty()) {
1043 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1044 /*virtual_size*/ circuit_size,
1045 /*start_index*/ 1 };
1046 }
1047 }
1048
1049 // Op queue wires to be shifted
1051 if (poly.is_empty()) {
1052 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1053 /*virtual_size*/ circuit_size,
1054 /*start_index*/ 1 };
1055 }
1056 }
1057
1058 // Initialize lagrange polynomials and the ordered extra range constraints numerator (the precomputed
1059 // polynomials) within the appropriate range they operate on
1060 lagrange_first = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size };
1061 lagrange_result_row = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size, /*start_index*/ RESULT_ROW };
1062 lagrange_even_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END,
1063 /*virtual_size*/ circuit_size,
1064 /*start_index=*/RESULT_ROW };
1065 lagrange_odd_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END - 1,
1066 /*virtual_size*/ circuit_size,
1067 /*start_index=*/RESULT_ROW + 1 };
1068 lagrange_last_in_minicircuit = Polynomial{ /*size*/ 1,
1069 /*virtual_size*/ circuit_size,
1070 /*start_index=*/MINI_CIRCUIT_SIZE - NUM_MASKED_ROWS_END - 1 };
1071 lagrange_mini_masking = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RANDOMNESS_START,
1072 /*virtual_size*/ circuit_size,
1073 /*start_index=*/RANDOMNESS_START };
1074 // With concatenation, masking rows are scattered in concatenated polys: end of each of the 16 blocks
1075 // Must span full circuit since values go up to position 15*MINI+(MINI-1)
1076 lagrange_masking = Polynomial{ circuit_size, circuit_size };
1077 // Ordered masking: contiguous at the end (marks masking positions in ordered polynomials)
1078 lagrange_ordered_masking = Polynomial{ /*size*/ MAX_RANDOM_VALUES_PER_ORDERED,
1079 /*virtual_size*/ circuit_size,
1080 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED };
1081 lagrange_last = Polynomial{ /*size*/ 1,
1082 /*virtual_size*/ circuit_size,
1083 /*start_index*/ circuit_size - 1 };
1084 // lagrange_real_last marks the last position with sorted values in ordered polynomials
1085 // (where we check maximum value = 2^14 - 1). With contiguous masking at the end,
1086 // this is at position circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1.
1087 lagrange_real_last = Polynomial{ /*size*/ 1,
1088 /*virtual_size*/ circuit_size,
1089 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1 };
1090 ordered_extra_range_constraints_numerator =
1092 /*virtual_size*/ circuit_size,
1093 /*start_index*/ 0 };
1094
1095 set_shifted();
1096 }
1099 ProverPolynomials(ProverPolynomials&& o) noexcept = default;
1102 [[nodiscard]] static size_t get_polynomial_size() { return 1UL << CONST_TRANSLATOR_LOG_N; }
1107 [[nodiscard]] AllValues get_row(size_t row_idx) const
1108 {
1109 AllValues result;
1110 for (auto [result_field, polynomial] : zip_view(result.get_all(), this->get_all())) {
1111 // Translator polynomials have different support regions (start_index/end_index)
1112 // Return 0 for out-of-bounds access (which is the correct value outside support)
1113 if (row_idx >= polynomial.start_index() && row_idx < polynomial.end_index()) {
1114 result_field = polynomial[row_idx];
1115 } else {
1116 result_field = FF(0);
1117 }
1118 }
1119 return result;
1120 }
1121 // Set all shifted polynomials based on their to-be-shifted counterpart.
1122 // Uses get_all_to_be_shifted() (86 entries for Sumcheck), not get_to_be_shifted() (9 entries for PCS).
1124 {
1125 for (auto [shifted, to_be_shifted] : zip_view(get_shifted(), get_all_to_be_shifted())) {
1126 shifted = to_be_shifted.shifted();
1127 }
1128 }
1129 };
1130
1136 public:
1139
1140 ProverPolynomials polynomials; // storage for all polynomials evaluated by the prover
1142
1143 ProvingKey() = default;
1144 };
1145
1151 template <typename DataType_> class VKEntities {
1152 public:
1153 bool operator==(const VKEntities& other) const = default;
1154 using DataType = DataType_;
1155 DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator);
1156 };
1157
1165
1171
1176
1181
1187 class CommitmentLabels : public AllEntities<std::string> {
1188 public:
1190 {
1191 // Concatenated polynomials (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1192 this->concatenated_range_constraints_0 = "CONCATENATED_RANGE_CONSTRAINTS_0";
1193 this->concatenated_range_constraints_1 = "CONCATENATED_RANGE_CONSTRAINTS_1";
1194 this->concatenated_range_constraints_2 = "CONCATENATED_RANGE_CONSTRAINTS_2";
1195 this->concatenated_range_constraints_3 = "CONCATENATED_RANGE_CONSTRAINTS_3";
1196 this->concatenated_non_range = "CONCATENATED_NON_RANGE";
1197
1198 // Ordered range constraints (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1199 this->ordered_range_constraints_0 = "ORDERED_RANGE_CONSTRAINTS_0";
1200 this->ordered_range_constraints_1 = "ORDERED_RANGE_CONSTRAINTS_1";
1201 this->ordered_range_constraints_2 = "ORDERED_RANGE_CONSTRAINTS_2";
1202 this->ordered_range_constraints_3 = "ORDERED_RANGE_CONSTRAINTS_3";
1203 this->ordered_range_constraints_4 = "ORDERED_RANGE_CONSTRAINTS_4";
1204
1205 // Grand product (committed separately)
1206 this->z_perm = "Z_PERM";
1207 };
1208 };
1209
1210 template <typename Commitment, typename VerificationKey>
1211 class VerifierCommitments_ : public AllEntities<Commitment> {
1212 public:
1213 VerifierCommitments_(const std::shared_ptr<VerificationKey>& verification_key)
1214 {
1215 // Only ordered_extra_range_constraints_numerator needs a VK commitment for PCS.
1216 // All other precomputed selectors are computable (evaluations derived from sumcheck challenge).
1217 this->ordered_extra_range_constraints_numerator =
1218 verification_key->ordered_extra_range_constraints_numerator;
1219 }
1220 };
1221
1229 template <typename ProverPolynomialsOrPartiallyEvaluatedMultivariates, typename EdgeType>
1230 static bool skip_entire_row([[maybe_unused]] const ProverPolynomialsOrPartiallyEvaluatedMultivariates& polynomials,
1231 [[maybe_unused]] const EdgeType edge_idx)
1232 {
1233 auto s0 = polynomials.ordered_range_constraints_0_shift[edge_idx];
1234 auto s1 = polynomials.ordered_range_constraints_1_shift[edge_idx];
1235 auto s2 = polynomials.ordered_range_constraints_2_shift[edge_idx];
1236 auto s3 = polynomials.ordered_range_constraints_3_shift[edge_idx];
1237 auto s4 = polynomials.ordered_range_constraints_4_shift[edge_idx];
1238 auto s5 = polynomials.ordered_range_constraints_0_shift[edge_idx + 1];
1239 auto s6 = polynomials.ordered_range_constraints_1_shift[edge_idx + 1];
1240 auto s7 = polynomials.ordered_range_constraints_2_shift[edge_idx + 1];
1241 auto s8 = polynomials.ordered_range_constraints_3_shift[edge_idx + 1];
1242 auto s9 = polynomials.ordered_range_constraints_4_shift[edge_idx + 1];
1243 auto shift_0 = (s0 == 0) && (s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 0) && (s5 == 0) && (s6 == 0) &&
1244 (s7 == 0) && (s8 == 0) && (s9 == 0);
1245 return shift_0 && (polynomials.z_perm[edge_idx] == polynomials.z_perm_shift[edge_idx]) &&
1246 (polynomials.z_perm[edge_idx + 1] == polynomials.z_perm_shift[edge_idx + 1]) &&
1247 polynomials.lagrange_last[edge_idx] == 0 && polynomials.lagrange_last[edge_idx + 1] == 0;
1248 }
1250};
1251
1252} // namespace bb
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
CommitmentKey object over a pairing group 𝔾₁.
Simple verification key class for fixed-size circuits (ECCVM, Translator, AVM).
Definition flavor.hpp:101
A container for storing the partially evaluated multivariates produced by sumcheck.
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
Definition ref_array.hpp:22
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
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...
A base class labelling all entities (for instance, all of the polynomials used by the prover during s...
DEFINE_COMPOUND_GET_ALL(MaskingEntities< DataType >, PrecomputedEntities< DataType >, WitnessEntities< DataType >, ShiftedEntities< DataType >) auto get_concatenated()
Getter for concatenated polynomials.
friend std::ostream & operator<<(std::ostream &os, const AllEntities &a)
auto get_pcs_unshifted()
All unshifted polynomials for PCS (excludes computable precomputed, includes concatenated).
auto get_full_circuit_entities()
Full-circuit entities sent in the proof (excludes computable precomputed, minicircuit wires,...
auto get_pcs_to_be_shifted()
All to-be-shifted polynomials for PCS (base to-be-shifted + concatenated).
auto get_ordered_range_constraints()
Getter for the ordered entities used in computing the denominator of the grand product in the permuta...
auto get_minicircuit_wires()
The 77 minicircuit wires (unshifted): NonRangeMain(13) + RangeConstraint(64).
auto get_minicircuit_wires_shifted()
The 77 minicircuit wire shifts: corresponds 1:1 with get_minicircuit_wires().
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
A container for commitment labels.
Ordered range constraint + z_perm shifted entities.
Container for ZK entities (gemini masking polynomial for ZK-PCS)
Non-op-queue minicircuit wire shifted entities (mirrors NonOpQueueWiresToBeShiftedEntities)
All non-op-queue wires that need to be shifted (composed of non-range main + range constraint)
Non-range main wires (13 wires that go into concatenated group 4)
Op queue shifted entities (mirrors OpQueueWiresToBeShiftedEntities)
Op queue wires (non-shifted): these represent the op queue and are provided by the merge protocol.
Op queue wires (to be shifted): first 3 wires of the to-be-shifted group.
DEFINE_FLAVOR_MEMBERS(DataType, ordered_range_constraints_0, ordered_range_constraints_1, ordered_range_constraints_2, ordered_range_constraints_3, ordered_range_constraints_4)
A base class labelling precomputed entities and (ordered) subsets of interest.
bool operator==(const PrecomputedEntities &other) const =default
DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator, lagrange_first, lagrange_last, lagrange_odd_in_minicircuit, lagrange_even_in_minicircuit, lagrange_result_row, lagrange_last_in_minicircuit, lagrange_masking, lagrange_mini_masking, lagrange_real_last, lagrange_ordered_masking)
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.
Range constraint wires (64 wires that go into concatenated groups 0-3)
DEFINE_FLAVOR_MEMBERS(DataType, 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)
Represents polynomials shifted by 1 or their evaluations, defined relative to WireToBeShiftedEntities...
std::vector< RefVector< DataType > > get_groups_to_be_concatenated_shifted()
Get the shifted versions of minicircuit wires organized into 5 concatenation groups.
DEFINE_COMPOUND_GET_ALL(OpQueueShiftedEntities< DataType >, NonOpQueueShiftedEntities< DataType >, DerivedShiftedEntities< DataType >) auto get_pcs_shifted()
PCS-level shifted evaluations matching get_to_be_shifted(): op_queue(3) + ordered_range(5) + z_perm(1...
The only precomputed commitment the verifier needs for PCS.
bool operator==(const VKEntities &other) const =default
DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator)
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_all_to_be_shifted()
All polys that need shifted views for Sumcheck (corresponds 1:1 with ShiftedEntities).
DEFINE_COMPOUND_GET_ALL(WireNonshiftedEntities< DataType >, WireToBeShiftedEntities< DataType >, OrderedRangeConstraints< DataType >, DerivedWitnessEntities< DataType >, ConcatenatedPolynomials< DataType >) auto get_wires()
Entities constructed from circuit data.
auto get_non_opqueue_wires_and_ordered_range_constraints()
Concatenated polynomials and ordered range constraints (committed to by translator prover).
std::vector< RefVector< DataType > > get_groups_to_be_concatenated()
Get all minicircuit wire polynomials that are concatenated into the 5 concatenated polys.
auto get_concatenated()
Get the concatenated polynomials.
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 MAX_RANDOM_VALUES_PER_ORDERED
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 std::array< FFType, NUM_FULL_CIRCUIT_EVALUATIONS > get_full_circuit_evaluations(AllEntities< FFType > &evals)
Prover: extract the full-circuit evaluations via get_full_circuit_entities().
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
static constexpr size_t MASKING_OVERFLOW_COLUMN
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t NUM_WIRES
static constexpr size_t NUM_SENT_EVALUATIONS
static constexpr size_t SORT_STEP
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
static constexpr size_t NUM_CONCATENATED_POLYS
static constexpr size_t num_frs_comm
static constexpr size_t TO_BE_SHIFTED_WITNESSES_START
static void compute_computable_precomputed(AllEntities< FFType > &evals, std::span< const FFType > challenge)
Compute the computable precomputed selector evaluations and write them into AllEntities.
static constexpr size_t TRACE_OFFSET
static constexpr size_t NUM_PCS_UNSHIFTED
static void set_minicircuit_evaluations(AllEntities< FFType > &evals, const std::array< FFType, NUM_MINICIRCUIT_EVALUATIONS > &mid)
Verifier: place the 154 raw mid-sumcheck minicircuit wire evaluations into AllEntities.
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t NUM_FULL_CIRCUIT_EVALUATIONS
static constexpr size_t RANDOMNESS_START
static void complete_claimed_evaluations(AllEntities< FFType > &evals, std::span< const FFType > challenge)
Verifier: complete the claimed evaluations for the sumcheck relation check.
static constexpr size_t CONST_TRANSLATOR_LOG_N
static constexpr size_t NUM_OP_QUEUE_WIRES
static constexpr size_t PROOF_LENGTH
Curve::ScalarField FF
Curve::AffineElement Commitment
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
static constexpr size_t COMMITTED_SUMCHECK_PROOF_LENGTH
static constexpr size_t NUM_CONCATENATED_WIRES
static constexpr size_t NUM_MINICIRCUIT_EVALUATIONS
static constexpr size_t LOG_MINI_CIRCUIT_SIZE
static constexpr bool USE_PADDING
static void set_full_circuit_evaluations(AllEntities< FFType > &evals, const std::array< FFType, NUM_FULL_CIRCUIT_EVALUATIONS > &full_circuit)
Verifier: write the full-circuit evaluations back via get_full_circuit_entities().
static constexpr size_t NUM_COMMITMENTS_IN_PROOF
static constexpr bool HasZK
static constexpr size_t NUM_ORDERED_RANGE
static constexpr size_t CONCATENATION_GROUP_SIZE
static std::array< FFType, NUM_CONCATENATED_POLYS > reconstruct_concatenated_evaluations(const std::vector< RefVector< FFType > > &groups, std::span< const FFType > challenge)
Reconstruct concatenated polynomial evaluations from individual wire evaluations using the Lagrange b...
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 NUM_TO_BE_SHIFTED
std::tuple< TranslatorPermutationRelation< FF >, TranslatorDeltaRangeConstraintRelation< FF >, TranslatorOpcodeConstraintRelation< FF >, TranslatorAccumulatorTransferRelation< FF >, TranslatorDecompositionRelation< FF >, TranslatorNonNativeFieldRelation< FF >, TranslatorZeroConstraintsRelation< FF > > Relations_
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
static constexpr size_t NUM_SHIFTED_ENTITIES
static std::vector< RefVector< DataType > > partition_minicircuit_wires_into_groups(WireRefs wire_refs, DataType &zero_value)
Partition minicircuit wire references into concatenation groups.
static constexpr size_t NUM_PCS_TO_BE_SHIFTED
static constexpr size_t SHIFTED_WITNESSES_START
static constexpr size_t SORTED_STEPS_COUNT
static constexpr size_t NUM_UNSHIFTED_WITNESSES_WITHOUT_CONCATENATED
static constexpr size_t NUM_SUBRELATIONS
static void complete_full_circuit_evaluations(AllEntities< FFType > &evals, const std::array< FFType, NUM_FULL_CIRCUIT_EVALUATIONS > &full_circuit, std::span< const FFType > challenge)
Verifier: complete full-circuit evaluations from received array and challenge.
static constexpr size_t NUM_WIRES_NON_SHIFTED
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t num_frs_fr
static std::array< FF, NUM_MINICIRCUIT_EVALUATIONS > get_minicircuit_evaluations(PolyContainer &polys)
Prover: read the 154 minicircuit wire evaluations from partially-evaluated polynomials.
static constexpr size_t NUM_COMPUTABLE_PRECOMPUTED
static constexpr size_t NUM_MINICIRCUIT_WIRES
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:44
bb::fr ScalarField
Definition bn254.hpp:18
group class. Represents an elliptic curve group element. Group is parametrised by Fq and Fr
Definition group.hpp:38
FF a
Base class templates shared across Honk flavors.
#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:50
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
RefArray< T,(Ns+...)> constexpr concatenate(const RefArray< T, Ns > &... ref_arrays)
Concatenates multiple RefArray objects into a single RefArray.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Stores the fixed Translator VK commitment that depends only on the circuit size constant CONST_TRANSL...
static TranslatorSelectorEvaluations compute(std::span< const FF > u)
Compute evaluations of all 10 structured selectors at the sumcheck challenge.
void populate(Entities &target) const
Write all 10 computed evaluations into any entity struct with matching named fields.