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
12
13// NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members) ?
14
15namespace bb {
16
18 public:
19 using CircuitBuilder = UltraCircuitBuilder; // determines the arithmetisation of recursive verifier
27 using PCS = IPA<Curve>;
28
29 // Indicates that this flavor runs with non-ZK Sumcheck.
30 static constexpr bool HasZK = true;
31 // ECCVM proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
32 static constexpr bool USE_PADDING = ECCVMFlavor::USE_PADDING;
33
34 static constexpr size_t NUM_WIRES = ECCVMFlavor::NUM_WIRES;
35 // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We often
36 // need containers of this size to hold related data, so we choose a name more agnostic than `NUM_POLYNOMIALS`.
37 // Note: this number does not include the individual sorted list polynomials.
39 // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying
40 // assignment of witnesses. We again choose a neutral name.
42 // The total number of witness entities not including shifts.
44
46 // define the tuple of Relations that comprise the Sumcheck relation
47 // Reuse the Relations from ECCVM
49
51 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
52
54
55 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
56 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
57 // length = 3
59 static constexpr size_t NUM_RELATIONS = std::tuple_size<Relations>::value;
60
66 public:
68 using Base::Base;
69 };
70
80 class VerificationKey : public StdlibVerificationKey_<CircuitBuilder,
81 ECCVMFlavor::PrecomputedEntities<Commitment>,
82 VKSerializationMode::NO_METADATA> {
83 public:
85
94 : pcs_verification_key(builder, 1UL << CONST_ECCVM_LOG_N, native_key->pcs_verification_key)
95 {
96
97 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1324): Remove `log_circuit_size` from MSGPACK
98 // and the verification key.
99 this->log_circuit_size = BF{ static_cast<uint64_t>(CONST_ECCVM_LOG_N) };
101 this->num_public_inputs = BF::from_witness(builder, typename BF::native(native_key->num_public_inputs));
102 this->pub_inputs_offset = BF::from_witness(builder, typename BF::native(native_key->pub_inputs_offset));
103
104 for (auto [native_commitment, commitment] : zip_view(native_key->get_all(), this->get_all())) {
105 commitment = Commitment::from_witness(builder, native_commitment);
106 }
107 }
108
115 FF hash_with_origin_tagging([[maybe_unused]] const std::string& domain_separator,
116 [[maybe_unused]] Transcript& transcript) const override
117 {
118 throw_or_abort("Not intended to be used because vk is hardcoded in circuit.");
119 }
120
126 {
127 for (Commitment& commitment : this->get_all()) {
128 commitment.fix_witness();
129 }
130 }
131 };
132
137
139 // Reuse the VerifierCommitments from ECCVM
141 // Reuse the transcript from ECCVM
143
144 // Proof type for recursive verification
146
148
149}; // NOLINTEND(cppcoreguidelines-avoid-const-or-ref-data-members)
150
151} // 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 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...
void fix_witness()
Fixes witnesses of VK to be constants.
FF hash_with_origin_tagging(const std::string &domain_separator, Transcript &transcript) const override
Unused function because vk is hardcoded in recursive verifier, so no transcript hashing is needed.
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_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:325
A simple wrapper around a vector of stdlib field elements representing a proof.
Definition proof.hpp:19
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:454
void convert_constant_to_fixed_witness(Builder *ctx)
Definition field.hpp:444
AluTraceBuilder builder
Definition alu.test.cpp:124
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
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)