barretenberg
Loading...
Searching...
No Matches
goblin_ultra_recursive.hpp
1#pragma once
2#include "barretenberg/commitment_schemes/commitment_key.hpp"
3#include "barretenberg/commitment_schemes/kzg/kzg.hpp"
4#include "barretenberg/ecc/curves/bn254/g1.hpp"
6#include "barretenberg/flavor/flavor_macros.hpp"
7#include "barretenberg/flavor/goblin_ultra.hpp"
8#include "barretenberg/polynomials/barycentric.hpp"
9#include "barretenberg/polynomials/evaluation_domain.hpp"
10#include "barretenberg/polynomials/polynomial.hpp"
11#include "barretenberg/polynomials/univariate.hpp"
12#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp"
13#include "barretenberg/srs/factories/crs_factory.hpp"
14#include <array>
15#include <concepts>
16#include <span>
17#include <string>
18#include <type_traits>
19#include <vector>
20
21#include "barretenberg/stdlib/primitives/curves/bn254.hpp"
22#include "barretenberg/stdlib/primitives/field/field.hpp"
23#include "barretenberg/stdlib/recursion/honk/transcript/transcript.hpp"
24
25namespace proof_system::honk::flavor {
26
41template <typename BuilderType> class GoblinUltraRecursive_ {
42 public:
43 using CircuitBuilder = BuilderType; // Determines arithmetization of circuit instantiated with this flavor
45 using GroupElement = typename Curve::Element;
46 using Commitment = typename Curve::Element;
47 using CommitmentHandle = typename Curve::Element;
48 using FF = typename Curve::ScalarField;
50
51 // Note(luke): Eventually this may not be needed at all
53
54 static constexpr size_t NUM_WIRES = flavor::GoblinUltra::NUM_WIRES;
55 // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We often
56 // need containers of this size to hold related data, so we choose a name more agnostic than `NUM_POLYNOMIALS`.
57 // Note: this number does not include the individual sorted list polynomials.
58 static constexpr size_t NUM_ALL_ENTITIES = flavor::GoblinUltra::NUM_ALL_ENTITIES;
59 // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying
60 // assignment of witnesses. We again choose a neutral name.
61 static constexpr size_t NUM_PRECOMPUTED_ENTITIES = flavor::GoblinUltra::NUM_PRECOMPUTED_ENTITIES;
62 // The total number of witness entities not including shifts.
63 static constexpr size_t NUM_WITNESS_ENTITIES = flavor::GoblinUltra::NUM_WITNESS_ENTITIES;
64
65 // define the tuple of Relations that comprise the Sumcheck relation
66 // Reuse the Relations from GoblinUltra
67 using Relations = GoblinUltra::Relations_<FF>;
68
69 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
70
71 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
72 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
73 // length = 3
74 static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = MAX_PARTIAL_RELATION_LENGTH + 1;
75 static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;
76
77 // define the container for storing the univariate contribution from each relation in Sumcheck
78 using SumcheckTupleOfTuplesOfUnivariates = decltype(create_sumcheck_tuple_of_tuples_of_univariates<Relations>());
79 using TupleOfArraysOfValues = decltype(create_tuple_of_arrays_of_values<Relations>());
80
81 public:
87 public:
89 using Base::Base;
90 AllValues(std::array<FF, NUM_ALL_ENTITIES> _data_in) { this->_data = _data_in; }
91 };
101 class VerificationKey : public VerificationKey_<GoblinUltra::PrecomputedEntities<Commitment>> {
102 public:
110 VerificationKey(CircuitBuilder* builder, const std::shared_ptr<NativeVerificationKey>& native_key)
111 : VerificationKey_<GoblinUltra::PrecomputedEntities<Commitment>>(native_key->circuit_size,
112 native_key->num_public_inputs)
113 {
114 this->q_m = Commitment::from_witness(builder, native_key->q_m);
115 this->q_l = Commitment::from_witness(builder, native_key->q_l);
116 this->q_r = Commitment::from_witness(builder, native_key->q_r);
117 this->q_o = Commitment::from_witness(builder, native_key->q_o);
118 this->q_4 = Commitment::from_witness(builder, native_key->q_4);
119 this->q_c = Commitment::from_witness(builder, native_key->q_c);
120 this->q_arith = Commitment::from_witness(builder, native_key->q_arith);
121 this->q_sort = Commitment::from_witness(builder, native_key->q_sort);
122 this->q_elliptic = Commitment::from_witness(builder, native_key->q_elliptic);
123 this->q_aux = Commitment::from_witness(builder, native_key->q_aux);
124 this->q_lookup = Commitment::from_witness(builder, native_key->q_lookup);
125 this->q_busread = Commitment::from_witness(builder, native_key->q_busread);
126 this->q_poseidon2_external = Commitment::from_witness(builder, native_key->q_poseidon2_external);
127 this->q_poseidon2_internal = Commitment::from_witness(builder, native_key->q_poseidon2_internal);
128 this->sigma_1 = Commitment::from_witness(builder, native_key->sigma_1);
129 this->sigma_2 = Commitment::from_witness(builder, native_key->sigma_2);
130 this->sigma_3 = Commitment::from_witness(builder, native_key->sigma_3);
131 this->sigma_4 = Commitment::from_witness(builder, native_key->sigma_4);
132 this->id_1 = Commitment::from_witness(builder, native_key->id_1);
133 this->id_2 = Commitment::from_witness(builder, native_key->id_2);
134 this->id_3 = Commitment::from_witness(builder, native_key->id_3);
135 this->id_4 = Commitment::from_witness(builder, native_key->id_4);
136 this->table_1 = Commitment::from_witness(builder, native_key->table_1);
137 this->table_2 = Commitment::from_witness(builder, native_key->table_2);
138 this->table_3 = Commitment::from_witness(builder, native_key->table_3);
139 this->table_4 = Commitment::from_witness(builder, native_key->table_4);
140 this->lagrange_first = Commitment::from_witness(builder, native_key->lagrange_first);
141 this->lagrange_last = Commitment::from_witness(builder, native_key->lagrange_last);
142 this->lagrange_ecc_op = Commitment::from_witness(builder, native_key->lagrange_ecc_op);
143 this->databus_id = Commitment::from_witness(builder, native_key->databus_id);
144 };
145 };
146
147 using CommitmentLabels = GoblinUltra::CommitmentLabels;
148 // Reuse the VerifierCommitments from GoblinUltra
150 // Reuse the transcript from GoblinUltra
152};
153
154} // namespace proof_system::honk::flavor
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
Definition: goblin_ultra_recursive.hpp:86
The verification key is responsible for storing the the commitments to the precomputed (non-witnessk)...
Definition: goblin_ultra_recursive.hpp:101
VerificationKey(CircuitBuilder *builder, const std::shared_ptr< NativeVerificationKey > &native_key)
Construct a new Verification Key with stdlib types from a provided native verification key.
Definition: goblin_ultra_recursive.hpp:110
The recursive counterpart to the "native" Goblin Ultra flavor.
Definition: goblin_ultra_recursive.hpp:41
A base class labelling all entities (for instance, all of the polynomials used by the prover during s...
Definition: goblin_ultra.hpp:229
A container for commitment labels.
Definition: goblin_ultra.hpp:360
Definition: goblin_ultra.hpp:24
VerificationKey_< PrecomputedEntities< Commitment > > VerificationKey
The verification key is responsible for storing the the commitments to the precomputed (non-witnessk)...
Definition: goblin_ultra.hpp:287
Definition: verification_key.hpp:25
Definition: biggroup.hpp:22
Definition: field.hpp:10
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
Definition: bn254.hpp:10