diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/blake3s/c_bind.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/blake3s/c_bind.cpp index 0b0e996d423..f4455ce95ff 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/blake3s/c_bind.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/blake3s/c_bind.cpp @@ -1,5 +1,5 @@ -#include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/common/wasm_export.hpp" +#include "barretenberg/ecc/curves/bn254/fr.hpp" #include "blake3s.hpp" WASM_EXPORT void blake3s_to_field(uint8_t const* data, size_t length, uint8_t* r) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp index a70b4d9d775..516e50038c1 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp @@ -9,8 +9,8 @@ #include "barretenberg/crypto/hashers/hashers.hpp" #include "barretenberg/common/serialize.hpp" -#include "barretenberg/serialize/msgpack.hpp" #include "barretenberg/common/streams.hpp" +#include "barretenberg/serialize/msgpack.hpp" namespace crypto { namespace schnorr { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/sha256/c_bind.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/sha256/c_bind.cpp index c13acaca124..7221eaa8a88 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/sha256/c_bind.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/crypto/sha256/c_bind.cpp @@ -1,5 +1,5 @@ -#include "sha256.hpp" #include "barretenberg/common/wasm_export.hpp" +#include "sha256.hpp" WASM_EXPORT void sha256__hash(uint8_t* in, const size_t length, uint8_t* r) { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp index 2b428a35b10..3f9090ff961 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp @@ -88,9 +88,9 @@ void create_recursion_constraints(Builder& builder, for (size_t i = 0; i < 4; ++i) { aggregation_elements[i] = bn254::BaseField(field_ct::from_witness_index(&builder, aggregation_input[4 * i]), - field_ct::from_witness_index(&builder, aggregation_input[4 * i + 1]), - field_ct::from_witness_index(&builder, aggregation_input[4 * i + 2]), - field_ct::from_witness_index(&builder, aggregation_input[4 * i + 3])); + field_ct::from_witness_index(&builder, aggregation_input[4 * i + 1]), + field_ct::from_witness_index(&builder, aggregation_input[4 * i + 2]), + field_ct::from_witness_index(&builder, aggregation_input[4 * i + 3])); aggregation_elements[i].assert_is_in_field(); } // If we have a previous aggregation object, assign it to `previous_aggregation` so that it is included diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/standard_grumpkin.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/standard_grumpkin.hpp index 90adf4d5387..bf9ecbaadee 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/standard_grumpkin.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/flavor/standard_grumpkin.hpp @@ -33,7 +33,7 @@ class StandardGrumpkin { using PolynomialHandle = std::span; using CommitmentKey = pcs::CommitmentKey; using VerifierCommitmentKey = pcs::VerifierCommitmentKey; - + 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 // need containers of this size to hold related data, so we choose a name more agnostic than `NUM_POLYNOMIALS` diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp index 35a52e4970b..9daeeb70746 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp @@ -1,7 +1,7 @@ #pragma once -#include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" +#include "barretenberg/polynomials/polynomial.hpp" namespace proof_system::honk::pcs { /** diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp index 4e86c350df9..3f70e9d4789 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp @@ -46,7 +46,9 @@ template inline std::shared_ptr CreateCommitmentKey() template inline std::shared_ptr CreateVerifierCommitmentKey(); -template <> inline std::shared_ptr> CreateVerifierCommitmentKey>() +template <> +inline std::shared_ptr> CreateVerifierCommitmentKey< + VerifierCommitmentKey>() { constexpr size_t n = 4096; std::shared_ptr> crs_factory( @@ -55,7 +57,8 @@ template <> inline std::shared_ptr> CreateVe } // For IPA template <> -inline std::shared_ptr> CreateVerifierCommitmentKey>() +inline std::shared_ptr> CreateVerifierCommitmentKey< + VerifierCommitmentKey>() { constexpr size_t n = 4096; std::shared_ptr> crs_factory( diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.cpp index 3f5bf74fc5f..2a39a4cecba 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.cpp @@ -53,8 +53,10 @@ namespace proof_system::honk::pcs::gemini { * @return std::vector */ template -std::vector> GeminiProver_::compute_fold_polynomials( - std::span mle_opening_point, Polynomial&& batched_unshifted, Polynomial&& batched_to_be_shifted) +std::vector> GeminiProver_< + Curve>::compute_fold_polynomials(std::span mle_opening_point, + Polynomial&& batched_unshifted, + Polynomial&& batched_to_be_shifted) { const size_t num_variables = mle_opening_point.size(); // m @@ -141,9 +143,8 @@ std::vector> Gemi * @param r_challenge univariate opening challenge */ template -ProverOutput GeminiProver_::compute_fold_polynomial_evaluations(std::span mle_opening_point, - std::vector&& fold_polynomials, - const Fr& r_challenge) +ProverOutput GeminiProver_::compute_fold_polynomial_evaluations( + std::span mle_opening_point, std::vector&& fold_polynomials, const Fr& r_challenge) { const size_t num_variables = mle_opening_point.size(); // m @@ -186,7 +187,6 @@ ProverOutput GeminiProver_::compute_fold_polynomial_evaluations(st return { fold_poly_opening_pairs, std::move(fold_polynomials) }; }; - template class GeminiProver_; template class GeminiProver_; }; // namespace proof_system::honk::pcs::gemini diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp index b0e647a4802..c9208592271 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp @@ -86,10 +86,10 @@ template class GeminiTest : public CommitmentTest { // - 2 partially evaluated Fold polynomial commitments [Fold_{r}^(0)] and [Fold_{-r}^(0)] // Aggregate: d+1 opening pairs and d+1 Fold poly commitments into verifier claim auto verifier_claim = GeminiVerifier::reduce_verification(multilinear_evaluation_point, - batched_evaluation, - batched_commitment_unshifted, - batched_commitment_to_be_shifted, - verifier_transcript); + batched_evaluation, + batched_commitment_unshifted, + batched_commitment_to_be_shifted, + verifier_transcript); // Check equality of the opening pairs computed by prover and verifier for (size_t i = 0; i < (log_n + 1); ++i) { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp index 3e8959084c4..bd970ac5c1d 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp @@ -152,7 +152,8 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift) } const Fr nu_challenge = prover_transcript.get_challenge("Shplonk:nu"); - auto batched_quotient_Q = ShplonkProver::compute_batched_quotient(gemini_opening_pairs, gemini_witnesses, nu_challenge); + auto batched_quotient_Q = + ShplonkProver::compute_batched_quotient(gemini_opening_pairs, gemini_witnesses, nu_challenge); prover_transcript.send_to_verifier("Shplonk:Q", this->ck()->commit(batched_quotient_Q)); const Fr z_challenge = prover_transcript.get_challenge("Shplonk:z"); @@ -164,12 +165,13 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift) auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript); auto gemini_verifier_claim = GeminiVerifier::reduce_verification(mle_opening_point, - batched_evaluation, - batched_commitment_unshifted, - batched_commitment_to_be_shifted, - verifier_transcript); + batched_evaluation, + batched_commitment_unshifted, + batched_commitment_to_be_shifted, + verifier_transcript); - const auto shplonk_verifier_claim = ShplonkVerifier::reduce_verification(this->vk(), gemini_verifier_claim, verifier_transcript); + const auto shplonk_verifier_claim = + ShplonkVerifier::reduce_verification(this->vk(), gemini_verifier_claim, verifier_transcript); bool verified = IPA::verify(this->vk(), shplonk_verifier_claim, verifier_transcript); EXPECT_EQ(verified, true); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp index 1e7f5753659..cd14f401a29 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp @@ -140,7 +140,8 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift) // - opening pair: (z_challenge, 0) // - witness: polynomial Q - Q_z const Fr nu_challenge = prover_transcript.get_challenge("Shplonk:nu"); - auto batched_quotient_Q = ShplonkProver::compute_batched_quotient(gemini_opening_pairs, gemini_witnesses, nu_challenge); + auto batched_quotient_Q = + ShplonkProver::compute_batched_quotient(gemini_opening_pairs, gemini_witnesses, nu_challenge); prover_transcript.send_to_verifier("Shplonk:Q", this->ck()->commit(batched_quotient_Q)); const Fr z_challenge = prover_transcript.get_challenge("Shplonk:z"); @@ -158,13 +159,14 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift) // Gemini verifier output: // - claim: d+1 commitments to Fold_{r}^(0), Fold_{-r}^(0), Fold^(l), d+1 evaluations a_0_pos, a_l, l = 0:d-1 auto gemini_verifier_claim = GeminiVerifier::reduce_verification(mle_opening_point, - batched_evaluation, - batched_commitment_unshifted, - batched_commitment_to_be_shifted, - verifier_transcript); + batched_evaluation, + batched_commitment_unshifted, + batched_commitment_to_be_shifted, + verifier_transcript); // Shplonk verifier claim: commitment [Q] - [Q_z], opening point (z_challenge, 0) - const auto shplonk_verifier_claim = ShplonkVerifier::reduce_verification(this->vk(), gemini_verifier_claim, verifier_transcript); + const auto shplonk_verifier_claim = + ShplonkVerifier::reduce_verification(this->vk(), gemini_verifier_claim, verifier_transcript); // KZG verifier: // aggregates inputs [Q] - [Q_z] and [W] into an 'accumulator' (can perform pairing check on result) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp index b3307b2c240..01f0a6c5c65 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp @@ -52,8 +52,9 @@ TYPED_TEST(ShplonkTest, ShplonkSimple) prover_transcript.send_to_verifier("Shplonk:Q", this->ck()->commit(batched_quotient_Q)); const Fr z_challenge = prover_transcript.get_challenge("Shplonk:z"); - const auto [prover_opening_pair, shplonk_prover_witness] = ShplonkProver::compute_partially_evaluated_batched_quotient( - opening_pairs, polynomials, std::move(batched_quotient_Q), nu_challenge, z_challenge); + const auto [prover_opening_pair, shplonk_prover_witness] = + ShplonkProver::compute_partially_evaluated_batched_quotient( + opening_pairs, polynomials, std::move(batched_quotient_Q), nu_challenge, z_challenge); // An intermediate check to confirm the opening of the shplonk prover witness Q this->verify_opening_pair(prover_opening_pair, shplonk_prover_witness); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/verification_key.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/verification_key.hpp index 510799f41ec..8dc4492815e 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/verification_key.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/verification_key.hpp @@ -26,7 +26,7 @@ template class VerifierCommitmentKey; /** * @brief Specialization for bn254 - * + * * @tparam curve::BN254 */ template <> class VerifierCommitmentKey { @@ -44,7 +44,7 @@ template <> class VerifierCommitmentKey { * @param srs verifier G2 point */ VerifierCommitmentKey([[maybe_unused]] size_t num_points, - std::shared_ptr> crs_factory) + std::shared_ptr> crs_factory) : srs(crs_factory->get_verifier_crs()) {} @@ -70,7 +70,7 @@ template <> class VerifierCommitmentKey { /** * @brief Specialization for Grumpkin - * + * * @tparam curve::Grumpkin */ template <> class VerifierCommitmentKey { @@ -88,7 +88,8 @@ template <> class VerifierCommitmentKey { * @param num_points specifies the length of the SRS * @param path is the location to the SRS file */ - VerifierCommitmentKey(size_t num_points, std::shared_ptr> crs_factory) + VerifierCommitmentKey(size_t num_points, + std::shared_ptr> crs_factory) : pippenger_runtime_state(num_points) , srs(crs_factory->get_verifier_crs(num_points)) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp index a15b968a414..146d73ab686 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp @@ -154,10 +154,10 @@ template bool StandardVerifier_::verify_proof(const pl // - 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/sumcheck/polynomials/barycentric_data.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp index 91d67db9c4f..df8eb47fdfa 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 @@ -1,5 +1,5 @@ -#include "barycentric_data.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" +#include "barycentric_data.hpp" #include "barretenberg/numeric/random/engine.hpp" #include diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp index 7d21b09d001..eb885cf1603 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp @@ -77,8 +77,8 @@ template class SumcheckProver { * * @details */ - SumcheckOutput prove( - auto full_polynomials, const RelationParameters& relation_parameters) // pass by value, not by reference + SumcheckOutput prove(auto full_polynomials, + const RelationParameters& relation_parameters) // pass by value, not by reference { auto [alpha, zeta] = transcript.get_challenges("Sumcheck:alpha", "Sumcheck:zeta"); @@ -176,8 +176,8 @@ template class SumcheckVerifier { * target sum. * * @details If verification fails, returns std::nullopt, otherwise returns SumcheckOutput - * @param relation_parameters - * @param transcript + * @param relation_parameters + * @param transcript */ std::optional> verify(const RelationParameters& relation_parameters, auto& transcript) { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp index b503bd49e8d..ca36c393bde 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp @@ -67,6 +67,7 @@ template class BaseTranscript { // TODO(Adrian): Make these tweakable public: static constexpr size_t HASH_OUTPUT_SIZE = 32; + private: static constexpr size_t MIN_BYTES_PER_CHALLENGE = 128 / 8; // 128 bit challenges diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp index f0a84c077e3..931ab21e16e 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp @@ -3,8 +3,8 @@ * @brief Contains some functions that are shared between the various Plonk composers. */ #include "composer_lib.hpp" -#include "barretenberg/srs/factories/crs_factory.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" +#include "barretenberg/srs/factories/crs_factory.hpp" namespace proof_system::plonk { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.cpp index 47d57d8b986..c453b3724a8 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.cpp @@ -150,8 +150,7 @@ template void Polynomial::zero_memory_beyond(const size_t star **/ template -void Polynomial::fft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::fft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -160,8 +159,9 @@ void Polynomial::fft(const EvaluationDomain& domain) } template -void Polynomial::partial_fft(const EvaluationDomain& domain, Fr constant, bool is_coset) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::partial_fft(const EvaluationDomain& domain, + Fr constant, + bool is_coset) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -170,8 +170,7 @@ void Polynomial::partial_fft(const EvaluationDomain& domain, Fr constant } template -void Polynomial::coset_fft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::coset_fft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -182,8 +181,7 @@ void Polynomial::coset_fft(const EvaluationDomain& domain) template void Polynomial::coset_fft(const EvaluationDomain& domain, const EvaluationDomain& large_domain, - const size_t domain_extension) - requires polynomial_arithmetic::SupportsFFT + const size_t domain_extension) requires polynomial_arithmetic::SupportsFFT { size_t extended_size = domain.size * domain_extension; @@ -194,8 +192,8 @@ void Polynomial::coset_fft(const EvaluationDomain& domain, } template -void Polynomial::coset_fft_with_constant(const EvaluationDomain& domain, const Fr& constant) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::coset_fft_with_constant(const EvaluationDomain& domain, + const Fr& constant) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -204,8 +202,8 @@ void Polynomial::coset_fft_with_constant(const EvaluationDomain& domain, } template -void Polynomial::coset_fft_with_generator_shift(const EvaluationDomain& domain, const Fr& constant) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::coset_fft_with_generator_shift(const EvaluationDomain& domain, + const Fr& constant) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -214,8 +212,7 @@ void Polynomial::coset_fft_with_generator_shift(const EvaluationDomain& } template -void Polynomial::ifft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::ifft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -224,8 +221,8 @@ void Polynomial::ifft(const EvaluationDomain& domain) } template -void Polynomial::ifft_with_constant(const EvaluationDomain& domain, const Fr& constant) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::ifft_with_constant(const EvaluationDomain& domain, + const Fr& constant) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -234,8 +231,7 @@ void Polynomial::ifft_with_constant(const EvaluationDomain& domain, cons } template -void Polynomial::coset_ifft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT +void Polynomial::coset_ifft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT { ASSERT(in_place_operation_viable(domain.size)); zero_memory_beyond(domain.size); @@ -244,24 +240,23 @@ void Polynomial::coset_ifft(const EvaluationDomain& domain) } template -Fr Polynomial::compute_kate_opening_coefficients(const Fr& z) - requires polynomial_arithmetic::SupportsFFT +Fr Polynomial::compute_kate_opening_coefficients(const Fr& z) requires polynomial_arithmetic::SupportsFFT { return polynomial_arithmetic::compute_kate_opening_coefficients(coefficients_.get(), coefficients_.get(), z, size_); } template -Fr Polynomial::compute_barycentric_evaluation(const Fr& z, const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT +Fr Polynomial::compute_barycentric_evaluation( + const Fr& z, const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT { return polynomial_arithmetic::compute_barycentric_evaluation(coefficients_.get(), domain.size, z, domain); } template -Fr Polynomial::evaluate_from_fft(const EvaluationDomain& large_domain, - const Fr& z, - const EvaluationDomain& small_domain) - requires polynomial_arithmetic::SupportsFFT +Fr Polynomial::evaluate_from_fft( + const EvaluationDomain& large_domain, + const Fr& z, + const EvaluationDomain& small_domain) requires polynomial_arithmetic::SupportsFFT { return polynomial_arithmetic::evaluate_from_fft(coefficients_.get(), large_domain, z, small_domain); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.hpp index a12f79be787..aa8aef4d445 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial.hpp @@ -106,34 +106,28 @@ template class Polynomial { Fr evaluate(const Fr& z, const size_t target_size) const; Fr evaluate(const Fr& z) const; - Fr compute_barycentric_evaluation(const Fr& z, const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT; + Fr compute_barycentric_evaluation( + const Fr& z, const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT; Fr evaluate_from_fft(const EvaluationDomain& large_domain, const Fr& z, - const EvaluationDomain& small_domain) - requires polynomial_arithmetic::SupportsFFT; - void fft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT; - void partial_fft(const EvaluationDomain& domain, Fr constant = 1, bool is_coset = false) - requires polynomial_arithmetic::SupportsFFT; - void coset_fft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT; + const EvaluationDomain& small_domain) requires polynomial_arithmetic::SupportsFFT; + void fft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT; + void partial_fft(const EvaluationDomain& domain, + Fr constant = 1, + bool is_coset = false) requires polynomial_arithmetic::SupportsFFT; + void coset_fft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT; void coset_fft(const EvaluationDomain& domain, const EvaluationDomain& large_domain, - const size_t domain_extension) - requires polynomial_arithmetic::SupportsFFT; - void coset_fft_with_constant(const EvaluationDomain& domain, const Fr& costant) - requires polynomial_arithmetic::SupportsFFT; - void coset_fft_with_generator_shift(const EvaluationDomain& domain, const Fr& constant) - requires polynomial_arithmetic::SupportsFFT; - void ifft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT; - void ifft_with_constant(const EvaluationDomain& domain, const Fr& constant) - requires polynomial_arithmetic::SupportsFFT; - void coset_ifft(const EvaluationDomain& domain) - requires polynomial_arithmetic::SupportsFFT; - Fr compute_kate_opening_coefficients(const Fr& z) - requires polynomial_arithmetic::SupportsFFT; + const size_t domain_extension) requires polynomial_arithmetic::SupportsFFT; + void coset_fft_with_constant(const EvaluationDomain& domain, + const Fr& costant) requires polynomial_arithmetic::SupportsFFT; + void coset_fft_with_generator_shift(const EvaluationDomain& domain, + const Fr& constant) requires polynomial_arithmetic::SupportsFFT; + void ifft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT; + void ifft_with_constant(const EvaluationDomain& domain, + const Fr& constant) requires polynomial_arithmetic::SupportsFFT; + void coset_ifft(const EvaluationDomain& domain) requires polynomial_arithmetic::SupportsFFT; + Fr compute_kate_opening_coefficients(const Fr& z) requires polynomial_arithmetic::SupportsFFT; bool is_empty() const { return (coefficients_ == nullptr) || (size_ == 0); } diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.cpp index 0fa9083bd90..a8eae416766 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.cpp @@ -59,8 +59,9 @@ void copy_polynomial(const Fr* src, Fr* dest, size_t num_src_coefficients, size_ } template - requires SupportsFFT -void fft_inner_serial(std::vector coeffs, const size_t domain_size, const std::vector& root_table) +requires SupportsFFT void fft_inner_serial(std::vector coeffs, + const size_t domain_size, + const std::vector& root_table) { // Assert that the number of polynomials is a power of two. const size_t num_polys = coeffs.size(); @@ -146,10 +147,9 @@ void scale_by_generator(Fr* coeffs, * @param subgroup_roots Pointer to the array for saving subgroup members. * */ template - requires SupportsFFT -void compute_multiplicative_subgroup(const size_t log2_subgroup_size, - const EvaluationDomain& src_domain, - Fr* subgroup_roots) +requires SupportsFFT void compute_multiplicative_subgroup(const size_t log2_subgroup_size, + const EvaluationDomain& src_domain, + Fr* subgroup_roots) { size_t subgroup_size = 1UL << log2_subgroup_size; // Step 1: get primitive 4th root of unity @@ -169,11 +169,10 @@ void compute_multiplicative_subgroup(const size_t log2_subgroup_size, } template - requires SupportsFFT -void fft_inner_parallel(std::vector coeffs, - const EvaluationDomain& domain, - const Fr&, - const std::vector& root_table) +requires SupportsFFT void fft_inner_parallel(std::vector coeffs, + const EvaluationDomain& domain, + const Fr&, + const std::vector& root_table) { auto scratch_space_ptr = get_scratch_space(domain.size); auto scratch_space = scratch_space_ptr.get(); @@ -297,8 +296,7 @@ void fft_inner_parallel(std::vector coeffs, } template - requires SupportsFFT -void fft_inner_parallel( +requires SupportsFFT void fft_inner_parallel( Fr* coeffs, Fr* target, const EvaluationDomain& domain, const Fr&, const std::vector& root_table) { parallel_for(domain.num_threads, [&](size_t j) { @@ -392,11 +390,10 @@ void fft_inner_parallel( } template - requires SupportsFFT -void partial_fft_serial_inner(Fr* coeffs, - Fr* target, - const EvaluationDomain& domain, - const std::vector& root_table) +requires SupportsFFT void partial_fft_serial_inner(Fr* coeffs, + Fr* target, + const EvaluationDomain& domain, + const std::vector& root_table) { // We wish to compute a partial modified FFT of 2 rounds from given coefficients. // We need a 2-round modified FFT for commiting to the 4n-sized quotient polynomial for @@ -435,8 +432,7 @@ void partial_fft_serial_inner(Fr* coeffs, } template - requires SupportsFFT -void partial_fft_parellel_inner( +requires SupportsFFT void partial_fft_parellel_inner( Fr* coeffs, const EvaluationDomain& domain, const std::vector& root_table, Fr constant, bool is_coset) { // We wish to compute a partial modified FFT of 2 rounds from given coefficients. @@ -507,43 +503,33 @@ void partial_fft_parellel_inner( } template - requires SupportsFFT -void partial_fft_serial(Fr* coeffs, Fr* target, const EvaluationDomain& domain) +requires SupportsFFT void partial_fft_serial(Fr* coeffs, Fr* target, const EvaluationDomain& domain) { partial_fft_serial_inner(coeffs, target, domain, domain.get_round_roots()); } template - requires SupportsFFT -void partial_fft(Fr* coeffs, const EvaluationDomain& domain, Fr constant, bool is_coset) +requires SupportsFFT void partial_fft(Fr* coeffs, const EvaluationDomain& domain, Fr constant, bool is_coset) { partial_fft_parellel_inner(coeffs, domain, domain.get_round_roots(), constant, is_coset); } -template - requires SupportsFFT -void fft(Fr* coeffs, const EvaluationDomain& domain) +template requires SupportsFFT void fft(Fr* coeffs, const EvaluationDomain& domain) { fft_inner_parallel({ coeffs }, domain, domain.root, domain.get_round_roots()); } -template - requires SupportsFFT -void fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain) +template requires SupportsFFT void fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain) { fft_inner_parallel(coeffs, target, domain, domain.root, domain.get_round_roots()); } -template - requires SupportsFFT -void fft(std::vector coeffs, const EvaluationDomain& domain) +template requires SupportsFFT void fft(std::vector coeffs, const EvaluationDomain& domain) { fft_inner_parallel(coeffs, domain.size, domain.root, domain.get_round_roots()); } -template - requires SupportsFFT -void ifft(Fr* coeffs, const EvaluationDomain& domain) +template requires SupportsFFT void ifft(Fr* coeffs, const EvaluationDomain& domain) { fft_inner_parallel({ coeffs }, domain, domain.root_inverse, domain.get_inverse_round_roots()); ITERATE_OVER_DOMAIN_START(domain); @@ -551,9 +537,7 @@ void ifft(Fr* coeffs, const EvaluationDomain& domain) ITERATE_OVER_DOMAIN_END; } -template - requires SupportsFFT -void ifft(Fr* coeffs, Fr* target, const EvaluationDomain& domain) +template requires SupportsFFT void ifft(Fr* coeffs, Fr* target, const EvaluationDomain& domain) { fft_inner_parallel(coeffs, target, domain, domain.root_inverse, domain.get_inverse_round_roots()); ITERATE_OVER_DOMAIN_START(domain); @@ -561,9 +545,7 @@ void ifft(Fr* coeffs, Fr* target, const EvaluationDomain& domain) ITERATE_OVER_DOMAIN_END; } -template - requires SupportsFFT -void ifft(std::vector coeffs, const EvaluationDomain& domain) +template requires SupportsFFT void ifft(std::vector coeffs, const EvaluationDomain& domain) { fft_inner_parallel(coeffs, domain, domain.root_inverse, domain.get_inverse_round_roots()); @@ -580,8 +562,7 @@ void ifft(std::vector coeffs, const EvaluationDomain& domain) } template - requires SupportsFFT -void fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value) +requires SupportsFFT void fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value) { fft_inner_parallel({ coeffs }, domain, domain.root, domain.get_round_roots()); ITERATE_OVER_DOMAIN_START(domain); @@ -589,25 +570,21 @@ void fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& ITERATE_OVER_DOMAIN_END; } -template - requires SupportsFFT -void coset_fft(Fr* coeffs, const EvaluationDomain& domain) +template requires SupportsFFT void coset_fft(Fr* coeffs, const EvaluationDomain& domain) { scale_by_generator(coeffs, coeffs, domain, Fr::one(), domain.generator, domain.generator_size); fft(coeffs, domain); } template - requires SupportsFFT -void coset_fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain) +requires SupportsFFT void coset_fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain) { scale_by_generator(coeffs, target, domain, Fr::one(), domain.generator, domain.generator_size); fft(coeffs, target, domain); } template - requires SupportsFFT -void coset_fft(std::vector coeffs, const EvaluationDomain& domain) +requires SupportsFFT void coset_fft(std::vector coeffs, const EvaluationDomain& domain) { const size_t num_polys = coeffs.size(); ASSERT(is_power_of_two(num_polys)); @@ -623,11 +600,10 @@ void coset_fft(std::vector coeffs, const EvaluationDomain& domain) } template - requires SupportsFFT -void coset_fft(Fr* coeffs, - const EvaluationDomain& domain, - const EvaluationDomain&, - const size_t domain_extension) +requires SupportsFFT void coset_fft(Fr* coeffs, + const EvaluationDomain& domain, + const EvaluationDomain&, + const size_t domain_extension) { const size_t log2_domain_extension = static_cast(numeric::get_msb(domain_extension)); Fr primitive_root = Fr::get_root_of_unity(domain.log2_size + log2_domain_extension); @@ -684,8 +660,9 @@ void coset_fft(Fr* coeffs, } template - requires SupportsFFT -void coset_fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& constant) +requires SupportsFFT void coset_fft_with_constant(Fr* coeffs, + const EvaluationDomain& domain, + const Fr& constant) { Fr start = constant; scale_by_generator(coeffs, coeffs, domain, start, domain.generator, domain.generator_size); @@ -693,16 +670,16 @@ void coset_fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, con } template - requires SupportsFFT -void coset_fft_with_generator_shift(Fr* coeffs, const EvaluationDomain& domain, const Fr& constant) +requires SupportsFFT void coset_fft_with_generator_shift(Fr* coeffs, + const EvaluationDomain& domain, + const Fr& constant) { scale_by_generator(coeffs, coeffs, domain, Fr::one(), domain.generator * constant, domain.generator_size); fft(coeffs, domain); } template - requires SupportsFFT -void ifft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value) +requires SupportsFFT void ifft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value) { fft_inner_parallel({ coeffs }, domain, domain.root_inverse, domain.get_inverse_round_roots()); Fr T0 = domain.domain_inverse * value; @@ -711,17 +688,14 @@ void ifft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr ITERATE_OVER_DOMAIN_END; } -template - requires SupportsFFT -void coset_ifft(Fr* coeffs, const EvaluationDomain& domain) +template requires SupportsFFT void coset_ifft(Fr* coeffs, const EvaluationDomain& domain) { ifft(coeffs, domain); scale_by_generator(coeffs, coeffs, domain, Fr::one(), domain.generator_inverse, domain.size); } template - requires SupportsFFT -void coset_ifft(std::vector coeffs, const EvaluationDomain& domain) +requires SupportsFFT void coset_ifft(std::vector coeffs, const EvaluationDomain& domain) { ifft(coeffs, domain); @@ -852,10 +826,9 @@ template Fr evaluate(const std::vector coeffs, const Fr& z, c * L_i(X), we perform a (k*i)-left-shift of this vector. */ template - requires SupportsFFT -void compute_lagrange_polynomial_fft(Fr* l_1_coefficients, - const EvaluationDomain& src_domain, - const EvaluationDomain& target_domain) +requires SupportsFFT void compute_lagrange_polynomial_fft(Fr* l_1_coefficients, + const EvaluationDomain& src_domain, + const EvaluationDomain& target_domain) { // Step 1: Compute the 1/denominator for each evaluation: 1 / (X_i - 1) Fr multiplicand = target_domain.root; // kn'th root of unity w' @@ -899,11 +872,11 @@ void compute_lagrange_polynomial_fft(Fr* l_1_coefficients, } template - requires SupportsFFT -void divide_by_pseudo_vanishing_polynomial(std::vector coeffs, - const EvaluationDomain& src_domain, - const EvaluationDomain& target_domain, - const size_t num_roots_cut_out_of_vanishing_polynomial) +requires SupportsFFT void divide_by_pseudo_vanishing_polynomial( + std::vector coeffs, + const EvaluationDomain& src_domain, + const EvaluationDomain& target_domain, + const size_t num_roots_cut_out_of_vanishing_polynomial) { // Older version: // the PLONK divisor polynomial is equal to the vanishing polynomial divided by the vanishing polynomial for the @@ -1009,8 +982,7 @@ void divide_by_pseudo_vanishing_polynomial(std::vector coeffs, } template - requires SupportsFFT -Fr compute_kate_opening_coefficients(const Fr* src, Fr* dest, const Fr& z, const size_t n) +requires SupportsFFT Fr compute_kate_opening_coefficients(const Fr* src, Fr* dest, const Fr& z, const size_t n) { // if `coeffs` represents F(X), we want to compute W(X) // where W(X) = F(X) - F(z) / (X - z) @@ -1039,8 +1011,7 @@ Fr compute_kate_opening_coefficients(const Fr* src, Fr* dest, const Fr& z, const * @param zeta - the name given (in our code) to the evaluation challenge ʓ from the Plonk paper. */ template - requires SupportsFFT -barretenberg::polynomial_arithmetic::LagrangeEvaluations get_lagrange_evaluations( +requires SupportsFFT barretenberg::polynomial_arithmetic::LagrangeEvaluations get_lagrange_evaluations( const Fr& zeta, const EvaluationDomain& domain, const size_t num_roots_cut_out_of_vanishing_polynomial) { // Compute Z_H*(ʓ), l_start(ʓ), l_{end}(ʓ) @@ -1121,11 +1092,10 @@ barretenberg::polynomial_arithmetic::LagrangeEvaluations get_lagrange_evalua // n.(ʓ.ω^{1-i)} - 1) // template - requires SupportsFFT -Fr compute_barycentric_evaluation(const Fr* coeffs, - const size_t num_coeffs, - const Fr& z, - const EvaluationDomain& domain) +requires SupportsFFT Fr compute_barycentric_evaluation(const Fr* coeffs, + const size_t num_coeffs, + const Fr& z, + const EvaluationDomain& domain) { Fr* denominators = static_cast(aligned_alloc(64, sizeof(Fr) * num_coeffs)); @@ -1167,8 +1137,7 @@ Fr compute_barycentric_evaluation(const Fr* coeffs, // Convert an fft with `current_size` point evaluations, to one with `current_size >> compress_factor` point evaluations template - requires SupportsFFT -void compress_fft(const Fr* src, Fr* dest, const size_t cur_size, const size_t compress_factor) +requires SupportsFFT void compress_fft(const Fr* src, Fr* dest, const size_t cur_size, const size_t compress_factor) { // iterate from top to bottom, allows `dest` to overlap with `src` size_t log2_compress_factor = (size_t)numeric::get_msb(compress_factor); @@ -1180,11 +1149,10 @@ void compress_fft(const Fr* src, Fr* dest, const size_t cur_size, const size_t c } template - requires SupportsFFT -Fr evaluate_from_fft(const Fr* poly_coset_fft, - const EvaluationDomain& large_domain, - const Fr& z, - const EvaluationDomain& small_domain) +requires SupportsFFT Fr evaluate_from_fft(const Fr* poly_coset_fft, + const EvaluationDomain& large_domain, + const Fr& z, + const EvaluationDomain& small_domain) { size_t n = small_domain.size; Fr* small_poly_coset_fft = static_cast(aligned_alloc(64, sizeof(Fr) * n)); @@ -1242,8 +1210,7 @@ template Fr compute_linear_polynomial_product_evaluation(const Fr* } template - requires SupportsFFT -void fft_linear_polynomial_product( +requires SupportsFFT void fft_linear_polynomial_product( const Fr* roots, Fr* dest, const size_t n, const EvaluationDomain& domain, const bool is_coset) { size_t m = domain.size >> 1; diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.hpp index 8e4338ba251..795aebf4a17 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.hpp @@ -4,8 +4,7 @@ namespace barretenberg { namespace polynomial_arithmetic { -template -concept SupportsFFT = T::Params::has_high_2adicity; +template concept SupportsFFT = T::Params::has_high_2adicity; template struct LagrangeEvaluations { Fr vanishing_poly; @@ -30,92 +29,71 @@ void copy_polynomial(const Fr* src, Fr* dest, size_t num_src_coefficients, size_ // 2. Compute a lookup table of the roots of unity, and suffer through cache misses from nonlinear access patterns template - requires SupportsFFT -void fft_inner_serial(std::vector coeffs, const size_t domain_size, const std::vector& root_table); +requires SupportsFFT void fft_inner_serial(std::vector coeffs, + const size_t domain_size, + const std::vector& root_table); template - requires SupportsFFT -void fft_inner_parallel(std::vector coeffs, - const EvaluationDomain& domain, - const Fr&, - const std::vector& root_table); +requires SupportsFFT void fft_inner_parallel(std::vector coeffs, + const EvaluationDomain& domain, + const Fr&, + const std::vector& root_table); +template requires SupportsFFT void fft(Fr* coeffs, const EvaluationDomain& domain); +template requires SupportsFFT void fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain); +template requires SupportsFFT void fft(std::vector coeffs, const EvaluationDomain& domain); template - requires SupportsFFT -void fft(Fr* coeffs, const EvaluationDomain& domain); -template - requires SupportsFFT -void fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain); -template - requires SupportsFFT -void fft(std::vector coeffs, const EvaluationDomain& domain); -template - requires SupportsFFT -void fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value); +requires SupportsFFT void fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value); +template requires SupportsFFT void coset_fft(Fr* coeffs, const EvaluationDomain& domain); template - requires SupportsFFT -void coset_fft(Fr* coeffs, const EvaluationDomain& domain); -template - requires SupportsFFT -void coset_fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain); +requires SupportsFFT void coset_fft(Fr* coeffs, Fr* target, const EvaluationDomain& domain); template - requires SupportsFFT -void coset_fft(std::vector coeffs, const EvaluationDomain& domain); +requires SupportsFFT void coset_fft(std::vector coeffs, const EvaluationDomain& domain); template - requires SupportsFFT -void coset_fft(Fr* coeffs, - const EvaluationDomain& small_domain, - const EvaluationDomain& large_domain, - const size_t domain_extension); +requires SupportsFFT void coset_fft(Fr* coeffs, + const EvaluationDomain& small_domain, + const EvaluationDomain& large_domain, + const size_t domain_extension); template - requires SupportsFFT -void coset_fft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& constant); +requires SupportsFFT void coset_fft_with_constant(Fr* coeffs, + const EvaluationDomain& domain, + const Fr& constant); template - requires SupportsFFT -void coset_fft_with_generator_shift(Fr* coeffs, const EvaluationDomain& domain, const Fr& constant); +requires SupportsFFT void coset_fft_with_generator_shift(Fr* coeffs, + const EvaluationDomain& domain, + const Fr& constant); -template - requires SupportsFFT -void ifft(Fr* coeffs, const EvaluationDomain& domain); -template - requires SupportsFFT -void ifft(Fr* coeffs, Fr* target, const EvaluationDomain& domain); -template - requires SupportsFFT -void ifft(std::vector coeffs, const EvaluationDomain& domain); +template requires SupportsFFT void ifft(Fr* coeffs, const EvaluationDomain& domain); +template requires SupportsFFT void ifft(Fr* coeffs, Fr* target, const EvaluationDomain& domain); +template requires SupportsFFT void ifft(std::vector coeffs, const EvaluationDomain& domain); template - requires SupportsFFT -void ifft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value); +requires SupportsFFT void ifft_with_constant(Fr* coeffs, const EvaluationDomain& domain, const Fr& value); +template requires SupportsFFT void coset_ifft(Fr* coeffs, const EvaluationDomain& domain); template - requires SupportsFFT -void coset_ifft(Fr* coeffs, const EvaluationDomain& domain); -template - requires SupportsFFT -void coset_ifft(std::vector coeffs, const EvaluationDomain& domain); +requires SupportsFFT void coset_ifft(std::vector coeffs, const EvaluationDomain& domain); template - requires SupportsFFT -void partial_fft_serial_inner(Fr* coeffs, - Fr* target, - const EvaluationDomain& domain, - const std::vector& root_table); +requires SupportsFFT void partial_fft_serial_inner(Fr* coeffs, + Fr* target, + const EvaluationDomain& domain, + const std::vector& root_table); template - requires SupportsFFT -void partial_fft_parellel_inner(Fr* coeffs, - const EvaluationDomain& domain, - const std::vector& root_table, - Fr constant = 1, - bool is_coset = false); +requires SupportsFFT void partial_fft_parellel_inner(Fr* coeffs, + const EvaluationDomain& domain, + const std::vector& root_table, + Fr constant = 1, + bool is_coset = false); template - requires SupportsFFT -void partial_fft_serial(Fr* coeffs, Fr* target, const EvaluationDomain& domain); +requires SupportsFFT void partial_fft_serial(Fr* coeffs, Fr* target, const EvaluationDomain& domain); template - requires SupportsFFT -void partial_fft(Fr* coeffs, const EvaluationDomain& domain, Fr constant = 1, bool is_coset = false); +requires SupportsFFT void partial_fft(Fr* coeffs, + const EvaluationDomain& domain, + Fr constant = 1, + bool is_coset = false); template void add(const Fr* a_coeffs, const Fr* b_coeffs, Fr* r_coeffs, const EvaluationDomain& domain); @@ -132,31 +110,27 @@ void mul(const Fr* a_coeffs, const Fr* b_coeffs, Fr* r_coeffs, const EvaluationD // for all X = k*n'th roots of unity. // To compute the vector for the k*n-fft transform of L_i(X), we perform a (k*i)-left-shift of this vector template - requires SupportsFFT -void compute_lagrange_polynomial_fft(Fr* l_1_coefficients, - const EvaluationDomain& src_domain, - const EvaluationDomain& target_domain); +requires SupportsFFT void compute_lagrange_polynomial_fft(Fr* l_1_coefficients, + const EvaluationDomain& src_domain, + const EvaluationDomain& target_domain); template - requires SupportsFFT -void divide_by_pseudo_vanishing_polynomial(std::vector coeffs, - const EvaluationDomain& src_domain, - const EvaluationDomain& target_domain, - const size_t num_roots_cut_out_of_vanishing_polynomial = 4); +requires SupportsFFT void divide_by_pseudo_vanishing_polynomial( + std::vector coeffs, + const EvaluationDomain& src_domain, + const EvaluationDomain& target_domain, + const size_t num_roots_cut_out_of_vanishing_polynomial = 4); // void populate_with_vanishing_polynomial(Fr* coeffs, const size_t num_non_zero_entries, const EvaluationDomain& // src_domain, const EvaluationDomain& target_domain); template - requires SupportsFFT -Fr compute_kate_opening_coefficients(const Fr* src, Fr* dest, const Fr& z, const size_t n); +requires SupportsFFT Fr compute_kate_opening_coefficients(const Fr* src, Fr* dest, const Fr& z, const size_t n); // compute Z_H*(z), l_start(z), l_{end}(z) (= l_{n-4}(z)) template - requires SupportsFFT -LagrangeEvaluations get_lagrange_evaluations(const Fr& z, - const EvaluationDomain& domain, - const size_t num_roots_cut_out_of_vanishing_polynomial = 4); +requires SupportsFFT LagrangeEvaluations get_lagrange_evaluations( + const Fr& z, const EvaluationDomain& domain, const size_t num_roots_cut_out_of_vanishing_polynomial = 4); template Fr compute_barycentric_evaluation(const Fr* coeffs, const size_t num_coeffs, @@ -164,15 +138,16 @@ Fr compute_barycentric_evaluation(const Fr* coeffs, const EvaluationDomain& domain); // Convert an fft with `current_size` point evaluations, to one with `current_size >> compress_factor` point evaluations template - requires SupportsFFT -void compress_fft(const Fr* src, Fr* dest, const size_t current_size, const size_t compress_factor); +requires SupportsFFT void compress_fft(const Fr* src, + Fr* dest, + const size_t current_size, + const size_t compress_factor); template - requires SupportsFFT -Fr evaluate_from_fft(const Fr* poly_coset_fft, - const EvaluationDomain& large_domain, - const Fr& z, - const EvaluationDomain& small_domain); +requires SupportsFFT Fr evaluate_from_fft(const Fr* poly_coset_fft, + const EvaluationDomain& large_domain, + const Fr& z, + const EvaluationDomain& small_domain); // This function computes sum of all scalars in a given array. template Fr compute_sum(const Fr* src, const size_t n); @@ -187,8 +162,7 @@ template Fr compute_linear_polynomial_product_evaluation(const Fr* // This function computes the lagrange (or coset-lagrange) form of the polynomial (x - a)(x - b)(x - c)... // given n distinct roots (a, b, c, ...). template - requires SupportsFFT -void fft_linear_polynomial_product( +requires SupportsFFT void fft_linear_polynomial_product( const Fr* roots, Fr* dest, const size_t n, const EvaluationDomain& domain, const bool is_coset = false); // This function interpolates from points {(z_1, f(z_1)), (z_2, f(z_2)), ...}. diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.test.cpp index 5bb675a2064..8a2637fd31b 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/polynomials/polynomial_arithmetic.test.cpp @@ -1,9 +1,9 @@ -#include "polynomial_arithmetic.hpp" #include "barretenberg/common/mem.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/numeric/random/engine.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "polynomial.hpp" +#include "polynomial_arithmetic.hpp" #include #include #include diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.test.cpp index ca4ac215e78..7a099e4016c 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.test.cpp @@ -1,5 +1,5 @@ -#include "goblin_translator_circuit_builder.hpp" #include "barretenberg/ecc/curves/bn254/bn254.hpp" +#include "goblin_translator_circuit_builder.hpp" #include #include #include diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp index 45d019a417b..3065f2eacfc 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp @@ -64,12 +64,12 @@ */ #pragma once +#include "barretenberg/honk/pcs/commitment_key.hpp" +#include "barretenberg/honk/pcs/verification_key.hpp" #include "barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp" #include "barretenberg/honk/sumcheck/polynomials/univariate.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/proof_system/types/circuit_type.hpp" -#include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/honk/pcs/verification_key.hpp" #include #include #include diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/cbind_fwd.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/cbind_fwd.hpp index 9c218cafff8..821f7e0759a 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/cbind_fwd.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/cbind_fwd.hpp @@ -1,7 +1,7 @@ #pragma once +#include "barretenberg/common/wasm_export.hpp" #include #include -#include "barretenberg/common/wasm_export.hpp" // CBIND forward declarations for msgback default bind format (encode as tuple of args and return value as msgpack // string) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/msgpack_impl/name_value_pair_macro.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/msgpack_impl/name_value_pair_macro.hpp index d2de01418ba..7e4207f87fa 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/msgpack_impl/name_value_pair_macro.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/serialize/msgpack_impl/name_value_pair_macro.hpp @@ -5,11 +5,72 @@ * used in msgpack serialization. */ // hacky counting of variadic macro params: -#define VA_NARGS_IMPL( \ - _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, N, ...) \ +#define VA_NARGS_IMPL(_1, \ + _2, \ + _3, \ + _4, \ + _5, \ + _6, \ + _7, \ + _8, \ + _9, \ + _10, \ + _11, \ + _12, \ + _13, \ + _14, \ + _15, \ + _16, \ + _17, \ + _18, \ + _19, \ + _20, \ + _21, \ + _22, \ + _23, \ + _24, \ + _25, \ + _26, \ + _27, \ + _28, \ + _29, \ + _30, \ + N, \ + ...) \ N // AD: support for 30 fields!? one may ask. Well, after 20 not being enough... -#define VA_NARGS(...) VA_NARGS_IMPL(__VA_ARGS__, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) +#define VA_NARGS(...) \ + VA_NARGS_IMPL(__VA_ARGS__, \ + 30, \ + 29, \ + 28, \ + 27, \ + 26, \ + 25, \ + 24, \ + 23, \ + 22, \ + 21, \ + 20, \ + 19, \ + 18, \ + 17, \ + 16, \ + 15, \ + 14, \ + 13, \ + 12, \ + 11, \ + 10, \ + 9, \ + 8, \ + 7, \ + 6, \ + 5, \ + 4, \ + 3, \ + 2, \ + 1) // name-value pair expansion for variables // used in msgpack map expansion diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/hash/benchmarks/celer/sha256.bench.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/hash/benchmarks/celer/sha256.bench.cpp index d160c1b8d77..a22ceae5faf 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/hash/benchmarks/celer/sha256.bench.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/hash/benchmarks/celer/sha256.bench.cpp @@ -6,8 +6,8 @@ * @date 2023-08-02 * */ -#include "barretenberg/stdlib/hash/sha256/sha256.hpp" #include "barretenberg/plonk/composer/ultra_composer.hpp" +#include "barretenberg/stdlib/hash/sha256/sha256.hpp" #include #include diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp index 7fbdedb9c81..819d4d3a1bb 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp @@ -236,9 +236,7 @@ template class BigFieldBase { * @param rng PRNG used * @return A random instruction */ - template - inline static Instruction generateRandom(T& rng) - requires SimpleRng + template inline static Instruction generateRandom(T& rng) requires SimpleRng { // Choose which instruction we are going to generate OPCODE instruction_opcode = static_cast(rng.next() % (OPCODE::_LAST)); @@ -364,8 +362,7 @@ template class BigFieldBase { * @return Mutated element */ template - inline static fq mutateFieldElement(fq e, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static fq mutateFieldElement(fq e, T& rng, HavocSettings& havoc_config) requires SimpleRng { // With a certain probability, we apply changes to the Montgomery form, rather than the plain form. This // has merit, since the computation is performed in montgomery form and comparisons are often performed @@ -461,8 +458,9 @@ template class BigFieldBase { * @return Mutated instruction */ template - inline static Instruction mutateInstruction(Instruction instruction, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static Instruction mutateInstruction(Instruction instruction, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { #define PUT_RANDOM_BYTE_IF_LUCKY(variable) \ if (rng.next() & 1) { \ diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp index 1b2ac170f85..5ca3bbad35e 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp @@ -30,7 +30,8 @@ template struct TestType { using element_ct = typename std::conditional<_use_bigfield, typename Curve::g1_bigfr_ct, typename Curve::Group>::type; // the field of scalars acting on element_ct - using scalar_ct = typename std::conditional<_use_bigfield, typename Curve::bigfr_ct, typename Curve::ScalarField>::type; + using scalar_ct = + typename std::conditional<_use_bigfield, typename Curve::bigfr_ct, typename Curve::ScalarField>::type; }; template class stdlib_biggroup : public testing::Test { diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp index 397ba57c853..37345fe8ee1 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp @@ -170,9 +170,7 @@ template class BitArrayFuzzBase { * @param rng PRNG used * @return A random instruction */ - template - inline static Instruction generateRandom(T& rng) - requires SimpleRng + template inline static Instruction generateRandom(T& rng) requires SimpleRng { // Choose which instruction we are going to generate OPCODE instruction_opcode = static_cast(rng.next() % (OPCODE::_LAST)); @@ -231,8 +229,9 @@ template class BitArrayFuzzBase { * @return Mutated instruction */ template - inline static Instruction mutateInstruction(Instruction instruction, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static Instruction mutateInstruction(Instruction instruction, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { (void)rng; (void)havoc_config; diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp index f516c802961..fa7052f913f 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp @@ -72,9 +72,7 @@ template class BoolFuzzBase { * @param rng PRNG used * @return A random instruction */ - template - inline static Instruction generateRandom(T& rng) - requires SimpleRng + template inline static Instruction generateRandom(T& rng) requires SimpleRng { // Choose which instruction we are going to generate OPCODE instruction_opcode = static_cast(rng.next() % (OPCODE::_LAST)); @@ -131,8 +129,9 @@ template class BoolFuzzBase { * @return Mutated instruction */ template - inline static Instruction mutateInstruction(Instruction instruction, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static Instruction mutateInstruction(Instruction instruction, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { (void)rng; (void)havoc_config; diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp index 1680e94b7f5..6af538852c0 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp @@ -106,9 +106,7 @@ template class ByteArrayFuzzBase { * @param rng PRNG used * @return A random instruction */ - template - inline static Instruction generateRandom(T& rng) - requires SimpleRng + template inline static Instruction generateRandom(T& rng) requires SimpleRng { // Choose which instruction we are going to generate OPCODE instruction_opcode = static_cast(rng.next() % (OPCODE::_LAST)); @@ -178,8 +176,9 @@ template class ByteArrayFuzzBase { * @return Mutated instruction */ template - inline static Instruction mutateInstruction(Instruction instruction, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static Instruction mutateInstruction(Instruction instruction, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { (void)rng; (void)havoc_config; diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp index c898d9d3763..11076595d74 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp @@ -227,9 +227,7 @@ template class FieldBase { * @param rng PRNG used * @return A random instruction */ - template - inline static Instruction generateRandom(T& rng) - requires SimpleRng + template inline static Instruction generateRandom(T& rng) requires SimpleRng { // Choose which instruction we are going to generate OPCODE instruction_opcode = static_cast(rng.next() % (OPCODE::_LAST)); @@ -327,8 +325,9 @@ template class FieldBase { * @return Mutated element */ template - inline static barretenberg::fr mutateFieldElement(barretenberg::fr e, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static barretenberg::fr mutateFieldElement(barretenberg::fr e, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { // With a certain probability, we apply changes to the Montgomery form, rather than the plain form. This // has merit, since the computation is performed in montgomery form and comparisons are often performed @@ -424,8 +423,9 @@ template class FieldBase { * @return Mutated instruction */ template - inline static Instruction mutateInstruction(Instruction instruction, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static Instruction mutateInstruction(Instruction instruction, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { #define PUT_RANDOM_BYTE_IF_LUCKY(variable) \ if (rng.next() & 1) { \ diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp index c1fc716935e..c96fafc3033 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp @@ -189,9 +189,7 @@ template class SafeUintFuzzBase { * @param rng PRNG used * @return A random instruction */ - template - inline static Instruction generateRandom(T& rng) - requires SimpleRng + template inline static Instruction generateRandom(T& rng) requires SimpleRng { // Choose which instruction we are going to generate OPCODE instruction_opcode = static_cast(rng.next() % (OPCODE::_LAST)); @@ -286,8 +284,7 @@ template class SafeUintFuzzBase { * @return Mutated element */ template - inline static fr mutateFieldElement(fr e, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static fr mutateFieldElement(fr e, T& rng, HavocSettings& havoc_config) requires SimpleRng { // With a certain probability, we apply changes to the Montgomery form, rather than the plain form. This has // merit, since the computation is performed in montgomery form and comparisons are often performed in it, @@ -380,8 +377,9 @@ template class SafeUintFuzzBase { * @return Mutated instruction */ template - inline static Instruction mutateInstruction(Instruction instruction, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static Instruction mutateInstruction(Instruction instruction, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { #define PUT_RANDOM_BYTE_IF_LUCKY(variable) \ if (rng.next() & 1) { \ diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp index 20ab5fa3618..cc8c853f17d 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp @@ -105,9 +105,7 @@ template class UintFuzzBase { * @param rng PRNG used * @return A random instruction */ - template - inline static Instruction generateRandom(T& rng) - requires SimpleRng + template inline static Instruction generateRandom(T& rng) requires SimpleRng { // Choose which instruction we are going to generate OPCODE instruction_opcode = static_cast(rng.next() % (OPCODE::_LAST)); @@ -167,8 +165,9 @@ template class UintFuzzBase { * @return Mutated instruction */ template - inline static Instruction mutateInstruction(Instruction instruction, T& rng, HavocSettings& havoc_config) - requires SimpleRng + inline static Instruction mutateInstruction(Instruction instruction, + T& rng, + HavocSettings& havoc_config) requires SimpleRng { (void)rng; (void)havoc_config; diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp index c26809d4353..697aa34ea19 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp @@ -11,7 +11,7 @@ #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/utility/utility.hpp" -//TODO(luke): this namespace will be sensible once stdlib is moved out of the plonk namespace +// TODO(luke): this namespace will be sensible once stdlib is moved out of the plonk namespace namespace proof_system::plonk::stdlib::recursion::honk { template class Transcript { public: @@ -92,7 +92,7 @@ template class Transcript { { // Get native type corresponding to input type using NativeType = typename StdlibTypes::template NativeType::type; - + // Extract the native element from the native transcript NativeType element = native_transcript.template receive_from_prover(label); diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp index ed62c4efa81..50c3cd77e4d 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp @@ -195,7 +195,7 @@ template class RecursiveVerifierTest : public testing:: /** * @brief Construct a recursive verification circuit for the proof of an inner circuit then call check_circuit on it - * + * */ static void test_recursive_proof_composition() {