Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ultra_rollup_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
21
22namespace bb {
23
38template <typename BuilderType> class UltraRollupRecursiveFlavor_ : public UltraRecursiveFlavor_<BuilderType> {
39 public:
40 using CircuitBuilder = BuilderType; // Determines arithmetization of circuit instantiated with this flavor
43 using PCS = KZG<Curve>;
44 using GroupElement = typename Curve::Element;
45 using Commitment = typename Curve::Element;
46 using FF = typename Curve::ScalarField;
50
60 : public StdlibVerificationKey_<BuilderType, UltraRollupFlavor::PrecomputedEntities<Commitment>> {
61 public:
63
71 {
72 this->log_circuit_size = FF::from_witness(builder, typename FF::native(native_key->log_circuit_size));
73 this->num_public_inputs = FF::from_witness(builder, typename FF::native(native_key->num_public_inputs));
74 this->pub_inputs_offset = FF::from_witness(builder, typename FF::native(native_key->pub_inputs_offset));
75
76 // Generate stdlib commitments (biggroup) from the native counterparts
77 for (auto [commitment, native_commitment] : zip_view(this->get_all(), native_key->get_all())) {
78 commitment = Commitment::from_witness(builder, native_commitment);
79 }
80 };
81
89 {
90 using Codec = stdlib::StdlibCodec<FF>;
91
92 size_t num_frs_read = 0;
93
94 this->log_circuit_size = Codec::template deserialize_from_frs<FF>(elements, num_frs_read);
95 this->num_public_inputs = Codec::template deserialize_from_frs<FF>(elements, num_frs_read);
96 this->pub_inputs_offset = Codec::template deserialize_from_frs<FF>(elements, num_frs_read);
97
98 for (Commitment& commitment : this->get_all()) {
99 commitment = Codec::template deserialize_from_frs<Commitment>(elements, num_frs_read);
100 }
101 }
102
111 const std::span<const uint32_t> witness_indices)
112 {
113 std::vector<FF> vk_fields;
114 vk_fields.reserve(witness_indices.size());
115 for (const auto& idx : witness_indices) {
116 vk_fields.emplace_back(FF::from_witness_index(&builder, idx));
117 }
118 return VerificationKey(vk_fields);
119 }
120
121#ifndef NDEBUG
128 {
129 NativeVerificationKey native_vk;
130 native_vk.log_circuit_size = static_cast<uint64_t>(this->log_circuit_size.get_value());
131 native_vk.num_public_inputs = static_cast<uint64_t>(this->num_public_inputs.get_value());
132 native_vk.pub_inputs_offset = static_cast<uint64_t>(this->pub_inputs_offset.get_value());
133 for (auto [commitment, native_commitment] : zip_view(this->get_all(), native_vk.get_all())) {
134 native_commitment = commitment.get_value();
135 }
136 return native_vk;
137 }
138#endif
139 };
140
141 // Reuse the VerifierCommitments from Ultra
144};
145
146} // 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:325
A container encapsulating all the commitments that the verifier receives (to precomputed polynomials ...
The recursive counterpart to the "native" Ultra flavor.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
NativeVerificationKey get_value() const
Get the native verification key corresponding to this stdlib verification key.
VerificationKey(CircuitBuilder *builder, const std::shared_ptr< NativeVerificationKey > &native_key)
Construct a new Verification Key with stdlib types from a provided native verification key.
static VerificationKey from_witness_indices(CircuitBuilder &builder, const std::span< const uint32_t > witness_indices)
Construct a VerificationKey from a set of corresponding witness indices.
VerificationKey(std::span< FF > elements)
Deserialize a verification key from a vector of field elements.
The recursive counterpart to the "native" UltraRollupFlavor.
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
static field_t from_witness_index(Builder *ctx, uint32_t witness_index)
Definition field.cpp:62
bb::fr get_value() const
Given a := *this, compute its value given by a.v * a.mul + a.add.
Definition field.cpp:828
static field_t from_witness(Builder *ctx, const bb::fr &input)
Definition field.hpp:454
AluTraceBuilder builder
Definition alu.test.cpp:124
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
field_t< CircuitBuilder > ScalarField
Definition bn254.hpp:33