Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
eccvm_recursive_flavor.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
23
24// NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members) ?
25
26namespace bb {
27
29 public:
30 using CircuitBuilder = UltraCircuitBuilder; // determines the arithmetisation of recursive verifier
38 using PCS = IPA<Curve>;
39
40 // indicates when evaluating sumcheck, edges must be extended to be MAX_TOTAL_RELATION_LENGTH
42
43 // Indicates that this flavor runs with non-ZK Sumcheck.
44 static constexpr bool HasZK = true;
45 // ECCVM proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
46 static constexpr bool USE_PADDING = ECCVMFlavor::USE_PADDING;
47
48 static constexpr size_t NUM_WIRES = ECCVMFlavor::NUM_WIRES;
49 // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We often
50 // need containers of this size to hold related data, so we choose a name more agnostic than `NUM_POLYNOMIALS`.
51 // Note: this number does not include the individual sorted list polynomials.
53 // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying
54 // assignment of witnesses. We again choose a neutral name.
56 // The total number of witness entities not including shifts.
58
60 // define the tuple of Relations that comprise the Sumcheck relation
61 // Reuse the Relations from ECCVM
63
65 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
66
68
69 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
70 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
71 // length = 3
73 static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;
74
80 public:
82 using Base::Base;
83 };
84
95 : public StdlibVerificationKey_<CircuitBuilder, ECCVMFlavor::PrecomputedEntities<Commitment>> {
96 public:
98
107 : pcs_verification_key(builder, 1UL << CONST_ECCVM_LOG_N, native_key->pcs_verification_key)
108 {
109
110 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1324): Remove `log_circuit_size` from MSGPACK
111 // and the verification key.
112 this->log_circuit_size = BF{ static_cast<uint64_t>(CONST_ECCVM_LOG_N) };
114 this->num_public_inputs = BF::from_witness(builder, native_key->num_public_inputs);
115 this->pub_inputs_offset = BF::from_witness(builder, native_key->pub_inputs_offset);
116
117 for (auto [native_commitment, commitment] : zip_view(native_key->get_all(), this->get_all())) {
118 commitment = Commitment::from_witness(builder, native_commitment);
119 }
120 }
121
128 {
129 using namespace bb::stdlib::field_conversion;
130 auto serialize_to_field_buffer = []<typename T>(const T& input, std::vector<FF>& buffer) {
131 std::vector<FF> input_fields = convert_to_bn254_frs<CircuitBuilder, T>(input);
132 buffer.insert(buffer.end(), input_fields.begin(), input_fields.end());
133 };
134
135 std::vector<FF> elements;
136 for (const Commitment& commitment : this->get_all()) {
137 serialize_to_field_buffer(commitment, elements);
138 }
139
140 return elements;
141 }
142
149 FF hash_through_transcript([[maybe_unused]] const std::string& domain_separator,
150 [[maybe_unused]] Transcript& transcript) const override
151 {
152 throw_or_abort("Not intended to be used because vk is hardcoded in circuit.");
153 }
154
160 {
161 for (Commitment& commitment : this->get_all()) {
162 commitment.fix_witness();
163 }
164 }
165 };
166
171
173 // Reuse the VerifierCommitments from ECCVM
175 // Reuse the transcript from ECCVM
177
179
180}; // NOLINTEND(cppcoreguidelines-avoid-const-or-ref-data-members)
181
182} // namespace bb
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
A base class labelling all entities (for instance, all of the polynomials used by the prover during s...
A container for commitment labels.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
static constexpr size_t NUM_SUBRELATIONS
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
std::tuple< ECCVMTranscriptRelation< FF >, ECCVMPointTableRelation< FF >, ECCVMWnafRelation< FF >, ECCVMMSMRelation< FF >, ECCVMSetRelation< FF >, ECCVMLookupRelation< FF >, ECCVMBoolsRelation< FF > > Relations_
static constexpr bool USE_SHORT_MONOMIALS
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
static constexpr size_t NUM_WIRES
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr bool USE_PADDING
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
The verification key is responsible for storing the commitments to the precomputed (non-witness) poly...
std::vector< BF > to_field_elements() const override
Serialize verification key to field elements.
FF hash_through_transcript(const std::string &domain_separator, Transcript &transcript) const override
Unused function because vk is hardcoded in recursive verifier, so no transcript hashing is needed.
void fix_witness()
Fixes witnesses of VK to be constants.
VerificationKey(CircuitBuilder *builder, const std::shared_ptr< NativeVerificationKey > &native_key)
Construct a new Verification Key with stdlib types from a provided native verification key.
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
ECCVMFlavor::Relations_< FF > Relations
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t NUM_SUBRELATIONS
static constexpr size_t NUM_WIRES
static constexpr size_t NUM_RELATIONS
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
static constexpr bool USE_SHORT_MONOMIALS
static constexpr bool USE_PADDING
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
IPA (inner product argument) commitment scheme class.
Definition ipa.hpp:95
Base Stdlib verification key class.
Definition flavor.hpp:242
cycle_group represents a group Element of the proving system's embedded curve i.e....
static cycle_group from_witness(Builder *_context, const AffineElement &_in)
Converts an AffineElement into a circuit witness.
static field_t from_witness(Builder *ctx, const bb::fr &input)
Definition field.hpp:424
void convert_constant_to_fixed_witness(Builder *ctx)
Definition field.hpp:414
AluTraceBuilder builder
Definition alu.test.cpp:123
uint8_t buffer[RANDOM_BUFFER_SIZE]
Definition engine.cpp:34
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
Entry point for Barretenberg command-line interface.
UltraCircuitBuilder_< UltraExecutionTraceBlocks > UltraCircuitBuilder
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Curve grumpkin in circuit setting.
Definition grumpkin.hpp:21
bigfield< Builder, bb::Bn254FqParams > ScalarField
Definition grumpkin.hpp:29
field_t< Builder > BaseField
Definition grumpkin.hpp:30
void throw_or_abort(std::string const &err)