Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
recursive_flavor.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
10
11namespace bb::avm2 {
12
14 public:
22
26
27 // Native one is used!
29
31
32 // indicates when evaluating sumcheck, edges must be extended to be MAX_TOTAL_RELATION_LENGTH
34
35 static constexpr size_t NUM_WIRES = NativeFlavor::NUM_WIRES;
39
42
44 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
45
46 // This flavor would not be used with ZK Sumcheck
47 static constexpr bool HasZK = false;
48
49 // To achieve fixed proof size and that the recursive verifier circuit is constant, we are using padding in Sumcheck
50 // and Shplemini
51 static constexpr bool USE_PADDING = true;
52
58 public:
60 using Base::Base;
61 };
62
64 : public StdlibVerificationKey_<CircuitBuilder, NativeFlavor::PrecomputedEntities<Commitment>> {
65 public:
68 {
69 for (auto [native_comm, comm] : zip_view(native_key->get_all(), this->get_all())) {
70 comm = Commitment::from_witness(builder, native_comm);
71 }
72 }
73
81 {
82 size_t num_frs_read = 0;
83 size_t num_frs_Comm = stdlib::field_conversion::calc_num_bn254_frs<CircuitBuilder, Commitment>();
84
85 for (Commitment& comm : this->get_all()) {
86 comm = stdlib::field_conversion::convert_from_bn254_frs<CircuitBuilder, Commitment>(
87 builder, elements.subspan(num_frs_read, num_frs_Comm));
88 num_frs_read += num_frs_Comm;
89 }
90 }
91
92 std::vector<FF> to_field_elements() const override { throw_or_abort("Not intended to be used."); }
93 FF hash_through_transcript([[maybe_unused]] const std::string& domain_separator,
94 [[maybe_unused]] Transcript& transcript) const override
95 {
96 throw_or_abort("Not intended to be used because vk is hardcoded in circuit.");
97 }
98
104 {
105 for (Commitment& commitment : this->get_all()) {
106 commitment.fix_witness();
107 }
108 }
109 };
110
113};
114
115} // namespace bb::avm2
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
Base Stdlib verification key class.
Definition flavor.hpp:242
tuple_cat_t< MainRelations_< FF_ >, LookupRelations_< FF_ > > Relations_
Definition flavor.hpp:80
static constexpr size_t NUM_SUBRELATIONS
Definition flavor.hpp:83
AvmFlavorSettings::VerifierCommitmentKey VerifierCommitmentKey
Definition flavor.hpp:41
static constexpr size_t NUM_WITNESS_ENTITIES
Definition flavor.hpp:54
static constexpr size_t NUM_WIRES
Definition flavor.hpp:56
static constexpr bool USE_SHORT_MONOMIALS
Definition flavor.hpp:44
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
Definition flavor.hpp:94
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
Definition flavor.hpp:53
static constexpr size_t NUM_ALL_ENTITIES
Definition flavor.hpp:57
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
void fix_witness()
Fixes witnesses of VK to be constants.
VerificationKey(CircuitBuilder *builder, const std::shared_ptr< NativeVerificationKey > &native_key)
VerificationKey(CircuitBuilder &builder, std::span< const FF > elements)
Deserialize a verification key from a vector of field elements.
FF hash_through_transcript(const std::string &domain_separator, Transcript &transcript) const override
Hashes the vk using the transcript's independent buffer and returns the hash.
std::vector< FF > to_field_elements() const override
Serialize verification key to field elements.
static constexpr size_t NUM_SUBRELATIONS
NativeFlavor::Relations_< FF > Relations
AvmRecursiveFlavorSettings::BF BF
static constexpr size_t NUM_WIRES
static constexpr size_t NUM_RELATIONS
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
AvmRecursiveFlavorSettings::GroupElement GroupElement
static constexpr size_t NUM_ALL_ENTITIES
static constexpr bool USE_PADDING
static constexpr size_t NUM_WITNESS_ENTITIES
AvmRecursiveFlavorSettings::FF FF
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
static constexpr bool USE_SHORT_MONOMIALS
AvmRecursiveFlavorSettings::Commitment Commitment
AluTraceBuilder builder
Definition alu.test.cpp:123
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
constexpr size_t MAX_AVM_TRACE_LOG_SIZE
Definition constants.hpp:9
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
void throw_or_abort(std::string const &err)