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
38
39namespace bb {
40
41namespace detail {
42template <typename> struct ref_array_extent;
43template <typename T, std::size_t N> struct ref_array_extent<RefArray<T, N>> {
44 static constexpr std::size_t value = N;
45};
46} // namespace detail
47
49
50 public:
53 using PCS = KZG<Curve>;
61 using Codec = FrCodec;
64
65 // indicates when evaluating sumcheck, edges must be extended to be MAX_PARTIAL_RELATION_LENGTH
66 static constexpr bool USE_SHORT_MONOMIALS = false;
67
68 // Indicates that this flavor runs with ZK Sumcheck.
69 static constexpr bool HasZK = true;
70 // Translator has no disabled rows at the top of the trace.
71 static constexpr size_t TRACE_OFFSET = 0;
72 // Translator proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
73 static constexpr bool USE_PADDING = false;
74 // Important: these constants cannot be arbitrarily changed - please consult with a member of the Crypto team if
75 // they become too small.
76
77 // The number of entities added for ZK (gemini_masking_poly)
78 static constexpr size_t NUM_MASKING_POLYNOMIALS = 1;
79
80 // None of this parameters can be changed
81 // Number of wires representing the op queue whose commitments are going to be checked against those from the
82 // final round of merge
83 static constexpr size_t NUM_OP_QUEUE_WIRES = 4;
84
85 // How many mini_circuit_size polynomials are concatenated in one concatenated poly
86 static constexpr size_t CONCATENATION_GROUP_SIZE = 16;
87
88 // The fixed log size of Translator mini circuit. It should be determined by the size of the EccOpQueue.
89 static constexpr size_t LOG_MINI_CIRCUIT_SIZE = CONST_TRANSLATOR_MINI_CIRCUIT_LOG_SIZE;
90
91 // Log of size of concatenated and ordered polynomials
93
94 // For the translator, the genuine and virtual log circuit size coincide
95 static constexpr size_t VIRTUAL_LOG_N = CONST_TRANSLATOR_LOG_N;
96
97 static constexpr size_t MINI_CIRCUIT_SIZE = 1UL << LOG_MINI_CIRCUIT_SIZE;
98
99 // The number of concatenated polynomials (4 range constraint groups + 1 non-range group)
100 static constexpr size_t NUM_CONCATENATED_POLYS = 5;
101
102 // The step in the DeltaRangeConstraint relation i.e. the maximum difference between two consecutive values
103 static constexpr size_t SORT_STEP = 3;
104
105 // Number of wires
106 static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
107
108 // The result of evaluating the polynomials in the nonnative form in translator circuit, stored as limbs and
109 // referred to as accumulated_result. This is reconstructed in it's base field form and sent to the verifier
110 // responsible for checking it against the evaluations received from ECCVM.
111 static constexpr size_t RESULT_ROW = CircuitBuilder::RESULT_ROW;
112
113 // Number of random ops found at he end of Translator trace multiplied by 2 as each accumulation gates occupies two
114 // rows.
116
117 // Maximum number of random masking values any ordered polynomial will have at the end
118 // Total scattered masking positions = CONCATENATION_GROUP_SIZE * NUM_MASKED_ROWS_END
119 // This is the space reserved at the end of each ordered polynomial (contiguous)
121
122 // Index at which random coefficients start (for zk) within Translator trace.
123 // The first 2 rows are zeros for polynomial shiftability (one op's worth of rows).
124 static constexpr size_t RANDOMNESS_START = 2;
125
126 // The bitness of the range constraint
128
129 // Number of bits in a binary limb
130 // This is not a configurable value. Relations are sepcifically designed for it to be 68
132
134 // define the tuple of Relations that comprise the Sumcheck relation
135 template <typename FF>
145
146 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
147 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
148
149 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
150
151 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
152 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
153 // length = 3.
154 // The degree has to be further increased because the relation is multiplied by the Row Disabling Polynomial
155 // total degree = sumcheck relation degree + 1 (PowZeta) + 1 (masking)
158 "LIBRA_UNIVARIATES_LENGTH must be equal to Translator::BATCHED_RELATION_PARTIAL_LENGTH");
160
161 static constexpr size_t num_frs_comm = FrCodec::calc_num_fields<Commitment>();
162 static constexpr size_t num_frs_fr = FrCodec::calc_num_fields<FF>();
163 static constexpr size_t num_frs_fq = FrCodec::calc_num_fields<BF>();
164
169 template <typename DataType_> class PrecomputedEntities {
170 public:
171 bool operator==(const PrecomputedEntities& other) const = default;
172 using DataType = DataType_;
174 ordered_extra_range_constraints_numerator, // column 0
175 lagrange_first, // column 1
176 lagrange_last, // column 2
177 lagrange_odd_in_minicircuit, // column 3
178 lagrange_even_in_minicircuit, // column 4
179 lagrange_result_row, // column 5
180 lagrange_last_in_minicircuit, // column 6
181 lagrange_masking, // column 7
182 lagrange_mini_masking, // column 8
183 lagrange_real_last, // column 9
184 lagrange_ordered_masking); // column 10
185 };
186
187 template <typename DataType> class ConcatenatedPolynomials {
188 public:
189 DEFINE_FLAVOR_MEMBERS(DataType,
190 concatenated_range_constraints_0, // column 0
191 concatenated_range_constraints_1, // column 1
192 concatenated_range_constraints_2, // column 2
193 concatenated_range_constraints_3, // column 3
194 concatenated_non_range) // column 4
195 };
199 template <typename DataType> class NonRangeMainWires {
200 public:
201 DEFINE_FLAVOR_MEMBERS(DataType,
202 p_x_low_limbs, // column 0
203 p_x_high_limbs, // column 1
204 p_y_low_limbs, // column 2
205 p_y_high_limbs, // column 3
206 z_low_limbs, // column 4
207 z_high_limbs, // column 5
208 accumulators_binary_limbs_0, // column 6
209 accumulators_binary_limbs_1, // column 7
210 accumulators_binary_limbs_2, // column 8
211 accumulators_binary_limbs_3, // column 9
212 quotient_low_binary_limbs, // column 10
213 quotient_high_binary_limbs, // column 11
214 relation_wide_limbs) // column 12
215 };
216
220 template <typename DataType> class RangeConstraintWires {
221 public:
223 p_x_low_limbs_range_constraint_0, // column 0
224 p_x_low_limbs_range_constraint_1, // column 17
225 p_x_low_limbs_range_constraint_2, // column 18
226 p_x_low_limbs_range_constraint_3, // column 19
227 p_x_low_limbs_range_constraint_4, // column 20
228 p_x_low_limbs_range_constraint_tail, // column 21
229 p_x_high_limbs_range_constraint_0, // column 22
230 p_x_high_limbs_range_constraint_1, // column 23
231 p_x_high_limbs_range_constraint_2, // column 24
232 p_x_high_limbs_range_constraint_3, // column 25
233 p_x_high_limbs_range_constraint_4, // column 26
234 p_x_high_limbs_range_constraint_tail, // column 27
235 p_y_low_limbs_range_constraint_0, // column 28
236 p_y_low_limbs_range_constraint_1, // column 29
237 p_y_low_limbs_range_constraint_2, // column 30
238 p_y_low_limbs_range_constraint_3, // column 31
239 p_y_low_limbs_range_constraint_4, // column 32
240 p_y_low_limbs_range_constraint_tail, // column 33
241 p_y_high_limbs_range_constraint_0, // column 34
242 p_y_high_limbs_range_constraint_1, // column 35
243 p_y_high_limbs_range_constraint_2, // column 36
244 p_y_high_limbs_range_constraint_3, // column 37
245 p_y_high_limbs_range_constraint_4, // column 38
246 p_y_high_limbs_range_constraint_tail, // column 39
247 z_low_limbs_range_constraint_0, // column 40
248 z_low_limbs_range_constraint_1, // column 41
249 z_low_limbs_range_constraint_2, // column 42
250 z_low_limbs_range_constraint_3, // column 43
251 z_low_limbs_range_constraint_4, // column 44
252 z_low_limbs_range_constraint_tail, // column 45
253 z_high_limbs_range_constraint_0, // column 46
254 z_high_limbs_range_constraint_1, // column 47
255 z_high_limbs_range_constraint_2, // column 48
256 z_high_limbs_range_constraint_3, // column 49
257 z_high_limbs_range_constraint_4, // column 50
258 z_high_limbs_range_constraint_tail, // column 51
259 accumulator_low_limbs_range_constraint_0, // column 52
260 accumulator_low_limbs_range_constraint_1, // column 53
261 accumulator_low_limbs_range_constraint_2, // column 54
262 accumulator_low_limbs_range_constraint_3, // column 55
263 accumulator_low_limbs_range_constraint_4, // column 56
264 accumulator_low_limbs_range_constraint_tail, // column 57
265 accumulator_high_limbs_range_constraint_0, // column 58
266 accumulator_high_limbs_range_constraint_1, // column 59
267 accumulator_high_limbs_range_constraint_2, // column 60
268 accumulator_high_limbs_range_constraint_3, // column 61
269 accumulator_high_limbs_range_constraint_4, // column 62
270 accumulator_high_limbs_range_constraint_tail, // column 63
271 quotient_low_limbs_range_constraint_0, // column 64
272 quotient_low_limbs_range_constraint_1, // column 65
273 quotient_low_limbs_range_constraint_2, // column 66
274 quotient_low_limbs_range_constraint_3, // column 67
275 quotient_low_limbs_range_constraint_4, // column 68
276 quotient_low_limbs_range_constraint_tail, // column 69
277 quotient_high_limbs_range_constraint_0, // column 70
278 quotient_high_limbs_range_constraint_1, // column 71
279 quotient_high_limbs_range_constraint_2, // column 72
280 quotient_high_limbs_range_constraint_3, // column 73
281 quotient_high_limbs_range_constraint_4, // column 74
282 quotient_high_limbs_range_constraint_tail, // column 75
283 relation_wide_limbs_range_constraint_0, // column 76
284 relation_wide_limbs_range_constraint_1, // column 77
285 relation_wide_limbs_range_constraint_2, // column 62
286 relation_wide_limbs_range_constraint_3); // column 63
287 };
288
292 template <typename DataType>
298
302 template <typename DataType> class OpQueueWiresToBeShiftedEntities {
303 public:
304 DEFINE_FLAVOR_MEMBERS(DataType,
305 x_lo_y_hi, // column 0
306 x_hi_z_1, // column 1
307 y_lo_z_2) // column 2
308 };
309
313 template <typename DataType>
319
320 // Note: These are technically derived from wires but do not depend on challenges (like z_perm). They are committed
321 // to in the wires commitment round.
322 template <typename DataType> class OrderedRangeConstraints {
323 public:
325 ordered_range_constraints_0, // column 0
326 ordered_range_constraints_1, // column 1
327 ordered_range_constraints_2, // column 2
328 ordered_range_constraints_3, // column 3
329 ordered_range_constraints_4); // column 4
330 };
331
335 template <typename DataType> class OpQueueWireNonshiftedEntities {
336 public:
338 op // column 0
339 );
340 };
341
345 template <typename DataType> class WireNonshiftedEntities : public OpQueueWireNonshiftedEntities<DataType> {
346 public:
348 };
349
350 template <typename DataType> class DerivedWitnessEntities {
351 public:
353 z_perm); // column 0
354 };
358 template <typename DataType>
419
423 template <typename DataType> class OpQueueShiftedEntities {
424 public:
425 DEFINE_FLAVOR_MEMBERS(DataType,
426 x_lo_y_hi_shift, // column 0
427 x_hi_z_1_shift, // column 1
428 y_lo_z_2_shift) // column 2
429 };
430
434 template <typename DataType> class NonOpQueueShiftedEntities {
435 public:
436 DEFINE_FLAVOR_MEMBERS(DataType,
437 p_x_low_limbs_shift, // column 3
438 p_x_high_limbs_shift, // column 10
439 p_y_low_limbs_shift, // column 17
440 p_y_high_limbs_shift, // column 24
441 z_low_limbs_shift, // column 31
442 z_high_limbs_shift, // column 38
443 accumulators_binary_limbs_0_shift, // column 45
444 accumulators_binary_limbs_1_shift, // column 46
445 accumulators_binary_limbs_2_shift, // column 47
446 accumulators_binary_limbs_3_shift, // column 48
447 quotient_low_binary_limbs_shift, // column 61
448 quotient_high_binary_limbs_shift, // column 62
449 relation_wide_limbs_shift, // column 75
450 p_x_low_limbs_range_constraint_0_shift, // column 4
451 p_x_low_limbs_range_constraint_1_shift, // column 5
452 p_x_low_limbs_range_constraint_2_shift, // column 6
453 p_x_low_limbs_range_constraint_3_shift, // column 7
454 p_x_low_limbs_range_constraint_4_shift, // column 8
455 p_x_low_limbs_range_constraint_tail_shift, // column 9
456 p_x_high_limbs_range_constraint_0_shift, // column 11
457 p_x_high_limbs_range_constraint_1_shift, // column 12
458 p_x_high_limbs_range_constraint_2_shift, // column 13
459 p_x_high_limbs_range_constraint_3_shift, // column 14
460 p_x_high_limbs_range_constraint_4_shift, // column 15
461 p_x_high_limbs_range_constraint_tail_shift, // column 16
462 p_y_low_limbs_range_constraint_0_shift, // column 18
463 p_y_low_limbs_range_constraint_1_shift, // column 19
464 p_y_low_limbs_range_constraint_2_shift, // column 20
465 p_y_low_limbs_range_constraint_3_shift, // column 21
466 p_y_low_limbs_range_constraint_4_shift, // column 22
467 p_y_low_limbs_range_constraint_tail_shift, // column 23
468 p_y_high_limbs_range_constraint_0_shift, // column 25
469 p_y_high_limbs_range_constraint_1_shift, // column 26
470 p_y_high_limbs_range_constraint_2_shift, // column 27
471 p_y_high_limbs_range_constraint_3_shift, // column 28
472 p_y_high_limbs_range_constraint_4_shift, // column 29
473 p_y_high_limbs_range_constraint_tail_shift, // column 30
474 z_low_limbs_range_constraint_0_shift, // column 32
475 z_low_limbs_range_constraint_1_shift, // column 33
476 z_low_limbs_range_constraint_2_shift, // column 34
477 z_low_limbs_range_constraint_3_shift, // column 35
478 z_low_limbs_range_constraint_4_shift, // column 36
479 z_low_limbs_range_constraint_tail_shift, // column 37
480 z_high_limbs_range_constraint_0_shift, // column 39
481 z_high_limbs_range_constraint_1_shift, // column 40
482 z_high_limbs_range_constraint_2_shift, // column 41
483 z_high_limbs_range_constraint_3_shift, // column 42
484 z_high_limbs_range_constraint_4_shift, // column 43
485 z_high_limbs_range_constraint_tail_shift, // column 44
486 accumulator_low_limbs_range_constraint_0_shift, // column 49
487 accumulator_low_limbs_range_constraint_1_shift, // column 50
488 accumulator_low_limbs_range_constraint_2_shift, // column 51
489 accumulator_low_limbs_range_constraint_3_shift, // column 52
490 accumulator_low_limbs_range_constraint_4_shift, // column 53
491 accumulator_low_limbs_range_constraint_tail_shift, // column 54
492 accumulator_high_limbs_range_constraint_0_shift, // column 55
493 accumulator_high_limbs_range_constraint_1_shift, // column 56
494 accumulator_high_limbs_range_constraint_2_shift, // column 57
495 accumulator_high_limbs_range_constraint_3_shift, // column 58
496 accumulator_high_limbs_range_constraint_4_shift, // column 59
497 accumulator_high_limbs_range_constraint_tail_shift, // column 60
498 quotient_low_limbs_range_constraint_0_shift, // column 63
499 quotient_low_limbs_range_constraint_1_shift, // column 64
500 quotient_low_limbs_range_constraint_2_shift, // column 65
501 quotient_low_limbs_range_constraint_3_shift, // column 66
502 quotient_low_limbs_range_constraint_4_shift, // column 67
503 quotient_low_limbs_range_constraint_tail_shift, // column 68
504 quotient_high_limbs_range_constraint_0_shift, // column 69
505 quotient_high_limbs_range_constraint_1_shift, // column 70
506 quotient_high_limbs_range_constraint_2_shift, // column 71
507 quotient_high_limbs_range_constraint_3_shift, // column 72
508 quotient_high_limbs_range_constraint_4_shift, // column 73
509 quotient_high_limbs_range_constraint_tail_shift, // column 74
510 relation_wide_limbs_range_constraint_0_shift, // column 76
511 relation_wide_limbs_range_constraint_1_shift, // column 77
512 relation_wide_limbs_range_constraint_2_shift, // column 78
513 relation_wide_limbs_range_constraint_3_shift) // column 79
514 };
515
519 template <typename DataType> class DerivedShiftedEntities {
520 public:
521 DEFINE_FLAVOR_MEMBERS(DataType,
522 ordered_range_constraints_0_shift, // column 80
523 ordered_range_constraints_1_shift, // column 81
524 ordered_range_constraints_2_shift, // column 82
525 ordered_range_constraints_3_shift, // column 83
526 ordered_range_constraints_4_shift, // column 84
527 z_perm_shift) // column 85
528 };
529
533 template <typename DataType>
534 class ShiftedEntities : public OpQueueShiftedEntities<DataType>,
535 public NonOpQueueShiftedEntities<DataType>,
536 public DerivedShiftedEntities<DataType> {
537 public:
551
557 {
558 static DataType zero_value = DataType(0);
559 return partition_minicircuit_wires_into_groups<DataType>(NonOpQueueShiftedEntities<DataType>::get_all(),
560 zero_value);
561 };
562 };
563
568 template <typename DataType> class MaskingEntities {
569 public:
570 DEFINE_FLAVOR_MEMBERS(DataType, gemini_masking_poly)
571 };
572
581 template <typename DataType>
582 class AllEntities : public MaskingEntities<DataType>,
583 public PrecomputedEntities<DataType>,
584 public WitnessEntities<DataType>,
585 public ShiftedEntities<DataType> {
586 public:
596
602
613 {
614 return concatenate(
615 MaskingEntities<DataType>::get_all(), // gemini_masking_poly
616 RefArray<DataType, 1>{ this->ordered_extra_range_constraints_numerator }, // non-computable precomputed
617 WireNonshiftedEntities<DataType>::get_all(), // op (from merge protocol)
618 OpQueueWiresToBeShiftedEntities<DataType>::get_all(), // x_lo_y_hi, x_hi_z_1, y_lo_z_2
622 }
623
635
638
655
660
665
666 friend std::ostream& operator<<(std::ostream& os, const AllEntities& a)
667 {
668 os << "{ ";
669 std::ios_base::fmtflags f(os.flags());
670 auto entities = a.get_all();
671 for (size_t i = 0; i < entities.size() - 1; i++) {
672 os << "e[" << std::setw(2) << i << "] = " << (entities[i]) << ",\n";
673 }
674 os << "e[" << std::setw(2) << (entities.size() - 1) << "] = " << entities[entities.size() - 1] << " }";
675
676 os.flags(f);
677 return os;
678 }
679 };
680
685 class AllValues : public AllEntities<FF> {
686 public:
688 using Base::Base;
689 };
690
691 // ========================================
692 // Derived entity counts (from entity class sizes)
693 // ========================================
697
698 // Witness = WireNonshifted + WireToBeShifted + OrderedRange + Derived + Concatenated
699 static constexpr size_t NUM_WITNESS_ENTITIES =
704
705 // Shifted = OpQueueShifted + NonOpQueueShifted + DerivedShifted
709
710 static constexpr size_t NUM_ALL_ENTITIES =
712
713 // All precomputed selectors except ordered_extra_range_constraints_numerator are computable
715
716 // Minicircuit wires: NonRangeMain + RangeConstraint (the non-op-queue wires that get shifted)
717 static constexpr size_t NUM_MINICIRCUIT_WIRES =
720 "Shifted minicircuit wires must match unshifted");
721 // 77 unshifted + 77 shifted minicircuit wire evaluations are sent mid-sumcheck
723
724 // Number of evaluations sent in proof (all minus computable precomputed minus reconstructed concat evals)
725 static constexpr size_t NUM_SENT_EVALUATIONS =
728
729 // Total number of minicircuit wires across all concatenation groups
733 "Range constraint wires must fill exactly 4 concatenation groups");
734
735 // PCS batch sizes
736 // Note: op-queue to-be-shifted wires (x_lo_y_hi, x_hi_z_1, y_lo_z_2) are registered in BOTH the
737 // unshifted and shifted PCS batches because the decomposition relation reads them in both forms.
744 static constexpr size_t NUM_PCS_UNSHIFTED = NUM_MASKING_POLYNOMIALS +
748
749 // Indices for partitioning AllEntities
752
753 // Commitments sent in wire round: concatenated + ordered range constraints
755
756 // A container to be fed to ShpleminiVerifier to avoid redundant scalar muls.
757 // Identifies commitments that appear in both the unshifted and shifted batches:
758 // Unshifted batch: masking(1) + ordered_extra(1) + op(1) + op_queue_tbs(3) + ordered(5) + z_perm(1) + concat(5)
759 // = 17
760 // Shifted batch: op_queue(3) + ordered(5) + z_perm(1) + concat(5) = 14
761 // Range 1: op_queue_tbs(3) + ordered(5) + z_perm(1) = 9 (contiguous in both batches)
762 // stored indices 2..10 (unshifted) ↔ 16..24 (shifted)
763 // Range 2: concatenated(5) — stored indices 11..15 (unshifted) ↔ 25..29 (shifted)
764 // (Stored indices are 0-based after ZK offset; offset=2 accounts for Q_commitment + gemini_masking_poly)
773
774 static constexpr size_t PROOF_LENGTH =
775 /* 1. Gemini masking poly commitment */ (num_frs_comm) +
776 /* 2. Wire commitments: concatenated + ordered */
778 /* 3. Z_PERM commitment */ (num_frs_comm) +
779 /* 4. Libra concatenation commitment */ (num_frs_comm) +
780 /* 5. Libra sum */ (num_frs_fr) +
781 /* 6. CONST_TRANSLATOR_LOG_N sumcheck univariates */
783 /* 7. sumcheck evaluations (computable precomputed and concat evals excluded) */
785 /* 8. Libra claimed evaluation */ (num_frs_fr) +
786 /* 9. Libra grand sum commitment */ (num_frs_comm) +
787 /* 10. Libra quotient commitment */ (num_frs_comm) +
788 /* 11. CONST_TRANSLATOR_LOG_N - 1 Gemini Fold commitments */
790 /* 12. CONST_TRANSLATOR_LOG_N Gemini a evaluations */
792 /* 13. NUM_SMALL_IPA_TRANSCRIPT_EVALS libra evals */
794 /* 14. Shplonk Q commitment */ (num_frs_comm) +
795 /* 15. KZG W commitment */ (num_frs_comm);
796
797 // Proof length when using committed sumcheck: each round sends a commitment + 2 scalar evaluations
798 // instead of BATCHED_RELATION_PARTIAL_LENGTH scalars.
799 static constexpr size_t COMMITTED_SUMCHECK_PROOF_LENGTH =
802
803 // ===== Static assert to ensure a valid trace can be proven ======
804
805 // The number of "steps" inserted in ordered range constraint polynomials to ensure that the
806 // DeltaRangeConstraintRelation can always be satisfied if the polynomial is within the appropriate range.
807 static constexpr size_t SORTED_STEPS_COUNT = ((1 << MICRO_LIMB_BITS) / SORT_STEP) + 1;
808
809 // The number of masking values in the overflow columns used for the ordered range constraint
810 static constexpr size_t MASKING_OVERFLOW_COLUMN =
812
815 "Translator circuit is too small for defined number of steps "
816 "(TranslatorDeltaRangeConstraintRelation). ");
817
818 // ================================================================
819
827 template <typename DataType, typename WireRefs>
829 DataType& zero_value)
830 {
831 constexpr size_t num_non_range = NonRangeMainWires<DataType>::_members_size;
832 constexpr size_t num_range = RangeConstraintWires<DataType>::_members_size;
833 static_assert(num_range % CONCATENATION_GROUP_SIZE == 0);
834 constexpr size_t num_range_groups = num_range / CONCATENATION_GROUP_SIZE;
835
837 // Groups 0..num_range_groups-1: sequential chunks of range constraint wires
838 for (size_t g = 0; g < num_range_groups; g++) {
840 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
841 group.push_back(wire_refs[num_non_range + g * CONCATENATION_GROUP_SIZE + j]);
842 }
843 groups.push_back(std::move(group));
844 }
845 // Last group: non-range main wires + zero padding
847 for (size_t j = 0; j < num_non_range; j++) {
848 group.push_back(wire_refs[j]);
849 }
850 for (size_t j = num_non_range; j < CONCATENATION_GROUP_SIZE; j++) {
851 group.push_back(zero_value);
852 }
853 groups.push_back(std::move(group));
854 return groups;
855 }
856
860 template <typename FFType>
865
871 template <typename PolyContainer>
873 {
875 size_t dst = 0;
876 for (auto& wire : polys.get_minicircuit_wires()) {
877 result[dst++] = wire[0];
878 }
879 for (auto& wire : polys.get_minicircuit_wires_shifted()) {
880 result[dst++] = wire[0];
881 }
882 return result;
883 }
884
890 template <typename FFType>
893 {
894 size_t src = 0;
895 for (auto& wire : evals.get_minicircuit_wires()) {
896 wire = mid[src++];
897 }
898 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
899 wire = mid[src++];
900 }
901 }
902
911 template <typename FFType>
913 {
914 // 1. Compute the computable precomputed selector evaluations
915 compute_computable_precomputed(evals, challenge);
916
917 // 2. Scale minicircuit wire evaluations by L_0(u_top) = Π_{i=0}^{3} (1 - u_{LOG_MINI + i})
918 FFType l0 = FFType(1);
919 for (size_t i = 0; i < CONST_TRANSLATOR_LOG_N - LOG_MINI_CIRCUIT_SIZE; i++) {
920 l0 *= (FFType(1) - challenge[LOG_MINI_CIRCUIT_SIZE + i]);
921 }
922 for (auto& wire : evals.get_minicircuit_wires()) {
923 wire *= l0;
924 }
925 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
926 wire *= l0;
927 }
928 }
929
938 template <typename FFType>
941 std::span<const FFType> challenge)
942 {
943 set_full_circuit_evaluations(evals, full_circuit);
944 complete_claimed_evaluations(evals, challenge);
945
946 // Reconstruct the 5 concatenated polynomial evaluations from (now L0-scaled) wire evaluations
947 auto groups = evals.get_groups_to_be_concatenated();
948 auto concat_evals = reconstruct_concatenated_evaluations(groups, challenge);
949 auto concat_refs = evals.get_concatenated();
950 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
951 concat_refs[g] = concat_evals[g];
952 }
953 }
954
967 template <typename FFType>
969 const std::vector<RefVector<FFType>>& groups, std::span<const FFType> challenge)
970 {
971 static constexpr size_t NUM_TOP_BITS = numeric::get_msb(CONCATENATION_GROUP_SIZE);
972
973 // Compute CONCATENATION_GROUP_SIZE-point Lagrange basis over the top challenges
974 // a = u[N - 4], b = u[N - 3], c = u[N - 2], d = u[N - 1]
975 // L(0) = (1 - d) * (1 - c) * (1 - b) * (1 - a)
976 // L(1) = (1 - d) * (1 - c) * (1 - b) * ( a)
977 // L(2) = (1 - d) * (1 - c) * ( b) * (1 - a)
978 // L(3) = (1 - d) * (1 - c) * ( b) * ( a)
979 // ...
981 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
982 lagrange_basis[j] = FFType(1);
983 for (size_t bit = 0; bit < NUM_TOP_BITS; bit++) {
984 const FFType& u = challenge[CONST_TRANSLATOR_LOG_N - NUM_TOP_BITS + bit];
985 lagrange_basis[j] *= ((j >> bit) & 1) ? u : (FFType(1) - u);
986 }
987 }
988
989 // L_0 is the "padding" factor from wires having support in [1, MINI)
990 // The reason we need to divide by L_0 is because L_j(u) already accounts for the challenges a, b, c, d:
991 // L_j(u) = (1 - d) * (1 - c) * (1 - b) * (1 - a) * L_j(0, u_bottom)
992 FFType padding_inv = lagrange_basis[0].invert();
993
994 auto reconstruct = [&](const auto& group) -> FFType {
995 FFType result = FFType(0);
996 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
997 result += lagrange_basis[j] * group[j];
998 }
999 return result * padding_inv;
1000 };
1001
1003 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
1004 result[g] = reconstruct(groups[g]);
1005 }
1006 return result;
1007 }
1008
1012 template <typename FFType>
1014 {
1016 size_t dst = 0;
1017 for (auto& entity : evals.get_full_circuit_entities()) {
1018 result[dst++] = entity;
1019 }
1020 return result;
1021 }
1022
1026 template <typename FFType>
1029 {
1030 size_t src = 0;
1031 for (auto& entity : evals.get_full_circuit_entities()) {
1032 entity = full_circuit[src++];
1033 }
1034 }
1035
1039 class ProverPolynomials : public AllEntities<Polynomial> {
1040 public:
1046 {
1047
1048 const size_t circuit_size = 1 << CONST_TRANSLATOR_LOG_N;
1049 for (auto& ordered_range_constraint : get_ordered_range_constraints()) {
1050 ordered_range_constraint = Polynomial{ /*size*/ circuit_size - 1,
1051 /*largest possible index*/ circuit_size,
1052 1 };
1053 }
1054
1055 // Initialize 5 concatenated polynomials (full circuit_size, shiftable with start_index=1)
1056 // Row 0 of block 0 is the no-op row where all values are zero.
1057 for (auto& concat_poly : get_concatenated()) {
1058 concat_poly = Polynomial{ /*size*/ circuit_size - 1,
1059 /*virtual_size*/ circuit_size,
1060 /*start_index*/ 1 };
1061 }
1062 z_perm = Polynomial{ /*size*/ circuit_size - 1,
1063 /*virtual_size*/ circuit_size,
1064 /*start_index*/ 1 };
1065
1066 op = Polynomial{ MINI_CIRCUIT_SIZE, circuit_size };
1067
1068 // All minicircuit wires (non-op-queue) are only non-zero in [1, MINI_CIRCUIT_SIZE)
1070 if (poly.is_empty()) {
1071 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1072 /*virtual_size*/ circuit_size,
1073 /*start_index*/ 1 };
1074 }
1075 }
1076
1077 // Op queue wires to be shifted
1079 if (poly.is_empty()) {
1080 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1081 /*virtual_size*/ circuit_size,
1082 /*start_index*/ 1 };
1083 }
1084 }
1085
1086 // Initialize lagrange polynomials and the ordered extra range constraints numerator (the precomputed
1087 // polynomials) within the appropriate range they operate on
1088 lagrange_first = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size };
1089 lagrange_result_row = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size, /*start_index*/ RESULT_ROW };
1090 lagrange_even_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END,
1091 /*virtual_size*/ circuit_size,
1092 /*start_index=*/RESULT_ROW };
1093 lagrange_odd_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END - 1,
1094 /*virtual_size*/ circuit_size,
1095 /*start_index=*/RESULT_ROW + 1 };
1096 lagrange_last_in_minicircuit = Polynomial{ /*size*/ 1,
1097 /*virtual_size*/ circuit_size,
1098 /*start_index=*/MINI_CIRCUIT_SIZE - NUM_MASKED_ROWS_END - 1 };
1099 lagrange_mini_masking = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RANDOMNESS_START,
1100 /*virtual_size*/ circuit_size,
1101 /*start_index=*/RANDOMNESS_START };
1102 // With concatenation, masking rows are scattered in concatenated polys: end of each of the 16 blocks
1103 // Must span full circuit since values go up to position 15*MINI+(MINI-1)
1104 lagrange_masking = Polynomial{ circuit_size, circuit_size };
1105 // Ordered masking: contiguous at the end (marks masking positions in ordered polynomials)
1106 lagrange_ordered_masking = Polynomial{ /*size*/ MAX_RANDOM_VALUES_PER_ORDERED,
1107 /*virtual_size*/ circuit_size,
1108 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED };
1109 lagrange_last = Polynomial{ /*size*/ 1,
1110 /*virtual_size*/ circuit_size,
1111 /*start_index*/ circuit_size - 1 };
1112 // lagrange_real_last marks the last position with sorted values in ordered polynomials
1113 // (where we check maximum value = 2^14 - 1). With contiguous masking at the end,
1114 // this is at position circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1.
1115 lagrange_real_last = Polynomial{ /*size*/ 1,
1116 /*virtual_size*/ circuit_size,
1117 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1 };
1118 ordered_extra_range_constraints_numerator =
1120 /*virtual_size*/ circuit_size,
1121 /*start_index*/ 0 };
1122
1123 set_shifted();
1124 }
1127 ProverPolynomials(ProverPolynomials&& o) noexcept = default;
1130 [[nodiscard]] static size_t get_polynomial_size() { return 1UL << CONST_TRANSLATOR_LOG_N; }
1135 [[nodiscard]] AllValues get_row(size_t row_idx) const
1136 {
1138 for (auto [result_field, polynomial] : zip_view(result.get_all(), this->get_all())) {
1139 // Translator polynomials have different support regions (start_index/end_index)
1140 // Return 0 for out-of-bounds access (which is the correct value outside support)
1141 if (row_idx >= polynomial.start_index() && row_idx < polynomial.end_index()) {
1142 result_field = polynomial[row_idx];
1143 } else {
1144 result_field = FF(0);
1145 }
1146 }
1147 return result;
1148 }
1149 // Set all shifted polynomials based on their to-be-shifted counterpart.
1150 // Uses get_all_to_be_shifted() (86 entries for Sumcheck), not get_to_be_shifted() (9 entries for PCS).
1152 {
1153 for (auto [shifted, to_be_shifted] : zip_view(get_shifted(), get_all_to_be_shifted())) {
1154 shifted = to_be_shifted.shifted();
1155 }
1156 }
1157 };
1158
1164 public:
1167
1168 ProverPolynomials polynomials; // storage for all polynomials evaluated by the prover
1170
1171 ProvingKey() = default;
1172 };
1173
1179 template <typename DataType_> class VKEntities {
1180 public:
1181 bool operator==(const VKEntities& other) const = default;
1182 using DataType = DataType_;
1183 DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator);
1184 };
1185
1193
1199
1204
1209
1215 class CommitmentLabels : public AllEntities<std::string> {
1216 public:
1218 {
1219 // Concatenated polynomials (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1220 this->concatenated_range_constraints_0 = "CONCATENATED_RANGE_CONSTRAINTS_0";
1221 this->concatenated_range_constraints_1 = "CONCATENATED_RANGE_CONSTRAINTS_1";
1222 this->concatenated_range_constraints_2 = "CONCATENATED_RANGE_CONSTRAINTS_2";
1223 this->concatenated_range_constraints_3 = "CONCATENATED_RANGE_CONSTRAINTS_3";
1224 this->concatenated_non_range = "CONCATENATED_NON_RANGE";
1225
1226 // Ordered range constraints (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1227 this->ordered_range_constraints_0 = "ORDERED_RANGE_CONSTRAINTS_0";
1228 this->ordered_range_constraints_1 = "ORDERED_RANGE_CONSTRAINTS_1";
1229 this->ordered_range_constraints_2 = "ORDERED_RANGE_CONSTRAINTS_2";
1230 this->ordered_range_constraints_3 = "ORDERED_RANGE_CONSTRAINTS_3";
1231 this->ordered_range_constraints_4 = "ORDERED_RANGE_CONSTRAINTS_4";
1232
1233 // Grand product (committed separately)
1234 this->z_perm = "Z_PERM";
1235 };
1236 };
1237
1238 template <typename Commitment, typename VerificationKey>
1239 class VerifierCommitments_ : public AllEntities<Commitment> {
1240 public:
1241 VerifierCommitments_(const std::shared_ptr<VerificationKey>& verification_key)
1242 {
1243 // Only ordered_extra_range_constraints_numerator needs a VK commitment for PCS.
1244 // All other precomputed selectors are computable (evaluations derived from sumcheck challenge).
1245 this->ordered_extra_range_constraints_numerator =
1246 verification_key->ordered_extra_range_constraints_numerator;
1247 }
1248 };
1249
1257 template <typename ProverPolynomialsOrPartiallyEvaluatedMultivariates, typename EdgeType>
1258 static bool skip_entire_row([[maybe_unused]] const ProverPolynomialsOrPartiallyEvaluatedMultivariates& polynomials,
1259 [[maybe_unused]] const EdgeType edge_idx)
1260 {
1261 auto s0 = polynomials.ordered_range_constraints_0_shift[edge_idx];
1262 auto s1 = polynomials.ordered_range_constraints_1_shift[edge_idx];
1263 auto s2 = polynomials.ordered_range_constraints_2_shift[edge_idx];
1264 auto s3 = polynomials.ordered_range_constraints_3_shift[edge_idx];
1265 auto s4 = polynomials.ordered_range_constraints_4_shift[edge_idx];
1266 auto s5 = polynomials.ordered_range_constraints_0_shift[edge_idx + 1];
1267 auto s6 = polynomials.ordered_range_constraints_1_shift[edge_idx + 1];
1268 auto s7 = polynomials.ordered_range_constraints_2_shift[edge_idx + 1];
1269 auto s8 = polynomials.ordered_range_constraints_3_shift[edge_idx + 1];
1270 auto s9 = polynomials.ordered_range_constraints_4_shift[edge_idx + 1];
1271 auto shift_0 = (s0 == 0) && (s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 0) && (s5 == 0) && (s6 == 0) &&
1272 (s7 == 0) && (s8 == 0) && (s9 == 0);
1273 return shift_0 && (polynomials.z_perm[edge_idx] == polynomials.z_perm_shift[edge_idx]) &&
1274 (polynomials.z_perm[edge_idx + 1] == polynomials.z_perm_shift[edge_idx + 1]) &&
1275 polynomials.lagrange_last[edge_idx] == 0 && polynomials.lagrange_last[edge_idx + 1] == 0;
1276 }
1278};
1279
1281 public:
1284
1285 static constexpr bool USE_SHORT_MONOMIALS = true;
1286
1288 template <typename FF_>
1298
1299 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
1301 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
1304
1307
1312};
1313
1314// Guard against drift between the runtime PCS entity lists and their compile-time counts;
1315// REPEATED_COMMITMENTS and PROOF_LENGTH depend on these counts and desync silently otherwise.
1317 .get_pcs_unshifted())>::value ==
1319 "get_pcs_unshifted() entity count must equal NUM_PCS_UNSHIFTED. If you added a witness entity, "
1320 "update both the runtime list and NUM_UNSHIFTED_WITNESSES_WITHOUT_CONCATENATED.");
1322 .get_pcs_to_be_shifted())>::value ==
1324 "get_pcs_to_be_shifted() entity count must equal NUM_PCS_TO_BE_SHIFTED. If you added a to-be-shifted "
1325 "entity, update both the runtime list and NUM_TO_BE_SHIFTED.");
1326
1327} // namespace bb
constexpr size_t N
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:104
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
Definition ref_array.hpp:23
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_OP_QUEUE_TO_BE_SHIFTED
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
std::tuple< TranslatorPermutationRelation< FF >, TranslatorDeltaRangeConstraintRelation< FF >, TranslatorOpcodeConstraintRelation< FF >, TranslatorAccumulatorTransferRelation< FF >, TranslatorDecompositionRelation< FF >, TranslatorNonNativeFieldRelation< FF >, TranslatorZeroConstraintsRelation< FF >, TranslatorShiftableFirstCoeffZeroRelation< FF > > Relations_
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
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
std::tuple< TranslatorPermutationShortRelation< FF_ >, TranslatorDeltaRangeConstraintShortRelation< FF_ >, TranslatorOpcodeConstraintShortRelation< FF_ >, TranslatorAccumulatorTransferShortRelation< FF_ >, TranslatorDecompositionShortRelation< FF_ >, TranslatorNonNativeFieldShortRelation< FF_ >, TranslatorZeroConstraintsShortRelation< FF_ >, TranslatorShiftableFirstCoeffZeroShortRelation< FF_ > > Relations_
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
std::tuple< TranslatorPermutationShortRelation< FF > > GrandProductRelations
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
constexpr size_t NUM_SMALL_IPA_TRANSCRIPT_EVALS
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.
BB_VF_LOAD_LIMBS * this
VectorField result