diff --git a/barretenberg/cpp/src/CMakeLists.txt b/barretenberg/cpp/src/CMakeLists.txt index b09a2181ebca..b5368f0ee948 100644 --- a/barretenberg/cpp/src/CMakeLists.txt +++ b/barretenberg/cpp/src/CMakeLists.txt @@ -59,7 +59,6 @@ add_subdirectory(barretenberg/env) add_subdirectory(barretenberg/examples) add_subdirectory(barretenberg/flavor) add_subdirectory(barretenberg/grumpkin_srs_gen) -add_subdirectory(barretenberg/goblin) add_subdirectory(barretenberg/honk) add_subdirectory(barretenberg/join_split_example) add_subdirectory(barretenberg/numeric) diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp index af6f4ec457f6..3881b4e9d69d 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp @@ -2,11 +2,11 @@ #include "barretenberg/commitment_schemes/gemini/gemini.hpp" #include "barretenberg/commitment_schemes/shplonk/shplonk.hpp" #include "barretenberg/flavor/ecc_vm.hpp" -#include "barretenberg/goblin/translation_evaluations.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" +#include "barretenberg/translator_vm/translation_evaluations.hpp" namespace proof_system::honk { diff --git a/barretenberg/cpp/src/barretenberg/goblin/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/goblin/CMakeLists.txt deleted file mode 100644 index a6c3c61383a6..000000000000 --- a/barretenberg/cpp/src/barretenberg/goblin/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -barretenberg_module(goblin ultra_honk eccvm translator_vm transcript) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/goblin/full_goblin_composer.test.cpp b/barretenberg/cpp/src/barretenberg/goblin/full_goblin_composer.test.cpp deleted file mode 100644 index 7503307881ab..000000000000 --- a/barretenberg/cpp/src/barretenberg/goblin/full_goblin_composer.test.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "barretenberg/eccvm/eccvm_composer.hpp" -#include "barretenberg/goblin/goblin.hpp" -#include "barretenberg/goblin/mock_circuits.hpp" -#include "barretenberg/goblin/translation_evaluations.hpp" -#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/translator_vm/goblin_translator_composer.hpp" -#include "barretenberg/ultra_honk/ultra_composer.hpp" - -#include - -using namespace barretenberg; -using namespace proof_system::honk; - -namespace test_full_goblin_composer { - -class FullGoblinComposerTests : public ::testing::Test { - protected: - static void SetUpTestSuite() - { - barretenberg::srs::init_crs_factory("../srs_db/ignition"); - barretenberg::srs::init_grumpkin_crs_factory("../srs_db/grumpkin"); - } - - using Curve = curve::BN254; - using FF = Curve::ScalarField; - using Fbase = Curve::BaseField; - using Point = Curve::AffineElement; - using CommitmentKey = pcs::CommitmentKey; - using OpQueue = proof_system::ECCOpQueue; - using GoblinUltraBuilder = proof_system::GoblinUltraCircuitBuilder; - using ECCVMFlavor = flavor::ECCVM; - using ECCVMBuilder = proof_system::ECCVMCircuitBuilder; - using ECCVMComposer = ECCVMComposer_; - using KernelInput = Goblin::AccumulationOutput; -}; - -/** - * @brief Test proof construction/verification for a circuit with ECC op gates, public inputs, and basic arithmetic - * gates - * @note We simulate op queue interactions with a previous circuit so the actual circuit under test utilizes an op queue - * with non-empty 'previous' data. This avoids complications with zero-commitments etc. - * - */ -TEST_F(FullGoblinComposerTests, SimpleCircuit) -{ - barretenberg::Goblin goblin; - GoblinUltraBuilder initial_circuit{ goblin.op_queue }; - GoblinTestingUtils::construct_simple_initial_circuit(initial_circuit); - KernelInput kernel_input = goblin.accumulate(initial_circuit); - - // Construct a series of simple Goblin circuits; generate and verify their proofs - size_t NUM_CIRCUITS = 2; - for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) { - GoblinUltraBuilder circuit_builder{ goblin.op_queue }; - GoblinTestingUtils::construct_arithmetic_circuit(circuit_builder); - kernel_input = goblin.accumulate(circuit_builder); - } - - Goblin::Proof proof = goblin.prove(); - bool verified = goblin.verify(proof); - EXPECT_TRUE(verified); -} - -// TODO(https://github.com/AztecProtocol/barretenberg/issues/787) Expand these tests. -} // namespace test_full_goblin_composer diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/full_goblin_recursion.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/full_goblin_recursion.test.cpp index f21c21b92e1f..cb723f586c3e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/full_goblin_recursion.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/full_goblin_recursion.test.cpp @@ -1,12 +1,12 @@ #include "barretenberg/eccvm/eccvm_composer.hpp" -#include "barretenberg/goblin/goblin.hpp" -#include "barretenberg/goblin/mock_circuits.hpp" -#include "barretenberg/goblin/translation_evaluations.hpp" #include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp" #include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" +#include "barretenberg/stdlib/recursion/goblin/goblin.hpp" +#include "barretenberg/stdlib/recursion/goblin/mock_circuits.hpp" #include "barretenberg/stdlib/recursion/honk/verifier/ultra_recursive_verifier.hpp" #include "barretenberg/translator_vm/goblin_translator_composer.hpp" +#include "barretenberg/translator_vm/translation_evaluations.hpp" #include "barretenberg/ultra_honk/ultra_composer.hpp" #include @@ -40,7 +40,8 @@ class GoblinRecursionTests : public ::testing::Test { using NativeVerificationKey = flavor::GoblinUltra::VerificationKey; using RecursiveFlavor = flavor::GoblinUltraRecursive_; using RecursiveVerifier = proof_system::plonk::stdlib::recursion::honk::UltraRecursiveVerifier_; - using KernelInput = Goblin::AccumulationOutput; + using Goblin = proof_system::plonk::stdlib::recursion::goblin::Goblin; + using KernelInput = proof_system::plonk::stdlib::recursion::goblin::Goblin::AccumulationOutput; /** * @brief Construct a mock kernel circuit @@ -72,7 +73,7 @@ class GoblinRecursionTests : public ::testing::Test { */ TEST_F(GoblinRecursionTests, Pseudo) { - barretenberg::Goblin goblin; + Goblin goblin; // Construct an initial circuit; its proof will be recursively verified by the first kernel GoblinUltraBuilder initial_circuit{ goblin.op_queue }; diff --git a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/goblin.hpp similarity index 97% rename from barretenberg/cpp/src/barretenberg/goblin/goblin.hpp rename to barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/goblin.hpp index fb941c0f83eb..a47c13d8269e 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/goblin.hpp @@ -8,7 +8,7 @@ #include "barretenberg/translator_vm/goblin_translator_composer.hpp" #include "barretenberg/ultra_honk/ultra_composer.hpp" -namespace barretenberg { +namespace proof_system::plonk::stdlib::recursion::goblin { class Goblin { using HonkProof = proof_system::plonk::proof; @@ -68,7 +68,6 @@ class Goblin { // issue (https://github.com/AztecProtocol/barretenberg/issues/723) if (verify_merge) { RecursiveMergeVerifier merge_verifier{ &circuit_builder }; - // Recursively verify the merge proof constructed on the previous call to accumulate [[maybe_unused]] auto pairing_points = merge_verifier.verify_proof(merge_proof); } @@ -115,4 +114,4 @@ class Goblin { return eccvm_verified && accumulator_construction_verified && translation_verified; }; }; -} // namespace barretenberg \ No newline at end of file +} // namespace proof_system::plonk::stdlib::recursion::goblin \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/mock_circuits.hpp similarity index 97% rename from barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp rename to barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/mock_circuits.hpp index cb12bb08c37d..f9688fc6001d 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/goblin/mock_circuits.hpp @@ -1,11 +1,10 @@ #include "barretenberg/commitment_schemes/commitment_key.hpp" #include "barretenberg/eccvm/eccvm_composer.hpp" -#include "barretenberg/goblin/goblin.hpp" -#include "barretenberg/goblin/translation_evaluations.hpp" #include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp" #include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/translator_vm/goblin_translator_composer.hpp" +#include "barretenberg/translator_vm/translation_evaluations.hpp" #include "barretenberg/ultra_honk/ultra_composer.hpp" namespace barretenberg { 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 e959eef720e0..82792cca043e 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/flavor/goblin_translator.hpp" -#include "barretenberg/goblin/translation_evaluations.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" +#include "barretenberg/translator_vm/translation_evaluations.hpp" namespace proof_system::honk { class GoblinTranslatorVerifier { diff --git a/barretenberg/cpp/src/barretenberg/goblin/translation_evaluations.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/translation_evaluations.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/goblin/translation_evaluations.hpp rename to barretenberg/cpp/src/barretenberg/translator_vm/translation_evaluations.hpp