48template <
typename Flavor>
51 size_t public_inputs_size,
54 requires IsRecursiveFlavor<Flavor>
57 using NativeFlavor =
typename Flavor::NativeFlavor;
63 BB_ASSERT_EQ(proof_size, NativeFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS());
65 size_t num_inner_public_inputs = public_inputs_size - IO::PUBLIC_INPUTS_SIZE;
66 uint32_t pub_inputs_offset = NativeFlavor::has_zero_row ? 1 : 0;
69 auto honk_vk = create_mock_honk_vk<typename Flavor::NativeFlavor, IO>(
70 1 << Flavor::VIRTUAL_LOG_N, pub_inputs_offset, num_inner_public_inputs);
75 for (
auto& vk_element : honk_vk->to_field_elements()) {
76 builder.set_variable(key_fields[
offset].get_witness_index(), vk_element);
81 bb::HonkProof honk_proof = create_mock_honk_proof<typename Flavor::NativeFlavor, IO>(num_inner_public_inputs);
85 for (
auto& proof_element : honk_proof) {
86 builder.set_variable(proof_fields[
offset].get_witness_index(), proof_element);
106template <
typename Flavor>
108 std::vector<fr>& place_holder_vk_fields,
112 size_t public_inputs_size,
120 if (
builder.is_write_vk_mode()) {
123 size_t size_of_proof_with_no_pub_inputs = proof_size - IO::PUBLIC_INPUTS_SIZE;
124 size_t total_num_public_inputs = public_inputs_size + IO::PUBLIC_INPUTS_SIZE;
126 create_dummy_vkey_and_proof<Flavor>(
127 builder, size_of_proof_with_no_pub_inputs, total_num_public_inputs, vk_fields, proof_fields);
130 uint32_t pub_inputs_offset = Flavor::NativeFlavor::has_zero_row ? 1 : 0;
133 auto honk_vk = create_mock_honk_vk<typename Flavor::NativeFlavor, IO>(
134 1 << Flavor::VIRTUAL_LOG_N, pub_inputs_offset, public_inputs_size);
135 place_holder_vk_fields = honk_vk->to_field_elements();
136 place_holder_proof = create_mock_honk_proof<typename Flavor::NativeFlavor, IO>(public_inputs_size);
137 place_holder_vk_hash = honk_vk->hash();
141 auto [place_holder_honk_proof, place_holder_vk] =
142 construct_honk_proof_for_simple_circuit<typename Flavor::NativeFlavor>(public_inputs_size);
143 place_holder_proof = place_holder_honk_proof;
144 place_holder_vk_fields = place_holder_vk->to_field_elements();
145 place_holder_vk_hash = place_holder_vk->hash();
160template <
typename Flavor>
163 requires(IsRecursiveFlavor<Flavor> && IsUltraHonk<typename Flavor::NativeFlavor>)
168 using RecursiveVKAndHash = Flavor::VKAndHash;
174 BB_ASSERT(input.proof_type ==
HONK || input.proof_type ==
HONK_ZK || HasIPAAccumulator<Flavor>);
186 std::vector<uint32_t> proof_indices =
194 std::vector<fr> place_holder_vk_fields;
199 place_holder_proof_and_vk<Flavor>(
builder,
200 place_holder_vk_fields,
202 place_holder_vk_hash,
204 input.public_inputs.size(),
208 if (!input.predicate.is_constant) {
209 bool_ct predicate_witness = bool_ct::from_witness_index_unsafe(&
builder, input.predicate.index);
212 result_proof.reserve(proof_fields.size());
213 result_vk.reserve(vk_fields.size());
215 for (uint32_t i = 0; i < proof_fields.size(); ++i) {
227 result_proof.push_back(valid_proof);
231 for (uint32_t i = 0; i < vk_fields.size(); ++i) {
238 result_vk.push_back(valid_vk);
242 proof_fields = result_proof;
243 vk_fields = result_vk;
249 RecursiveVerifier verifier(&
builder, vk_and_hash);
253 native_verification_debug<Flavor>(vkey, proof_fields);
258 return verifier_output;
265template <
typename Flavor>
277 if constexpr (HasIPAAccumulator<Flavor>) {
278 honk_proof =
HonkProof(native_proof.begin(), native_proof.end() - IPA_PROOF_LENGTH);
279 ipa_proof =
HonkProof(native_proof.end() - IPA_PROOF_LENGTH, native_proof.end());
281 honk_proof = native_proof;
286 bool is_valid_proof(native_verifier.template verify_proof<NativeIO>(honk_proof, ipa_proof));
288 info(
"===== HONK RECURSION CONSTRAINT DEBUG INFO =====");
290 if constexpr (HasIPAAccumulator<Flavor>) {
291 flavor =
"Ultra Rollup Flavor";
293 flavor =
"Ultra ZK Flavor";
295 flavor =
"Ultra Flavor";
297 info(
"Flavor used: ", flavor);
298 info(
"Honk recursion constraint: input proof verifies natively: ", is_valid_proof ?
"true" :
"false");
299 info(
"===== END OF HONK RECURSION CONSTRAINT DEBUG INFO =====");
303#define INSTANTIATE_HONK_RECURSION_CONSTRAINT(Flavor) \
304 template HonkRecursionConstraintOutput<typename Flavor::CircuitBuilder> create_honk_recursion_constraints<Flavor>( \
305 typename Flavor::CircuitBuilder & builder, const RecursionConstraint& input);
313#undef INSTANTIATE_HONK_RECURSION_CONSTRAINT
316#define INSTANTIATE_NATIVE_VERIFICATION_DEBUG(Flavor) \
317 template void native_verification_debug<Flavor>(const std::shared_ptr<typename Flavor::VerificationKey>, \
318 const bb::stdlib::Proof<typename Flavor::CircuitBuilder>&);
326#undef INSTANTIATE_NATIVE_VERIFICATION_DEBUG
#define BB_ASSERT(expression,...)
#define BB_ASSERT_EQ(actual, expected,...)
Manages the data that is propagated on the public inputs of an application/function circuit.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
static constexpr bool HasZK
ECCVMCircuitBuilder CircuitBuilder
An object storing two EC points that represent the inputs to a pairing check.
The data that is propagated on the public inputs of a rollup circuit.
The recursive counterpart to the "native" Ultra flavor.
The recursive counterpart to the "native" UltraRollupFlavor.
The recursive counterpart to the Ultra flavor with ZK.
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
A simple wrapper around a vector of stdlib field elements representing a proof.
HonkProof get_value() const
Implements boolean logic in-circuit.
static field_t from_witness_index(Builder *ctx, uint32_t witness_index)
void unset_free_witness_tag() const
Unset the free witness flag for the field element's tag.
bb::fr get_value() const
Given a := *this, compute its value given by a.v * a.mul + a.add.
static field_t from_witness(Builder *ctx, const bb::fr &input)
static field_t conditional_assign(const bool_t< Builder > &predicate, const field_t &lhs, const field_t &rhs)
Manages the data that is propagated on the public inputs of an application/function circuit.
The data that is propagated on the public inputs of a rollup circuit.
Base class templates for structures that contain data parameterized by the fundamental polynomials of...
#define INSTANTIATE_NATIVE_VERIFICATION_DEBUG(Flavor)
#define INSTANTIATE_HONK_RECURSION_CONSTRAINT(Flavor)
Entry point for Barretenberg command-line interface.
std::vector< fr > HonkProof
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
An object storing two EC points that represent the inputs to a pairing check.