From e63dc37543e9c1b1f6e0d5c76d6528bf48ffe2e6 Mon Sep 17 00:00:00 2001 From: Cody Gunton Date: Thu, 30 Mar 2023 10:09:11 -0400 Subject: [PATCH] Cg/move to shared (https://github.com/AztecProtocol/barretenberg/pull/294) * Move circuit constructors to shared. * Move helper lib and perm helper. * Move tmp composers and helpers for plonk. * Fix namespace and red herring comment. * Remove pointless namespace declaration. * Fix more namespaces. * Split flavor * Rename tests to avoid ambiguity. * Remove redundant macro defs. * Fix comment formatting. * StandardArithmetization is not shared with plonk. --- .../standard_honk_composer_helper.cpp | 2 +- .../standard_honk_composer_helper.hpp | 6 +- .../honk/composer/standard_honk_composer.hpp | 4 +- .../composer/standard_honk_composer.test.cpp | 6 +- .../src/barretenberg/honk/flavor/flavor.hpp | 188 ++++++++++++++++++ .../barretenberg/honk/flavor/flavor.test.cpp | 30 +++ .../honk/proof_system/program_settings.hpp | 4 +- .../barretenberg/honk/proof_system/prover.cpp | 8 +- .../barretenberg/honk/proof_system/prover.hpp | 4 +- .../honk/proof_system/verifier.cpp | 12 +- .../honk/proof_system/verifier.hpp | 2 +- .../honk/proof_system/verifier.test.cpp | 4 +- .../relations/arithmetic_relation.hpp | 2 +- .../grand_product_computation_relation.hpp | 11 +- .../grand_product_initialization_relation.hpp | 2 +- .../honk/sumcheck/relations/relation.test.cpp | 12 +- .../barretenberg/honk/sumcheck/sumcheck.hpp | 4 +- .../honk/sumcheck/sumcheck.test.cpp | 6 +- .../honk/sumcheck/sumcheck_output.hpp | 2 +- .../honk/sumcheck/sumcheck_round.test.cpp | 6 +- .../honk/transcript/transcript.test.cpp | 2 - .../standard_plonk_composer_helper.cpp | 5 +- .../standard_plonk_composer_helper.hpp | 10 +- .../turbo_plonk_composer_helper.cpp | 8 +- .../turbo_plonk_composer_helper.hpp | 6 +- .../standard_plonk_composer.hpp | 2 +- .../standard_plonk_composer.test.cpp | 24 +-- .../splitting_tmp}/turbo_plonk_composer.hpp | 2 +- .../turbo_plonk_composer.test.cpp | 42 ++-- .../widgets/random_widgets/random_widget.hpp | 1 + .../circuit_constructor_base.cpp | 0 .../circuit_constructor_base.hpp | 0 .../standard_circuit_constructor.cpp | 0 .../standard_circuit_constructor.hpp | 0 .../standard_circuit_constructor.test.cpp | 0 .../turbo_circuit_constructor.cpp | 0 .../turbo_circuit_constructor.hpp | 0 .../turbo_circuit_constructor.test.cpp | 0 .../composer}/composer_helper_lib.cpp | 4 +- .../composer}/composer_helper_lib.hpp | 0 .../composer}/permutation_helper.hpp | 3 +- .../proof_system/flavor/flavor.hpp | 184 +---------------- .../primitives/bigfield/bigfield.test.cpp | 2 +- .../stdlib/primitives/composers/composers.hpp | 2 +- .../primitives/composers/composers_fwd.hpp | 2 - .../stdlib/primitives/field/field.hpp | 2 +- 46 files changed, 324 insertions(+), 292 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp create mode 100644 barretenberg/cpp/src/barretenberg/honk/flavor/flavor.test.cpp rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/composer_helper/standard_plonk_composer_helper.cpp (98%) rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/composer_helper/standard_plonk_composer_helper.hpp (97%) rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/composer_helper/turbo_plonk_composer_helper.cpp (97%) rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/composer_helper/turbo_plonk_composer_helper.hpp (98%) rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/standard_plonk_composer.hpp (98%) rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/standard_plonk_composer.test.cpp (96%) rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/turbo_plonk_composer.hpp (99%) rename barretenberg/cpp/src/barretenberg/{honk/composer => plonk/composer/splitting_tmp}/turbo_plonk_composer.test.cpp (97%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/circuit_constructor_base.cpp (100%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/circuit_constructor_base.hpp (100%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/standard_circuit_constructor.cpp (100%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/standard_circuit_constructor.hpp (100%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/standard_circuit_constructor.test.cpp (100%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/turbo_circuit_constructor.cpp (100%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/turbo_circuit_constructor.hpp (100%) rename barretenberg/cpp/src/barretenberg/{honk => proof_system}/circuit_constructors/turbo_circuit_constructor.test.cpp (100%) rename barretenberg/cpp/src/barretenberg/{honk/composer/composer_helper => proof_system/composer}/composer_helper_lib.cpp (98%) rename barretenberg/cpp/src/barretenberg/{honk/composer/composer_helper => proof_system/composer}/composer_helper_lib.hpp (100%) rename barretenberg/cpp/src/barretenberg/{honk/composer/composer_helper => proof_system/composer}/permutation_helper.hpp (99%) diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp index 2c89d6a7d8f..a16827d4886 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp @@ -1,6 +1,6 @@ #include "standard_honk_composer_helper.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp index 394509571fb..ed776170bfc 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp @@ -5,13 +5,13 @@ #include "barretenberg/proof_system/proving_key/proving_key.hpp" #include "barretenberg/honk/proof_system/prover.hpp" #include "barretenberg/honk/proof_system/verifier.hpp" -#include "barretenberg/honk/circuit_constructors/standard_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" #include "barretenberg/proof_system/composer/composer_base.hpp" -#include "composer_helper_lib.hpp" -#include "permutation_helper.hpp" +#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/proof_system/composer/permutation_helper.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp index ec3cbb9ee04..b64615d6a40 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp @@ -1,10 +1,10 @@ #pragma once #include "composer_helper/standard_honk_composer_helper.hpp" -#include "barretenberg/honk/circuit_constructors/standard_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" #include "barretenberg/transcript/manifest.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" namespace honk { /** diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp index 2913d3c1d07..c8e46024be0 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp @@ -1,7 +1,7 @@ #include "standard_honk_composer.hpp" #include "barretenberg/honk/sumcheck/relations/relation.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include #include "barretenberg/honk/proof_system/prover.hpp" #include "barretenberg/honk/sumcheck/sumcheck_round.hpp" @@ -347,7 +347,7 @@ TEST(StandardHonkComposer, SumcheckRelationCorrectness) .public_input_delta = public_input_delta, }; - constexpr size_t num_polynomials = bonk::StandardArithmetization::NUM_POLYNOMIALS; + constexpr size_t num_polynomials = honk::StandardArithmetization::NUM_POLYNOMIALS; // Compute grand product polynomial (now all the necessary polynomials are inside the proving key) polynomial z_perm_poly = prover.compute_grand_product_polynomial(beta, gamma); @@ -357,7 +357,7 @@ TEST(StandardHonkComposer, SumcheckRelationCorrectness) // in the list below std::array, num_polynomials> evaluations_array; - using POLYNOMIAL = bonk::StandardArithmetization::POLYNOMIAL; + using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; evaluations_array[POLYNOMIAL::W_L] = prover.wire_polynomials[0]; evaluations_array[POLYNOMIAL::W_R] = prover.wire_polynomials[1]; evaluations_array[POLYNOMIAL::W_O] = prover.wire_polynomials[2]; diff --git a/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp new file mode 100644 index 00000000000..1f004b548f8 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp @@ -0,0 +1,188 @@ +#pragma once +#include +#include +#include "barretenberg/common/log.hpp" +#include "barretenberg/transcript/manifest.hpp" + +namespace honk { +// TODO(Cody) This _should_ be shared with Plonk, but it isn't. +struct StandardArithmetization { + /** + * @brief All of the multivariate polynomials used by the Standard Honk Prover. + * @details The polynomials are broken into three categories: precomputed, witness, and shifted. + * This separation must be maintained to allow for programmatic access, but the ordering of the + * polynomials can be permuted within each category if necessary. Polynomials can also be added + * or removed (assuming consistency with the prover algorithm) but the constants describing the + * number of poynomials in each category must be manually updated. + * + */ + enum POLYNOMIAL { + /* --- PRECOMPUTED POLYNOMIALS --- */ + Q_C, + Q_L, + Q_R, + Q_O, + Q_M, + SIGMA_1, + SIGMA_2, + SIGMA_3, + ID_1, + ID_2, + ID_3, + LAGRANGE_FIRST, + LAGRANGE_LAST, // = LAGRANGE_N-1 whithout ZK, but can be less + /* --- WITNESS POLYNOMIALS --- */ + W_L, + W_R, + W_O, + Z_PERM, + /* --- SHIFTED POLYNOMIALS --- */ + Z_PERM_SHIFT, + /* --- --- */ + COUNT // for programmatic determination of NUM_POLYNOMIALS + }; + + static constexpr size_t NUM_POLYNOMIALS = POLYNOMIAL::COUNT; + static constexpr size_t NUM_SHIFTED_POLYNOMIALS = 1; + static constexpr size_t NUM_PRECOMPUTED_POLYNOMIALS = 13; + static constexpr size_t NUM_UNSHIFTED_POLYNOMIALS = NUM_POLYNOMIALS - NUM_SHIFTED_POLYNOMIALS; + + // *** WARNING: The order of this array must be manually updated to match POLYNOMIAL enum *** + // TODO(luke): This is a temporary measure to associate the above enum with sting tags. Its only needed because + // the + // polynomials/commitments in the prover/verifier are stored in maps. This storage could be converted to simple + // arrays at which point these string tags can be removed. + inline static const std::array ENUM_TO_COMM = { + "Q_C", "Q_1", "Q_2", "Q_3", "Q_M", "SIGMA_1", + "SIGMA_2", "SIGMA_3", "ID_1", "ID_2", "ID_3", "LAGRANGE_FIRST", + "LAGRANGE_LAST", "W_1", "W_2", "W_3", "Z_PERM", "Z_PERM_SHIFT" + }; +}; +} // namespace honk + +namespace honk { +struct StandardHonk { + public: + using Arithmetization = honk::StandardArithmetization; + using MULTIVARIATE = Arithmetization::POLYNOMIAL; + // // TODO(Cody): Where to specify? is this polynomial manifest size? + // static constexpr size_t STANDARD_HONK_MANIFEST_SIZE = 16; + // TODO(Cody): Maybe relation should be supplied and this should be computed as is done in sumcheck? + // Then honk::StandardHonk (or whatever we rename it) would become an alias for a Honk flavor with a + // certain set of parameters, including the relations? + static constexpr size_t MAX_RELATION_LENGTH = 5; + + // TODO(Cody): should extract this from the parameter pack. Maybe that should be done here? + + // num_sumcheck_rounds = 1 if using quotient polynomials, otherwise = number of sumcheck rounds + static transcript::Manifest create_manifest(const size_t num_public_inputs, const size_t num_sumcheck_rounds = 1) + { + constexpr size_t g1_size = 64; + constexpr size_t fr_size = 32; + const size_t public_input_size = fr_size * num_public_inputs; + // clang-format off + /* A RoundManifest describes data that will be put in or extracted from a transcript. + Here we have (1 + 7 + num_sumcheck_rounds)-many RoundManifests. */ + std::vector manifest_rounds; + + // Round 0 + manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( + { + { .name = "circuit_size", .num_bytes = 4, .derived_by_verifier = true }, + { .name = "public_input_size", .num_bytes = 4, .derived_by_verifier = true } + }, + /* challenge_name = */ "init", + /* num_challenges_in = */ 1)); + + // Round 1 + manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( + { /* this is a noop */ }, + /* challenge_name = */ "eta", + /* num_challenges_in = */ 0)); + + // Round 2 + manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( + { + { .name = "public_inputs", .num_bytes = public_input_size, .derived_by_verifier = false }, + { .name = "W_1", .num_bytes = g1_size, .derived_by_verifier = false }, + { .name = "W_2", .num_bytes = g1_size, .derived_by_verifier = false }, + { .name = "W_3", .num_bytes = g1_size, .derived_by_verifier = false }, + }, + /* challenge_name = */ "beta", + /* num_challenges_in = */ 2) // also produce "gamma" + ); + + // Round 3 + manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( + { { .name = "Z_PERM", .num_bytes = g1_size, .derived_by_verifier = false } }, + /* challenge_name = */ "alpha", + /* num_challenges_in = */ 2) + ); + + // Rounds 4, ... 4 + num_sumcheck_rounds-1 + for (size_t i = 0; i < num_sumcheck_rounds; i++) { + auto label = std::to_string(i); + manifest_rounds.emplace_back( + transcript::Manifest::RoundManifest( + { + { .name = "univariate_" + label, .num_bytes = fr_size * honk::StandardHonk::MAX_RELATION_LENGTH, .derived_by_verifier = false } + }, + /* challenge_name = */ "u_" + label, + /* num_challenges_in = */ 1)); + } + + // Round 5 + num_sumcheck_rounds + manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( + { + { .name = "multivariate_evaluations", .num_bytes = fr_size * honk::StandardArithmetization::NUM_POLYNOMIALS, .derived_by_verifier = false, .challenge_map_index = 0 }, + }, + /* challenge_name = */ "rho", + /* num_challenges_in = */ 1)); /* TODO(Cody): magic number! Where should this be specified? */ + + // Rounds 6 + num_sumcheck_rounds, ... , 6 + 2 * num_sumcheck_rounds - 1 + std::vector fold_commitment_entries; + for (size_t i = 1; i < num_sumcheck_rounds; i++) { + fold_commitment_entries.emplace_back(transcript::Manifest::ManifestEntry( + { .name = "FOLD_" + std::to_string(i), .num_bytes = g1_size, .derived_by_verifier = false })); + }; + manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( + fold_commitment_entries, + /* challenge_name = */ "r", + /* num_challenges_in */ 1)); + + // Rounds 6 + 2 * num_sumcheck_rounds, ..., 6 + 3 * num_sumcheck_rounds + std::vector gemini_evaluation_entries; + for (size_t i = 0; i < num_sumcheck_rounds; i++) { + gemini_evaluation_entries.emplace_back(transcript::Manifest::ManifestEntry( + { .name = "a_" + std::to_string(i), .num_bytes = fr_size, .derived_by_verifier = false })); + }; + manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( + gemini_evaluation_entries, + /* challenge_name = */ "nu", + /* num_challenges_in */ 1)); + + // Round 7 + 3 * num_sumcheck_rounds + manifest_rounds.emplace_back( + transcript::Manifest::RoundManifest( + { + { .name = "Q", .num_bytes = g1_size, .derived_by_verifier = false } + }, + /* challenge_name = */ "z", + /* num_challenges_in */ 1)); + + // Round 8 + 3 * num_sumcheck_rounds + manifest_rounds.emplace_back( + transcript::Manifest::RoundManifest( + { + { .name = "W", .num_bytes = g1_size, .derived_by_verifier = false } + }, + /* challenge_name = */ "separator", + /* num_challenges_in */ 1)); + + // clang-format on + + auto output = transcript::Manifest(manifest_rounds); + return output; + } +}; +} // namespace honk diff --git a/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.test.cpp b/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.test.cpp new file mode 100644 index 00000000000..06accb92651 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.test.cpp @@ -0,0 +1,30 @@ +#include "flavor.hpp" + +#include + +namespace test_flavor { + +// // TODO(Cody) This seems like a good idea, but I'm not sure why. +// TEST(Flavor, StandardArithmetization){ +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::W_L, 0); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::W_R, 1); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::W_O, 2); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::Z_PERM, 3); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::Z_PERM_SHIFT, 4); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::Q_M, 5); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::Q_L, 6); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::Q_R, 7); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::Q_O, 8); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::Q_C, 9); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::SIGMA_1, 10); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::SIGMA_2, 11); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::SIGMA_3, 12); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::ID_1, 13); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::ID_2, 14); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::ID_3, 15); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::LAGRANGE_FIRST, 16); +// EXPECT_EQ(StandardArithmetization::MULTIVARIATE::COUNT, 17); + +// } + +} // namespace test_flavor diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp index 224ad1e2995..44083817fd7 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp @@ -4,7 +4,7 @@ #include "../../transcript/transcript_wrappers.hpp" #include "../../plonk/proof_system/types/prover_settings.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" namespace honk { @@ -16,7 +16,7 @@ class standard_verifier_settings : public plonk::standard_settings { static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; static constexpr size_t program_width = 3; - static constexpr size_t num_polys = bonk::StandardArithmetization::NUM_POLYNOMIALS; + static constexpr size_t num_polys = honk::StandardArithmetization::NUM_POLYNOMIALS; }; } // namespace honk diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp index 7f13772c11f..5e719dfd17e 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp @@ -16,7 +16,7 @@ #include "barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp" #include "barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "barretenberg/transcript/transcript_wrappers.hpp" #include #include "barretenberg/honk/pcs/claim.hpp" @@ -26,7 +26,7 @@ namespace honk { using Fr = barretenberg::fr; using Commitment = barretenberg::g1::affine_element; using Polynomial = barretenberg::Polynomial; -using POLYNOMIAL = bonk::StandardArithmetization::POLYNOMIAL; +using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; /** * Create Prover from proving key, witness and manifest. @@ -288,8 +288,8 @@ template void Prover::execute_relation_check_round * */ template void Prover::execute_univariatization_round() { - const size_t NUM_POLYNOMIALS = bonk::StandardArithmetization::NUM_POLYNOMIALS; - const size_t NUM_UNSHIFTED_POLYS = bonk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; + const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; + const size_t NUM_UNSHIFTED_POLYS = honk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; // Generate batching challenge ρ and powers 1,ρ,…,ρᵐ⁻¹ Fr rho = transcript.get_challenge("rho"); diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp index b962c6c5b2b..97ad588e2b5 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp @@ -2,7 +2,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/honk/pcs/shplonk/shplonk.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include #include "barretenberg/proof_system/proving_key/proving_key.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" @@ -66,7 +66,7 @@ template class Prover { std::shared_ptr commitment_key; // Container for spans of all polynomials required by the prover (i.e. all multivariates evaluated by Sumcheck). - std::array, bonk::StandardArithmetization::POLYNOMIAL::COUNT> prover_polynomials; + std::array, honk::StandardArithmetization::POLYNOMIAL::COUNT> prover_polynomials; // Honk only needs a small portion of the functionality but may be fine to use existing work_queue // NOTE: this is not currently in use, but it may well be used in the future. diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp index a555c687de1..24cfecc6bb9 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp @@ -11,13 +11,13 @@ #include "barretenberg/honk/pcs/gemini/gemini.hpp" #include "barretenberg/honk/pcs/kzg/kzg.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "barretenberg/proof_system/polynomial_store/polynomial_store.hpp" #include "barretenberg/ecc/curves/bn254/fq12.hpp" #include "barretenberg/ecc/curves/bn254/pairing.hpp" #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" #include "barretenberg/polynomials/polynomial_arithmetic.hpp" -#include "barretenberg/honk/composer/composer_helper/permutation_helper.hpp" +#include "barretenberg/proof_system/composer/permutation_helper.hpp" #include #include #include @@ -83,9 +83,9 @@ template bool Verifier::verify_pro using Gemini = pcs::gemini::MultilinearReductionScheme; using Shplonk = pcs::shplonk::SingleBatchOpeningScheme; using KZG = pcs::kzg::UnivariateOpeningScheme; - const size_t NUM_POLYNOMIALS = bonk::StandardArithmetization::NUM_POLYNOMIALS; - const size_t NUM_UNSHIFTED = bonk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; - const size_t NUM_PRECOMPUTED = bonk::StandardArithmetization::NUM_PRECOMPUTED_POLYNOMIALS; + const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; + const size_t NUM_UNSHIFTED = honk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; + const size_t NUM_PRECOMPUTED = honk::StandardArithmetization::NUM_PRECOMPUTED_POLYNOMIALS; constexpr auto program_width = program_settings::program_width; @@ -165,7 +165,7 @@ template bool Verifier::verify_pro // Construct batched commitment for NON-shifted polynomials for (size_t i = 0; i < NUM_PRECOMPUTED; ++i) { - auto commitment = key->commitments[bonk::StandardArithmetization::ENUM_TO_COMM[i]]; + auto commitment = key->commitments[honk::StandardArithmetization::ENUM_TO_COMM[i]]; batched_commitment_unshifted += commitment * rhos[i]; } // add wire commitments diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp index 217dffb5b68..e4ef74d667b 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp @@ -7,7 +7,7 @@ #include "../sumcheck/sumcheck.hpp" #include "../sumcheck/relations/arithmetic_relation.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "barretenberg/honk/pcs/gemini/gemini.hpp" #include "barretenberg/honk/pcs/shplonk/shplonk_single.hpp" #include "barretenberg/honk/pcs/kzg/kzg.hpp" diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp index 1569723e90d..42689b9282d 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp @@ -1,7 +1,7 @@ #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "prover.hpp" #include "barretenberg/proof_system/proving_key/proving_key.hpp" #include "barretenberg/transcript/transcript.hpp" @@ -11,7 +11,7 @@ #include "barretenberg/srs/reference_string/file_reference_string.hpp" #include "barretenberg/polynomials/polynomial_arithmetic.hpp" #include "barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp" -#include "barretenberg/honk/composer/composer_helper/permutation_helper.hpp" +#include "barretenberg/proof_system/composer/permutation_helper.hpp" #include using namespace barretenberg; diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp index 8aaed7922eb..4bfd999bd4c 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp @@ -2,7 +2,7 @@ #include #include -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "../polynomials/univariate.hpp" #include "relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp index 9ba477f5c34..c2cab137ce1 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp @@ -1,6 +1,6 @@ #pragma once #include "relation.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "../polynomials/univariate.hpp" namespace honk::sumcheck { @@ -18,10 +18,11 @@ template class GrandProductComputationRelation { * This file handles the relation that confirms faithful calculation of the grand * product polynomial Z_perm. (Initialization relation Z_perm(0) = 1 is handled elsewhere). * - * C(extended_edges(X)...) = ( z_perm(X) + lagrange_first(X) )*P(X) - ( z_perm_shift(X) + delta * lagrange_last(X) )*Q(X), - * where - * P(X) = Prod_{i=1:3} w_i(X) + β*(n*(i-1) + idx(X)) + γ - * Q(X) = Prod_{i=1:3} w_i(X) + β*σ_i(X) + γ + * C(extended_edges(X)...) = + * ( z_perm(X) + lagrange_first(X) )*P(X) + * - ( z_perm_shift(X) + delta * lagrange_last(X))*Q(X), + * where P(X) = Prod_{i=1:3} w_i(X) + β*(n*(i-1) + idx(X)) + γ + * Q(X) = Prod_{i=1:3} w_i(X) + β*σ_i(X) + γ * * @param evals transformed to `evals + C(extended_edges(X)...)*scaling_factor` * @param extended_edges an std::array containing the fully extended Univariate edges. diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp index 9620cc3d37e..66853b2e23b 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp @@ -1,6 +1,6 @@ #pragma once #include "relation.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "../polynomials/univariate.hpp" namespace honk::sumcheck { diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp index 070cf142f77..8a2620badcb 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp @@ -1,5 +1,5 @@ #include "relation.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "arithmetic_relation.hpp" #include "grand_product_initialization_relation.hpp" #include "grand_product_computation_relation.hpp" @@ -23,7 +23,7 @@ using namespace honk::sumcheck; */ static const size_t input_univariate_length = 2; static constexpr size_t FULL_RELATION_LENGTH = 5; -static const size_t NUM_POLYNOMIALS = bonk::StandardArithmetization::NUM_POLYNOMIALS; +static const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; namespace honk_relation_tests { @@ -31,7 +31,7 @@ template class SumcheckRelation : public testing::Test { public: template using Univariate = Univariate; template using UnivariateView = UnivariateView; - using POLYNOMIAL = bonk::StandardArithmetization::POLYNOMIAL; + using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; // TODO(#225)(Adrian): Accept FULL_RELATION_LENGTH as a template parameter for this function only, so that the test // can decide to which degree the polynomials must be extended. Possible accept an existing list of "edges" and // extend them to the degree. @@ -173,7 +173,7 @@ TYPED_TEST_SUITE(SumcheckRelation, FieldTypes); TYPED_TEST(SumcheckRelation, ArithmeticRelation) { SUMCHECK_RELATION_TYPE_ALIASES - using MULTIVARIATE = bonk::StandardArithmetization::POLYNOMIAL; + using MULTIVARIATE = honk::StandardArithmetization::POLYNOMIAL; const auto relation_parameters = TestFixture::compute_mock_relation_parameters(); auto run_test = [&relation_parameters](bool is_random_input) { std::array, NUM_POLYNOMIALS> extended_edges; @@ -216,7 +216,7 @@ TYPED_TEST(SumcheckRelation, ArithmeticRelation) TYPED_TEST(SumcheckRelation, GrandProductComputationRelation) { SUMCHECK_RELATION_TYPE_ALIASES - using MULTIVARIATE = bonk::StandardArithmetization::POLYNOMIAL; + using MULTIVARIATE = honk::StandardArithmetization::POLYNOMIAL; const auto relation_parameters = TestFixture::compute_mock_relation_parameters(); auto run_test = [&relation_parameters](bool is_random_input) { std::array, NUM_POLYNOMIALS> extended_edges; @@ -278,7 +278,7 @@ TYPED_TEST(SumcheckRelation, GrandProductComputationRelation) TYPED_TEST(SumcheckRelation, GrandProductInitializationRelation) { SUMCHECK_RELATION_TYPE_ALIASES - using MULTIVARIATE = bonk::StandardArithmetization::POLYNOMIAL; + using MULTIVARIATE = honk::StandardArithmetization::POLYNOMIAL; const auto relation_parameters = TestFixture::compute_mock_relation_parameters(); auto run_test = [&relation_parameters](bool is_random_input) { std::array, NUM_POLYNOMIALS> extended_edges; diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp index 0dad08391d5..b96bd99d67a 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp @@ -7,7 +7,7 @@ #include "barretenberg/common/throw_or_abort.hpp" #include "sumcheck_round.hpp" #include "polynomials/univariate.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include #include #include @@ -23,7 +23,7 @@ template class... Relations> cl public: static constexpr size_t MAX_RELATION_LENGTH = std::max({ Relations::RELATION_LENGTH... }); - static constexpr size_t NUM_POLYNOMIALS = bonk::StandardArithmetization::NUM_POLYNOMIALS; + static constexpr size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; std::array purported_evaluations; Transcript& transcript; diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp index b36dc8d504e..9f3092c5be1 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp @@ -1,6 +1,6 @@ #include "sumcheck.hpp" #include "barretenberg/honk/transcript/transcript.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "barretenberg/transcript/transcript_wrappers.hpp" #include "relations/arithmetic_relation.hpp" #include "relations/grand_product_computation_relation.hpp" @@ -23,8 +23,8 @@ using namespace honk; using namespace honk::sumcheck; using FF = barretenberg::fr; -const size_t NUM_POLYNOMIALS = bonk::StandardArithmetization::NUM_POLYNOMIALS; -using POLYNOMIAL = bonk::StandardArithmetization::POLYNOMIAL; +const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; +using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; namespace test_sumcheck_round { diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp index b10b5b4ac8f..ab47f20e6c0 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp @@ -12,7 +12,7 @@ template struct SumcheckOutput { // u = (u_0, ..., u_{d-1}) std::vector challenge_point; // Evaluations in `u` of the polynomials used in Sumcheck - std::array evaluations; + std::array evaluations; bool operator==(const SumcheckOutput& other) const = default; }; diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp index eac7240906c..f0129c1061b 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/honk/flavor/flavor.hpp" #include "sumcheck_round.hpp" #include "relations/arithmetic_relation.hpp" #include "relations/grand_product_computation_relation.hpp" @@ -24,8 +24,8 @@ using namespace honk::sumcheck; const size_t max_relation_length = 5; const size_t input_polynomial_length = 2; using FF = barretenberg::fr; -const size_t NUM_POLYNOMIALS = bonk::StandardArithmetization::NUM_POLYNOMIALS; -using POLYNOMIAL = bonk::StandardArithmetization::POLYNOMIAL; +const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; +using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; namespace test_sumcheck_round { /** diff --git a/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp b/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp index bbd487cf0a5..5b333622ddb 100644 --- a/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp @@ -3,8 +3,6 @@ #include "barretenberg/honk/composer/standard_honk_composer.hpp" #include "barretenberg/honk/sumcheck/polynomials/univariate.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" -// #include "standard_honk_composer.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_plonk_composer_helper.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_plonk_composer_helper.cpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp index 6bd7c532d90..6205c0d9b1f 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_plonk_composer_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp @@ -1,6 +1,5 @@ #include "standard_plonk_composer_helper.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/flavor/flavor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp" @@ -11,7 +10,7 @@ #include #include -namespace bonk { +namespace plonk { /** * Compute witness polynomials (w_1, w_2, w_3, w_4). @@ -173,4 +172,4 @@ plonk::Prover StandardPlonkComposerHelper::create_prover( } template class StandardPlonkComposerHelper; -} // namespace bonk +} // namespace plonk diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_plonk_composer_helper.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp similarity index 97% rename from barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_plonk_composer_helper.hpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp index df366c7ff3f..1fdacd7aeec 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_plonk_composer_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp @@ -4,16 +4,16 @@ #include "barretenberg/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -#include "barretenberg/honk/circuit_constructors/standard_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -#include "composer_helper_lib.hpp" -#include "permutation_helper.hpp" +#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/proof_system/composer/permutation_helper.hpp" #include -namespace bonk { +namespace plonk { // TODO(Kesha): change initializations to specify this parameter // Cody: What does this mean? template class StandardPlonkComposerHelper { @@ -171,4 +171,4 @@ template class StandardPlonkComposerHelper { } }; -} // namespace honk +} // namespace plonk diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/turbo_plonk_composer_helper.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp similarity index 97% rename from barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/turbo_plonk_composer_helper.cpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp index 7c62536d4d2..2a28ffd2047 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/turbo_plonk_composer_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp @@ -1,5 +1,5 @@ #include "turbo_plonk_composer_helper.hpp" -#include "barretenberg/honk/circuit_constructors/turbo_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp" #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp" @@ -10,10 +10,10 @@ #include "barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp" #include "barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp" #include "barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp" -#include "permutation_helper.hpp" +#include "barretenberg/proof_system/composer/permutation_helper.hpp" using namespace barretenberg; -namespace bonk { +namespace plonk { /** * Compute proving key @@ -177,4 +177,4 @@ plonk::TurboVerifier TurboPlonkComposerHelper::create_verifi } template class TurboPlonkComposerHelper; -} // namespace bonk +} // namespace plonk diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/turbo_plonk_composer_helper.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/turbo_plonk_composer_helper.hpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp index 60c9355aacd..94920b20464 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/turbo_plonk_composer_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp @@ -1,12 +1,12 @@ #pragma once -#include "composer_helper_lib.hpp" +#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" #include "barretenberg/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -namespace bonk { +namespace plonk { template class TurboPlonkComposerHelper { public: static constexpr size_t NUM_RANDOMIZED_GATES = 2; // equal to the number of multilinear evaluations leaked @@ -132,4 +132,4 @@ template class TurboPlonkComposerHelper { return output; } }; -} // namespace bonk +} // namespace plonk diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/standard_plonk_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/honk/composer/standard_plonk_composer.hpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp index 99321393542..3379c7995c6 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/standard_plonk_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp @@ -1,7 +1,7 @@ #pragma once #include "composer_helper/standard_plonk_composer_helper.hpp" -#include "barretenberg/honk/circuit_constructors/standard_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/standard_plonk_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/honk/composer/standard_plonk_composer.test.cpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp index 9241c94fa58..d371578b523 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/standard_plonk_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp @@ -11,7 +11,7 @@ namespace { auto& engine = numeric::random::get_debug_engine(); } -TEST(standard_composer, base_case) +TEST(standard_plonk_composer_splitting_tmp, base_case) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); fr a = fr::one(); @@ -25,7 +25,7 @@ TEST(standard_composer, base_case) EXPECT_EQ(result, true); } -TEST(standard_composer, composer_from_serialized_keys) +TEST(standard_plonk_composer_splitting_tmp, composer_from_serialized_keys) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); fr a = fr::one(); @@ -53,7 +53,7 @@ TEST(standard_composer, composer_from_serialized_keys) EXPECT_EQ(result, true); } -TEST(standard_composer, test_add_gate_proofs) +TEST(standard_plonk_composer_splitting_tmp, test_add_gate_proofs) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); fr a = fr::one(); @@ -112,7 +112,7 @@ TEST(standard_composer, test_add_gate_proofs) EXPECT_EQ(result, true); } -TEST(standard_composer, test_mul_gate_proofs) +TEST(standard_plonk_composer_splitting_tmp, test_mul_gate_proofs) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); fr q[7]{ fr::random_element(), fr::random_element(), fr::random_element(), fr::random_element(), @@ -191,7 +191,7 @@ TEST(standard_composer, test_mul_gate_proofs) EXPECT_EQ(result, true); } -TEST(standard_composer, range_constraint) +TEST(standard_plonk_composer_splitting_tmp, range_constraint) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); @@ -234,7 +234,7 @@ TEST(standard_composer, range_constraint) EXPECT_EQ(result, true); } -TEST(standard_composer, range_constraint_fail) +TEST(standard_plonk_composer_splitting_tmp, range_constraint_fail) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); @@ -254,7 +254,7 @@ TEST(standard_composer, range_constraint_fail) EXPECT_EQ(result, false); } -TEST(standard_composer, and_constraint) +TEST(standard_plonk_composer_splitting_tmp, and_constraint) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); @@ -325,7 +325,7 @@ TEST(standard_composer, and_constraint) EXPECT_EQ(result, true); } -TEST(standard_composer, xor_constraint) +TEST(standard_plonk_composer_splitting_tmp, xor_constraint) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); @@ -395,7 +395,7 @@ TEST(standard_composer, xor_constraint) EXPECT_EQ(result, true); } -TEST(standard_composer, big_add_gate_with_bit_extract) +TEST(standard_plonk_composer_splitting_tmp, big_add_gate_with_bit_extract) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); @@ -439,7 +439,7 @@ TEST(standard_composer, big_add_gate_with_bit_extract) EXPECT_EQ(result, true); } -TEST(standard_composer, test_range_constraint_fail) +TEST(standard_plonk_composer_splitting_tmp, test_range_constraint_fail) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); uint32_t witness_index = composer.add_variable(fr::neg_one()); @@ -456,7 +456,7 @@ TEST(standard_composer, test_range_constraint_fail) EXPECT_EQ(result, false); } -TEST(standard_composer, test_check_circuit_correct) +TEST(standard_plonk_composer_splitting_tmp, test_check_circuit_correct) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); fr a = fr::one(); @@ -476,7 +476,7 @@ TEST(standard_composer, test_check_circuit_correct) EXPECT_EQ(result, true); } -TEST(standard_composer, test_check_circuit_broken) +TEST(standard_plonk_composer_splitting_tmp, test_check_circuit_broken) { plonk::StandardPlonkComposer composer = plonk::StandardPlonkComposer(); fr a = fr::one(); diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/turbo_plonk_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/honk/composer/turbo_plonk_composer.hpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp index 6f79cbaa71d..985e5529e21 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/turbo_plonk_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp @@ -1,6 +1,6 @@ #pragma once #include "composer_helper/turbo_plonk_composer_helper.hpp" -#include "barretenberg/honk/circuit_constructors/turbo_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp" using namespace bonk; namespace plonk { /** diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/turbo_plonk_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp similarity index 97% rename from barretenberg/cpp/src/barretenberg/honk/composer/turbo_plonk_composer.test.cpp rename to barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp index 9a336c34729..24ac9a02beb 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/turbo_plonk_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp @@ -10,7 +10,7 @@ using namespace crypto::pedersen; namespace { auto& engine = numeric::random::get_debug_engine(); } -TEST(turbo_plonk_composer, base_case) +TEST(turbo_plonk_composer_splitting_tmp, base_case) { TurboPlonkComposer composer = TurboPlonkComposer(); fr a = fr::one(); @@ -25,7 +25,7 @@ TEST(turbo_plonk_composer, base_case) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, composer_from_serialized_keys) +TEST(turbo_plonk_composer_splitting_tmp, composer_from_serialized_keys) { TurboPlonkComposer composer = TurboPlonkComposer(); fr a = fr::one(); @@ -53,7 +53,7 @@ TEST(turbo_plonk_composer, composer_from_serialized_keys) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, test_add_gate_proofs) +TEST(turbo_plonk_composer_splitting_tmp, test_add_gate_proofs) { TurboPlonkComposer composer = TurboPlonkComposer(); fr a = fr::one(); @@ -116,7 +116,7 @@ TEST(turbo_plonk_composer, test_add_gate_proofs) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, test_mul_gate_proofs) +TEST(turbo_plonk_composer_splitting_tmp, test_mul_gate_proofs) { TurboPlonkComposer composer = TurboPlonkComposer(); fr q[7]{ fr::random_element(), fr::random_element(), fr::random_element(), fr::random_element(), @@ -203,7 +203,7 @@ TEST(turbo_plonk_composer, test_mul_gate_proofs) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, small_scalar_multipliers) +TEST(turbo_plonk_composer_splitting_tmp, small_scalar_multipliers) { constexpr size_t num_bits = 63; constexpr size_t num_quads_base = (num_bits - 1) >> 1; @@ -332,7 +332,7 @@ TEST(turbo_plonk_composer, small_scalar_multipliers) free(accumulator_transcript); } -TEST(turbo_plonk_composer, large_scalar_multipliers) +TEST(turbo_plonk_composer_splitting_tmp, large_scalar_multipliers) { constexpr size_t num_bits = 254; constexpr size_t num_quads_base = (num_bits - 1) >> 1; @@ -464,7 +464,7 @@ TEST(turbo_plonk_composer, large_scalar_multipliers) free(accumulator_transcript); } -TEST(turbo_plonk_composer, range_constraint) +TEST(turbo_plonk_composer_splitting_tmp, range_constraint) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -508,7 +508,7 @@ TEST(turbo_plonk_composer, range_constraint) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, range_constraint_fail) +TEST(turbo_plonk_composer_splitting_tmp, range_constraint_fail) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -532,7 +532,7 @@ TEST(turbo_plonk_composer, range_constraint_fail) * @brief Test that the `AND` constraint fails when constraining too few bits. * */ -TEST(turbo_plonk_composer, and_constraint_failure) +TEST(turbo_plonk_composer_splitting_tmp, and_constraint_failure) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -562,7 +562,7 @@ TEST(turbo_plonk_composer, and_constraint_failure) EXPECT_EQ(result, false); } -TEST(turbo_plonk_composer, and_constraint) +TEST(turbo_plonk_composer_splitting_tmp, and_constraint) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -637,7 +637,7 @@ TEST(turbo_plonk_composer, and_constraint) * @brief Test that the `XOR` constraint fails when constraining too few bits. * */ -TEST(turbo_plonk_composer, xor_constraint_failure) +TEST(turbo_plonk_composer_splitting_tmp, xor_constraint_failure) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -667,7 +667,7 @@ TEST(turbo_plonk_composer, xor_constraint_failure) EXPECT_EQ(result, false); } -TEST(turbo_plonk_composer, xor_constraint) +TEST(turbo_plonk_composer_splitting_tmp, xor_constraint) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -737,7 +737,7 @@ TEST(turbo_plonk_composer, xor_constraint) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, big_add_gate_with_bit_extract) +TEST(turbo_plonk_composer_splitting_tmp, big_add_gate_with_bit_extract) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -781,7 +781,7 @@ TEST(turbo_plonk_composer, big_add_gate_with_bit_extract) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, validate_copy_constraints) +TEST(turbo_plonk_composer_splitting_tmp, validate_copy_constraints) { for (size_t m = 0; m < 2; ++m) { for (size_t k = 0; k < 4; ++k) { @@ -851,7 +851,7 @@ TEST(turbo_plonk_composer, validate_copy_constraints) } } -TEST(turbo_plonk_composer, test_check_circuit_add_gate_proofs_correct) +TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_add_gate_proofs_correct) { TurboPlonkComposer composer = TurboPlonkComposer(); fr a = fr::one(); @@ -876,7 +876,7 @@ TEST(turbo_plonk_composer, test_check_circuit_add_gate_proofs_correct) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, test_check_circuit_add_gate_proofs_broken) +TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_add_gate_proofs_broken) { TurboPlonkComposer composer = TurboPlonkComposer(); fr a = fr::one(); @@ -900,7 +900,7 @@ TEST(turbo_plonk_composer, test_check_circuit_add_gate_proofs_broken) bool result = composer.check_circuit(); EXPECT_EQ(result, false); } -TEST(turbo_plonk_composer, test_check_circuit_mul_gate_proofs_correct) +TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_mul_gate_proofs_correct) { TurboPlonkComposer composer = TurboPlonkComposer(); fr q[7]{ fr::random_element(), fr::random_element(), fr::random_element(), fr::random_element(), @@ -935,7 +935,7 @@ TEST(turbo_plonk_composer, test_check_circuit_mul_gate_proofs_correct) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, test_check_circuit_mul_gate_proofs_broken) +TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_mul_gate_proofs_broken) { TurboPlonkComposer composer = TurboPlonkComposer(); fr q[7]{ fr::random_element(), fr::random_element(), fr::random_element(), fr::random_element(), @@ -969,7 +969,7 @@ TEST(turbo_plonk_composer, test_check_circuit_mul_gate_proofs_broken) EXPECT_EQ(result, false); } -TEST(turbo_plonk_composer, test_check_circuit_fixed_group) +TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_fixed_group) { constexpr size_t num_bits = 254; constexpr size_t num_quads_base = (num_bits - 1) >> 1; @@ -1095,7 +1095,7 @@ TEST(turbo_plonk_composer, test_check_circuit_fixed_group) free(accumulator_transcript); } -TEST(turbo_plonk_composer, test_check_circuit_range_constraint) +TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_range_constraint) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -1121,7 +1121,7 @@ TEST(turbo_plonk_composer, test_check_circuit_range_constraint) EXPECT_EQ(result, true); } -TEST(turbo_plonk_composer, test_check_circuit_xor) +TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_xor) { TurboPlonkComposer composer = TurboPlonkComposer(); diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp index 828897a4954..56fb3ae1f9e 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp @@ -8,6 +8,7 @@ namespace transcript { class Transcript; } +// TODO(Cody) Fix this namespace. namespace bonk { struct proving_key; diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/circuit_constructor_base.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/circuit_constructor_base.cpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/circuit_constructor_base.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/circuit_constructor_base.hpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/standard_circuit_constructor.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/standard_circuit_constructor.cpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/standard_circuit_constructor.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/standard_circuit_constructor.hpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/standard_circuit_constructor.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.test.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/standard_circuit_constructor.test.cpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.test.cpp diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/turbo_circuit_constructor.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/turbo_circuit_constructor.cpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.cpp diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/turbo_circuit_constructor.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/turbo_circuit_constructor.hpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp diff --git a/barretenberg/cpp/src/barretenberg/honk/circuit_constructors/turbo_circuit_constructor.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/circuit_constructors/turbo_circuit_constructor.test.cpp rename to barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/composer_helper_lib.cpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.cpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/composer_helper_lib.cpp rename to barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.cpp index 8cbf8df51f7..25742b90617 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/composer_helper_lib.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.cpp @@ -6,8 +6,8 @@ */ #include "composer_helper_lib.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/honk/circuit_constructors/standard_circuit_constructor.hpp" -#include "barretenberg/honk/circuit_constructors/turbo_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" +#include "barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp" namespace bonk { /** diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/composer_helper_lib.hpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/composer_helper_lib.hpp rename to barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/permutation_helper.hpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/permutation_helper.hpp rename to barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp index 92bf892055c..9a1288c816f 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/permutation_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp @@ -226,8 +226,7 @@ void compute_honk_style_sigma_lagrange_polynomials_from_mapping( std::string index = std::to_string(j + 1); key->polynomial_store.put("sigma_" + index + "_lagrange", std::move(sigma[j])); } - -} // namespace honk +} /** * Compute sigma permutation polynomial in lagrange base diff --git a/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp index e7047e1e732..c9e8bb6aff6 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/flavor/flavor.hpp @@ -5,186 +5,4 @@ #include "barretenberg/transcript/manifest.hpp" #define STANDARD_WIDTH 3 -#define TURBO_WIDTH 4 -// TODO(Cody): "bonk" is short for "both plonk and honk". Just need a short and non-vague temporary name. -namespace bonk { -struct StandardArithmetization { - /** - * @brief All of the multivariate polynomials used by the Standard Honk Prover. - * @details The polynomials are broken into three categories: precomputed, witness, and shifted. - * This separation must be maintained to allow for programmatic access, but the ordering of the - * polynomials can be permuted within each category if necessary. Polynomials can also be added - * or removed (assuming consistency with the prover algorithm) but the constants describing the - * number of poynomials in each category must be manually updated. - * - */ - enum POLYNOMIAL { - /* --- PRECOMPUTED POLYNOMIALS --- */ - Q_C, - Q_L, - Q_R, - Q_O, - Q_M, - SIGMA_1, - SIGMA_2, - SIGMA_3, - ID_1, - ID_2, - ID_3, - LAGRANGE_FIRST, - LAGRANGE_LAST, // = LAGRANGE_N-1 whithout ZK, but can be less - /* --- WITNESS POLYNOMIALS --- */ - W_L, - W_R, - W_O, - Z_PERM, - /* --- SHIFTED POLYNOMIALS --- */ - Z_PERM_SHIFT, - /* --- --- */ - COUNT // for programmatic determination of NUM_POLYNOMIALS - }; - - static constexpr size_t NUM_POLYNOMIALS = POLYNOMIAL::COUNT; - static constexpr size_t NUM_SHIFTED_POLYNOMIALS = 1; - static constexpr size_t NUM_PRECOMPUTED_POLYNOMIALS = 13; - static constexpr size_t NUM_UNSHIFTED_POLYNOMIALS = NUM_POLYNOMIALS - NUM_SHIFTED_POLYNOMIALS; - - // *** WARNING: The order of this array must be manually updated to match POLYNOMIAL enum *** - // TODO(luke): This is a temporary measure to associate the above enum with sting tags. Its only needed because - // the - // polynomials/commitments in the prover/verifier are stored in maps. This storage could be converted to simple - // arrays at which point these string tags can be removed. - inline static const std::array ENUM_TO_COMM = { - "Q_C", "Q_1", "Q_2", "Q_3", "Q_M", "SIGMA_1", - "SIGMA_2", "SIGMA_3", "ID_1", "ID_2", "ID_3", "LAGRANGE_FIRST", - "LAGRANGE_LAST", "W_1", "W_2", "W_3", "Z_PERM", "Z_PERM_SHIFT" - }; -}; -} // namespace bonk - -namespace honk { -struct StandardHonk { - public: - using Arithmetization = bonk::StandardArithmetization; - using MULTIVARIATE = Arithmetization::POLYNOMIAL; - // // TODO(Cody): Where to specify? is this polynomial manifest size? - // static constexpr size_t STANDARD_HONK_MANIFEST_SIZE = 16; - // TODO(Cody): Maybe relation should be supplied and this should be computed as is done in sumcheck? - // Then honk::StandardHonk (or whatever we rename it) would become an alias for a Honk flavor with a - // certain set of parameters, including the relations? - static constexpr size_t MAX_RELATION_LENGTH = 5; - - // TODO(Cody): should extract this from the parameter pack. Maybe that should be done here? - - // num_sumcheck_rounds = 1 if using quotient polynomials, otherwise = number of sumcheck rounds - static transcript::Manifest create_manifest(const size_t num_public_inputs, const size_t num_sumcheck_rounds = 1) - { - constexpr size_t g1_size = 64; - constexpr size_t fr_size = 32; - const size_t public_input_size = fr_size * num_public_inputs; - // clang-format off - /* A RoundManifest describes data that will be put in or extracted from a transcript. - Here we have (1 + 7 + num_sumcheck_rounds)-many RoundManifests. */ - std::vector manifest_rounds; - - // Round 0 - manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( - { - { .name = "circuit_size", .num_bytes = 4, .derived_by_verifier = true }, - { .name = "public_input_size", .num_bytes = 4, .derived_by_verifier = true } - }, - /* challenge_name = */ "init", - /* num_challenges_in = */ 1)); - - // Round 1 - manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( - { /* this is a noop */ }, - /* challenge_name = */ "eta", - /* num_challenges_in = */ 0)); - - // Round 2 - manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( - { - { .name = "public_inputs", .num_bytes = public_input_size, .derived_by_verifier = false }, - { .name = "W_1", .num_bytes = g1_size, .derived_by_verifier = false }, - { .name = "W_2", .num_bytes = g1_size, .derived_by_verifier = false }, - { .name = "W_3", .num_bytes = g1_size, .derived_by_verifier = false }, - }, - /* challenge_name = */ "beta", - /* num_challenges_in = */ 2) // also produce "gamma" - ); - - // Round 3 - manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( - { { .name = "Z_PERM", .num_bytes = g1_size, .derived_by_verifier = false } }, - /* challenge_name = */ "alpha", - /* num_challenges_in = */ 2) - ); - - // Rounds 4, ... 4 + num_sumcheck_rounds-1 - for (size_t i = 0; i < num_sumcheck_rounds; i++) { - auto label = std::to_string(i); - manifest_rounds.emplace_back( - transcript::Manifest::RoundManifest( - { - { .name = "univariate_" + label, .num_bytes = fr_size * honk::StandardHonk::MAX_RELATION_LENGTH, .derived_by_verifier = false } - }, - /* challenge_name = */ "u_" + label, - /* num_challenges_in = */ 1)); - } - - // Round 5 + num_sumcheck_rounds - manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( - { - { .name = "multivariate_evaluations", .num_bytes = fr_size * bonk::StandardArithmetization::NUM_POLYNOMIALS, .derived_by_verifier = false, .challenge_map_index = 0 }, - }, - /* challenge_name = */ "rho", - /* num_challenges_in = */ 1)); /* TODO(Cody): magic number! Where should this be specified? */ - - // Rounds 6 + num_sumcheck_rounds, ... , 6 + 2 * num_sumcheck_rounds - 1 - std::vector fold_commitment_entries; - for (size_t i = 1; i < num_sumcheck_rounds; i++) { - fold_commitment_entries.emplace_back(transcript::Manifest::ManifestEntry( - { .name = "FOLD_" + std::to_string(i), .num_bytes = g1_size, .derived_by_verifier = false })); - }; - manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( - fold_commitment_entries, - /* challenge_name = */ "r", - /* num_challenges_in */ 1)); - - // Rounds 6 + 2 * num_sumcheck_rounds, ..., 6 + 3 * num_sumcheck_rounds - std::vector gemini_evaluation_entries; - for (size_t i = 0; i < num_sumcheck_rounds; i++) { - gemini_evaluation_entries.emplace_back(transcript::Manifest::ManifestEntry( - { .name = "a_" + std::to_string(i), .num_bytes = fr_size, .derived_by_verifier = false })); - }; - manifest_rounds.emplace_back(transcript::Manifest::RoundManifest( - gemini_evaluation_entries, - /* challenge_name = */ "nu", - /* num_challenges_in */ 1)); - - // Round 7 + 3 * num_sumcheck_rounds - manifest_rounds.emplace_back( - transcript::Manifest::RoundManifest( - { - { .name = "Q", .num_bytes = g1_size, .derived_by_verifier = false } - }, - /* challenge_name = */ "z", - /* num_challenges_in */ 1)); - - // Round 8 + 3 * num_sumcheck_rounds - manifest_rounds.emplace_back( - transcript::Manifest::RoundManifest( - { - { .name = "W", .num_bytes = g1_size, .derived_by_verifier = false } - }, - /* challenge_name = */ "separator", - /* num_challenges_in */ 1)); - - // clang-format on - - auto output = transcript::Manifest(manifest_rounds); - return output; - } -}; -} // namespace honk +#define TURBO_WIDTH 4 \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp index 80fa53e8554..b6e5626b346 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp @@ -10,7 +10,7 @@ #include "../field/field.hpp" #include "./bigfield.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -#include "barretenberg/honk/composer/standard_plonk_composer.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers.hpp index 7567d080f10..3325835f470 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers.hpp @@ -1,5 +1,5 @@ #pragma once -#include "barretenberg/honk/composer/standard_plonk_composer.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" #include "barretenberg/plonk/composer/standard_composer.hpp" #include "barretenberg/plonk/composer/turbo_composer.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp index 75812507939..34246ac63cb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp @@ -12,8 +12,6 @@ namespace honk { class StandardHonkComposer; } // namespace honk -namespace bonk {} - #define EXTERN_STDLIB_TYPE(stdlib_type) \ extern template class stdlib_type; \ extern template class stdlib_type; \ diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp index f5abc5b7102..a175f62ab98 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp @@ -3,7 +3,7 @@ #include "../composers/composers_fwd.hpp" #include "../witness/witness.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -#include "barretenberg/honk/composer/standard_plonk_composer.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp" #include "barretenberg/common/assert.hpp" namespace plonk {