diff --git a/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp b/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp index e721f9beccc1..aed0abd16bff 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp @@ -10,7 +10,7 @@ #include "barretenberg/dsl/acir_proofs/honk_contract.hpp" #include "barretenberg/dsl/acir_proofs/honk_zk_contract.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" +#include "barretenberg/special_public_inputs/special_public_inputs.hpp" #include "barretenberg/srs/global_crs.hpp" namespace bb { @@ -87,16 +87,22 @@ PubInputsProofAndKey _prove(const bool compute_vk, UltraProver_ prover{ proving_key, vk }; Proof concat_pi_and_proof = prover.construct_proof(); - size_t num_inner_public_inputs = prover.proving_key->num_public_inputs(); - // Loose check that the public inputs contain a pairing point accumulator, doesn't catch everything. - BB_ASSERT_GTE(prover.proving_key->num_public_inputs(), - PAIRING_POINTS_SIZE, - "Public inputs should contain a pairing point accumulator."); - num_inner_public_inputs -= PAIRING_POINTS_SIZE; - if constexpr (HasIPAAccumulator) { - BB_ASSERT_GTE(num_inner_public_inputs, IPA_CLAIM_SIZE, "Public inputs should contain an IPA claim."); - num_inner_public_inputs -= IPA_CLAIM_SIZE; - } + // Compute number of inner public inputs. Perform loose checks that the public inputs contain enough data. + auto num_inner_public_inputs = [&]() { + size_t num_public_inputs = prover.proving_key->num_public_inputs(); + if constexpr (HasIPAAccumulator) { + BB_ASSERT_GTE(num_public_inputs, + RollupIO::PUBLIC_INPUTS_SIZE, + "Public inputs should contain a pairing point accumulator and an IPA claim."); + return num_public_inputs - RollupIO::PUBLIC_INPUTS_SIZE; + } else { + BB_ASSERT_GTE(num_public_inputs, + DefaultIO::PUBLIC_INPUTS_SIZE, + "Public inputs should contain a pairing point accumulator."); + return num_public_inputs - DefaultIO::PUBLIC_INPUTS_SIZE; + } + }(); + // We split the inner public inputs, which are stored at the front of the proof, from the rest of the proof. Now, // the "proof" refers to everything except the inner public inputs. PublicInputsAndProof public_inputs_and_proof{ diff --git a/barretenberg/cpp/src/barretenberg/api/prove_tube.cpp b/barretenberg/cpp/src/barretenberg/api/prove_tube.cpp index f63ec8e2fafc..f55ae2d1c553 100644 --- a/barretenberg/cpp/src/barretenberg/api/prove_tube.cpp +++ b/barretenberg/cpp/src/barretenberg/api/prove_tube.cpp @@ -3,6 +3,7 @@ #include "barretenberg/common/map.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/stdlib/client_ivc_verifier/client_ivc_recursive_verifier.hpp" +#include "barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp" namespace bb { /** @@ -17,6 +18,8 @@ void prove_tube(const std::string& output_path, const std::string& vk_path) using Builder = UltraCircuitBuilder; using StdlibProof = ClientIVCRecursiveVerifier::StdlibProof; + using HidingKernelIO = stdlib::recursion::honk::HidingKernelIO; + using RollupIO = stdlib::recursion::honk::RollupIO; std::string proof_path = output_path + "/proof"; @@ -34,7 +37,7 @@ void prove_tube(const std::string& output_path, const std::string& vk_path) // The public inputs in the proof are propagated to the base rollup by making them public inputs of this circuit. // Exclude the public inputs of the Hiding Kernel: the pairing points are handled separately, the ecc op tables are // not needed after this point - auto num_inner_public_inputs = vk.mega->num_public_inputs - HidingKernelIO::PUBLIC_INPUTS_SIZE; + auto num_inner_public_inputs = vk.mega->num_public_inputs - HidingKernelIO::PUBLIC_INPUTS_SIZE; for (size_t i = 0; i < num_inner_public_inputs; i++) { stdlib_proof.mega_proof[i].set_public(); } diff --git a/barretenberg/cpp/src/barretenberg/bb/cli.cpp b/barretenberg/cpp/src/barretenberg/bb/cli.cpp index 25ccf363f881..91a4704f59a8 100644 --- a/barretenberg/cpp/src/barretenberg/bb/cli.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/cli.cpp @@ -25,7 +25,6 @@ #include "barretenberg/bbapi/c_bind.hpp" #include "barretenberg/common/thread.hpp" #include "barretenberg/flavor/ultra_rollup_flavor.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/srs/factories/native_crs_factory.hpp" #include "barretenberg/srs/global_crs.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_ultra_honk.cpp b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_ultra_honk.cpp index a74bdfa51aa2..9c8f2b9fc097 100644 --- a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_ultra_honk.cpp +++ b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_ultra_honk.cpp @@ -7,7 +7,6 @@ #include "barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp" #include "barretenberg/dsl/acir_format/serde/witness_stack.hpp" #include "barretenberg/flavor/mega_flavor.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/ultra_honk/decider_proving_key.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp index 768c0c9faa94..4e4b6a76c6c0 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp @@ -7,7 +7,6 @@ #pragma once #include "barretenberg/commitment_schemes/commitment_key.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/stdlib/primitives/curves/grumpkin.hpp" @@ -64,8 +63,10 @@ template class OpeningClaim { // commitment to univariate polynomial p(X) Commitment commitment; - // Size of public inputs representation of an opening claim over Grumpkin - static constexpr size_t PUBLIC_INPUTS_SIZE = IPA_CLAIM_SIZE; + static constexpr bool IS_GRUMPKIN = + std::is_same_v || std::is_same_v>; + // Size of public inputs representation of an opening claim over Grumpkin: 2 * 4 + 2 = 10 + static constexpr size_t PUBLIC_INPUTS_SIZE = IS_GRUMPKIN ? GRUMPKIN_OPENING_CLAIM_SIZE : INVALID_PUBLIC_INPUTS_SIZE; /** * @brief Set the witness indices for the opening claim to public @@ -91,8 +92,6 @@ template class OpeningClaim { const std::span, PUBLIC_INPUTS_SIZE>& limbs) requires(std::is_same_v>) { - BB_ASSERT_EQ(2 * Fr::PUBLIC_INPUTS_SIZE + Commitment::PUBLIC_INPUTS_SIZE, PUBLIC_INPUTS_SIZE); - const size_t FIELD_SIZE = Fr::PUBLIC_INPUTS_SIZE; const size_t COMMITMENT_SIZE = Commitment::PUBLIC_INPUTS_SIZE; std::span, FIELD_SIZE> challenge_limbs{ limbs.data(), FIELD_SIZE }; @@ -111,19 +110,18 @@ template class OpeningClaim { * @note Implemented for native curve::Grumpkin for use with IPA. * */ - static OpeningClaim reconstruct_from_public(const std::span& ipa_claim_limbs) + static OpeningClaim reconstruct_from_public(const std::span& limbs) requires(std::is_same_v) { - size_t index = 0; - std::span challenge_limbs = ipa_claim_limbs.subspan(index, FQ_PUBLIC_INPUT_SIZE); - index += FQ_PUBLIC_INPUT_SIZE; - std::span evaluation_limbs = ipa_claim_limbs.subspan(index, FQ_PUBLIC_INPUT_SIZE); - index += FQ_PUBLIC_INPUT_SIZE; - std::span point_limbs = ipa_claim_limbs.subspan(index, 2 * FR_PUBLIC_INPUTS_SIZE); - - auto challenge = fq::reconstruct_from_public(challenge_limbs); - auto evaluation = fq::reconstruct_from_public(evaluation_limbs); - typename Curve::AffineElement commitment = Curve::AffineElement::reconstruct_from_public(point_limbs); + const size_t FIELD_SIZE = Fr::PUBLIC_INPUTS_SIZE; + const size_t COMMITMENT_SIZE = Commitment::PUBLIC_INPUTS_SIZE; + std::span challenge_limbs{ limbs.data(), FIELD_SIZE }; + std::span evaluation_limbs{ limbs.data() + FIELD_SIZE, FIELD_SIZE }; + std::span commitment_limbs{ limbs.data() + 2 * FIELD_SIZE, COMMITMENT_SIZE }; + + Fr challenge = Fr::reconstruct_from_public(challenge_limbs); + Fr evaluation = Fr::reconstruct_from_public(evaluation_limbs); + Commitment commitment = Commitment::reconstruct_from_public(commitment_limbs); return OpeningClaim{ { challenge, evaluation }, commitment }; } diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/pairing_points.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/pairing_points.hpp index adaf1f201362..006d7e9b0f6c 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/pairing_points.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/pairing_points.hpp @@ -8,7 +8,6 @@ #include "barretenberg/commitment_schemes/commitment_key.hpp" #include "barretenberg/commitment_schemes/verification_key.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/stdlib/primitives/curves/grumpkin.hpp" @@ -30,6 +29,8 @@ class PairingPoints { using VerifierCK = VerifierCommitmentKey; public: + static constexpr size_t PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE; + Point P0 = Point::infinity(); Point P1 = Point::infinity(); @@ -43,10 +44,13 @@ class PairingPoints { * @brief Reconstruct the pairing points from limbs stored on the public inputs. * */ - static PairingPoints reconstruct_from_public(const std::span& limbs_in) + static PairingPoints reconstruct_from_public(const std::span& limbs_in) { - Point P0 = Point::reconstruct_from_public(limbs_in.subspan(0, 2 * FQ_PUBLIC_INPUT_SIZE)); - Point P1 = Point::reconstruct_from_public(limbs_in.subspan(2 * FQ_PUBLIC_INPUT_SIZE, 2 * FQ_PUBLIC_INPUT_SIZE)); + const std::span P0_limbs(limbs_in.data(), Point::PUBLIC_INPUTS_SIZE); + const std::span P1_limbs(limbs_in.data() + Point::PUBLIC_INPUTS_SIZE, + Point::PUBLIC_INPUTS_SIZE); + Point P0 = Point::reconstruct_from_public(P0_limbs); + Point P1 = Point::reconstruct_from_public(P1_limbs); return PairingPoints{ P0, P1 }; } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp index 72654ad1c685..6ad45320ff6c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp @@ -11,7 +11,6 @@ #include "barretenberg/flavor/ultra_recursive_flavor.hpp" #include "barretenberg/flavor/ultra_rollup_recursive_flavor.hpp" #include "barretenberg/flavor/ultra_zk_recursive_flavor.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp" #include "barretenberg/stdlib/pairing_points.hpp" #include "barretenberg/stdlib/primitives/bigfield/constants.hpp" @@ -55,6 +54,9 @@ void create_dummy_vkey_and_proof(typename Flavor::CircuitBuilder& builder, { using Builder = typename Flavor::CircuitBuilder; using NativeFlavor = typename Flavor::NativeFlavor; + + static constexpr size_t IPA_CLAIM_SIZE = stdlib::recursion::honk::RollupIO::IpaClaim::PUBLIC_INPUTS_SIZE; + // Set vkey->circuit_size correctly based on the proof size BB_ASSERT_EQ(proof_size, NativeFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS); // a lambda that adds dummy commitments (libra and gemini) @@ -83,10 +85,8 @@ void create_dummy_vkey_and_proof(typename Flavor::CircuitBuilder& builder, // Third key field is the pub inputs offset uint32_t pub_inputs_offset = NativeFlavor::has_zero_row ? 1 : 0; builder.set_variable(key_fields[offset++].witness_index, pub_inputs_offset); - size_t num_inner_public_inputs = public_inputs_size - bb::PAIRING_POINTS_SIZE; - if constexpr (HasIPAAccumulator) { - num_inner_public_inputs -= bb::IPA_CLAIM_SIZE; - } + size_t num_inner_public_inputs = HasIPAAccumulator ? public_inputs_size - bb::RollupIO::PUBLIC_INPUTS_SIZE + : public_inputs_size - bb::DefaultIO::PUBLIC_INPUTS_SIZE; for (size_t i = 0; i < Flavor::NUM_PRECOMPUTED_ENTITIES; ++i) { set_dummy_commitment(offset); @@ -110,7 +110,7 @@ void create_dummy_vkey_and_proof(typename Flavor::CircuitBuilder& builder, // IPA claim // TODO(https://github.com/AztecProtocol/barretenberg/issues/1392): Don't use random elements here. if constexpr (HasIPAAccumulator) { - for (size_t i = 0; i < bb::IPA_CLAIM_SIZE; i++) { + for (size_t i = 0; i < IPA_CLAIM_SIZE; i++) { set_dummy_evaluation(offset); } } @@ -257,11 +257,13 @@ HonkRecursionConstraintOutput create_honk_recur size_t size_of_proof_with_no_pub_inputs = input.proof.size(); size_t total_num_public_inputs = input.public_inputs.size(); if constexpr (HasIPAAccumulator) { + using RollupIO = stdlib::recursion::honk::RollupIO; size_of_proof_with_no_pub_inputs -= RollupIO::PUBLIC_INPUTS_SIZE; total_num_public_inputs += RollupIO::PUBLIC_INPUTS_SIZE; } else { - size_of_proof_with_no_pub_inputs -= DefaultIO::PUBLIC_INPUTS_SIZE; - total_num_public_inputs += DefaultIO::PUBLIC_INPUTS_SIZE; + using DefaultIO = stdlib::recursion::honk::DefaultIO; + size_of_proof_with_no_pub_inputs -= DefaultIO::PUBLIC_INPUTS_SIZE; + total_num_public_inputs += DefaultIO::PUBLIC_INPUTS_SIZE; } create_dummy_vkey_and_proof( diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.cpp index 5043f0322eec..56cde1107de1 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.cpp @@ -11,7 +11,6 @@ #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/ultra_recursive_flavor.hpp" #include "barretenberg/flavor/ultra_rollup_recursive_flavor.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp" #include "barretenberg/stdlib/pairing_points.hpp" #include "barretenberg/stdlib/primitives/bigfield/constants.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/mock_verifier_inputs.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/mock_verifier_inputs.cpp index dcabb8fd4011..f36771c3d86e 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/mock_verifier_inputs.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/mock_verifier_inputs.cpp @@ -8,7 +8,6 @@ #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/ultra_recursive_flavor.hpp" #include "barretenberg/flavor/ultra_rollup_recursive_flavor.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp" #include "barretenberg/stdlib/pairing_points.hpp" #include "barretenberg/stdlib/primitives/bigfield/constants.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp index e2492a76fb51..a980fc1cdea4 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/proof_surgeon.hpp @@ -10,8 +10,8 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include "barretenberg/special_public_inputs/special_public_inputs.hpp" #include "barretenberg/stdlib/proof/proof.hpp" #include #include @@ -46,10 +46,9 @@ class ProofSurgeon { // Get public inputs by cutting them out of the proof size_t num_public_inputs_to_extract = - static_cast(verification_key->num_public_inputs) - bb::PAIRING_POINTS_SIZE; - if (ipa_accumulation) { - num_public_inputs_to_extract -= bb::IPA_CLAIM_SIZE; - } + ipa_accumulation + ? static_cast(verification_key->num_public_inputs) - bb::RollupIO::PUBLIC_INPUTS_SIZE + : static_cast(verification_key->num_public_inputs) - bb::DefaultIO::PUBLIC_INPUTS_SIZE; debug("proof size: ", proof.size()); debug("number of public inputs to extract: ", num_public_inputs_to_extract); std::vector public_inputs = diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fq.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fq.hpp index cdd28a5d90db..5ab75529015a 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fq.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fq.hpp @@ -16,11 +16,6 @@ // NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays) namespace bb { -// TODO(https://github.com/AztecProtocol/barretenberg/issues/1478): Can we define this constant as part of the -// parameters and make it avaiable via the interface of field? -// A point in Fq is represented with 4 public inputs -static constexpr size_t FQ_PUBLIC_INPUT_SIZE = 4; - class Bn254FqParams { // There is a helper script in ecc/fields/parameter_helper.py that can be used to extract these parameters from the // source code @@ -166,15 +161,15 @@ class Bn254FqParams { // The modulus is larger than BN254 scalar field modulus, so it maps to two BN254 scalars static constexpr size_t NUM_BN254_SCALARS = 2; static constexpr size_t MAX_BITS_PER_ENDOMORPHISM_SCALAR = 128; + + // A point in Fq is represented as a bigfield element in the public inputs, so 4 public inputs + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGFIELD_PUBLIC_INPUTS_SIZE; }; using fq = field; -template <> template <> inline fq fq::reconstruct_from_public(const std::span& limbs) +template <> template <> inline fq fq::reconstruct_from_public(const std::span& limbs) { - // A point in Fq is represented with 4 public inputs - BB_ASSERT_EQ(limbs.size(), FQ_PUBLIC_INPUT_SIZE, "Incorrect number of limbs"); - const uint256_t limb = static_cast(limbs[0]) + (static_cast(limbs[1]) << bb::stdlib::NUM_LIMB_BITS_IN_FIELD_SIMULATION) + (static_cast(limbs[2]) << (bb::stdlib::NUM_LIMB_BITS_IN_FIELD_SIMULATION * 2)) + diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fr.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fr.hpp index 925a92e5dd8e..e76e6a665ab7 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fr.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fr.hpp @@ -11,14 +11,12 @@ #include #include "../../fields/field.hpp" +#include "barretenberg/honk/types/public_inputs_type.hpp" // NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays) namespace bb { -// A point in Fr is represented with 1 public input -static constexpr size_t FR_PUBLIC_INPUTS_SIZE = 1; - class Bn254FrParams { // There is a helper script in ecc/fields/parameter_helper.py that can be used to extract these parameters from the public: @@ -168,15 +166,15 @@ class Bn254FrParams { // This is a BN254 scalar, so it represents one BN254 scalar static constexpr size_t NUM_BN254_SCALARS = 1; static constexpr size_t MAX_BITS_PER_ENDOMORPHISM_SCALAR = 128; + + // A point in Fr is represented with 1 public input + static constexpr size_t PUBLIC_INPUTS_SIZE = FR_PUBLIC_INPUTS_SIZE; }; using fr = field; -template <> template <> inline fr fr::reconstruct_from_public(const std::span& limbs) +template <> template <> inline fr fr::reconstruct_from_public(const std::span& limbs) { - - BB_ASSERT_EQ(limbs.size(), FR_PUBLIC_INPUTS_SIZE, "Incorrect number of limbs"); - return fr(limbs[0]); } diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g1.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g1.hpp index ef084cee213e..0362e9e712ec 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g1.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g1.hpp @@ -40,24 +40,3 @@ inline std::string msgpack_schema_name(bb::g1::affine_element const& /*unused*/) { return "G1AffineElement"; } - -// Specialize the reconstruct from public method -template <> -inline bb::g1::affine_element bb::g1::affine_element::reconstruct_from_public(const std::span& limbs) -{ - BB_ASSERT_EQ(limbs.size(), 2 * FQ_PUBLIC_INPUT_SIZE, "Incorrect number of limbs"); - - auto x_limbs = limbs.subspan(0, FQ_PUBLIC_INPUT_SIZE); - auto y_limbs = limbs.subspan(FQ_PUBLIC_INPUT_SIZE, FQ_PUBLIC_INPUT_SIZE); - - affine_element result; - result.x = Fq::reconstruct_from_public(x_limbs); - result.y = Fq::reconstruct_from_public(y_limbs); - - if (result.x == Fq::zero() && result.y == Fq::zero()) { - result.self_set_infinity(); - } - - ASSERT(result.on_curve()); - return result; -} diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g2.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g2.hpp index a136b1147bf9..9b0c9b0f3613 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g2.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/g2.hpp @@ -37,4 +37,4 @@ struct Bn254G2Params { }; using g2 = group; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp index 88ef56fc2915..b3103cf15d73 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp @@ -79,25 +79,3 @@ class Grumpkin { static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH = 3; }; } // namespace bb::curve - -// Specialize the reconstruct from public method -template <> -inline bb::grumpkin::g1::affine_element bb::grumpkin::g1::affine_element::reconstruct_from_public( - const std::span& limbs) -{ - BB_ASSERT_EQ(limbs.size(), 2 * FR_PUBLIC_INPUTS_SIZE, "Incorrect number of limbs"); - - auto x_limbs = limbs.subspan(0, FR_PUBLIC_INPUTS_SIZE); - auto y_limbs = limbs.subspan(FR_PUBLIC_INPUTS_SIZE, FR_PUBLIC_INPUTS_SIZE); - - affine_element result; - result.x = Fq::reconstruct_from_public(x_limbs); - result.y = Fq::reconstruct_from_public(y_limbs); - - if (result.x == Fq::zero() && result.y == Fq::zero()) { - result.self_set_infinity(); - } - - ASSERT(result.on_curve()); - return result; -} diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/secp256k1/secp256k1.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/secp256k1/secp256k1.hpp index 954fd74f81f2..1ad501a8b9d4 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/secp256k1/secp256k1.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/secp256k1/secp256k1.hpp @@ -135,6 +135,10 @@ struct FqParams { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL }; + + // For consistency with bb::fq, if we ever represent an element of bb::secp256k1::fq in the public inputs, we do so + // as a bigfield element, so with 4 public inputs + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGFIELD_PUBLIC_INPUTS_SIZE; }; using fq = field; @@ -277,6 +281,10 @@ struct FrParams { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL }; + + // For consistency with bb::fq, if we ever represent an element of bb::secp256k1::fr in the public inputs, we do so + // as a bigfield element, so with 4 public inputs + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGFIELD_PUBLIC_INPUTS_SIZE; }; using fr = field; diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/secp256r1/secp256r1.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/secp256r1/secp256r1.hpp index 81f109b04ad2..836ff708dd68 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/secp256r1/secp256r1.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/secp256r1/secp256r1.hpp @@ -132,6 +132,10 @@ struct FqParams { 0x0000009fffffff5fULL, 0x000000bfffffff3fULL, 0x000000dfffffff1fULL, 0x000000fffffffeffULL, 0x0000011ffffffedfULL, 0x0000013ffffffebfULL }; + + // For consistency with bb::fq, if we ever represent an element of bb::secp256r1::fq in the public inputs, we do so + // as a bigfield element, so with 4 public inputs + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGFIELD_PUBLIC_INPUTS_SIZE; }; using fq = field; @@ -257,6 +261,10 @@ struct FrParams { 0x0000011ffffffee0ULL, 0x0000013ffffffec0ULL, 0x0000015ffffffea0ULL, 0x0000017ffffffe80ULL, 0x0000019ffffffe60ULL, 0x000001bffffffe40ULL }; + + // For consistency with bb::fq, if we ever represent an element of bb::secp256r1::fq in the public inputs, we do so + // as a bigfield element, so with 4 public inputs + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGFIELD_PUBLIC_INPUTS_SIZE; }; using fr = field; diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field2_declarations.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field2_declarations.hpp index c999874bb6c3..b174e5f87415 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field2_declarations.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field2_declarations.hpp @@ -16,6 +16,8 @@ class RNG; namespace bb { template struct alignas(32) field2 { public: + static constexpr size_t PUBLIC_INPUTS_SIZE = base_field::PUBLIC_INPUTS_SIZE + base_field::PUBLIC_INPUTS_SIZE; + constexpr field2(const base_field& a = base_field::zero(), const base_field& b = base_field::zero()) : c0(a) , c1(b) diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp index d9a0bf89d076..e60fd53f40b7 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp @@ -43,6 +43,9 @@ template struct alignas(32) field { using out_buf = uint8_t*; using vec_out_buf = uint8_t**; + // The number of element required to represent field in the public inputs of a circuit + static constexpr size_t PUBLIC_INPUTS_SIZE = Params::PUBLIC_INPUTS_SIZE; + #if defined(__wasm__) || !defined(__SIZEOF_INT128__) #define WASM_NUM_LIMBS 9 #define WASM_LIMB_BITS 29 @@ -373,7 +376,7 @@ template struct alignas(32) field { static field serialize_from_buffer(const uint8_t* buffer) { return from_buffer(buffer); } - template static field reconstruct_from_public(const std::span>& limbs); + template static field reconstruct_from_public(const std::span, PUBLIC_INPUTS_SIZE>& limbs); [[nodiscard]] BB_INLINE std::vector to_buffer() const { return ::to_buffer(*this); } diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp index d86931339c5f..d7723900c69a 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.hpp @@ -29,6 +29,14 @@ template class alignas(64) affine using out_buf = uint8_t*; using vec_out_buf = uint8_t**; + /** + * Number of bb::fr elements required to represent an affine_element in the public inputs + * @note In contrast to biggroup and biggroup_goblin this value cannot be computed for all instances of Fq because + * Fq::PUBLIC_INPUTS_SIZE depends on Fq, while bigfield and bigfield_goblin are always represented using 4 public + * inputs + */ + static constexpr size_t PUBLIC_INPUTS_SIZE = Fq::PUBLIC_INPUTS_SIZE + Fq::PUBLIC_INPUTS_SIZE; + affine_element() noexcept = default; ~affine_element() noexcept = default; @@ -171,7 +179,19 @@ template class alignas(64) affine return buffer; } - static affine_element reconstruct_from_public(const std::span& limbs); + static affine_element reconstruct_from_public(const std::span& limbs) + { + const std::span x_limbs(limbs.data(), Fq::PUBLIC_INPUTS_SIZE); + const std::span y_limbs(limbs.data() + Fq::PUBLIC_INPUTS_SIZE, + Fq::PUBLIC_INPUTS_SIZE); + + affine_element result; + result.x = Fq::reconstruct_from_public(x_limbs); + result.y = Fq::reconstruct_from_public(y_limbs); + + ASSERT(result.on_curve()); + return result; + } friend std::ostream& operator<<(std::ostream& os, const affine_element& a) { diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp index bc9088225e95..b3fd65a44e17 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp @@ -294,6 +294,8 @@ TYPED_TEST(TestAffineElement, MulWithEndomorphismMatchesMulWithoutEndomorphism) TEST(AffineElementFromPublicInputs, Bn254FromPublicInputs) { using Curve = curve::BN254; + using Fq = Curve::BaseField; + using Fr = Curve::ScalarField; using AffineElement = Curve::AffineElement; AffineElement point = AffineElement::random_element(); @@ -301,21 +303,23 @@ TEST(AffineElementFromPublicInputs, Bn254FromPublicInputs) uint256_t y(point.y); // Construct public inputs - std::vector public_inputs; + std::vector public_inputs; size_t index = 0; - for (size_t idx = 0; idx < FQ_PUBLIC_INPUT_SIZE; idx++) { + for (size_t idx = 0; idx < Fq::PUBLIC_INPUTS_SIZE; idx++) { auto limb = x.slice(index, index + bb::stdlib::NUM_LIMB_BITS_IN_FIELD_SIMULATION); - public_inputs.emplace_back(bb::fr(limb)); + public_inputs.emplace_back(Fr(limb)); index += bb::stdlib::NUM_LIMB_BITS_IN_FIELD_SIMULATION; } index = 0; - for (size_t idx = 0; idx < FQ_PUBLIC_INPUT_SIZE; idx++) { + for (size_t idx = 0; idx < Fq::PUBLIC_INPUTS_SIZE; idx++) { auto limb = y.slice(index, index + bb::stdlib::NUM_LIMB_BITS_IN_FIELD_SIMULATION); - public_inputs.emplace_back(bb::fr(limb)); + public_inputs.emplace_back(Fr(limb)); index += bb::stdlib::NUM_LIMB_BITS_IN_FIELD_SIMULATION; } - auto reconstructed = AffineElement::reconstruct_from_public(std::span(public_inputs)); + std::span limbs(public_inputs.data(), AffineElement::PUBLIC_INPUTS_SIZE); + + auto reconstructed = AffineElement::reconstruct_from_public(limbs); EXPECT_EQ(reconstructed, point); } @@ -324,13 +328,16 @@ TEST(AffineElementFromPublicInputs, GrumpkinFromPublicInputs) { using Curve = curve::Grumpkin; using AffineElement = Curve::AffineElement; + using Fq = Curve::BaseField; AffineElement point = AffineElement::random_element(); // Construct public inputs - std::vector public_inputs = { point.x, point.y }; + std::vector public_inputs = { point.x, point.y }; + + std::span limbs(public_inputs.data(), AffineElement::PUBLIC_INPUTS_SIZE); - auto reconstructed = AffineElement::reconstruct_from_public(std::span(public_inputs)); + auto reconstructed = AffineElement::reconstruct_from_public(limbs); EXPECT_EQ(reconstructed, point); } diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index 7096559b7f65..43632b912b8f 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -78,16 +78,15 @@ #include "barretenberg/constants.hpp" #include "barretenberg/crypto/poseidon2/poseidon2.hpp" #include "barretenberg/ecc/fields/field_conversion.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/honk/types/circuit_type.hpp" #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/polynomials/univariate.hpp" +#include "barretenberg/public_input_component/public_component_key.hpp" #include "barretenberg/srs/global_crs.hpp" #include "barretenberg/stdlib/hash/poseidon2/poseidon2.hpp" #include "barretenberg/stdlib/primitives/field/field_conversion.hpp" #include "barretenberg/stdlib/transcript/transcript.hpp" -#include "barretenberg/stdlib_circuit_builders/public_component_key.hpp" #include "barretenberg/transcript/transcript.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra_flavor.hpp index b52a7ae0b250..ccd61a43bc54 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra_flavor.hpp @@ -13,7 +13,6 @@ #include "barretenberg/flavor/repeated_commitments_data.hpp" #include "barretenberg/honk/library/grand_product_delta.hpp" #include "barretenberg/honk/library/grand_product_library.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra_rollup_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra_rollup_flavor.hpp index 84636ac4246a..226fc251dda7 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra_rollup_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra_rollup_flavor.hpp @@ -7,6 +7,7 @@ #pragma once #include "barretenberg/commitment_schemes/ipa/ipa.hpp" #include "barretenberg/flavor/ultra_flavor.hpp" +#include "barretenberg/special_public_inputs/special_public_inputs.hpp" namespace bb { @@ -16,7 +17,7 @@ class UltraRollupFlavor : public bb::UltraFlavor { static constexpr size_t num_frs_fr = bb::field_conversion::calc_num_bn254_frs(); static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS = UltraFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS + IPA_PROOF_LENGTH; - static constexpr size_t BACKEND_PUB_INPUTS_SIZE = PAIRING_POINTS_SIZE + IPA_CLAIM_SIZE; + static constexpr size_t BACKEND_PUB_INPUTS_SIZE = RollupIO::PUBLIC_INPUTS_SIZE; using UltraFlavor::UltraFlavor; diff --git a/barretenberg/cpp/src/barretenberg/honk/types/aggregation_object_type.hpp b/barretenberg/cpp/src/barretenberg/honk/types/aggregation_object_type.hpp deleted file mode 100644 index b56318b2d851..000000000000 --- a/barretenberg/cpp/src/barretenberg/honk/types/aggregation_object_type.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// === AUDIT STATUS === -// internal: { status: not started, auditors: [], date: YYYY-MM-DD } -// external_1: { status: not started, auditors: [], date: YYYY-MM-DD } -// external_2: { status: not started, auditors: [], date: YYYY-MM-DD } -// ===================== - -#pragma once - -#include -#include - -namespace bb { -// An aggregation state is represented by two G1 affine elements. Each G1 point has -// two field element coordinates (x, y). Thus, four base field elements -// Four limbs are used when simulating a non-native field using the bigfield class, so 16 total field elements. -static constexpr uint32_t PAIRING_POINTS_SIZE = 16; - -static constexpr uint32_t IPA_CLAIM_SIZE = 10; // Size public inputs representaiton of a Grumpkin opening claim -} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/honk/types/public_inputs_type.hpp b/barretenberg/cpp/src/barretenberg/honk/types/public_inputs_type.hpp new file mode 100644 index 000000000000..a18c625e5da6 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/honk/types/public_inputs_type.hpp @@ -0,0 +1,70 @@ +#pragma once + +#include + +namespace bb { + +/** + * We collect the number of public inputs required to represent the various classes we use + * Note that these constants should not be imported directly. They should be fetched from the respective structures in + * the code. For example, instead of importing PAIRING_POINTS_SIZE, we should fetch this value from + * PairingPoints::PUBLIC_INPUTS_SIZE + */ + +// Number of bb::fr elements used to represent an element of bb::fr in the public inputs +static constexpr std::size_t FR_PUBLIC_INPUTS_SIZE = 1; + +// Number of bb::fr elements used to represent a bigfield element in the public inputs +static constexpr std::size_t BIGFIELD_PUBLIC_INPUTS_SIZE = 4; + +// Number of bb::fr elements used to represent a goblin bigfield element in the public inputs +static constexpr std::size_t GOBLIN_FIELD_PUBLIC_INPUTS_SIZE = 4; + +// Number of bb::fr elements used to represent a biggroup element in the public inputs +static constexpr std::size_t BIGGROUP_PUBLIC_INPUTS_SIZE = 2 * BIGFIELD_PUBLIC_INPUTS_SIZE; + +// Number of bb::fr elements used to represent a goblin biggroup element in the public inputs +static constexpr std::size_t GOBLIN_GROUP_PUBLIC_INPUTS_SIZE = 2 * GOBLIN_FIELD_PUBLIC_INPUTS_SIZE; + +/** + * Number of bb::fr elements used to represent a pair {P0, P1} of points in the public inputs + * The formula assumes BIGGROUP_PUBLIC_INPUTS_SIZE == GOBLIN_GROUP_PUBLIC_INPUTS_SIZE, if this assumption + * becomes incorrect, then the PAIRING_POINTS_SIZE should be split into two values: one for the pairing points used in + * ClientIVC (Mega arithmetization), and one for the pairing points used in the Rollup (Ultra arithmetization) + */ +static constexpr std::size_t PAIRING_POINTS_SIZE = 2 * GOBLIN_GROUP_PUBLIC_INPUTS_SIZE; + +// Number of bb::fr elements used to represent a opening claim (C, (r, p(r))) over Grumpkin +// Formula is: a point on Grumpkin (2 * FR_PUBLIC_INPUTS_SIZE) and two points on bb::fq (2 * +// BIGFIELD_PUBLIC_INPUTS_SIZE) +static constexpr std::size_t GRUMPKIN_OPENING_CLAIM_SIZE = 2 * FR_PUBLIC_INPUTS_SIZE + 2 * BIGFIELD_PUBLIC_INPUTS_SIZE; + +// Invalid public input size, used in OpeningClaim when Curve is not Grumpkin +static constexpr std::size_t INVALID_PUBLIC_INPUTS_SIZE = 0; + +// Number of wires in the Mega execution trace, they must be re-defined to avoid circular dependencies +static constexpr std::size_t MEGA_EXECUTION_TRACE_NUM_WIRES = 4; + +// Number of bb::fr elements used to represent the public inputs of an INIT/INNER/RESET/TAIL kernel +static constexpr std::size_t KERNEL_PUBLIC_INPUTS_SIZE = + /*pairing_inputs*/ PAIRING_POINTS_SIZE + + /*kernel_return_data*/ GOBLIN_GROUP_PUBLIC_INPUTS_SIZE + + /*app_return_data*/ GOBLIN_GROUP_PUBLIC_INPUTS_SIZE + + /*table_commitments*/ MEGA_EXECUTION_TRACE_NUM_WIRES * GOBLIN_GROUP_PUBLIC_INPUTS_SIZE; + +// Number of bb::fr elements used to represent the default public inputs, i.e., the pairing points +static constexpr std::size_t DEFAULT_PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE; + +// Number of bb::fr elements used to represent the public inputs of an App circuit +static constexpr std::size_t APP_PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE; + +// Number of bb::fr elements used to represent the public inputs of the HIDING kernel +static constexpr std::size_t HIDING_KERNEL_PUBLIC_INPUTS_SIZE = + /*pairing_inputs*/ PAIRING_POINTS_SIZE + + /*table_commitments*/ MEGA_EXECUTION_TRACE_NUM_WIRES * GOBLIN_GROUP_PUBLIC_INPUTS_SIZE; + +// Number of bb::fr elements used to represent the public inputs of a ROLLUP circuit +static constexpr std::size_t ROLLUP_PUBLIC_INPUTS_SIZE = + /*pairing_inputs*/ PAIRING_POINTS_SIZE + /*ipa_claim*/ GRUMPKIN_OPENING_CLAIM_SIZE; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/public_component_key.hpp b/barretenberg/cpp/src/barretenberg/public_input_component/public_component_key.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/public_component_key.hpp rename to barretenberg/cpp/src/barretenberg/public_input_component/public_component_key.hpp diff --git a/barretenberg/cpp/src/barretenberg/public_input_component/public_input_component.hpp b/barretenberg/cpp/src/barretenberg/public_input_component/public_input_component.hpp new file mode 100644 index 000000000000..3ee40f1293c0 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/public_input_component/public_input_component.hpp @@ -0,0 +1,63 @@ +// === AUDIT STATUS === +// internal: { status: not started, auditors: [], date: YYYY-MM-DD } +// external_1: { status: not started, auditors: [], date: YYYY-MM-DD } +// external_2: { status: not started, auditors: [], date: YYYY-MM-DD } +// ===================== + +#pragma once + +#include "barretenberg/common/assert.hpp" +#include "barretenberg/ecc/curves/bn254/fr.hpp" +#include "barretenberg/public_input_component/public_component_key.hpp" +#include +#include +namespace bb { + +/** + * @brief A concept defining requirements for types that are to be deserialized from the public inputs of a circuit + * via the PublicInputComponent class. + * + * @tparam ComponentType The type of the object to be deserialized + */ +template +concept IsDeserializableFromPublicInputs = + requires(std::span public_inputs) { + { // A method to reconstruct the object from the limbs stored in public inputs + ComponentType::reconstruct_from_public(public_inputs) + } -> std::same_as; + { // A constant defining the number of limbs needed to represent the object in the public inputs + ComponentType::PUBLIC_INPUTS_SIZE + } -> std::convertible_to; + }; + +/** + * @brief A wrapper class for deserializing objects from the public inputs of a circuit + * + * @tparam ComponentType A type that satisfies the IsDeserializableFromPublicInputs concept + */ +template + requires IsDeserializableFromPublicInputs +class PublicInputComponent { + static constexpr uint32_t COMPONENT_SIZE = ComponentType::PUBLIC_INPUTS_SIZE; + + public: + using Key = PublicComponentKey; + + // Reconstruct the component from the public inputs and the key indicating its location + static ComponentType reconstruct(const std::vector& public_inputs, const Key& key) + { + // Ensure that the key has been set + if (!key.is_set()) { + throw_or_abort("ERROR: Trying to construct a PublicInputComponent from an invalid key!"); + } + + // Use the provided key to extract the limbs of the component from the public inputs then reconstruct it + BB_ASSERT_LTE(key.start_idx + COMPONENT_SIZE, + public_inputs.size(), + "PublicInputComponent cannot be reconstructed - PublicInputComponentKey start_idx out of bounds"); + std::span limbs{ public_inputs.data() + key.start_idx, COMPONENT_SIZE }; + return ComponentType::reconstruct_from_public(limbs); + } +}; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/special_public_inputs/special_public_inputs.hpp b/barretenberg/cpp/src/barretenberg/special_public_inputs/special_public_inputs.hpp index c5a8dd4a8394..948c85d9619f 100644 --- a/barretenberg/cpp/src/barretenberg/special_public_inputs/special_public_inputs.hpp +++ b/barretenberg/cpp/src/barretenberg/special_public_inputs/special_public_inputs.hpp @@ -8,6 +8,7 @@ #include "barretenberg/commitment_schemes/claim.hpp" #include "barretenberg/commitment_schemes/pairing_points.hpp" +#include "barretenberg/public_input_component/public_input_component.hpp" namespace bb { @@ -18,10 +19,9 @@ namespace bb { class DefaultIO { public: using FF = curve::BN254::ScalarField; + using PublicPairingPoints = PublicInputComponent; - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1478): Can we define this constant as part of - // PairingPoints (cascading it down from Fq)? - static constexpr size_t PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE; + static constexpr size_t PUBLIC_INPUTS_SIZE = DEFAULT_PUBLIC_INPUTS_SIZE; PairingPoints pairing_inputs; @@ -35,9 +35,7 @@ class DefaultIO { // Assumes that the app-io public inputs are at the end of the public_inputs vector uint32_t index = static_cast(public_inputs.size() - PUBLIC_INPUTS_SIZE); - const std::span pairing_point_limbs(public_inputs.data() + index, - PAIRING_POINTS_SIZE); - pairing_inputs = PairingPoints::reconstruct_from_public(pairing_point_limbs); + pairing_inputs = PublicPairingPoints::reconstruct(public_inputs, PublicComponentKey{ index }); } }; @@ -48,18 +46,15 @@ class HidingKernelIO { public: using FF = curve::BN254::ScalarField; using G1 = curve::BN254::AffineElement; + using TableCommitments = std::array; - // Number of columns that jointly constitute the op_queue, should be the same as the number of wires in the - // MegaCircuitBuilder - static constexpr size_t NUM_WIRES = 4; + using PublicPairingPoints = PublicInputComponent; + using PublicPoint = PublicInputComponent; - // Number of bb::fr field elements used to represent a goblin element in the public inputs - // The element is of goblin type because the HidingKernel is always employed with a MegaBuilder - static constexpr size_t G1_PUBLIC_INPUTS_SIZE = FQ_PUBLIC_INPUT_SIZE * 2; - static constexpr size_t PUBLIC_INPUTS_SIZE = NUM_WIRES * G1_PUBLIC_INPUTS_SIZE + PAIRING_POINTS_SIZE; + static constexpr size_t PUBLIC_INPUTS_SIZE = HIDING_KERNEL_PUBLIC_INPUTS_SIZE; PairingPoints pairing_inputs; - std::array ecc_op_tables; + TableCommitments ecc_op_tables; /** * @brief Reconstructs the IO components from a public inputs array. @@ -71,16 +66,11 @@ class HidingKernelIO { // Assumes that the hiding-kernel-io public inputs are at the end of the public_inputs vector uint32_t index = static_cast(public_inputs.size() - PUBLIC_INPUTS_SIZE); - const std::span pairing_inputs_limbs(public_inputs.data() + index, - PAIRING_POINTS_SIZE); - index += PAIRING_POINTS_SIZE; - pairing_inputs = PairingPoints::reconstruct_from_public(pairing_inputs_limbs); - + pairing_inputs = PublicPairingPoints::reconstruct(public_inputs, PublicComponentKey{ index }); + index += PairingPoints::PUBLIC_INPUTS_SIZE; for (auto& commitment : ecc_op_tables) { - const std::span ecc_op_table_limbs(public_inputs.data() + index, - G1_PUBLIC_INPUTS_SIZE); - commitment = G1::reconstruct_from_public(ecc_op_table_limbs); - index += G1_PUBLIC_INPUTS_SIZE; + commitment = PublicPoint::reconstruct(public_inputs, { index }); + index += G1::PUBLIC_INPUTS_SIZE; } } }; @@ -93,7 +83,10 @@ class RollupIO { using FF = curve::BN254::ScalarField; using IpaClaim = OpeningClaim; - static constexpr size_t PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE + IPA_CLAIM_SIZE; + using PublicPairingPoints = PublicInputComponent; + using PublicIpaClaim = PublicInputComponent; + + static constexpr size_t PUBLIC_INPUTS_SIZE = ROLLUP_PUBLIC_INPUTS_SIZE; PairingPoints pairing_inputs; IpaClaim ipa_claim; @@ -108,13 +101,9 @@ class RollupIO { // Assumes that the app-io public inputs are at the end of the public_inputs vector uint32_t index = static_cast(public_inputs.size() - PUBLIC_INPUTS_SIZE); - const std::span pairing_inputs_limbs(public_inputs.data() + index, - PAIRING_POINTS_SIZE); - index += PAIRING_POINTS_SIZE; - const std::span ipa_claim_limbs(public_inputs.data() + index, IPA_CLAIM_SIZE); - - pairing_inputs = PairingPoints::reconstruct_from_public(pairing_inputs_limbs); - ipa_claim = IpaClaim::reconstruct_from_public(ipa_claim_limbs); + pairing_inputs = PublicPairingPoints::reconstruct(public_inputs, PublicComponentKey{ index }); + index += PairingPoints::PUBLIC_INPUTS_SIZE; + ipa_claim = PublicIpaClaim::reconstruct(public_inputs, PublicComponentKey{ index }); } }; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/pairing_points.hpp b/barretenberg/cpp/src/barretenberg/stdlib/pairing_points.hpp index 9bc6042f744d..4435c3add2db 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/pairing_points.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/pairing_points.hpp @@ -7,7 +7,6 @@ #pragma once #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/common/assert.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/transcript/transcript.hpp" @@ -33,7 +32,7 @@ template struct PairingPoints { bool has_data = false; // Number of bb::fr field elements used to represent a goblin element in the public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = Group::PUBLIC_INPUTS_SIZE * 2; + static constexpr size_t PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE; PairingPoints() = default; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp index 2506b7c40ae2..f11ca4a36af5 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp @@ -28,7 +28,7 @@ template class bigfield { using field_ct = field_t; // Number of bb::fr field elements used to represent a bigfield element in the public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = 4; + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGFIELD_PUBLIC_INPUTS_SIZE; struct Basis { uint512_t modulus; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp index 631e6e4842c4..a22b2561e9ff 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp @@ -29,7 +29,7 @@ template class element { using BaseField = Fq; // Number of bb::fr field elements used to represent a goblin element in the public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = Fq::PUBLIC_INPUTS_SIZE * 2; + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGGROUP_PUBLIC_INPUTS_SIZE; struct secp256k1_wnaf { std::vector> wnaf; field_t positive_skew; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp index 6b8142ebad00..4cea1c64061e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.hpp @@ -43,7 +43,7 @@ template class goblin_el using biggroup_tag = goblin_element; // Facilitates a constexpr check IsBigGroup // Number of bb::fr field elements used to represent a goblin element in the public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = Fq::PUBLIC_INPUTS_SIZE * 2; + static constexpr size_t PUBLIC_INPUTS_SIZE = BIGGROUP_PUBLIC_INPUTS_SIZE; goblin_element() = default; goblin_element(const typename NativeGroup::affine_element& input) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/public_input_component/public_input_component.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/public_input_component/public_input_component.test.cpp index 6d1c889ba656..7014ffd77a98 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/public_input_component/public_input_component.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/public_input_component/public_input_component.test.cpp @@ -3,9 +3,10 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/numeric/random/engine.hpp" +#include "barretenberg/public_input_component/public_input_component.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" +#include "barretenberg/stdlib/primitives/public_input_component/public_input_component.hpp" #include "barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp" -#include "public_input_component.hpp" using namespace bb; @@ -17,7 +18,7 @@ auto& engine = bb::numeric::get_debug_randomness(); * @brief A test demonstrating the functionality set and reconstruct methods on a GolbinBigGroup object * */ -TEST(PublicInputsTest, GoblinBigGroup) +TEST(PublicInputComponentTest, GoblinBigGroup) { using Builder = MegaCircuitBuilder; using Curve = stdlib::bn254; @@ -26,6 +27,7 @@ TEST(PublicInputsTest, GoblinBigGroup) using AffineElementNative = Curve::GroupNative::affine_element; using FrNative = Curve::ScalarFieldNative; using PublicPoint = stdlib::PublicInputComponent; + using PublicPointNative = bb::PublicInputComponent; AffineElementNative point_value = AffineElementNative::random_element(); @@ -73,4 +75,13 @@ TEST(PublicInputsTest, GoblinBigGroup) // Ensure the reconstructed point matches the original point EXPECT_EQ(point_value, reconstructed_point.get_value()); } + + // Reconstruct from native public inputs + { + // Reconstruct the point from the native public inputs and the public component key + AffineElementNative reconstructed_point = PublicPointNative::reconstruct(public_inputs, public_point_key); + + // Ensure the reconstructed point matches the original point + EXPECT_EQ(point_value, reconstructed_point); + } } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp b/barretenberg/cpp/src/barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp index 11896150da1c..5bcbad0fcda4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp @@ -46,8 +46,7 @@ class KernelIO { // FF pg_acc_hash; // Total size of the kernel IO public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = PairingInputs::PUBLIC_INPUTS_SIZE + G1::PUBLIC_INPUTS_SIZE + - G1::PUBLIC_INPUTS_SIZE + Builder::NUM_WIRES * G1::PUBLIC_INPUTS_SIZE; + static constexpr size_t PUBLIC_INPUTS_SIZE = KERNEL_PUBLIC_INPUTS_SIZE; /** * @brief Reconstructs the IO components from a public inputs array. @@ -126,7 +125,7 @@ template class DefaultIO { PairingInputs pairing_inputs; // Total size of the IO public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = PairingInputs::PUBLIC_INPUTS_SIZE; + static constexpr size_t PUBLIC_INPUTS_SIZE = DEFAULT_PUBLIC_INPUTS_SIZE; /** * @brief Reconstructs the IO components from a public inputs array. @@ -184,8 +183,7 @@ template class HidingKernelIO { TableCommitments ecc_op_tables; // commitments to merged tables obtained from final Merge verification // Total size of the IO public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = - PairingInputs::PUBLIC_INPUTS_SIZE + Builder::NUM_WIRES * G1::PUBLIC_INPUTS_SIZE; + static constexpr size_t PUBLIC_INPUTS_SIZE = HIDING_KERNEL_PUBLIC_INPUTS_SIZE; /** * @brief Reconstructs the IO components from a public inputs array. @@ -282,7 +280,7 @@ class RollupIO { IpaClaim ipa_claim; // Total size of the IO public inputs - static constexpr size_t PUBLIC_INPUTS_SIZE = PairingInputs::PUBLIC_INPUTS_SIZE + IpaClaim::PUBLIC_INPUTS_SIZE; + static constexpr size_t PUBLIC_INPUTS_SIZE = ROLLUP_PUBLIC_INPUTS_SIZE; /** * @brief Reconstructs the IO components from a public inputs array. diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp index ff3c085de106..e2389d0e27f9 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp @@ -10,9 +10,8 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/honk/execution_trace/gate_data.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" +#include "barretenberg/public_input_component/public_component_key.hpp" #include "barretenberg/serialize/msgpack.hpp" -#include "barretenberg/stdlib_circuit_builders/public_component_key.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp index ea3af42175b3..d44156e8fba5 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp @@ -8,8 +8,7 @@ #include "barretenberg/common/assert.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" -#include "barretenberg/stdlib_circuit_builders/public_component_key.hpp" +#include "barretenberg/public_input_component/public_component_key.hpp" #include namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/mega_honk.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/mega_honk.test.cpp index a47d70e5564e..de5d498fd540 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/mega_honk.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/mega_honk.test.cpp @@ -6,7 +6,6 @@ #include "barretenberg/common/log.hpp" #include "barretenberg/goblin/mock_circuits.hpp" #include "barretenberg/honk/relation_checker.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp" #include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "barretenberg/ultra_honk/merge_prover.hpp" @@ -111,16 +110,18 @@ TYPED_TEST_SUITE(MegaHonkTests, FlavorTypes); TYPED_TEST(MegaHonkTests, ProofLengthCheck) { using Flavor = TypeParam; + using Builder = Flavor::CircuitBuilder; + using DefaultIO = stdlib::recursion::honk::DefaultIO; - auto builder = typename Flavor::CircuitBuilder{}; - stdlib::recursion::PairingPoints::add_default_to_public_inputs(builder); + auto builder = Builder{}; + DefaultIO::add_default(builder); // Construct a mega proof and ensure its size matches expectation; if not, the constant may need to be updated auto proving_key = std::make_shared>(builder); auto verification_key = std::make_shared(proving_key->get_precomputed()); UltraProver_ prover(proving_key, verification_key); HonkProof mega_proof = prover.construct_proof(); - EXPECT_EQ(mega_proof.size(), Flavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS + PAIRING_POINTS_SIZE); + EXPECT_EQ(mega_proof.size(), Flavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS + DefaultIO::PUBLIC_INPUTS_SIZE); } /** diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_honk.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_honk.test.cpp index bfe1b73edd8e..8636af086fa4 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_honk.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_honk.test.cpp @@ -3,12 +3,12 @@ #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/ultra_rollup_flavor.hpp" #include "barretenberg/honk/library/grand_product_delta.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/stdlib/pairing_points.hpp" #include "barretenberg/stdlib/primitives/curves/grumpkin.hpp" +#include "barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp" #include "barretenberg/stdlib_circuit_builders/mock_circuits.hpp" #include "barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.hpp" #include "barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp" @@ -102,19 +102,20 @@ TYPED_TEST_SUITE(UltraHonkTests, FlavorTypes); TYPED_TEST(UltraHonkTests, ProofLengthCheck) { using Flavor = TypeParam; + using Builder = Flavor::CircuitBuilder; + using IO = std::conditional_t, + stdlib::recursion::honk::RollupIO, + stdlib::recursion::honk::DefaultIO>; using Proof = typename Flavor::Transcript::Proof; - auto builder = typename Flavor::CircuitBuilder{}; - TestFixture::set_default_pairing_points_and_ipa_claim_and_proof(builder); + auto builder = Builder{}; + IO::add_default(builder); // Construct a UH proof and ensure its size matches expectation; if not, the constant may need to be updated auto proving_key = std::make_shared>(builder); auto verification_key = std::make_shared(proving_key->get_precomputed()); UltraProver_ prover(proving_key, verification_key); Proof ultra_proof = prover.construct_proof(); - size_t expected_proof_length = Flavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS + PAIRING_POINTS_SIZE; - if (HasIPAAccumulator) { - expected_proof_length += IPA_CLAIM_SIZE; - } + size_t expected_proof_length = Flavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS + IO::PUBLIC_INPUTS_SIZE; EXPECT_EQ(ultra_proof.size(), expected_proof_length); } diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp index e4b78d0dc37a..00af7a683899 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp @@ -67,15 +67,12 @@ template class UltraTranscriptTests : public ::testing::Test { manifest_expected.add_entry(round, "vk_hash", frs_per_Fr); manifest_expected.add_entry(round, "public_input_0", frs_per_Fr); - for (size_t i = 0; i < PAIRING_POINTS_SIZE; i++) { + constexpr size_t PUBLIC_INPUTS_SIZE = + HasIPAAccumulator ? RollupIO::PUBLIC_INPUTS_SIZE : DefaultIO::PUBLIC_INPUTS_SIZE; + for (size_t i = 0; i < PUBLIC_INPUTS_SIZE; i++) { manifest_expected.add_entry(round, "public_input_" + std::to_string(1 + i), frs_per_Fr); } - if constexpr (HasIPAAccumulator) { - for (size_t i = 0; i < IPA_CLAIM_SIZE; i++) { - manifest_expected.add_entry( - round, "public_input_" + std::to_string(1 + PAIRING_POINTS_SIZE + i), frs_per_Fr); - } - } + manifest_expected.add_entry(round, "W_L", frs_per_G); manifest_expected.add_entry(round, "W_R", frs_per_G); manifest_expected.add_entry(round, "W_O", frs_per_G); diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.cpp index ada5fcd1cdef..92cc48385808 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.cpp @@ -6,7 +6,6 @@ #include "barretenberg/commitment_schemes/shplonk/shplemini.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" -#include "barretenberg/honk/types/aggregation_object_type.hpp" #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/polynomials/shared_shifted_virtual_zeroes_array.hpp" #include "barretenberg/stdlib/primitives/bool/bool.hpp"