From 5853af448a86ed02901609f4786e86fe1651880e Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 1 Feb 2024 18:10:17 -0500 Subject: [PATCH] refactor: collapse bb::honk (#4318) Per crypto team thinking, the following namespaces ``` namespace bb::honk { namespace bb::honk::flavor { namespace bb::honk::grand_product_library { namespace bb::honk::logderivative_library { namespace bb::honk::pcs { namespace bb::honk::pcs::gemini { namespace bb::honk::pcs::ipa { namespace bb::honk::pcs::kzg { namespace bb::honk::pcs::shplonk { namespace bb::honk::pcs::zeromorph { namespace bb::honk::permutation_library { namespace bb::honk::sumcheck { ``` are now all in 'bb'. If any names are unclear, they should be improved (feel free to point them out here). If details really need to be grouped and used by multiple source units, they can have a namespace like I kept with gemini partially. --------- Co-authored-by: ludamad --- .../benchmark/goblin_bench/eccvm.bench.cpp | 4 +- .../benchmark/ipa_bench/ipa.bench.cpp | 32 +++++------ .../protogalaxy_bench/protogalaxy.bench.cpp | 6 +-- .../relations_bench/relations.bench.cpp | 46 ++++++++-------- .../benchmark/ultra_bench/mock_proofs.hpp | 12 ++--- .../ultra_bench/ultra_honk.bench.cpp | 4 +- .../ultra_bench/ultra_honk_rounds.bench.cpp | 6 +-- .../barretenberg/commitment_schemes/claim.hpp | 4 +- .../commitment_schemes/commit.bench.cpp | 5 +- .../commitment_schemes/commitment_key.hpp | 4 +- .../commitment_key.test.hpp | 7 +-- .../commitment_schemes/gemini/gemini.cpp | 8 +-- .../commitment_schemes/gemini/gemini.hpp | 21 ++++---- .../commitment_schemes/gemini/gemini.test.cpp | 5 +- .../commitment_schemes/ipa/ipa.hpp | 4 +- .../commitment_schemes/ipa/ipa.test.cpp | 13 +++-- .../commitment_schemes/kzg/kzg.hpp | 4 +- .../commitment_schemes/kzg/kzg.test.cpp | 12 ++--- .../commitment_schemes/shplonk/shplonk.hpp | 8 +-- .../shplonk/shplonk.test.cpp | 6 +-- .../commitment_schemes/verification_key.hpp | 4 +- .../commitment_schemes/wrapper.hpp | 4 +- .../zeromorph/zeromorph.hpp | 4 +- .../zeromorph/zeromorph.test.cpp | 4 +- .../src/barretenberg/eccvm/eccvm_composer.cpp | 16 +++--- .../src/barretenberg/eccvm/eccvm_composer.hpp | 10 ++-- .../eccvm/eccvm_composer.test.cpp | 5 +- .../src/barretenberg/eccvm/eccvm_prover.cpp | 42 +++++++-------- .../src/barretenberg/eccvm/eccvm_prover.hpp | 24 ++++----- .../eccvm/eccvm_transcript.test.cpp | 5 +- .../src/barretenberg/eccvm/eccvm_verifier.cpp | 22 ++++---- .../src/barretenberg/eccvm/eccvm_verifier.hpp | 8 +-- .../cpp/src/barretenberg/flavor/ecc_vm.hpp | 38 ++++++------- .../cpp/src/barretenberg/flavor/flavor.hpp | 54 +++++++++---------- .../src/barretenberg/flavor/flavor.test.cpp | 6 +-- .../flavor/generated/AvmMini_flavor.hpp | 10 ++-- .../flavor/generated/Toy_flavor.hpp | 12 ++--- .../barretenberg/flavor/goblin_translator.hpp | 12 ++--- .../src/barretenberg/flavor/goblin_ultra.hpp | 14 ++--- .../flavor/goblin_ultra_recursive.hpp | 32 +++++------ .../cpp/src/barretenberg/flavor/ultra.hpp | 12 ++--- .../barretenberg/flavor/ultra_recursive.hpp | 12 ++--- .../goblin/full_goblin_recursion.test.cpp | 2 +- .../cpp/src/barretenberg/goblin/goblin.hpp | 26 +++++---- .../src/barretenberg/goblin/mock_circuits.hpp | 6 +-- .../goblin/mock_circuits_pinning.test.cpp | 1 - .../proof_system/logderivative_library.hpp | 4 +- .../honk/proof_system/permutation_library.hpp | 8 +-- .../honk/proof_system/types/proof.hpp | 6 +-- .../src/barretenberg/honk/utils/testing.hpp | 4 +- .../plonk/composer/composer_lib.cpp | 2 +- .../proof_system/types/prover_settings.hpp | 2 +- .../arithmetization/arithmetization.hpp | 14 ++--- .../eccvm/eccvm_circuit_builder.hpp | 25 ++++----- .../eccvm/eccvm_circuit_builder.test.cpp | 5 +- .../generated/AvmMini_circuit_builder.hpp | 4 +- .../generated/Toy_circuit_builder.hpp | 12 ++--- .../goblin_translator_circuit_builder.hpp | 2 +- .../goblin_ultra_circuit_builder.cpp | 6 +-- .../goblin_ultra_circuit_builder.hpp | 14 ++--- .../standard_circuit_builder.cpp | 2 - .../standard_circuit_builder.hpp | 2 +- .../toy_avm/toy_avm_circuit_builder.test.cpp | 3 +- .../circuit_builder/ultra_circuit_builder.cpp | 10 ++-- .../circuit_builder/ultra_circuit_builder.hpp | 2 +- .../composer/composer_lib.test.cpp | 2 +- .../composer/permutation_lib.test.cpp | 2 +- .../library/grand_product_delta.hpp | 4 +- .../library/grand_product_library.hpp | 4 +- .../library/grand_product_library.test.cpp | 11 ++-- .../protogalaxy/combiner.test.cpp | 9 ++-- .../protogalaxy/decider_prover.cpp | 22 ++++---- .../protogalaxy/decider_prover.hpp | 18 +++---- .../protogalaxy/decider_verifier.cpp | 15 +++--- .../protogalaxy/decider_verifier.hpp | 8 +-- .../protogalaxy/folding_result.hpp | 4 +- .../protogalaxy/protogalaxy_prover.cpp | 8 +-- .../protogalaxy/protogalaxy_prover.hpp | 4 +- .../protogalaxy/protogalaxy_verifier.cpp | 8 +-- .../protogalaxy/protogalaxy_verifier.hpp | 4 +- .../relations/databus_lookup_relation.hpp | 6 +-- .../relations/ecc_vm/ecc_lookup_relation.cpp | 8 +-- .../relations/ecc_vm/ecc_lookup_relation.hpp | 4 +- .../relations/ecc_vm/ecc_msm_relation.cpp | 6 +-- .../relations/ecc_vm/ecc_msm_relation.hpp | 4 +- .../ecc_vm/ecc_point_table_relation.cpp | 6 +-- .../ecc_vm/ecc_point_table_relation.hpp | 4 +- .../relations/ecc_vm/ecc_set_relation.cpp | 8 +-- .../relations/ecc_vm/ecc_set_relation.hpp | 4 +- .../ecc_vm/ecc_transcript_relation.cpp | 6 +-- .../ecc_vm/ecc_transcript_relation.hpp | 4 +- .../relations/ecc_vm/ecc_wnaf_relation.cpp | 6 +-- .../relations/ecc_vm/ecc_wnaf_relation.hpp | 4 +- .../relations/generated/Toy/lookup_xor.hpp | 6 +-- .../generated/Toy/two_column_perm.hpp | 4 +- .../generic_lookup_relation.hpp | 9 ++-- .../generic_permutation_relation.hpp | 10 ++-- ...n_translator_relation_consistency.test.cpp | 2 +- .../translator_decomposition_relation.cpp | 2 +- .../translator_extra_relations.cpp | 4 +- .../translator_gen_perm_sort_relation.cpp | 2 +- .../translator_non_native_field_relation.cpp | 2 +- .../translator_permutation_relation.cpp | 2 +- .../circuit_builders/circuit_builders_fwd.hpp | 21 +++----- .../recursion/honk/transcript/transcript.hpp | 4 +- .../honk/transcript/transcript.test.cpp | 5 +- .../verifier/decider_recursive_verifier.cpp | 13 +++-- .../verifier/decider_recursive_verifier.hpp | 2 +- .../honk/verifier/goblin_verifier.test.cpp | 9 ++-- .../verifier/merge_recursive_verifier.cpp | 2 +- .../verifier/merge_recursive_verifier.hpp | 8 +-- .../honk/verifier/merge_verifier.test.cpp | 5 +- .../protogalaxy_recursive_verifier.cpp | 12 ++--- .../protogalaxy_recursive_verifier.hpp | 2 +- .../protogalaxy_recursive_verifier.test.cpp | 18 +++---- .../verifier/ultra_recursive_verifier.cpp | 18 +++---- .../verifier/ultra_recursive_verifier.hpp | 2 +- .../recursion/honk/verifier/verifier.test.cpp | 8 ++- .../sumcheck/instance/instances.hpp | 4 +- .../sumcheck/instance/prover_instance.cpp | 12 ++--- .../sumcheck/instance/prover_instance.hpp | 4 +- .../instance/prover_instance.test.cpp | 3 +- .../sumcheck/instance/verifier_instance.hpp | 4 +- .../sumcheck/partial_evaluation.test.cpp | 6 ++- .../src/barretenberg/sumcheck/sumcheck.hpp | 4 +- .../barretenberg/sumcheck/sumcheck.test.cpp | 8 +-- .../barretenberg/sumcheck/sumcheck_output.hpp | 4 +- .../barretenberg/sumcheck/sumcheck_round.hpp | 4 +- .../sumcheck/sumcheck_round.test.cpp | 22 +++----- .../barretenberg/transcript/transcript.hpp | 6 +-- .../transcript/transcript.test.cpp | 2 +- .../goblin_translator_composer.cpp | 41 ++++++-------- .../goblin_translator_composer.hpp | 8 +-- .../goblin_translator_composer.test.cpp | 13 +++-- .../goblin_translator_prover.cpp | 14 ++--- .../goblin_translator_prover.hpp | 16 +++--- .../goblin_translator_verifier.cpp | 28 +++++----- .../goblin_translator_verifier.hpp | 8 +-- .../ultra_honk/databus_composer.test.cpp | 3 +- .../ultra_honk/goblin_ultra_composer.test.cpp | 6 +-- .../goblin_ultra_transcript.test.cpp | 3 +- .../barretenberg/ultra_honk/merge_prover.cpp | 12 ++--- .../barretenberg/ultra_honk/merge_prover.hpp | 12 ++--- .../ultra_honk/merge_verifier.cpp | 18 +++---- .../ultra_honk/merge_verifier.hpp | 8 +-- .../ultra_honk/protogalaxy.test.cpp | 8 +-- .../ultra_honk/relation_correctness.test.cpp | 26 +++++---- .../barretenberg/ultra_honk/sumcheck.test.cpp | 6 +-- .../ultra_honk/ultra_composer.cpp | 22 ++++---- .../ultra_honk/ultra_composer.hpp | 10 ++-- .../ultra_honk/ultra_composer.test.cpp | 1 - .../barretenberg/ultra_honk/ultra_prover.cpp | 30 +++++------ .../barretenberg/ultra_honk/ultra_prover.hpp | 20 +++---- .../ultra_honk/ultra_transcript.test.cpp | 3 +- .../ultra_honk/ultra_verifier.cpp | 15 +++--- .../ultra_honk/ultra_verifier.hpp | 10 ++-- .../vm/avm_trace/AvmMini_common.hpp | 2 +- .../vm/avm_trace/AvmMini_execution.cpp | 6 ++- .../vm/avm_trace/AvmMini_execution.hpp | 2 +- .../vm/generated/AvmMini_composer.cpp | 6 +-- .../vm/generated/AvmMini_composer.hpp | 6 +-- .../vm/generated/AvmMini_prover.cpp | 12 ++--- .../vm/generated/AvmMini_prover.hpp | 16 +++--- .../vm/generated/AvmMini_verifier.cpp | 13 ++--- .../vm/generated/AvmMini_verifier.hpp | 8 +-- .../vm/generated/Toy_composer.cpp | 6 +-- .../vm/generated/Toy_composer.hpp | 6 +-- .../barretenberg/vm/generated/Toy_prover.cpp | 12 ++--- .../barretenberg/vm/generated/Toy_prover.hpp | 16 +++--- .../vm/generated/Toy_verifier.cpp | 13 ++--- .../vm/generated/Toy_verifier.hpp | 8 +-- .../vm/tests/AvmMini_arithmetic.test.cpp | 3 +- .../vm/tests/AvmMini_control_flow.test.cpp | 2 + .../vm/tests/AvmMini_execution.test.cpp | 3 +- .../vm/tests/AvmMini_memory.test.cpp | 3 ++ .../barretenberg/vm/tests/helpers.test.cpp | 2 +- 176 files changed, 780 insertions(+), 877 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp index 949658c5bd0..2805fde8286 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp @@ -7,9 +7,9 @@ using namespace benchmark; using namespace bb; -using Flavor = honk::flavor::ECCVM; +using Flavor = ECCVMFlavor; using Builder = ECCVMCircuitBuilder; -using Composer = honk::ECCVMComposer; +using Composer = ECCVMComposer; namespace { diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp index 3a25ee93dfd..af594ba44e6 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp @@ -3,28 +3,22 @@ using namespace benchmark; using namespace bb; -using namespace bb::honk::pcs::ipa; + namespace { using Curve = curve::Grumpkin; using Fr = Curve::ScalarField; -using IPA = IPA; -using OpeningPair = honk::pcs::OpeningPair; -using OpeningClaim = honk::pcs::OpeningClaim; -using Polynomial = Polynomial; -using CommitmentKey = honk::pcs::CommitmentKey; -using VerifierCommitmentKey = honk::pcs::VerifierCommitmentKey; constexpr size_t MIN_POLYNOMIAL_DEGREE_LOG2 = 10; constexpr size_t MAX_POLYNOMIAL_DEGREE_LOG2 = 16; std::shared_ptr> crs_factory( new bb::srs::factories::FileCrsFactory("../srs_db/grumpkin", 1 << 16)); -auto ck = std::make_shared(1 << MAX_POLYNOMIAL_DEGREE_LOG2, crs_factory); -auto vk = std::make_shared(1 << MAX_POLYNOMIAL_DEGREE_LOG2, crs_factory); +auto ck = std::make_shared>(1 << MAX_POLYNOMIAL_DEGREE_LOG2, crs_factory); +auto vk = std::make_shared>(1 << MAX_POLYNOMIAL_DEGREE_LOG2, crs_factory); -std::vector> prover_transcripts(MAX_POLYNOMIAL_DEGREE_LOG2 - - MIN_POLYNOMIAL_DEGREE_LOG2 + 1); -std::vector opening_claims(MAX_POLYNOMIAL_DEGREE_LOG2 - MIN_POLYNOMIAL_DEGREE_LOG2 + 1); +std::vector> prover_transcripts(MAX_POLYNOMIAL_DEGREE_LOG2 - + MIN_POLYNOMIAL_DEGREE_LOG2 + 1); +std::vector> opening_claims(MAX_POLYNOMIAL_DEGREE_LOG2 - MIN_POLYNOMIAL_DEGREE_LOG2 + 1); void ipa_open(State& state) noexcept { @@ -33,19 +27,19 @@ void ipa_open(State& state) noexcept state.PauseTiming(); size_t n = 1 << static_cast(state.range(0)); // Construct the polynomial - Polynomial poly(n); + Polynomial poly(n); for (size_t i = 0; i < n; ++i) { poly[i] = Fr::random_element(&engine); } auto x = Fr::random_element(&engine); auto eval = poly.evaluate(x); - const OpeningPair opening_pair = { x, eval }; - const OpeningClaim opening_claim{ opening_pair, ck->commit(poly) }; + const OpeningPair opening_pair = { x, eval }; + const OpeningClaim opening_claim{ opening_pair, ck->commit(poly) }; // initialize empty prover transcript - auto prover_transcript = std::make_shared(); + auto prover_transcript = std::make_shared(); state.ResumeTiming(); // Compute proof - IPA::compute_opening_proof(ck, opening_pair, poly, prover_transcript); + IPA::compute_opening_proof(ck, opening_pair, poly, prover_transcript); // Store info for verifier prover_transcripts[static_cast(state.range(0)) - MIN_POLYNOMIAL_DEGREE_LOG2] = prover_transcript; opening_claims[static_cast(state.range(0)) - MIN_POLYNOMIAL_DEGREE_LOG2] = opening_claim; @@ -59,10 +53,10 @@ void ipa_verify(State& state) noexcept auto prover_transcript = prover_transcripts[static_cast(state.range(0)) - MIN_POLYNOMIAL_DEGREE_LOG2]; auto opening_claim = opening_claims[static_cast(state.range(0)) - MIN_POLYNOMIAL_DEGREE_LOG2]; // initialize verifier transcript from proof data - auto verifier_transcript = std::make_shared(prover_transcript->proof_data); + auto verifier_transcript = std::make_shared(prover_transcript->proof_data); state.ResumeTiming(); - auto result = IPA::verify(vk, opening_claim, verifier_transcript); + auto result = IPA::verify(vk, opening_claim, verifier_transcript); ASSERT(result); } } diff --git a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp index 26bebca3da7..156587d5133 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp @@ -6,8 +6,8 @@ using namespace benchmark; -namespace bb::honk { -using Flavor = flavor::Ultra; +namespace bb { +using Flavor = UltraFlavor; using Instance = ProverInstance_; using Instances = ProverInstances_; using ProtoGalaxyProver = ProtoGalaxyProver_; @@ -38,6 +38,6 @@ void fold_one(State& state) noexcept } BENCHMARK(fold_one)->/* vary the circuit size */ DenseRange(14, 20)->Unit(kMillisecond); -} // namespace bb::honk +} // namespace bb BENCHMARK_MAIN(); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp index 076da57aa17..45d2c1acbe2 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp @@ -8,8 +8,6 @@ namespace { auto& engine = bb::numeric::get_debug_randomness(); } -using namespace bb::honk::sumcheck; - namespace bb::benchmark::relations { using Fr = bb::fr; @@ -33,28 +31,28 @@ template void execute_relation(::benchmark: Relation::accumulate(accumulator, new_value, params, 1); } } -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); - -BENCHMARK(execute_relation>); - -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); - -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); + +BENCHMARK(execute_relation>); + +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); + +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); } // namespace bb::benchmark::relations diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp index 369a5bd8576..da9c1f2f108 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp @@ -48,13 +48,13 @@ template void generate_basic_arithmetic_circuit(Builder& buil } // ultrahonk -inline honk::UltraProver get_prover(honk::UltraComposer& composer, - void (*test_circuit_function)(honk::UltraComposer::CircuitBuilder&, size_t), - size_t num_iterations) +inline UltraProver get_prover(UltraComposer& composer, + void (*test_circuit_function)(UltraComposer::CircuitBuilder&, size_t), + size_t num_iterations) { - honk::UltraComposer::CircuitBuilder builder; + UltraComposer::CircuitBuilder builder; test_circuit_function(builder, num_iterations); - std::shared_ptr instance = composer.create_instance(builder); + std::shared_ptr instance = composer.create_instance(builder); return composer.create_prover(instance); } @@ -70,7 +70,7 @@ inline plonk::Prover get_prover(plonk::StandardComposer& composer, // ultraplonk inline plonk::UltraProver get_prover(plonk::UltraComposer& composer, - void (*test_circuit_function)(honk::UltraComposer::CircuitBuilder&, size_t), + void (*test_circuit_function)(UltraComposer::CircuitBuilder&, size_t), size_t num_iterations) { plonk::UltraComposer::CircuitBuilder builder; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp index c0320b135a3..29139186659 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp @@ -14,7 +14,7 @@ static void construct_proof_ultrahonk(State& state, void (*test_circuit_function)(UltraCircuitBuilder&, size_t)) noexcept { size_t num_iterations = 10; // 10x the circuit - bb::mock_proofs::construct_proof_with_specified_num_iterations( + bb::mock_proofs::construct_proof_with_specified_num_iterations( state, test_circuit_function, num_iterations); } @@ -24,7 +24,7 @@ static void construct_proof_ultrahonk(State& state, static void construct_proof_ultrahonk_power_of_2(State& state) noexcept { auto log2_of_gates = static_cast(state.range(0)); - bb::mock_proofs::construct_proof_with_specified_num_iterations( + bb::mock_proofs::construct_proof_with_specified_num_iterations( state, &bb::mock_proofs::generate_basic_arithmetic_circuit, log2_of_gates); } diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp index 18066f4d370..e91343143a8 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp @@ -27,7 +27,7 @@ enum { * @param prover - The ultrahonk prover. * @param index - The pass to measure. **/ -BBERG_PROFILE static void test_round_inner(State& state, honk::UltraProver& prover, size_t index) noexcept +BBERG_PROFILE static void test_round_inner(State& state, UltraProver& prover, size_t index) noexcept { auto time_if_index = [&](size_t target_index, auto&& func) -> void { if (index == target_index) { @@ -53,9 +53,9 @@ BBERG_PROFILE static void test_round(State& state, size_t index) noexcept for (auto _ : state) { state.PauseTiming(); - honk::UltraComposer composer; + UltraComposer composer; // TODO(https://github.com/AztecProtocol/barretenberg/issues/761) benchmark both sparse and dense circuits - honk::UltraProver prover = bb::mock_proofs::get_prover( + UltraProver prover = bb::mock_proofs::get_prover( composer, &bb::stdlib::generate_ecdsa_verification_test_circuit, 10); test_round_inner(state, prover, index); state.ResumeTiming(); diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp index 2ef8c69637e..61f32b8d6d1 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp @@ -3,7 +3,7 @@ #include "barretenberg/commitment_schemes/commitment_key.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace bb::honk::pcs { +namespace bb { /** * @brief Opening pair (r,v) for some witness polynomial p(X) such that p(r) = v * @@ -72,4 +72,4 @@ template class OpeningClaim { bool operator==(const OpeningClaim& other) const = default; }; -} // namespace bb::honk::pcs +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/commit.bench.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/commit.bench.cpp index e0b87c902d6..61525c1cd6d 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/commit.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/commit.bench.cpp @@ -5,8 +5,7 @@ namespace bb { -template -std::shared_ptr> create_commitment_key(const size_t num_points) +template std::shared_ptr> create_commitment_key(const size_t num_points) { std::string srs_path; if constexpr (std::same_as) { @@ -16,7 +15,7 @@ std::shared_ptr> create_commitment_key(const siz srs_path = "../srs_db/grumpkin"; } auto crs_factory = std::make_shared>(srs_path, num_points); - return std::make_shared>(num_points, crs_factory); + return std::make_shared>(num_points, crs_factory); } constexpr size_t MAX_LOG_NUM_POINTS = 24; diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp index 201a022fdb5..73369a2965d 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp @@ -19,7 +19,7 @@ #include #include -namespace bb::honk::pcs { +namespace bb { /** * @brief CommitmentKey object over a pairing group 𝔾₁. @@ -74,4 +74,4 @@ template class CommitmentKey { std::shared_ptr> srs; }; -} // namespace bb::honk::pcs +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.test.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.test.hpp index 3350e2ed867..69d7cdc05dd 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.test.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.test.hpp @@ -13,7 +13,7 @@ #include -namespace bb::honk::pcs { +namespace bb { template inline std::shared_ptr CreateCommitmentKey(); @@ -202,8 +202,5 @@ typename std::shared_ptr> CommitmentTest::ve using CommitmentSchemeParams = ::testing::Types; using IpaCommitmentSchemeParams = ::testing::Types; -// IMPROVEMENT: reinstate typed-tests for multiple field types, i.e.: -// using CommitmentSchemeParams = -// ::testing::Types, fake::Params, kzg::Params>; -} // namespace bb::honk::pcs +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.cpp index 0d1890abd66..19e815f8ab5 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.cpp @@ -42,7 +42,7 @@ * The verifier is able to computed the simulated commitments to A₀₊(X) and A₀₋(X) * since they are linear-combinations of the commitments [fⱼ] and [gⱼ]. */ -namespace bb::honk::pcs::gemini { +namespace bb { /** * @brief Computes d-1 fold polynomials Fold_i, i = 1, ..., d-1 @@ -141,7 +141,7 @@ std::vector> GeminiProver_< * @param r_challenge univariate opening challenge */ template -ProverOutput GeminiProver_::compute_fold_polynomial_evaluations( +GeminiProverOutput GeminiProver_::compute_fold_polynomial_evaluations( std::span mle_opening_point, std::vector&& gemini_polynomials, const Fr& r_challenge) { const size_t num_variables = mle_opening_point.size(); // m @@ -150,7 +150,7 @@ ProverOutput GeminiProver_::compute_fold_polynomial_evaluations( Polynomial& batched_G = gemini_polynomials[1]; // G(X) = ∑ⱼ ρᵏ⁺ʲ gⱼ(X) // Compute univariate opening queries rₗ = r^{2ˡ} for l = 0, 1, ..., m-1 - std::vector r_squares = squares_of_r(r_challenge, num_variables); + std::vector r_squares = gemini::squares_of_r(r_challenge, num_variables); // Compute G/r Fr r_inv = r_challenge.invert(); @@ -188,4 +188,4 @@ ProverOutput GeminiProver_::compute_fold_polynomial_evaluations( template class GeminiProver_; template class GeminiProver_; -}; // namespace bb::honk::pcs::gemini +}; // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.hpp index c417b4b76b3..6edf56c0b4b 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.hpp @@ -42,7 +42,7 @@ * The verifier is able to computed the simulated commitments to A₀₊(X) and A₀₋(X) * since they are linear-combinations of the commitments [fⱼ] and [gⱼ]. */ -namespace bb::honk::pcs::gemini { +namespace bb { /** * @brief Prover output (evalutation pair, witness) that can be passed on to Shplonk batch opening. @@ -57,11 +57,12 @@ namespace bb::honk::pcs::gemini { * ] * @tparam Curve CommitmentScheme parameters */ -template struct ProverOutput { +template struct GeminiProverOutput { std::vector> opening_pairs; std::vector> witnesses; }; +namespace gemini { /** * @brief Compute powers of challenge ρ * @@ -96,6 +97,7 @@ template inline std::vector squares_of_r(const Fr r, const size_t } return squares; }; +} // namespace gemini template class GeminiProver_ { using Fr = typename Curve::ScalarField; @@ -106,10 +108,10 @@ template class GeminiProver_ { Polynomial&& batched_unshifted, Polynomial&& batched_to_be_shifted); - static ProverOutput compute_fold_polynomial_evaluations(std::span mle_opening_point, - std::vector&& gemini_polynomials, - const Fr& r_challenge); -}; // namespace bb::honk::pcs::gemini + static GeminiProverOutput compute_fold_polynomial_evaluations(std::span mle_opening_point, + std::vector&& gemini_polynomials, + const Fr& r_challenge); +}; // namespace bb template class GeminiVerifier_ { using Fr = typename Curve::ScalarField; @@ -148,7 +150,7 @@ template class GeminiVerifier_ { // compute vector of powers of random evaluation point r const Fr r = transcript->get_challenge("Gemini:r"); - std::vector r_squares = squares_of_r(r, num_variables); + std::vector r_squares = gemini::squares_of_r(r, num_variables); // Get evaluations a_i, i = 0,...,m-1 from transcript std::vector evaluations; @@ -261,7 +263,6 @@ template class GeminiVerifier_ { return { C0_r_pos, C0_r_neg }; } +}; -}; // namespace bb::honk::pcs::gemini - -} // namespace bb::honk::pcs::gemini +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.test.cpp index 09f65bbc635..0574dcfa115 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.test.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.test.cpp @@ -8,9 +8,6 @@ #include using namespace bb; -using namespace bb::honk; -using namespace bb::honk::pcs; -using namespace bb::honk::pcs::gemini; template class GeminiTest : public CommitmentTest { using GeminiProver = GeminiProver_; @@ -32,7 +29,7 @@ template class GeminiTest : public CommitmentTest { const Fr rho = Fr::random_element(); - std::vector rhos = pcs::gemini::powers_of_rho(rho, multilinear_evaluations.size()); + std::vector rhos = gemini::powers_of_rho(rho, multilinear_evaluations.size()); // Compute batched multivariate evaluation Fr batched_evaluation = Fr::zero(); diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp index 666ac255aa4..ccac4dbdc2f 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp @@ -14,7 +14,7 @@ * https://hackmd.io/q-A8y6aITWyWJrvsGGMWNA?view. * */ -namespace bb::honk::pcs::ipa { +namespace bb { template class IPA { using Fr = typename Curve::ScalarField; using GroupElement = typename Curve::Element; @@ -288,4 +288,4 @@ template class IPA { } }; -} // namespace bb::honk::pcs::ipa \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.test.cpp index e68f79f4861..b1d61d63df4 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.test.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.test.cpp @@ -10,10 +10,8 @@ #include using namespace bb; -using namespace bb::honk; -using namespace bb::honk::pcs; -using namespace bb::honk::pcs::ipa; +namespace { using Curve = curve::Grumpkin; class IPATest : public CommitmentTest { @@ -24,6 +22,7 @@ class IPATest : public CommitmentTest { using VK = VerifierCommitmentKey; using Polynomial = bb::Polynomial; }; +} // namespace TEST_F(IPATest, CommitOnManyZeroCoeffPolyWorks) { @@ -88,10 +87,10 @@ TEST_F(IPATest, Open) TEST_F(IPATest, GeminiShplonkIPAWithShift) { using IPA = IPA; - using ShplonkProver = shplonk::ShplonkProver_; - using ShplonkVerifier = shplonk::ShplonkVerifier_; - using GeminiProver = gemini::GeminiProver_; - using GeminiVerifier = gemini::GeminiVerifier_; + using ShplonkProver = ShplonkProver_; + using ShplonkVerifier = ShplonkVerifier_; + using GeminiProver = GeminiProver_; + using GeminiVerifier = GeminiVerifier_; const size_t n = 8; const size_t log_n = 3; diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.hpp index 3780b10ef85..1e4a0f1b18e 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.hpp @@ -9,7 +9,7 @@ #include #include -namespace bb::honk::pcs::kzg { +namespace bb { template class KZG { using CK = CommitmentKey; @@ -101,4 +101,4 @@ template class KZG { return { P_0, P_1 }; }; }; -} // namespace bb::honk::pcs::kzg +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.test.cpp index 30c02c0543a..9e45ffff90a 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.test.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.test.cpp @@ -12,7 +12,7 @@ #include #include -namespace bb::honk::pcs::kzg { +namespace bb { template class KZGTest : public CommitmentTest { public: @@ -57,10 +57,10 @@ TYPED_TEST(KZGTest, single) */ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift) { - using ShplonkProver = shplonk::ShplonkProver_; - using ShplonkVerifier = shplonk::ShplonkVerifier_; - using GeminiProver = gemini::GeminiProver_; - using GeminiVerifier = gemini::GeminiVerifier_; + using ShplonkProver = ShplonkProver_; + using ShplonkVerifier = ShplonkVerifier_; + using GeminiProver = GeminiProver_; + using GeminiVerifier = GeminiVerifier_; using KZG = KZG; using Fr = typename TypeParam::ScalarField; using GroupElement = typename TypeParam::Element; @@ -177,4 +177,4 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift) EXPECT_EQ(verified, true); } -} // namespace bb::honk::pcs::kzg +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.hpp index 7f0f53093a4..a73ffa37a8f 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.hpp @@ -18,7 +18,7 @@ * The challenges are ρ (batching) and r (random evaluation). * */ -namespace bb::honk::pcs::shplonk { +namespace bb { /** * @brief Polynomial G(X) = Q(X) - ∑ₖ ẑₖ(r)⋅( Bₖ(X) − Tₖ(z) ), where Q(X) = ∑ₖ ( Bₖ(X) − Tₖ(X) ) / zₖ(X) @@ -33,7 +33,7 @@ template using OutputWitness = bb::Polynomial struct ProverOutput { +template struct ShplonkProverOutput { OpeningPair opening_pair; // single opening pair (challenge, evaluation) OutputWitness witness; // single polynomial G(X) }; @@ -97,7 +97,7 @@ template class ShplonkProver_ { * @param z_challenge * @return Output{OpeningPair, Polynomial} */ - static ProverOutput compute_partially_evaluated_batched_quotient( + static ShplonkProverOutput compute_partially_evaluated_batched_quotient( std::span> opening_pairs, std::span witness_polynomials, Polynomial&& batched_quotient_Q, @@ -271,4 +271,4 @@ template class ShplonkVerifier_ { return { { z_challenge, Fr(0) }, G_commitment }; }; }; -} // namespace bb::honk::pcs::shplonk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.test.cpp index 6e754ae127b..ee5168b2253 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.test.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.test.cpp @@ -10,7 +10,7 @@ #include "../commitment_key.test.hpp" #include "barretenberg/commitment_schemes/claim.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace bb::honk::pcs::shplonk { +namespace bb { template class ShplonkTest : public CommitmentTest {}; using CurveTypes = ::testing::Types; @@ -23,7 +23,7 @@ TYPED_TEST(ShplonkTest, ShplonkSimple) using ShplonkVerifier = ShplonkVerifier_; using Fr = typename TypeParam::ScalarField; using Polynomial = typename bb::Polynomial; - using OpeningPair = OpeningPair; + using OpeningPair = bb::OpeningPair; using OpeningClaim = OpeningClaim; const size_t n = 16; @@ -71,4 +71,4 @@ TYPED_TEST(ShplonkTest, ShplonkSimple) this->verify_opening_claim(verifier_claim, shplonk_prover_witness); } -} // namespace bb::honk::pcs::shplonk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/verification_key.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/verification_key.hpp index 3d6429875bc..c1771ce2ce5 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/verification_key.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/verification_key.hpp @@ -20,7 +20,7 @@ #include #include -namespace bb::honk::pcs { +namespace bb { template class VerifierCommitmentKey; @@ -98,4 +98,4 @@ template <> class VerifierCommitmentKey { std::shared_ptr> srs; }; -} // namespace bb::honk::pcs +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/wrapper.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/wrapper.hpp index a79d42e5f1f..ded625f8e39 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/wrapper.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/wrapper.hpp @@ -3,7 +3,7 @@ #include "barretenberg/ecc/curves/bn254/g1.hpp" #include "gemini/gemini.hpp" -namespace bb::honk { +namespace bb { struct OpeningProof { std::vector gemini; @@ -11,4 +11,4 @@ struct OpeningProof { bb::g1::affine_element kzg; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp index 8e805a54b6a..ce1e8c6fdd1 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp @@ -5,7 +5,7 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk::pcs::zeromorph { +namespace bb { /** * @brief Compute powers of a given challenge @@ -728,4 +728,4 @@ template class ZeroMorphVerifier_ { } }; -} // namespace bb::honk::pcs::zeromorph +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp index e933aaa07fa..b963ecb0511 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp @@ -4,7 +4,7 @@ #include -namespace bb::honk::pcs::zeromorph { +namespace bb { template class ZeroMorphTest : public CommitmentTest { public: @@ -532,4 +532,4 @@ TYPED_TEST(ZeroMorphWithConcatenationTest, ProveAndVerify) auto verified = this->execute_zeromorph_protocol(num_unshifted, num_shifted, num_concatenated); EXPECT_TRUE(verified); } -} // namespace bb::honk::pcs::zeromorph +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp index 530e36f047b..e111aac9469 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp @@ -2,13 +2,13 @@ #include "barretenberg/proof_system/composer/composer_lib.hpp" #include "barretenberg/proof_system/composer/permutation_lib.hpp" -namespace bb::honk { +namespace bb { /** * @brief Compute witness polynomials * */ -template void ECCVMComposer_::compute_witness(CircuitConstructor& circuit_constructor) +template void ECCVMComposer_::compute_witness(CircuitConstructor& circuit_constructor) { if (computed_witness) { return; @@ -26,7 +26,7 @@ template void ECCVMComposer_::compute_witness(Circu computed_witness = true; } -template +template ECCVMProver_ ECCVMComposer_::create_prover(CircuitConstructor& circuit_constructor, const std::shared_ptr& transcript) { @@ -45,7 +45,7 @@ ECCVMProver_ ECCVMComposer_::create_prover(CircuitConstructor& c * * @return The verifier. * */ -template +template ECCVMVerifier_ ECCVMComposer_::create_verifier(CircuitConstructor& circuit_constructor, const std::shared_ptr& transcript) { @@ -61,7 +61,7 @@ ECCVMVerifier_ ECCVMComposer_::create_verifier(CircuitConstructo return output_state; } -template +template std::shared_ptr ECCVMComposer_::compute_proving_key( CircuitConstructor& circuit_constructor) { @@ -97,7 +97,7 @@ std::shared_ptr ECCVMComposer_::compute_pro * * @return Pointer to created circuit verification key. * */ -template +template std::shared_ptr ECCVMComposer_::compute_verification_key( CircuitConstructor& circuit_constructor) { @@ -117,6 +117,6 @@ std::shared_ptr ECCVMComposer_::comput verification_key->lagrange_last = commitment_key->commit(proving_key->lagrange_last); return verification_key; } -template class ECCVMComposer_; +template class ECCVMComposer_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp index e8a57b012cd..98f880a3823 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp @@ -7,8 +7,8 @@ #include "barretenberg/srs/factories/file_crs_factory.hpp" #include "barretenberg/srs/global_crs.hpp" -namespace bb::honk { -template class ECCVMComposer_ { +namespace bb { +template class ECCVMComposer_ { public: using FF = typename Flavor::FF; using CircuitConstructor = ECCVMCircuitBuilder; @@ -35,7 +35,7 @@ template class ECCVMComposer_ { bool contains_recursive_proof = false; bool computed_witness = false; ECCVMComposer_() - requires(std::same_as) + requires(std::same_as) { crs_factory_ = bb::srs::get_grumpkin_crs_factory(); }; @@ -75,6 +75,6 @@ template class ECCVMComposer_ { }; // TODO(#532): this pattern is weird; is this not instantiating the templates? -using ECCVMComposer = ECCVMComposer_; +using ECCVMComposer = ECCVMComposer_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp index bd995155314..812f842dee3 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp @@ -13,14 +13,13 @@ #include "barretenberg/sumcheck/sumcheck_round.hpp" using namespace bb; -using namespace bb::honk; template class ECCVMComposerTests : public ::testing::Test { protected: // TODO(640): The Standard Honk on Grumpkin test suite fails unless the SRS is initialized for every test. void SetUp() override { - if constexpr (std::is_same::value) { + if constexpr (std::is_same::value) { srs::init_grumpkin_crs_factory("../srs_db/grumpkin"); } else { srs::init_crs_factory("../srs_db/ignition"); @@ -28,7 +27,7 @@ template class ECCVMComposerTests : public ::testing::Test { }; }; -using FlavorTypes = ::testing::Types; +using FlavorTypes = ::testing::Types; TYPED_TEST_SUITE(ECCVMComposerTests, FlavorTypes); namespace { diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp index 071a63dfb4a..ec5cba49084 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp @@ -10,7 +10,7 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { /** * Create ECCVMProver_ from proving key, witness and manifest. @@ -20,7 +20,7 @@ namespace bb::honk { * * @tparam settings Settings class. * */ -template +template ECCVMProver_::ECCVMProver_(const std::shared_ptr& input_key, const std::shared_ptr& commitment_key, const std::shared_ptr& transcript) @@ -44,7 +44,7 @@ ECCVMProver_::ECCVMProver_(const std::shared_ptr void ECCVMProver_::execute_preamble_round() +template void ECCVMProver_::execute_preamble_round() { const auto circuit_size = static_cast(key->circuit_size); @@ -55,7 +55,7 @@ template void ECCVMProver_::execute_preamble_round( * @brief Compute commitments to the first three wires * */ -template void ECCVMProver_::execute_wire_commitments_round() +template void ECCVMProver_::execute_wire_commitments_round() { auto wire_polys = key->get_wires(); auto labels = commitment_labels.get_wires(); @@ -68,7 +68,7 @@ template void ECCVMProver_::execute_wire_commitment * @brief Compute sorted witness-table accumulator * */ -template void ECCVMProver_::execute_log_derivative_commitments_round() +template void ECCVMProver_::execute_log_derivative_commitments_round() { // Compute and add beta to relation parameters auto [beta, gamma] = challenges_to_field_elements(transcript->get_challenges("beta", "gamma")); @@ -83,7 +83,7 @@ template void ECCVMProver_::execute_log_derivative_ gamma * (gamma + beta_sqr) * (gamma + beta_sqr + beta_sqr) * (gamma + beta_sqr + beta_sqr + beta_sqr); relation_parameters.eccvm_set_permutation_delta = relation_parameters.eccvm_set_permutation_delta.invert(); // Compute inverse polynomial for our logarithmic-derivative lookup method - logderivative_library::compute_logderivative_inverse( + compute_logderivative_inverse( prover_polynomials, relation_parameters, key->circuit_size); transcript->send_to_verifier(commitment_labels.lookup_inverses, commitment_key->commit(key->lookup_inverses)); prover_polynomials.lookup_inverses = key->lookup_inverses.share(); @@ -93,10 +93,10 @@ template void ECCVMProver_::execute_log_derivative_ * @brief Compute permutation and lookup grand product polynomials and commitments * */ -template void ECCVMProver_::execute_grand_product_computation_round() +template void ECCVMProver_::execute_grand_product_computation_round() { // Compute permutation grand product and their commitments - permutation_library::compute_permutation_grand_products(key, prover_polynomials, relation_parameters); + compute_permutation_grand_products(key, prover_polynomials, relation_parameters); transcript->send_to_verifier(commitment_labels.z_perm, commitment_key->commit(key->z_perm)); } @@ -105,9 +105,9 @@ template void ECCVMProver_::execute_grand_product_c * @brief Run Sumcheck resulting in u = (u_1,...,u_d) challenges and all evaluations at u being calculated. * */ -template void ECCVMProver_::execute_relation_check_rounds() +template void ECCVMProver_::execute_relation_check_rounds() { - using Sumcheck = sumcheck::SumcheckProver; + using Sumcheck = SumcheckProver; auto sumcheck = Sumcheck(key->circuit_size, transcript); FF alpha = transcript->get_challenge("Sumcheck:alpha"); @@ -123,13 +123,13 @@ template void ECCVMProver_::execute_relation_check_ * - Compute d+1 Fold polynomials and their evaluations. * * */ -template void ECCVMProver_::execute_univariatization_round() +template void ECCVMProver_::execute_univariatization_round() { const size_t NUM_POLYNOMIALS = Flavor::NUM_ALL_ENTITIES; // Generate batching challenge ρ and powers 1,ρ,…,ρᵐ⁻¹ FF rho = transcript->get_challenge("rho"); - std::vector rhos = pcs::gemini::powers_of_rho(rho, NUM_POLYNOMIALS); + std::vector rhos = gemini::powers_of_rho(rho, NUM_POLYNOMIALS); // Batch the unshifted polynomials and the to-be-shifted polynomials using ρ Polynomial batched_poly_unshifted(key->circuit_size); // batched unshifted polynomials @@ -166,7 +166,7 @@ template void ECCVMProver_::execute_univariatizatio * - Compute and aggregate opening pairs (challenge, evaluation) for each of d Fold polynomials. * - Add d-many Fold evaluations a_i, i = 0, ..., d-1 to the transcript, excluding eval of Fold_{r}^(0) * */ -template void ECCVMProver_::execute_pcs_evaluation_round() +template void ECCVMProver_::execute_pcs_evaluation_round() { const FF r_challenge = transcript->get_challenge("Gemini:r"); gemini_output = Gemini::compute_fold_polynomial_evaluations( @@ -183,7 +183,7 @@ template void ECCVMProver_::execute_pcs_evaluation_ * - Do Fiat-Shamir to get "nu" challenge. * - Compute commitment [Q]_1 * */ -template void ECCVMProver_::execute_shplonk_batched_quotient_round() +template void ECCVMProver_::execute_shplonk_batched_quotient_round() { nu_challenge = transcript->get_challenge("Shplonk:nu"); @@ -198,7 +198,7 @@ template void ECCVMProver_::execute_shplonk_batched * - Do Fiat-Shamir to get "z" challenge. * - Compute polynomial Q(X) - Q_z(X) * */ -template void ECCVMProver_::execute_shplonk_partial_evaluation_round() +template void ECCVMProver_::execute_shplonk_partial_evaluation_round() { const FF z_challenge = transcript->get_challenge("Shplonk:z"); @@ -210,7 +210,7 @@ template void ECCVMProver_::execute_shplonk_partial * - For KZG, this is the quotient commitment [W]_1 * - For IPA, the vectors L and R * */ -template void ECCVMProver_::execute_final_pcs_round() +template void ECCVMProver_::execute_final_pcs_round() { PCS::compute_opening_proof(commitment_key, shplonk_output.opening_pair, shplonk_output.witness, transcript); } @@ -221,7 +221,7 @@ template void ECCVMProver_::execute_final_pcs_round * * @tparam Flavor */ -template void ECCVMProver_::execute_transcript_consistency_univariate_opening_round() +template void ECCVMProver_::execute_transcript_consistency_univariate_opening_round() { // Since IPA cannot currently handle polynomials for which the latter half of the coefficients are 0, we hackily // batch the constant polynomial 1 in with the 5 transcript polynomials. See issue #768 for more details. @@ -274,13 +274,13 @@ template void ECCVMProver_::execute_transcript_cons translation_batching_challenge_v = transcript->get_challenge("Translation:batching_challenge"); } -template honk::proof& ECCVMProver_::export_proof() +template HonkProof& ECCVMProver_::export_proof() { proof = transcript->export_proof(); return proof; } -template honk::proof& ECCVMProver_::construct_proof() +template HonkProof& ECCVMProver_::construct_proof() { execute_preamble_round(); @@ -307,6 +307,6 @@ template honk::proof& ECCVMProver_::construct_proof return export_proof(); } -template class ECCVMProver_; +template class ECCVMProver_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp index 96f3e76a309..a5051d6d4f9 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp @@ -8,11 +8,11 @@ #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { -// We won't compile this class with honk::flavor::Standard, but we will like want to compile it (at least for testing) +// We won't compile this class with Standard, but we will like want to compile it (at least for testing) // with a flavor that uses the curve Grumpkin, or a flavor that does/does not have zk, etc. -template class ECCVMProver_ { +template class ECCVMProver_ { using FF = typename Flavor::FF; using PCS = typename Flavor::PCS; @@ -42,8 +42,8 @@ template class ECCVMProver_ { BBERG_PROFILE void execute_final_pcs_round(); BBERG_PROFILE void execute_transcript_consistency_univariate_opening_round(); - honk::proof& export_proof(); - honk::proof& construct_proof(); + HonkProof& export_proof(); + HonkProof& construct_proof(); std::shared_ptr transcript; @@ -71,16 +71,16 @@ template class ECCVMProver_ { FF evaluation_challenge_x; FF translation_batching_challenge_v; // to be rederived by the translator verifier - sumcheck::SumcheckOutput sumcheck_output; - pcs::gemini::ProverOutput gemini_output; - pcs::shplonk::ProverOutput shplonk_output; + SumcheckOutput sumcheck_output; + GeminiProverOutput gemini_output; + ShplonkProverOutput shplonk_output; std::shared_ptr commitment_key; - using Gemini = pcs::gemini::GeminiProver_; - using Shplonk = pcs::shplonk::ShplonkProver_; + using Gemini = GeminiProver_; + using Shplonk = ShplonkProver_; private: - honk::proof proof; + HonkProof proof; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp index 2b4e69d3624..73dafdf3c68 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp @@ -7,13 +7,12 @@ #include using namespace bb; -using namespace bb::honk; template class ECCVMTranscriptTests : public ::testing::Test { public: void SetUp() override { - if constexpr (std::is_same::value) { + if constexpr (std::is_same::value) { srs::init_grumpkin_crs_factory("../srs_db/grumpkin"); } else { srs::init_crs_factory("../srs_db/ignition"); @@ -222,7 +221,7 @@ template class ECCVMTranscriptTests : public ::testing::Test { numeric::RNG& engine = numeric::get_debug_randomness(); -using FlavorTypes = testing::Types; +using FlavorTypes = testing::Types; TYPED_TEST_SUITE(ECCVMTranscriptTests, FlavorTypes); /** diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp index 82780b09eb3..58cf1e656c3 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp @@ -4,10 +4,7 @@ #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/transcript/transcript.hpp" -using namespace bb; -using namespace bb::honk::sumcheck; - -namespace bb::honk { +namespace bb { template ECCVMVerifier_::ECCVMVerifier_(const std::shared_ptr& verifier_key) : key(verifier_key) @@ -32,19 +29,18 @@ template ECCVMVerifier_& ECCVMVerifier_::opera * @brief This function verifies an ECCVM Honk proof for given program settings. * */ -template bool ECCVMVerifier_::verify_proof(const honk::proof& proof) +template bool ECCVMVerifier_::verify_proof(const HonkProof& proof) { using FF = typename Flavor::FF; using GroupElement = typename Flavor::GroupElement; using Commitment = typename Flavor::Commitment; using PCS = typename Flavor::PCS; using Curve = typename Flavor::Curve; - using Gemini = pcs::gemini::GeminiVerifier_; - using Shplonk = pcs::shplonk::ShplonkVerifier_; + using Gemini = GeminiVerifier_; + using Shplonk = ShplonkVerifier_; using VerifierCommitments = typename Flavor::VerifierCommitments; using CommitmentLabels = typename Flavor::CommitmentLabels; using Transcript = typename Flavor::Transcript; - using OpeningClaim = typename pcs::OpeningClaim; RelationParameters relation_parameters; @@ -183,7 +179,7 @@ template bool ECCVMVerifier_::verify_proof(const honk: const size_t NUM_POLYNOMIALS = Flavor::NUM_ALL_ENTITIES; // Compute powers of batching challenge rho FF rho = transcript->get_challenge("rho"); - std::vector rhos = pcs::gemini::powers_of_rho(rho, NUM_POLYNOMIALS); + std::vector rhos = gemini::powers_of_rho(rho, NUM_POLYNOMIALS); // Compute batched multivariate evaluation FF batched_evaluation = FF::zero(); @@ -273,14 +269,14 @@ template bool ECCVMVerifier_::verify_proof(const honk: } // Construct and verify batched opening claim - OpeningClaim batched_univariate_claim = { { evaluation_challenge_x, batched_transcript_eval }, - batched_commitment }; + OpeningClaim batched_univariate_claim = { { evaluation_challenge_x, batched_transcript_eval }, + batched_commitment }; univariate_opening_verified = PCS::verify(pcs_verification_key, batched_univariate_claim, transcript); } return sumcheck_verified.value() && multivariate_opening_verified && univariate_opening_verified; } -template class ECCVMVerifier_; +template class ECCVMVerifier_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp index 998bd5ed034..958453b42ea 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp @@ -3,7 +3,7 @@ #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { template class ECCVMVerifier_ { using FF = typename Flavor::FF; using Commitment = typename Flavor::Commitment; @@ -30,7 +30,7 @@ template class ECCVMVerifier_ { ECCVMVerifier_& operator=(ECCVMVerifier_&& other) noexcept; ~ECCVMVerifier_() = default; - bool verify_proof(const honk::proof& proof); + bool verify_proof(const HonkProof& proof); std::shared_ptr key; std::map commitments; @@ -39,6 +39,6 @@ template class ECCVMVerifier_ { std::shared_ptr transcript; }; -using ECCVMVerifierGrumpkin = ECCVMVerifier_; +using ECCVMVerifierGrumpkin = ECCVMVerifier_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp b/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp index 8745101e633..ba3c2df1abf 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp @@ -26,7 +26,7 @@ // NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members) -namespace bb::honk::flavor { +namespace bb { template class ECCVMBase { public: @@ -42,8 +42,8 @@ template class ECCVMBa using GroupElement = typename G1::element; using Commitment = typename G1::affine_element; using CommitmentHandle = typename G1::affine_element; - using CommitmentKey = pcs::CommitmentKey; - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; static constexpr size_t NUM_WIRES = 74; @@ -58,16 +58,16 @@ template class ECCVMBa // The total number of witness entities not including shifts. static constexpr size_t NUM_WITNESS_ENTITIES = 76; - using GrandProductRelations = std::tuple>; + using GrandProductRelations = std::tuple>; // define the tuple of Relations that comprise the Sumcheck relation - using Relations = std::tuple, - sumcheck::ECCVMPointTableRelation, - sumcheck::ECCVMWnafRelation, - sumcheck::ECCVMMSMRelation, - sumcheck::ECCVMSetRelation, - sumcheck::ECCVMLookupRelation>; - - using LookupRelation = sumcheck::ECCVMLookupRelation; + using Relations = std::tuple, + ECCVMPointTableRelation, + ECCVMWnafRelation, + ECCVMMSMRelation, + ECCVMSetRelation, + ECCVMLookupRelation>; + + using LookupRelation = ECCVMLookupRelation; static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length(); // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta` @@ -613,7 +613,7 @@ template class ECCVMBa Transcript() = default; - Transcript(const honk::proof& proof) + Transcript(const HonkProof& proof) : BaseTranscript(proof) {} @@ -793,10 +793,10 @@ template class ECCVMBa } shplonk_q_comm = BaseTranscript::template deserialize_from_buffer(BaseTranscript::proof_data, num_frs_read); - if (std::is_same>::value) { + if (std::is_same>::value) { kzg_w_comm = BaseTranscript::template deserialize_from_buffer(BaseTranscript::proof_data, num_frs_read); - } else if (std::is_same>::value) { + } else if (std::is_same>::value) { ipa_poly_degree = BaseTranscript::template deserialize_from_buffer(BaseTranscript::proof_data, num_frs_read); auto log_poly_degree = static_cast(numeric::get_msb(ipa_poly_degree)); @@ -907,9 +907,9 @@ template class ECCVMBa BaseTranscript::template serialize_to_buffer(gemini_a_evals[i], BaseTranscript::proof_data); } BaseTranscript::template serialize_to_buffer(shplonk_q_comm, BaseTranscript::proof_data); - if (std::is_same>::value) { + if (std::is_same>::value) { BaseTranscript::template serialize_to_buffer(kzg_w_comm, BaseTranscript::proof_data); - } else if (std::is_same>::value) { + } else if (std::is_same>::value) { BaseTranscript::template serialize_to_buffer(ipa_poly_degree, BaseTranscript::proof_data); auto log_poly_degree = static_cast(numeric::get_msb(ipa_poly_degree)); for (size_t i = 0; i < log_poly_degree; ++i) { @@ -924,8 +924,8 @@ template class ECCVMBa }; }; -class ECCVM : public ECCVMBase> {}; +class ECCVMFlavor : public ECCVMBase> {}; // NOLINTEND(cppcoreguidelines-avoid-const-or-ref-data-members) -} // namespace bb::honk::flavor +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index 3272ed95164..fd45588e9c6 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -76,7 +76,7 @@ #include #include -namespace bb::honk::flavor { +namespace bb { /** * @brief Base class template containing circuit-specifying data. @@ -255,16 +255,16 @@ template static constexpr auto create_tu } } -} // namespace bb::honk::flavor +} // namespace bb // Forward declare honk flavors -namespace bb::honk::flavor { -class Ultra; -class ECCVM; -class GoblinUltra; -template class UltraRecursive_; -template class GoblinUltraRecursive_; -} // namespace bb::honk::flavor +namespace bb { +class UltraFlavor; +class ECCVMFlavor; +class GoblinUltraFlavor; +template class UltraRecursiveFlavor_; +template class GoblinUltraRecursiveFlavor_; +} // namespace bb // Forward declare plonk flavors namespace bb::plonk::flavor { @@ -286,34 +286,32 @@ template concept IsPlonkFlavor = IsAnyOf; template -concept IsHonkFlavor = IsAnyOf; +concept IsHonkFlavor = IsAnyOf; template -concept IsUltraFlavor = IsAnyOf; +concept IsUltraFlavor = IsAnyOf; template -concept IsGoblinFlavor = IsAnyOf, - honk::flavor::GoblinUltraRecursive_>; +concept IsGoblinFlavor = IsAnyOf, + GoblinUltraRecursiveFlavor_>; template -concept IsRecursiveFlavor = IsAnyOf, - honk::flavor::UltraRecursive_, - honk::flavor::GoblinUltraRecursive_, - honk::flavor::GoblinUltraRecursive_>; - -template concept IsGrumpkinFlavor = IsAnyOf; +concept IsRecursiveFlavor = IsAnyOf, + UltraRecursiveFlavor_, + GoblinUltraRecursiveFlavor_, + GoblinUltraRecursiveFlavor_>; -template concept IsFoldingFlavor = IsAnyOf, - honk::flavor::UltraRecursive_, - honk::flavor::GoblinUltraRecursive_, - honk::flavor::GoblinUltraRecursive_>; +template concept IsGrumpkinFlavor = IsAnyOf; -template concept UltraFlavor = IsAnyOf; +template concept IsFoldingFlavor = IsAnyOf, + UltraRecursiveFlavor_, + GoblinUltraRecursiveFlavor_, + GoblinUltraRecursiveFlavor_>; -template concept ECCVMFlavor = IsAnyOf; +template concept IsECCVMFlavor = IsAnyOf; template inline std::string flavor_get_label(Container&& container, const Element& element) { diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp index 3eb36f5fdc2..89886373557 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp @@ -8,7 +8,7 @@ using namespace bb; TEST(Flavor, Getters) { - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = Flavor::FF; using ProvingKey = typename Flavor::ProvingKey; @@ -43,7 +43,7 @@ TEST(Flavor, Getters) TEST(Flavor, AllEntitiesSpecialMemberFunctions) { - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = Flavor::FF; using PartiallyEvaluatedMultivariates = Flavor::PartiallyEvaluatedMultivariates; using Polynomial = bb::Polynomial; @@ -69,7 +69,7 @@ TEST(Flavor, AllEntitiesSpecialMemberFunctions) TEST(Flavor, GetRow) { - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = typename Flavor::FF; std::array, Flavor::NUM_ALL_ENTITIES> data; std::generate(data.begin(), data.end(), []() { diff --git a/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp index 19b18ec3d79..a249820db28 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp @@ -18,13 +18,13 @@ #include "barretenberg/relations/generated/AvmMini/mem_trace.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk::flavor { +namespace bb { class AvmMiniFlavor { public: using Curve = curve::BN254; using G1 = Curve::Group; - using PCS = pcs::kzg::KZG; + using PCS = KZG; using FF = G1::subgroup_field; using Polynomial = bb::Polynomial; @@ -32,8 +32,8 @@ class AvmMiniFlavor { using GroupElement = G1::element; using Commitment = G1::affine_element; using CommitmentHandle = G1::affine_element; - using CommitmentKey = pcs::CommitmentKey; - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 2; @@ -898,4 +898,4 @@ class AvmMiniFlavor { }; }; -} // namespace bb::honk::flavor +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/generated/Toy_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/generated/Toy_flavor.hpp index 258d4c3d8a0..83f540cfd8b 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/generated/Toy_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/generated/Toy_flavor.hpp @@ -17,13 +17,13 @@ #include "barretenberg/relations/generated/Toy/two_column_perm.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk::flavor { +namespace bb { class ToyFlavor { public: using Curve = curve::BN254; using G1 = Curve::Group; - using PCS = pcs::kzg::KZG; + using PCS = KZG; using FF = G1::subgroup_field; using Polynomial = bb::Polynomial; @@ -31,8 +31,8 @@ class ToyFlavor { using GroupElement = G1::element; using Commitment = G1::affine_element; using CommitmentHandle = G1::affine_element; - using CommitmentKey = pcs::CommitmentKey; - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 1; @@ -42,7 +42,7 @@ class ToyFlavor { // the unshifted and one for the shifted static constexpr size_t NUM_ALL_ENTITIES = 17; - using Relations = std::tuple, sumcheck::two_column_perm_relation>; + using Relations = std::tuple, two_column_perm_relation>; static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length(); @@ -367,4 +367,4 @@ class ToyFlavor { }; }; -} // namespace bb::honk::flavor +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp index f18a480f176..8f0fe89209d 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp @@ -16,20 +16,20 @@ #include "barretenberg/relations/translator_vm/translator_permutation_relation.hpp" #include "relation_definitions.hpp" -namespace bb::honk::flavor { +namespace bb { -class GoblinTranslator { +class GoblinTranslatorFlavor { public: static constexpr size_t mini_circuit_size = 2048; using CircuitBuilder = GoblinTranslatorCircuitBuilder; using Curve = curve::BN254; - using PCS = pcs::kzg::KZG; + using PCS = KZG; using GroupElement = Curve::Element; using Commitment = Curve::AffineElement; using CommitmentHandle = Curve::AffineElement; - using CommitmentKey = pcs::CommitmentKey; - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; using FF = Curve::ScalarField; using BF = Curve::BaseField; using Polynomial = bb::Polynomial; @@ -1138,4 +1138,4 @@ class GoblinTranslator { using Transcript = BaseTranscript; }; -} // namespace bb::honk::flavor \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp index ed247351c52..deee8860d9a 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp @@ -20,9 +20,9 @@ #include "barretenberg/transcript/transcript.hpp" #include "relation_definitions.hpp" -namespace bb::honk::flavor { +namespace bb { -class GoblinUltra { +class GoblinUltraFlavor { public: using CircuitBuilder = GoblinUltraCircuitBuilder; using Curve = curve::BN254; @@ -30,11 +30,11 @@ class GoblinUltra { using GroupElement = Curve::Element; using Commitment = Curve::AffineElement; using CommitmentHandle = Curve::AffineElement; - using PCS = pcs::kzg::KZG; + using PCS = KZG; using Polynomial = bb::Polynomial; using PolynomialHandle = std::span; - using CommitmentKey = pcs::CommitmentKey; - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::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 @@ -506,7 +506,7 @@ class GoblinUltra { Transcript_() = default; - Transcript_(const honk::proof& proof) + Transcript_(const HonkProof& proof) : BaseTranscript(proof) {} @@ -591,4 +591,4 @@ class GoblinUltra { using Transcript = Transcript_; }; -} // namespace bb::honk::flavor +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp index e1146ea4b70..559b3a9a270 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp @@ -22,7 +22,7 @@ #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/recursion/honk/transcript/transcript.hpp" -namespace bb::honk::flavor { +namespace bb { /** * @brief The recursive counterpart to the "native" Goblin Ultra flavor. @@ -38,7 +38,7 @@ namespace bb::honk::flavor { * * @tparam BuilderType Determines the arithmetization of the verifier circuit defined based on this flavor. */ -template class GoblinUltraRecursive_ { +template class GoblinUltraRecursiveFlavor_ { public: using CircuitBuilder = BuilderType; // Determines arithmetization of circuit instantiated with this flavor using Curve = stdlib::bn254; @@ -46,25 +46,25 @@ template class GoblinUltraRecursive_ { using FF = typename Curve::ScalarField; using Commitment = typename Curve::Element; using CommitmentHandle = typename Curve::Element; - using NativeVerificationKey = flavor::GoblinUltra::VerificationKey; + using NativeVerificationKey = GoblinUltraFlavor::VerificationKey; // Note(luke): Eventually this may not be needed at all - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; - static constexpr size_t NUM_WIRES = flavor::GoblinUltra::NUM_WIRES; + static constexpr size_t NUM_WIRES = GoblinUltraFlavor::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`. // Note: this number does not include the individual sorted list polynomials. - static constexpr size_t NUM_ALL_ENTITIES = flavor::GoblinUltra::NUM_ALL_ENTITIES; + static constexpr size_t NUM_ALL_ENTITIES = GoblinUltraFlavor::NUM_ALL_ENTITIES; // The number of polynomials precomputed to describe a circuit and to aid a prover in constructing a satisfying // assignment of witnesses. We again choose a neutral name. - static constexpr size_t NUM_PRECOMPUTED_ENTITIES = flavor::GoblinUltra::NUM_PRECOMPUTED_ENTITIES; + static constexpr size_t NUM_PRECOMPUTED_ENTITIES = GoblinUltraFlavor::NUM_PRECOMPUTED_ENTITIES; // The total number of witness entities not including shifts. - static constexpr size_t NUM_WITNESS_ENTITIES = flavor::GoblinUltra::NUM_WITNESS_ENTITIES; + static constexpr size_t NUM_WITNESS_ENTITIES = GoblinUltraFlavor::NUM_WITNESS_ENTITIES; // define the tuple of Relations that comprise the Sumcheck relation // Reuse the Relations from GoblinUltra - using Relations = GoblinUltra::Relations_; + using Relations = GoblinUltraFlavor::Relations_; static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length(); static constexpr size_t MAX_TOTAL_RELATION_LENGTH = compute_max_total_relation_length(); @@ -90,9 +90,9 @@ template class GoblinUltraRecursive_ { * @brief A field element for each entity of the flavor. These entities represent the prover polynomials evaluated * at one point. */ - class AllValues : public GoblinUltra::AllEntities { + class AllValues : public GoblinUltraFlavor::AllEntities { public: - using Base = GoblinUltra::AllEntities; + using Base = GoblinUltraFlavor::AllEntities; using Base::Base; }; /** @@ -104,7 +104,7 @@ template class GoblinUltraRecursive_ { * circuits. * This differs from GoblinUltra in how we construct the commitments. */ - class VerificationKey : public VerificationKey_> { + class VerificationKey : public VerificationKey_> { public: VerificationKey(const size_t circuit_size, const size_t num_public_inputs) { @@ -160,13 +160,13 @@ template class GoblinUltraRecursive_ { /** * @brief A container for the witness commitments. */ - using WitnessCommitments = GoblinUltra::WitnessEntities; + using WitnessCommitments = GoblinUltraFlavor::WitnessEntities; - using CommitmentLabels = GoblinUltra::CommitmentLabels; + using CommitmentLabels = GoblinUltraFlavor::CommitmentLabels; // Reuse the VerifierCommitments from GoblinUltra - using VerifierCommitments = GoblinUltra::VerifierCommitments_; + using VerifierCommitments = GoblinUltraFlavor::VerifierCommitments_; // Reuse the transcript from GoblinUltra using Transcript = bb::stdlib::recursion::honk::Transcript; }; -} // namespace bb::honk::flavor +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp index 466cac1c869..ae2232f8685 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp @@ -16,9 +16,9 @@ #include "barretenberg/relations/ultra_arithmetic_relation.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk::flavor { +namespace bb { -class Ultra { +class UltraFlavor { public: using CircuitBuilder = UltraCircuitBuilder; using Curve = curve::BN254; @@ -26,11 +26,11 @@ class Ultra { using GroupElement = Curve::Element; using Commitment = Curve::AffineElement; using CommitmentHandle = Curve::AffineElement; - using PCS = pcs::kzg::KZG; + using PCS = KZG; using Polynomial = bb::Polynomial; using PolynomialHandle = std::span; - using CommitmentKey = pcs::CommitmentKey; - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::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 @@ -575,4 +575,4 @@ class Ultra { }; }; -} // namespace bb::honk::flavor +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp index 94955d72f75..9666b1e8648 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp @@ -30,7 +30,7 @@ #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace bb::honk::flavor { +namespace bb { /** * @brief The recursive counterpart to the "native" Ultra flavor. @@ -46,7 +46,7 @@ namespace bb::honk::flavor { * * @tparam BuilderType Determines the arithmetization of the verifier circuit defined based on this flavor. */ -template class UltraRecursive_ { +template class UltraRecursiveFlavor_ { public: using CircuitBuilder = BuilderType; // Determines arithmetization of circuit instantiated with this flavor using Curve = stdlib::bn254; @@ -54,12 +54,12 @@ template class UltraRecursive_ { using Commitment = typename Curve::Element; using CommitmentHandle = typename Curve::Element; using FF = typename Curve::ScalarField; - using NativeVerificationKey = flavor::Ultra::VerificationKey; + using NativeVerificationKey = UltraFlavor::VerificationKey; // Note(luke): Eventually this may not be needed at all - using VerifierCommitmentKey = pcs::VerifierCommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; - static constexpr size_t NUM_WIRES = flavor::Ultra::NUM_WIRES; + static constexpr size_t NUM_WIRES = UltraFlavor::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`. // Note: this number does not include the individual sorted list polynomials. @@ -421,4 +421,4 @@ template class UltraRecursive_ { using Transcript = bb::stdlib::recursion::honk::Transcript; }; -} // namespace bb::honk::flavor +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/goblin/full_goblin_recursion.test.cpp b/barretenberg/cpp/src/barretenberg/goblin/full_goblin_recursion.test.cpp index 04968199532..dcc1323d781 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/full_goblin_recursion.test.cpp +++ b/barretenberg/cpp/src/barretenberg/goblin/full_goblin_recursion.test.cpp @@ -10,8 +10,8 @@ #include "barretenberg/ultra_honk/ultra_composer.hpp" #include + using namespace bb; -using namespace bb::honk; class GoblinRecursionTests : public ::testing::Test { protected: diff --git a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp index 4913695c918..4f5cc1942cd 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp @@ -1,6 +1,7 @@ #pragma once #include "barretenberg/eccvm/eccvm_composer.hpp" +#include "barretenberg/flavor/goblin_ultra.hpp" #include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp" #include "barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp" #include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" @@ -12,37 +13,34 @@ namespace bb { class Goblin { - using HonkProof = bb::honk::proof; - using GUHFlavor = bb::honk::flavor::GoblinUltra; using GoblinUltraCircuitBuilder = bb::GoblinUltraCircuitBuilder; - using GUHVerificationKey = GUHFlavor::VerificationKey; - using Commitment = GUHFlavor::Commitment; - using FF = GUHFlavor::FF; + using Commitment = GoblinUltraFlavor::Commitment; + using FF = GoblinUltraFlavor::FF; public: using Builder = GoblinUltraCircuitBuilder; using Fr = bb::fr; - using Transcript = bb::honk::BaseTranscript; + using Transcript = bb::BaseTranscript; - using GoblinUltraComposer = bb::honk::UltraComposer_; - using GoblinUltraVerifier = bb::honk::UltraVerifier_; + using GoblinUltraComposer = bb::UltraComposer_; + using GoblinUltraVerifier = bb::UltraVerifier_; using OpQueue = bb::ECCOpQueue; - using ECCVMFlavor = bb::honk::flavor::ECCVM; + using ECCVMFlavor = bb::ECCVMFlavor; using ECCVMBuilder = bb::ECCVMCircuitBuilder; - using ECCVMComposer = bb::honk::ECCVMComposer; - using ECCVMProver = bb::honk::ECCVMProver_; + using ECCVMComposer = bb::ECCVMComposer; + using ECCVMProver = bb::ECCVMProver_; using TranslatorBuilder = bb::GoblinTranslatorCircuitBuilder; - using TranslatorComposer = bb::honk::GoblinTranslatorComposer; + using TranslatorComposer = bb::GoblinTranslatorComposer; using RecursiveMergeVerifier = bb::stdlib::recursion::goblin::MergeRecursiveVerifier_; - using MergeVerifier = bb::honk::MergeVerifier_; + using MergeVerifier = bb::MergeVerifier_; /** * @brief Output of goblin::accumulate; an Ultra proof and the corresponding verification key * */ struct AccumulationOutput { HonkProof proof; - std::shared_ptr verification_key; + std::shared_ptr verification_key; }; struct Proof { diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp index db98486ddbb..576fc798ae0 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp @@ -22,11 +22,11 @@ class GoblinMockCircuits { using FF = Curve::ScalarField; using Fbase = Curve::BaseField; using Point = Curve::AffineElement; - using CommitmentKey = bb::honk::pcs::CommitmentKey; + using CommitmentKey = bb::CommitmentKey; using OpQueue = bb::ECCOpQueue; using GoblinUltraBuilder = bb::GoblinUltraCircuitBuilder; - using Flavor = bb::honk::flavor::GoblinUltra; - using RecursiveFlavor = bb::honk::flavor::GoblinUltraRecursive_; + using Flavor = bb::GoblinUltraFlavor; + using RecursiveFlavor = bb::GoblinUltraRecursiveFlavor_; using RecursiveVerifier = bb::stdlib::recursion::honk::UltraRecursiveVerifier_; using KernelInput = Goblin::AccumulationOutput; static constexpr size_t NUM_OP_QUEUE_COLUMNS = Flavor::NUM_WIRES; diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp index 1135a559b92..6d642bf5bc8 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp @@ -5,7 +5,6 @@ #include using namespace bb; -using namespace bb::honk; /** * @brief For benchmarking, we want to be sure that our mocking functions create circuits of a known size. We control diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/logderivative_library.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/logderivative_library.hpp index adf3355d618..9e124684c3e 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/logderivative_library.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/logderivative_library.hpp @@ -1,7 +1,7 @@ #pragma once #include -namespace bb::honk::logderivative_library { +namespace bb { /** * @brief Compute the inverse polynomial I(X) required for logderivative lookups @@ -246,4 +246,4 @@ void accumulate_logderivative_permutation_subrelation_contributions(ContainerOve std::get<1>(accumulator) -= permutation_relation.template compute_write_term_predicate(in) * denominator_accumulator[1]; } -} // namespace bb::honk::logderivative_library \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp index 6deaa03df7a..59744f96b20 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp @@ -3,7 +3,7 @@ #include "barretenberg/polynomials/polynomial.hpp" #include -namespace bb::honk::permutation_library { +namespace bb { /** * @brief Compute a permutation grand product polynomial Z_perm(X) @@ -221,8 +221,8 @@ template void compute_concatenated_pol * changed ∈ [0 , 2¹⁴ - 1]. To do this, we use several virtual concatenated wires, each of which represents a subset * or original wires (concatenated_range_constraints_). We also generate several new polynomials of the same length * as concatenated ones. These polynomials have values within range, but they are also constrained by the - * GoblinTranslator's GenPermSort relation, which ensures that sequential values differ by not more than 3, the last - * value is the maximum and the first value is zero (zero at the start allows us not to dance around shifts). + * GoblinTranslatorFlavor's GenPermSort relation, which ensures that sequential values differ by not more than 3, the + * last value is the maximum and the first value is zero (zero at the start allows us not to dance around shifts). * * Ideally, we could simply rearrange the values in concatenated_.._0 ,..., concatenated_.._3 and get denominator * polynomials (ordered_constraints), but we could get the worst case scenario: each value in the polynomials is @@ -435,4 +435,4 @@ inline void compute_lagrange_polynomials_for_goblin_translator(auto proving_key, proving_key->lagrange_second = lagrange_polynomial_second.share(); } -} // namespace bb::honk::permutation_library \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/types/proof.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/types/proof.hpp index 1e40a20d95d..091d310d5c2 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/types/proof.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/types/proof.hpp @@ -2,8 +2,8 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include -namespace bb::honk { +namespace bb { -using proof = std::vector; +using HonkProof = std::vector; -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/honk/utils/testing.hpp b/barretenberg/cpp/src/barretenberg/honk/utils/testing.hpp index 69613d67398..b9f1fb8f4d8 100644 --- a/barretenberg/cpp/src/barretenberg/honk/utils/testing.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/utils/testing.hpp @@ -2,7 +2,7 @@ #include "barretenberg/common/zip_view.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace bb::honk { +namespace bb { /** * @brief Get a ProverPolynomials instance initialized to sequential values starting at 0. * @details Values are assigned according to the order specified in the underlying array of the flavor class. The @@ -43,4 +43,4 @@ template typename Flavor::ProverPolynomials get_zero_prover_po return prover_polynomials; } -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp index 21cc5dabe46..86bc6201c5d 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/composer_lib.cpp @@ -50,7 +50,7 @@ std::shared_ptr compute_verification_key_common( auto circuit_verification_key = std::make_shared( proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->circuit_type); // TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc - using KZGCommitmentKey = honk::pcs::CommitmentKey; + using KZGCommitmentKey = bb::CommitmentKey; auto commitment_key = KZGCommitmentKey(proving_key->circuit_size, proving_key->reference_string); for (size_t i = 0; i < proving_key->polynomial_manifest.size(); ++i) { diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp index eaf863a1c7b..88dd0d26e89 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp @@ -12,7 +12,7 @@ class settings_base { class standard_settings : public settings_base { public: - using Arithmetization = arithmetization::Standard; + using Arithmetization = StandardArith; static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; static constexpr size_t program_width = 3; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp b/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp index 0a5c4ec1089..5bdf8b3faab 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp @@ -5,7 +5,7 @@ #include #include -namespace arithmetization { +namespace bb { /** * @brief Specify the structure of a CircuitBuilder @@ -32,7 +32,7 @@ namespace arithmetization { // These are not magic numbers and they should not be written with global constants. These parameters are not accessible // through clearly named static class members. -template class Standard { +template class StandardArith { public: static constexpr size_t NUM_WIRES = 3; static constexpr size_t NUM_SELECTORS = 5; @@ -53,7 +53,7 @@ template class Standard { const SelectorType& q_3() const { return selectors[3]; }; const SelectorType& q_c() const { return selectors[4]; }; - Standard() + StandardArith() : selectors(NUM_SELECTORS) {} @@ -70,7 +70,7 @@ template class Standard { inline static const std::vector selector_names = { "q_m", "q_1", "q_2", "q_3", "q_c" }; }; -template class Ultra { +template class UltraArith { public: static constexpr size_t NUM_WIRES = 4; static constexpr size_t NUM_SELECTORS = 11; @@ -133,7 +133,7 @@ template class Ultra { * * @tparam FF_ */ -template class UltraHonk { +template class UltraHonkArith { public: static constexpr size_t NUM_WIRES = 4; static constexpr size_t NUM_SELECTORS = 14; @@ -200,9 +200,9 @@ template class UltraHonk { inline static const std::vector selector_names = {}; }; -class GoblinTranslator { +class GoblinTranslatorArith { public: static constexpr size_t NUM_WIRES = 81; static constexpr size_t NUM_SELECTORS = 0; }; -} // namespace arithmetization \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp index 7569275796e..a60c840d379 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp @@ -505,11 +505,8 @@ template class ECCVMCircuitBuilder { auto polynomials = compute_polynomials(); const size_t num_rows = polynomials.get_polynomial_size(); - bb::honk::logderivative_library::compute_logderivative_inverse>( - polynomials, params, num_rows); - - honk::permutation_library::compute_permutation_grand_product>( - num_rows, polynomials, params); + compute_logderivative_inverse>(polynomials, params, num_rows); + compute_permutation_grand_product>(num_rows, polynomials, params); polynomials.z_perm_shift = Polynomial(polynomials.z_perm.shifted()); @@ -538,20 +535,16 @@ template class ECCVMCircuitBuilder { }; bool result = true; - result = result && evaluate_relation.template operator()>( - "ECCVMTranscriptRelation"); - result = result && evaluate_relation.template operator()>( - "ECCVMPointTableRelation"); - result = - result && evaluate_relation.template operator()>("ECCVMWnafRelation"); result = - result && evaluate_relation.template operator()>("ECCVMMSMRelation"); + result && evaluate_relation.template operator()>("ECCVMTranscriptRelation"); result = - result && evaluate_relation.template operator()>("ECCVMSetRelation"); + result && evaluate_relation.template operator()>("ECCVMPointTableRelation"); + result = result && evaluate_relation.template operator()>("ECCVMWnafRelation"); + result = result && evaluate_relation.template operator()>("ECCVMMSMRelation"); + result = result && evaluate_relation.template operator()>("ECCVMSetRelation"); - using LookupRelation = honk::sumcheck::ECCVMLookupRelation; - typename honk::sumcheck::ECCVMLookupRelation::SumcheckArrayOfValuesOverSubrelations - lookup_result; + using LookupRelation = ECCVMLookupRelation; + typename ECCVMLookupRelation::SumcheckArrayOfValuesOverSubrelations lookup_result; for (auto& r : lookup_result) { r = 0; } diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.test.cpp index 18bacda13ef..54e0b7a8a79 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.test.cpp @@ -7,11 +7,12 @@ using namespace bb; namespace { auto& engine = numeric::get_debug_randomness(); -} template class ECCVMCircuitBuilderTests : public ::testing::Test {}; -using FlavorTypes = ::testing::Types; +using FlavorTypes = ::testing::Types; +} // namespace + TYPED_TEST_SUITE(ECCVMCircuitBuilderTests, FlavorTypes); TYPED_TEST(ECCVMCircuitBuilderTests, BaseCase) diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/AvmMini_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/AvmMini_circuit_builder.hpp index baef5adc856..5392923eb1f 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/AvmMini_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/AvmMini_circuit_builder.hpp @@ -16,8 +16,6 @@ #include "barretenberg/relations/generated/AvmMini/avm_mini.hpp" #include "barretenberg/relations/generated/AvmMini/mem_trace.hpp" -using namespace bb; - namespace bb { template struct AvmMiniFullRow { @@ -105,7 +103,7 @@ template struct AvmMiniFullRow { class AvmMiniCircuitBuilder { public: - using Flavor = bb::honk::flavor::AvmMiniFlavor; + using Flavor = bb::AvmMiniFlavor; using FF = Flavor::FF; using Row = AvmMiniFullRow; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp index 3491f983291..207b5a9e21e 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/Toy_circuit_builder.hpp @@ -16,8 +16,6 @@ #include "barretenberg/relations/generated/Toy/toy_avm.hpp" #include "barretenberg/relations/generated/Toy/two_column_perm.hpp" -using namespace bb; - namespace bb { template struct ToyFullRow { @@ -42,7 +40,7 @@ template struct ToyFullRow { class ToyCircuitBuilder { public: - using Flavor = bb::honk::flavor::ToyFlavor; + using Flavor = bb::ToyFlavor; using FF = Flavor::FF; using Row = ToyFullRow; @@ -137,8 +135,7 @@ class ToyCircuitBuilder { const auto evaluate_logderivative = [&](const std::string& lookup_name) { // Check the logderivative relation - bb::honk::logderivative_library::compute_logderivative_inverse( - polys, params, num_rows); + bb::compute_logderivative_inverse(polys, params, num_rows); typename LogDerivativeSettings::SumcheckArrayOfValuesOverSubrelations lookup_result; @@ -162,11 +159,10 @@ class ToyCircuitBuilder { return false; } - if (!evaluate_logderivative.template operator()>( - "two_column_perm")) { + if (!evaluate_logderivative.template operator()>("two_column_perm")) { return false; } - if (!evaluate_logderivative.template operator()>("lookup_xor")) { + if (!evaluate_logderivative.template operator()>("lookup_xor")) { return false; } diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp index 41865d083a1..14c2c368f23 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp @@ -77,7 +77,7 @@ class GoblinTranslatorCircuitBuilder : public CircuitBuilderBase { // We don't need templating for Goblin using Fr = bb::fr; using Fq = bb::fq; - using Arithmetization = arithmetization::GoblinTranslator; + using Arithmetization = GoblinTranslatorArith; public: static constexpr size_t NUM_WIRES = Arithmetization::NUM_WIRES; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp index 428409bf73f..c2630db7b7b 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp @@ -12,7 +12,7 @@ namespace bb { template void GoblinUltraCircuitBuilder_::finalize_circuit() { - UltraCircuitBuilder_>::finalize_circuit(); + UltraCircuitBuilder_>::finalize_circuit(); } /** @@ -26,7 +26,7 @@ template void GoblinUltraCircuitBuilder_::finalize_circuit() template void GoblinUltraCircuitBuilder_::add_gates_to_ensure_all_polys_are_non_zero() { // Most polynomials are handled via the conventional Ultra method - UltraCircuitBuilder_>::add_gates_to_ensure_all_polys_are_non_zero(); + UltraCircuitBuilder_>::add_gates_to_ensure_all_polys_are_non_zero(); // All that remains is to handle databus related and poseidon2 related polynomials. In what follows we populate the // calldata with some mock data then constuct a single calldata read gate @@ -448,7 +448,7 @@ inline FF GoblinUltraCircuitBuilder_::compute_poseidon2_internal_identity(FF template bool GoblinUltraCircuitBuilder_::check_circuit() { bool result = true; - if (!UltraCircuitBuilder_>::check_circuit()) { + if (!UltraCircuitBuilder_>::check_circuit()) { return false; } diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp index 072a7d10357..a338b88549e 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp @@ -7,12 +7,12 @@ namespace bb { using namespace bb; -template class GoblinUltraCircuitBuilder_ : public UltraCircuitBuilder_> { +template class GoblinUltraCircuitBuilder_ : public UltraCircuitBuilder_> { public: static constexpr std::string_view NAME_STRING = "GoblinUltraArithmetization"; static constexpr CircuitType CIRCUIT_TYPE = CircuitType::ULTRA; static constexpr size_t DEFAULT_NON_NATIVE_FIELD_LIMB_BITS = - UltraCircuitBuilder_>::DEFAULT_NON_NATIVE_FIELD_LIMB_BITS; + UltraCircuitBuilder_>::DEFAULT_NON_NATIVE_FIELD_LIMB_BITS; size_t num_ecc_op_gates = 0; // number of ecc op "gates" (rows); these are placed at the start of the circuit @@ -29,7 +29,7 @@ template class GoblinUltraCircuitBuilder_ : public UltraCircuitBui using SelectorVector = std::vector>; // Wires storing ecc op queue data; values are indices into the variables array - std::array::NUM_WIRES> ecc_op_wires; + std::array::NUM_WIRES> ecc_op_wires; WireVector& ecc_op_wire_1() { return std::get<0>(ecc_op_wires); }; WireVector& ecc_op_wire_2() { return std::get<1>(ecc_op_wires); }; @@ -67,7 +67,7 @@ template class GoblinUltraCircuitBuilder_ : public UltraCircuitBui public: GoblinUltraCircuitBuilder_(const size_t size_hint = 0, std::shared_ptr op_queue_in = std::make_shared()) - : UltraCircuitBuilder_>(size_hint) + : UltraCircuitBuilder_>(size_hint) , op_queue(op_queue_in) { // Set indices to constants corresponding to Goblin ECC op codes @@ -95,7 +95,7 @@ template class GoblinUltraCircuitBuilder_ : public UltraCircuitBui auto& witness_values, std::vector& public_inputs, size_t varnum) - : UltraCircuitBuilder_>(/*size_hint=*/0, witness_values, public_inputs, varnum) + : UltraCircuitBuilder_>(/*size_hint=*/0, witness_values, public_inputs, varnum) , op_queue(op_queue_in) { // Set indices to constants corresponding to Goblin ECC op codes @@ -119,7 +119,7 @@ template class GoblinUltraCircuitBuilder_ : public UltraCircuitBui */ size_t get_num_gates() const override { - auto num_ultra_gates = UltraCircuitBuilder_>::get_num_gates(); + auto num_ultra_gates = UltraCircuitBuilder_>::get_num_gates(); return num_ultra_gates + num_ecc_op_gates; } @@ -134,7 +134,7 @@ template class GoblinUltraCircuitBuilder_ : public UltraCircuitBui size_t romcount = 0; size_t ramcount = 0; size_t nnfcount = 0; - UltraCircuitBuilder_>::get_num_gates_split_into_components( + UltraCircuitBuilder_>::get_num_gates_split_into_components( count, rangecount, romcount, ramcount, nnfcount); size_t total = count + romcount + ramcount + rangecount + num_ecc_op_gates; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.cpp index fd8500a0a71..ca7167c2e16 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.cpp @@ -7,8 +7,6 @@ #include "barretenberg/serialize/cbind.hpp" #include "barretenberg/serialize/msgpack.hpp" -using namespace bb; - namespace bb { /** diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp index 9f0bdc141de..a8c1fa20436 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp @@ -11,7 +11,7 @@ namespace bb { template class StandardCircuitBuilder_ : public CircuitBuilderBase { public: - using Arithmetization = arithmetization::Standard; + using Arithmetization = StandardArith; static constexpr size_t NUM_WIRES = Arithmetization::NUM_WIRES; // Keeping NUM_WIRES, at least temporarily, for backward compatibility static constexpr size_t program_width = Arithmetization::NUM_WIRES; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp index 25e182c0a46..7c395269104 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/toy_avm/toy_avm_circuit_builder.test.cpp @@ -17,8 +17,7 @@ auto& engine = numeric::get_debug_randomness(); */ TEST(ToyAVMCircuitBuilder, BaseCase) { - - using FF = honk::flavor::ToyFlavor::FF; + using FF = ToyFlavor::FF; using Builder = ToyCircuitBuilder; using Row = Builder::Row; Builder circuit_builder; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp index 9845b2ab06e..28a6959b830 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp @@ -10,8 +10,6 @@ #include #include -using namespace bb; - namespace bb { template void UltraCircuitBuilder_::finalize_circuit() @@ -2887,8 +2885,8 @@ inline typename Arithmetization::FF UltraCircuitBuilder_::compu const FF y_3 = w_3_shifted_value; const FF q_sign = q_1_value; const FF q_is_double = q_m_value; - constexpr FF curve_b = CircuitBuilderBase>::EmbeddedCurve::Group::curve_b; - static_assert(CircuitBuilderBase>::EmbeddedCurve::Group::curve_a == 0); + constexpr FF curve_b = CircuitBuilderBase>::EmbeddedCurve::Group::curve_b; + static_assert(CircuitBuilderBase>::EmbeddedCurve::Group::curve_a == 0); FF x_diff = x_2 - x_1; FF y1_sqr = y_1.sqr(); @@ -3484,8 +3482,8 @@ template bool UltraCircuitBuilder_:: circuit_backup.restore_prefinilized_state(this); return result; } -template class UltraCircuitBuilder_>; -template class UltraCircuitBuilder_>; +template class UltraCircuitBuilder_>; +template class UltraCircuitBuilder_>; // To enable this we need to template plookup // template class UltraCircuitBuilder_; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp index 4ee4751b403..055db48379d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp @@ -1171,5 +1171,5 @@ class UltraCircuitBuilder_ : public CircuitBuilderBase>; +using UltraCircuitBuilder = UltraCircuitBuilder_>; } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.test.cpp index aad30452664..9e45324e0d3 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.test.cpp @@ -10,7 +10,7 @@ using namespace bb; class ComposerLibTests : public ::testing::Test { protected: - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = typename Flavor::FF; Flavor::CircuitBuilder circuit_constructor; Flavor::ProvingKey proving_key = []() { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.test.cpp index 3fc4d2bcb3c..bde1e500a41 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.test.cpp @@ -10,7 +10,7 @@ using namespace bb; class PermutationHelperTests : public ::testing::Test { protected: - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = typename Flavor::FF; using ProvingKey = Flavor::ProvingKey; Flavor::CircuitBuilder circuit_constructor; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_delta.hpp b/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_delta.hpp index c49d5e278d3..a68b398b118 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_delta.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_delta.hpp @@ -1,7 +1,7 @@ #pragma once #include -namespace bb::honk { +namespace bb { /** * @brief Compute the correction term for the permutation argument. @@ -83,4 +83,4 @@ Field compute_lookup_grand_product_delta(const Field& beta, const Field& gamma, return gamma_by_one_plus_beta.pow(domain_size); // (γ(1 + β))^n } -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.hpp b/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.hpp index b131c0c2e7b..897d5a63642 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.hpp @@ -7,7 +7,7 @@ #include "barretenberg/relations/relation_parameters.hpp" #include -namespace bb::honk::grand_product_library { +namespace bb { // TODO(luke): This contains utilities for grand product computation and is not specific to the permutation grand // product. Update comments accordingly. @@ -167,4 +167,4 @@ void compute_grand_products(std::shared_ptr& key, }); } -} // namespace bb::honk::grand_product_library \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.test.cpp index 7e78b77e3cd..502b9ca7cb4 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.test.cpp @@ -7,7 +7,6 @@ #include "barretenberg/srs/factories/file_crs_factory.hpp" #include using namespace bb; -using namespace bb::honk; template class GrandProductTests : public testing::Test { @@ -101,8 +100,7 @@ template class GrandProductTests : public testing::Test { ASSERT(Flavor::NUM_WIRES == 4); using RHS = typename bb::UltraPermutationRelation; static_assert(std::same_as); - grand_product_library::compute_grand_product( - proving_key->circuit_size, prover_polynomials, params); + compute_grand_product(proving_key->circuit_size, prover_polynomials, params); // Method 2: Compute z_perm locally using the simplest non-optimized syntax possible. The comment below, // which describes the computation in 4 steps, is adapted from a similar comment in @@ -184,7 +182,7 @@ template class GrandProductTests : public testing::Test { static const size_t num_public_inputs = 0; // Instatiate a proving_key and make a pointer to it. This will be used to instantiate a Prover. - using Flavor = flavor::Ultra; + using Flavor = UltraFlavor; auto proving_key = std::make_shared(circuit_size, num_public_inputs); // Construct mock wire and permutation polynomials. @@ -259,8 +257,7 @@ template class GrandProductTests : public testing::Test { using LHS = typename std::tuple_element::type; using RHS = LookupRelation; static_assert(std::same_as); - grand_product_library::compute_grand_product( - proving_key->circuit_size, prover_polynomials, params); + compute_grand_product(proving_key->circuit_size, prover_polynomials, params); // Method 2: Compute the lookup grand product polynomial Z_lookup: // @@ -341,7 +338,7 @@ TYPED_TEST_SUITE(GrandProductTests, FieldTypes); TYPED_TEST(GrandProductTests, GrandProductPermutation) { - TestFixture::template test_permutation_grand_product_construction(); + TestFixture::template test_permutation_grand_product_construction(); } TYPED_TEST(GrandProductTests, GrandProductLookup) diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp index 132ba614498..d78b066a94a 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp @@ -7,9 +7,8 @@ #include using namespace bb; -using namespace bb::honk; -using Flavor = honk::flavor::Ultra; +using Flavor = UltraFlavor; using Polynomial = typename Flavor::Polynomial; using FF = typename Flavor::FF; @@ -42,7 +41,7 @@ TEST(Protogalaxy, CombinerOn2Instances) for (size_t idx = 0; idx < NUM_INSTANCES; idx++) { auto instance = std::make_shared(); - auto prover_polynomials = honk::get_sequential_prover_polynomials( + auto prover_polynomials = get_sequential_prover_polynomials( /*log_circuit_size=*/1, idx * 128); restrict_to_standard_arithmetic_relation(prover_polynomials); instance->prover_polynomials = std::move(prover_polynomials); @@ -74,7 +73,7 @@ TEST(Protogalaxy, CombinerOn2Instances) for (size_t idx = 0; idx < NUM_INSTANCES; idx++) { auto instance = std::make_shared(); - auto prover_polynomials = honk::get_zero_prover_polynomials( + auto prover_polynomials = get_zero_prover_polynomials( /*log_circuit_size=*/1); restrict_to_standard_arithmetic_relation(prover_polynomials); instance->prover_polynomials = std::move(prover_polynomials); @@ -165,7 +164,7 @@ TEST(Protogalaxy, CombinerOn4Instances) for (size_t idx = 0; idx < NUM_INSTANCES; idx++) { auto instance = std::make_shared(); - auto prover_polynomials = honk::get_zero_prover_polynomials( + auto prover_polynomials = get_zero_prover_polynomials( /*log_circuit_size=*/1); instance->prover_polynomials = std::move(prover_polynomials); instance->instance_size = 2; diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.cpp index f8f5e651e37..51d55e9766a 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.cpp @@ -1,7 +1,7 @@ #include "decider_prover.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { /** * Create DeciderProver_ from an accumulator. @@ -11,7 +11,7 @@ namespace bb::honk { * * @tparam a type of UltraFlavor * */ -template +template DeciderProver_::DeciderProver_(const std::shared_ptr& inst, const std::shared_ptr& commitment_key, const std::shared_ptr& transcript) @@ -24,7 +24,7 @@ DeciderProver_::DeciderProver_(const std::shared_ptr& inst, * @brief Add ϕ, \vec{β}, e to the transcript. These are produced in the last round of folding that was carried out * before deciding. */ -template void DeciderProver_::execute_preamble_round() +template void DeciderProver_::execute_preamble_round() { const auto accumulator_size = static_cast(accumulator->instance_size); const auto num_public_inputs = static_cast(accumulator->public_inputs.size()); @@ -70,9 +70,9 @@ template void DeciderProver_::execute_preamble_roun * challenges and all evaluations at u being calculated. * */ -template void DeciderProver_::execute_relation_check_rounds() +template void DeciderProver_::execute_relation_check_rounds() { - using Sumcheck = sumcheck::SumcheckProver; + using Sumcheck = SumcheckProver; auto instance_size = accumulator->instance_size; auto sumcheck = Sumcheck(instance_size, transcript); sumcheck_output = sumcheck.prove(accumulator); @@ -83,7 +83,7 @@ template void DeciderProver_::execute_relation_chec * @details See https://hackmd.io/dlf9xEwhTQyE3hiGbq4FsA?view for a complete description of the unrolled protocol. * * */ -template void DeciderProver_::execute_zeromorph_rounds() +template void DeciderProver_::execute_zeromorph_rounds() { ZeroMorph::prove(accumulator->prover_polynomials.get_unshifted(), accumulator->prover_polynomials.get_to_be_shifted(), @@ -94,13 +94,13 @@ template void DeciderProver_::execute_zeromorph_rou transcript); } -template honk::proof& DeciderProver_::export_proof() +template HonkProof& DeciderProver_::export_proof() { proof = transcript->proof_data; return proof; } -template honk::proof& DeciderProver_::construct_proof() +template HonkProof& DeciderProver_::construct_proof() { // Add ϕ, \vec{β*}, e* to transcript execute_preamble_round(); @@ -115,7 +115,7 @@ template honk::proof& DeciderProver_::construct_pro return export_proof(); } -template class DeciderProver_; -template class DeciderProver_; +template class DeciderProver_; +template class DeciderProver_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp index 3114446b9c6..68440d5129b 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp @@ -8,9 +8,9 @@ #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { -template class DeciderProver_ { +template class DeciderProver_ { using FF = typename Flavor::FF; using Commitment = typename Flavor::Commitment; using CommitmentKey = typename Flavor::CommitmentKey; @@ -32,8 +32,8 @@ template class DeciderProver_ { BBERG_PROFILE void execute_relation_check_rounds(); BBERG_PROFILE void execute_zeromorph_rounds(); - honk::proof& export_proof(); - honk::proof& construct_proof(); + HonkProof& export_proof(); + HonkProof& construct_proof(); std::shared_ptr accumulator; @@ -45,16 +45,16 @@ template class DeciderProver_ { Polynomial quotient_W; - sumcheck::SumcheckOutput sumcheck_output; + SumcheckOutput sumcheck_output; std::shared_ptr commitment_key; - using ZeroMorph = pcs::zeromorph::ZeroMorphProver_; + using ZeroMorph = ZeroMorphProver_; private: - honk::proof proof; + HonkProof proof; }; -using DeciderProver = DeciderProver_; +using DeciderProver = DeciderProver_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.cpp index ef86acfcb2e..1c6601613fb 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.cpp @@ -4,10 +4,7 @@ #include "barretenberg/sumcheck/instance/verifier_instance.hpp" #include "barretenberg/transcript/transcript.hpp" -using namespace bb; -using namespace bb::honk::sumcheck; - -namespace bb::honk { +namespace bb { template DeciderVerifier_::DeciderVerifier_(const std::shared_ptr& transcript, @@ -26,12 +23,12 @@ DeciderVerifier_::DeciderVerifier_() * e*). * */ -template bool DeciderVerifier_::verify_proof(const honk::proof& proof) +template bool DeciderVerifier_::verify_proof(const HonkProof& proof) { using FF = typename Flavor::FF; using Commitment = typename Flavor::Commitment; using Curve = typename Flavor::Curve; - using ZeroMorph = pcs::zeromorph::ZeroMorphVerifier_; + using ZeroMorph = ZeroMorphVerifier_; using Instance = VerifierInstance_; using VerifierCommitments = typename Flavor::VerifierCommitments; @@ -107,7 +104,7 @@ template bool DeciderVerifier_::verify_proof(const hon return sumcheck_verified.value() && verified; } -template class DeciderVerifier_; -template class DeciderVerifier_; +template class DeciderVerifier_; +template class DeciderVerifier_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp index 3e9b5607673..70ca2033617 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp @@ -5,7 +5,7 @@ #include "barretenberg/srs/global_crs.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { template class DeciderVerifier_ { using FF = typename Flavor::FF; using Commitment = typename Flavor::Commitment; @@ -18,7 +18,7 @@ template class DeciderVerifier_ { explicit DeciderVerifier_(const std::shared_ptr& transcript, const std::shared_ptr& verifier_key = nullptr); - bool verify_proof(const honk::proof& proof); + bool verify_proof(const HonkProof& proof); std::shared_ptr key; std::map commitments; @@ -26,6 +26,6 @@ template class DeciderVerifier_ { std::shared_ptr transcript; }; -using DeciderVerifier = DeciderVerifier_; +using DeciderVerifier = DeciderVerifier_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/folding_result.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/folding_result.hpp index 55bbbd826ac..4bf3eb88fff 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/folding_result.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/folding_result.hpp @@ -2,7 +2,7 @@ #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/instance/prover_instance.hpp" -namespace bb::honk { +namespace bb { /** * @brief The result of running the Protogalaxy prover containing a new accumulator (relaxed instance) as well as the * proof data to instantiate the verifier transcript. @@ -15,4 +15,4 @@ template struct FoldingResult { // TODO(https://github.com/AztecProtocol/barretenberg/issues/656): turn folding data into a struct std::vector folding_data; }; -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp index 6a138c51a51..f5273d654a4 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp @@ -1,6 +1,6 @@ #include "protogalaxy_prover.hpp" #include "barretenberg/flavor/flavor.hpp" -namespace bb::honk { +namespace bb { template void ProtoGalaxyProver_::finalise_and_send_instance(std::shared_ptr instance, const std::string& domain_separator) @@ -307,6 +307,6 @@ FoldingResult ProtoGalaxyProver_>; -template class ProtoGalaxyProver_>; -} // namespace bb::honk \ No newline at end of file +template class ProtoGalaxyProver_>; +template class ProtoGalaxyProver_>; +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp index 5a0794c3dd7..46d4305a30a 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp @@ -11,7 +11,7 @@ #include "barretenberg/relations/utils.hpp" #include "barretenberg/sumcheck/instance/instances.hpp" -namespace bb::honk { +namespace bb { template class ProtoGalaxyProver_ { public: using ProverInstances = ProverInstances_; @@ -434,4 +434,4 @@ template class ProtoGalaxyProver_ { const FF& compressed_perturbator); }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp index 5c8331e0aaf..02923df5972 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp @@ -1,6 +1,6 @@ #include "protogalaxy_verifier.hpp" #include "barretenberg/proof_system/library/grand_product_delta.hpp" -namespace bb::honk { +namespace bb { template void ProtoGalaxyVerifier_::receive_accumulator(const std::shared_ptr& inst, @@ -288,6 +288,6 @@ bool ProtoGalaxyVerifier_::verify_folding_proof(const std::ve return verified; } -template class ProtoGalaxyVerifier_>; -template class ProtoGalaxyVerifier_>; -} // namespace bb::honk \ No newline at end of file +template class ProtoGalaxyVerifier_>; +template class ProtoGalaxyVerifier_>; +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp index cbb23d6cc72..5743a888a0f 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp @@ -6,7 +6,7 @@ #include "barretenberg/sumcheck/instance/instances.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { template class ProtoGalaxyVerifier_ { public: using Flavor = typename VerifierInstances::Flavor; @@ -86,4 +86,4 @@ template class ProtoGalaxyVerifier_ { bool verify_folding_proof(const std::vector&); }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp index 77a1f0b3744..eb79bb21efe 100644 --- a/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp @@ -175,9 +175,9 @@ template class DatabusLookupRelationImpl { const Parameters& params, const FF& scaling_factor) { - honk::logderivative_library:: - accumulate_logderivative_lookup_subrelation_contributions>( - accumulator, in, params, scaling_factor); + + accumulate_logderivative_lookup_subrelation_contributions>( + accumulator, in, params, scaling_factor); } }; diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp index 72bb7b89bc1..46fc53baad3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp @@ -3,7 +3,7 @@ #include "barretenberg/honk/proof_system/logderivative_library.hpp" #include "ecc_msm_relation.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief Expression for ECCVM lookup tables. @@ -25,11 +25,11 @@ void ECCVMLookupRelationImpl::accumulate(ContainerOverSubrelations& accumula const Parameters& params, const FF& scaling_factor) { - logderivative_library::accumulate_logderivative_lookup_subrelation_contributions>( + accumulate_logderivative_lookup_subrelation_contributions>( accumulator, in, params, scaling_factor); } template class ECCVMLookupRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(ECCVMLookupRelationImpl, flavor::ECCVM); +DEFINE_SUMCHECK_RELATION_CLASS(ECCVMLookupRelationImpl, ECCVMFlavor); -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp index e41177bedd4..fd89cbe5819 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp @@ -7,7 +7,7 @@ #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { template class ECCVMLookupRelationImpl { public: @@ -247,4 +247,4 @@ template class ECCVMLookupRelationImpl { template using ECCVMLookupRelation = Relation>; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp index 7cb0f9b088f..44f11fe6a58 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp @@ -2,7 +2,7 @@ #include "barretenberg/flavor/ecc_vm.hpp" #include "barretenberg/flavor/relation_definitions.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief MSM relations that evaluate the Strauss multiscalar multiplication algorithm. @@ -392,6 +392,6 @@ void ECCVMMSMRelationImpl::accumulate(ContainerOverSubrelations& accumulator } template class ECCVMMSMRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(ECCVMMSMRelationImpl, flavor::ECCVM); +DEFINE_SUMCHECK_RELATION_CLASS(ECCVMMSMRelationImpl, ECCVMFlavor); -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp index 6011790fe5c..51e15f608ed 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief MSM relations that evaluate the Strauss multiscalar multiplication algorithm. @@ -51,4 +51,4 @@ template class ECCVMMSMRelationImpl { template using ECCVMMSMRelation = Relation>; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp index 57ca0bc7ea4..a6ef32a0376 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp @@ -2,7 +2,7 @@ #include "barretenberg/flavor/ecc_vm.hpp" #include "barretenberg/flavor/relation_definitions.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief ECCVMPointTableRelationImpl @@ -173,6 +173,6 @@ void ECCVMPointTableRelationImpl::accumulate(ContainerOverSubrelations& accu } template class ECCVMPointTableRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(ECCVMPointTableRelationImpl, flavor::ECCVM); +DEFINE_SUMCHECK_RELATION_CLASS(ECCVMPointTableRelationImpl, ECCVMFlavor); -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp index 2d850420a94..771e54018fd 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief ECCVMPointTableRelationImpl @@ -30,4 +30,4 @@ template class ECCVMPointTableRelationImpl { template using ECCVMPointTableRelation = Relation>; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp index 7dea0fe450e..d52e0599c91 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp @@ -2,7 +2,7 @@ #include "barretenberg/flavor/relation_definitions.hpp" #include "ecc_msm_relation.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief Performs list-equivalence checks for the ECCVM @@ -394,7 +394,7 @@ void ECCVMSetRelationImpl::accumulate(ContainerOverSubrelations& accumulator } template class ECCVMSetRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(ECCVMSetRelationImpl, flavor::ECCVM); -DEFINE_SUMCHECK_PERMUTATION_CLASS(ECCVMSetRelationImpl, flavor::ECCVM); +DEFINE_SUMCHECK_RELATION_CLASS(ECCVMSetRelationImpl, ECCVMFlavor); +DEFINE_SUMCHECK_PERMUTATION_CLASS(ECCVMSetRelationImpl, ECCVMFlavor); -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp index 6d4add0f7f2..41043a88134 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp @@ -7,7 +7,7 @@ #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { template class ECCVMSetRelationImpl { public: @@ -46,4 +46,4 @@ template class ECCVMSetRelationImpl { template using ECCVMSetRelation = Relation>; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp index 40fa62f7591..5e617a02a00 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp @@ -5,7 +5,7 @@ #include "barretenberg/flavor/ecc_vm.hpp" #include "barretenberg/flavor/relation_definitions.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief ECCVMTranscriptRelationImpl evaluates the correctness of the ECCVM transcript columns @@ -256,6 +256,6 @@ void ECCVMTranscriptRelationImpl::accumulate(ContainerOverSubrelations& accu } template class ECCVMTranscriptRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(ECCVMTranscriptRelationImpl, flavor::ECCVM); +DEFINE_SUMCHECK_RELATION_CLASS(ECCVMTranscriptRelationImpl, ECCVMFlavor); -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp index b690db33a8d..ef511e41331 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp @@ -4,7 +4,7 @@ #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief ECCVMTranscriptRelationImpl evaluates the correctness of the ECCVM transcript columns @@ -55,4 +55,4 @@ template class ECCVMTranscriptRelationImpl { template using ECCVMTranscriptRelation = Relation>; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp index 82e832deb0d..b8077336928 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp @@ -2,7 +2,7 @@ #include "barretenberg/flavor/ecc_vm.hpp" #include "barretenberg/flavor/relation_definitions.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief ECCVMWnafRelationImpl evaluates relations that convert scalar multipliers into 4-bit WNAF slices @@ -217,6 +217,6 @@ void ECCVMWnafRelationImpl::accumulate(ContainerOverSubrelations& accumulato } template class ECCVMWnafRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(ECCVMWnafRelationImpl, flavor::ECCVM); +DEFINE_SUMCHECK_RELATION_CLASS(ECCVMWnafRelationImpl, ECCVMFlavor); -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp index 22faa56f6fc..4373d1e7f44 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief ECCVMWnafRelationImpl evaluates relations that convert scalar multipliers into 4-bit WNAF slices * @details Each WNAF slice is a 4-bit slice representing one of 16 integers { -15, -13, ..., 15 } @@ -48,4 +48,4 @@ template class ECCVMWnafRelationImpl { template using ECCVMWnafRelation = Relation>; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/lookup_xor.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/Toy/lookup_xor.hpp index 40f6e5481a8..b94e500d57d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/lookup_xor.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/Toy/lookup_xor.hpp @@ -7,7 +7,7 @@ #include #include -namespace bb::honk::sumcheck { +namespace bb { /** * @brief This class contains an example of how to set LookupSettings classes used by the @@ -19,7 +19,7 @@ namespace bb::honk::sumcheck { * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to * include the new settings * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` * */ @@ -171,4 +171,4 @@ class lookup_xor_lookup_settings { template using lookup_xor_relation = GenericLookupRelation; template using lookup_xor = GenericLookup; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/two_column_perm.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/Toy/two_column_perm.hpp index 77391e221b0..c9eb36311cb 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/Toy/two_column_perm.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/Toy/two_column_perm.hpp @@ -7,7 +7,7 @@ #include #include -namespace bb::honk::sumcheck { +namespace bb { class two_column_perm_permutation_settings { public: @@ -91,4 +91,4 @@ template using two_column_perm_relation = GenericPermutationRelation; template using two_column_perm = GenericPermutation; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generic_lookup/generic_lookup_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/generic_lookup/generic_lookup_relation.hpp index ce779b7c0eb..18b9c872101 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generic_lookup/generic_lookup_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generic_lookup/generic_lookup_relation.hpp @@ -24,7 +24,7 @@ #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief Specifies positions of elements in the tuple of entities received from methods in the Settings class * @@ -468,9 +468,8 @@ template class GenericLookupRelationImpl { const Parameters& params, const FF& scaling_factor) { - logderivative_library:: - accumulate_logderivative_lookup_subrelation_contributions>( - accumulator, in, params, scaling_factor); + accumulate_logderivative_lookup_subrelation_contributions>( + accumulator, in, params, scaling_factor); } }; @@ -479,4 +478,4 @@ using GenericLookupRelation = Relation>; template using GenericLookup = GenericLookupRelationImpl; -} // namespace bb::honk::sumcheck \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generic_permutation/generic_permutation_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/generic_permutation/generic_permutation_relation.hpp index 89ff480a9c5..084132abfa3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generic_permutation/generic_permutation_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generic_permutation/generic_permutation_relation.hpp @@ -15,7 +15,7 @@ #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/relations/relation_types.hpp" -namespace bb::honk::sumcheck { +namespace bb { /** * @brief Specifies positions of elements in the tuple of entities received from methods in the Settings class * @@ -202,9 +202,9 @@ template class GenericPermutationRelationImpl const Parameters& params, const FF& scaling_factor) { - logderivative_library::accumulate_logderivative_permutation_subrelation_contributions< - FF, - GenericPermutationRelationImpl>(accumulator, in, params, scaling_factor); + accumulate_logderivative_permutation_subrelation_contributions>( + accumulator, in, params, scaling_factor); } }; @@ -213,4 +213,4 @@ using GenericPermutationRelation = Relation using GenericPermutation = GenericPermutationRelationImpl; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp index 4f8093f9ad8..890810aee0a 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp @@ -16,7 +16,7 @@ using namespace bb; -using Flavor = honk::flavor::GoblinTranslator; +using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using InputElements = typename Flavor::AllValues; diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp index d2822cd9a6c..07691f0aa21 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp @@ -617,6 +617,6 @@ void GoblinTranslatorDecompositionRelationImpl::accumulate(ContainerOverSubr }; template class GoblinTranslatorDecompositionRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorDecompositionRelationImpl, honk::flavor::GoblinTranslator); +DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorDecompositionRelationImpl, GoblinTranslatorFlavor); } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp index eaf08ada3db..5852d95e681 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp @@ -149,7 +149,7 @@ void GoblinTranslatorAccumulatorTransferRelationImpl::accumulate(ContainerOv template class GoblinTranslatorOpcodeConstraintRelationImpl; template class GoblinTranslatorAccumulatorTransferRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorOpcodeConstraintRelationImpl, honk::flavor::GoblinTranslator); -DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorAccumulatorTransferRelationImpl, honk::flavor::GoblinTranslator); +DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorOpcodeConstraintRelationImpl, GoblinTranslatorFlavor); +DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorAccumulatorTransferRelationImpl, GoblinTranslatorFlavor); } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.cpp index 24db1101cc3..fe5c222a8cc 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.cpp @@ -127,6 +127,6 @@ void GoblinTranslatorGenPermSortRelationImpl::accumulate(ContainerOverSubrel }; template class GoblinTranslatorGenPermSortRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorGenPermSortRelationImpl, honk::flavor::GoblinTranslator); +DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorGenPermSortRelationImpl, GoblinTranslatorFlavor); } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp index 71ce173b8f3..d4231625ff3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp @@ -278,6 +278,6 @@ void GoblinTranslatorNonNativeFieldRelationImpl::accumulate(ContainerOverSub }; template class GoblinTranslatorNonNativeFieldRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorNonNativeFieldRelationImpl, honk::flavor::GoblinTranslator); +DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorNonNativeFieldRelationImpl, GoblinTranslatorFlavor); } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp index 74d4364b8e0..de6aa1d350d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp @@ -60,6 +60,6 @@ void GoblinTranslatorPermutationRelationImpl::accumulate(ContainerOverSubrel }; template class GoblinTranslatorPermutationRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorPermutationRelationImpl, honk::flavor::GoblinTranslator); +DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorPermutationRelationImpl, GoblinTranslatorFlavor); } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp index ca1e082d04d..6c0d18f5fd5 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp @@ -9,25 +9,18 @@ construction in stdlib and contains macros for explicit instantiation. #pragma once #include -namespace bb::honk::flavor { -class Standard; -class Ultra; -} // namespace bb::honk::flavor - namespace bb { +class StandardFlavor; +class UltraFlavor; class Bn254FrParams; class Bn254FqParams; template struct alignas(32) field; -} // namespace bb -namespace arithmetization { -template class Ultra; -} // namespace arithmetization -namespace bb { +template class UltraArith; template class StandardCircuitBuilder_; -using StandardCircuitBuilder = StandardCircuitBuilder_>; -using StandardGrumpkinCircuitBuilder = StandardCircuitBuilder_>; +using StandardCircuitBuilder = StandardCircuitBuilder_>; +using StandardGrumpkinCircuitBuilder = StandardCircuitBuilder_>; template class UltraCircuitBuilder_; -using UltraCircuitBuilder = UltraCircuitBuilder_>>; +using UltraCircuitBuilder = UltraCircuitBuilder_>>; template class GoblinUltraCircuitBuilder_; -using GoblinUltraCircuitBuilder = GoblinUltraCircuitBuilder_>; +using GoblinUltraCircuitBuilder = GoblinUltraCircuitBuilder_>; } // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp index 723ad1f7cf0..fc36ffcdded 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.hpp @@ -18,7 +18,7 @@ template class Transcript { public: using field_ct = field_t; using FF = bb::fr; - using NativeTranscript = bb::honk::BaseTranscript; + using NativeTranscript = BaseTranscript; using StdlibTypes = utility::StdlibTypesUtility; static constexpr size_t HASH_OUTPUT_SIZE = NativeTranscript::HASH_OUTPUT_SIZE; @@ -28,7 +28,7 @@ template class Transcript { Transcript() = default; - Transcript(Builder* builder, const bb::honk::proof& proof_data) + Transcript(Builder* builder, const bb::HonkProof& proof_data) : native_transcript(proof_data) , builder(builder){}; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp index 307e388e368..09c8620c619 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/transcript/transcript.test.cpp @@ -11,10 +11,9 @@ namespace bb::stdlib::recursion::honk { using Builder = UltraCircuitBuilder; -using UltraFlavor = ::bb::honk::flavor::Ultra; -using UltraRecursiveFlavor = ::bb::honk::flavor::UltraRecursive_; +using UltraRecursiveFlavor = UltraRecursiveFlavor_; using FF = fr; -using BaseTranscript = ::bb::honk::BaseTranscript; +using BaseTranscript = BaseTranscript; /** * @brief Create some mock data; add it to the provided prover transcript in various mock rounds diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.cpp index 101615f51e9..5c7ef744e28 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.cpp @@ -17,15 +17,14 @@ DeciderRecursiveVerifier_::DeciderRecursiveVerifier_(Builder* builder) * */ template -std::array DeciderRecursiveVerifier_::verify_proof( - const bb::honk::proof& proof) +std::array DeciderRecursiveVerifier_::verify_proof(const HonkProof& proof) { - using Sumcheck = ::bb::honk::sumcheck::SumcheckVerifier; + using Sumcheck = ::bb::SumcheckVerifier; using Curve = typename Flavor::Curve; - using ZeroMorph = ::bb::honk::pcs::zeromorph::ZeroMorphVerifier_; + using ZeroMorph = ::bb::ZeroMorphVerifier_; using VerifierCommitments = typename Flavor::VerifierCommitments; using Transcript = typename Flavor::Transcript; - using Instance = typename ::bb::honk::VerifierInstance_; + using Instance = VerifierInstance_; static constexpr size_t NUM_SUBRELATIONS = Flavor::NUM_SUBRELATIONS; transcript = std::make_shared(builder, proof); @@ -91,6 +90,6 @@ std::array DeciderRecursiveVerifier_:: return pairing_points; } -template class DeciderRecursiveVerifier_>; -template class DeciderRecursiveVerifier_>; +template class DeciderRecursiveVerifier_>; +template class DeciderRecursiveVerifier_>; } // namespace bb::stdlib::recursion::honk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.hpp index ba6dc021bed..56f8ec1c46d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/decider_recursive_verifier.hpp @@ -19,7 +19,7 @@ template class DeciderRecursiveVerifier_ { public: explicit DeciderRecursiveVerifier_(Builder* builder); - PairingPoints verify_proof(const bb::honk::proof& proof); + PairingPoints verify_proof(const HonkProof& proof); std::map commitments; std::shared_ptr pcs_verification_key; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp index b64bfcf418d..9052d25c071 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp @@ -18,11 +18,8 @@ namespace bb::stdlib::recursion::honk { */ template class GoblinRecursiveVerifierTest : public testing::Test { - // Define types relevant for testing - using UltraFlavor = ::bb::honk::flavor::Ultra; - using GoblinUltraFlavor = ::bb::honk::flavor::GoblinUltra; - using UltraComposer = ::bb::honk::UltraComposer_; - using GoblinUltraComposer = ::bb::honk::UltraComposer_; + using UltraComposer = UltraComposer_; + using GoblinUltraComposer = UltraComposer_; // Define types for the inner circuit, i.e. the circuit whose proof will be recursively verified using InnerFlavor = GoblinUltraFlavor; @@ -34,7 +31,7 @@ template class GoblinRecursiveVerifierTest : public testi // Types for recursive verifier circuit using OuterBuilder = BuilderType; - using RecursiveFlavor = ::bb::honk::flavor::GoblinUltraRecursive_; + using RecursiveFlavor = GoblinUltraRecursiveFlavor_; using RecursiveVerifier = UltraRecursiveVerifier_; using VerificationKey = typename RecursiveVerifier::VerificationKey; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.cpp index 6d809e7ad5a..28fbe6d92df 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.cpp @@ -16,7 +16,7 @@ MergeRecursiveVerifier_::MergeRecursiveVerifier_(CircuitBuilder* */ template std::array::Element, 2> MergeRecursiveVerifier_::verify_proof( - const bb::honk::proof& proof) + const HonkProof& proof) { transcript = std::make_shared(builder, proof); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.hpp index 411b44fd472..9e5a76fbc8d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_recursive_verifier.hpp @@ -11,19 +11,19 @@ template class MergeRecursiveVerifier_ { using FF = typename Curve::ScalarField; using Commitment = typename Curve::Element; using GroupElement = typename Curve::Element; - using KZG = ::bb::honk::pcs::kzg::KZG; - using OpeningClaim = ::bb::honk::pcs::OpeningClaim; + using KZG = ::bb::KZG; + using OpeningClaim = ::bb::OpeningClaim; using PairingPoints = std::array; using Transcript = honk::Transcript; CircuitBuilder* builder; std::shared_ptr transcript; - static constexpr size_t NUM_WIRES = arithmetization::UltraHonk::NUM_WIRES; + static constexpr size_t NUM_WIRES = UltraHonkArith::NUM_WIRES; explicit MergeRecursiveVerifier_(CircuitBuilder* builder); - PairingPoints verify_proof(const bb::honk::proof& proof); + PairingPoints verify_proof(const HonkProof& proof); }; } // namespace bb::stdlib::recursion::goblin diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_verifier.test.cpp index 5c242885de2..04c0fd54e41 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/merge_verifier.test.cpp @@ -20,8 +20,7 @@ class RecursiveMergeVerifierTest : public testing::Test { using RecursiveMergeVerifier = MergeRecursiveVerifier_; // Define types relevant for inner circuit - using GoblinUltraFlavor = ::bb::honk::flavor::GoblinUltra; - using GoblinUltraComposer = ::bb::honk::UltraComposer_; + using GoblinUltraComposer = UltraComposer_; using InnerFlavor = GoblinUltraFlavor; using InnerComposer = GoblinUltraComposer; using InnerBuilder = typename InnerComposer::CircuitBuilder; @@ -29,7 +28,7 @@ class RecursiveMergeVerifierTest : public testing::Test { // Define additional types for testing purposes using Commitment = InnerFlavor::Commitment; using FF = InnerFlavor::FF; - using VerifierCommitmentKey = ::bb::honk::pcs::VerifierCommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; public: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.cpp index d1fdaeee01b..48f6d655c5a 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.cpp @@ -108,10 +108,9 @@ void ProtoGalaxyRecursiveVerifier_::receive_and_finalise_inst transcript->template receive_from_prover(domain_separator + "_" + labels.z_lookup); // Compute correction terms for grand products - const FF public_input_delta = bb::honk::compute_public_input_delta( + const FF public_input_delta = compute_public_input_delta( inst->public_inputs, beta, gamma, inst->instance_size, inst->pub_inputs_offset); - const FF lookup_grand_product_delta = - bb::honk::compute_lookup_grand_product_delta(beta, gamma, inst->instance_size); + const FF lookup_grand_product_delta = compute_lookup_grand_product_delta(beta, gamma, inst->instance_size); inst->relation_parameters = RelationParameters{ eta, beta, gamma, public_input_delta, lookup_grand_product_delta }; @@ -164,7 +163,7 @@ template void ProtoGalaxyRecursiveVerifier_ -void ProtoGalaxyRecursiveVerifier_::verify_folding_proof(const bb::honk::proof& proof) +void ProtoGalaxyRecursiveVerifier_::verify_folding_proof(const HonkProof& proof) { using Transcript = typename Flavor::Transcript; using ElementNative = typename Flavor::Curve::ElementNative; @@ -313,8 +312,7 @@ void ProtoGalaxyRecursiveVerifier_::verify_folding_proof(cons } } +template class ProtoGalaxyRecursiveVerifier_, 2>>; template class ProtoGalaxyRecursiveVerifier_< - bb::honk::VerifierInstances_, 2>>; -template class ProtoGalaxyRecursiveVerifier_< - bb::honk::VerifierInstances_, 2>>; + VerifierInstances_, 2>>; } // namespace bb::stdlib::recursion::honk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.hpp index 7d4305a7ff5..15fc8dabae3 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.hpp @@ -91,7 +91,7 @@ template class ProtoGalaxyRecursiveVerifier_ { * by the prover, are expressed as constraints. */ - void verify_folding_proof(const bb::honk::proof& proof); + void verify_folding_proof(const HonkProof& proof); /** * @brief Evaluates the perturbator at a given scalar, in a sequential manner for the recursive setting. diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.test.cpp index 61dee74084f..34cfdfb303f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/protogalaxy_recursive_verifier.test.cpp @@ -11,14 +11,12 @@ namespace bb::stdlib::recursion::honk { class ProtogalaxyRecursiveTest : public testing::Test { public: // Define types relevant for testing - using UltraFlavor = ::bb::honk::flavor::Ultra; - using GoblinUltraFlavor = ::bb::honk::flavor::GoblinUltra; - using UltraComposer = ::bb::honk::UltraComposer_; - using GoblinUltraComposer = ::bb::honk::UltraComposer_; + using UltraComposer = ::bb::UltraComposer_; + using GoblinUltraComposer = ::bb::UltraComposer_; using InnerFlavor = UltraFlavor; using InnerComposer = UltraComposer; - using Instance = ::bb::honk::ProverInstance_; + using Instance = ::bb::ProverInstance_; using InnerBuilder = typename InnerComposer::CircuitBuilder; using InnerCurve = bn254; using Commitment = InnerFlavor::Commitment; @@ -27,13 +25,13 @@ class ProtogalaxyRecursiveTest : public testing::Test { // Types for recursive verifier circuit // cannot do on Goblin using OuterBuilder = GoblinUltraCircuitBuilder; - using RecursiveFlavor = ::bb::honk::flavor::UltraRecursive_; - using RecursiveVerifierInstances = ::bb::honk::VerifierInstances_; + using RecursiveFlavor = ::bb::UltraRecursiveFlavor_; + using RecursiveVerifierInstances = VerifierInstances_; using FoldingRecursiveVerifier = ProtoGalaxyRecursiveVerifier_; using DeciderRecursiveVerifier = DeciderRecursiveVerifier_; - using DeciderVerifier = ::bb::honk::DeciderVerifier_; - using NativeVerifierInstances = ::bb::honk::VerifierInstances_; - using NativeFoldingVerifier = bb::honk::ProtoGalaxyVerifier_; + using DeciderVerifier = DeciderVerifier_; + using NativeVerifierInstances = VerifierInstances_; + using NativeFoldingVerifier = ProtoGalaxyVerifier_; // Helper for getting composer for prover/verifier of recursive (outer) circuit template static auto get_outer_composer() diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp index 8e86410d3d0..b6e6b4edfed 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.cpp @@ -18,11 +18,11 @@ UltraRecursiveVerifier_::UltraRecursiveVerifier_( * */ template -std::array UltraRecursiveVerifier_::verify_proof(const bb::honk::proof& proof) +std::array UltraRecursiveVerifier_::verify_proof(const HonkProof& proof) { - using Sumcheck = ::bb::honk::sumcheck::SumcheckVerifier; + using Sumcheck = ::bb::SumcheckVerifier; using Curve = typename Flavor::Curve; - using ZeroMorph = ::bb::honk::pcs::zeromorph::ZeroMorphVerifier_; + using ZeroMorph = ::bb::ZeroMorphVerifier_; using VerifierCommitments = typename Flavor::VerifierCommitments; using CommitmentLabels = typename Flavor::CommitmentLabels; using RelationParams = ::bb::RelationParameters; @@ -86,9 +86,9 @@ std::array UltraRecursiveVerifier_::ve transcript->template receive_from_prover(commitment_labels.lookup_inverses); } - const FF public_input_delta = bb::honk::compute_public_input_delta( + const FF public_input_delta = compute_public_input_delta( public_inputs, beta, gamma, circuit_size, static_cast(pub_inputs_offset.get_value())); - const FF lookup_grand_product_delta = bb::honk::compute_lookup_grand_product_delta(beta, gamma, circuit_size); + const FF lookup_grand_product_delta = compute_lookup_grand_product_delta(beta, gamma, circuit_size); relation_parameters.beta = beta; relation_parameters.gamma = gamma; @@ -124,8 +124,8 @@ std::array UltraRecursiveVerifier_::ve return pairing_points; } -template class UltraRecursiveVerifier_>; -template class UltraRecursiveVerifier_>; -template class UltraRecursiveVerifier_>; -template class UltraRecursiveVerifier_>; +template class UltraRecursiveVerifier_>; +template class UltraRecursiveVerifier_>; +template class UltraRecursiveVerifier_>; +template class UltraRecursiveVerifier_>; } // namespace bb::stdlib::recursion::honk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp index 00bb9a9c780..5288b699452 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp @@ -23,7 +23,7 @@ template class UltraRecursiveVerifier_ { // TODO(luke): Eventually this will return something like aggregation_state but I'm simplifying for now until we // determine the exact interface. Simply returns the two pairing points. - PairingPoints verify_proof(const bb::honk::proof& proof); + PairingPoints verify_proof(const HonkProof& proof); std::shared_ptr key; std::map commitments; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp index 3ac3f72678b..7203a67a2c2 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp @@ -19,10 +19,8 @@ namespace bb::stdlib::recursion::honk { template class RecursiveVerifierTest : public testing::Test { // Define types relevant for testing - using UltraFlavor = ::bb::honk::flavor::Ultra; - using GoblinUltraFlavor = ::bb::honk::flavor::GoblinUltra; - using UltraComposer = ::bb::honk::UltraComposer_; - using GoblinUltraComposer = ::bb::honk::UltraComposer_; + using UltraComposer = UltraComposer_; + using GoblinUltraComposer = UltraComposer_; using InnerFlavor = UltraFlavor; using InnerComposer = UltraComposer; @@ -32,7 +30,7 @@ template class RecursiveVerifierTest : public testing::Te using FF = InnerFlavor::FF; // Types for recursive verifier circuit - using RecursiveFlavor = ::bb::honk::flavor::UltraRecursive_; + using RecursiveFlavor = UltraRecursiveFlavor_; using RecursiveVerifier = UltraRecursiveVerifier_; using OuterBuilder = BuilderType; using VerificationKey = typename RecursiveVerifier::VerificationKey; diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp index d8262e40d8f..db792938bd5 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp @@ -2,7 +2,7 @@ #include "barretenberg/sumcheck/instance/prover_instance.hpp" #include "barretenberg/sumcheck/instance/verifier_instance.hpp" -namespace bb::honk { +namespace bb { template struct ProverInstances_ { public: @@ -105,4 +105,4 @@ template struct VerifierInstances_ { std::generate(_data.begin(), _data.end(), []() { return std::make_unique(); }); }; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp index 9bb8ebddc69..5479420510d 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp @@ -5,7 +5,7 @@ #include "barretenberg/proof_system/library/grand_product_delta.hpp" #include "barretenberg/proof_system/library/grand_product_library.hpp" -namespace bb::honk { +namespace bb { /** * @brief Helper method to compute quantities like total number of gates and dyadic circuit size * @@ -407,7 +407,7 @@ void ProverInstance_::compute_logderivative_inverse(FF beta, FF gamma) relation_parameters.gamma = gamma; // Compute permutation and lookup grand product polynomials - logderivative_library::compute_logderivative_inverse( + bb::compute_logderivative_inverse( prover_polynomials, relation_parameters, proving_key->circuit_size); } @@ -422,10 +422,10 @@ template void ProverInstance_::compute_grand_product_poly relation_parameters.lookup_grand_product_delta = lookup_grand_product_delta; // Compute permutation and lookup grand product polynomials - grand_product_library::compute_grand_products(proving_key, prover_polynomials, relation_parameters); + compute_grand_products(proving_key, prover_polynomials, relation_parameters); } -template class ProverInstance_; -template class ProverInstance_; +template class ProverInstance_; +template class ProverInstance_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp index 74106338322..3ab3a2da938 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp @@ -5,7 +5,7 @@ #include "barretenberg/proof_system/composer/composer_lib.hpp" #include "barretenberg/relations/relation_parameters.hpp" -namespace bb::honk { +namespace bb { /** * @brief An Instance is normally constructed from a finalized circuit and it's role is to compute all the polynomials * involved in creating a proof and, if requested, the verification key. @@ -107,4 +107,4 @@ template class ProverInstance_ { void add_plookup_memory_records_to_wire_4(FF); }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp index 86c51e5ed1c..1c9e58e5811 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp @@ -6,7 +6,6 @@ #include "barretenberg/srs/factories/file_crs_factory.hpp" #include using namespace bb; -using namespace bb::honk; template class InstanceTests : public testing::Test { using FF = typename Flavor::FF; @@ -81,7 +80,7 @@ template class InstanceTests : public testing::Test { }; }; -using FlavorTypes = testing::Types; +using FlavorTypes = testing::Types; TYPED_TEST_SUITE(InstanceTests, FlavorTypes); TYPED_TEST(InstanceTests, SortedListAccumulator) diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/verifier_instance.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/verifier_instance.hpp index 05a6a7444e2..9ba56880f84 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/verifier_instance.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/verifier_instance.hpp @@ -2,7 +2,7 @@ #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/relations/relation_parameters.hpp" -namespace bb::honk { +namespace bb { template class VerifierInstance_ { public: using FF = typename Flavor::FF; @@ -28,4 +28,4 @@ template class VerifierInstance_ { WitnessCommitments witness_commitments; CommitmentLabels commitment_labels; }; -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp index 83c5084988a..f10e968e6c8 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp @@ -3,11 +3,13 @@ #include -using namespace bb::honk::sumcheck; +using namespace bb; +namespace { template class PartialEvaluationTests : public testing::Test {}; -using Flavors = testing::Types; +using Flavors = testing::Types; +} // namespace TYPED_TEST_SUITE(PartialEvaluationTests, Flavors); diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp index 7f32a7b9fc7..e3829102c87 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp @@ -5,7 +5,7 @@ #include "barretenberg/transcript/transcript.hpp" #include "sumcheck_round.hpp" -namespace bb::honk::sumcheck { +namespace bb { template class SumcheckProver { @@ -257,4 +257,4 @@ template class SumcheckVerifier { return SumcheckOutput{ multivariate_challenge, purported_evaluations, verified }; }; }; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp index 81a58a3f169..ccb952dc19f 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp @@ -11,10 +11,11 @@ #include "barretenberg/ultra_honk/ultra_composer.hpp" #include + using namespace bb; -using namespace bb::honk; -using namespace bb::honk::sumcheck; -using Flavor = honk::flavor::Ultra; + +namespace { +using Flavor = UltraFlavor; using FF = typename Flavor::FF; using ProverPolynomials = typename Flavor::ProverPolynomials; using RelationSeparator = Flavor::RelationSeparator; @@ -37,6 +38,7 @@ ProverPolynomials construct_ultra_full_polynomials(auto& input_polynomials) } return full_polynomials; } +} // namespace class SumcheckTests : public ::testing::Test { protected: diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_output.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_output.hpp index ea25b076ff8..65624855545 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_output.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_output.hpp @@ -4,7 +4,7 @@ #include #include -namespace bb::honk::sumcheck { +namespace bb { /** * @brief Contains the multi-linear evaluations of the polynomials at the challenge point 'u'. @@ -20,4 +20,4 @@ template struct SumcheckOutput { // Whether or not the claimed multilinear evaluations and final sumcheck evaluation have been confirmed std::optional verified = false; // optional b/c this struct is shared by the Prover/Verifier }; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp index 4b06970542f..5e9edef2f96 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp @@ -7,7 +7,7 @@ #include "barretenberg/relations/relation_types.hpp" #include "barretenberg/relations/utils.hpp" -namespace bb::honk::sumcheck { +namespace bb { /* Notation: The polynomial P(X0, X1) that is the low-degree extension of its values vij = P(i,j) @@ -335,4 +335,4 @@ template class SumcheckVerifierRound { return output; } }; -} // namespace bb::honk::sumcheck +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp index 5091717988e..98381ca823e 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp @@ -3,16 +3,8 @@ #include "barretenberg/relations/utils.hpp" #include -using namespace bb; -using namespace bb::honk; -using namespace bb::honk::sumcheck; - -using bb::BarycentricData; -using bb::Univariate; -using Flavor = flavor::Ultra; -using FF = typename Flavor::FF; -using Utils = RelationUtils; +using namespace bb; /** * @brief Test SumcheckRound functions for operations on tuples (and tuples of tuples) of Univariates @@ -20,7 +12,7 @@ using Utils = RelationUtils; */ TEST(SumcheckRound, SumcheckTupleOfTuplesOfUnivariates) { - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = typename Flavor::FF; using RelationSeparator = typename Flavor::RelationSeparator; @@ -38,7 +30,7 @@ TEST(SumcheckRound, SumcheckTupleOfTuplesOfUnivariates) challenge[0] = 5; challenge[1] = challenge[0].sqr(); FF running_challenge = 1; - Utils::scale_univariates(tuple_of_tuples, challenge, running_challenge); + RelationUtils::scale_univariates(tuple_of_tuples, challenge, running_challenge); // Use extend_and_batch_univariates to extend to MAX_LENGTH then accumulate PowPolynomial pow_polynomial({ 1 }); @@ -54,7 +46,7 @@ TEST(SumcheckRound, SumcheckTupleOfTuplesOfUnivariates) EXPECT_EQ(result, result_expected); // Reinitialize univariate accumulators to zero - Utils::zero_univariates(tuple_of_tuples); + RelationUtils::zero_univariates(tuple_of_tuples); // Check that reinitialization was successful Univariate expected_1({ 0, 0, 0 }); @@ -71,7 +63,7 @@ TEST(SumcheckRound, SumcheckTupleOfTuplesOfUnivariates) */ TEST(SumcheckRound, TuplesOfEvaluationArrays) { - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using Utils = RelationUtils; using FF = typename Flavor::FF; using RelationSeparator = typename Flavor::RelationSeparator; @@ -111,7 +103,7 @@ TEST(SumcheckRound, TuplesOfEvaluationArrays) */ TEST(SumcheckRound, AddTuplesOfTuplesOfUnivariates) { - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = typename Flavor::FF; // Define some arbitrary univariates @@ -133,7 +125,7 @@ TEST(SumcheckRound, AddTuplesOfTuplesOfUnivariates) auto tuple_of_tuples_2 = std::make_tuple(std::make_tuple(univariate_4), std::make_tuple(univariate_5, univariate_6)); - Utils::add_nested_tuples(tuple_of_tuples_1, tuple_of_tuples_2); + RelationUtils::add_nested_tuples(tuple_of_tuples_1, tuple_of_tuples_2); EXPECT_EQ(std::get<0>(std::get<0>(tuple_of_tuples_1)), expected_sum_1); EXPECT_EQ(std::get<0>(std::get<1>(tuple_of_tuples_1)), expected_sum_2); diff --git a/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp b/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp index aaa3b193d98..5b39412ac11 100644 --- a/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp +++ b/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp @@ -10,7 +10,7 @@ // #define LOG_CHALLENGES // #define LOG_INTERACTIONS -namespace bb::honk { +namespace bb { template concept Loggable = (std::same_as || std::same_as || @@ -66,7 +66,7 @@ class BaseTranscript { public: using Fr = bb::fr; using Poseidon2Params = crypto::Poseidon2Bn254ScalarFieldParams; - using Proof = honk::proof; + using Proof = HonkProof; BaseTranscript() = default; @@ -368,4 +368,4 @@ template std::array challenges_to_fie std::move(arr.begin(), arr.end(), result.begin()); return result; } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp b/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp index 05ff79c73e5..2d70ad4a24f 100644 --- a/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp @@ -6,7 +6,7 @@ using namespace bb; using FF = fr; using Fr = fr; using Fq = fq; -using Transcript = honk::BaseTranscript; +using Transcript = BaseTranscript; /** * @brief Test sending, receiving, and exporting proofs diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.cpp index 64846fcc7bb..50b111ef9bc 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.cpp @@ -11,18 +11,11 @@ #include "barretenberg/proof_system/composer/composer_lib.hpp" #include "barretenberg/proof_system/composer/permutation_lib.hpp" -namespace bb::honk { -using Flavor = honk::flavor::GoblinTranslator; -using Curve = typename Flavor::Curve; -using FF = typename Flavor::FF; -using CircuitBuilder = typename Flavor::CircuitBuilder; -using ProvingKey = typename Flavor::ProvingKey; -using VerificationKey = typename Flavor::VerificationKey; -using PCS = typename Flavor::PCS; -using CommitmentKey = typename Flavor::CommitmentKey; -using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey; -using Polynomial = typename Flavor::Polynomial; -using Transcript = typename Flavor::Transcript; +namespace { +using Flavor = bb::GoblinTranslatorFlavor; +} // namespace + +namespace bb { /** * @brief Helper method to compute quantities like total number of gates and dyadic circuit size @@ -56,16 +49,16 @@ void GoblinTranslatorComposer::compute_circuit_size_parameters(CircuitBuilder& c * @return std::vector * */ -std::vector construct_wire_polynomials_base_goblin_translator(const CircuitBuilder& circuit_builder, - const size_t dyadic_circuit_size) +std::vector construct_wire_polynomials_base_goblin_translator( + const typename Flavor::CircuitBuilder& circuit_builder, const size_t dyadic_circuit_size) { const size_t num_gates = circuit_builder.num_gates; - std::vector wire_polynomials; + std::vector wire_polynomials; // Populate the wire polynomials with values from conventional wires for (size_t wire_idx = 0; wire_idx < Flavor::NUM_WIRES; ++wire_idx) { // Expect all values to be set to 0 initially - Polynomial w_lagrange(dyadic_circuit_size); + typename Flavor::Polynomial w_lagrange(dyadic_circuit_size); // Insert conventional gate wire values into the wire polynomial for (size_t i = 0; i < num_gates; ++i) { @@ -176,12 +169,12 @@ void GoblinTranslatorComposer::compute_witness(CircuitBuilder& circuit_builder) // We construct concatenated versions of range constraint polynomials, where several polynomials are concatenated // into one. These polynomials are not commited to. - bb::honk::permutation_library::compute_concatenated_polynomials(proving_key.get()); + bb::compute_concatenated_polynomials(proving_key.get()); // We also contruct ordered polynomials, which have the same values as concatenated ones + enough values to bridge // the range from 0 to maximum range defined by the range constraint. - bb::honk::permutation_library::compute_goblin_translator_range_constraint_ordered_polynomials( - proving_key.get(), mini_circuit_dyadic_size); + bb::compute_goblin_translator_range_constraint_ordered_polynomials(proving_key.get(), + mini_circuit_dyadic_size); computed_witness = true; } @@ -265,13 +258,11 @@ std::shared_ptr GoblinTranslatorComposer::compute_p // Compute polynomials with odd and even indices set to 1 up to the minicircuit margin + lagrange polynomials at // second and second to last indices in the minicircuit - bb::honk::permutation_library::compute_lagrange_polynomials_for_goblin_translator(proving_key.get(), - mini_circuit_dyadic_size); + bb::compute_lagrange_polynomials_for_goblin_translator(proving_key.get(), mini_circuit_dyadic_size); // Compute the numerator for the permutation argument with several repetitions of steps bridging 0 and maximum range // constraint - bb::honk::permutation_library::compute_extra_range_constraint_numerator(proving_key.get(), - dyadic_circuit_size); + bb::compute_extra_range_constraint_numerator(proving_key.get(), dyadic_circuit_size); return proving_key; } @@ -282,7 +273,7 @@ std::shared_ptr GoblinTranslatorComposer::compute_p * @return Pointer to created circuit verification key. * */ -std::shared_ptr GoblinTranslatorComposer::compute_verification_key( +std::shared_ptr GoblinTranslatorComposer::compute_verification_key( const CircuitBuilder& circuit_builder) { if (verification_key) { @@ -307,4 +298,4 @@ std::shared_ptr GoblinTranslatorComposer::compute_verification_ return verification_key; } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.hpp index 55e2ed944ba..9117a03a405 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.hpp @@ -7,10 +7,10 @@ #include "barretenberg/translator_vm/goblin_translator_prover.hpp" #include "barretenberg/translator_vm/goblin_translator_verifier.hpp" -namespace bb::honk { +namespace bb { class GoblinTranslatorComposer { public: - using Flavor = honk::flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using Curve = typename Flavor::Curve; using CircuitBuilder = typename Flavor::CircuitBuilder; using ProvingKey = typename Flavor::ProvingKey; @@ -39,7 +39,7 @@ class GoblinTranslatorComposer { size_t dyadic_circuit_size = 0; // final power-of-2 circuit size size_t mini_circuit_dyadic_size = 0; // The size of the small circuit that contains non-range constraint relations - // We only need the standard crs factory. GoblinTranslator is not supposed to be used with Grumpkin + // We only need the standard crs factory. GoblinTranslatorFlavor is not supposed to be used with Grumpkin GoblinTranslatorComposer() { crs_factory_ = bb::srs::get_crs_factory(); } GoblinTranslatorComposer(std::shared_ptr p_key, std::shared_ptr v_key) @@ -71,4 +71,4 @@ class GoblinTranslatorComposer { return commitment_key; }; }; -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp index 7221bab8ff5..05850f7366a 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp @@ -8,20 +8,18 @@ #include using namespace bb; -using namespace bb::honk; -using CircuitBuilder = flavor::GoblinTranslator::CircuitBuilder; -using Transcript = flavor::GoblinTranslator::Transcript; -using OpQueue = ECCOpQueue; namespace { +using CircuitBuilder = GoblinTranslatorFlavor::CircuitBuilder; +using Transcript = GoblinTranslatorFlavor::Transcript; +using OpQueue = ECCOpQueue; auto& engine = numeric::get_debug_randomness(); -} std::vector add_variables(auto& circuit_constructor, std::vector variables) { std::vector res; - for (size_t i = 0; i < variables.size(); i++) { - res.emplace_back(circuit_constructor.add_variable(variables[i])); + for (fr& variable : variables) { + res.emplace_back(circuit_constructor.add_variable(variable)); } return res; } @@ -39,6 +37,7 @@ class GoblinTranslatorComposerTests : public ::testing::Test { protected: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } }; +} // namespace /** * @brief Test simple circuit with public inputs diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp index da407ae15bd..e6b1e89a963 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp @@ -5,7 +5,7 @@ #include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { /** * Create GoblinTranslatorProver from proving key, witness and manifest. @@ -126,7 +126,7 @@ void GoblinTranslatorProver::execute_grand_product_computation_round() }; } // Compute constraint permutation grand product - grand_product_library::compute_grand_products(key, prover_polynomials, relation_parameters); + compute_grand_products(key, prover_polynomials, relation_parameters); transcript->send_to_verifier(commitment_labels.z_perm, commitment_key->commit(key->z_perm)); } @@ -137,7 +137,7 @@ void GoblinTranslatorProver::execute_grand_product_computation_round() */ void GoblinTranslatorProver::execute_relation_check_rounds() { - using Sumcheck = sumcheck::SumcheckProver; + using Sumcheck = SumcheckProver; auto sumcheck = Sumcheck(key->circuit_size, transcript); FF alpha = transcript->get_challenge("Sumcheck:alpha"); @@ -155,7 +155,7 @@ void GoblinTranslatorProver::execute_relation_check_rounds() * */ void GoblinTranslatorProver::execute_zeromorph_rounds() { - using ZeroMorph = pcs::zeromorph::ZeroMorphProver_; + using ZeroMorph = ZeroMorphProver_; ZeroMorph::prove(prover_polynomials.get_unshifted(), prover_polynomials.get_to_be_shifted(), sumcheck_output.claimed_evaluations.get_unshifted(), @@ -168,13 +168,13 @@ void GoblinTranslatorProver::execute_zeromorph_rounds() prover_polynomials.get_concatenation_groups()); } -honk::proof& GoblinTranslatorProver::export_proof() +HonkProof& GoblinTranslatorProver::export_proof() { proof = transcript->export_proof(); return proof; } -honk::proof& GoblinTranslatorProver::construct_proof() +HonkProof& GoblinTranslatorProver::construct_proof() { // Add circuit size public input size and public inputs to transcript. execute_preamble_round(); @@ -197,4 +197,4 @@ honk::proof& GoblinTranslatorProver::construct_proof() return export_proof(); } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp index 5709f504e9d..4db4f131385 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp @@ -4,13 +4,13 @@ #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" -namespace bb::honk { +namespace bb { -// We won't compile this class with honk::flavor::Standard, but we will like want to compile it (at least for testing) +// We won't compile this class with Standard, but we will like want to compile it (at least for testing) // with a flavor that uses the curve Grumpkin, or a flavor that does/does not have zk, etc. class GoblinTranslatorProver { - using Flavor = honk::flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using BF = typename Flavor::BF; using Commitment = typename Flavor::Commitment; @@ -32,8 +32,8 @@ class GoblinTranslatorProver { BBERG_PROFILE void execute_grand_product_computation_round(); BBERG_PROFILE void execute_relation_check_rounds(); BBERG_PROFILE void execute_zeromorph_rounds(); - honk::proof& export_proof(); - honk::proof& construct_proof(); + HonkProof& export_proof(); + HonkProof& construct_proof(); std::shared_ptr transcript = std::make_shared(); @@ -48,10 +48,10 @@ class GoblinTranslatorProver { std::shared_ptr commitment_key; - sumcheck::SumcheckOutput sumcheck_output; + SumcheckOutput sumcheck_output; private: - honk::proof proof; + HonkProof proof; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.cpp index b83f0b449a8..6165e4f99d9 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.cpp @@ -3,10 +3,7 @@ #include "barretenberg/sumcheck/sumcheck.hpp" #include "barretenberg/transcript/transcript.hpp" -using namespace bb; -using namespace bb::honk::sumcheck; - -namespace bb::honk { +namespace bb { GoblinTranslatorVerifier::GoblinTranslatorVerifier( const std::shared_ptr& verifier_key, @@ -63,9 +60,9 @@ void GoblinTranslatorVerifier::put_translation_data_in_relation_parameters(const }; /** - * @brief This function verifies an GoblinTranslator Honk proof for given program settings. + * @brief This function verifies an GoblinTranslatorFlavor Honk proof for given program settings. */ -bool GoblinTranslatorVerifier::verify_proof(const honk::proof& proof) +bool GoblinTranslatorVerifier::verify_proof(const HonkProof& proof) { batching_challenge_v = transcript->get_challenge("Translation:batching_challenge"); transcript->load_proof(proof); @@ -262,15 +259,14 @@ bool GoblinTranslatorVerifier::verify_proof(const honk::proof& proof) // Execute ZeroMorph rounds. See https://hackmd.io/dlf9xEwhTQyE3hiGbq4FsA?view for a complete description ofthe // unrolled protocol. - auto pairing_points = - pcs::zeromorph::ZeroMorphVerifier_::verify(commitments.get_unshifted(), - commitments.get_to_be_shifted(), - claimed_evaluations.get_unshifted(), - claimed_evaluations.get_shifted(), - multivariate_challenge, - transcript, - commitments.get_concatenation_groups(), - claimed_evaluations.get_concatenated_constraints()); + auto pairing_points = ZeroMorphVerifier_::verify(commitments.get_unshifted(), + commitments.get_to_be_shifted(), + claimed_evaluations.get_unshifted(), + claimed_evaluations.get_shifted(), + multivariate_challenge, + transcript, + commitments.get_concatenation_groups(), + claimed_evaluations.get_concatenated_constraints()); auto verified = pcs_verification_key->pairing_check(pairing_points[0], pairing_points[1]); @@ -312,4 +308,4 @@ bool GoblinTranslatorVerifier::verify_translation(const TranslationEvaluations& return is_value_reconstructed; } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp index 977dc9ed8a8..1af71745bfb 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp @@ -3,10 +3,10 @@ #include "barretenberg/goblin/translation_evaluations.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" -namespace bb::honk { +namespace bb { class GoblinTranslatorVerifier { public: - using Flavor = honk::flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using BF = typename Flavor::BF; using Commitment = typename Flavor::Commitment; @@ -35,7 +35,7 @@ class GoblinTranslatorVerifier { void put_translation_data_in_relation_parameters(const uint256_t& evaluation_input_x, const BF& batching_challenge_v, const uint256_t& accumulated_result); - bool verify_proof(const honk::proof& proof); + bool verify_proof(const HonkProof& proof); bool verify_translation(const TranslationEvaluations& translation_evaluations); }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp index 6dcc73e1f7f..bbec6530151 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp @@ -10,7 +10,6 @@ #include "barretenberg/ultra_honk/ultra_composer.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" using namespace bb; -using namespace bb::honk; namespace { auto& engine = numeric::get_debug_randomness(); @@ -23,7 +22,7 @@ class DataBusComposerTests : public ::testing::Test { using Curve = curve::BN254; using FF = Curve::ScalarField; using Point = Curve::AffineElement; - using CommitmentKey = pcs::CommitmentKey; + using CommitmentKey = bb::CommitmentKey; /** * @brief Generate a simple test circuit that includes arithmetic and goblin ecc op gates diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp index ff5d21488c3..b9e5fc5c669 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp @@ -7,12 +7,11 @@ #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/ultra_honk/ultra_composer.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" + using namespace bb; -using namespace bb::honk; namespace { auto& engine = numeric::get_debug_randomness(); -} class GoblinUltraHonkComposerTests : public ::testing::Test { protected: @@ -21,7 +20,7 @@ class GoblinUltraHonkComposerTests : public ::testing::Test { using Curve = curve::BN254; using FF = Curve::ScalarField; using Point = Curve::AffineElement; - using CommitmentKey = pcs::CommitmentKey; + using CommitmentKey = bb::CommitmentKey; /** * @brief Generate a simple test circuit with some ECC op gates and conventional arithmetic gates @@ -82,6 +81,7 @@ class GoblinUltraHonkComposerTests : public ::testing::Test { return verified; } }; +} // namespace /** * @brief Test proof construction/verification for a circuit with ECC op gates, public inputs, and basic arithmetic diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_transcript.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_transcript.test.cpp index 70247e48a0d..a557b138dae 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_transcript.test.cpp @@ -7,13 +7,12 @@ #include using namespace bb; -using namespace bb::honk; class GoblinUltraTranscriptTests : public ::testing::Test { public: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } - using Flavor = honk::flavor::GoblinUltra; + using Flavor = GoblinUltraFlavor; using FF = Flavor::FF; /** diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.cpp index c79fe9a8689..328a7ead912 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.cpp @@ -1,6 +1,6 @@ #include "merge_prover.hpp" -namespace bb::honk { +namespace bb { /** * Create MergeProver_ @@ -27,9 +27,9 @@ MergeProver_::MergeProver_(const std::shared_ptr& commitm * for details (https://github.com/AztecProtocol/barretenberg/issues/746). * * @tparam Flavor - * @return honk::proof& + * @return HonkProof& */ -template honk::proof& MergeProver_::construct_proof() +template HonkProof& MergeProver_::construct_proof() { size_t N = op_queue->get_current_size(); @@ -116,7 +116,7 @@ template honk::proof& MergeProver_::construct_proof() return proof; } -template class MergeProver_; -template class MergeProver_; +template class MergeProver_; +template class MergeProver_; -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp index 8693f77ed8c..5ba8c85769e 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp @@ -7,7 +7,7 @@ #include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { /** * @brief Prover class for the Goblin ECC op queue transcript merge protocol @@ -21,8 +21,8 @@ template class MergeProver_ { using Commitment = typename Flavor::Commitment; using PCS = typename Flavor::PCS; using Curve = typename Flavor::Curve; - using OpeningClaim = typename pcs::ProverOpeningClaim; - using OpeningPair = typename pcs::OpeningPair; + using OpeningClaim = ProverOpeningClaim; + using OpeningPair = bb::OpeningPair; using Transcript = BaseTranscript; public: @@ -33,10 +33,10 @@ template class MergeProver_ { explicit MergeProver_(const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& transcript = std::make_shared()); - BBERG_PROFILE honk::proof& construct_proof(); + BBERG_PROFILE HonkProof& construct_proof(); private: - honk::proof proof; + HonkProof proof; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp index a50c25a0d57..c00504c95a5 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp @@ -1,6 +1,6 @@ #include "merge_verifier.hpp" -namespace bb::honk { +namespace bb { template MergeVerifier_::MergeVerifier_() @@ -16,9 +16,9 @@ MergeVerifier_::MergeVerifier_() * queue has been constructed correctly via a simple Schwartz-Zippel check. Evaluations are checked via batched KZG. * * @tparam Flavor - * @return honk::proof& + * @return HonkProof& */ -template bool MergeVerifier_::verify_proof(const honk::proof& proof) +template bool MergeVerifier_::verify_proof(const HonkProof& proof) { transcript = std::make_shared(proof); @@ -41,16 +41,16 @@ template bool MergeVerifier_::verify_proof(const honk: std::vector opening_claims; for (size_t idx = 0; idx < Flavor::NUM_WIRES; ++idx) { T_prev_evals[idx] = transcript->template receive_from_prover("T_prev_eval_" + std::to_string(idx + 1)); - opening_claims.emplace_back(pcs::OpeningClaim{ { kappa, T_prev_evals[idx] }, C_T_prev[idx] }); + opening_claims.emplace_back(OpeningClaim{ { kappa, T_prev_evals[idx] }, C_T_prev[idx] }); } for (size_t idx = 0; idx < Flavor::NUM_WIRES; ++idx) { t_shift_evals[idx] = transcript->template receive_from_prover("t_shift_eval_" + std::to_string(idx + 1)); - opening_claims.emplace_back(pcs::OpeningClaim{ { kappa, t_shift_evals[idx] }, C_t_shift[idx] }); + opening_claims.emplace_back(OpeningClaim{ { kappa, t_shift_evals[idx] }, C_t_shift[idx] }); } for (size_t idx = 0; idx < Flavor::NUM_WIRES; ++idx) { T_current_evals[idx] = transcript->template receive_from_prover("T_current_eval_" + std::to_string(idx + 1)); - opening_claims.emplace_back(pcs::OpeningClaim{ { kappa, T_current_evals[idx] }, C_T_current[idx] }); + opening_claims.emplace_back(OpeningClaim{ { kappa, T_current_evals[idx] }, C_T_current[idx] }); } // Check the identity T_i(\kappa) = T_{i-1}(\kappa) + t_i^{shift}(\kappa). If it fails, return false @@ -79,7 +79,7 @@ template bool MergeVerifier_::verify_proof(const honk: return identity_checked && verified; } -template class MergeVerifier_; -template class MergeVerifier_; +template class MergeVerifier_; +template class MergeVerifier_; -} // namespace bb::honk \ No newline at end of file +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp index a32d071eb9b..8081c060450 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp @@ -8,7 +8,7 @@ #include "barretenberg/srs/global_crs.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { /** * @brief Verifier class for the Goblin ECC op queue transcript merge protocol @@ -22,7 +22,7 @@ template class MergeVerifier_ { using Commitment = typename Flavor::Commitment; using PCS = typename Flavor::PCS; using Curve = typename Flavor::Curve; - using OpeningClaim = typename pcs::OpeningClaim; + using OpeningClaim = typename bb::OpeningClaim; using VerificationKey = typename Flavor::VerificationKey; using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey; using Transcript = typename Flavor::Transcript; @@ -33,7 +33,7 @@ template class MergeVerifier_ { std::shared_ptr pcs_verification_key; explicit MergeVerifier_(); - bool verify_proof(const honk::proof& proof); + bool verify_proof(const HonkProof& proof); }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp index 1f41c5325ab..651c05fa19c 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp @@ -2,10 +2,11 @@ #include "barretenberg/protogalaxy/protogalaxy_prover.hpp" #include "barretenberg/ultra_honk/ultra_composer.hpp" #include + using namespace bb; -using namespace bb::honk; -using Flavor = flavor::Ultra; +namespace { +using Flavor = UltraFlavor; using VerificationKey = Flavor::VerificationKey; using Instance = ProverInstance_; using Instances = ProverInstances_; @@ -20,9 +21,7 @@ using CommitmentKey = Flavor::CommitmentKey; const size_t NUM_POLYNOMIALS = Flavor::NUM_ALL_ENTITIES; -namespace { auto& engine = numeric::get_debug_randomness(); -} // TODO(https://github.com/AztecProtocol/barretenberg/issues/744): make testing utility with functionality shared // amongst test files in the proof system Polynomial get_random_polynomial(size_t size) @@ -87,6 +86,7 @@ class ProtoGalaxyTests : public ::testing::Test { public: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } }; +} // namespace TEST_F(ProtoGalaxyTests, FullHonkEvaluationsValidCircuit) { diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp index b9313be2496..2b5ec50f37e 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp @@ -12,7 +12,6 @@ #include "barretenberg/ultra_honk/ultra_composer.hpp" #include using namespace bb; -using namespace bb::honk; void ensure_non_zero(auto& polynomial) { @@ -253,7 +252,7 @@ class RelationCorrectnessTests : public ::testing::Test { // TODO(luke): Add a gate that sets q_arith = 3 to check secondary arithmetic relation TEST_F(RelationCorrectnessTests, UltraRelationCorrectness) { - using Flavor = flavor::Ultra; + using Flavor = UltraFlavor; using FF = typename Flavor::FF; // Create a composer and then add an assortment of gates designed to ensure that the constraint(s) represented @@ -305,7 +304,7 @@ TEST_F(RelationCorrectnessTests, UltraRelationCorrectness) TEST_F(RelationCorrectnessTests, GoblinUltraRelationCorrectness) { - using Flavor = flavor::GoblinUltra; + using Flavor = GoblinUltraFlavor; using FF = typename Flavor::FF; // Create a composer and then add an assortment of gates designed to ensure that the constraint(s) represented @@ -373,11 +372,10 @@ TEST_F(RelationCorrectnessTests, GoblinUltraRelationCorrectness) */ TEST_F(RelationCorrectnessTests, GoblinTranslatorPermutationRelationCorrectness) { - using Flavor = flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using ProverPolynomials = typename Flavor::ProverPolynomials; using Polynomial = bb::Polynomial; - using namespace bb::honk::permutation_library; auto& engine = numeric::get_debug_randomness(); const size_t mini_circuit_size = 2048; auto full_circuit_size = mini_circuit_size * Flavor::CONCATENATION_GROUP_SIZE; @@ -480,7 +478,7 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorPermutationRelationCorrectness) compute_concatenated_polynomials(&prover_polynomials); // Compute the grand product polynomial - grand_product_library::compute_grand_product>( + compute_grand_product>( full_circuit_size, prover_polynomials, params); prover_polynomials.z_perm_shift = prover_polynomials.z_perm.shifted(); @@ -492,7 +490,7 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorPermutationRelationCorrectness) TEST_F(RelationCorrectnessTests, GoblinTranslatorGenPermSortRelationCorrectness) { - using Flavor = flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using ProverPolynomials = typename Flavor::ProverPolynomials; using Polynomial = bb::Polynomial; @@ -566,13 +564,13 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorGenPermSortRelationCorrectness) } /** - * @brief Test the correctness of GoblinTranslator's extra relations (GoblinTranslatorOpcodeConstraintRelation and - * GoblinTranslatorAccumulatorTransferRelation) + * @brief Test the correctness of GoblinTranslatorFlavor's extra relations (GoblinTranslatorOpcodeConstraintRelation + * and GoblinTranslatorAccumulatorTransferRelation) * */ TEST_F(RelationCorrectnessTests, GoblinTranslatorExtraRelationsCorrectness) { - using Flavor = flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using ProverPolynomials = typename Flavor::ProverPolynomials; using ProverPolynomialIds = typename Flavor::ProverPolynomialIds; @@ -669,12 +667,12 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorExtraRelationsCorrectness) check_relation>(circuit_size, prover_polynomials, params); } /** - * @brief Test the correctness of GoblinTranslator's Decomposition Relation + * @brief Test the correctness of GoblinTranslatorFlavor's Decomposition Relation * */ TEST_F(RelationCorrectnessTests, GoblinTranslatorDecompositionRelationCorrectness) { - using Flavor = flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using BF = typename Flavor::BF; using ProverPolynomials = typename Flavor::ProverPolynomials; @@ -1043,12 +1041,12 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorDecompositionRelationCorrectnes } /** - * @brief Test the correctness of GoblinTranslator's NonNativeField Relation + * @brief Test the correctness of GoblinTranslatorFlavor's NonNativeField Relation * */ TEST_F(RelationCorrectnessTests, GoblinTranslatorNonNativeRelationCorrectness) { - using Flavor = flavor::GoblinTranslator; + using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; using BF = typename Flavor::BF; using ProverPolynomials = typename Flavor::ProverPolynomials; diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp index fe0fede946c..2f736f2ed82 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp @@ -15,10 +15,8 @@ #include using namespace bb; -using namespace bb::honk; -using namespace bb::honk::sumcheck; -using Flavor = honk::flavor::Ultra; +using Flavor = UltraFlavor; using FF = typename Flavor::FF; class SumcheckTestsRealCircuit : public ::testing::Test { @@ -32,7 +30,7 @@ class SumcheckTestsRealCircuit : public ::testing::Test { */ TEST_F(SumcheckTestsRealCircuit, Ultra) { - using Flavor = flavor::Ultra; + using Flavor = UltraFlavor; using FF = typename Flavor::FF; using Transcript = typename Flavor::Transcript; using RelationSeparator = typename Flavor::RelationSeparator; diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.cpp index 320c325827e..ae42bd4366a 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.cpp @@ -4,14 +4,14 @@ #include "barretenberg/proof_system/composer/permutation_lib.hpp" #include "barretenberg/proof_system/library/grand_product_library.hpp" -namespace bb::honk { +namespace bb { /** * Compute verification key consisting of selector precommitments. * * @return Pointer to the resulting verification key of the Instance. * */ -template +template void UltraComposer_::compute_verification_key(const std::shared_ptr>& instance) { if (instance->verification_key) { @@ -64,7 +64,7 @@ void UltraComposer_::compute_verification_key(const std::shared_ptrverification_key = std::move(verification_key); } -template +template std::shared_ptr> UltraComposer_::create_instance(CircuitBuilder& circuit) { circuit.add_gates_to_ensure_all_polys_are_non_zero(); @@ -76,7 +76,7 @@ std::shared_ptr> UltraComposer_::create_instance return instance; } -template +template UltraProver_ UltraComposer_::create_prover(const std::shared_ptr& instance, const std::shared_ptr& transcript) { @@ -85,7 +85,7 @@ UltraProver_ UltraComposer_::create_prover(const std::shared_ptr return output_state; } -template +template UltraVerifier_ UltraComposer_::create_verifier(const std::shared_ptr& instance, const std::shared_ptr& transcript) { @@ -97,7 +97,7 @@ UltraVerifier_ UltraComposer_::create_verifier(const std::shared return output_state; } -template +template DeciderProver_ UltraComposer_::create_decider_prover(const std::shared_ptr& accumulator, const std::shared_ptr& transcript) { @@ -107,7 +107,7 @@ DeciderProver_ UltraComposer_::create_decider_prover(const std:: return output_state; } -template +template DeciderProver_ UltraComposer_::create_decider_prover( const std::shared_ptr& accumulator, const std::shared_ptr& commitment_key, @@ -118,7 +118,7 @@ DeciderProver_ UltraComposer_::create_decider_prover( return output_state; } -template +template DeciderVerifier_ UltraComposer_::create_decider_verifier(const std::shared_ptr& accumulator, const std::shared_ptr& transcript) { @@ -130,6 +130,6 @@ DeciderVerifier_ UltraComposer_::create_decider_verifier(const s return output_state; } -template class UltraComposer_; -template class UltraComposer_; -} // namespace bb::honk +template class UltraComposer_; +template class UltraComposer_; +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp index 5d2a6a71ea2..57ae8c06f99 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp @@ -12,8 +12,8 @@ #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" -namespace bb::honk { -template class UltraComposer_ { +namespace bb { +template class UltraComposer_ { public: using CircuitBuilder = typename Flavor::CircuitBuilder; using ProvingKey = typename Flavor::ProvingKey; @@ -134,6 +134,6 @@ template class UltraComposer_ { }; // TODO(#532): this pattern is weird; is this not instantiating the templates? -using UltraComposer = UltraComposer_; -using GoblinUltraComposer = UltraComposer_; -} // namespace bb::honk +using UltraComposer = UltraComposer_; +using GoblinUltraComposer = UltraComposer_; +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp index 09a1bdb72f3..205a67aad24 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp @@ -17,7 +17,6 @@ #include using namespace bb; -using namespace bb::honk; namespace { auto& engine = numeric::get_debug_randomness(); diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp index 40fc15a3369..16118067408 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp @@ -1,7 +1,7 @@ #include "ultra_prover.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { /** * Create UltraProver_ from an instance. @@ -10,7 +10,7 @@ namespace bb::honk { * * @tparam a type of UltraFlavor * */ -template +template UltraProver_::UltraProver_(const std::shared_ptr& inst, const std::shared_ptr& commitment_key, const std::shared_ptr& transcript) @@ -25,7 +25,7 @@ UltraProver_::UltraProver_(const std::shared_ptr& inst, * @brief Add circuit size, public input size, and public inputs to transcript * */ -template void UltraProver_::execute_preamble_round() +template void UltraProver_::execute_preamble_round() { auto proving_key = instance->proving_key; const auto circuit_size = static_cast(proving_key->circuit_size); @@ -46,7 +46,7 @@ template void UltraProver_::execute_preamble_round( * only commited to after adding memory records. In the Goblin Flavor, we also commit to the ECC OP wires and the * DataBus columns. */ -template void UltraProver_::execute_wire_commitments_round() +template void UltraProver_::execute_wire_commitments_round() { auto& witness_commitments = instance->witness_commitments; auto& proving_key = instance->proving_key; @@ -89,7 +89,7 @@ template void UltraProver_::execute_wire_commitment * @brief Compute sorted witness-table accumulator and commit to the resulting polynomials. * */ -template void UltraProver_::execute_sorted_list_accumulator_round() +template void UltraProver_::execute_sorted_list_accumulator_round() { FF eta = transcript->get_challenge("eta"); @@ -109,7 +109,7 @@ template void UltraProver_::execute_sorted_list_acc * @brief Compute log derivative inverse polynomial and its commitment, if required * */ -template void UltraProver_::execute_log_derivative_inverse_round() +template void UltraProver_::execute_log_derivative_inverse_round() { // Compute and store challenges beta and gamma auto [beta, gamma] = challenges_to_field_elements(transcript->get_challenges("beta", "gamma")); @@ -128,7 +128,7 @@ template void UltraProver_::execute_log_derivative_ * @brief Compute permutation and lookup grand product polynomials and their commitments * */ -template void UltraProver_::execute_grand_product_computation_round() +template void UltraProver_::execute_grand_product_computation_round() { instance->compute_grand_product_polynomials(relation_parameters.beta, relation_parameters.gamma); @@ -144,9 +144,9 @@ template void UltraProver_::execute_grand_product_c * @brief Run Sumcheck resulting in u = (u_1,...,u_d) challenges and all evaluations at u being calculated. * */ -template void UltraProver_::execute_relation_check_rounds() +template void UltraProver_::execute_relation_check_rounds() { - using Sumcheck = sumcheck::SumcheckProver; + using Sumcheck = SumcheckProver; auto circuit_size = instance->proving_key->circuit_size; auto sumcheck = Sumcheck(circuit_size, transcript); RelationSeparator alphas; @@ -167,7 +167,7 @@ template void UltraProver_::execute_relation_check_ * @details See https://hackmd.io/dlf9xEwhTQyE3hiGbq4FsA?view for a complete description of the unrolled protocol. * * */ -template void UltraProver_::execute_zeromorph_rounds() +template void UltraProver_::execute_zeromorph_rounds() { ZeroMorph::prove(instance->prover_polynomials.get_unshifted(), instance->prover_polynomials.get_to_be_shifted(), @@ -178,13 +178,13 @@ template void UltraProver_::execute_zeromorph_round transcript); } -template honk::proof& UltraProver_::export_proof() +template HonkProof& UltraProver_::export_proof() { proof = transcript->proof_data; return proof; } -template honk::proof& UltraProver_::construct_proof() +template HonkProof& UltraProver_::construct_proof() { // Add circuit size public input size and public inputs to transcript-> execute_preamble_round(); @@ -212,7 +212,7 @@ template honk::proof& UltraProver_::construct_proof return export_proof(); } -template class UltraProver_; -template class UltraProver_; +template class UltraProver_; +template class UltraProver_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp index 13d3a1cc1b8..8e211390dd7 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp @@ -8,9 +8,9 @@ #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { -template class UltraProver_ { +template class UltraProver_ { using FF = typename Flavor::FF; using Commitment = typename Flavor::Commitment; using CommitmentKey = typename Flavor::CommitmentKey; @@ -35,8 +35,8 @@ template class UltraProver_ { BBERG_PROFILE void execute_relation_check_rounds(); BBERG_PROFILE void execute_zeromorph_rounds(); - honk::proof& export_proof(); - honk::proof& construct_proof(); + HonkProof& export_proof(); + HonkProof& construct_proof(); std::shared_ptr instance; @@ -48,17 +48,17 @@ template class UltraProver_ { Polynomial quotient_W; - sumcheck::SumcheckOutput sumcheck_output; + SumcheckOutput sumcheck_output; std::shared_ptr commitment_key; - using ZeroMorph = pcs::zeromorph::ZeroMorphProver_; + using ZeroMorph = ZeroMorphProver_; private: - honk::proof proof; + HonkProof proof; }; -using UltraProver = UltraProver_; -using GoblinUltraProver = UltraProver_; +using UltraProver = UltraProver_; +using GoblinUltraProver = UltraProver_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp index 3dc2e8f1d3b..609b455e22f 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp @@ -7,13 +7,12 @@ #include using namespace bb; -using namespace bb::honk; class UltraTranscriptTests : public ::testing::Test { public: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } - using Flavor = honk::flavor::Ultra; + using Flavor = UltraFlavor; using FF = Flavor::FF; /** diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.cpp index b0ee1339dd1..4ab7b6addf3 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.cpp @@ -3,10 +3,7 @@ #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/transcript/transcript.hpp" -using namespace bb; -using namespace bb::honk::sumcheck; - -namespace bb::honk { +namespace bb { template UltraVerifier_::UltraVerifier_(const std::shared_ptr& transcript, const std::shared_ptr& verifier_key) @@ -45,12 +42,12 @@ template UltraVerifier_& UltraVerifier_::opera * @brief This function verifies an Ultra Honk proof for a given Flavor. * */ -template bool UltraVerifier_::verify_proof(const honk::proof& proof) +template bool UltraVerifier_::verify_proof(const HonkProof& proof) { using FF = typename Flavor::FF; using Commitment = typename Flavor::Commitment; using Curve = typename Flavor::Curve; - using ZeroMorph = pcs::zeromorph::ZeroMorphVerifier_; + using ZeroMorph = ZeroMorphVerifier_; using VerifierCommitments = typename Flavor::VerifierCommitments; using CommitmentLabels = typename Flavor::CommitmentLabels; @@ -163,7 +160,7 @@ template bool UltraVerifier_::verify_proof(const honk: return sumcheck_verified.value() && verified; } -template class UltraVerifier_; -template class UltraVerifier_; +template class UltraVerifier_; +template class UltraVerifier_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp index 0c5dd4a9f1d..9e6df95ebb8 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp @@ -5,7 +5,7 @@ #include "barretenberg/srs/global_crs.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { template class UltraVerifier_ { using FF = typename Flavor::FF; using Commitment = typename Flavor::Commitment; @@ -24,7 +24,7 @@ template class UltraVerifier_ { UltraVerifier_& operator=(const UltraVerifier_& other) = delete; UltraVerifier_& operator=(UltraVerifier_&& other); - bool verify_proof(const honk::proof& proof); + bool verify_proof(const HonkProof& proof); std::shared_ptr key; std::map commitments; @@ -32,7 +32,7 @@ template class UltraVerifier_ { std::shared_ptr transcript; }; -using UltraVerifier = UltraVerifier_; -using GoblinUltraVerifier = UltraVerifier_; +using UltraVerifier = UltraVerifier_; +using GoblinUltraVerifier = UltraVerifier_; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp index f8e06ef180b..fdbf49ebe57 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp @@ -4,7 +4,7 @@ #include "barretenberg/proof_system/circuit_builder/generated/AvmMini_circuit_builder.hpp" #include -using Flavor = bb::honk::flavor::AvmMiniFlavor; +using Flavor = bb::AvmMiniFlavor; using FF = Flavor::FF; using Row = bb::AvmMiniFullRow; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp index 22703836848..9a5f8f5a396 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.cpp @@ -11,6 +11,8 @@ #include #include +using namespace bb; + namespace avm_trace { /** @@ -22,14 +24,14 @@ namespace avm_trace { * @throws runtime_error exception when the bytecode is invalid. * @return A zk proof of the execution. */ -honk::proof Execution::run_and_prove(std::vector const& bytecode, std::vector const& calldata) +HonkProof Execution::run_and_prove(std::vector const& bytecode, std::vector const& calldata) { auto instructions = parse(bytecode); auto trace = gen_trace(instructions, calldata); auto circuit_builder = bb::AvmMiniCircuitBuilder(); circuit_builder.set_trace(std::move(trace)); - auto composer = bb::honk::AvmMiniComposer(); + auto composer = AvmMiniComposer(); auto prover = composer.create_prover(circuit_builder); return prover.construct_proof(); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.hpp index db6ffce56b0..ae041f65bb0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_execution.hpp @@ -22,7 +22,7 @@ class Execution { static std::vector parse(std::vector const& bytecode); static std::vector gen_trace(std::vector const& instructions, std::vector const& calldata); - static honk::proof run_and_prove(std::vector const& bytecode, std::vector const& calldata); + static bb::HonkProof run_and_prove(std::vector const& bytecode, std::vector const& calldata); }; } // namespace avm_trace \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.cpp index a948d5a2a45..a27776eabea 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.cpp @@ -6,9 +6,9 @@ #include "barretenberg/proof_system/composer/permutation_lib.hpp" #include "barretenberg/vm/generated/AvmMini_verifier.hpp" -namespace bb::honk { +namespace bb { -using Flavor = honk::flavor::AvmMiniFlavor; +using Flavor = AvmMiniFlavor; void AvmMiniComposer::compute_witness(CircuitConstructor& circuit) { if (computed_witness) { @@ -83,4 +83,4 @@ std::shared_ptr AvmMiniComposer::compute_verification_k return verification_key; } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.hpp index 17299dff8e7..61a6fbfa622 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_composer.hpp @@ -8,10 +8,10 @@ #include "barretenberg/vm/generated/AvmMini_prover.hpp" #include "barretenberg/vm/generated/AvmMini_verifier.hpp" -namespace bb::honk { +namespace bb { class AvmMiniComposer { public: - using Flavor = honk::flavor::AvmMiniFlavor; + using Flavor = AvmMiniFlavor; using CircuitConstructor = AvmMiniCircuitBuilder; using ProvingKey = Flavor::ProvingKey; using VerificationKey = Flavor::VerificationKey; @@ -66,4 +66,4 @@ class AvmMiniComposer { }; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.cpp index 5dc17405239..d79339a530b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.cpp @@ -11,9 +11,9 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { -using Flavor = honk::flavor::AvmMiniFlavor; +using Flavor = AvmMiniFlavor; using FF = Flavor::FF; /** @@ -70,7 +70,7 @@ void AvmMiniProver::execute_wire_commitments_round() */ void AvmMiniProver::execute_relation_check_rounds() { - using Sumcheck = sumcheck::SumcheckProver; + using Sumcheck = SumcheckProver; auto sumcheck = Sumcheck(key->circuit_size, transcript); @@ -99,13 +99,13 @@ void AvmMiniProver::execute_zeromorph_rounds() transcript); } -honk::proof& AvmMiniProver::export_proof() +HonkProof& AvmMiniProver::export_proof() { proof = transcript->proof_data; return proof; } -bb::honk::proof& AvmMiniProver::construct_proof() +HonkProof& AvmMiniProver::construct_proof() { // Add circuit size public input size and public inputs to transcript. execute_preamble_round(); @@ -132,4 +132,4 @@ bb::honk::proof& AvmMiniProver::construct_proof() return export_proof(); } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.hpp index 7c88d3b455e..726ea473bf2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_prover.hpp @@ -8,11 +8,11 @@ #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { class AvmMiniProver { - using Flavor = honk::flavor::AvmMiniFlavor; + using Flavor = AvmMiniFlavor; using FF = Flavor::FF; using PCS = Flavor::PCS; using PCSCommitmentKey = Flavor::CommitmentKey; @@ -31,8 +31,8 @@ class AvmMiniProver { void execute_relation_check_rounds(); void execute_zeromorph_rounds(); - honk::proof& export_proof(); - honk::proof& construct_proof(); + HonkProof& export_proof(); + HonkProof& construct_proof(); std::shared_ptr transcript = std::make_shared(); @@ -49,14 +49,14 @@ class AvmMiniProver { Polynomial quotient_W; - sumcheck::SumcheckOutput sumcheck_output; + SumcheckOutput sumcheck_output; std::shared_ptr commitment_key; - using ZeroMorph = pcs::zeromorph::ZeroMorphProver_; + using ZeroMorph = ZeroMorphProver_; private: - honk::proof proof; + HonkProof proof; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.cpp index 5d18e651ac7..8d093e0fee3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.cpp @@ -5,10 +5,7 @@ #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/transcript/transcript.hpp" -using namespace bb; -using namespace bb::honk::sumcheck; - -namespace bb::honk { +namespace bb { AvmMiniVerifier::AvmMiniVerifier(std::shared_ptr verifier_key) : key(verifier_key) {} @@ -30,13 +27,13 @@ AvmMiniVerifier& AvmMiniVerifier::operator=(AvmMiniVerifier&& other) noexcept * @brief This function verifies an AvmMini Honk proof for given program settings. * */ -bool AvmMiniVerifier::verify_proof(const honk::proof& proof) +bool AvmMiniVerifier::verify_proof(const HonkProof& proof) { - using Flavor = honk::flavor::AvmMiniFlavor; + using Flavor = AvmMiniFlavor; using FF = Flavor::FF; using Commitment = Flavor::Commitment; // using Curve = Flavor::Curve; - // using ZeroMorph = pcs::zeromorph::ZeroMorphVerifier_; + // using ZeroMorph = ZeroMorphVerifier_; using VerifierCommitments = Flavor::VerifierCommitments; using CommitmentLabels = Flavor::CommitmentLabels; @@ -198,4 +195,4 @@ bool AvmMiniVerifier::verify_proof(const honk::proof& proof) return sumcheck_verified.value(); } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.hpp index 81aa4eea673..152950496c0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/AvmMini_verifier.hpp @@ -5,9 +5,9 @@ #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { class AvmMiniVerifier { - using Flavor = honk::flavor::AvmMiniFlavor; + using Flavor = AvmMiniFlavor; using FF = Flavor::FF; using Commitment = Flavor::Commitment; using VerificationKey = Flavor::VerificationKey; @@ -22,7 +22,7 @@ class AvmMiniVerifier { AvmMiniVerifier& operator=(const AvmMiniVerifier& other) = delete; AvmMiniVerifier& operator=(AvmMiniVerifier&& other) noexcept; - bool verify_proof(const honk::proof& proof); + bool verify_proof(const HonkProof& proof); std::shared_ptr key; std::map commitments; @@ -30,4 +30,4 @@ class AvmMiniVerifier { std::shared_ptr transcript; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.cpp index 3f311d16311..b5c36724fd6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.cpp @@ -6,9 +6,9 @@ #include "barretenberg/proof_system/composer/permutation_lib.hpp" #include "barretenberg/vm/generated/Toy_verifier.hpp" -namespace bb::honk { +namespace bb { -using Flavor = honk::flavor::ToyFlavor; +using Flavor = ToyFlavor; void ToyComposer::compute_witness(CircuitConstructor& circuit) { if (computed_witness) { @@ -82,4 +82,4 @@ std::shared_ptr ToyComposer::compute_verification_key(C return verification_key; } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.hpp index 8cbbda8b712..1e6a7292413 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_composer.hpp @@ -8,10 +8,10 @@ #include "barretenberg/vm/generated/Toy_prover.hpp" #include "barretenberg/vm/generated/Toy_verifier.hpp" -namespace bb::honk { +namespace bb { class ToyComposer { public: - using Flavor = honk::flavor::ToyFlavor; + using Flavor = ToyFlavor; using CircuitConstructor = ToyCircuitBuilder; using ProvingKey = Flavor::ProvingKey; using VerificationKey = Flavor::VerificationKey; @@ -66,4 +66,4 @@ class ToyComposer { }; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.cpp index 482261dda9f..dd76091689d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.cpp @@ -11,9 +11,9 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { -using Flavor = honk::flavor::ToyFlavor; +using Flavor = ToyFlavor; /** * Create ToyProver from proving key, witness and manifest. @@ -68,7 +68,7 @@ void ToyProver::execute_wire_commitments_round() */ void ToyProver::execute_relation_check_rounds() { - using Sumcheck = sumcheck::SumcheckProver; + using Sumcheck = SumcheckProver; auto sumcheck = Sumcheck(key->circuit_size, transcript); FF alpha = transcript->get_challenge("Sumcheck:alpha"); std::vector gate_challenges(numeric::get_msb(key->circuit_size)); @@ -94,13 +94,13 @@ void ToyProver::execute_zeromorph_rounds() transcript); } -honk::proof& ToyProver::export_proof() +HonkProof& ToyProver::export_proof() { proof = transcript->proof_data; return proof; } -honk::proof& ToyProver::construct_proof() +HonkProof& ToyProver::construct_proof() { // Add circuit size public input size and public inputs to transcript. execute_preamble_round(); @@ -127,4 +127,4 @@ honk::proof& ToyProver::construct_proof() return export_proof(); } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.hpp index a0b0ec62cfa..8a807b7729a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_prover.hpp @@ -8,11 +8,11 @@ #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace bb::honk { +namespace bb { class ToyProver { - using Flavor = honk::flavor::ToyFlavor; + using Flavor = ToyFlavor; using FF = Flavor::FF; using PCS = Flavor::PCS; using PCSCommitmentKey = Flavor::CommitmentKey; @@ -31,8 +31,8 @@ class ToyProver { void execute_relation_check_rounds(); void execute_zeromorph_rounds(); - honk::proof& export_proof(); - honk::proof& construct_proof(); + HonkProof& export_proof(); + HonkProof& construct_proof(); std::shared_ptr transcript = std::make_shared(); @@ -49,14 +49,14 @@ class ToyProver { Polynomial quotient_W; - sumcheck::SumcheckOutput sumcheck_output; + SumcheckOutput sumcheck_output; std::shared_ptr commitment_key; - using ZeroMorph = pcs::zeromorph::ZeroMorphProver_; + using ZeroMorph = ZeroMorphProver_; private: - honk::proof proof; + HonkProof proof; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.cpp index f153991ed90..b430c530234 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.cpp @@ -5,10 +5,7 @@ #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/transcript/transcript.hpp" -using namespace bb; -using namespace bb::honk::sumcheck; - -namespace bb::honk { +namespace bb { ToyVerifier::ToyVerifier(std::shared_ptr verifier_key) : key(verifier_key) {} @@ -30,13 +27,13 @@ ToyVerifier& ToyVerifier::operator=(ToyVerifier&& other) noexcept * @brief This function verifies an Toy Honk proof for given program settings. * */ -bool ToyVerifier::verify_proof(const honk::proof& proof) +bool ToyVerifier::verify_proof(const HonkProof& proof) { - using Flavor = honk::flavor::ToyFlavor; + using Flavor = ToyFlavor; using FF = Flavor::FF; using Commitment = Flavor::Commitment; // using Curve = Flavor::Curve; - // using ZeroMorph = pcs::zeromorph::ZeroMorphVerifier_; + // using ZeroMorph = ZeroMorphVerifier_; using VerifierCommitments = Flavor::VerifierCommitments; using CommitmentLabels = Flavor::CommitmentLabels; @@ -113,4 +110,4 @@ bool ToyVerifier::verify_proof(const honk::proof& proof) return sumcheck_verified.value(); } -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.hpp index ce84ed8ab6b..d4bbdd2a998 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/Toy_verifier.hpp @@ -5,9 +5,9 @@ #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" -namespace bb::honk { +namespace bb { class ToyVerifier { - using Flavor = honk::flavor::ToyFlavor; + using Flavor = ToyFlavor; using FF = Flavor::FF; using Commitment = Flavor::Commitment; using VerificationKey = Flavor::VerificationKey; @@ -22,7 +22,7 @@ class ToyVerifier { ToyVerifier& operator=(const ToyVerifier& other) = delete; ToyVerifier& operator=(ToyVerifier&& other) noexcept; - bool verify_proof(const honk::proof& proof); + bool verify_proof(const HonkProof& proof); std::shared_ptr key; std::map commitments; @@ -30,4 +30,4 @@ class ToyVerifier { std::shared_ptr transcript; }; -} // namespace bb::honk +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_arithmetic.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_arithmetic.test.cpp index 6cde3d10186..c486d6af888 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_arithmetic.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_arithmetic.test.cpp @@ -2,7 +2,8 @@ #include "barretenberg/numeric/uint128/uint128.hpp" -using namespace numeric; +using namespace bb; +using namespace bb::numeric; namespace { using namespace tests_avm; diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_control_flow.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_control_flow.test.cpp index 11ede61acfc..a5eeeadb817 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_control_flow.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_control_flow.test.cpp @@ -1,5 +1,7 @@ #include "AvmMini_common.test.hpp" +using namespace bb; + namespace tests_avm { using namespace avm_trace; diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp index afe4386816d..ce2fcf868b1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp @@ -10,6 +10,7 @@ #include #include +using namespace bb; namespace { void gen_proof_and_validate(std::vector const& bytecode, std::vector&& trace, @@ -19,7 +20,7 @@ void gen_proof_and_validate(std::vector const& bytecode, circuit_builder.set_trace(std::move(trace)); EXPECT_TRUE(circuit_builder.check_circuit()); - auto composer = honk::AvmMiniComposer(); + auto composer = AvmMiniComposer(); auto verifier = composer.create_verifier(circuit_builder); auto proof = avm_trace::Execution::run_and_prove(bytecode, calldata); diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_memory.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_memory.test.cpp index f51e4139539..668462d65a8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_memory.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_memory.test.cpp @@ -1,4 +1,7 @@ #include "AvmMini_common.test.hpp" + +using namespace bb; + namespace tests_avm { using namespace avm_trace; diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp index 8377eba5ff8..dc2a1e29b77 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp @@ -15,7 +15,7 @@ void validate_trace_proof(std::vector&& trace) EXPECT_TRUE(circuit_builder.check_circuit()); - auto composer = honk::AvmMiniComposer(); + auto composer = AvmMiniComposer(); auto prover = composer.create_prover(circuit_builder); auto proof = prover.construct_proof();