From 779f3c22bf3ec438b6872733dc0e6ae209dbb832 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Wed, 16 Aug 2023 23:12:46 +0000 Subject: [PATCH] comments and cleanup --- .../barretenberg/ecc/curves/bn254/bn254.hpp | 3 ++ .../ecc/curves/grumpkin/grumpkin.hpp | 3 ++ .../honk/flavor/ultra_recursive.hpp | 20 +++++---- .../barretenberg/honk/pcs/gemini/gemini.hpp | 6 +-- .../barretenberg/honk/pcs/shplonk/shplonk.hpp | 43 +++++++------------ .../honk/proof_system/ultra_verifier.cpp | 16 +++---- .../honk/proof_system/ultra_verifier.hpp | 5 +-- .../sumcheck/polynomials/barycentric_data.hpp | 43 +++++++++---------- .../polynomials/barycentric_data.test.cpp | 3 +- .../honk/sumcheck/polynomials/pow.hpp | 3 +- .../relations/relation_parameters.hpp | 1 - .../honk/sumcheck/sumcheck_round.hpp | 2 +- .../stdlib/primitives/curves/bn254.hpp | 3 ++ .../{trancript.hpp => transcript.hpp} | 0 .../honk/transcript/transcript.test.cpp | 4 +- .../verifier/ultra_recursive_verifier.cpp | 9 ++-- .../verifier/ultra_recursive_verifier.hpp | 2 +- 17 files changed, 81 insertions(+), 85 deletions(-) rename circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/{trancript.hpp => transcript.hpp} (100%) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/bn254.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/bn254.hpp index e5df58ce3505..dadc92964b04 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/bn254.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/bn254.hpp @@ -18,6 +18,9 @@ class BN254 { using G2BaseField = typename barretenberg::fq2; using TargetField = barretenberg::fq12; + // TODO(#673): This flag is temporary. It is needed in the verifier classes (GeminiVerifier, etc.) while these + // classes are instantiated with "native" curve types. Eventually, the verifier classes will be instantiated only + // with stdlib types, and "native" verification will be acheived via a simulated builder. static constexpr bool is_stdlib_type = false; }; } // namespace curve \ No newline at end of file diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp index 881af2620dc2..9d654ec56952 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/ecc/curves/grumpkin/grumpkin.hpp @@ -43,6 +43,9 @@ class Grumpkin { using Element = typename Group::element; using AffineElement = typename Group::affine_element; + // TODO(#673): This flag is temporary. It is needed in the verifier classes (GeminiVerifier, etc.) while these + // classes are instantiated with "native" curve types. Eventually, the verifier classes will be instantiated only + // with stdlib types, and "native" verification will be acheived via a simulated builder. static constexpr bool is_stdlib_type = false; }; } // namespace curve \ No newline at end of file diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/ultra_recursive.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/ultra_recursive.hpp index b6962f108d9a..47c306df8408 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/ultra_recursive.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/ultra_recursive.hpp @@ -32,16 +32,14 @@ class UltraRecursive { public: using CircuitBuilder = UltraCircuitBuilder; using Curve = plonk::stdlib::bn254; - using FF = Curve::ScalarField; + using PCS = pcs::kzg::KZG; using GroupElement = Curve::Element; using Commitment = Curve::Element; using CommitmentHandle = Curve::Element; + using FF = Curve::ScalarField; - // WORKTODO: these. do we need them? - using CommitmentKey = pcs::CommitmentKey; + // Note(luke): Eventually this may not be needed at all using VerifierCommitmentKey = pcs::VerifierCommitmentKey; - - using PCS = pcs::kzg::KZG; static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES; // The number of multivariate polynomials on which a sumcheck prover sumcheck operates (including shifts). We often @@ -255,11 +253,17 @@ class UltraRecursive { * that, and split out separate PrecomputedPolynomials/Commitments data for clarity but also for portability of our * circuits. */ - class VerificationKey : public VerificationKey_> - { + class VerificationKey : public VerificationKey_> { public: + /** + * @brief Construct a new Verification Key with stdlib types from a provided native verification key + * + * @param builder + * @param native_key Native verification key from which to extract the precomputed commitments + */ VerificationKey(CircuitBuilder* builder, auto native_key) - : VerificationKey_>(native_key->circuit_size, native_key->num_public_inputs) + : VerificationKey_>(native_key->circuit_size, + native_key->num_public_inputs) { q_m = Commitment::from_witness(builder, native_key->q_m); q_l = Commitment::from_witness(builder, native_key->q_l); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp index 27a49973990c..1fdbeb06353f 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp @@ -237,10 +237,10 @@ template class GeminiVerifier_ { GroupElement C0_r_neg = batched_f; Fr r_inv = r.invert(); - // WORKTODO: reinstate some kind of !batched_g.is_point_at_infinity() check for stdlib? This is mostly relevant - // for Gemini unit tests since in practice batched_g will not be zero + // TODO(luke): reinstate some kind of !batched_g.is_point_at_infinity() check for stdlib types? This is mostly + // relevant for Gemini unit tests since in practice batched_g != zero (i.e. we will always have shifted polys). bool batched_g_is_point_at_infinity = false; - if constexpr (!Curve::is_stdlib_type) { + if constexpr (!Curve::is_stdlib_type) { // Note: required for Gemini tests with no shifts batched_g_is_point_at_infinity = batched_g.is_point_at_infinity(); } if (!batched_g_is_point_at_infinity) { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp index 9668997bb4c6..428bacd068e5 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp @@ -1,8 +1,8 @@ #pragma once #include "barretenberg/honk/pcs/claim.hpp" -#include "barretenberg/honk/transcript/transcript.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/honk/pcs/verification_key.hpp" +#include "barretenberg/honk/transcript/transcript.hpp" /** * @brief Reduces multiple claims about commitments, each opened at a single point @@ -162,21 +162,14 @@ template class ShplonkVerifier_ { * @return OpeningClaim */ static OpeningClaim reduce_verification(std::shared_ptr vk, - std::span> claims, - auto& transcript) + std::span> claims, + auto& transcript) { const size_t num_claims = claims.size(); const Fr nu = transcript.get_challenge("Shplonk:nu"); - size_t prev_num_gates = 0; - (void)prev_num_gates; - if constexpr (Curve::is_stdlib_type) { - // info("Shplonk, init: num gates = ", nu.get_context().get_num_gates()); - prev_num_gates = nu.get_context()->get_num_gates(); - } - auto Q_commitment = transcript.template receive_from_prover("Shplonk:Q"); const Fr z_challenge = transcript.get_challenge("Shplonk:z"); @@ -211,7 +204,8 @@ template class ShplonkVerifier_ { } auto current_nu = Fr(1); - std::vector commitments; // used in recursion setting only + // Note: commitments and scalars vectors used only in recursion setting for batch mul + std::vector commitments; std::vector scalars; for (size_t j = 0; j < num_claims; ++j) { // (Cⱼ, xⱼ, vⱼ) @@ -222,7 +216,7 @@ template class ShplonkVerifier_ { // G₀ += ρʲ / ( r − xⱼ ) ⋅ vⱼ G_commitment_constant += scaling_factor * opening_pair.evaluation; - // If recursion, store MSM inputs for batch mul, otherwise perform mul and add directly + // If recursion, store MSM inputs for batch mul, otherwise accumulate directly if constexpr (Curve::is_stdlib_type) { commitments.emplace_back(commitment); scalars.emplace_back(scaling_factor); @@ -236,33 +230,26 @@ template class ShplonkVerifier_ { // If recursion, do batch mul to compute [G] -= ∑ⱼ ρʲ / ( r − xⱼ )⋅[fⱼ] if constexpr (Curve::is_stdlib_type) { - info("Shplonk: inversions, adds: num gates = ", nu.get_context()->get_num_gates() - prev_num_gates); - prev_num_gates = nu.get_context()->get_num_gates(); G_commitment -= GroupElement::batch_mul(commitments, scalars); - info("Shplonk: batch mul: num gates = ", nu.get_context()->get_num_gates() - prev_num_gates); - prev_num_gates = nu.get_context()->get_num_gates(); } // [G] += G₀⋅[1] = [G] + (∑ⱼ ρʲ ⋅ vⱼ / ( r − xⱼ ))⋅[1] + Fr evaluation_zero; // 0 \in Fr + GroupElement group_one; // [1] if constexpr (Curve::is_stdlib_type) { - auto ctx = nu.get_context(); - G_commitment += GroupElement::one(ctx) * G_commitment_constant; - info("Shplonk: final mul add: num gates = ", nu.get_context()->get_num_gates() - prev_num_gates); + auto ctx = transcript.builder; + evaluation_zero = Fr::from_witness(ctx, 0); + group_one = GroupElement::one(ctx); } else { // GroupElement sort_of_one{ x, y }; - G_commitment += vk->srs->get_first_g1() * G_commitment_constant; + evaluation_zero = Fr(0); + group_one = vk->srs->get_first_g1(); } - Fr zero_evaluation; - if constexpr (Curve::is_stdlib_type) { - auto ctx = transcript.builder; - zero_evaluation = Fr::from_witness(ctx, 0); - } else { - zero_evaluation = Fr(0); - } + G_commitment += group_one * G_commitment_constant; // Return opening pair (z, 0) and commitment [G] - return { { z_challenge, zero_evaluation }, G_commitment }; + return { { z_challenge, evaluation_zero }, G_commitment }; }; }; } // namespace proof_system::honk::pcs::shplonk diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.cpp index 55bf0ad384cb..565df400d8f8 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.cpp @@ -14,12 +14,12 @@ UltraVerifier_::UltraVerifier_(std::shared_ptr -UltraVerifier_::UltraVerifier_(UltraVerifier_&& other) noexcept +UltraVerifier_::UltraVerifier_(UltraVerifier_&& other) : key(std::move(other.key)) , pcs_verification_key(std::move(other.pcs_verification_key)) {} -template UltraVerifier_& UltraVerifier_::operator=(UltraVerifier_&& other) noexcept +template UltraVerifier_& UltraVerifier_::operator=(UltraVerifier_&& other) { key = other.key; pcs_verification_key = (std::move(other.pcs_verification_key)); @@ -119,7 +119,7 @@ template bool UltraVerifier_::verify_proof(const plonk if (!sumcheck_output.has_value()) { return false; } - + auto [multivariate_challenge, purported_evaluations] = *sumcheck_output; // Execute Gemini/Shplonk verification: @@ -145,7 +145,7 @@ template bool UltraVerifier_::verify_proof(const plonk // Construct batched commitment for NON-shifted polynomials size_t commitment_idx = 0; for (auto& commitment : commitments.get_unshifted()) { - batched_commitment_unshifted += commitment * rhos[commitment_idx]; + batched_commitment_unshifted += commitment * rhos[commitment_idx]; ++commitment_idx; } @@ -159,10 +159,10 @@ template bool UltraVerifier_::verify_proof(const plonk // - d+1 commitments [Fold_{r}^(0)], [Fold_{-r}^(0)], and [Fold^(l)], l = 1:d-1 // - d+1 evaluations a_0_pos, and a_l, l = 0:d-1 auto gemini_claim = Gemini::reduce_verification(multivariate_challenge, - batched_evaluation, - batched_commitment_unshifted, - batched_commitment_to_be_shifted, - transcript); + batched_evaluation, + batched_commitment_unshifted, + batched_commitment_to_be_shifted, + transcript); // Produce a Shplonk claim: commitment [Q] - [Q_z], evaluation zero (at random challenge z) auto shplonk_claim = Shplonk::reduce_verification(pcs_verification_key, gemini_claim, transcript); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.hpp index 3468d9e1bc21..0f290f943abf 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/ultra_verifier.hpp @@ -2,7 +2,6 @@ #include "barretenberg/honk/flavor/goblin_ultra.hpp" #include "barretenberg/honk/flavor/ultra.hpp" #include "barretenberg/honk/flavor/ultra_grumpkin.hpp" -#include "barretenberg/honk/flavor/ultra_recursive.hpp" #include "barretenberg/honk/sumcheck/sumcheck.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" @@ -15,10 +14,10 @@ template class UltraVerifier_ { public: explicit UltraVerifier_(std::shared_ptr verifier_key = nullptr); - UltraVerifier_(UltraVerifier_&& other) noexcept; + UltraVerifier_(UltraVerifier_&& other); UltraVerifier_(const UltraVerifier_& other) = delete; UltraVerifier_& operator=(const UltraVerifier_& other) = delete; - UltraVerifier_& operator=(UltraVerifier_&& other) noexcept; + UltraVerifier_& operator=(UltraVerifier_&& other); bool verify_proof(const plonk::proof& proof); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp index 3629a06c5a7c..ce1d458b0935 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp @@ -3,6 +3,12 @@ #include #include +// TODO(#674): We need the functionality of BarycentricData for both field and field_t. The former is "literal" i.e. is +// compatible with constexpr operations, and the former is not. The functions for computing the pre-computable arrays in +// BarycentricData need to be constexpr and it takes some trickery to share these functions with the non-constexpr +// setting. Right now everything is more or less duplicated across BarycentricDataCompileTime and +// BarycentricDataRunTime. There should be a way to share more of the logic. + /* IMPROVEMENT(Cody): This could or should be improved in various ways. In no particular order: 1) Edge cases are not considered. One non-use case situation (I forget which) leads to a segfault. @@ -229,8 +235,7 @@ template class BarycentricDataR return result; } - static std::array batch_invert( - const std::array& coeffs) + static std::array batch_invert(const std::array& coeffs) { constexpr size_t n = domain_size * num_evals; std::array temporaries{}; @@ -260,8 +265,8 @@ template class BarycentricDataR // for each x_k in the big domain, build set of domain size-many denominator inverses // 1/(d_i*(x_k - x_j)). will multiply against each of these (rather than to divide by something) // for each barycentric evaluation - static std::array construct_denominator_inverses( - const auto& big_domain, const auto& lagrange_denominators) + static std::array construct_denominator_inverses(const auto& big_domain, + const auto& lagrange_denominators) { std::array result{}; // default init to 0 since below does not init all elements for (size_t k = domain_size; k < num_evals; ++k) { @@ -374,37 +379,31 @@ template class BarycentricDataR }; }; - /** * @brief Helper to determine whether input is bberg::field type - * - * @tparam T + * + * @tparam T */ -template -struct is_field_type { +template struct is_field_type { static constexpr bool value = false; }; -template -struct is_field_type> { +template struct is_field_type> { static constexpr bool value = true; }; -template -inline constexpr bool is_field_type_v = is_field_type::value; +template inline constexpr bool is_field_type_v = is_field_type::value; /** - * @brief Exposes BarycentricData with compile time arrays if the type is bberg::field and runtime arrays otherwise + * @brief Exposes BarycentricData with compile time arrays if the type is bberg::field and runtime arrays otherwise * @details This method is also needed for stdlib field, for which the arrays are not compile time computable - * @tparam Fr - * @tparam domain_size - * @tparam num_evals + * @tparam Fr + * @tparam domain_size + * @tparam num_evals */ template -using BarycentricData = std::conditional_t< - is_field_type_v, - BarycentricDataCompileTime, - BarycentricDataRunTime ->; +using BarycentricData = std::conditional_t, + BarycentricDataCompileTime, + BarycentricDataRunTime>; } // namespace proof_system::honk::sumcheck diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp index 00534117a650..68d3834f1e04 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp @@ -23,9 +23,8 @@ TYPED_TEST(BarycentricDataTests, CompileTimeComputation) BARYCENTIC_DATA_TESTS_TYPE_ALIASES const size_t domain_size(2); const size_t num_evals(10); - // if constexpr (std::is_literal_type_v) { + static_assert(BarycentricData::big_domain[5] == 5); - // } } TYPED_TEST(BarycentricDataTests, Extend) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp index eb9f27568dd6..dd84d7cebc89 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp @@ -122,7 +122,8 @@ template struct PowUnivariate { { FF current_univariate_eval = univariate_eval(challenge); zeta_pow = zeta_pow_sqr; - zeta_pow_sqr = zeta_pow_sqr.sqr(); // WORKTODO: used to be self_sqr + // TODO(luke): for native FF, this could be self_sqr() + zeta_pow_sqr = zeta_pow_sqr.sqr(); partial_evaluation_constant *= current_univariate_eval; } diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation_parameters.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation_parameters.hpp index 56125e48b0dd..a575a999a76b 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation_parameters.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation_parameters.hpp @@ -8,7 +8,6 @@ namespace proof_system::honk::sumcheck { * * @tparam FF */ -// WORKTODO: cant init via FF::zero() for stdlib. Do we need this? template struct RelationParameters { FF eta = FF(0); // Lookup FF beta = FF(0); // Permutation + Lookup diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp index b345756ecd99..4dc27e075f80 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp @@ -424,7 +424,7 @@ template class SumcheckVerifierRound { // S^{l}(1) = ( (1−1) + 1⋅ζ^{ 2^l } ) ⋅ T^{l}(1) = ζ^{ 2^l } ⋅ T^{l}(1) FF total_sum = univariate.value_at(0) + univariate.value_at(1); // target_total_sum = sigma_{l} = - // WORKTODO: perhaps conditionals like this go away once native verification is is just recursive verification + // TODO(#673): Conditionals like this can go away once native verification is is just recursive verification // with a simulated builder. bool sumcheck_round_failed(false); if constexpr (IsRecursiveFlavor) { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp index 28d720b9b2eb..27ed0920797f 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp @@ -9,6 +9,9 @@ namespace stdlib { template struct bn254 { static constexpr proof_system::CurveType type = proof_system::CurveType::BN254; + // TODO(#673): This flag is temporary. It is needed in the verifier classes (GeminiVerifier, etc.) while these + // classes are instantiated with "native" curve types. Eventually, the verifier classes will be instantiated only + // with stdlib types, and "native" verification will be acheived via a simulated builder. static constexpr bool is_stdlib_type = true; // Corresponding native types (used exclusively for testing) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/trancript.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp similarity index 100% rename from circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/trancript.hpp rename to circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp index 3491080b9659..f176d46fc66a 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp @@ -6,7 +6,7 @@ #include "barretenberg/honk/flavor/ultra_recursive.hpp" #include "barretenberg/honk/sumcheck/polynomials/univariate.hpp" #include "barretenberg/honk/transcript/transcript.hpp" -#include "barretenberg/stdlib/recursion/honk/transcript/trancript.hpp" +#include "barretenberg/stdlib/recursion/honk/transcript/transcript.hpp" namespace proof_system::plonk::stdlib::recursion::honk { @@ -111,7 +111,7 @@ TEST(RecursiveHonkTranscript, InterfacesMatch) Transcript transcript{ &builder, proof_data }; perform_mock_verifier_transcript_operations(transcript); - // Confirm that the native and stdlib transcripts have generated the same manifest + // Confirm that the native and stdlib verifier transcripts have generated the same manifest EXPECT_EQ(transcript.get_manifest(), native_transcript.get_manifest()); // TODO(luke): This doesn't check much of anything until hashing is constrained in the stdlib transcript diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp index 3e358801ec11..903c00052e83 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp @@ -6,9 +6,6 @@ #include "barretenberg/honk/utils/power_polynomial.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" -using namespace barretenberg; -using namespace proof_system::honk::sumcheck; - namespace proof_system::plonk::stdlib::recursion::honk { template UltraRecursiveVerifier_::UltraRecursiveVerifier_(Builder* builder, @@ -42,14 +39,16 @@ template std::array UltraRec using FF = typename Flavor::FF; using GroupElement = typename Flavor::GroupElement; using Commitment = typename Flavor::Commitment; + using Sumcheck = ::proof_system::honk::sumcheck::SumcheckVerifier; using Curve = typename Flavor::Curve; using Gemini = ::proof_system::honk::pcs::gemini::GeminiVerifier_; using Shplonk = ::proof_system::honk::pcs::shplonk::ShplonkVerifier_; using PCS = typename Flavor::PCS; // note: This can only be KZG using VerifierCommitments = typename Flavor::VerifierCommitments; using CommitmentLabels = typename Flavor::CommitmentLabels; + using RelationParams = ::proof_system::honk::sumcheck::RelationParameters; - RelationParameters relation_parameters; + RelationParams relation_parameters; size_t prev_num_gates = builder->get_num_gates(); @@ -121,7 +120,7 @@ template std::array UltraRec commitments.z_lookup = transcript.template receive_from_prover(commitment_labels.z_lookup); // Execute Sumcheck Verifier - auto sumcheck = SumcheckVerifier(circuit_size_native); + auto sumcheck = Sumcheck(circuit_size_native); std::optional sumcheck_output = sumcheck.verify(relation_parameters, transcript); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp index 35741a3ab472..a2e1e80f4888 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp @@ -5,7 +5,7 @@ #include "barretenberg/honk/flavor/ultra_recursive.hpp" #include "barretenberg/honk/sumcheck/sumcheck.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" -#include "barretenberg/stdlib/recursion/honk/transcript/trancript.hpp" +#include "barretenberg/stdlib/recursion/honk/transcript/transcript.hpp" namespace proof_system::plonk::stdlib::recursion::honk { template class UltraRecursiveVerifier_ {