2#include "barretenberg/commitment_schemes/commitment_key.hpp"
3#include "barretenberg/commitment_schemes/ipa/ipa.hpp"
4#include "barretenberg/commitment_schemes/kzg/kzg.hpp"
5#include "barretenberg/common/std_array.hpp"
6#include "barretenberg/ecc/curves/bn254/bn254.hpp"
7#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
9#include "barretenberg/flavor/flavor_macros.hpp"
10#include "barretenberg/polynomials/univariate.hpp"
11#include "barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp"
12#include "barretenberg/relations/ecc_vm/ecc_msm_relation.hpp"
13#include "barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp"
14#include "barretenberg/relations/ecc_vm/ecc_set_relation.hpp"
15#include "barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp"
16#include "barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp"
17#include "barretenberg/relations/relation_parameters.hpp"
18#include "barretenberg/relations/relation_types.hpp"
19#include "relation_definitions_fwd.hpp"
32template <
typename CycleGroup_T,
typename Curve_T,
typename PCS_T>
class ECCVMBase {
35 using CycleGroup = CycleGroup_T;
36 using Curve = Curve_T;
37 using G1 =
typename Curve::Group;
40 using FF =
typename G1::subgroup_field;
42 using PolynomialHandle = std::span<FF>;
43 using GroupElement =
typename G1::element;
44 using Commitment =
typename G1::affine_element;
45 using CommitmentHandle =
typename G1::affine_element;
49 static constexpr size_t NUM_WIRES = 74;
54 static constexpr size_t NUM_ALL_ENTITIES = 105;
57 static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 3;
59 static constexpr size_t NUM_WITNESS_ENTITIES = 76;
61 using GrandProductRelations = std::tuple<sumcheck::ECCVMSetRelation<FF>>;
63 using Relations = std::tuple<sumcheck::ECCVMTranscriptRelation<FF>,
71 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
76 static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = MAX_PARTIAL_RELATION_LENGTH + 1;
77 static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;
82 using SumcheckTupleOfTuplesOfUnivariates =
decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
83 using TupleOfArraysOfValues =
decltype(create_tuple_of_arrays_of_values<Relations>());
92 using DataType = DataType_;
93 DEFINE_FLAVOR_MEMBERS(DataType,
98 DataType get_selectors() {
return get_all(); };
108 template <
typename DataType>
struct DerivedWitnessEntities {
109 DEFINE_FLAVOR_MEMBERS(DataType,
118 template <
typename DataType>
class WireEntities {
120 DEFINE_FLAVOR_MEMBERS(DataType,
124 transcript_collision_check,
125 transcript_msm_transition,
127 transcript_msm_count,
135 transcript_accumulator_x,
136 transcript_accumulator_y,
140 precompute_point_transition,
142 precompute_scalar_sum,
190 transcript_accumulator_empty,
191 transcript_reset_accumulator,
193 lookup_read_counts_0,
194 lookup_read_counts_1);
201 template <
typename DataType>
202 class WitnessEntities :
public WireEntities<DataType>,
public DerivedWitnessEntities<DataType> {
204 DEFINE_COMPOUND_GET_ALL(WireEntities<DataType>, DerivedWitnessEntities<DataType>)
213 template <
typename DataType>
class ShiftedEntities {
215 DEFINE_FLAVOR_MEMBERS(DataType,
216 transcript_mul_shift,
217 transcript_msm_count_shift,
218 transcript_accumulator_x_shift,
219 transcript_accumulator_y_shift,
220 precompute_scalar_sum_shift,
221 precompute_s1hi_shift,
226 msm_transition_shift,
230 msm_accumulator_x_shift,
231 msm_accumulator_y_shift,
238 precompute_round_shift,
239 transcript_accumulator_empty_shift,
240 precompute_select_shift,
244 template <
typename DataType,
typename PrecomputedAndWitnessEntitiesSuperset>
245 static RefVector<DataType> get_to_be_shifted(PrecomputedAndWitnessEntitiesSuperset& entities)
248 return { entities.transcript_mul,
249 entities.transcript_msm_count,
250 entities.transcript_accumulator_x,
251 entities.transcript_accumulator_y,
252 entities.precompute_scalar_sum,
253 entities.precompute_s1hi,
254 entities.precompute_dx,
255 entities.precompute_dy,
256 entities.precompute_tx,
257 entities.precompute_ty,
258 entities.msm_transition,
262 entities.msm_accumulator_x,
263 entities.msm_accumulator_y,
268 entities.precompute_pc,
269 entities.transcript_pc,
270 entities.precompute_round,
271 entities.transcript_accumulator_empty,
272 entities.precompute_select,
285 template <
typename DataType>
286 class AllEntities :
public PrecomputedEntities<DataType>,
287 public WitnessEntities<DataType>,
288 public ShiftedEntities<DataType> {
292 : PrecomputedEntities<DataType>{}
293 , WitnessEntities<DataType>{}
294 , ShiftedEntities<DataType>{}
298 DEFINE_COMPOUND_GET_ALL(PrecomputedEntities<DataType>, WitnessEntities<DataType>, ShiftedEntities<DataType>)
302 return concatenate(PrecomputedEntities<DataType>::get_all(), WitnessEntities<DataType>::get_all());
305 RefVector<DataType> get_to_be_shifted() {
return ECCVMBase::get_to_be_shifted<DataType>(*
this); }
321 RefVector<Polynomial> get_to_be_shifted() {
return ECCVMBase::get_to_be_shifted<Polynomial>(*
this); }
323 std::array<PolynomialHandle, 3> get_table_column_wires() {
return {}; };
348 using Base = AllEntities<FF>;
350 AllValues(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
369 for (
auto& poly : this->get_all()) {
378 template <
size_t LENGTH>
using ProverUnivariates = AllEntities<barretenberg::Univariate<FF, LENGTH>>;
397 [[nodiscard]]
size_t get_polynomial_size()
const {
return this->lagrange_first.size(); }
420 using Base = AllEntities<std::string>;
424 : AllEntities<std::string>()
426 Base::transcript_add =
"TRANSCRIPT_ADD";
427 Base::transcript_mul =
"TRANSCRIPT_MUL";
428 Base::transcript_eq =
"TRANSCRIPT_EQ";
429 Base::transcript_collision_check =
"TRANSCRIPT_COLLISION_CHECK";
430 Base::transcript_msm_transition =
"TRANSCRIPT_MSM_TRANSITION";
431 Base::transcript_pc =
"TRANSCRIPT_PC";
432 Base::transcript_msm_count =
"TRANSCRIPT_MSM_COUNT";
433 Base::transcript_Px =
"TRANSCRIPT_PX";
434 Base::transcript_Py =
"TRANSCRIPT_PY";
435 Base::transcript_z1 =
"TRANSCRIPT_Z1";
436 Base::transcript_z2 =
"TRANSCRIPT_Z2";
437 Base::transcript_z1zero =
"TRANSCRIPT_Z1ZERO";
438 Base::transcript_z2zero =
"TRANSCRIPT_Z2ZERO";
439 Base::transcript_op =
"TRANSCRIPT_OP";
440 Base::transcript_accumulator_x =
"TRANSCRIPT_ACCUMULATOR_X";
441 Base::transcript_accumulator_y =
"TRANSCRIPT_ACCUMULATOR_Y";
442 Base::transcript_msm_x =
"TRANSCRIPT_MSM_X";
443 Base::transcript_msm_y =
"TRANSCRIPT_MSM_Y";
444 Base::precompute_pc =
"PRECOMPUTE_PC";
445 Base::precompute_point_transition =
"PRECOMPUTE_POINT_TRANSITION";
446 Base::precompute_round =
"PRECOMPUTE_ROUND";
447 Base::precompute_scalar_sum =
"PRECOMPUTE_SCALAR_SUM";
448 Base::precompute_s1hi =
"PRECOMPUTE_S1HI";
449 Base::precompute_s1lo =
"PRECOMPUTE_S1LO";
450 Base::precompute_s2hi =
"PRECOMPUTE_S2HI";
451 Base::precompute_s2lo =
"PRECOMPUTE_S2LO";
452 Base::precompute_s3hi =
"PRECOMPUTE_S3HI";
453 Base::precompute_s3lo =
"PRECOMPUTE_S3LO";
454 Base::precompute_s4hi =
"PRECOMPUTE_S4HI";
455 Base::precompute_s4lo =
"PRECOMPUTE_S4LO";
456 Base::precompute_skew =
"PRECOMPUTE_SKEW";
457 Base::precompute_dx =
"PRECOMPUTE_DX";
458 Base::precompute_dy =
"PRECOMPUTE_DY";
459 Base::precompute_tx =
"PRECOMPUTE_TX";
460 Base::precompute_ty =
"PRECOMPUTE_TY";
461 Base::msm_transition =
"MSM_TRANSITION";
462 Base::msm_add =
"MSM_ADD";
463 Base::msm_double =
"MSM_DOUBLE";
464 Base::msm_skew =
"MSM_SKEW";
465 Base::msm_accumulator_x =
"MSM_ACCUMULATOR_X";
466 Base::msm_accumulator_y =
"MSM_ACCUMULATOR_Y";
467 Base::msm_pc =
"MSM_PC";
468 Base::msm_size_of_msm =
"MSM_SIZE_OF_MSM";
469 Base::msm_count =
"MSM_COUNT";
470 Base::msm_round =
"MSM_ROUND";
471 Base::msm_add1 =
"MSM_ADD1";
472 Base::msm_add2 =
"MSM_ADD2";
473 Base::msm_add3 =
"MSM_ADD3";
474 Base::msm_add4 =
"MSM_ADD4";
475 Base::msm_x1 =
"MSM_X1";
476 Base::msm_y1 =
"MSM_Y1";
477 Base::msm_x2 =
"MSM_X2";
478 Base::msm_y2 =
"MSM_Y2";
479 Base::msm_x3 =
"MSM_X3";
480 Base::msm_y3 =
"MSM_Y3";
481 Base::msm_x4 =
"MSM_X4";
482 Base::msm_y4 =
"MSM_Y4";
483 Base::msm_collision_x1 =
"MSM_COLLISION_X1";
484 Base::msm_collision_x2 =
"MSM_COLLISION_X2";
485 Base::msm_collision_x3 =
"MSM_COLLISION_X3";
486 Base::msm_collision_x4 =
"MSM_COLLISION_X4";
487 Base::msm_lambda1 =
"MSM_LAMBDA1";
488 Base::msm_lambda2 =
"MSM_LAMBDA2";
489 Base::msm_lambda3 =
"MSM_LAMBDA3";
490 Base::msm_lambda4 =
"MSM_LAMBDA4";
491 Base::msm_slice1 =
"MSM_SLICE1";
492 Base::msm_slice2 =
"MSM_SLICE2";
493 Base::msm_slice3 =
"MSM_SLICE3";
494 Base::msm_slice4 =
"MSM_SLICE4";
495 Base::transcript_accumulator_empty =
"TRANSCRIPT_ACCUMULATOR_EMPTY";
496 Base::transcript_reset_accumulator =
"TRANSCRIPT_RESET_ACCUMULATOR";
497 Base::precompute_select =
"PRECOMPUTE_SELECT";
498 Base::lookup_read_counts_0 =
"LOOKUP_READ_COUNTS_0";
499 Base::lookup_read_counts_1 =
"LOOKUP_READ_COUNTS_1";
500 Base::z_perm =
"Z_PERM";
501 Base::lookup_inverses =
"LOOKUP_INVERSES";
503 Base::lagrange_first =
"__LAGRANGE_FIRST";
504 Base::lagrange_second =
"__LAGRANGE_SECOND";
505 Base::lagrange_last =
"__LAGRANGE_LAST";
513 this->lagrange_first = verification_key->lagrange_first;
514 this->lagrange_second = verification_key->lagrange_second;
515 this->lagrange_last = verification_key->lagrange_last;
525 uint32_t circuit_size;
526 Commitment transcript_add_comm;
527 Commitment transcript_mul_comm;
528 Commitment transcript_eq_comm;
529 Commitment transcript_collision_check_comm;
530 Commitment transcript_msm_transition_comm;
531 Commitment transcript_pc_comm;
532 Commitment transcript_msm_count_comm;
533 Commitment transcript_Px_comm;
534 Commitment transcript_Py_comm;
535 Commitment transcript_z1_comm;
536 Commitment transcript_z2_comm;
537 Commitment transcript_z1zero_comm;
538 Commitment transcript_z2zero_comm;
539 Commitment transcript_op_comm;
540 Commitment transcript_accumulator_x_comm;
541 Commitment transcript_accumulator_y_comm;
542 Commitment transcript_msm_x_comm;
543 Commitment transcript_msm_y_comm;
544 Commitment precompute_pc_comm;
545 Commitment precompute_point_transition_comm;
546 Commitment precompute_round_comm;
547 Commitment precompute_scalar_sum_comm;
548 Commitment precompute_s1hi_comm;
549 Commitment precompute_s1lo_comm;
550 Commitment precompute_s2hi_comm;
551 Commitment precompute_s2lo_comm;
552 Commitment precompute_s3hi_comm;
553 Commitment precompute_s3lo_comm;
554 Commitment precompute_s4hi_comm;
555 Commitment precompute_s4lo_comm;
556 Commitment precompute_skew_comm;
557 Commitment precompute_dx_comm;
558 Commitment precompute_dy_comm;
559 Commitment precompute_tx_comm;
560 Commitment precompute_ty_comm;
561 Commitment msm_transition_comm;
562 Commitment msm_add_comm;
563 Commitment msm_double_comm;
564 Commitment msm_skew_comm;
565 Commitment msm_accumulator_x_comm;
566 Commitment msm_accumulator_y_comm;
567 Commitment msm_pc_comm;
568 Commitment msm_size_of_msm_comm;
569 Commitment msm_count_comm;
570 Commitment msm_round_comm;
571 Commitment msm_add1_comm;
572 Commitment msm_add2_comm;
573 Commitment msm_add3_comm;
574 Commitment msm_add4_comm;
575 Commitment msm_x1_comm;
576 Commitment msm_y1_comm;
577 Commitment msm_x2_comm;
578 Commitment msm_y2_comm;
579 Commitment msm_x3_comm;
580 Commitment msm_y3_comm;
581 Commitment msm_x4_comm;
582 Commitment msm_y4_comm;
583 Commitment msm_collision_x1_comm;
584 Commitment msm_collision_x2_comm;
585 Commitment msm_collision_x3_comm;
586 Commitment msm_collision_x4_comm;
587 Commitment msm_lambda1_comm;
588 Commitment msm_lambda2_comm;
589 Commitment msm_lambda3_comm;
590 Commitment msm_lambda4_comm;
591 Commitment msm_slice1_comm;
592 Commitment msm_slice2_comm;
593 Commitment msm_slice3_comm;
594 Commitment msm_slice4_comm;
595 Commitment transcript_accumulator_empty_comm;
596 Commitment transcript_reset_accumulator_comm;
597 Commitment precompute_select_comm;
598 Commitment lookup_read_counts_0_comm;
599 Commitment lookup_read_counts_1_comm;
600 Commitment z_perm_comm;
601 Commitment lookup_inverses_comm;
602 std::vector<barretenberg::Univariate<FF, BATCHED_RELATION_PARTIAL_LENGTH>> sumcheck_univariates;
603 std::array<FF, NUM_ALL_ENTITIES> sumcheck_evaluations;
604 std::vector<Commitment> gemini_univariate_comms;
605 std::vector<FF> gemini_a_evals;
606 Commitment shplonk_q_comm;
607 Commitment kzg_w_comm;
609 uint64_t ipa_poly_degree;
610 std::vector<Commitment> ipa_l_comms;
611 std::vector<Commitment> ipa_r_comms;
620 void deserialize_full_transcript()
623 size_t num_bytes_read = 0;
625 BaseTranscript::template deserialize_from_buffer<uint32_t>(BaseTranscript::proof_data, num_bytes_read);
626 size_t log_n = numeric::get_msb(circuit_size);
627 transcript_add_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
628 BaseTranscript::proof_data, num_bytes_read);
629 transcript_mul_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
630 BaseTranscript::proof_data, num_bytes_read);
631 transcript_eq_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
632 BaseTranscript::proof_data, num_bytes_read);
633 transcript_collision_check_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
634 BaseTranscript::proof_data, num_bytes_read);
635 transcript_msm_transition_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
636 BaseTranscript::proof_data, num_bytes_read);
637 transcript_pc_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
638 BaseTranscript::proof_data, num_bytes_read);
639 transcript_msm_count_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
640 BaseTranscript::proof_data, num_bytes_read);
641 transcript_Px_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
642 BaseTranscript::proof_data, num_bytes_read);
643 transcript_Py_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
644 BaseTranscript::proof_data, num_bytes_read);
645 transcript_z1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
646 BaseTranscript::proof_data, num_bytes_read);
647 transcript_z2_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
648 BaseTranscript::proof_data, num_bytes_read);
649 transcript_z1zero_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
650 BaseTranscript::proof_data, num_bytes_read);
651 transcript_z2zero_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
652 BaseTranscript::proof_data, num_bytes_read);
653 transcript_op_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
654 BaseTranscript::proof_data, num_bytes_read);
655 transcript_accumulator_x_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
656 BaseTranscript::proof_data, num_bytes_read);
657 transcript_accumulator_y_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
658 BaseTranscript::proof_data, num_bytes_read);
659 transcript_msm_x_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
660 BaseTranscript::proof_data, num_bytes_read);
661 transcript_msm_y_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
662 BaseTranscript::proof_data, num_bytes_read);
663 precompute_pc_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
664 BaseTranscript::proof_data, num_bytes_read);
665 precompute_point_transition_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
666 BaseTranscript::proof_data, num_bytes_read);
667 precompute_round_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
668 BaseTranscript::proof_data, num_bytes_read);
669 precompute_scalar_sum_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
670 BaseTranscript::proof_data, num_bytes_read);
671 precompute_s1hi_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
672 BaseTranscript::proof_data, num_bytes_read);
673 precompute_s1lo_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
674 BaseTranscript::proof_data, num_bytes_read);
675 precompute_s2hi_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
676 BaseTranscript::proof_data, num_bytes_read);
677 precompute_s2lo_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
678 BaseTranscript::proof_data, num_bytes_read);
679 precompute_s3hi_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
680 BaseTranscript::proof_data, num_bytes_read);
681 precompute_s3lo_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
682 BaseTranscript::proof_data, num_bytes_read);
683 precompute_s4hi_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
684 BaseTranscript::proof_data, num_bytes_read);
685 precompute_s4lo_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
686 BaseTranscript::proof_data, num_bytes_read);
687 precompute_skew_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
688 BaseTranscript::proof_data, num_bytes_read);
689 precompute_dx_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
690 BaseTranscript::proof_data, num_bytes_read);
691 precompute_dy_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
692 BaseTranscript::proof_data, num_bytes_read);
693 precompute_tx_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
694 BaseTranscript::proof_data, num_bytes_read);
695 precompute_ty_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
696 BaseTranscript::proof_data, num_bytes_read);
697 msm_transition_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
698 BaseTranscript::proof_data, num_bytes_read);
699 msm_add_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
701 msm_double_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
703 msm_skew_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
705 msm_accumulator_x_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
706 BaseTranscript::proof_data, num_bytes_read);
707 msm_accumulator_y_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
708 BaseTranscript::proof_data, num_bytes_read);
709 msm_pc_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
711 msm_size_of_msm_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
712 BaseTranscript::proof_data, num_bytes_read);
713 msm_count_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
715 msm_round_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
717 msm_add1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
719 msm_add2_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
721 msm_add3_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
723 msm_add4_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
725 msm_x1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
727 msm_y1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
729 msm_x2_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
731 msm_y2_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
733 msm_x3_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
735 msm_y3_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
737 msm_x4_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
739 msm_y4_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
741 msm_collision_x1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
742 BaseTranscript::proof_data, num_bytes_read);
743 msm_collision_x2_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
744 BaseTranscript::proof_data, num_bytes_read);
745 msm_collision_x3_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
746 BaseTranscript::proof_data, num_bytes_read);
747 msm_collision_x4_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
748 BaseTranscript::proof_data, num_bytes_read);
749 msm_lambda1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
751 msm_lambda2_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
753 msm_lambda3_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
755 msm_lambda4_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
757 msm_slice1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
759 msm_slice2_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
761 msm_slice3_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
763 msm_slice4_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
765 transcript_accumulator_empty_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
766 BaseTranscript::proof_data, num_bytes_read);
767 transcript_reset_accumulator_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
768 BaseTranscript::proof_data, num_bytes_read);
769 precompute_select_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
770 BaseTranscript::proof_data, num_bytes_read);
771 lookup_read_counts_0_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
772 BaseTranscript::proof_data, num_bytes_read);
773 lookup_read_counts_1_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
774 BaseTranscript::proof_data, num_bytes_read);
775 lookup_inverses_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(
776 BaseTranscript::proof_data, num_bytes_read);
777 z_perm_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
779 for (
size_t i = 0; i < log_n; ++i) {
782 BaseTranscript::proof_data, num_bytes_read));
784 sumcheck_evaluations = BaseTranscript::template deserialize_from_buffer<std::array<FF, NUM_ALL_ENTITIES>>(
785 BaseTranscript::proof_data, num_bytes_read);
786 for (
size_t i = 0; i < log_n - 1; ++i) {
787 gemini_univariate_comms.emplace_back(BaseTranscript::template deserialize_from_buffer<Commitment>(
788 BaseTranscript::proof_data, num_bytes_read));
790 for (
size_t i = 0; i < log_n; ++i) {
791 gemini_a_evals.emplace_back(
792 BaseTranscript::template deserialize_from_buffer<FF>(BaseTranscript::proof_data, num_bytes_read));
794 shplonk_q_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
797 kzg_w_comm = BaseTranscript::template deserialize_from_buffer<Commitment>(BaseTranscript::proof_data,
800 ipa_poly_degree = BaseTranscript::template deserialize_from_buffer<uint64_t>(BaseTranscript::proof_data,
802 auto log_poly_degree =
static_cast<size_t>(numeric::get_msb(ipa_poly_degree));
803 for (
size_t i = 0; i < log_poly_degree; ++i) {
804 ipa_l_comms.emplace_back(BaseTranscript::template deserialize_from_buffer<Commitment>(
805 BaseTranscript::proof_data, num_bytes_read));
806 ipa_r_comms.emplace_back(BaseTranscript::template deserialize_from_buffer<Commitment>(
807 BaseTranscript::proof_data, num_bytes_read));
810 BaseTranscript::template deserialize_from_buffer<FF>(BaseTranscript::proof_data, num_bytes_read);
812 throw_or_abort(
"Unsupported PCS");
816 void serialize_full_transcript()
818 size_t old_proof_length = BaseTranscript::proof_data.size();
819 BaseTranscript::proof_data.clear();
820 size_t log_n = numeric::get_msb(circuit_size);
823 BaseTranscript::template
serialize_to_buffer(transcript_add_comm, BaseTranscript::proof_data);
824 BaseTranscript::template
serialize_to_buffer(transcript_mul_comm, BaseTranscript::proof_data);
825 BaseTranscript::template
serialize_to_buffer(transcript_eq_comm, BaseTranscript::proof_data);
826 BaseTranscript::template
serialize_to_buffer(transcript_collision_check_comm, BaseTranscript::proof_data);
827 BaseTranscript::template
serialize_to_buffer(transcript_msm_transition_comm, BaseTranscript::proof_data);
828 BaseTranscript::template
serialize_to_buffer(transcript_pc_comm, BaseTranscript::proof_data);
829 BaseTranscript::template
serialize_to_buffer(transcript_msm_count_comm, BaseTranscript::proof_data);
830 BaseTranscript::template
serialize_to_buffer(transcript_Px_comm, BaseTranscript::proof_data);
831 BaseTranscript::template
serialize_to_buffer(transcript_Py_comm, BaseTranscript::proof_data);
832 BaseTranscript::template
serialize_to_buffer(transcript_z1_comm, BaseTranscript::proof_data);
833 BaseTranscript::template
serialize_to_buffer(transcript_z2_comm, BaseTranscript::proof_data);
834 BaseTranscript::template
serialize_to_buffer(transcript_z1zero_comm, BaseTranscript::proof_data);
835 BaseTranscript::template
serialize_to_buffer(transcript_z2zero_comm, BaseTranscript::proof_data);
836 BaseTranscript::template
serialize_to_buffer(transcript_op_comm, BaseTranscript::proof_data);
837 BaseTranscript::template
serialize_to_buffer(transcript_accumulator_x_comm, BaseTranscript::proof_data);
838 BaseTranscript::template
serialize_to_buffer(transcript_accumulator_y_comm, BaseTranscript::proof_data);
839 BaseTranscript::template
serialize_to_buffer(transcript_msm_x_comm, BaseTranscript::proof_data);
840 BaseTranscript::template
serialize_to_buffer(transcript_msm_y_comm, BaseTranscript::proof_data);
841 BaseTranscript::template
serialize_to_buffer(precompute_pc_comm, BaseTranscript::proof_data);
842 BaseTranscript::template
serialize_to_buffer(precompute_point_transition_comm, BaseTranscript::proof_data);
843 BaseTranscript::template
serialize_to_buffer(precompute_round_comm, BaseTranscript::proof_data);
844 BaseTranscript::template
serialize_to_buffer(precompute_scalar_sum_comm, BaseTranscript::proof_data);
845 BaseTranscript::template
serialize_to_buffer(precompute_s1hi_comm, BaseTranscript::proof_data);
846 BaseTranscript::template
serialize_to_buffer(precompute_s1lo_comm, BaseTranscript::proof_data);
847 BaseTranscript::template
serialize_to_buffer(precompute_s2hi_comm, BaseTranscript::proof_data);
848 BaseTranscript::template
serialize_to_buffer(precompute_s2lo_comm, BaseTranscript::proof_data);
849 BaseTranscript::template
serialize_to_buffer(precompute_s3hi_comm, BaseTranscript::proof_data);
850 BaseTranscript::template
serialize_to_buffer(precompute_s3lo_comm, BaseTranscript::proof_data);
851 BaseTranscript::template
serialize_to_buffer(precompute_s4hi_comm, BaseTranscript::proof_data);
852 BaseTranscript::template
serialize_to_buffer(precompute_s4lo_comm, BaseTranscript::proof_data);
853 BaseTranscript::template
serialize_to_buffer(precompute_skew_comm, BaseTranscript::proof_data);
854 BaseTranscript::template
serialize_to_buffer(precompute_dx_comm, BaseTranscript::proof_data);
855 BaseTranscript::template
serialize_to_buffer(precompute_dy_comm, BaseTranscript::proof_data);
856 BaseTranscript::template
serialize_to_buffer(precompute_tx_comm, BaseTranscript::proof_data);
857 BaseTranscript::template
serialize_to_buffer(precompute_ty_comm, BaseTranscript::proof_data);
858 BaseTranscript::template
serialize_to_buffer(msm_transition_comm, BaseTranscript::proof_data);
862 BaseTranscript::template
serialize_to_buffer(msm_accumulator_x_comm, BaseTranscript::proof_data);
863 BaseTranscript::template
serialize_to_buffer(msm_accumulator_y_comm, BaseTranscript::proof_data);
865 BaseTranscript::template
serialize_to_buffer(msm_size_of_msm_comm, BaseTranscript::proof_data);
880 BaseTranscript::template
serialize_to_buffer(msm_collision_x1_comm, BaseTranscript::proof_data);
881 BaseTranscript::template
serialize_to_buffer(msm_collision_x2_comm, BaseTranscript::proof_data);
882 BaseTranscript::template
serialize_to_buffer(msm_collision_x3_comm, BaseTranscript::proof_data);
883 BaseTranscript::template
serialize_to_buffer(msm_collision_x4_comm, BaseTranscript::proof_data);
884 BaseTranscript::template
serialize_to_buffer(msm_lambda1_comm, BaseTranscript::proof_data);
885 BaseTranscript::template
serialize_to_buffer(msm_lambda2_comm, BaseTranscript::proof_data);
886 BaseTranscript::template
serialize_to_buffer(msm_lambda3_comm, BaseTranscript::proof_data);
887 BaseTranscript::template
serialize_to_buffer(msm_lambda4_comm, BaseTranscript::proof_data);
892 BaseTranscript::template
serialize_to_buffer(transcript_accumulator_empty_comm, BaseTranscript::proof_data);
893 BaseTranscript::template
serialize_to_buffer(transcript_reset_accumulator_comm, BaseTranscript::proof_data);
894 BaseTranscript::template
serialize_to_buffer(precompute_select_comm, BaseTranscript::proof_data);
895 BaseTranscript::template
serialize_to_buffer(lookup_read_counts_0_comm, BaseTranscript::proof_data);
896 BaseTranscript::template
serialize_to_buffer(lookup_read_counts_1_comm, BaseTranscript::proof_data);
897 BaseTranscript::template
serialize_to_buffer(lookup_inverses_comm, BaseTranscript::proof_data);
899 for (
size_t i = 0; i < log_n; ++i) {
900 BaseTranscript::template
serialize_to_buffer(sumcheck_univariates[i], BaseTranscript::proof_data);
902 BaseTranscript::template
serialize_to_buffer(sumcheck_evaluations, BaseTranscript::proof_data);
903 for (
size_t i = 0; i < log_n - 1; ++i) {
904 BaseTranscript::template
serialize_to_buffer(gemini_univariate_comms[i], BaseTranscript::proof_data);
906 for (
size_t i = 0; i < log_n; ++i) {
907 BaseTranscript::template
serialize_to_buffer(gemini_a_evals[i], BaseTranscript::proof_data);
914 auto log_poly_degree =
static_cast<size_t>(numeric::get_msb(ipa_poly_degree));
915 for (
size_t i = 0; i < log_poly_degree; ++i) {
922 ASSERT(BaseTranscript::proof_data.size() == old_proof_length);
927class ECCVM :
public ECCVMBase<barretenberg::g1, curve::Grumpkin, pcs::ipa::IPA<curve::Grumpkin>> {};
934extern template class ECCVMTranscriptRelationImpl<grumpkin::fr>;
935extern template class ECCVMWnafRelationImpl<grumpkin::fr>;
936extern template class ECCVMPointTableRelationImpl<grumpkin::fr>;
937extern template class ECCVMMSMRelationImpl<grumpkin::fr>;
938extern template class ECCVMSetRelationImpl<grumpkin::fr>;
939extern template class ECCVMLookupRelationImpl<grumpkin::fr>;
941DECLARE_SUMCHECK_RELATION_CLASS(ECCVMTranscriptRelationImpl,
flavor::ECCVM);
942DECLARE_SUMCHECK_RELATION_CLASS(ECCVMWnafRelationImpl,
flavor::ECCVM);
943DECLARE_SUMCHECK_RELATION_CLASS(ECCVMPointTableRelationImpl,
flavor::ECCVM);
944DECLARE_SUMCHECK_RELATION_CLASS(ECCVMMSMRelationImpl,
flavor::ECCVM);
945DECLARE_SUMCHECK_RELATION_CLASS(ECCVMSetRelationImpl,
flavor::ECCVM);
946DECLARE_SUMCHECK_RELATION_CLASS(ECCVMLookupRelationImpl,
flavor::ECCVM);
948DECLARE_SUMCHECK_PERMUTATION_CLASS(ECCVMSetRelationImpl,
flavor::ECCVM);
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
Definition: ref_vector.hpp:20
Definition: polynomial.hpp:12
A univariate polynomial represented by its values on {domain_start, domain_start + 1,...
Definition: univariate.hpp:23
The templates defined herein facilitate sharing the relation arithmetic between the prover and the ve...
Definition: relation_types.hpp:121
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
Definition: transcript.hpp:62
T deserialize_from_buffer(const Proof &proof_data, size_t &offset) const
Deserializes the bytes starting at offset into the typed element and returns that element.
Definition: transcript.hpp:180
void serialize_to_buffer(const T &element, Proof &proof_data)
Serializes object and appends it to proof_data.
Definition: transcript.hpp:166
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
Definition: ecc_vm.hpp:346
A container for commitment labels.
Definition: ecc_vm.hpp:418
A container for storing the partially evaluated multivariates produced by sumcheck.
Definition: ecc_vm.hpp:362
A container for the prover polynomials.
Definition: ecc_vm.hpp:388
AllValues get_row(const size_t row_idx)
Returns the evaluations of all prover polynomials at one point on the boolean hypercube,...
Definition: ecc_vm.hpp:402
The proving key is responsible for storing the polynomials used by the prover.
Definition: ecc_vm.hpp:315
Derived class that defines proof structure for ECCVM proofs, as well as supporting functions.
Definition: ecc_vm.hpp:523
Definition: ecc_vm.hpp:509
Definition: ecc_vm.hpp:32
AllEntities< barretenberg::Univariate< FF, LENGTH > > ProverUnivariates
A container for univariates used during sumcheck.
Definition: ecc_vm.hpp:378
AllEntities< std::vector< FF > > FoldedPolynomials
A container for polynomials produced after the first round of sumcheck.
Definition: ecc_vm.hpp:340
AllEntities< FF > RowPolynomials
A container for polynomials produced after the first round of sumcheck.
Definition: ecc_vm.hpp:357
ProverUnivariates< MAX_PARTIAL_RELATION_LENGTH > ExtendedEdges
A container for univariates produced during the hot loop in sumcheck.
Definition: ecc_vm.hpp:383
Definition: ecc_vm.hpp:927
Base class template containing circuit-specifying data.
Definition: flavor.hpp:85
Base proving key class.
Definition: flavor.hpp:101
CommitmentKey object over a pairing group 𝔾₁.
Definition: commitment_key.hpp:35
Definition: verification_key.hpp:25
Definition: zip_view.hpp:159
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
Defines particular circuit builder types expected to be used for circuit construction in stdlib and c...
Definition: claim.hpp:6