Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
translator_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
19
20namespace bb {
21
32
33 public:
34 // TODO(https://github.com/AztecProtocol/barretenberg/issues/990): Establish whether mini_circuit_size pattern is
35 // needed
38 using PCS = KZG<Curve>;
44 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
45
48
50
51 // Indicates that this flavor runs with non-ZK Sumcheck.
52 static constexpr bool HasZK = true;
53 // Translator proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
55 // None of this parameters can be changed
56
57 // Number of bits in a binary limb
58 // This is not a configurable value. Relations are sepcifically designed for it to be 68
59 static constexpr size_t NUM_LIMB_BITS = NativeFlavor::NUM_LIMB_BITS;
60
61 // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We
62 // often need containers of this size to hold related data, so we choose a name more agnostic than
63 // `NUM_POLYNOMIALS`. Note: this number does not include the individual sorted list polynomials.
65 // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying
66 // assignment of witnesses. We again choose a neutral name.
68 // The total number of witness entities not including shifts.
70
71 // Number of wires representing the op queue whose commitments are going to be checked against those from the
72 // final round of merge
74
76
78
79 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
80 static constexpr size_t MAX_TOTAL_RELATION_LENGTH = compute_max_total_relation_length<Relations>();
81
82 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
83 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
84 // length = 3
87
93 public:
95 using Base::Base;
96 };
106 : public StdlibVerificationKey_<CircuitBuilder, TranslatorFlavor::PrecomputedEntities<Commitment>> {
107 public:
109 {
110 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1324): Remove `log_circuit_size` from MSGPACK
111 // and the verification key.
114 this->num_public_inputs = FF::from_witness(builder, native_key->num_public_inputs);
115 this->pub_inputs_offset = FF::from_witness(builder, native_key->pub_inputs_offset);
116
117 for (auto [native_comm, comm] : zip_view(native_key->get_all(), this->get_all())) {
118 comm = Commitment::from_witness(builder, native_comm);
119 }
120 }
121
127 std::vector<FF> to_field_elements() const override
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
156 {
157 for (Commitment& commitment : this->get_all()) {
158 commitment.fix_witness();
159 }
160 }
161 };
162
167
169 // Reuse the VerifierCommitments from Translator
171 // Reuse the transcript from Translator
173
175};
176} // namespace bb
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
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...
Container for all witness polynomials used/constructed by the prover.
static constexpr size_t NUM_ALL_ENTITIES
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t CONST_TRANSLATOR_LOG_N
static constexpr size_t NUM_OP_QUEUE_WIRES
static constexpr bool USE_PADDING
static constexpr size_t NUM_LIMB_BITS
std::tuple< TranslatorPermutationRelation< FF >, TranslatorDeltaRangeConstraintRelation< FF >, TranslatorOpcodeConstraintRelation< FF >, TranslatorAccumulatorTransferRelation< FF >, TranslatorDecompositionRelation< FF >, TranslatorNonNativeFieldRelation< FF >, TranslatorZeroConstraintsRelation< FF > > Relations_
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
static constexpr size_t NUM_SUBRELATIONS
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
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-witnessk) pol...
VerificationKey(CircuitBuilder *builder, const std::shared_ptr< NativeVerificationKey > &native_key)
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.
std::vector< FF > to_field_elements() const override
Serialize verification key to field elements.
The recursive counterpart of the native Translator flavor.
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
TranslatorFlavor::Relations_< FF > Relations
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
static constexpr size_t MAX_TOTAL_RELATION_LENGTH
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
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
field_t< CircuitBuilder > ScalarField
Definition bn254.hpp:33
Group::BaseField BaseField
Definition bn254.hpp:35
Group AffineElement
Definition bn254.hpp:37
void throw_or_abort(std::string const &err)