diff --git a/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp b/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp index d5169518bd..4d9bc421eb 100644 --- a/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp +++ b/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp @@ -120,6 +120,7 @@ template struct verification_key { key->n = witness_t(ctx, barretenberg::fr(input_key->circuit_size)); key->num_public_inputs = witness_t(ctx, input_key->num_public_inputs); key->domain = evaluation_domain::from_witness(ctx, input_key->domain); + key->contains_recursive_proof = witness_t(ctx, input_key->contains_recursive_proof); for (const auto& [tag, value] : input_key->commitments) { key->commitments.insert({ tag, Curve::g1_ct::from_witness(ctx, value) }); @@ -136,6 +137,7 @@ template struct verification_key { key->base_key = input_key; key->n = field_t(ctx, input_key->circuit_size); key->num_public_inputs = field_t(ctx, input_key->num_public_inputs); + key->contains_recursive_proof = bool_t(ctx, input_key->contains_recursive_proof); key->domain = evaluation_domain::from_constants(ctx, input_key->domain); @@ -259,6 +261,10 @@ template struct verification_key { field_t num_public_inputs; field_t z_pow_n; + // NOTE: This does not strictly need to be a circuit type. It can be used to check in the circuit + // if a proof contains any aggregated state. + bool_t contains_recursive_proof; + evaluation_domain domain; std::map commitments; diff --git a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp index 5802ad8f75..429eafa915 100644 --- a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp +++ b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp @@ -352,6 +352,10 @@ recursion_output verify_proof(typename Curve::Composer* context, rhs_scalars.push_back(random_separator); } + // Check if recursive proof information is correctly set. + key->contains_recursive_proof.assert_equal(key->base_key->contains_recursive_proof, + "contains_recursive_proof is incorrectly set"); + /** * N.B. if this key contains a recursive proof, then ALL potential verification keys being verified by the outer *circuit must ALSO contain a recursive proof (this is not a concern if the key is being generated from circuit