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
11
12// NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members) ?
13
14namespace bb {
15
17 public:
18 using CircuitBuilder = UltraCircuitBuilder; // determines the arithmetisation of recursive verifier
26 using PCS = IPA<Curve>;
27
28 // indicates when evaluating sumcheck, edges must be extended to be MAX_TOTAL_RELATION_LENGTH
30
31 // Indicates that this flavor runs with non-ZK Sumcheck.
32 static constexpr bool HasZK = true;
33 // ECCVM proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
34 static constexpr bool USE_PADDING = ECCVMFlavor::USE_PADDING;
35
36 static constexpr size_t NUM_WIRES = ECCVMFlavor::NUM_WIRES;
37 // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We often
38 // need containers of this size to hold related data, so we choose a name more agnostic than `NUM_POLYNOMIALS`.
39 // Note: this number does not include the individual sorted list polynomials.
41 // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying
42 // assignment of witnesses. We again choose a neutral name.
44 // The total number of witness entities not including shifts.
46
48 // define the tuple of Relations that comprise the Sumcheck relation
49 // Reuse the Relations from ECCVM
51
53 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
54
56
57 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
58 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
59 // length = 3
61 static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;
62
68 public:
70 using Base::Base;
71 };
72
82 class VerificationKey : public StdlibVerificationKey_<CircuitBuilder,
83 ECCVMFlavor::PrecomputedEntities<Commitment>,
84 VKSerializationMode::NO_METADATA> {
85 public:
87
96 : pcs_verification_key(builder, 1UL << CONST_ECCVM_LOG_N, native_key->pcs_verification_key)
97 {
98
99 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1324): Remove `log_circuit_size` from MSGPACK
100 // and the verification key.
101 this->log_circuit_size = BF{ static_cast<uint64_t>(CONST_ECCVM_LOG_N) };
103 this->num_public_inputs = BF::from_witness(builder, native_key->num_public_inputs);
104 this->pub_inputs_offset = BF::from_witness(builder, native_key->pub_inputs_offset);
105
106 for (auto [native_commitment, commitment] : zip_view(native_key->get_all(), this->get_all())) {
107 commitment = Commitment::from_witness(builder, native_commitment);
108 }
109 }
110
117 FF hash_through_transcript([[maybe_unused]] const std::string& domain_separator,
118 [[maybe_unused]] Transcript& transcript) const override
119 {
120 throw_or_abort("Not intended to be used because vk is hardcoded in circuit.");
121 }
122
128 {
129 for (Commitment& commitment : this->get_all()) {
130 commitment.fix_witness();
131 }
132 }
133 };
134
139
141 // Reuse the VerifierCommitments from ECCVM
143 // Reuse the transcript from ECCVM
145
147
148}; // NOLINTEND(cppcoreguidelines-avoid-const-or-ref-data-members)
149
150} // 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...
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:93
Base Stdlib verification key class.
Definition flavor.hpp:303
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:432
void convert_constant_to_fixed_witness(Builder *ctx)
Definition field.hpp:422
AluTraceBuilder builder
Definition alu.test.cpp:123
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)