diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp index 4b9a049dadc..aa472edd18e 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp @@ -34,7 +34,7 @@ void create_prover_bench(State& state) noexcept for (auto _ : state) { state.PauseTiming(); auto num_gates = 1 << (size_t)state.range(0); - auto composer = honk::StandardHonkComposer(static_cast(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast(num_gates)); generate_test_plonk_circuit(composer, static_cast(num_gates)); state.ResumeTiming(); @@ -51,7 +51,7 @@ void create_verifier_bench(State& state) noexcept for (auto _ : state) { state.PauseTiming(); auto num_gates = 1 << (size_t)state.range(0); - auto composer = honk::StandardHonkComposer(static_cast(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast(num_gates)); generate_test_plonk_circuit(composer, static_cast(num_gates)); state.ResumeTiming(); @@ -68,7 +68,7 @@ void construct_proof_bench(State& state) noexcept auto num_gates = 1 << (size_t)state.range(0); for (auto _ : state) { state.PauseTiming(); - auto composer = honk::StandardHonkComposer(static_cast(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast(num_gates)); generate_test_plonk_circuit(composer, static_cast(num_gates)); auto ext_prover = composer.create_prover(); state.ResumeTiming(); @@ -90,7 +90,7 @@ void verify_proof_bench(State& state) noexcept for (auto _ : state) { state.PauseTiming(); auto num_gates = (size_t)state.range(0); - auto composer = honk::StandardHonkComposer(static_cast(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast(num_gates)); generate_test_plonk_circuit(composer, static_cast(num_gates)); auto prover = composer.create_prover(); auto proof = prover.construct_proof(); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp b/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp index 2208ce5228a..40f2b15284f 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp @@ -41,7 +41,7 @@ constexpr size_t NUM_POINTS = 1 << 16; std::vector scalars; static barretenberg::evaluation_domain small_domain; static barretenberg::evaluation_domain large_domain; -auto reference_string = std::make_shared(NUM_POINTS, "../srs_db/ignition"); +auto reference_string = std::make_shared(NUM_POINTS, "../srs_db/ignition"); const auto init = []() { small_domain = barretenberg::evaluation_domain(NUM_POINTS); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp index 38581ff231a..475499bd724 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp @@ -36,7 +36,7 @@ void construct_witnesses_bench(State& state) noexcept { for (auto _ : state) { state.PauseTiming(); - plonk::StandardComposer composer = plonk::StandardComposer(static_cast(state.range(0))); + plonk::StandardComposer composer = proof_system::plonk::StandardComposer(static_cast(state.range(0))); generate_test_plonk_circuit(composer, static_cast(state.range(0))); composer.compute_proving_key(); state.ResumeTiming(); @@ -49,7 +49,7 @@ BENCHMARK(construct_witnesses_bench)->RangeMultiplier(2)->Range(START, MAX_GATES void construct_proving_keys_bench(State& state) noexcept { for (auto _ : state) { - plonk::StandardComposer composer = plonk::StandardComposer(static_cast(state.range(0))); + plonk::StandardComposer composer = proof_system::plonk::StandardComposer(static_cast(state.range(0))); generate_test_plonk_circuit(composer, static_cast(state.range(0))); size_t idx = static_cast(numeric::get_msb((uint64_t)state.range(0))) - static_cast(numeric::get_msb(START)); @@ -65,7 +65,7 @@ void construct_instances_bench(State& state) noexcept { for (auto _ : state) { state.PauseTiming(); - plonk::StandardComposer composer = plonk::StandardComposer(static_cast(state.range(0))); + plonk::StandardComposer composer = proof_system::plonk::StandardComposer(static_cast(state.range(0))); generate_test_plonk_circuit(composer, static_cast(state.range(0))); size_t idx = static_cast(numeric::get_msb((uint64_t)state.range(0))) - static_cast(numeric::get_msb(START)); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index 30160837c77..a10eb404687 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -1,6 +1,6 @@ #include "acir_format.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -88,7 +88,7 @@ void create_circuit(Composer& composer, const acir_format& constraint_system) } Composer create_circuit(const acir_format& constraint_system, - std::unique_ptr&& crs_factory) + std::unique_ptr&& crs_factory) { if (constraint_system.public_inputs.size() > constraint_system.varnum) { std::cout << "too many public inputs!" << std::endl; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp index b6f2f2ae4b4..55d5ee969e3 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -41,7 +41,7 @@ void read_witness(plonk::stdlib::types::Composer& composer, std::vector&& crs_factory); + std::unique_ptr&& crs_factory); plonk::stdlib::types::Composer create_circuit_with_witness(const acir_format& constraint_system, std::vector witness, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp index 56fe6a521f1..03deb176f6c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp @@ -1,7 +1,7 @@ #include "blake2s_constraint.hpp" #include "round.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -26,7 +26,7 @@ void create_blake2s_constraints(Composer& composer, const Blake2sConstraint& con arr.write(element_bytes); } - byte_array_ct output_bytes = plonk::stdlib::blake2s(arr); + byte_array_ct output_bytes = proof_system::plonk::stdlib::blake2s(arr); // Convert byte array to vector of field_t auto bytes = output_bytes.bytes(); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp index 4287faf6435..d81a670cb0d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp @@ -2,7 +2,7 @@ #include "barretenberg/crypto/ecdsa/ecdsa.hpp" #include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp index 6e829a8a9a3..81251944e60 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp @@ -1,6 +1,6 @@ #include "fixed_base_scalar_mul.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp index 564cd13c2ef..998b414cd46 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp @@ -1,7 +1,7 @@ #include "hash_to_field.hpp" #include "round.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -30,7 +30,7 @@ void create_hash_to_field_constraints(Composer& composer, const HashToFieldConst // Hash To Field using blake2s. // Note: It does not need to be blake2s in the future - byte_array_ct out_bytes = plonk::stdlib::blake2s(arr); + byte_array_ct out_bytes = proof_system::plonk::stdlib::blake2s(arr); field_ct out(out_bytes); field_ct normalised_out = out.normalize(); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp index b25530fa806..ca14b7cbc4a 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp @@ -1,7 +1,7 @@ #include "logic_constraint.hpp" #include "barretenberg/stdlib/primitives/logic/logic.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp index 8ff90de39d0..3f30a61fcbb 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp @@ -1,8 +1,8 @@ #include "merkle_membership_constraint.hpp" #include "barretenberg/stdlib/merkle_tree/membership.hpp" -using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp index 466929df423..03a8c4fe1f4 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp @@ -1,6 +1,6 @@ #include "pedersen.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp index 7c80c4208ca..f92176bd085 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp @@ -1,7 +1,7 @@ #include "schnorr_verify.hpp" #include "barretenberg/crypto/schnorr/schnorr.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp index 4da8a53567b..e54697d4e71 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp @@ -2,7 +2,7 @@ #include "round.hpp" #include "barretenberg/stdlib/hash/sha256/sha256.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -30,7 +30,7 @@ void create_sha256_constraints(Composer& composer, const Sha256Constraint& const } // Compute sha256 - byte_array_ct output_bytes = plonk::stdlib::sha256(arr); + byte_array_ct output_bytes = proof_system::plonk::stdlib::sha256(arr); // Convert byte array to vector of field_t auto bytes = output_bytes.bytes(); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp index ef70c7af1e8..21585f6df41 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp @@ -1,21 +1,21 @@ #include "acir_proofs.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/dsl/acir_format/acir_format.hpp" #include "barretenberg/stdlib/types/types.hpp" #include "barretenberg/srs/reference_string/pippenger_reference_string.hpp" -#include "barretenberg/proof_system/verification_key/sol_gen.hpp" +#include "barretenberg/plonk/proof_system/verification_key/sol_gen.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_proofs { size_t get_solidity_verifier(uint8_t const* g2x, uint8_t const* vk_buf, uint8_t** output_buf) { auto crs = std::make_shared(g2x); - bonk::verification_key_data vk_data; + proof_system::plonk::verification_key_data vk_data; read(vk_buf, vk_data); - auto verification_key = std::make_shared(std::move(vk_data), crs); + auto verification_key = std::make_shared(std::move(vk_data), crs); std::ostringstream stream; // TODO(blaine): Should we just use "VerificationKey" generically? @@ -32,7 +32,7 @@ size_t get_solidity_verifier(uint8_t const* g2x, uint8_t const* vk_buf, uint8_t* uint32_t get_exact_circuit_size(uint8_t const* constraint_system_buf) { auto constraint_system = from_buffer(constraint_system_buf); - auto crs_factory = std::make_unique(); + auto crs_factory = std::make_unique(); auto composer = create_circuit(constraint_system, std::move(crs_factory)); auto num_gates = composer.get_num_gates(); @@ -42,7 +42,7 @@ uint32_t get_exact_circuit_size(uint8_t const* constraint_system_buf) uint32_t get_total_circuit_size(uint8_t const* constraint_system_buf) { auto constraint_system = from_buffer(constraint_system_buf); - auto crs_factory = std::make_unique(); + auto crs_factory = std::make_unique(); auto composer = create_circuit(constraint_system, std::move(crs_factory)); return static_cast(composer.get_total_circuit_size()); @@ -69,9 +69,9 @@ size_t init_proving_key(uint8_t const* constraint_system_buf, uint8_t const** pk size_t init_verification_key(void* pippenger, uint8_t const* g2x, uint8_t const* pk_buf, uint8_t const** vk_buf) { std::shared_ptr crs; - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read(pk_buf, pk_data); - auto proving_key = std::make_shared(std::move(pk_data), crs); + auto proving_key = std::make_shared(std::move(pk_data), crs); auto crs_factory = std::make_unique( reinterpret_cast(pippenger), g2x); @@ -83,7 +83,7 @@ size_t init_verification_key(void* pippenger, uint8_t const* g2x, uint8_t const* // The composer_type has not yet been set. We need to set the composer_type for when we later read in and // construct the verification key so that we have the correct polynomial manifest - verification_key->composer_type = ComposerType::PLOOKUP; + verification_key->composer_type = proof_system::ComposerType::PLOOKUP; auto buffer = to_buffer(*verification_key); auto raw_buf = (uint8_t*)malloc(buffer.size()); @@ -103,9 +103,9 @@ size_t new_proof(void* pippenger, auto constraint_system = from_buffer(constraint_system_buf); std::shared_ptr crs; - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read(pk_buf, pk_data); - auto proving_key = std::make_shared(std::move(pk_data), crs); + auto proving_key = std::make_shared(std::move(pk_data), crs); auto witness = from_buffer>(witness_buf); @@ -136,9 +136,9 @@ bool verify_proof( #endif auto constraint_system = from_buffer(constraint_system_buf); auto crs = std::make_shared(g2x); - bonk::verification_key_data vk_data; + plonk::verification_key_data vk_data; read(vk_buf, vk_data); - auto verification_key = std::make_shared(std::move(vk_data), crs); + auto verification_key = std::make_shared(std::move(vk_data), crs); Composer composer(nullptr, verification_key); create_circuit(composer, constraint_system); diff --git a/barretenberg/cpp/src/barretenberg/ecc/curves/types.hpp b/barretenberg/cpp/src/barretenberg/ecc/curves/types.hpp index f716c7c4d10..deb73842163 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/curves/types.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/curves/types.hpp @@ -1,5 +1,5 @@ #pragma once -namespace bonk { +namespace proof_system { enum CurveType { BN254, SECP256K1, SECP256R1, GRUMPKIN }; } diff --git a/barretenberg/cpp/src/barretenberg/honk/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/honk/CMakeLists.txt index ac0dc30fd08..529a54878bf 100644 --- a/barretenberg/cpp/src/barretenberg/honk/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/honk/CMakeLists.txt @@ -1,4 +1,5 @@ -barretenberg_module(honk numeric ecc srs proof_system transcript) +# TODO(Cody): Remove plonk dependency +barretenberg_module(honk numeric ecc srs proof_system transcript plonk) if(TESTING) # TODO: Re-enable all these warnings once PoC is finished diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp index 4117dbcdd29..2bbf1c596d1 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp @@ -8,7 +8,7 @@ #include #include -namespace honk { +namespace proof_system::honk { /** * Compute proving key base. @@ -23,16 +23,13 @@ namespace honk { * @return Pointer to the initialized proving key updated with selector polynomials. * */ template -std::shared_ptr StandardHonkComposerHelper::compute_proving_key_base( +std::shared_ptr StandardHonkComposerHelper::compute_proving_key_base( const CircuitConstructor& constructor, const size_t minimum_circuit_size, const size_t num_randomized_gates) { // Initialize circuit_proving_key // TODO(#229)(Kesha): replace composer types. - circuit_proving_key = initialize_proving_key(constructor, - crs_factory_.get(), - minimum_circuit_size, - num_randomized_gates, - plonk::ComposerType::STANDARD_HONK); + circuit_proving_key = initialize_proving_key( + constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::STANDARD_HONK); // Compute lagrange selectors construct_lagrange_selector_forms(constructor, circuit_proving_key.get()); @@ -46,10 +43,10 @@ std::shared_ptr StandardHonkComposerHelper -std::shared_ptr StandardHonkComposerHelper::compute_verification_key_base( - std::shared_ptr const& proving_key, std::shared_ptr const& vrs) +std::shared_ptr StandardHonkComposerHelper::compute_verification_key_base( + std::shared_ptr const& proving_key, std::shared_ptr const& vrs) { - auto key = std::make_shared( + auto key = std::make_shared( proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->composer_type); // TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc auto commitment_key = pcs::kzg::CommitmentKey(proving_key->circuit_size, "../srs_db/ignition"); @@ -101,14 +98,14 @@ void StandardHonkComposerHelper::compute_witness(const Circu * */ template -std::shared_ptr StandardHonkComposerHelper::compute_proving_key( +std::shared_ptr StandardHonkComposerHelper::compute_proving_key( const CircuitConstructor& circuit_constructor) { if (circuit_proving_key) { return circuit_proving_key; } // Compute q_l, q_r, q_o, etc polynomials - StandardHonkComposerHelper::compute_proving_key_base(circuit_constructor, plonk::ComposerType::STANDARD_HONK); + StandardHonkComposerHelper::compute_proving_key_base(circuit_constructor, ComposerType::STANDARD_HONK); // Compute sigma polynomials (we should update that late) compute_standard_honk_sigma_permutations(circuit_constructor, @@ -126,7 +123,7 @@ std::shared_ptr StandardHonkComposerHelper -std::shared_ptr StandardHonkComposerHelper::compute_verification_key( +std::shared_ptr StandardHonkComposerHelper::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -182,4 +179,4 @@ StandardProver StandardHonkComposerHelper::create_prover( template class StandardHonkComposerHelper; template StandardProver StandardHonkComposerHelper::create_prover( const StandardCircuitConstructor& circuit_constructor); -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp index 80e48a5eebf..5b033996d5d 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp @@ -2,12 +2,12 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/honk/proof_system/prover.hpp" #include "barretenberg/honk/proof_system/verifier.hpp" #include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" #include "barretenberg/proof_system/arithmetization/gate_data.hpp" #include "barretenberg/proof_system/composer/composer_helper_lib.hpp" @@ -15,32 +15,34 @@ #include -namespace honk { +namespace proof_system::honk { // TODO(Kesha): change initializations to specify this parameter // Cody: What does this mean? template class StandardHonkComposerHelper { public: static constexpr size_t NUM_RANDOMIZED_GATES = 2; // equal to the number of multilinear evaluations leaked static constexpr size_t num_wires = CircuitConstructor::num_wires; - std::shared_ptr circuit_proving_key; + std::shared_ptr circuit_proving_key; std::vector wire_polynomials; - std::shared_ptr circuit_verification_key; + std::shared_ptr circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr crs_factory_; + std::shared_ptr crs_factory_; bool computed_witness = false; + // TODO(Luke): use make_shared StandardHonkComposerHelper() - : StandardHonkComposerHelper( - std::shared_ptr(new bonk::FileReferenceStringFactory("../srs_db/ignition"))) + : StandardHonkComposerHelper(std::shared_ptr( + new proof_system::FileReferenceStringFactory("../srs_db/ignition"))) {} - StandardHonkComposerHelper(std::shared_ptr crs_factory) + StandardHonkComposerHelper(std::shared_ptr crs_factory) : crs_factory_(std::move(crs_factory)) {} - StandardHonkComposerHelper(std::unique_ptr&& crs_factory) + StandardHonkComposerHelper(std::unique_ptr&& crs_factory) : crs_factory_(std::move(crs_factory)) {} - StandardHonkComposerHelper(std::shared_ptr p_key, std::shared_ptr v_key) + StandardHonkComposerHelper(std::shared_ptr p_key, + std::shared_ptr v_key) : circuit_proving_key(std::move(p_key)) , circuit_verification_key(std::move(v_key)) {} @@ -50,8 +52,8 @@ template class StandardHonkComposerHelper { StandardHonkComposerHelper& operator=(const StandardHonkComposerHelper& other) = delete; ~StandardHonkComposerHelper() = default; - std::shared_ptr compute_proving_key(const CircuitConstructor& circuit_constructor); - std::shared_ptr compute_verification_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr compute_proving_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr compute_verification_key(const CircuitConstructor& circuit_constructor); StandardVerifier create_verifier(const CircuitConstructor& circuit_constructor); @@ -59,17 +61,16 @@ template class StandardHonkComposerHelper { // TODO(#216)(Adrian): Seems error prone to provide the number of randomized gates // Cody: Where should this go? In the flavor (or whatever that becomes)? - std::shared_ptr compute_proving_key_base( + std::shared_ptr compute_proving_key_base( const CircuitConstructor& circuit_constructor, const size_t minimum_ciricut_size = 0, const size_t num_randomized_gates = NUM_RANDOMIZED_GATES); // This needs to be static as it may be used only to compute the selector commitments. - static std::shared_ptr compute_verification_key_base( - std::shared_ptr const& proving_key, - std::shared_ptr const& vrs); + static std::shared_ptr compute_verification_key_base( + std::shared_ptr const& proving_key, std::shared_ptr const& vrs); void compute_witness(const CircuitConstructor& circuit_constructor, const size_t minimum_circuit_size = 0); }; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp index 52d4579fd5e..ab2c344514f 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp @@ -6,7 +6,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/honk/flavor/flavor.hpp" -namespace honk { +namespace proof_system::honk { /** * @brief Standard Honk Composer has everything required to construct a prover and verifier, just as the legacy classes. * @@ -15,7 +15,7 @@ namespace honk { */ class StandardHonkComposer { public: - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD_HONK; + static constexpr ComposerType type = ComposerType::STANDARD_HONK; static constexpr size_t UINT_LOG2_BASE = 2; // An instantiation of the circuit constructor that only depends on arithmetization, not on the proof system @@ -39,17 +39,17 @@ class StandardHonkComposer { StandardHonkComposer(std::string const& crs_path, const size_t size_hint = 0) : StandardHonkComposer( - std::unique_ptr(new bonk::FileReferenceStringFactory(crs_path)), + std::unique_ptr(new proof_system::FileReferenceStringFactory(crs_path)), size_hint){}; - StandardHonkComposer(std::shared_ptr const& crs_factory, const size_t size_hint = 0) + StandardHonkComposer(std::shared_ptr const& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(crs_factory) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables) {} - StandardHonkComposer(std::unique_ptr&& crs_factory, const size_t size_hint = 0) + StandardHonkComposer(std::unique_ptr&& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(std::move(crs_factory)) , num_gates(circuit_constructor.num_gates) @@ -57,8 +57,8 @@ class StandardHonkComposer { {} - StandardHonkComposer(std::shared_ptr const& p_key, - std::shared_ptr const& v_key, + StandardHonkComposer(std::shared_ptr const& p_key, + std::shared_ptr const& v_key, size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(p_key, v_key) @@ -161,12 +161,12 @@ class StandardHonkComposer { /**Proof and verification-related methods*/ - std::shared_ptr compute_proving_key() + std::shared_ptr compute_proving_key() { return composer_helper.compute_proving_key(circuit_constructor); } - std::shared_ptr compute_verification_key() + std::shared_ptr compute_verification_key() { return composer_helper.compute_verification_key(circuit_constructor); } @@ -184,4 +184,4 @@ class StandardHonkComposer { const std::string& err() const { return circuit_constructor.err(); }; void failure(std::string msg) { circuit_constructor.failure(msg); } }; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp index a9970add689..84717e21a44 100644 --- a/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp @@ -11,7 +11,7 @@ #include -using namespace honk; +using namespace proof_system::honk; namespace test_standard_honk_composer { /** @@ -93,7 +93,7 @@ TEST(StandardHonkComposer, SigmaIDCorrectness) } // test correctness of the public input delta - auto delta = honk::compute_public_input_delta(public_inputs, beta, gamma, n); + auto delta = proof_system::honk::compute_public_input_delta(public_inputs, beta, gamma, n); EXPECT_EQ(left / right, delta); for (size_t i = 0; i < num_public_inputs; ++i) { @@ -348,7 +348,7 @@ TEST(StandardHonkComposer, SumcheckRelationCorrectness) .public_input_delta = public_input_delta, }; - constexpr size_t num_polynomials = honk::StandardArithmetization::NUM_POLYNOMIALS; + constexpr size_t num_polynomials = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; // Compute grand product polynomial polynomial z_perm_poly = prover_library::compute_permutation_grand_product(prover.key, prover.wire_polynomials, beta, gamma); @@ -359,7 +359,7 @@ TEST(StandardHonkComposer, SumcheckRelationCorrectness) // in the list below std::array, num_polynomials> evaluations_array; - using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; + using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; evaluations_array[POLYNOMIAL::W_L] = prover.wire_polynomials[0]; evaluations_array[POLYNOMIAL::W_R] = prover.wire_polynomials[1]; evaluations_array[POLYNOMIAL::W_O] = prover.wire_polynomials[2]; diff --git a/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp index 0d8903f9450..ad47783e1de 100644 --- a/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/flavor/flavor.hpp @@ -5,7 +5,7 @@ #include "barretenberg/proof_system/arithmetization/arithmetization.hpp" #include "barretenberg/transcript/manifest.hpp" -namespace honk { +namespace proof_system::honk { // TODO(Cody) This _should_ be shared with Plonk, but it isn't. struct StandardArithmetization { /** @@ -59,14 +59,14 @@ struct StandardArithmetization { "LAGRANGE_LAST", "W_1", "W_2", "W_3", "Z_PERM", "Z_PERM_SHIFT" }; }; -} // namespace honk +} // namespace proof_system::honk -namespace honk { +namespace proof_system::honk { struct StandardHonk { public: // This whole file is broken; changes here are in anticipation of a follow-up rework of the flavor specificaiton. using Arithmetization = arithmetization::Standard; - using MULTIVARIATE = honk::StandardArithmetization::POLYNOMIAL; + using MULTIVARIATE = proof_system::honk::StandardArithmetization::POLYNOMIAL; // // TODO(Cody): Where to specify? is this polynomial manifest size? // static constexpr size_t STANDARD_HONK_MANIFEST_SIZE = 16; // TODO(Cody): Maybe relation should be supplied and this should be computed as is done in sumcheck? @@ -187,4 +187,4 @@ struct StandardHonk { return output; } }; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/oracle/oracle.hpp b/barretenberg/cpp/src/barretenberg/honk/oracle/oracle.hpp index 0a78654fa97..52beed5d120 100644 --- a/barretenberg/cpp/src/barretenberg/honk/oracle/oracle.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/oracle/oracle.hpp @@ -3,7 +3,7 @@ #include #include -namespace honk { +namespace proof_system::honk { template struct Oracle { size_t consumed{ 0 }; @@ -271,4 +271,4 @@ template struct Oracle { // Fr public_input_delta = 1; // TODO FIX // }; -} // namespace honk \ No newline at end of file +} // namespace proof_system::honk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp index 55f26bfd155..d009edc0d30 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp @@ -2,7 +2,7 @@ #include "barretenberg/polynomials/polynomial.hpp" -namespace honk::pcs { +namespace proof_system::honk::pcs { /** * @brief Opening pair (r,v) for some witness polynomial p(X) such that p(r) = v * @@ -90,4 +90,4 @@ template class MLEOpeningClaim { // v↺ = g(u) = a₁⋅L₀(u) + … + aₙ₋₁⋅Lₙ₋₂(u) Fr evaluation; }; -} // namespace honk::pcs +} // namespace proof_system::honk::pcs diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.hpp index 81aec686f4f..ce29e5fe7d9 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.hpp @@ -15,7 +15,7 @@ #include #include -namespace honk::pcs { +namespace proof_system::honk::pcs { namespace kzg { @@ -66,7 +66,7 @@ class CommitmentKey { private: barretenberg::scalar_multiplication::pippenger_runtime_state pippenger_runtime_state; - bonk::FileReferenceString srs; + proof_system::FileReferenceString srs; }; class VerificationKey { @@ -108,7 +108,7 @@ class VerificationKey { } private: - bonk::VerifierFileReferenceString verifier_srs; + proof_system::VerifierFileReferenceString verifier_srs; }; struct Params { @@ -243,7 +243,7 @@ class CommitmentKey { }; barretenberg::scalar_multiplication::pippenger_runtime_state pippenger_runtime_state; - bonk::FileReferenceString srs; + proof_system::FileReferenceString srs; }; class VerificationKey { @@ -268,7 +268,7 @@ class VerificationKey { {} barretenberg::scalar_multiplication::pippenger_runtime_state pippenger_runtime_state; - bonk::FileReferenceString srs; + proof_system::FileReferenceString srs; }; struct Params { @@ -284,4 +284,4 @@ struct Params { } // namespace ipa -} // namespace honk::pcs +} // namespace proof_system::honk::pcs diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp index 47623ee4538..0676a2631f2 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp @@ -19,7 +19,7 @@ #include "claim.hpp" #include "commitment_key.hpp" -namespace honk::pcs { +namespace proof_system::honk::pcs { namespace { constexpr std::string_view kzg_srs_path = "../srs_db/ignition"; } @@ -202,4 +202,4 @@ using IpaCommitmentSchemeParams = ::testing::Types; // using CommitmentSchemeParams = // ::testing::Types, fake::Params, kzg::Params>; -} // namespace honk::pcs +} // namespace proof_system::honk::pcs diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp index e4b0126949d..6e2cd50fe7e 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp @@ -46,7 +46,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 honk::pcs::gemini { +namespace proof_system::honk::pcs::gemini { /** * @brief Prover output (evalutation pair, witness) that can be passed on to Shplonk batch opening. @@ -346,4 +346,4 @@ template class MultilinearReductionScheme { return { C0_r_pos, C0_r_neg }; }; }; -} // namespace honk::pcs::gemini +} // namespace proof_system::honk::pcs::gemini diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp b/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp index 17af010e23f..cf2e0549cfa 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp @@ -7,7 +7,7 @@ #include #include -namespace honk::pcs::gemini { +namespace proof_system::honk::pcs::gemini { template class GeminiTest : public CommitmentTest { using Gemini = MultilinearReductionScheme; @@ -237,4 +237,4 @@ TYPED_TEST(GeminiTest, DoubleWithShift) multilinear_commitments_to_be_shifted); } -} // namespace honk::pcs::gemini +} // namespace proof_system::honk::pcs::gemini diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp index b4add52fe59..6175d4da463 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp @@ -17,7 +17,7 @@ * https://hackmd.io/q-A8y6aITWyWJrvsGGMWNA?view. * */ -namespace honk::pcs::ipa { +namespace proof_system::honk::pcs::ipa { template class InnerProductArgument { using Fr = typename Params::Fr; using element = typename Params::Commitment; @@ -66,9 +66,9 @@ template class InnerProductArgument { "The poly_degree should be positive and a power of two"); auto& aux_generator = pub_input.aux_generator; auto a_vec = polynomial; - // TODO(#220)(Arijit): to make it more efficient by directly using G_vector for the input points when i = 0 and write the - // output points to G_vec_local. Then use G_vec_local for rounds where i>0, this can be done after we use SRS - // instead of G_vector. + // TODO(#220)(Arijit): to make it more efficient by directly using G_vector for the input points when i = 0 and + // write the output points to G_vec_local. Then use G_vec_local for rounds where i>0, this can be done after we + // use SRS instead of G_vector. auto srs_elements = ck->srs.get_monomial_points(); std::vector G_vec_local(poly_degree); for (size_t i = 0; i < poly_degree; i++) { @@ -251,4 +251,4 @@ template class InnerProductArgument { } }; -} // namespace honk::pcs::ipa +} // namespace proof_system::honk::pcs::ipa diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp b/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp index 39bd8803129..513e931d477 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp @@ -7,7 +7,7 @@ #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/honk/pcs/commitment_key.test.hpp" using namespace barretenberg; -namespace honk::pcs::ipa { +namespace proof_system::honk::pcs::ipa { template class IpaCommitmentTest : public CommitmentTest { using Fr = typename Params::Fr; @@ -58,4 +58,4 @@ TYPED_TEST(IpaCommitmentTest, open) auto result = IPA::reduce_verify(this->vk(), proof, pub_input); EXPECT_TRUE(result); } -} // namespace honk::pcs::ipa +} // namespace proof_system::honk::pcs::ipa diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp index 0a38b09c3ab..b6ba93653ae 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp @@ -7,7 +7,7 @@ #include #include -namespace honk::pcs::kzg { +namespace proof_system::honk::pcs::kzg { /** * @brief A transformed polynomial commitment opening claim of the form (P₀, P₁) ∈ 𝔾₁ * which should satisfy e(P₀, [1]₂) ⋅ e(P₁, [x]₂)=1. @@ -93,4 +93,4 @@ template class UnivariateOpeningScheme { return Accumulator(claim, quotient_commitment); }; }; -} // namespace honk::pcs::kzg +} // namespace proof_system::honk::pcs::kzg diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp b/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp index ebbf44af0ac..5d4e53a8c15 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp @@ -13,7 +13,7 @@ #include #include -namespace honk::pcs::kzg { +namespace proof_system::honk::pcs::kzg { template class BilinearAccumulationTest : public CommitmentTest { public: @@ -170,4 +170,4 @@ TYPED_TEST(BilinearAccumulationTest, GeminiShplonkKzgWithShift) EXPECT_EQ(verified, true); } -} // namespace honk::pcs::kzg +} // namespace proof_system::honk::pcs::kzg diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp index f09be9da05f..af84e1b6326 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp @@ -17,7 +17,7 @@ * The challenges are ρ (batching) and r (random evaluation). * */ -namespace honk::pcs::shplonk { +namespace proof_system::honk::pcs::shplonk { /** * @brief Single commitment to Q(X) = ∑ₖ ( Bₖ(X) − Tₖ(X) ) / zₖ(X) @@ -43,4 +43,4 @@ template struct ProverOutput { OutputWitness witness; // single polynomial G(X) }; -} // namespace honk::pcs::shplonk +} // namespace proof_system::honk::pcs::shplonk diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp b/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp index 2e406414f51..072b665e8ce 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp @@ -10,7 +10,7 @@ #include "../commitment_key.test.hpp" #include "barretenberg/honk/pcs/claim.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace honk::pcs::shplonk { +namespace proof_system::honk::pcs::shplonk { template class ShplonkTest : public CommitmentTest {}; TYPED_TEST_SUITE(ShplonkTest, CommitmentSchemeParams); @@ -63,4 +63,4 @@ TYPED_TEST(ShplonkTest, ShplonkSimple) this->verify_opening_claim(verifier_claim, shplonk_prover_witness); } -} // namespace honk::pcs::shplonk +} // namespace proof_system::honk::pcs::shplonk diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp index f68a0f98d5c..099e73962a9 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp @@ -4,7 +4,7 @@ #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/honk/transcript/transcript.hpp" -namespace honk::pcs::shplonk { +namespace proof_system::honk::pcs::shplonk { /** * @brief Protocol for opening several polynomials, each in a single different point. @@ -164,4 +164,4 @@ template class SingleBatchOpeningScheme { return { { z_challenge, Fr::zero() }, G_commitment }; }; }; -} // namespace honk::pcs::shplonk +} // namespace proof_system::honk::pcs::shplonk diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/wrapper.hpp b/barretenberg/cpp/src/barretenberg/honk/pcs/wrapper.hpp index d5f60d8cd7b..eb04f995650 100644 --- a/barretenberg/cpp/src/barretenberg/honk/pcs/wrapper.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/pcs/wrapper.hpp @@ -4,7 +4,7 @@ #include "gemini/gemini.hpp" #include "barretenberg/ecc/curves/bn254/g1.hpp" -namespace honk { +namespace proof_system::honk { struct OpeningProof { std::vector gemini; @@ -12,4 +12,4 @@ struct OpeningProof { barretenberg::g1::affine_element kzg; }; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp index 037d24362e7..b3df26bec66 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/program_settings.hpp @@ -6,7 +6,7 @@ #include "../../plonk/proof_system/types/prover_settings.hpp" #include "barretenberg/honk/flavor/flavor.hpp" -namespace honk { +namespace proof_system::honk { // TODO(#221)(Luke/Cody): Shouldn't subclass plonk settings here. Also, define standard_settings for Honk prover. class standard_verifier_settings : public plonk::standard_settings { @@ -15,8 +15,8 @@ class standard_verifier_settings : public plonk::standard_settings { typedef transcript::StandardTranscript Transcript; static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; - static constexpr size_t num_wires = honk::StandardHonk::Arithmetization::num_wires; - static constexpr size_t num_polys = honk::StandardArithmetization::NUM_POLYNOMIALS; + static constexpr size_t num_wires = proof_system::honk::StandardHonk::Arithmetization::num_wires; + static constexpr size_t num_polys = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; }; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp index e0c580099f9..7dbd085f40c 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.cpp @@ -22,12 +22,12 @@ #include #include "barretenberg/honk/pcs/claim.hpp" -namespace honk { +namespace proof_system::honk { using Fr = barretenberg::fr; using Commitment = barretenberg::g1::affine_element; using Polynomial = barretenberg::Polynomial; -using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; +using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; /** * Create Prover from proving key, witness and manifest. @@ -39,7 +39,7 @@ using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; * */ template Prover::Prover(std::vector&& wire_polys, - std::shared_ptr input_key) + std::shared_ptr input_key) : wire_polynomials(wire_polys) , key(input_key) , commitment_key(std::make_unique( @@ -182,8 +182,8 @@ template void Prover::execute_relation_check_round * */ template void Prover::execute_univariatization_round() { - const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; - const size_t NUM_UNSHIFTED_POLYS = honk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; + const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; + const size_t NUM_UNSHIFTED_POLYS = proof_system::honk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; // Generate batching challenge ρ and powers 1,ρ,…,ρᵐ⁻¹ Fr rho = transcript.get_challenge("rho"); @@ -317,4 +317,4 @@ template plonk::proof& Prover::construct_proof() template class Prover; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp index 5c9aa39ad87..43d2d27f381 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover.hpp @@ -4,7 +4,7 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/honk/flavor/flavor.hpp" #include -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/types/program_settings.hpp" @@ -25,7 +25,7 @@ #include "barretenberg/honk/pcs/claim.hpp" #include "barretenberg/honk/proof_system/prover_library.hpp" -namespace honk { +namespace proof_system::honk { using Fr = barretenberg::fr; using Polynomial = Polynomial; @@ -33,7 +33,7 @@ using Polynomial = Polynomial; template class Prover { public: - Prover(std::vector&& wire_polys, std::shared_ptr input_key = nullptr); + Prover(std::vector&& wire_polys, std::shared_ptr input_key = nullptr); void execute_preamble_round(); void execute_wire_commitments_round(); @@ -61,7 +61,7 @@ template class Prover { std::vector wire_polynomials; barretenberg::polynomial z_permutation; - std::shared_ptr key; + std::shared_ptr key; std::shared_ptr commitment_key; @@ -74,9 +74,9 @@ template class Prover { // Honk only needs a small portion of the functionality but may be fine to use existing work_queue // NOTE: this is not currently in use, but it may well be used in the future. // TODO(Adrian): Uncomment when we need this again. - // bonk::work_queue queue; + // proof_system::work_queue queue; // void flush_queued_work_items() { queue.flush_queue(); } - // bonk::work_queue::work_item_info get_queued_work_item_info() const { + // proof_system::work_queue::work_item_info get_queued_work_item_info() const { // return queue.get_queued_work_item_info(); // } // size_t get_scalar_multiplication_size(const size_t work_item_number) const @@ -103,4 +103,4 @@ extern template class Prover; using StandardProver = Prover; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.cpp index fe102bcd2c3..d99a2947a4b 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.cpp @@ -2,7 +2,7 @@ #include "barretenberg/plonk/proof_system/types/prover_settings.hpp" #include -namespace honk::prover_library { +namespace proof_system::honk::prover_library { using Fr = barretenberg::fr; using Polynomial = barretenberg::Polynomial; @@ -35,7 +35,7 @@ using Polynomial = barretenberg::Polynomial; */ // TODO(#222)(luke): Parallelize template -Polynomial compute_permutation_grand_product(std::shared_ptr& key, +Polynomial compute_permutation_grand_product(std::shared_ptr& key, std::vector& wire_polynomials, Fr beta, Fr gamma) @@ -181,7 +181,7 @@ Polynomial compute_permutation_grand_product(std::shared_ptr& * @param gamma * @return Polynomial */ -Polynomial compute_lookup_grand_product(std::shared_ptr& key, +Polynomial compute_lookup_grand_product(std::shared_ptr& key, std::vector& wire_polynomials, Polynomial& sorted_list_accumulator, Fr eta, @@ -327,7 +327,7 @@ Polynomial compute_lookup_grand_product(std::shared_ptr& key, * @param eta random challenge * @return Polynomial */ -Polynomial compute_sorted_list_accumulator(std::shared_ptr& key, +Polynomial compute_sorted_list_accumulator(std::shared_ptr& key, std::vector& sorted_list_polynomials, Fr eta) { @@ -353,8 +353,8 @@ Polynomial compute_sorted_list_accumulator(std::shared_ptr& k } template Polynomial compute_permutation_grand_product( - std::shared_ptr&, std::vector&, Fr, Fr); + std::shared_ptr&, std::vector&, Fr, Fr); template Polynomial compute_permutation_grand_product( - std::shared_ptr&, std::vector&, Fr, Fr); + std::shared_ptr&, std::vector&, Fr, Fr); -} // namespace honk::prover_library +} // namespace proof_system::honk::prover_library diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.hpp index 0fc6d1662f7..c88a089f850 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.hpp @@ -1,30 +1,30 @@ #pragma once #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/types/program_settings.hpp" -namespace honk::prover_library { +namespace proof_system::honk::prover_library { using Fr = barretenberg::fr; using Polynomial = barretenberg::Polynomial; template -Polynomial compute_permutation_grand_product(std::shared_ptr& key, +Polynomial compute_permutation_grand_product(std::shared_ptr& key, std::vector& wire_polynomials, Fr beta, Fr gamma); -Polynomial compute_lookup_grand_product(std::shared_ptr& key, +Polynomial compute_lookup_grand_product(std::shared_ptr& key, std::vector& wire_polynomials, Polynomial& sorted_list_accumulator, Fr eta, Fr beta, Fr gamma); -Polynomial compute_sorted_list_accumulator(std::shared_ptr& key, +Polynomial compute_sorted_list_accumulator(std::shared_ptr& key, std::vector& sorted_list_polynomials, Fr eta); -} // namespace honk::prover_library +} // namespace proof_system::honk::prover_library diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp index 205d2495814..09021293709 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp @@ -10,7 +10,7 @@ #include #include -using namespace honk; +using namespace proof_system::honk; namespace prover_library_tests { // field is named Fscalar here because of clash with the Fr @@ -47,11 +47,11 @@ template class ProverLibraryTests : public testing::Test { // Define some mock inputs for proving key constructor static const size_t num_gates = 8; static const size_t num_public_inputs = 0; - auto reference_string = std::make_shared(num_gates + 1, "../srs_db/ignition"); + auto reference_string = std::make_shared(num_gates + 1, "../srs_db/ignition"); // Instatiate a proving_key and make a pointer to it. This will be used to instantiate a Prover. - auto proving_key = std::make_shared( - num_gates, num_public_inputs, reference_string, plonk::ComposerType::STANDARD_HONK); + auto proving_key = std::make_shared( + num_gates, num_public_inputs, reference_string, ComposerType::STANDARD_HONK); // static const size_t program_width = StandardProver::settings_::program_width; @@ -156,11 +156,11 @@ template class ProverLibraryTests : public testing::Test { // Define some mock inputs for proving key constructor static const size_t circuit_size = 8; static const size_t num_public_inputs = 0; - auto reference_string = std::make_shared(circuit_size + 1, "../srs_db/ignition"); + auto reference_string = std::make_shared(circuit_size + 1, "../srs_db/ignition"); // Instatiate a proving_key and make a pointer to it. This will be used to instantiate a Prover. - auto proving_key = std::make_shared( - circuit_size, num_public_inputs, reference_string, plonk::ComposerType::STANDARD_HONK); + auto proving_key = std::make_shared( + circuit_size, num_public_inputs, reference_string, ComposerType::STANDARD_HONK); // Construct mock wire and permutation polynomials. // Note: for the purpose of checking the consistency between two methods of computing z_perm, these polynomials @@ -285,9 +285,9 @@ template class ProverLibraryTests : public testing::Test { // Construct a proving_key static const size_t circuit_size = 8; static const size_t num_public_inputs = 0; - auto reference_string = std::make_shared(circuit_size + 1, "../srs_db/ignition"); - auto proving_key = std::make_shared( - circuit_size, num_public_inputs, reference_string, plonk::ComposerType::STANDARD_HONK); + auto reference_string = std::make_shared(circuit_size + 1, "../srs_db/ignition"); + auto proving_key = std::make_shared( + circuit_size, num_public_inputs, reference_string, ComposerType::STANDARD_HONK); // Get random challenge eta auto eta = FF::random_element(); diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp index 4eae6955d3d..26e4b7e0332 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.cpp @@ -26,11 +26,11 @@ #include "barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp" using namespace barretenberg; -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; -namespace honk { +namespace proof_system::honk { template -Verifier::Verifier(std::shared_ptr verifier_key) +Verifier::Verifier(std::shared_ptr verifier_key) : key(verifier_key) {} @@ -199,4 +199,4 @@ template bool Verifier::verify_pro template class Verifier; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp index e4ef74d667b..ed4fe608a1f 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "./program_settings.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp" #include "../sumcheck/sumcheck.hpp" @@ -12,11 +12,11 @@ #include "barretenberg/honk/pcs/shplonk/shplonk_single.hpp" #include "barretenberg/honk/pcs/kzg/kzg.hpp" -namespace honk { +namespace proof_system::honk { template class Verifier { public: - Verifier(std::shared_ptr verifier_key = nullptr); + Verifier(std::shared_ptr verifier_key = nullptr); Verifier(Verifier&& other); Verifier(const Verifier& other) = delete; Verifier& operator=(const Verifier& other) = delete; @@ -24,7 +24,7 @@ template class Verifier { bool verify_proof(const plonk::proof& proof); - std::shared_ptr key; + std::shared_ptr key; std::map kate_g1_elements; std::map kate_fr_elements; std::shared_ptr kate_verification_key; @@ -35,4 +35,4 @@ extern template class Verifier; typedef Verifier StandardVerifier; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp index 42689b9282d..42f559aabf1 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/honk/flavor/flavor.hpp" #include "prover.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/transcript/transcript.hpp" #include "verifier.hpp" #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" @@ -15,7 +15,7 @@ #include using namespace barretenberg; -using namespace honk; +using namespace proof_system::honk; namespace test_honk_verifier { @@ -26,7 +26,7 @@ template class VerifierTests : public testing::Test { return honk::StandardHonk::create_manifest(num_public_inputs, num_sumcheck_rounds); } - static StandardVerifier generate_verifier(std::shared_ptr circuit_proving_key) + static StandardVerifier generate_verifier(std::shared_ptr circuit_proving_key) { std::array poly_coefficients; poly_coefficients[0] = circuit_proving_key->polynomial_store.get("q_1_lagrange").get_coefficients(); @@ -50,11 +50,12 @@ template class VerifierTests : public testing::Test { prover)); } - auto crs = std::make_shared("../srs_db/ignition"); - auto circuit_verification_key = std::make_shared(circuit_proving_key->circuit_size, - circuit_proving_key->num_public_inputs, - crs, - circuit_proving_key->composer_type); + auto crs = std::make_shared("../srs_db/ignition"); + auto circuit_verification_key = + std::make_shared(circuit_proving_key->circuit_size, + circuit_proving_key->num_public_inputs, + crs, + circuit_proving_key->composer_type); circuit_verification_key->commitments.insert({ "Q_1", commitments[0] }); circuit_verification_key->commitments.insert({ "Q_2", commitments[1] }); @@ -81,9 +82,9 @@ template class VerifierTests : public testing::Test { // Create some constraints that satisfy our arithmetic circuit relation // even indices = mul gates, odd incides = add gates - auto crs = std::make_shared(n + 1, "../srs_db/ignition"); - std::shared_ptr proving_key = - std::make_shared(n, 0, crs, plonk::STANDARD_HONK); + auto crs = std::make_shared(n + 1, "../srs_db/ignition"); + std::shared_ptr proving_key = + std::make_shared(n, 0, crs, ComposerType::STANDARD_HONK); polynomial w_l(n); polynomial w_r(n); @@ -177,8 +178,8 @@ template class VerifierTests : public testing::Test { proving_key->polynomial_store.put("sigma_2_lagrange", std::move(sigma_2_lagrange_base)); proving_key->polynomial_store.put("sigma_3_lagrange", std::move(sigma_3_lagrange_base)); - bonk::compute_standard_honk_id_polynomials<3>(proving_key); - bonk::compute_first_and_last_lagrange_polynomials(proving_key); + compute_standard_honk_id_polynomials<3>(proving_key); + compute_first_and_last_lagrange_polynomials(proving_key); proving_key->polynomial_store.put("w_1_lagrange", std::move(w_l)); proving_key->polynomial_store.put("w_2_lagrange", std::move(w_r)); diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp index 7fb76673686..ae2d5f5d9b2 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp @@ -13,7 +13,7 @@ 4) There should be more thorough testing of this class in isolation. */ -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /** * NOTE: We should definitely consider question of optimal choice of domain, but if decide on {0,1,...,t-1} then we can @@ -147,4 +147,4 @@ template class BarycentricData return result; }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp index baee00800e2..ed2471d01eb 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp @@ -4,7 +4,7 @@ #include #include "barretenberg/numeric/random/engine.hpp" -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; namespace test_sumcheck_polynomials { template class BarycentricDataTests : public testing::Test {}; diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp index c5d7756b8ac..d30650154a0 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp @@ -6,13 +6,13 @@ #include "barretenberg/honk/transcript/transcript.hpp" #include "barretenberg/numeric/random/engine.hpp" -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; namespace test_sumcheck_polynomials { template class MultivariatesTests : public testing::Test {}; using FieldTypes = testing::Types; -using Transcript = honk::ProverTranscript; +using Transcript = proof_system::honk::ProverTranscript; TYPED_TEST_SUITE(MultivariatesTests, FieldTypes); #define MULTIVARIATES_TESTS_TYPE_ALIASES using FF = TypeParam; diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp index 8cd92ac17ef..654c348753f 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp @@ -1,6 +1,6 @@ #pragma once -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /** * @brief Succinct representation of the `pow` polynomial that can be partially evaluated variable-by-variable. @@ -126,4 +126,4 @@ template struct PowUnivariate { partial_evaluation_constant *= current_univariate_eval; } }; -} // namespace honk::sumcheck \ No newline at end of file +} // namespace proof_system::honk::sumcheck \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp index 91bbad1a503..a8dd2f5ef36 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include -namespace honk::sumcheck::pow_test { +namespace proof_system::honk::sumcheck::pow_test { using FF = barretenberg::fr; @@ -20,7 +20,7 @@ TEST(SumcheckPow, FullPowConsistency) pow_univariate.partially_evaluate(u_i); } - FF expected_eval = honk::power_polynomial::evaluate(zeta, variables); + FF expected_eval = proof_system::honk::power_polynomial::evaluate(zeta, variables); EXPECT_EQ(pow_univariate.partial_evaluation_constant, expected_eval); } -} // namespace honk::sumcheck::pow_test +} // namespace proof_system::honk::sumcheck::pow_test diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp index 89804ebc8f9..a3cc9cf82f9 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp @@ -6,7 +6,7 @@ #include "barretenberg/common/serialize.hpp" #include "barretenberg/common/assert.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template class UnivariateView; @@ -349,4 +349,4 @@ template std::array array_to_array return array_to_array_aux(elements, std::make_index_sequence()); }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp index e1e5477858e..ffc870e46d8 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp @@ -5,7 +5,7 @@ #include #include "barretenberg/numeric/random/engine.hpp" -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; namespace test_univariate { template class UnivariateTest : public testing::Test { diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp index 4bfd999bd4c..55947abeb45 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp @@ -6,7 +6,7 @@ #include "../polynomials/univariate.hpp" #include "relation.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template class ArithmeticRelation { public: @@ -68,4 +68,4 @@ template class ArithmeticRelation { full_honk_relation_value += q_c; }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp index c2cab137ce1..5ecdedf61dc 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp @@ -3,7 +3,7 @@ #include "barretenberg/honk/flavor/flavor.hpp" #include "../polynomials/univariate.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template class GrandProductComputationRelation { public: @@ -90,4 +90,4 @@ template class GrandProductComputationRelation { (w_2 + beta * sigma_2 + gamma) * (w_3 + beta * sigma_3 + gamma)); }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp index 66853b2e23b..788cec7f52a 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp @@ -3,7 +3,7 @@ #include "barretenberg/honk/flavor/flavor.hpp" #include "../polynomials/univariate.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template class GrandProductInitializationRelation { public: @@ -45,4 +45,4 @@ template class GrandProductInitializationRelation { full_honk_relation_value += lagrange_last * z_perm_shift; }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp index 8218aaa3f09..a7860faeebe 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp @@ -1,6 +1,6 @@ #pragma once -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { // TODO(#226)(Adrian): Remove zeta, alpha as they are not used by the relations. template struct RelationParameters { @@ -8,4 +8,4 @@ template struct RelationParameters { FF gamma; FF public_input_delta; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp index 8a2620badcb..6b7e1ac5210 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp @@ -10,7 +10,7 @@ #include "barretenberg/numeric/random/engine.hpp" #include -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; /** * We want to test if all three relations (namely, ArithmeticRelation, GrandProductComputationRelation, * GrandProductInitializationRelation) provide correct contributions by manually computing their @@ -23,15 +23,15 @@ using namespace honk::sumcheck; */ static const size_t input_univariate_length = 2; static constexpr size_t FULL_RELATION_LENGTH = 5; -static const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; +static const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; -namespace honk_relation_tests { +namespace proof_system::honk_relation_tests { template class SumcheckRelation : public testing::Test { public: template using Univariate = Univariate; template using UnivariateView = UnivariateView; - using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; + using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; // TODO(#225)(Adrian): Accept FULL_RELATION_LENGTH as a template parameter for this function only, so that the test // can decide to which degree the polynomials must be extended. Possible accept an existing list of "edges" and // extend them to the degree. @@ -311,4 +311,4 @@ TYPED_TEST(SumcheckRelation, GrandProductInitializationRelation) run_test(/* is_random_input=*/false); }; -} // namespace honk_relation_tests +} // namespace proof_system::honk_relation_tests diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp index b96bd99d67a..837922feb23 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp @@ -17,13 +17,13 @@ #include "barretenberg/honk/sumcheck/sumcheck_output.hpp" #include -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template class... Relations> class Sumcheck { public: static constexpr size_t MAX_RELATION_LENGTH = std::max({ Relations::RELATION_LENGTH... }); - static constexpr size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; + static constexpr size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; std::array purported_evaluations; Transcript& transcript; @@ -217,4 +217,4 @@ template class... Relations> cl } }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp index 9f3092c5be1..95316ca5cbe 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp @@ -20,11 +20,11 @@ #include #include -using namespace honk; -using namespace honk::sumcheck; +using namespace proof_system::honk; +using namespace proof_system::honk::sumcheck; using FF = barretenberg::fr; -const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; -using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; +const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; +using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; namespace test_sumcheck_round { diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp index ab47f20e6c0..52383cc80b1 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp @@ -2,7 +2,7 @@ #include #include -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /** * @brief Contains the multi-linear evaluations of the polynomials at the challenge point 'u'. @@ -16,4 +16,4 @@ template struct SumcheckOutput { bool operator==(const SumcheckOutput& other) const = default; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp index 021d14730fd..8a10169b8aa 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp @@ -8,7 +8,7 @@ #include "polynomials/pow.hpp" #include "relations/relation.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /* Notation: The polynomial P(X0, X1) that is the low-degree extension of its values vij = P(i,j) @@ -318,4 +318,4 @@ template class... Relation } } }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp index f0129c1061b..97b8ab4c470 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp @@ -19,13 +19,13 @@ * similar approach. */ -using namespace honk; -using namespace honk::sumcheck; +using namespace proof_system::honk; +using namespace proof_system::honk::sumcheck; const size_t max_relation_length = 5; const size_t input_polynomial_length = 2; using FF = barretenberg::fr; -const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; -using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; +const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; +using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; namespace test_sumcheck_round { /** diff --git a/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp b/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp index 89cef262199..15d92c679be 100644 --- a/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.hpp @@ -15,7 +15,7 @@ #include #include -namespace honk { +namespace proof_system::honk { class TranscriptManifest { struct RoundData { @@ -272,4 +272,4 @@ template class VerifierTranscript : public BaseTranscript { return element; } }; -} // namespace honk +} // namespace proof_system::honk diff --git a/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp b/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp index d9c8bc8c742..1e2de3d9d9d 100644 --- a/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/transcript/transcript.test.cpp @@ -8,7 +8,7 @@ #include #include -using namespace honk; +using namespace proof_system::honk; template class TranscriptTest : public testing::Test { public: @@ -158,7 +158,7 @@ TYPED_TEST(TranscriptTest, ProverAndVerifierBasic) constexpr size_t LENGTH = 8; using Fr = barretenberg::fr; - using Univariate = honk::sumcheck::Univariate; + using Univariate = proof_system::honk::sumcheck::Univariate; using Commitment = barretenberg::g1::affine_element; std::array evaluations; diff --git a/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.hpp b/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.hpp index 3459679e379..4f2e1ed5b20 100644 --- a/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.hpp @@ -5,7 +5,7 @@ #ifndef NO_MULTITHREADING #include "omp.h" #endif -namespace honk::power_polynomial { +namespace proof_system::honk::power_polynomial { /** * @brief Generate the power polynomial vector * @@ -71,4 +71,4 @@ template Fr evaluate(Fr zeta, std::span variables) } return evaluation; } -} // namespace honk::power_polynomial +} // namespace proof_system::honk::power_polynomial diff --git a/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp b/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp index d62658e5924..748731f0146 100644 --- a/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp +++ b/barretenberg/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp @@ -7,7 +7,7 @@ TEST(power_polynomial, test_full_polynomial_correctness) const size_t order = 17; const size_t n = size_t(1) << order; barretenberg::fr zeta = barretenberg::fr::random_element(); - barretenberg::polynomial power_polynomial = honk::power_polynomial::generate_vector(zeta, n); + barretenberg::polynomial power_polynomial = proof_system::honk::power_polynomial::generate_vector(zeta, n); barretenberg::fr current_power = barretenberg::fr::one(); for (size_t i = 0; i < n; i++) { @@ -31,5 +31,5 @@ TEST(power_polynomial, test_evaluation_correctness) variables.emplace_back((random_index >> i) & 1); } EXPECT_EQ(zeta.pow(static_cast(random_index)), - honk::power_polynomial::evaluate(zeta, variables)); + proof_system::honk::power_polynomial::evaluate(zeta, variables)); } diff --git a/barretenberg/cpp/src/barretenberg/honk/utils/public_inputs.hpp b/barretenberg/cpp/src/barretenberg/honk/utils/public_inputs.hpp index e281aeab8e1..52c66cff947 100644 --- a/barretenberg/cpp/src/barretenberg/honk/utils/public_inputs.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/utils/public_inputs.hpp @@ -1,7 +1,7 @@ #pragma once #include -namespace honk { +namespace proof_system::honk { /** * @brief Compute the correction term for the permutation argument. @@ -54,4 +54,4 @@ Field compute_public_input_delta(std::span public_inputs, return numerator / denominator; } -} // namespace honk \ No newline at end of file +} // namespace proof_system::honk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp index f50bb31ebae..e5371b8bd0f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp @@ -5,7 +5,7 @@ #include #include #include "barretenberg/common/timer.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #ifndef __wasm__ #include @@ -19,9 +19,9 @@ struct circuit_data { : num_gates(0) {} - std::shared_ptr srs; - std::shared_ptr proving_key; - std::shared_ptr verification_key; + std::shared_ptr srs; + std::shared_ptr proving_key; + std::shared_ptr verification_key; size_t num_gates; std::vector padding_proof; bool mock; @@ -38,7 +38,7 @@ inline bool exists(std::string const& path) template circuit_data get_circuit_data(std::string const& name, std::string const& path_name, - std::shared_ptr const& srs, + std::shared_ptr const& srs, std::string const& key_path, bool compute, bool save, @@ -70,12 +70,12 @@ circuit_data get_circuit_data(std::string const& name, Timer timer; build_circuit(composer); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Build time", timer.toString()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Gates", @@ -86,7 +86,7 @@ circuit_data get_circuit_data(std::string const& name, auto public_inputs = composer.get_public_inputs(); mock::mock_circuit(mock_proof_composer, public_inputs); info(name, ": Mock circuit size: ", mock_proof_composer.get_num_gates()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Mock Gates", @@ -107,13 +107,13 @@ circuit_data get_circuit_data(std::string const& name, if (exists(pk_path) && load) { info(name, ": Loading proving key: ", pk_path); auto pk_stream = std::ifstream(pk_path); - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read_mmap(pk_stream, pk_dir, pk_data); data.proving_key = - std::make_shared(std::move(pk_data), srs->get_prover_crs(pk_data.circuit_size + 1)); + std::make_shared(std::move(pk_data), srs->get_prover_crs(pk_data.circuit_size + 1)); data.num_gates = pk_data.circuit_size; info(name, ": Circuit size 2^n: ", data.num_gates); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Gates 2^n", @@ -127,7 +127,7 @@ circuit_data get_circuit_data(std::string const& name, data.proving_key = composer.compute_proving_key(); info(name, ": Circuit size 2^n: ", data.proving_key->circuit_size); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Gates 2^n", @@ -136,7 +136,7 @@ circuit_data get_circuit_data(std::string const& name, data.num_gates = mock_proof_composer.get_num_gates(); data.proving_key = mock_proof_composer.compute_proving_key(); info(name, ": Mock circuit size 2^n: ", data.proving_key->circuit_size); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Mock Gates 2^n", @@ -145,7 +145,7 @@ circuit_data get_circuit_data(std::string const& name, info(name, ": Proving key computed in ", timer.toString(), "s"); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Proving key computed in", @@ -170,12 +170,12 @@ circuit_data get_circuit_data(std::string const& name, if (exists(vk_path) && load) { info(name, ": Loading verification key from: ", vk_path); auto vk_stream = std::ifstream(vk_path); - bonk::verification_key_data vk_data; + plonk::verification_key_data vk_data; read(vk_stream, vk_data); data.verification_key = - std::make_shared(std::move(vk_data), data.srs->get_verifier_crs()); + std::make_shared(std::move(vk_data), data.srs->get_verifier_crs()); info(name, ": Verification key hash: ", data.verification_key->sha256_hash()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Verification key hash", @@ -191,13 +191,13 @@ circuit_data get_circuit_data(std::string const& name, } info(name, ": Computed verification key in ", timer.toString(), "s"); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Verification key computed in", timer.toString()); info(name, ": Verification key hash: ", data.verification_key->sha256_hash()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Verification key hash", @@ -246,7 +246,7 @@ circuit_data get_circuit_data(std::string const& name, info(name, ": Padding verified: ", verifier.verify_proof(proof)); } info(name, ": Padding proof computed in ", timer.toString(), "s"); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Padding proof computed in", diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp index 88ffa3bf80b..cb35a19d276 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp @@ -8,11 +8,11 @@ #include #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/srs/reference_string/pippenger_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; using namespace join_split_example::proofs::join_split; #define WASM_EXPORT __attribute__((visibility("default"))) @@ -23,14 +23,14 @@ WASM_EXPORT void join_split__init_proving_key(bool mock) { // We know that we don't actually need any CRS to create a proving key, so just feed in a nothing. // Hacky, but, right now it needs *something*. - auto crs_factory = std::make_shared(); + auto crs_factory = std::make_shared(); init_proving_key(crs_factory, mock); } WASM_EXPORT void join_split__init_proving_key_from_buffer(uint8_t const* pk_buf) { - std::shared_ptr crs; - bonk::proving_key_data pk_data; + std::shared_ptr crs; + plonk::proving_key_data pk_data; read(pk_buf, pk_data); init_proving_key(crs, std::move(pk_data)); } @@ -70,15 +70,15 @@ WASM_EXPORT uint32_t join_split__get_new_proving_key_data(uint8_t** output) WASM_EXPORT void join_split__init_verification_key(void* pippenger, uint8_t const* g2x) { - auto crs_factory = std::make_unique( + auto crs_factory = std::make_unique( reinterpret_cast(pippenger), g2x); init_verification_key(std::move(crs_factory)); } WASM_EXPORT void join_split__init_verification_key_from_buffer(uint8_t const* vk_buf, uint8_t const* g2x) { - auto crs = std::make_shared(g2x); - bonk::verification_key_data vk_data; + auto crs = std::make_shared(g2x); + plonk::verification_key_data vk_data; read(vk_buf, vk_data); init_verification_key(crs, std::move(vk_data)); } diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp index 700310f724e..47fc4deec20 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp @@ -9,9 +9,9 @@ namespace proofs { namespace join_split { using namespace join_split_example::proofs::join_split; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; using namespace join_split_example::proofs::notes::native; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; join_split_tx noop_tx() { @@ -58,7 +58,7 @@ join_split_tx noop_tx() return tx; } -circuit_data get_circuit_data(std::shared_ptr const& srs, bool mock) +circuit_data get_circuit_data(std::shared_ptr const& srs, bool mock) { std::cerr << "Getting join-split circuit data..." << std::endl; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp index 8e4c533e6ed..6c01a5b144f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp @@ -10,7 +10,7 @@ join_split_tx noop_tx(); using circuit_data = proofs::circuit_data; -circuit_data get_circuit_data(std::shared_ptr const& srs, bool mock = false); +circuit_data get_circuit_data(std::shared_ptr const& srs, bool mock = false); } // namespace join_split } // namespace proofs diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp index 213628a18f9..44567b5b26b 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp @@ -7,13 +7,13 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk; +using namespace proof_system::plonk::stdlib::merkle_tree; -static std::shared_ptr proving_key; -static std::shared_ptr verification_key; +static std::shared_ptr proving_key; +static std::shared_ptr verification_key; -void init_proving_key(std::shared_ptr const& crs_factory, bool mock) +void init_proving_key(std::shared_ptr const& crs_factory, bool mock) { if (proving_key) { return; @@ -35,10 +35,11 @@ void init_proving_key(std::shared_ptr const& crs_f } } -void init_proving_key(std::shared_ptr const& crs, bonk::proving_key_data&& pk_data) +void init_proving_key(std::shared_ptr const& crs, + plonk::proving_key_data&& pk_data) { release_key(); - proving_key = std::make_shared(std::move(pk_data), crs); + proving_key = std::make_shared(std::move(pk_data), crs); } void release_key() @@ -46,7 +47,7 @@ void release_key() proving_key.reset(); } -void init_verification_key(std::unique_ptr&& crs_factory) +void init_verification_key(std::unique_ptr&& crs_factory) { if (!proving_key) { std::abort(); @@ -58,10 +59,10 @@ void init_verification_key(std::unique_ptr&& crs_f plonk::stdlib::types::Composer::compute_verification_key_base(proving_key, crs_factory->get_verifier_crs()); } -void init_verification_key(std::shared_ptr const& crs, - bonk::verification_key_data&& vk_data) +void init_verification_key(std::shared_ptr const& crs, + plonk::verification_key_data&& vk_data) { - verification_key = std::make_shared(std::move(vk_data), crs); + verification_key = std::make_shared(std::move(vk_data), crs); } stdlib::types::Prover new_join_split_prover(join_split_tx const& tx, bool mock) @@ -104,12 +105,12 @@ bool verify_proof(plonk::proof const& proof) return verifier.verify_proof(proof); } -std::shared_ptr get_proving_key() +std::shared_ptr get_proving_key() { return proving_key; } -std::shared_ptr get_verification_key() +std::shared_ptr get_verification_key() { return verification_key; } diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp index e4fe7817001..6c9b4ac5ab2 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp @@ -7,27 +7,28 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk::stdlib::merkle_tree; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; -void init_proving_key(std::shared_ptr const& crs_factory, bool mock); +void init_proving_key(std::shared_ptr const& crs_factory, bool mock); -void init_proving_key(std::shared_ptr const& crs, bonk::proving_key_data&& pk_data); +void init_proving_key(std::shared_ptr const& crs, + plonk::proving_key_data&& pk_data); void release_key(); -void init_verification_key(std::unique_ptr&& crs_factory); +void init_verification_key(std::unique_ptr&& crs_factory); -void init_verification_key(std::shared_ptr const& crs, - bonk::verification_key_data&& vk_data); +void init_verification_key(std::shared_ptr const& crs, + plonk::verification_key_data&& vk_data); stdlib::types::Prover new_join_split_prover(join_split_tx const& tx, bool mock); bool verify_proof(plonk::proof const& proof); -std::shared_ptr get_proving_key(); +std::shared_ptr get_proving_key(); -std::shared_ptr get_verification_key(); +std::shared_ptr get_verification_key(); } // namespace join_split } // namespace proofs diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp index e7564dc63a7..46a45c61507 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp @@ -6,7 +6,7 @@ #include "barretenberg/common/streams.hpp" #include "barretenberg/common/test.hpp" #include -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/merkle_tree/index.hpp" namespace join_split_example::proofs::join_split { @@ -122,8 +122,8 @@ constexpr bool CIRCUIT_CHANGE_EXPECTED = false; #endif using namespace barretenberg; -using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; using namespace join_split_example::proofs::notes::native; using key_pair = join_split_example::fixtures::grumpkin_key_pair; @@ -139,9 +139,9 @@ class join_split_tests : public ::testing::Test { static constexpr size_t ACCOUNT_INDEX = 14; static void SetUpTestCase() { - auto null_crs_factory = std::make_shared(); + auto null_crs_factory = std::make_shared(); init_proving_key(null_crs_factory, false); - auto crs_factory = std::make_unique("../srs_db/ignition"); + auto crs_factory = std::make_unique("../srs_db/ignition"); init_verification_key(std::move(crs_factory)); info("vk hash: ", get_verification_key()->sha256_hash()); } diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp index 0bc3b796b1b..a0061cde888 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp @@ -11,9 +11,9 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk; +using namespace proof_system::plonk; using namespace notes::circuit; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; /** * Check that the input note data, follows the given hash paths, to the publically given merkle root. diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp index 5e28d1e1612..b8821989b4e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp @@ -9,7 +9,7 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct join_split_inputs { field_ct proof_id; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp index e470b98f88b..0294983f7c5 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp @@ -4,7 +4,7 @@ #include "../notes/native/index.hpp" #include "barretenberg/common/streams.hpp" #include "barretenberg/common/test.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/merkle_tree/index.hpp" #include "barretenberg/crypto/sha256/sha256.hpp" @@ -13,8 +13,8 @@ namespace proofs { namespace join_split { using namespace barretenberg; -// using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +// using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; using namespace join_split_example::proofs::notes::native; using key_pair = join_split_example::fixtures::grumpkin_key_pair; @@ -25,9 +25,9 @@ class join_split_js_parity_tests : public ::testing::Test { protected: static void SetUpTestCase() { - auto null_crs_factory = std::make_shared(); + auto null_crs_factory = std::make_shared(); init_proving_key(null_crs_factory, false); - auto crs_factory = std::make_unique("../srs_db/ignition"); + auto crs_factory = std::make_unique("../srs_db/ignition"); init_verification_key(std::move(crs_factory)); info("vk hash: ", get_verification_key()->sha256_hash()); } diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp index 38c9cc4624d..4dae8f30e37 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp @@ -9,7 +9,7 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct join_split_tx { uint32_t proof_id; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp index 6f61e4e936d..f629a32f180 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp @@ -7,7 +7,7 @@ namespace join_split_example { namespace proofs { namespace mock { -using namespace plonk::stdlib; +using namespace proof_system::plonk::stdlib; template void mock_circuit(Composer& composer, std::vector const& public_inputs_) { diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp index dc4683353a6..16004e97876 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/common/test.hpp" #include "barretenberg/stdlib/types/types.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace rollup { namespace proofs { diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp index 7252072da9e..334b2edfc3e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { namespace account { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct account_note { field_ct account_alias_hash; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp index b1e6f3eadb2..ca668b94f65 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { namespace account { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto commit(field_ct const& account_alias_hash, point_ct const& account_public_key, diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp index b2c5d86c181..5163231bc56 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp @@ -3,7 +3,7 @@ namespace join_split_example::proofs::notes::circuit { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; std::pair deflag_asset_id(suint_ct const& asset_id) { diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp index 8a4b5a5520b..3c67f16695f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp @@ -3,7 +3,7 @@ namespace join_split_example::proofs::notes::circuit { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; std::pair deflag_asset_id(suint_ct const& asset_id); diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp index 40040322eec..f5b1bbd3199 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp @@ -9,7 +9,7 @@ namespace proofs { namespace notes { namespace circuit { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; constexpr uint32_t input_asset_id_a_shift = DEFI_BRIDGE_ADDRESS_ID_LEN; constexpr uint32_t input_asset_id_b_shift = input_asset_id_a_shift + DEFI_BRIDGE_INPUT_A_ASSET_ID_LEN; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp index f2f24a5a91d..8021265a43d 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp @@ -12,7 +12,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct partial_claim_note { suint_ct deposit_value; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp index d92ded2135a..c1ea735d12d 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto complete_partial_commitment(field_ct const& partial_commitment, field_ct const& interaction_nonce, diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp index 27f7284ea5f..05666cacc40 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline field_ct compute_nullifier(field_ct const& note_commitment) { diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp index b5c6180b5ea..d903e5688d3 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto create_partial_commitment(field_ct const& deposit_value, field_ct const& bridge_call_data, diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp index a5fd321a85a..b49bddd3bb5 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp @@ -11,7 +11,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; /** * Convert native claim note data into circuit witness data. diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp index cb1c475283c..2ec86fc763e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto complete_partial_commitment(field_ct const& value_note_partial_commitment, suint_ct const& value, diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp index f501e2df2b2..08f00dbf16e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; field_ct compute_nullifier(field_ct const& note_commitment, field_ct const& account_private_key, @@ -42,7 +42,7 @@ field_ct compute_nullifier(field_ct const& note_commitment, * eth address. */ auto blake_input = byte_array_ct(compressed_inputs); - auto blake_result = plonk::stdlib::blake2s(blake_input); + auto blake_result = proof_system::plonk::stdlib::blake2s(blake_input); return field_ct(blake_result); } diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp index 7b78685348c..3271035abb8 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp @@ -7,7 +7,7 @@ namespace notes { namespace circuit { using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; field_ct compute_nullifier(field_ct const& note_commitment, field_ct const& account_private_key, diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp index c6c7f838614..063ef93edd8 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp @@ -7,7 +7,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace join_split_example::proofs::notes; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; TEST(compute_nullifier_circuit, native_consistency) { diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp index bedd3d0688b..2cb12fa9d28 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto create_partial_commitment(field_ct const& secret, point_ct const& owner, diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp index 10ef82d110c..a4f8cc04c8f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct value_note { point_ct owner; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp index 3bdee7e2c43..e243b35fb86 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp @@ -5,7 +5,7 @@ #include using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; using namespace join_split_example::proofs::notes; using namespace join_split_example::proofs::notes::circuit::value; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp index 69e26fd9e27..ff0cbc0cc2e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct witness_data { point_ct owner; diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp index 140203f0c90..b37b5116915 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp @@ -20,13 +20,13 @@ template struct verify_result { std::vector proof_data; bool verified; - std::shared_ptr verification_key; + std::shared_ptr verification_key; size_t number_of_gates; }; template inline bool pairing_check(plonk::stdlib::recursion::recursion_output> recursion_output, - std::shared_ptr const& srs) + std::shared_ptr const& srs) { g1::affine_element P[2]; P[0].x = barretenberg::fq(recursion_output.P0.x.get_value().lo); diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.cpp index 1dde96b0dbf..46e404a57e5 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.cpp @@ -1,8 +1,8 @@ #include "composer_base.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/utils/permutation.hpp" -namespace plonk { +namespace proof_system::plonk { /** * Join variable class b to variable class a. @@ -422,4 +422,4 @@ template void ComposerBase::compute_witness_base<4>(const size_t); // turbo and template void ComposerBase::compute_wire_copy_cycles<3>(); template void ComposerBase::compute_wire_copy_cycles<4>(); -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.hpp index 6f2c3565107..6c93da04b14 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/composer_base.hpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/proof_system/types/prover_settings.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -namespace plonk { +namespace proof_system::plonk { static constexpr uint32_t DUMMY_TAG = 0; class ComposerBase { public: @@ -350,7 +350,7 @@ extern template void ComposerBase::compute_witness_base<3>(const size_t); // sta extern template void ComposerBase::compute_witness_base<4>(const size_t); // turbo and ultra extern template void ComposerBase::compute_sigma_permutations<4, true>(proving_key* key); -} // namespace plonk +} // namespace proof_system::plonk /** * Composer Example: Pythagorean triples. diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.cpp new file mode 100644 index 00000000000..4ab16d74341 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.cpp @@ -0,0 +1,77 @@ +/** + * @file composer_helper_lib.cpp + * @brief Contains implementations of some of the functions used both by Honk and Plonk-style composers (excluding + * permutation functions) + * + */ +#include "composer_helper_lib.hpp" +#include "barretenberg/honk/pcs/commitment_key.hpp" + +namespace proof_system::plonk { + +/** + * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into + * cache + * + * @param key Pointer to the proving key + * @param selector_properties Names of selectors + */ +void compute_monomial_and_coset_selector_forms(plonk::proving_key* circuit_proving_key, + std::vector selector_properties) +{ + for (size_t i = 0; i < selector_properties.size(); i++) { + // Compute monomial form of selector polynomial + auto& selector_poly_lagrange = + circuit_proving_key->polynomial_store.get(selector_properties[i].name + "_lagrange"); + barretenberg::polynomial selector_poly(circuit_proving_key->circuit_size); + barretenberg::polynomial_arithmetic::ifft( + &selector_poly_lagrange[0], &selector_poly[0], circuit_proving_key->small_domain); + + // Compute coset FFT of selector polynomial + barretenberg::polynomial selector_poly_fft(selector_poly, circuit_proving_key->circuit_size * 4 + 4); + selector_poly_fft.coset_fft(circuit_proving_key->large_domain); + + // TODO(luke): For Standard/Turbo, the lagrange polynomials can be removed from the store at this point but this + // is not the case for Ultra. Implement? + circuit_proving_key->polynomial_store.put(selector_properties[i].name, std::move(selector_poly)); + circuit_proving_key->polynomial_store.put(selector_properties[i].name + "_fft", std::move(selector_poly_fft)); + } +} + +/** + * @brief Computes the verification key by computing the: + * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, + * (2) sets the polynomial manifest using the data from proving key. + */ +std::shared_ptr compute_verification_key_common( + std::shared_ptr const& proving_key, std::shared_ptr const& vrs) +{ + auto circuit_verification_key = std::make_shared( + proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->composer_type); + // TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc + auto commitment_key = proof_system::honk::pcs::kzg::CommitmentKey(proving_key->circuit_size, "../srs_db/ignition"); + + for (size_t i = 0; i < proving_key->polynomial_manifest.size(); ++i) { + const auto& poly_info = proving_key->polynomial_manifest[i]; + + const std::string poly_label(poly_info.polynomial_label); + const std::string selector_commitment_label(poly_info.commitment_label); + + if (poly_info.source == PolynomialSource::SELECTOR || poly_info.source == PolynomialSource::PERMUTATION || + poly_info.source == PolynomialSource::OTHER) { + // Fetch the polynomial in its vector form. + + // Commit to the constraint selector polynomial and insert the commitment in the verification key. + + auto poly_commitment = commitment_key.commit(proving_key->polynomial_store.get(poly_label)); + circuit_verification_key->commitments.insert({ selector_commitment_label, poly_commitment }); + } + } + + // Set the polynomial manifest in verification key. + circuit_verification_key->polynomial_manifest = proof_system::plonk::PolynomialManifest(proving_key->composer_type); + + return circuit_verification_key; +} + +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp new file mode 100644 index 00000000000..927174cc0fc --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp @@ -0,0 +1,29 @@ +#pragma once +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" + +namespace proof_system::plonk { +struct SelectorProperties { + std::string name; + bool requires_lagrange_base_polynomial = false; // does the prover need the raw lagrange-base selector values? +}; + +/** + * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into + * cache + * + * @param key Pointer to the proving key + * @param selector_properties Names of selectors + */ +void compute_monomial_and_coset_selector_forms(plonk::proving_key* key, + std::vector selector_properties); + +/** + * @brief Computes the verification key by computing the: + * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, + * (2) sets the polynomial manifest using the data from proving key. + */ +std::shared_ptr compute_verification_key_common( + std::shared_ptr const& proving_key, std::shared_ptr const& vrs); + +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp index 6205c0d9b1f..601de58dacb 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp @@ -5,12 +5,15 @@ #include "barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp" #include "barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp" #include "barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp" +#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" +#include "barretenberg/proof_system/composer/permutation_helper.hpp" #include #include #include -namespace plonk { +namespace proof_system::plonk { /** * Compute witness polynomials (w_1, w_2, w_3, w_4). @@ -52,7 +55,7 @@ void StandardPlonkComposerHelper::compute_witness(const Circ * @return Pointer to the initialized proving key updated with selector polynomials. * */ template -std::shared_ptr StandardPlonkComposerHelper::compute_proving_key( +std::shared_ptr StandardPlonkComposerHelper::compute_proving_key( const CircuitConstructor& circuit_constructor) { if (circuit_proving_key) { @@ -62,11 +65,8 @@ std::shared_ptr StandardPlonkComposerHelper StandardPlonkComposerHelper(circuit_constructor, - circuit_proving_key.get()); + compute_standard_plonk_sigma_permutations(circuit_constructor, + circuit_proving_key.get()); circuit_proving_key->recursive_proof_public_input_indices = std::vector(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); @@ -91,7 +91,7 @@ std::shared_ptr StandardPlonkComposerHelper -std::shared_ptr StandardPlonkComposerHelper::compute_verification_key( +std::shared_ptr StandardPlonkComposerHelper::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -101,7 +101,8 @@ std::shared_ptr StandardPlonkComposerHelperget_verifier_crs()); + circuit_verification_key = + plonk::compute_verification_key_common(circuit_proving_key, crs_factory_->get_verifier_crs()); circuit_verification_key->composer_type = circuit_proving_key->composer_type; circuit_verification_key->recursive_proof_public_input_indices = std::vector(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); @@ -172,4 +173,4 @@ plonk::Prover StandardPlonkComposerHelper::create_prover( } template class StandardPlonkComposerHelper; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp index 976290b1bc5..32085fcb57e 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp @@ -1,49 +1,46 @@ #pragma once #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" #include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" -#include "barretenberg/proof_system/composer/permutation_helper.hpp" - +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" #include -namespace plonk { +namespace proof_system::plonk { // TODO(Kesha): change initializations to specify this parameter // Cody: What does this mean? template class StandardPlonkComposerHelper { public: static constexpr size_t NUM_RANDOMIZED_GATES = 2; // equal to the number of multilinear evaluations leaked static constexpr size_t program_width = CircuitConstructor::program_width; - std::shared_ptr circuit_proving_key; - std::shared_ptr circuit_verification_key; + std::shared_ptr circuit_proving_key; + std::shared_ptr circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr crs_factory_; + std::shared_ptr crs_factory_; std::vector recursive_proof_public_input_indices; bool contains_recursive_proof = false; bool computed_witness = false; StandardPlonkComposerHelper() - : StandardPlonkComposerHelper( - std::shared_ptr(new bonk::FileReferenceStringFactory("../srs_db/ignition"))) + : StandardPlonkComposerHelper(std::shared_ptr( + new proof_system::FileReferenceStringFactory("../srs_db/ignition"))) {} - - StandardPlonkComposerHelper(std::shared_ptr crs_factory) + StandardPlonkComposerHelper(std::shared_ptr crs_factory) : crs_factory_(std::move(crs_factory)) {} - StandardPlonkComposerHelper(std::unique_ptr&& crs_factory) + StandardPlonkComposerHelper(std::unique_ptr&& crs_factory) : crs_factory_(std::move(crs_factory)) {} - - StandardPlonkComposerHelper(std::shared_ptr p_key, std::shared_ptr v_key) + StandardPlonkComposerHelper(std::shared_ptr p_key, + std::shared_ptr v_key) : circuit_proving_key(std::move(p_key)) , circuit_verification_key(std::move(v_key)) {} @@ -54,7 +51,7 @@ template class StandardPlonkComposerHelper { StandardPlonkComposerHelper& operator=(const StandardPlonkComposerHelper& other) = delete; ~StandardPlonkComposerHelper() = default; - inline std::vector standard_selector_properties() + inline std::vector standard_selector_properties() { std::vector result{ { "q_m", false }, { "q_c", false }, { "q_1", false }, { "q_2", false }, { "q_3", false }, @@ -75,8 +72,8 @@ template class StandardPlonkComposerHelper { recursive_proof_public_input_indices.push_back((uint32_t)(circuit_constructor.public_inputs.size() - 1)); } } - std::shared_ptr compute_proving_key(const CircuitConstructor& circuit_constructor); - std::shared_ptr compute_verification_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr compute_proving_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr compute_verification_key(const CircuitConstructor& circuit_constructor); plonk::Verifier create_verifier(const CircuitConstructor& circuit_constructor); plonk::Prover create_prover(const CircuitConstructor& circuit_constructor); @@ -174,4 +171,4 @@ template class StandardPlonkComposerHelper { } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp index 2a28ffd2047..c24524a9282 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp @@ -11,9 +11,12 @@ #include "barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp" #include "barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp" #include "barretenberg/proof_system/composer/permutation_helper.hpp" +#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" + using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { /** * Compute proving key @@ -27,7 +30,7 @@ namespace plonk { * @return Pointer to the initialized proving key updated with selector polynomials. * */ template -std::shared_ptr TurboPlonkComposerHelper::compute_proving_key( +std::shared_ptr TurboPlonkComposerHelper::compute_proving_key( const CircuitConstructor& circuit_constructor) { if (circuit_proving_key) { @@ -37,11 +40,8 @@ std::shared_ptr TurboPlonkComposerHelper: const size_t num_randomized_gates = NUM_RANDOMIZED_GATES; // Initialize circuit_proving_key // TODO(#229)(Kesha): replace composer types. - circuit_proving_key = initialize_proving_key(circuit_constructor, - crs_factory_.get(), - minimum_circuit_size, - num_randomized_gates, - plonk::ComposerType::TURBO); + circuit_proving_key = initialize_proving_key( + circuit_constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::TURBO); construct_lagrange_selector_forms(circuit_constructor, circuit_proving_key.get()); @@ -50,8 +50,8 @@ std::shared_ptr TurboPlonkComposerHelper: compute_monomial_and_coset_selector_forms(circuit_proving_key.get(), turbo_selector_properties()); // Compute sigma polynomials (TODO(kesha): we should update that late) - bonk::compute_standard_plonk_sigma_permutations(circuit_constructor, - circuit_proving_key.get()); + compute_standard_plonk_sigma_permutations(circuit_constructor, + circuit_proving_key.get()); circuit_proving_key->recursive_proof_public_input_indices = std::vector(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); circuit_proving_key->contains_recursive_proof = contains_recursive_proof; @@ -64,7 +64,7 @@ std::shared_ptr TurboPlonkComposerHelper: * @return Pointer to created circuit verification key. * */ template -std::shared_ptr TurboPlonkComposerHelper::compute_verification_key( +std::shared_ptr TurboPlonkComposerHelper::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -74,7 +74,8 @@ std::shared_ptr TurboPlonkComposerHelperget_verifier_crs()); + circuit_verification_key = + plonk::compute_verification_key_common(circuit_proving_key, crs_factory_->get_verifier_crs()); circuit_verification_key->composer_type = circuit_proving_key->composer_type; circuit_verification_key->recursive_proof_public_input_indices = std::vector(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); @@ -177,4 +178,4 @@ plonk::TurboVerifier TurboPlonkComposerHelper::create_verifi } template class TurboPlonkComposerHelper; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp index 94920b20464..2f12901330f 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp @@ -1,12 +1,13 @@ #pragma once +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" #include "barretenberg/proof_system/composer/composer_helper_lib.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -namespace plonk { +namespace proof_system::plonk { template class TurboPlonkComposerHelper { public: static constexpr size_t NUM_RANDOMIZED_GATES = 2; // equal to the number of multilinear evaluations leaked @@ -14,29 +15,29 @@ template class TurboPlonkComposerHelper { static constexpr ComposerType type = ComposerType::TURBO; static constexpr MerkleHashType merkle_hash_type = MerkleHashType::FIXED_BASE_PEDERSEN; static constexpr size_t UINT_LOG2_BASE = 2; - std::shared_ptr circuit_proving_key; - std::shared_ptr circuit_verification_key; + std::shared_ptr circuit_proving_key; + std::shared_ptr circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr crs_factory_; + std::shared_ptr crs_factory_; std::vector recursive_proof_public_input_indices; bool contains_recursive_proof = false; bool computed_witness = false; TurboPlonkComposerHelper() - : TurboPlonkComposerHelper( - std::shared_ptr(new bonk::FileReferenceStringFactory("../srs_db/ignition"))) + : TurboPlonkComposerHelper(std::shared_ptr( + new proof_system::FileReferenceStringFactory("../srs_db/ignition"))) {} - TurboPlonkComposerHelper(std::shared_ptr crs_factory) + TurboPlonkComposerHelper(std::shared_ptr crs_factory) : crs_factory_(std::move(crs_factory)) {} - TurboPlonkComposerHelper(std::unique_ptr&& crs_factory) + TurboPlonkComposerHelper(std::unique_ptr&& crs_factory) : crs_factory_(std::move(crs_factory)) {} - TurboPlonkComposerHelper(std::shared_ptr p_key, std::shared_ptr v_key) + TurboPlonkComposerHelper(std::shared_ptr p_key, std::shared_ptr v_key) : circuit_proving_key(std::move(p_key)) , circuit_verification_key(std::move(v_key)) {} @@ -50,7 +51,7 @@ template class TurboPlonkComposerHelper { TurboProver create_prover(const CircuitConstructor& circuit_constructor); TurboVerifier create_verifier(const CircuitConstructor& circuit_constructor); - inline std::vector turbo_selector_properties() + inline std::vector turbo_selector_properties() { const std::vector result{ { "q_m", false }, { "q_c", false }, { "q_1", false }, { "q_2", false }, @@ -132,4 +133,4 @@ template class TurboPlonkComposerHelper { return output; } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp index 9049ed0e0be..26e7049443f 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp @@ -10,7 +10,7 @@ #include #include -namespace plonk { +namespace proof_system::plonk { /** * @brief Computes `this.witness`, which is basiclly a set of polynomials mapped-to by strings. @@ -228,11 +228,8 @@ std::shared_ptr UltraPlonkComposerHelper::compu const size_t num_randomized_gates = NUM_RANDOMIZED_GATES; // Initialize circuit_proving_key // TODO(#229)(Kesha): replace composer types. - circuit_proving_key = initialize_proving_key(circuit_constructor, - crs_factory_.get(), - minimum_circuit_size, - num_randomized_gates, - plonk::ComposerType::PLOOKUP); + circuit_proving_key = initialize_proving_key( + circuit_constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::PLOOKUP); construct_lagrange_selector_forms(circuit_constructor, circuit_proving_key.get()); @@ -240,8 +237,8 @@ std::shared_ptr UltraPlonkComposerHelper::compu compute_monomial_and_coset_selector_forms(circuit_proving_key.get(), ultra_selector_properties()); - bonk::compute_plonk_generalized_sigma_permutations(circuit_constructor, - circuit_proving_key.get()); + compute_plonk_generalized_sigma_permutations(circuit_constructor, + circuit_proving_key.get()); const size_t subgroup_size = circuit_proving_key->circuit_size; @@ -350,7 +347,7 @@ std::shared_ptr UltraPlonkComposerHelper::compu * @return Pointer to created circuit verification key. * */ template -std::shared_ptr UltraPlonkComposerHelper::compute_verification_key( +std::shared_ptr UltraPlonkComposerHelper::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -391,4 +388,4 @@ void UltraPlonkComposerHelper::add_table_column_selector_pol } template class UltraPlonkComposerHelper; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp index 45b218460d0..c66ce7eea0b 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp @@ -1,15 +1,16 @@ #pragma once #include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" #include #include -namespace plonk { +namespace proof_system::plonk { // TODO(Kesha): change initializations to specify this parameter // Cody: What does this mean? template class UltraPlonkComposerHelper { @@ -21,11 +22,11 @@ template class UltraPlonkComposerHelper { // simultaneously here and in the other split composers. static constexpr size_t NUM_RANDOMIZED_GATES = 4; // equal to the number of multilinear evaluations leaked static constexpr size_t program_width = CircuitConstructor::program_width; - std::shared_ptr circuit_proving_key; - std::shared_ptr circuit_verification_key; + std::shared_ptr circuit_proving_key; + std::shared_ptr circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr crs_factory_; + std::shared_ptr crs_factory_; std::vector recursive_proof_public_input_indices; bool contains_recursive_proof = false; @@ -52,7 +53,7 @@ template class UltraPlonkComposerHelper { UltraPlonkComposerHelper& operator=(UltraPlonkComposerHelper const& other) noexcept = default; ~UltraPlonkComposerHelper() = default; - std::vector ultra_selector_properties() + std::vector ultra_selector_properties() { // When reading and writing the proving key from a buffer we must precompute the Lagrange form of certain // selector polynomials. In order to avoid a new selector type and definitions in the polynomial manifest, we @@ -63,7 +64,7 @@ template class UltraPlonkComposerHelper { // { "q_m", true }, { "q_c", true }, { "q_1", true }, { "q_2", true }, // { "q_3", true }, { "q_4", false }, { "q_arith", false }, { "q_sort", false }, // { "q_elliptic", false }, { "q_aux", false }, { "table_type", true }, - std::vector result{ + std::vector result{ { "q_m", true }, { "q_c", true }, { "q_1", true }, { "q_2", true }, { "q_3", true }, { "q_4", true }, { "q_arith", true }, { "q_sort", true }, { "q_elliptic", true }, { "q_aux", true }, { "table_type", true }, @@ -75,8 +76,8 @@ template class UltraPlonkComposerHelper { void finalize_circuit(CircuitConstructor& circuit_constructor) { circuit_constructor.finalize_circuit(); }; - std::shared_ptr compute_proving_key(const CircuitConstructor& circuit_constructor); - std::shared_ptr compute_verification_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr compute_proving_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr compute_verification_key(const CircuitConstructor& circuit_constructor); void compute_witness(CircuitConstructor& circuit_constructor); @@ -208,4 +209,4 @@ template class UltraPlonkComposerHelper { } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp index 083ac264dc3..34e51f92de3 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp @@ -6,7 +6,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" -namespace plonk { +namespace proof_system::plonk { /** * @brief Standard Plonk Composer has everything required to construct a prover and verifier, just as the legacy * classes. @@ -16,7 +16,7 @@ namespace plonk { */ class StandardPlonkComposer { public: - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD; + static constexpr ComposerType type = ComposerType::STANDARD; static constexpr size_t UINT_LOG2_BASE = 2; // An instantiation of the circuit constructor that only depends on arithmetization, not on the proof system @@ -40,17 +40,17 @@ class StandardPlonkComposer { StandardPlonkComposer(std::string const& crs_path, const size_t size_hint = 0) : StandardPlonkComposer( - std::unique_ptr(new bonk::FileReferenceStringFactory(crs_path)), + std::unique_ptr(new proof_system::FileReferenceStringFactory(crs_path)), size_hint){}; - StandardPlonkComposer(std::shared_ptr const& crs_factory, const size_t size_hint = 0) + StandardPlonkComposer(std::shared_ptr const& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(crs_factory) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables) {} - StandardPlonkComposer(std::unique_ptr&& crs_factory, const size_t size_hint = 0) + StandardPlonkComposer(std::unique_ptr&& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(std::move(crs_factory)) , num_gates(circuit_constructor.num_gates) @@ -58,8 +58,8 @@ class StandardPlonkComposer { {} - StandardPlonkComposer(std::shared_ptr const& p_key, - std::shared_ptr const& v_key, + StandardPlonkComposer(std::shared_ptr const& p_key, + std::shared_ptr const& v_key, size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(p_key, v_key) @@ -162,12 +162,12 @@ class StandardPlonkComposer { /**Proof and verification-related methods*/ - std::shared_ptr compute_proving_key() + std::shared_ptr compute_proving_key() { return composer_helper.compute_proving_key(circuit_constructor); } - std::shared_ptr compute_verification_key() + std::shared_ptr compute_verification_key() { return composer_helper.compute_verification_key(circuit_constructor); } @@ -200,4 +200,4 @@ class StandardPlonkComposer { const std::string& err() const { return circuit_constructor.err(); }; void failure(std::string msg) { circuit_constructor.failure(msg); } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp index d371578b523..0ff53d40b0e 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp @@ -2,10 +2,10 @@ #include #include "barretenberg/crypto/pedersen/pedersen.hpp" #include "barretenberg/crypto/pedersen/generator_data.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -33,13 +33,13 @@ TEST(standard_plonk_composer_splitting_tmp, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer(pk_buf); - auto vk_data = from_buffer(vk_buf); + auto pk_data = from_buffer(pk_buf); + auto vk_data = from_buffer(vk_buf); - auto crs = std::make_unique("../srs_db/ignition"); + auto crs = std::make_unique("../srs_db/ignition"); auto proving_key = - std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); plonk::StandardPlonkComposer composer2 = plonk::StandardPlonkComposer(proving_key, verification_key); composer2.add_public_variable(a); diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp index 985e5529e21..6019662bb55 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp @@ -1,8 +1,8 @@ #pragma once #include "composer_helper/turbo_plonk_composer_helper.hpp" #include "barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp" -using namespace bonk; -namespace plonk { + +namespace proof_system::plonk { /** * @brief Standard Plonk Composer has everything required to construct a prover and verifier, just as the legacy * classes. @@ -12,7 +12,7 @@ namespace plonk { */ class TurboPlonkComposer { public: - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD; + static constexpr ComposerType type = ComposerType::STANDARD; static constexpr size_t UINT_LOG2_BASE = 2; @@ -39,23 +39,23 @@ class TurboPlonkComposer { TurboPlonkComposer(std::string const& crs_path, const size_t size_hint = 0) : TurboPlonkComposer( - std::unique_ptr(new bonk::FileReferenceStringFactory(crs_path)), + std::unique_ptr(new proof_system::FileReferenceStringFactory(crs_path)), size_hint){}; - TurboPlonkComposer(std::shared_ptr const& crs_factory, const size_t size_hint = 0) + TurboPlonkComposer(std::shared_ptr const& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(crs_factory) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables){}; - TurboPlonkComposer(std::unique_ptr&& crs_factory, const size_t size_hint = 0) + TurboPlonkComposer(std::unique_ptr&& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(std::move(crs_factory)) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables){}; - TurboPlonkComposer(std::shared_ptr const& p_key, - std::shared_ptr const& v_key, + TurboPlonkComposer(std::shared_ptr const& p_key, + std::shared_ptr const& v_key, size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(p_key, v_key) @@ -169,12 +169,12 @@ class TurboPlonkComposer { barretenberg::fr get_variable(const uint32_t index) const { return circuit_constructor.get_variable(index); } /**Proof and verification-related methods*/ - std::shared_ptr compute_proving_key() + std::shared_ptr compute_proving_key() { return composer_helper.compute_proving_key(circuit_constructor); } - std::shared_ptr compute_verification_key() + std::shared_ptr compute_verification_key() { return composer_helper.compute_verification_key(circuit_constructor); } @@ -205,4 +205,4 @@ class TurboPlonkComposer { const std::string& err() const { return circuit_constructor.err(); }; void failure(std::string msg) { circuit_constructor.failure(msg); } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp index 24ac9a02beb..007afa3e19c 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp @@ -1,15 +1,17 @@ #include "turbo_plonk_composer.hpp" #include "barretenberg/crypto/pedersen/pedersen.hpp" #include -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; using namespace crypto::pedersen; +namespace proof_system::plonk::test_turbo_plonk_composer { namespace { auto& engine = numeric::random::get_debug_engine(); } + TEST(turbo_plonk_composer_splitting_tmp, base_case) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -33,13 +35,13 @@ TEST(turbo_plonk_composer_splitting_tmp, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer(pk_buf); - auto vk_data = from_buffer(vk_buf); + auto pk_data = from_buffer(pk_buf); + auto vk_data = from_buffer(vk_buf); - auto crs = std::make_unique("../srs_db/ignition"); + auto crs = std::make_unique("../srs_db/ignition"); auto proving_key = - std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); TurboPlonkComposer composer2 = TurboPlonkComposer(proving_key, verification_key); composer2.add_public_variable(a); @@ -1151,3 +1153,4 @@ TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_xor) EXPECT_EQ(result, true); } +} // namespace proof_system::plonk::test_turbo_plonk_composer \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp index 4c448818ade..d66c99aa1d8 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp @@ -6,9 +6,7 @@ #include "barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp" #include -using namespace bonk; - -namespace plonk { +namespace proof_system::plonk { class UltraPlonkComposer { @@ -364,7 +362,7 @@ class UltraPlonkComposer { // std::array decompose_non_native_field_double_width_limb( // const uint32_t limb_idx, const size_t num_limb_bits = (2 * DEFAULT_NON_NATIVE_FIELD_LIMB_BITS)); std::array evaluate_non_native_field_multiplication( - const bonk::non_native_field_witnesses& input, const bool range_constrain_quotient_and_remainder = true) + const non_native_field_witnesses& input, const bool range_constrain_quotient_and_remainder = true) { return circuit_constructor.evaluate_non_native_field_multiplication(input, range_constrain_quotient_and_remainder); @@ -473,4 +471,4 @@ class UltraPlonkComposer { // std::vector recursive_proof_public_input_indices; // bool contains_recursive_proof = false; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp index 416cee213e5..d5c2128e059 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp @@ -9,9 +9,8 @@ #include "barretenberg/numeric/uintx/uintx.hpp" using namespace barretenberg; -using namespace bonk; -namespace plonk { +namespace proof_system::plonk { namespace { auto& engine = numeric::random::get_debug_engine(); @@ -780,7 +779,7 @@ TEST(ultra_plonk_composer_splitting_tmp, non_native_field_multiplication) const auto q_indices = get_limb_witness_indices(split_into_limbs(uint256_t(q))); const auto r_indices = get_limb_witness_indices(split_into_limbs(uint256_t(r))); - bonk::non_native_field_witnesses inputs{ + non_native_field_witnesses inputs{ a_indices, b_indices, q_indices, r_indices, modulus_limbs, fr(uint256_t(modulus)), }; const auto [lo_1_idx, hi_1_idx] = composer.evaluate_non_native_field_multiplication(inputs); @@ -914,4 +913,4 @@ TEST(ultra_plonk_composer_splitting_tmp, ram) EXPECT_EQ(result, true); } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp index dfa084e79fb..1158590acf1 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp @@ -9,9 +9,9 @@ #include using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { #define STANDARD_SELECTOR_REFS \ auto& q_m = selectors[StandardSelectors::QM]; \ auto& q_c = selectors[StandardSelectors::QC]; \ @@ -616,4 +616,4 @@ bool StandardComposer::check_circuit() } return true; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp index 0a7015767f5..f8ec6455339 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp @@ -3,8 +3,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -using namespace bonk; -namespace plonk { +namespace proof_system::plonk { enum StandardSelectors { QM, QC, Q1, Q2, Q3, NUM }; inline std::vector standard_selector_properties() @@ -230,4 +229,4 @@ class StandardComposer : public ComposerBase { bool check_circuit(); }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp index 632b40da09d..c4413ce080c 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp @@ -2,15 +2,15 @@ #include #include "barretenberg/crypto/pedersen/pedersen.hpp" #include "barretenberg/crypto/pedersen/generator_data.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; namespace { auto& engine = numeric::random::get_debug_engine(); } -namespace plonk { +namespace proof_system::plonk { TEST(standard_composer, base_case) { StandardComposer composer = StandardComposer(); @@ -34,13 +34,13 @@ TEST(standard_composer, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer(pk_buf); - auto vk_data = from_buffer(vk_buf); + auto pk_data = from_buffer(pk_buf); + auto vk_data = from_buffer(vk_buf); - auto crs = std::make_unique("../srs_db/ignition"); + auto crs = std::make_unique("../srs_db/ignition"); auto proving_key = - std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); StandardComposer composer2 = StandardComposer(proving_key, verification_key); composer2.add_public_variable(a); @@ -540,4 +540,4 @@ TEST(standard_composer, test_check_circuit_broken) bool result = composer.check_circuit(); EXPECT_EQ(result, false); } -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp index cf599e26b64..f3339cf1473 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp @@ -12,9 +12,9 @@ #include "barretenberg/srs/reference_string/file_reference_string.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { #define TURBO_SELECTOR_REFS \ auto& q_m = selectors[TurboSelectors::QM]; \ @@ -1039,4 +1039,4 @@ TurboVerifier TurboComposer::create_verifier() return output_state; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp index ab71116a852..5f4ffda9af1 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp @@ -1,9 +1,7 @@ #pragma once #include "composer_base.hpp" -using namespace bonk; - -namespace plonk { +namespace proof_system::plonk { class TurboComposer : public ComposerBase { public: static constexpr ComposerType type = ComposerType::TURBO; @@ -229,8 +227,8 @@ class CheckGetter { } }; -using TurboArithmeticChecker = plonk::widget::TurboArithmeticKernel; -using TurboRangeChecker = plonk::widget::TurboRangeKernel; -using TurboLogicChecker = plonk::widget::TurboLogicKernel; -using TurboFixedBaseChecker = plonk::widget::TurboFixedBaseKernel; -} // namespace plonk +using TurboArithmeticChecker = widget::TurboArithmeticKernel; +using TurboRangeChecker = widget::TurboRangeKernel; +using TurboLogicChecker = widget::TurboLogicKernel; +using TurboFixedBaseChecker = widget::TurboFixedBaseKernel; +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp index 2cbefaa1ae5..14b448db485 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp @@ -1,16 +1,16 @@ #include "turbo_composer.hpp" #include "barretenberg/crypto/pedersen/pedersen.hpp" #include -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; using namespace crypto::pedersen; namespace { auto& engine = numeric::random::get_debug_engine(); } -namespace plonk { +namespace proof_system::plonk { TEST(turbo_composer, base_case) { TurboComposer composer = TurboComposer(); @@ -34,13 +34,13 @@ TEST(turbo_composer, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer(pk_buf); - auto vk_data = from_buffer(vk_buf); + auto pk_data = from_buffer(pk_buf); + auto vk_data = from_buffer(vk_buf); - auto crs = std::make_unique("../srs_db/ignition"); + auto crs = std::make_unique("../srs_db/ignition"); auto proving_key = - std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared(std::move(vk_data), crs->get_verifier_crs()); TurboComposer composer2 = TurboComposer(proving_key, verification_key); composer2.add_public_variable(a); @@ -1152,4 +1152,4 @@ TEST(turbo_composer, test_check_circuit_xor) EXPECT_EQ(result, true); } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp index 0cb677d6b21..597b2ddea01 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp @@ -29,7 +29,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { #define ULTRA_SELECTOR_REFS \ auto& q_m = selectors[UltraSelectors::QM]; \ @@ -2828,4 +2828,4 @@ void UltraComposer::process_RAM_arrays(const size_t gate_offset_from_public_inpu process_RAM_array(i, gate_offset_from_public_inputs); } } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp index 769ec09a345..7fa42ed9397 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp @@ -3,9 +3,7 @@ #include "plookup_tables/plookup_tables.hpp" #include -using namespace bonk; - -namespace plonk { +namespace proof_system::plonk { class UltraComposer : public ComposerBase { @@ -690,4 +688,4 @@ class UltraComposer : public ComposerBase { return create_manifest(num_public_inputs); } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp index 51e0838b5f0..5b0f6b6ce89 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp @@ -8,9 +8,9 @@ #include "./plookup_tables/sha256.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace { auto& engine = numeric::random::get_debug_engine(); @@ -856,4 +856,4 @@ TEST(ultra_composer, ram) EXPECT_EQ(result, true); } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp index 0e3712b3ba6..8dc934984fb 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp @@ -7,7 +7,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { class CommitmentScheme { public: @@ -35,16 +35,16 @@ class CommitmentScheme { virtual void batch_open(const transcript::StandardTranscript& transcript, work_queue& queue, - std::shared_ptr input_key = nullptr) = 0; + std::shared_ptr input_key = nullptr) = 0; virtual void batch_verify(const transcript::StandardTranscript& transcript, std::map& kate_g1_elements, std::map& kate_fr_elements, - std::shared_ptr input_key = nullptr) = 0; + std::shared_ptr input_key = nullptr) = 0; virtual void add_opening_evaluations_to_transcript(transcript::StandardTranscript& trancript, - std::shared_ptr input_key = nullptr, + std::shared_ptr input_key = nullptr, bool in_lagrange_form = false) = 0; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp index 200e44a281c..933de8cd5de 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp @@ -15,7 +15,7 @@ #include "barretenberg/ecc/curves/bn254/pairing.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; TEST(commitment_scheme, kate_open) { @@ -36,9 +36,9 @@ TEST(commitment_scheme, kate_open) plonk::KateCommitmentScheme newKate; // std::shared_ptr crs_factory = (new FileReferenceStringFactory("../srs_db/ignition")); - auto file_crs = std::make_shared("../srs_db/ignition"); + auto file_crs = std::make_shared("../srs_db/ignition"); auto crs = file_crs->get_prover_crs(n); - auto circuit_proving_key = std::make_shared(n, 0, crs, plonk::STANDARD); + auto circuit_proving_key = std::make_shared(n, 0, crs, ComposerType::STANDARD); work_queue queue(circuit_proving_key.get(), &inp_tx); newKate.commit(&coeffs[0], "F_COMM", 0, queue); @@ -93,9 +93,9 @@ TEST(commitment_scheme, kate_batch_open) transcript::StandardTranscript inp_tx = transcript::StandardTranscript(transcript::Manifest()); plonk::KateCommitmentScheme newKate; - auto file_crs = std::make_shared("../srs_db/ignition"); + auto file_crs = std::make_shared("../srs_db/ignition"); auto crs = file_crs->get_prover_crs(n); - auto circuit_proving_key = std::make_shared(n, 0, crs, plonk::STANDARD); + auto circuit_proving_key = std::make_shared(n, 0, crs, ComposerType::STANDARD); work_queue queue(circuit_proving_key.get(), &inp_tx); // commit to individual polynomials diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp index 5465b68ac49..1992b97435c 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp @@ -2,7 +2,7 @@ #include "kate_commitment_scheme.hpp" #include "../../../polynomials/polynomial_arithmetic.hpp" -namespace plonk { +namespace proof_system::plonk { // Constructors for KateCommitmentScheme template @@ -133,7 +133,7 @@ void KateCommitmentScheme::generic_batch_open(const fr* src, template void KateCommitmentScheme::batch_open(const transcript::StandardTranscript& transcript, work_queue& queue, - std::shared_ptr input_key) + std::shared_ptr input_key) { /* Compute batch opening polynomials according to the Kate commitment scheme. @@ -233,7 +233,7 @@ template void KateCommitmentScheme::batch_verify(const transcript::StandardTranscript& transcript, std::map& kate_g1_elements, std::map& kate_fr_elements, - std::shared_ptr input_key) + std::shared_ptr input_key) { // Compute batch evaluation commitment [F]_1 // In this method, we accumulate scalars and corresponding group elements for the multi-scalar @@ -345,9 +345,8 @@ void KateCommitmentScheme::batch_verify(const transcript::StandardTran } template -void KateCommitmentScheme::add_opening_evaluations_to_transcript(transcript::StandardTranscript& transcript, - std::shared_ptr input_key, - bool in_lagrange_form) +void KateCommitmentScheme::add_opening_evaluations_to_transcript( + transcript::StandardTranscript& transcript, std::shared_ptr input_key, bool in_lagrange_form) { // In this function, we compute the evaluations of all polynomials in the polynomial manifest at the // evaluation challenge "zeta", as well as the needed evaluations at shifts. @@ -391,4 +390,4 @@ template class KateCommitmentScheme; template class KateCommitmentScheme; template class KateCommitmentScheme; template class KateCommitmentScheme; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp index 48f49a60554..653340dbdfc 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp @@ -1,7 +1,7 @@ #pragma once #include "commitment_scheme.hpp" -namespace plonk { +namespace proof_system::plonk { template class KateCommitmentScheme : public CommitmentScheme { public: @@ -24,15 +24,15 @@ template class KateCommitmentScheme : public CommitmentSchem void batch_open(const transcript::StandardTranscript& transcript, work_queue& queue, - std::shared_ptr input_key = nullptr) override; + std::shared_ptr input_key = nullptr) override; void batch_verify(const transcript::StandardTranscript& transcript, std::map& kate_g1_elements, std::map& kate_fr_elements, - std::shared_ptr input_key = nullptr) override; + std::shared_ptr input_key = nullptr) override; void add_opening_evaluations_to_transcript(transcript::StandardTranscript& transcript, - std::shared_ptr input_key = nullptr, + std::shared_ptr input_key = nullptr, bool in_lagrange_form = false) override; private: @@ -44,4 +44,4 @@ extern template class KateCommitmentScheme; extern template class KateCommitmentScheme; extern template class KateCommitmentScheme; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/constants.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/constants.hpp index f919f636cfe..debf064c8f7 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/constants.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/constants.hpp @@ -1,14 +1,7 @@ #pragma once #include - -namespace plonk { - -enum ComposerType { - STANDARD, - TURBO, - PLOOKUP, - STANDARD_HONK, // Todo(Arijit): We should replace STANDARD_HONK outside plonk or the namespace should be bonk -}; +#include "barretenberg/proof_system/types/composer_type.hpp" +namespace proof_system::plonk { // This variable sets the composer (TURBO or ULTRA) of the entire stdlib and rollup modules. // To switch to using a new composer, only changing this variable should activate the new composer @@ -29,4 +22,4 @@ enum MerkleHashType { static constexpr uint64_t NUM_LIMB_BITS_IN_FIELD_SIMULATION = 68; static constexpr uint32_t NUM_QUOTIENT_PARTS = 4; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp index 633c4562c19..6cd4d4c7af6 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp @@ -1,6 +1,7 @@ #include "prover.hpp" #include "barretenberg/env/data_store.hpp" #include "barretenberg/env/crs.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" #define WASM_EXPORT __attribute__((visibility("default"))) @@ -31,7 +32,7 @@ WASM_EXPORT void* test_async_func(size_t size, int val) } } /** - * @brief Simple wrapper for env_load_verifier_crs. + * @brief Simple wrapper for env_load_verifier_crs. * @return The CRS. */ WASM_EXPORT void* test_env_load_verifier_crs() @@ -39,7 +40,7 @@ WASM_EXPORT void* test_env_load_verifier_crs() return env_load_verifier_crs(); } /** - * @brief Simple wrapper for env_load_verifier_crs. + * @brief Simple wrapper for env_load_verifier_crs. * @param The number of points to load of the prover CRS. * @return The CRS. */ @@ -47,7 +48,8 @@ WASM_EXPORT void* test_env_load_prover_crs(size_t num_points) { return env_load_prover_crs(num_points); } -typedef std::conditional_t WasmProver; +typedef std::conditional_t + WasmProver; WASM_EXPORT void prover_process_queue(WasmProver* prover) { diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp index 2a7fe494abb..66cfdc74967 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp @@ -1,4 +1,5 @@ #include "prover.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" #define WASM_EXPORT __attribute__((visibility("default"))) @@ -7,7 +8,7 @@ using namespace barretenberg; extern "C" { // TODO(Cody): Removed "unrolled" here when the time comes, if it does. -typedef std::conditional_t +typedef std::conditional_t WasmUnrolledProver; WASM_EXPORT void unrolled_prover_process_queue(WasmUnrolledProver* prover) diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp index 12c5a3b1ea3..3c3647e7f0d 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp @@ -8,7 +8,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { /** * Create ProverBase from proving key, witness and manifest. @@ -468,7 +468,7 @@ template void ProverBase::execute_fourth_round() diff = std::chrono::duration_cast(end - start); std::cerr << "compute quotient commitment: " << diff.count() << "ms" << std::endl; #endif -} // namespace plonk +} // namespace proof_system::plonk template void ProverBase::execute_fifth_round() { @@ -640,4 +640,4 @@ template class ProverBase; template class ProverBase; template class ProverBase; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp index 50d303c81ad..d0476608e25 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp @@ -1,13 +1,13 @@ #pragma once -#include "../../../proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "../types/proof.hpp" #include "../types/program_settings.hpp" #include "../widgets/random_widgets/random_widget.hpp" #include "../../../proof_system/work_queue/work_queue.hpp" #include "../widgets/transition_widgets/transition_widget.hpp" #include "../commitment_scheme/commitment_scheme.hpp" -using namespace plonk; -namespace plonk { + +namespace proof_system::plonk { template class ProverBase { @@ -110,4 +110,4 @@ typedef ProverBase UltraProver; // TODO(Mike): maybe just return // TODO(Cody): Make this into an issue? typedef ProverBase UltraToStandardProver; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp index bdcbad74e5e..50a535f9464 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp @@ -65,7 +65,7 @@ sigma_3 = [39, 23, 4, 40, 41, 25, 33, 36, 37, 42, 43, 44, 45, 46, 47, 48] ``` */ using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace prover_helpers { @@ -112,8 +112,8 @@ plonk::Prover generate_test_data(const size_t n) // even indices = mul gates, odd incides = add gates - auto reference_string = std::make_shared(n + 1, "../srs_db/ignition"); - std::shared_ptr key = std::make_shared(n, 0, reference_string, plonk::STANDARD); + auto reference_string = std::make_shared(n + 1, "../srs_db/ignition"); + std::shared_ptr key = std::make_shared(n, 0, reference_string, ComposerType::STANDARD); polynomial w_l(n); polynomial w_r(n); diff --git a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.cpp similarity index 92% rename from barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.cpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.cpp index ad66e30fa0f..ea22d7f366d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.cpp @@ -2,7 +2,8 @@ #include "barretenberg/polynomials/polynomial_arithmetic.hpp" #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" -namespace bonk { + +namespace proof_system::plonk { // In all the constructors below, the pippenger_runtime_state takes (n + 1) as the input // as the degree of t_{high}(X) is (n + 1) for standard plonk. Refer to @@ -23,8 +24,8 @@ namespace bonk { * */ proving_key::proving_key(const size_t num_gates, const size_t num_inputs, - std::shared_ptr const& crs, - plonk::ComposerType type = plonk::STANDARD) // TODO(Cody): Don't use default for Honk + std::shared_ptr const& crs, + ComposerType type = ComposerType::STANDARD) // TODO(Cody): Don't use default for Honk : composer_type(type) , circuit_size(num_gates) , log_circuit_size(numeric::get_msb(num_gates)) @@ -44,7 +45,7 @@ proving_key::proving_key(const size_t num_gates, * @param data * @param crs */ -proving_key::proving_key(proving_key_data&& data, std::shared_ptr const& crs) +proving_key::proving_key(proving_key_data&& data, std::shared_ptr const& crs) : composer_type(data.composer_type) , circuit_size(data.circuit_size) , num_public_inputs(data.num_public_inputs) @@ -88,4 +89,4 @@ void proving_key::init() memset((void*)"ient_polynomial_parts[3][0], 0x00, sizeof(barretenberg::fr) * circuit_size); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp similarity index 92% rename from barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.hpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp index 7df19d2e644..f3198a5cbb2 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp @@ -7,10 +7,10 @@ #include "barretenberg/proof_system/polynomial_store/polynomial_store.hpp" #include "barretenberg/srs/reference_string/reference_string.hpp" #include "barretenberg/plonk/proof_system/constants.hpp" -#include "barretenberg/proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" #include -namespace bonk { +namespace proof_system::plonk { struct proving_key_data { uint32_t composer_type; @@ -36,7 +36,7 @@ struct proving_key { proving_key(const size_t num_gates, const size_t num_inputs, std::shared_ptr const& crs, - plonk::ComposerType type); + ComposerType type); proving_key(std::ostream& is, std::string const& crs_path); @@ -69,4 +69,4 @@ struct proving_key { static constexpr size_t min_thread_block = 4UL; }; -} // namespace bonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp similarity index 85% rename from barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.test.cpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp index fd4a0ff2cfa..c3d2969fbfc 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/proving_key.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp @@ -10,7 +10,7 @@ #endif using namespace barretenberg; -using namespace bonk; +using namespace proof_system; // Test proving key serialization/deserialization to/from buffer TEST(proving_key, proving_key_from_serialized_key) @@ -19,17 +19,17 @@ TEST(proving_key, proving_key_from_serialized_key) fr a = fr::one(); composer.add_public_variable(a); - bonk::proving_key& p_key = *composer.compute_proving_key(); + plonk::proving_key& p_key = *composer.compute_proving_key(); auto pk_buf = to_buffer(p_key); - auto pk_data = from_buffer(pk_buf); - auto crs = std::make_unique("../srs_db/ignition"); + auto pk_data = from_buffer(pk_buf); + auto crs = std::make_unique("../srs_db/ignition"); auto proving_key = - std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); // Loop over all pre-computed polys for the given composer type and ensure equality // between original proving key polynomial store and the polynomial store that was // serialized/deserialized from buffer - bonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); + plonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); bool all_polys_are_equal{ true }; for (size_t i = 0; i < precomputed_poly_list.size(); ++i) { std::string poly_id = precomputed_poly_list[i]; @@ -55,17 +55,17 @@ TEST(proving_key, proving_key_from_serialized_key_ultra) fr a = fr::one(); composer.add_public_variable(a); - bonk::proving_key& p_key = *composer.compute_proving_key(); + plonk::proving_key& p_key = *composer.compute_proving_key(); auto pk_buf = to_buffer(p_key); - auto pk_data = from_buffer(pk_buf); - auto crs = std::make_unique("../srs_db/ignition"); + auto pk_data = from_buffer(pk_buf); + auto crs = std::make_unique("../srs_db/ignition"); auto proving_key = - std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + std::make_shared(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); // Loop over all pre-computed polys for the given composer type and ensure equality // between original proving key polynomial store and the polynomial store that was // serialized/deserialized from buffer - bonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); + plonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); bool all_polys_are_equal{ true }; for (size_t i = 0; i < precomputed_poly_list.size(); ++i) { std::string poly_id = precomputed_poly_list[i]; @@ -115,7 +115,7 @@ TEST(proving_key, proving_key_from_mmaped_key) if (!os.good()) { std::cerr << "OS failed in composer_from_mmap_keys! \n"; } - bonk::proving_key& p_key = *composer.compute_proving_key(); + plonk::proving_key& p_key = *composer.compute_proving_key(); write_mmap(os, pk_dir, p_key); os.close(); @@ -125,14 +125,14 @@ TEST(proving_key, proving_key_from_mmaped_key) if (!pk_stream.good()) { std::cerr << "IS failed in composer_from_mmap_keys! \n"; } - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read_mmap(pk_stream, pk_dir, pk_data); pk_stream.close(); // Loop over all pre-computed polys for the given composer type and ensure equality // between original proving key polynomial store and the polynomial store that was // serialized/deserialized via mmap - bonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); + plonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); bool all_polys_are_equal{ true }; for (size_t i = 0; i < precomputed_poly_list.size(); ++i) { std::string poly_id = precomputed_poly_list[i]; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/serialize.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/serialize.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/proof_system/proving_key/serialize.hpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/serialize.hpp index 4248d0a5ccc..6bc7e79ed56 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/proving_key/serialize.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/serialize.hpp @@ -4,7 +4,7 @@ #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/common/serialize.hpp" -namespace bonk { +namespace proof_system::plonk { // Read the pre-computed polynomials template inline void read(B& any, proving_key_data& key) @@ -115,4 +115,4 @@ template inline void write_mmap(B& os, std::string const& path, pro write(os, key.memory_write_records); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp index a137bca18c9..13b9effd29f 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp @@ -2,7 +2,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include -namespace plonk { +namespace proof_system::plonk { template Field compute_public_input_delta(const std::vector& inputs, const Field& beta, diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp index 8730d41afe1..33e47a32e85 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp @@ -61,7 +61,7 @@ sigma_3 = [39, 23, 4, 40, 41, 25, 33, 36, 37, 42, 43, 44, 45, 46, 47, 48] ``` */ using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { @@ -138,7 +138,7 @@ TEST(test_public_inputs, compute_delta) for (size_t i = 0; i < num_public_inputs; ++i) { public_inputs.push_back(left[i]); } - fr target_delta = plonk::compute_public_input_delta(public_inputs, beta, gamma, domain.root); + fr target_delta = proof_system::plonk::compute_public_input_delta(public_inputs, beta, gamma, domain.root); EXPECT_EQ((modified_result == target_delta), true); } diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp index 5f14716eb69..cb28bca3c42 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp @@ -1,6 +1,6 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { /** * Public inputs! @@ -137,4 +137,4 @@ Field compute_public_input_delta(const std::vector& public_inputs, T0 = numerator / denominator; return T0; } -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp index b7269f79e54..e35951dc9b0 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp @@ -3,10 +3,10 @@ #include #include -namespace plonk { +namespace proof_system::plonk { struct commitment_open_proof { std::vector proof_data; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/proof_system/types/polynomial_manifest.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/proof_system/types/polynomial_manifest.hpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp index 4052d4ebff8..aefd348ff90 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/types/polynomial_manifest.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp @@ -4,9 +4,8 @@ #include #include #include "barretenberg/plonk/proof_system/constants.hpp" -// ToDo(Arijit): The below namespace should be plonk once all the honk related stuffs are moved out -// ToDo(Cody): This is now plonk-specific. -namespace bonk { + +namespace proof_system::plonk { enum PolynomialSource { WITNESS, SELECTOR, PERMUTATION, OTHER }; @@ -87,7 +86,7 @@ struct PolynomialDescriptor { std::string_view polynomial_label; bool requires_shifted_evaluation; PolynomialSource source; - bonk::PolynomialIndex index; + PolynomialIndex index; }; static constexpr size_t STANDARD_MANIFEST_SIZE = 12; @@ -176,19 +175,19 @@ class PolynomialManifest { PolynomialManifest(uint32_t composer_type) { switch (composer_type) { - case plonk::ComposerType::STANDARD: { + case ComposerType::STANDARD: { std::copy(standard_polynomial_manifest, standard_polynomial_manifest + STANDARD_MANIFEST_SIZE, std::back_inserter(manifest)); break; }; - case plonk::ComposerType::TURBO: { + case ComposerType::TURBO: { std::copy(turbo_polynomial_manifest, turbo_polynomial_manifest + TURBO_MANIFEST_SIZE, std::back_inserter(manifest)); break; }; - case plonk::ComposerType::PLOOKUP: { + case ComposerType::PLOOKUP: { std::copy(ultra_polynomial_manifest, ultra_polynomial_manifest + ULTRA_MANIFEST_SIZE, std::back_inserter(manifest)); @@ -236,7 +235,7 @@ class PrecomputedPolyList { precomputed_poly_ids.emplace_back(label); precomputed_poly_ids.emplace_back(label + "_fft"); // Store all lagrange forms of selector polynomials for ultra - if (composer_type == plonk::ComposerType::PLOOKUP) { + if (composer_type == ComposerType::PLOOKUP) { precomputed_poly_ids.emplace_back(label + "_lagrange"); } break; @@ -256,4 +255,4 @@ class PrecomputedPolyList { std::string operator[](size_t index) const { return precomputed_poly_ids[index]; } }; -} // namespace bonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp index 8e4b072c671..b4b9d5d7535 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp @@ -17,7 +17,7 @@ #include "../widgets/random_widgets/plookup_widget.hpp" #include "./prover_settings.hpp" -namespace plonk { +namespace proof_system::plonk { class standard_verifier_settings : public standard_settings { public: @@ -187,4 +187,4 @@ class ultra_to_standard_verifier_settings : public ultra_verifier_settings { static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp index eb0398d35a0..9d4713ccd6b 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp @@ -2,10 +2,10 @@ #include #include -namespace plonk { +namespace proof_system::plonk { struct proof { std::vector proof_data; }; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file 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 0862073254c..fd439df7660 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 @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/proof_system/arithmetization/arithmetization.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace plonk { +namespace proof_system::plonk { class settings_base { public: static constexpr bool requires_shifted_wire(const uint64_t wire_shift_settings, const uint64_t wire_index) @@ -57,4 +57,4 @@ class ultra_to_standard_settings : public ultra_settings { static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp index a85f9a6e3db..fbf08b9c102 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp @@ -3,7 +3,7 @@ #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace plonk { +namespace proof_system::plonk { template inline void compute_gen_permutation_lagrange_base_single(barretenberg::polynomial& output, const std::vector& permutation, @@ -63,4 +63,4 @@ inline void compute_gen_permutation_lagrange_base_single(barretenberg::polynomia } ITERATE_OVER_DOMAIN_END; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp index 91ee51d3b72..5fa5eeda390 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp @@ -2,7 +2,7 @@ #include -namespace plonk { +namespace proof_system::plonk { template Field compute_kate_batch_evaluation(typename Transcript::Key* key, const Transcript& transcript) @@ -146,4 +146,4 @@ inline void print_turbo_verification_key(verification_key* key) print_fr("permutation_non_residues[1]", 6); print_fr("permutation_non_residues[2]", 7); } -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp index d33cf98d467..24ae1810f0b 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp @@ -4,7 +4,7 @@ #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace plonk { +namespace proof_system::plonk { struct permutation_subgroup_element { uint32_t subgroup_index = 0; @@ -107,4 +107,4 @@ inline void compute_permutation_lagrange_base_single(barretenberg::polynomial& o } ITERATE_OVER_DOMAIN_END; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/sol_gen.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/sol_gen.hpp similarity index 92% rename from barretenberg/cpp/src/barretenberg/proof_system/verification_key/sol_gen.hpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/sol_gen.hpp index 29fd773f0b0..6342ea042f5 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/sol_gen.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/sol_gen.hpp @@ -1,11 +1,11 @@ -namespace bonk { +namespace proof_system { /** * Write a solidity file containing the vk params to the given stream. * Uses StandardPlonk **/ inline void output_vk_sol_standard(std::ostream& os, - std::shared_ptr const& key, + std::shared_ptr const& key, std::string const& class_name) { const auto print_u256 = [&](const std::string& offset, const barretenberg::fr& element, const std::string& name) { @@ -65,7 +65,7 @@ inline void output_vk_sol_standard(std::ostream& os, * Write a solidity file containing the vk params to the given stream. * Uses UltraPlonk **/ -inline void output_vk_sol_ultra(std::ostream& os, std::shared_ptr const& key, std::string const& class_name) +inline void output_vk_sol_ultra(std::ostream& os, std::shared_ptr const& key, std::string const& class_name) { const auto print_u256 = [&](const std::string& offset, const barretenberg::fr& element, const std::string& name) { os << " mstore(add(_vk, " << offset << "), " << element << ") // " << name << std::endl; @@ -141,26 +141,26 @@ inline void output_vk_sol_ultra(std::ostream& os, std::shared_ptr const& key, std::string const& class_name) +inline void output_vk_sol(std::ostream& os, std::shared_ptr const& key, std::string const& class_name) { - plonk::ComposerType composer_type = static_cast(key->composer_type); + ComposerType composer_type = static_cast(key->composer_type); switch (composer_type) { - case plonk::ComposerType::STANDARD: { + case ComposerType::STANDARD: { return output_vk_sol_standard(os, key, class_name); break; } - // case plonk::ComposerType::TURBO: { + // case ComposerType::TURBO: { // return output_vk_sol_turbo(os, key, class_name); // break; // } - case plonk::ComposerType::PLOOKUP: { + case ComposerType::PLOOKUP: { return output_vk_sol_ultra(os, key, class_name); break; } default: { - std::cerr << "bonk::output_vk_sol unsupported composer type. Defaulting to standard composer" << std::endl; + std::cerr << "proof_system::output_vk_sol unsupported composer type. Defaulting to standard composer" << std::endl; return output_vk_sol_standard(os, key, class_name); } } } -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.cpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.cpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.cpp index 3838656c8a6..ef6913f184d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.cpp @@ -1,8 +1,8 @@ #include "barretenberg/crypto/sha256/sha256.hpp" #include "verification_key.hpp" -#include "../../plonk/proof_system/constants.hpp" +#include "barretenberg/plonk/proof_system/constants.hpp" -namespace bonk { +namespace proof_system::plonk { verification_key::verification_key(const size_t num_gates, const size_t num_inputs, @@ -87,4 +87,4 @@ sha256::hash verification_key::sha256_hash() return sha256::sha256(to_buffer(vk_data)); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.hpp similarity index 95% rename from barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.hpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.hpp index 08b0f857516..3d1a31a67f9 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.hpp @@ -3,9 +3,9 @@ #include "barretenberg/srs/reference_string/reference_string.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/crypto/sha256/sha256.hpp" -#include "../../proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" -namespace bonk { +namespace proof_system::plonk { struct verification_key_data { uint32_t composer_type; @@ -91,4 +91,4 @@ template inline void write(B& buf, verification_key const& key) write(buf, key.recursive_proof_public_input_indices); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.test.cpp similarity index 80% rename from barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.test.cpp rename to barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.test.cpp index 8f74d875d64..bb049af0111 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/verification_key/verification_key.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.test.cpp @@ -3,12 +3,14 @@ #include "verification_key.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system::plonk; + +namespace proof_system::plonk::test_verification_key { TEST(verification_key, buffer_serialization) { verification_key_data key; - key.composer_type = static_cast(plonk::ComposerType::STANDARD); + key.composer_type = static_cast(ComposerType::STANDARD); key.circuit_size = 1234; key.num_public_inputs = 10; key.commitments["test1"] = g1::element::random_element(); @@ -25,7 +27,7 @@ TEST(verification_key, buffer_serialization) TEST(verification_key, stream_serialization) { verification_key_data key; - key.composer_type = static_cast(plonk::ComposerType::STANDARD); + key.composer_type = static_cast(ComposerType::STANDARD); key.circuit_size = 1234; key.num_public_inputs = 10; key.commitments["test1"] = g1::element::random_element(); @@ -41,3 +43,4 @@ TEST(verification_key, stream_serialization) EXPECT_EQ(key, result); } +} // namespace proof_system::plonk::test_verification_key \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp index 4986bec4607..2a4681df5fb 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp @@ -10,7 +10,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { template VerifierBase::VerifierBase(std::shared_ptr verifier_key, const transcript::Manifest& input_manifest) @@ -242,4 +242,4 @@ template class VerifierBase; template class VerifierBase; template class VerifierBase; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp index 32be98f1265..151117ba102 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp @@ -5,7 +5,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp" -namespace plonk { +namespace proof_system::plonk { template class VerifierBase { public: @@ -38,4 +38,4 @@ typedef VerifierBase TurboVerifier; typedef VerifierBase UltraVerifier; typedef VerifierBase UltraToStandardVerifier; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp index 79be2fab2ec..701a4651896 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp @@ -1,5 +1,5 @@ #include "../prover/prover.hpp" -#include "../../../proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "../utils/permutation.hpp" #include "../widgets/transition_widgets/arithmetic_widget.hpp" #include "../../../transcript/transcript.hpp" @@ -14,7 +14,7 @@ namespace verifier_helpers { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; plonk::Verifier generate_verifier(std::shared_ptr circuit_proving_key) { @@ -40,7 +40,7 @@ plonk::Verifier generate_verifier(std::shared_ptr circuit_proving_k state)); } - auto crs = std::make_shared("../srs_db/ignition"); + auto crs = std::make_shared("../srs_db/ignition"); std::shared_ptr circuit_verification_key = std::make_shared(circuit_proving_key->circuit_size, circuit_proving_key->num_public_inputs, @@ -76,8 +76,8 @@ plonk::Prover generate_test_data(const size_t n) // even indices = mul gates, odd incides = add gates - auto crs = std::make_shared(n + 1, "../srs_db/ignition"); - std::shared_ptr key = std::make_shared(n, 0, crs, plonk::STANDARD); + auto crs = std::make_shared(n + 1, "../srs_db/ignition"); + std::shared_ptr key = std::make_shared(n, 0, crs, ComposerType::STANDARD); polynomial w_l(n); polynomial w_r(n); diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp index 92606be5e41..98e58b0bade 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp @@ -1,7 +1,7 @@ #pragma once #include "random_widget.hpp" -namespace plonk { +namespace proof_system::plonk { template ProverPermutationWidget::ProverPermutationWidget( @@ -789,4 +789,4 @@ template class VerifierPermutationWidget; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp index 003f2927693..623f3a61937 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp @@ -1,7 +1,7 @@ #pragma once #include "random_widget.hpp" -namespace plonk { +namespace proof_system::plonk { template ProverPlookupWidget::ProverPlookupWidget(proving_key* input_key) @@ -734,7 +734,7 @@ Field VerifierPlookupWidget Field VerifierPlookupWidget:: @@ -751,4 +751,4 @@ template class VerifierPlookupWidget; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp index 56fb3ae1f9e..39829799ccb 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp @@ -9,7 +9,7 @@ class Transcript; } // TODO(Cody) Fix this namespace. -namespace bonk { +namespace proof_system::plonk { struct proving_key; @@ -53,4 +53,4 @@ class ProverRandomWidget { proving_key* key; }; -} // namespace bonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp index 7b403a58978..e21da0141eb 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -32,13 +32,12 @@ template class ArithmeticKe typedef containers::coefficient_array coefficient_array; public: - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_M, bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3 - }; + static const std::set required_polynomial_ids = { PolynomialIndex::Q_1, PolynomialIndex::Q_2, + PolynomialIndex::Q_3, PolynomialIndex::Q_M, + PolynomialIndex::Q_C, PolynomialIndex::W_1, + PolynomialIndex::W_2, PolynomialIndex::W_3 }; return required_polynomial_ids; } @@ -58,11 +57,11 @@ template class ArithmeticKe const size_t i = 0) { const Field& w_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); linear_terms[0] = w_1 * w_2; linear_terms[1] = w_1; @@ -94,15 +93,15 @@ template class ArithmeticKe { const Field& alpha = challenges.alpha_powers[0]; const Field& q_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_m = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_c = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); Field result = linear_terms[0] * q_m; result += (linear_terms[1] * q_1); @@ -155,4 +154,4 @@ using ProverArithmeticWidget = widget::TransitionWidget using VerifierArithmeticWidget = widget::GenericVerifierWidget; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp index 65e545a37bc..e628a855633 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -73,12 +73,11 @@ template class EllipticKern typedef containers::coefficient_array coefficient_array; public: - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_3, bonk::PolynomialIndex::Q_4, - bonk::PolynomialIndex::Q_ELLIPTIC, bonk::PolynomialIndex::W_1, bonk::PolynomialIndex::W_2, - bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_3, PolynomialIndex::Q_4, PolynomialIndex::Q_ELLIPTIC, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -97,27 +96,23 @@ template class EllipticKern const size_t i = 0) { const Field& x_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& y_1 = - Getters::template get_value(polynomials, i); - const Field& x_2 = - Getters::template get_value(polynomials, i); - const Field& y_2 = - Getters::template get_value(polynomials, i); - const Field& x_3 = - Getters::template get_value(polynomials, i); - const Field& y_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); + const Field& x_2 = Getters::template get_value(polynomials, i); + const Field& y_2 = Getters::template get_value(polynomials, i); + const Field& x_3 = Getters::template get_value(polynomials, i); + const Field& y_3 = Getters::template get_value(polynomials, i); // Endomorphism coefficient for when we add and multiply by beta at the same time const Field& q_beta = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); // Square of endomorphism coefficient const Field& q_beta_sqr = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); // sign const Field& q_sign = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); // TODO: Can this be implemented more efficiently? // It seems that Zac wanted to group the elements by selectors to use several linear terms initially, @@ -165,7 +160,7 @@ template class EllipticKern const size_t i = 0) { const Field& q_elliptic = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); return linear_terms[0] * q_elliptic; } @@ -193,4 +188,4 @@ using ProverEllipticWidget = widget::TransitionWidget using VerifierEllipticWidget = widget::GenericVerifierWidget; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp index d5b7e9c4ef3..8ee5d507b66 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -86,13 +86,12 @@ template class typedef containers::coefficient_array coefficient_array; public: - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_5, bonk::PolynomialIndex::Q_M, - PolynomialIndex::Q_C, PolynomialIndex::Q_FIXED_BASE, PolynomialIndex::W_1, - PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 + static const std::set required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_5, PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_FIXED_BASE, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -329,4 +328,4 @@ using VerifierTurboFixedBaseWidget = template using VerifierUltraFixedBaseWidget = widget::GenericVerifierWidget; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp index b7e7e3453a8..ee8afe2dc9c 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { template class GenPermSortKernel { @@ -18,11 +18,11 @@ template class GenPermSortK typedef containers::coefficient_array coefficient_array; public: - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_SORT, bonk::PolynomialIndex::W_1, bonk::PolynomialIndex::W_2, - bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4, bonk::PolynomialIndex::Z + static const std::set required_polynomial_ids = { + PolynomialIndex::Q_SORT, PolynomialIndex::W_1, PolynomialIndex::W_2, + PolynomialIndex::W_3, PolynomialIndex::W_4, PolynomialIndex::Z }; return required_polynomial_ids; } @@ -38,15 +38,15 @@ template class GenPermSortK const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_1_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); Field alpha_a = alpha_base; Field alpha_b = alpha_a * alpha; @@ -105,7 +105,7 @@ template class GenPermSortK const size_t i = 0) { const Field& q_sort = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); return linear_terms[0] * q_sort; } @@ -126,4 +126,4 @@ using ProverGenPermSortWidget = widget::TransitionWidget using VerifierGenPermSortWidget = widget::GenericVerifierWidget; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp index bf6458fb6ed..3a10bb97876 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -64,13 +64,12 @@ template class PlookupArith typedef containers::coefficient_array coefficient_array; public: - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_5, bonk::PolynomialIndex::Q_M, - bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::Q_ARITHMETIC, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_5, PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_ARITHMETIC, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -100,32 +99,31 @@ template class PlookupArith { // For subgroup element i, this term evaluates to W_4(i \omega) * 2 iff Q_ARITH(i \omega) = 2 const Field& q_arith = - Getters::template get_value(polynomials, - i); + Getters::template get_value(polynomials, i); const Field& w_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_1_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_m = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_c = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; @@ -207,4 +205,4 @@ template ; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp index 894ec072e18..093568b58a2 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -52,13 +52,12 @@ template class PlookupAuxil typedef containers::coefficient_array coefficient_array; public: - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_M, bonk::PolynomialIndex::Q_C, - bonk::PolynomialIndex::Q_ARITHMETIC, bonk::PolynomialIndex::Q_AUX, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_ARITHMETIC, PolynomialIndex::Q_AUX, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -78,43 +77,42 @@ template class PlookupAuxil constexpr barretenberg::fr SUBLIMB_SHIFT(uint256_t(1) << 14); const Field& w_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_1_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& eta = challenges.elements[ChallengeIndex::ETA]; const Field& q_aux = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_m = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_c = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_arith = - Getters::template get_value(polynomials, - i); + Getters::template get_value(polynomials, i); /** * Non native field arithmetic gate 2 @@ -350,4 +348,4 @@ template ; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp index 006ea63e456..5dc62aa2a96 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp @@ -7,10 +7,11 @@ #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "../../types/prover_settings.hpp" -#include "../../../../proof_system/proving_key/proving_key.hpp" -#include "../../../../proof_system/work_queue/work_queue.hpp" -using namespace bonk; -namespace plonk { +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/proof_system/work_queue/work_queue.hpp" + +using namespace proof_system; +namespace proof_system::plonk { namespace widget { enum ChallengeIndex { @@ -386,4 +387,4 @@ class GenericVerifierWidget { } }; } // namespace widget -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp index 39098e68acb..9daaba1f0c7 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -49,18 +49,16 @@ template class TurboArithme inline static bool gate_enabled(PolyContainer& polynomials, const size_t i = 0) { const Field& q_arith = - Getters::template get_value(polynomials, - i); + Getters::template get_value(polynomials, i); return !q_arith.is_zero(); } - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_5, bonk::PolynomialIndex::Q_M, - bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::Q_ARITHMETIC, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_5, PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_ARITHMETIC, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -87,17 +85,16 @@ template class TurboArithme constexpr barretenberg::fr minus_two(-2); const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_arith = - Getters::template get_value(polynomials, - i); + Getters::template get_value(polynomials, i); Field T0; Field T1; @@ -147,12 +144,11 @@ template class TurboArithme constexpr barretenberg::fr minus_seven(-7); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_arith = - Getters::template get_value(polynomials, - i); + Getters::template get_value(polynomials, i); const Field& alpha_base = challenges.alpha_powers[0]; Field T1; @@ -242,19 +238,19 @@ template class TurboArithme { const Field& alpha_base = challenges.alpha_powers[0]; const Field& q_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_5 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_m = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_c = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); Field result = linear_terms[0] * q_m; result += (linear_terms[1] * q_1); @@ -309,4 +305,4 @@ template ; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp index 239c548f515..95ade04896a 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { template class TurboLogicKernel { @@ -18,11 +18,11 @@ template class TurboLogicKe typedef containers::coefficient_array coefficient_array; public: - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { - bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::Q_LOGIC, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set required_polynomial_ids = { + PolynomialIndex::Q_C, PolynomialIndex::Q_LOGIC, PolynomialIndex::W_1, + PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -37,7 +37,7 @@ template class TurboLogicKe inline static bool gate_enabled(PolyContainer& polynomials, const size_t i = 0) { const Field& q_logic = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); return !q_logic.is_zero(); } @@ -53,22 +53,22 @@ template class TurboLogicKe const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_1_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& q_c = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); Field delta_sum; Field delta_squared_sum; @@ -212,7 +212,7 @@ template class TurboLogicKe const size_t i = 0) { const Field& q_logic = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); return linear_terms[0] * q_logic; } @@ -233,4 +233,4 @@ using ProverTurboLogicWidget = widget::TransitionWidget using VerifierTurboLogicWidget = widget::GenericVerifierWidget; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp index afb7e0f5745..ffa9852c116 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /* @@ -85,17 +85,17 @@ template class TurboRangeKe inline static bool gate_enabled(PolyContainer& polynomials, const size_t i = 0) { const Field& q_range = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); return !q_range.is_zero(); } - inline static std::set const& get_required_polynomial_ids() + inline static std::set const& get_required_polynomial_ids() { - static const std::set required_polynomial_ids = { bonk::PolynomialIndex::Q_RANGE, - bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, - bonk::PolynomialIndex::W_3, - bonk::PolynomialIndex::W_4 }; + static const std::set required_polynomial_ids = { PolynomialIndex::Q_RANGE, + PolynomialIndex::W_1, + PolynomialIndex::W_2, + PolynomialIndex::W_3, + PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -110,15 +110,15 @@ template class TurboRangeKe const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_2 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_3 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4 = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); const Field& w_4_omega = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); Field alpha_a = alpha_base; Field alpha_b = alpha_a * alpha; @@ -188,7 +188,7 @@ template class TurboRangeKe const size_t i = 0) { const Field& q_range = - Getters::template get_value(polynomials, i); + Getters::template get_value(polynomials, i); return linear_terms[0] * q_range; } @@ -209,4 +209,4 @@ using ProverTurboRangeWidget = widget::TransitionWidget using VerifierTurboRangeWidget = widget::GenericVerifierWidget; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/proof_system/CMakeLists.txt index 99041b45c2c..3cb26213345 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/proof_system/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(proof_system plonk) \ No newline at end of file +barretenberg_module(proof_system polynomials crypto_pedersen) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp b/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp index f62a1219609..5175867bfd2 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp @@ -3,7 +3,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/common/serialize.hpp" -namespace bonk { +namespace proof_system { struct add_triple { uint32_t a; uint32_t b; @@ -121,4 +121,4 @@ struct ecc_add_gate { barretenberg::fr endomorphism_coefficient; barretenberg::fr sign_coefficient; }; -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp index ee2cbb9fffa..2f1f190805a 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp @@ -1,6 +1,6 @@ #include "circuit_constructor_base.hpp" -namespace bonk { +namespace proof_system { /** * Join variable class b to variable class a. @@ -43,4 +43,4 @@ void CircuitConstructorBase::assert_equal(const uint32_t a_vari // Standard honk/ plonk instantiation template class CircuitConstructorBase; template class CircuitConstructorBase; -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp index 619d8fbffdd..325349708d0 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp @@ -4,7 +4,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include -namespace bonk { +namespace proof_system { static constexpr uint32_t DUMMY_TAG = 0; template class CircuitConstructorBase { @@ -236,7 +236,7 @@ template class CircuitConstructorBase { } }; -} // namespace bonk +} // namespace proof_system // TODO(#217)(Cody): This will need updating based on the approach we take to ensure no multivariate is zero. /** diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp index 79600647000..61c6ed8de5a 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace bonk { +namespace proof_system { /** * Create an addition gate. @@ -496,4 +496,4 @@ bool StandardCircuitConstructor::check_circuit() } return true; } -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp index b1e03f89b3b..b627b17a9b9 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp @@ -1,10 +1,10 @@ #pragma once #include #include "circuit_constructor_base.hpp" -#include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" -namespace bonk { +namespace proof_system { inline std::vector standard_selector_names() { std::vector result{ "q_m", "q_1", "q_2", "q_3", "q_c" }; @@ -23,7 +23,7 @@ class StandardCircuitConstructor : public CircuitConstructorBase& q_3 = std::get<3>(selectors); std::vector& q_c = std::get<4>(selectors); - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD_HONK; // TODO(Cody): Get rid of this. + static constexpr ComposerType type = ComposerType::STANDARD_HONK; // TODO(Cody): Get rid of this. static constexpr size_t UINT_LOG2_BASE = 2; // These are variables that we have used a gate on, to enforce that they are @@ -101,4 +101,4 @@ class StandardCircuitConstructor : public CircuitConstructorBase #include "circuit_constructor_base.hpp" -#include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" -namespace bonk { +namespace proof_system { inline std::vector turbo_selector_names() { @@ -32,7 +32,7 @@ class TurboCircuitConstructor : public CircuitConstructorBase& q_range = std::get<9>(selectors); std::vector& q_logic = std::get<10>(selectors); - static constexpr plonk::ComposerType type = plonk::ComposerType::TURBO; + static constexpr ComposerType type = ComposerType::TURBO; static constexpr size_t UINT_LOG2_BASE = 2; TurboCircuitConstructor(const size_t size_hint = 0); @@ -114,4 +114,4 @@ class TurboCircuitConstructor : public CircuitConstructorBase constant_variable_indices; }; -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp index 3be6bbea1ee..1efacb4622f 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp @@ -8,7 +8,7 @@ using namespace crypto::pedersen; namespace { auto& engine = numeric::random::get_debug_engine(); } -namespace bonk { +namespace proof_system { TEST(turbo_circuit_constructor, base_case) { TurboCircuitConstructor circuit_constructor = TurboCircuitConstructor(); @@ -687,4 +687,4 @@ TEST(turbo_circuit_constructor, big_add_gate_with_bit_extract) EXPECT_EQ(result, true); } -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp index c26a3380f5b..d606ab173df 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace bonk { +namespace proof_system { void UltraCircuitConstructor::finalize_circuit() { @@ -2321,4 +2321,4 @@ void UltraCircuitConstructor::process_RAM_arrays(const size_t gate_offset_from_p } } -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp index fe9d23830fd..65f73f724d5 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp @@ -1,6 +1,6 @@ #pragma once #include "barretenberg/proof_system/arithmetization/arithmetization.hpp" -#include "barretenberg/proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" #include "circuit_constructor_base.hpp" #include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" @@ -10,9 +10,9 @@ #include "barretenberg/plonk/proof_system/types/prover_settings.hpp" #include -namespace bonk { +namespace proof_system { -static constexpr plonk::ComposerType type = plonk::ComposerType::PLOOKUP; +static constexpr ComposerType type = ComposerType::PLOOKUP; static constexpr plonk::MerkleHashType merkle_hash_type = plonk::MerkleHashType::LOOKUP_PEDERSEN; static constexpr size_t NUM_RESERVED_GATES = 4; // This must be >= num_roots_cut_out_of_vanishing_polynomial // See the comment in plonk/proof_system/prover/prover.cpp @@ -167,7 +167,7 @@ class UltraCircuitConstructor : public CircuitConstructorBase - */ -template -std::shared_ptr initialize_proving_key(const CircuitConstructor& circuit_constructor, - bonk::ReferenceStringFactory* crs_factory, - const size_t minimum_circuit_size, - const size_t num_randomized_gates, - plonk::ComposerType composer_type) -{ - const size_t num_gates = circuit_constructor.num_gates; - std::span public_inputs = circuit_constructor.public_inputs; - - const size_t num_public_inputs = public_inputs.size(); - const size_t num_constraints = num_gates + num_public_inputs; - const size_t total_num_constraints = std::max(minimum_circuit_size, num_constraints); - const size_t subgroup_size = - circuit_constructor.get_circuit_subgroup_size(total_num_constraints + num_randomized_gates); // next power of 2 - - auto crs = crs_factory->get_prover_crs(subgroup_size + 1); - - return std::make_shared(subgroup_size, num_public_inputs, crs, composer_type); -} - -/** - * @brief Construct lagrange selector polynomials from ciruit selector information and put into polynomial cache - * - * @tparam CircuitConstructor The class holding the circuit - * @param circuit_constructor The object holding the circuit - * @param key Pointer to the proving key - */ -template -void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constructor, - bonk::proving_key* circuit_proving_key) -{ - const size_t num_public_inputs = circuit_constructor.public_inputs.size(); - for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { - std::span selector_values = circuit_constructor.selectors[j]; - ASSERT(circuit_proving_key->circuit_size >= selector_values.size()); - - // Compute selector vector, initialized to 0. - // Copy the selector values for all gates, keeping the rows at which we store public inputs as 0. - // Initializing the polynomials in this way automatically applies 0-padding to the selectors. - barretenberg::polynomial selector_poly_lagrange(circuit_proving_key->circuit_size); - for (size_t i = 0; i < selector_values.size(); ++i) { - selector_poly_lagrange[num_public_inputs + i] = selector_values[i]; - } - // TODO(#217)(Adrian): We may want to add a unique value (e.g. j+1) in the last position of each selector - // polynomial to guard against some edge cases that may occur during the MSM. If we do so, we should ensure that - // this does not clash with any other values we want to place at the end of of the witness vectors. In later - // iterations of the Sumcheck, we will be able to efficiently cancel out any checks in the last 2^k rows, so any - // randomness or unique values should be placed there. - circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", - std::move(selector_poly_lagrange)); - } -} - -/** - * @brief Fill the last index of each selector polynomial in lagrange form with a non-zero value - * - * @tparam CircuitConstructor The class holding the circuit - * @param circuit_constructor The object holding the circuit - * @param key Pointer to the proving key - */ -template -void enforce_nonzero_polynomial_selectors(const CircuitConstructor& circuit_constructor, - bonk::proving_key* circuit_proving_key) -{ - for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { - auto current_selector = - circuit_proving_key->polynomial_store.get(circuit_constructor.selector_names_[j] + "_lagrange"); - current_selector[current_selector.size() - 1] = j + 1; - circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", - std::move(current_selector)); - } -} - -/** - * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into - * cache - * - * @param key Pointer to the proving key - * @param selector_properties Names of selectors - */ -void compute_monomial_and_coset_selector_forms(bonk::proving_key* circuit_proving_key, - std::vector selector_properties) -{ - for (size_t i = 0; i < selector_properties.size(); i++) { - // Compute monomial form of selector polynomial - auto& selector_poly_lagrange = - circuit_proving_key->polynomial_store.get(selector_properties[i].name + "_lagrange"); - barretenberg::polynomial selector_poly(circuit_proving_key->circuit_size); - barretenberg::polynomial_arithmetic::ifft( - &selector_poly_lagrange[0], &selector_poly[0], circuit_proving_key->small_domain); - - // Compute coset FFT of selector polynomial - barretenberg::polynomial selector_poly_fft(selector_poly, circuit_proving_key->circuit_size * 4 + 4); - selector_poly_fft.coset_fft(circuit_proving_key->large_domain); - - // TODO(luke): For Standard/Turbo, the lagrange polynomials can be removed from the store at this point but this - // is not the case for Ultra. Implement? - circuit_proving_key->polynomial_store.put(selector_properties[i].name, std::move(selector_poly)); - circuit_proving_key->polynomial_store.put(selector_properties[i].name + "_fft", std::move(selector_poly_fft)); - } -} - -/** - * Compute witness polynomials (w_1, w_2, w_3, w_4) and put them into polynomial cache - * - * @details Fills 3 or 4 witness polynomials w_1, w_2, w_3, w_4 with the values of in-circuit variables. The beginning - * of w_1, w_2 polynomials is filled with public_input values. - * @return Witness with computed witness polynomials. - * - * @tparam Program settings needed to establish if w_4 is being used. - * */ -template -std::vector compute_witness_base(const CircuitConstructor& circuit_constructor, - const size_t minimum_circuit_size, - const size_t number_of_randomized_gates) -{ - const size_t program_width = CircuitConstructor::program_width; - const size_t num_gates = circuit_constructor.num_gates; - std::span public_inputs = circuit_constructor.public_inputs; - const size_t num_public_inputs = public_inputs.size(); - - const size_t num_constraints = std::max(minimum_circuit_size, num_gates + num_public_inputs); - // TODO(#216)(Adrian): Not a fan of specifying NUM_RANDOMIZED_GATES everywhere, - // Each flavor of Honk should have a "fixed" number of random places to add randomness to. - // It should be taken care of in as few places possible. - const size_t subgroup_size = - circuit_constructor.get_circuit_subgroup_size(num_constraints + number_of_randomized_gates); - - // construct a view over all the wire's variable indices - // w[j][i] is the index of the variable in the j-th wire, at gate i - // Each array should be of size `num_gates` - std::array, program_width> w; - w[0] = circuit_constructor.w_l; - w[1] = circuit_constructor.w_r; - w[2] = circuit_constructor.w_o; - if constexpr (program_width > 3) { - w[3] = circuit_constructor.w_4; - } - std::vector wires; - // Note: randomness is added to 3 of the last 4 positions in plonk/proof_system/prover/prover.cpp - // StandardProverBase::execute_preamble_round(). - for (size_t j = 0; j < program_width; ++j) { - // Initialize the polynomial with all the actual copies variable values - // Expect all values to be set to 0 initially - barretenberg::polynomial w_lagrange(subgroup_size); - - // Place all public inputs at the start of w_l and w_r. - // All selectors at these indices are set to 0 so these values are not constrained at all. - if ((j == 0) || (j == 1)) { - for (size_t i = 0; i < num_public_inputs; ++i) { - w_lagrange[i] = circuit_constructor.get_variable(public_inputs[i]); - } - } - - // Assign the variable values (which are pointed-to by the `w_` wires) to the wire witness polynomials - // `poly_w_`, shifted to make room for the public inputs at the beginning. - for (size_t i = 0; i < num_gates; ++i) { - w_lagrange[num_public_inputs + i] = circuit_constructor.get_variable(w[j][i]); - } - wires.push_back(std::move(w_lagrange)); - } - return wires; -} - -/** - * @brief Computes the verification key by computing the: - * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, - * (2) sets the polynomial manifest using the data from proving key. - */ -std::shared_ptr compute_verification_key_common( - std::shared_ptr const& proving_key, std::shared_ptr const& vrs) -{ - auto circuit_verification_key = std::make_shared( - proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->composer_type); - // TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc - auto commitment_key = honk::pcs::kzg::CommitmentKey(proving_key->circuit_size, "../srs_db/ignition"); - - for (size_t i = 0; i < proving_key->polynomial_manifest.size(); ++i) { - const auto& poly_info = proving_key->polynomial_manifest[i]; - - const std::string poly_label(poly_info.polynomial_label); - const std::string selector_commitment_label(poly_info.commitment_label); - - if (poly_info.source == bonk::PolynomialSource::SELECTOR || - poly_info.source == bonk::PolynomialSource::PERMUTATION || - poly_info.source == bonk::PolynomialSource::OTHER) { - // Fetch the polynomial in its vector form. - - // Commit to the constraint selector polynomial and insert the commitment in the verification key. - - auto poly_commitment = commitment_key.commit(proving_key->polynomial_store.get(poly_label)); - circuit_verification_key->commitments.insert({ selector_commitment_label, poly_commitment }); - } - } - - // Set the polynomial manifest in verification key. - circuit_verification_key->polynomial_manifest = bonk::PolynomialManifest(proving_key->composer_type); - - return circuit_verification_key; -} -// Ensure we compile all versions so that there are no issues during linkage -#define COMPILE_FOR_CIRCUIT_CONSTRUCTOR(circuit_constructor) \ - template std::shared_ptr initialize_proving_key( \ - const circuit_constructor&, bonk::ReferenceStringFactory*, const size_t, const size_t, plonk::ComposerType); \ - template void construct_lagrange_selector_forms(const circuit_constructor&, \ - bonk::proving_key*); \ - template std::vector compute_witness_base( \ - const circuit_constructor&, const size_t, const size_t); \ - template void enforce_nonzero_polynomial_selectors(const circuit_constructor& constructor, \ - bonk::proving_key* circuit_proving_key); - -COMPILE_FOR_CIRCUIT_CONSTRUCTOR(StandardCircuitConstructor) -COMPILE_FOR_CIRCUIT_CONSTRUCTOR(TurboCircuitConstructor) -COMPILE_FOR_CIRCUIT_CONSTRUCTOR(UltraCircuitConstructor) - -} // namespace bonk diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp index 7387270fb59..c31dfe13b98 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp @@ -1,13 +1,8 @@ #pragma once -#include "barretenberg/proof_system/proving_key/proving_key.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" -#include "barretenberg/polynomials/polynomial_arithmetic.hpp" -#include "barretenberg/polynomials/polynomial.hpp" -namespace bonk { -struct SelectorProperties { - std::string name; - bool requires_lagrange_base_polynomial = false; // does the prover need the raw lagrange-base selector values? -}; +#include +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" + +namespace proof_system { /** * @brief Initialize proving key and load the crs @@ -17,24 +12,61 @@ struct SelectorProperties { * @param minimum_circuit_size The minimum size of polynomials without randomized elements * @param num_randomized_gates Number of gates with randomized witnesses * @param composer_type The type of composer we are using - * @return std::shared_ptr + * @return std::shared_ptr */ template -std::shared_ptr initialize_proving_key(const CircuitConstructor& circuit_constructor, - bonk::ReferenceStringFactory* crs_factory, - const size_t minimum_circuit_size, - const size_t num_randomized_gates, - plonk::ComposerType composer_type); +std::shared_ptr initialize_proving_key(const CircuitConstructor& circuit_constructor, + ReferenceStringFactory* crs_factory, + const size_t minimum_circuit_size, + const size_t num_randomized_gates, + ComposerType composer_type) +{ + const size_t num_gates = circuit_constructor.num_gates; + std::span public_inputs = circuit_constructor.public_inputs; + + const size_t num_public_inputs = public_inputs.size(); + const size_t num_constraints = num_gates + num_public_inputs; + const size_t total_num_constraints = std::max(minimum_circuit_size, num_constraints); + const size_t subgroup_size = + circuit_constructor.get_circuit_subgroup_size(total_num_constraints + num_randomized_gates); // next power of 2 + + auto crs = crs_factory->get_prover_crs(subgroup_size + 1); + + return std::make_shared(subgroup_size, num_public_inputs, crs, composer_type); +} /** - * @brief Construct lagrange selector polynomials from circuit selector information and put into polynomial cache + * @brief Construct lagrange selector polynomials from ciruit selector information and put into polynomial cache * * @tparam CircuitConstructor The class holding the circuit * @param circuit_constructor The object holding the circuit * @param key Pointer to the proving key */ template -void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constructor, bonk::proving_key* key); +void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constructor, + plonk::proving_key* circuit_proving_key) +{ + const size_t num_public_inputs = circuit_constructor.public_inputs.size(); + for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { + std::span selector_values = circuit_constructor.selectors[j]; + ASSERT(circuit_proving_key->circuit_size >= selector_values.size()); + + // Compute selector vector, initialized to 0. + // Copy the selector values for all gates, keeping the rows at which we store public inputs as 0. + // Initializing the polynomials in this way automatically applies 0-padding to the selectors. + barretenberg::polynomial selector_poly_lagrange(circuit_proving_key->circuit_size); + for (size_t i = 0; i < selector_values.size(); ++i) { + selector_poly_lagrange[num_public_inputs + i] = selector_values[i]; + } + // TODO(#217)(Adrian): We may want to add a unique value (e.g. j+1) in the last position of each selector + // polynomial to guard against some edge cases that may occur during the MSM. If we do so, we should ensure that + // this does not clash with any other values we want to place at the end of of the witness vectors. In later + // iterations of the Sumcheck, we will be able to efficiently cancel out any checks in the last 2^k rows, so any + // randomness or unique values should be placed there. + circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", + std::move(selector_poly_lagrange)); + } +} /** * @brief Fill the last index of each selector polynomial in lagrange form with a non-zero value @@ -44,17 +76,17 @@ void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constru * @param key Pointer to the proving key */ template -void enforce_nonzero_polynomial_selectors(const CircuitConstructor& circuit_constructor, bonk::proving_key* key); - -/** - * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into - * cache - * - * @param key Pointer to the proving key - * @param selector_properties Names of selectors - */ -void compute_monomial_and_coset_selector_forms(bonk::proving_key* key, - std::vector selector_properties); +void enforce_nonzero_polynomial_selectors(const CircuitConstructor& circuit_constructor, + plonk::proving_key* circuit_proving_key) +{ + for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { + auto current_selector = + circuit_proving_key->polynomial_store.get(circuit_constructor.selector_names_[j] + "_lagrange"); + current_selector[current_selector.size() - 1] = j + 1; + circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", + std::move(current_selector)); + } +} /** * Compute witness polynomials (w_1, w_2, w_3, w_4) and put them into polynomial cache @@ -68,14 +100,53 @@ void compute_monomial_and_coset_selector_forms(bonk::proving_key* key, template std::vector compute_witness_base(const CircuitConstructor& circuit_constructor, const size_t minimum_circuit_size, - const size_t number_of_randomized_gates); + const size_t number_of_randomized_gates) +{ + const size_t program_width = CircuitConstructor::program_width; + const size_t num_gates = circuit_constructor.num_gates; + std::span public_inputs = circuit_constructor.public_inputs; + const size_t num_public_inputs = public_inputs.size(); -/** - * @brief Computes the verification key by computing the: - * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, - * (2) sets the polynomial manifest using the data from proving key. - */ -std::shared_ptr compute_verification_key_common( - std::shared_ptr const& proving_key, std::shared_ptr const& vrs); + const size_t num_constraints = std::max(minimum_circuit_size, num_gates + num_public_inputs); + // TODO(#216)(Adrian): Not a fan of specifying NUM_RANDOMIZED_GATES everywhere, + // Each flavor of Honk should have a "fixed" number of random places to add randomness to. + // It should be taken care of in as few places possible. + const size_t subgroup_size = + circuit_constructor.get_circuit_subgroup_size(num_constraints + number_of_randomized_gates); + + // construct a view over all the wire's variable indices + // w[j][i] is the index of the variable in the j-th wire, at gate i + // Each array should be of size `num_gates` + std::array, program_width> w; + w[0] = circuit_constructor.w_l; + w[1] = circuit_constructor.w_r; + w[2] = circuit_constructor.w_o; + if constexpr (program_width > 3) { + w[3] = circuit_constructor.w_4; + } + std::vector wires; + // Note: randomness is added to 3 of the last 4 positions in plonk/proof_system/prover/prover.cpp + // StandardProverBase::execute_preamble_round(). + for (size_t j = 0; j < program_width; ++j) { + // Initialize the polynomial with all the actual copies variable values + // Expect all values to be set to 0 initially + barretenberg::polynomial w_lagrange(subgroup_size); + + // Place all public inputs at the start of w_l and w_r. + // All selectors at these indices are set to 0 so these values are not constrained at all. + if ((j == 0) || (j == 1)) { + for (size_t i = 0; i < num_public_inputs; ++i) { + w_lagrange[i] = circuit_constructor.get_variable(public_inputs[i]); + } + } -} // namespace bonk + // Assign the variable values (which are pointed-to by the `w_` wires) to the wire witness polynomials + // `poly_w_`, shifted to make room for the public inputs at the beginning. + for (size_t i = 0; i < num_gates; ++i) { + w_lagrange[num_public_inputs + i] = circuit_constructor.get_variable(w[j][i]); + } + wires.push_back(std::move(w_lagrange)); + } + return wires; +} +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp index d9baedaef47..793204ea11b 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp @@ -10,7 +10,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include #include @@ -21,7 +21,7 @@ #include #include -namespace bonk { +namespace proof_system { /** * @brief cycle_node represents the index of a value of the circuit. @@ -131,8 +131,8 @@ std::vector compute_wire_copy_cycles(const CircuitConstructor * @param key Pointer to the proving key */ template -std::array, program_width> compute_basic_bonk_sigma_permutations( - const CircuitConstructor& circuit_constructor, bonk::proving_key* key) +std::array, program_width> compute_basic_proof_system_sigma_permutations( + const CircuitConstructor& circuit_constructor, plonk::proving_key* key) { // Compute wire copy cycles (cycles of permutations) auto wire_copy_cycles = compute_wire_copy_cycles(circuit_constructor); @@ -192,7 +192,7 @@ std::array, program_width> compute_bas */ template void compute_honk_style_sigma_lagrange_polynomials_from_mapping( - std::array, program_width>& sigma_mappings, bonk::proving_key* key) + std::array, program_width>& sigma_mappings, plonk::proving_key* key) { const size_t num_gates = key->circuit_size; @@ -317,7 +317,7 @@ template void compute_plonk_permutation_lagrange_polynomials_from_mapping( std::string label, std::array, program_width>& mappings, - bonk::proving_key* key) + plonk::proving_key* key) { for (size_t i = 0; i < program_width; i++) { std::string index = std::to_string(i + 1); @@ -337,7 +337,7 @@ void compute_plonk_permutation_lagrange_polynomials_from_mapping( * @param key Pointer to the proving key */ template -void compute_monomial_and_coset_fft_polynomials_from_lagrange(std::string label, bonk::proving_key* key) +void compute_monomial_and_coset_fft_polynomials_from_lagrange(std::string label, plonk::proving_key* key) { for (size_t i = 0; i < program_width; ++i) { std::string index = std::to_string(i + 1); @@ -400,10 +400,10 @@ void compute_standard_honk_id_polynomials(auto key) // proving_key* and shared_p */ // TODO(#293): Update this (and all similar functions) to take a smart pointer. template -void compute_standard_honk_sigma_permutations(CircuitConstructor& circuit_constructor, bonk::proving_key* key) +void compute_standard_honk_sigma_permutations(CircuitConstructor& circuit_constructor, plonk::proving_key* key) { // Compute the permutation table specifying which element becomes which - auto sigma_mappings = compute_basic_bonk_sigma_permutations(circuit_constructor, key); + auto sigma_mappings = compute_basic_proof_system_sigma_permutations(circuit_constructor, key); // Compute Honk-style sigma polynomial fromt the permutation table compute_honk_style_sigma_lagrange_polynomials_from_mapping(sigma_mappings, key); } @@ -417,10 +417,10 @@ void compute_standard_honk_sigma_permutations(CircuitConstructor& circuit_constr * @param key Pointer to a proving key */ template -void compute_standard_plonk_sigma_permutations(CircuitConstructor& circuit_constructor, bonk::proving_key* key) +void compute_standard_plonk_sigma_permutations(CircuitConstructor& circuit_constructor, plonk::proving_key* key) { // Compute the permutation table specifying which element becomes which - auto sigma_mappings = compute_basic_bonk_sigma_permutations(circuit_constructor, key); + auto sigma_mappings = compute_basic_proof_system_sigma_permutations(circuit_constructor, key); // Compute Plonk-style sigma polynomials from the mapping compute_plonk_permutation_lagrange_polynomials_from_mapping("sigma", sigma_mappings, key); // Compute their monomial and coset versions @@ -453,7 +453,8 @@ inline void compute_first_and_last_lagrange_polynomials(auto key) // proving_key * @return std::array, program_width> */ template -void compute_plonk_generalized_sigma_permutations(const CircuitConstructor& circuit_constructor, bonk::proving_key* key) +void compute_plonk_generalized_sigma_permutations(const CircuitConstructor& circuit_constructor, + plonk::proving_key* key) { // Compute wire copy cycles for public and private variables auto wire_copy_cycles = compute_wire_copy_cycles(circuit_constructor); @@ -536,4 +537,4 @@ void compute_plonk_generalized_sigma_permutations(const CircuitConstructor& circ compute_monomial_and_coset_fft_polynomials_from_lagrange("id", key); } -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp b/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp index 01b1e7c7771..cd91bd4414c 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp @@ -6,12 +6,14 @@ #include #include #include -namespace bonk { + +namespace proof_system { /** * @brief Basic storage class for Polynomials * * @tparam Fr */ +// TODO(Cody): Move into plonk namespace. template class PolynomialStore { using Polynomial = barretenberg::Polynomial; @@ -96,4 +98,4 @@ template class PolynomialStore { typename std::unordered_map::const_iterator end() const { return polynomial_map.end(); } }; -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp index f0486cccbf6..a068cce790c 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp @@ -4,7 +4,7 @@ #include "polynomial_store.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace bonk { +namespace proof_system { using namespace barretenberg; using Fr = barretenberg::fr; @@ -111,4 +111,4 @@ TEST(PolynomialStore, RangeBasedFor) } } -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/types/composer_type.hpp b/barretenberg/cpp/src/barretenberg/proof_system/types/composer_type.hpp new file mode 100644 index 00000000000..295967e1360 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/proof_system/types/composer_type.hpp @@ -0,0 +1,6 @@ +#pragma once + +namespace proof_system { +// TODO(Cody) Get rid of this. +enum ComposerType { STANDARD, TURBO, PLOOKUP, STANDARD_HONK }; +} // namespace proof_system \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp b/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp index ef8e51616b4..54d29fad313 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp @@ -3,9 +3,9 @@ #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" #include "barretenberg/polynomials/polynomial_arithmetic.hpp" -namespace bonk { +namespace proof_system { -work_queue::work_queue(proving_key* prover_key, transcript::StandardTranscript* prover_transcript) +work_queue::work_queue(plonk::proving_key* prover_key, transcript::StandardTranscript* prover_transcript) : key(prover_key) , transcript(prover_transcript) , work_item_queue() @@ -305,4 +305,4 @@ std::vector work_queue::get_queue() const return work_item_queue; } -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp b/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp index 88aff2c4c44..4cbf5481494 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp @@ -1,9 +1,10 @@ #pragma once #include "../../transcript/transcript_wrappers.hpp" -#include "../proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" -namespace bonk { +namespace proof_system { +// TODO(Cody): Template by flavor? class work_queue { public: @@ -29,7 +30,7 @@ class work_queue { barretenberg::fr shift_factor; }; - work_queue(proving_key* prover_key = nullptr, transcript::StandardTranscript* prover_transcript = nullptr); + work_queue(plonk::proving_key* prover_key = nullptr, transcript::StandardTranscript* prover_transcript = nullptr); work_queue(const work_queue& other) = default; work_queue(work_queue&& other) = default; @@ -61,8 +62,8 @@ class work_queue { std::vector get_queue() const; private: - proving_key* key; + plonk::proving_key* key; transcript::StandardTranscript* transcript; std::vector work_item_queue; }; -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp index 9f91243678a..e4eebec39f2 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp @@ -1,7 +1,7 @@ /** * Create reference strings given an environment that implements env/crs.hpp. * Usable in both native and WASM code, but particularly useful for accessing - * reference strings from a WASM context. + * reference strings from a WASM context. * In a native context, the implementations assume a hard-coded string path. * For that reason, ideally this is only used in c-bind functions to maintain flexibility. */ @@ -17,7 +17,7 @@ #include #include -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -50,4 +50,4 @@ class EnvReferenceStringFactory : public ReferenceStringFactory { } }; -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp index b8c7e3787ef..d71c5c34f96 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp @@ -9,9 +9,9 @@ TEST(reference_string, env_file_consistency) { - auto env_crs = std::make_unique(); + auto env_crs = std::make_unique(); - auto file_crs = std::make_unique("../srs_db/ignition"); + auto file_crs = std::make_unique("../srs_db/ignition"); auto file_verifier = file_crs->get_verifier_crs(); EXPECT_EQ(env_crs->get_verifier_crs()->get_g2x(), file_verifier->get_g2x()); @@ -19,8 +19,6 @@ TEST(reference_string, env_file_consistency) file_verifier->get_precomputed_g2_lines(), sizeof(barretenberg::pairing::miller_lines) * 2), 0); - EXPECT_EQ( - env_crs->get_prover_crs(1)->get_monomial_points()[0], - file_crs->get_prover_crs(1)->get_monomial_points()[0] - ); + EXPECT_EQ(env_crs->get_prover_crs(1)->get_monomial_points()[0], + file_crs->get_prover_crs(1)->get_monomial_points()[0]); } diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp index e4dbae0bdd6..99f09c776ce 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp @@ -3,7 +3,7 @@ #include "barretenberg/ecc/curves/bn254/pairing.hpp" -namespace bonk { +namespace proof_system { VerifierFileReferenceString::VerifierFileReferenceString(std::string const& path) : precomputed_g2_lines( @@ -20,4 +20,4 @@ VerifierFileReferenceString::~VerifierFileReferenceString() aligned_free(precomputed_g2_lines); } -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp index 02ff6e6a0ad..ef6bebfc0ad 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp @@ -15,7 +15,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -99,4 +99,4 @@ class DynamicFileReferenceStringFactory : public ReferenceStringFactory { std::shared_ptr verifier_crs_; }; -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp index 8fe33b25f3e..0a9c71b40a1 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp @@ -6,7 +6,7 @@ #include -namespace bonk { +namespace proof_system { VerifierMemReferenceString::VerifierMemReferenceString(uint8_t const* g2x) : precomputed_g2_lines( @@ -23,4 +23,4 @@ VerifierMemReferenceString::~VerifierMemReferenceString() aligned_free(precomputed_g2_lines); } -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp index 95a9598b884..608446fa77a 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp @@ -11,7 +11,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -29,4 +29,4 @@ class VerifierMemReferenceString : public VerifierReferenceString { pairing::miller_lines* precomputed_g2_lines; }; -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp index 598d6aa9cf3..18701cc5370 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp @@ -20,9 +20,9 @@ TEST(reference_string, mem_file_consistency) transcript.read((char*)g2x.data(), 128); transcript.close(); - auto mem_verifier = std::make_unique(g2x.data()); + auto mem_verifier = std::make_unique(g2x.data()); - auto file_crs = std::make_unique("../srs_db/ignition"); + auto file_crs = std::make_unique("../srs_db/ignition"); auto file_verifier = file_crs->get_verifier_crs(); EXPECT_EQ(mem_verifier->get_g2x(), file_verifier->get_g2x()); diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp index f409b9225d8..53c6867018f 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp @@ -9,7 +9,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -51,4 +51,4 @@ class PippengerReferenceStringFactory : public ReferenceStringFactory { uint8_t const* g2x_; }; -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/srs/reference_string/reference_string.hpp b/barretenberg/cpp/src/barretenberg/srs/reference_string/reference_string.hpp index 13033d9f371..e43d9fa798e 100644 --- a/barretenberg/cpp/src/barretenberg/srs/reference_string/reference_string.hpp +++ b/barretenberg/cpp/src/barretenberg/srs/reference_string/reference_string.hpp @@ -10,7 +10,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { class VerifierReferenceString { public: @@ -40,4 +40,4 @@ class ReferenceStringFactory { virtual std::shared_ptr get_verifier_crs() { return nullptr; } }; -} // namespace bonk +} // namespace proof_system diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp index fa45398119f..6e99674ba94 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp @@ -11,13 +11,13 @@ using namespace crypto::aes128; using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace aes128 { constexpr uint32_t AES128_BASE = 9; -typedef plonk::stdlib::field_t field_t; -typedef plonk::stdlib::witness_t witness_t; +typedef stdlib::field_t field_t; +typedef stdlib::witness_t witness_t; typedef std::pair byte_pair; @@ -296,4 +296,4 @@ std::vector encrypt_buffer_cbc(const std::vector& input, const } // namespace aes128 } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp index 14dea9b3960..fc9dbfcc1d2 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp @@ -8,7 +8,7 @@ #include "../../primitives/field/field.hpp" #include "../../primitives/witness/witness.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace aes128 { @@ -19,4 +19,4 @@ std::vector> encrypt_buffer_cbc(const std::vector< } // namespace aes128 } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp index ca97c0b11e9..da1fc78a6d7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp @@ -7,12 +7,12 @@ #include using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; TEST(stdlib_aes128, encrypt_64_bytes) { - typedef plonk::stdlib::field_t field_pt; - typedef plonk::stdlib::witness_t witness_pt; + typedef stdlib::field_t field_pt; + typedef stdlib::witness_t witness_pt; uint8_t key[16]{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; uint8_t out[64]{ 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, @@ -34,7 +34,7 @@ TEST(stdlib_aes128, encrypt_64_bytes) return converted; }; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::vector in_field{ witness_pt(&composer, fr(convert_bytes(in))), @@ -50,7 +50,7 @@ TEST(stdlib_aes128, encrypt_64_bytes) convert_bytes(out), convert_bytes(out + 16), convert_bytes(out + 32), convert_bytes(out + 48) }; - const auto result = plonk::stdlib::aes128::encrypt_buffer_cbc(in_field, iv_field, key_field); + const auto result = stdlib::aes128::encrypt_buffer_cbc(in_field, iv_field, key_field); for (size_t i = 0; i < 4; ++i) { EXPECT_EQ(result[i].get_value(), expected[i]); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp index bdd67f46b40..c6ab50fbae2 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp @@ -3,7 +3,7 @@ #include "../../primitives/byte_array/byte_array.hpp" #include "../../primitives/composers/composers_fwd.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace ecdsa { @@ -18,6 +18,6 @@ bool_t verify_signature(const stdlib::byte_array& message, const signature& sig); } // namespace ecdsa } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk #include "./ecdsa_impl.hpp" \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp index 808bfbdf040..b1edc24d847 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp @@ -7,10 +7,10 @@ #include "barretenberg/common/test.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace test_stdlib_ecdsa { -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using curve = stdlib::secp256k1; TEST(stdlib_ecdsa, verify_signature) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp index 882a4b083a6..12355453d66 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp @@ -2,7 +2,7 @@ #include "../../hash/sha256/sha256.hpp" #include "../../primitives/bit_array/bit_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace ecdsa { @@ -34,7 +34,7 @@ bool_t verify_signature(const stdlib::byte_array& message, G1 result; if constexpr (Composer::type == ComposerType::PLOOKUP) { - ASSERT(Curve::type == bonk::CurveType::SECP256K1); + ASSERT(Curve::type == proof_system::CurveType::SECP256K1); public_key.validate_on_curve(); result = G1::secp256k1_ecdsa_mul(public_key, u1, u2); } else { @@ -68,4 +68,4 @@ bool_t verify_signature(const stdlib::byte_array& message, } // namespace ecdsa } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp index 35ebcde4b9e..86f419095c6 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp @@ -6,7 +6,7 @@ #include "../../primitives/composers/composers.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace schnorr { @@ -119,12 +119,12 @@ point variable_base_mul(const point& pub_key, const field_t& low_bits, field_t zero_test = (low_bits * high_bits); zero_test.assert_is_not_zero(); - const auto low_wnaf = plonk::stdlib::schnorr::convert_field_into_wnaf(context, low_bits); - const auto high_wnaf = plonk::stdlib::schnorr::convert_field_into_wnaf(context, high_bits); + const auto low_wnaf = stdlib::schnorr::convert_field_into_wnaf(context, low_bits); + const auto high_wnaf = stdlib::schnorr::convert_field_into_wnaf(context, high_bits); // current_accumulator is pub_key, so init is true, so high_output is [high_wnaf]pub_key - point high_output = plonk::stdlib::schnorr::variable_base_mul(pub_key, pub_key, high_wnaf); + point high_output = stdlib::schnorr::variable_base_mul(pub_key, pub_key, high_wnaf); // compute output = [low_wnaf]pub_key + [2^128]high_output. - point output = plonk::stdlib::schnorr::variable_base_mul(pub_key, high_output, low_wnaf); + point output = stdlib::schnorr::variable_base_mul(pub_key, high_output, low_wnaf); return output; } @@ -376,4 +376,4 @@ template signature_bits convert_signature convert_signature blake2s(const byte_array blake2s(const byte_array& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp index 242fbbc6073..aeaf759b6c1 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp @@ -1,13 +1,13 @@ #pragma once #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { class StandardComposer; class TurboComposer; class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template byte_array blake2s(const byte_array& input); @@ -17,4 +17,4 @@ extern template byte_array blake2s(const byte_array blake2s(const byte_array& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp index ac920961f97..b61cbc305db 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp @@ -5,9 +5,9 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; typedef stdlib::byte_array byte_array; typedef stdlib::byte_array byte_array_plookup; typedef stdlib::public_witness_t public_witness_t; @@ -39,7 +39,7 @@ TEST(stdlib_blake2s, test_single_block) TEST(stdlib_blake2s, test_single_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01"; std::vector input_v(input.begin(), input.end()); @@ -87,7 +87,7 @@ TEST(stdlib_blake2s, test_double_block) TEST(stdlib_blake2s, test_double_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789"; std::vector input_v(input.begin(), input.end()); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp index c967769cea5..3fad189ef28 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp @@ -16,7 +16,7 @@ * 2. replace use of uint32 with basic field_t type * **/ -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake2s_plookup { @@ -171,4 +171,4 @@ template byte_array blake2s(const byte_array blake2s(const byte_array state[BLAKE3_STATE_SIZE], } // namespace blake_util } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp index f8af0692ac5..dad4d642044 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp @@ -5,7 +5,7 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include "../blake2s/blake_util.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake3_internal { @@ -264,4 +264,4 @@ template byte_array blake3s(const byte_array blake3s(const byte_array& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp index 70e4c14b2e2..79e265586aa 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp @@ -1,12 +1,12 @@ #pragma once #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { class TurboComposer; class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template byte_array blake3s(const byte_array& input); @@ -16,4 +16,4 @@ extern template byte_array blake3s(const byte_array blake3s(const byte_array& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp index 3b9db59eec4..583bd87db4c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp @@ -6,9 +6,9 @@ #include "barretenberg/plonk/composer/ultra_composer.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; -typedef plonk::TurboComposer Composer; +typedef proof_system::plonk::TurboComposer Composer; typedef stdlib::byte_array byte_array; typedef stdlib::byte_array byte_array_plookup; typedef stdlib::public_witness_t public_witness_t; @@ -52,7 +52,7 @@ TEST(stdlib_blake3s, test_single_block) TEST(stdlib_blake3s, test_single_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01"; std::vector input_v(input.begin(), input.end()); @@ -100,7 +100,7 @@ TEST(stdlib_blake3s, test_double_block) TEST(stdlib_blake3s, test_double_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789"; std::vector input_v(input.begin(), input.end()); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp index b27c488bea1..3253483722d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp @@ -8,7 +8,7 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake3s_plookup { @@ -264,4 +264,4 @@ template byte_array blake3s(const byte_array blake3s(const byte_array stdlib::byte_array keccak::hash template class keccak; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp index 5c8423a03fa..ec52db7fab4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp @@ -4,11 +4,11 @@ #include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp" #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class bit_array; @@ -186,4 +186,4 @@ template class keccak { extern template class keccak; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp index 5a914402c86..589d14dd0e9 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp @@ -6,9 +6,9 @@ #include "../../primitives/plookup/plookup.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; -typedef plonk::UltraComposer Composer; +typedef proof_system::plonk::UltraComposer Composer; typedef stdlib::byte_array byte_array; typedef stdlib::public_witness_t public_witness_t; typedef stdlib::field_t field_ct; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp index 1f330830d05..5fd4073deae 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp @@ -43,7 +43,7 @@ void generate_test_pedersen_circuit(plonk::TurboComposer& turbo_composer, size_t plonk::stdlib::witness_t(&turbo_composer, barretenberg::fr::random_element())); for (size_t i = 0; i < num_repetitions; ++i) { - out = plonk::stdlib::pedersen::compress(left, out); + out = proof_system::plonk::stdlib::pedersen::compress(left, out); } } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp index 5db83ffca16..d0ebf02f5a8 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp @@ -7,12 +7,12 @@ #include "../../primitives/composers/composers.hpp" #include "../../primitives/packed_byte_array/packed_byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; using namespace crypto::pedersen; -using namespace bonk; +using namespace proof_system; namespace { /** @@ -225,8 +225,8 @@ point pedersen::hash_single(const field_t& in, if (i > 0) { gates.create_fixed_group_add_gate(round_quad); } else { - if constexpr (C::type == plonk::PLOOKUP && - C::merkle_hash_type == plonk::MerkleHashType::FIXED_BASE_PEDERSEN) { + if constexpr (C::type == ComposerType::PLOOKUP && + C::merkle_hash_type == MerkleHashType::FIXED_BASE_PEDERSEN) { /* In TurboComposer, the selector q_5 is used to show that w_1 and w_2 are properly initialized to the * coordinates of P_s = (-s + 4^n)[g]. In UltraPlonK, we have removed q_5 for overall efficiency (it * would only be used here in this gate), but this presents us a cost in the present circuit: we must @@ -577,4 +577,4 @@ template class pedersen; template class pedersen; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp index 1f8b1afd526..c2cf7957ef5 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp @@ -5,17 +5,17 @@ #include "../../primitives/point/point.hpp" #include "../../primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { constexpr uint64_t WNAF_MASK = crypto::pedersen::WNAF_MASK; template class pedersen { private: - typedef plonk::stdlib::field_t field_t; - typedef plonk::stdlib::point point; - typedef plonk::stdlib::byte_array byte_array; - typedef plonk::stdlib::bool_t bool_t; + typedef stdlib::field_t field_t; + typedef stdlib::point point; + typedef stdlib::byte_array byte_array; + typedef stdlib::bool_t bool_t; static point hash_single(const field_t& in, const crypto::pedersen::generator_index_t hash_index, @@ -54,4 +54,4 @@ extern template class pedersen; extern template class pedersen; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp index 725d09752f8..5450ab5b8f7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp @@ -9,7 +9,7 @@ namespace test_stdlib_pedersen { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); } @@ -454,7 +454,7 @@ typedef stdlib::field_t field_ct; typedef stdlib::witness_t witness_ct; TEST(stdlib_pedersen, test_pedersen_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); fr left_in = fr::random_element(); fr right_in = fr::random_element(); @@ -481,7 +481,7 @@ TEST(stdlib_pedersen, test_pedersen_plookup) TEST(stdlib_pedersen, test_compress_many_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::vector input_values{ fr::random_element(), fr::random_element(), fr::random_element(), @@ -513,7 +513,7 @@ TEST(stdlib_pedersen, test_compress_many_plookup) TEST(stdlib_pedersen, test_merkle_damgard_compress_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::vector input_values{ fr::random_element(), fr::random_element(), fr::random_element(), diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp index 6d708abee1c..211b01e3fdb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp @@ -5,7 +5,7 @@ #include "../../primitives/point/point.hpp" #include "../../primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -22,10 +22,9 @@ namespace stdlib { */ template class pedersen_gates { public: - using fixed_group_add_quad = bonk::fixed_group_add_quad; - using fixed_group_init_quad = bonk::fixed_group_init_quad; - using add_quad = bonk::add_quad; - using ComposerType = plonk::ComposerType; + using fixed_group_add_quad = proof_system::fixed_group_add_quad; + using fixed_group_init_quad = proof_system::fixed_group_init_quad; + using add_quad = proof_system::add_quad; Composer* context; fixed_group_add_quad previous_add_quad; @@ -313,4 +312,4 @@ template class pedersen_gates { }; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp index f2f3d851485..d7c062d77f2 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp @@ -6,9 +6,9 @@ #include "../../primitives/composers/composers.hpp" #include "../../primitives/plookup/plookup.hpp" -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; @@ -168,4 +168,4 @@ field_t pedersen_plookup::compress(const std::vector& inputs, con template class pedersen_plookup; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp index bc01ff94a8b..2d14bf73cb0 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp @@ -4,15 +4,15 @@ #include "../../primitives/point/point.hpp" #include "../../primitives/packed_byte_array/packed_byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class pedersen_plookup { private: - typedef plonk::stdlib::field_t field_t; - typedef plonk::stdlib::point point; - typedef plonk::stdlib::packed_byte_array packed_byte_array; - typedef plonk::stdlib::bool_t bool_t; + typedef stdlib::field_t field_t; + typedef stdlib::point point; + typedef stdlib::packed_byte_array packed_byte_array; + typedef stdlib::bool_t bool_t; enum AddType { LAMBDA, @@ -43,4 +43,4 @@ template class pedersen_plookup { extern template class pedersen_plookup; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp index 00d00082e13..1c5947c6692 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp @@ -5,7 +5,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace benchmark; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; constexpr size_t NUM_HASHES = 8; constexpr size_t BYTES_PER_CHUNK = 512; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp index 150f91b6369..22bc5ac9de6 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp @@ -5,7 +5,7 @@ #include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace internal { constexpr uint32_t init_constants[8]{ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, @@ -186,4 +186,4 @@ template packed_byte_array sha256(const packed_byte_arr template packed_byte_array sha256(const packed_byte_array& input); template packed_byte_array sha256(const packed_byte_array& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp index ec30872a8f4..57ec0a7253b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp @@ -6,13 +6,13 @@ #include "sha256_plookup.hpp" -namespace plonk { +namespace proof_system::plonk { class UltraComposer; class StandardComposer; class TurboComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class bit_array; @@ -41,4 +41,4 @@ extern template packed_byte_array sha256( extern template packed_byte_array sha256(const packed_byte_array& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp index b9d9d3add71..9379e2382ad 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp @@ -16,7 +16,8 @@ auto& engine = numeric::random::get_debug_engine(); namespace test_stdlib_sha256 { using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk; +using namespace proof_system::plonk::stdlib::types; constexpr uint64_t ror(uint64_t val, uint64_t shift) { @@ -111,7 +112,7 @@ std::array inner_block(std::array& w) TEST(stdlib_sha256, test_duplicate_proving_key) { - plonk::StandardComposer first_composer = plonk::StandardComposer(); + plonk::StandardComposer first_composer = StandardComposer(); stdlib::packed_byte_array input(&first_composer, "An 8 character password? Snow White and the 7 Dwarves.."); plonk::stdlib::sha256(input); auto prover = first_composer.create_prover(); @@ -124,7 +125,7 @@ TEST(stdlib_sha256, test_duplicate_proving_key) auto circuit_size = prover.circuit_size; // Test a second time with same keys and different input. - plonk::StandardComposer second_composer = plonk::StandardComposer(proving_key, verification_key, circuit_size); + plonk::StandardComposer second_composer = StandardComposer(proving_key, verification_key, circuit_size); stdlib::packed_byte_array input2(&second_composer, "An 8 character password? Snow White and the 9 Dwarves.."); plonk::stdlib::sha256(input2); auto second_prover = second_composer.create_prover(); @@ -137,14 +138,15 @@ TEST(stdlib_sha256, test_duplicate_proving_key) // TEST(stdlib_sha256_plookup, test_round) // { -// plonk::UltraComposer composer = plonk::UltraComposer(); +// plonk::UltraComposer composer = UltraComposer(); // std::array w_inputs; // std::array, 64> w_elements; // for (size_t i = 0; i < 64; ++i) { // w_inputs[i] = engine.get_random_uint32(); -// w_elements[i] = plonk::stdlib::witness_t(&composer, barretenberg::fr(w_inputs[i])); +// w_elements[i] = stdlib::witness_t(&composer, +// barretenberg::fr(w_inputs[i])); // } // const auto expected = inner_block(w_inputs); @@ -167,15 +169,15 @@ TEST(stdlib_sha256, test_duplicate_proving_key) TEST(stdlib_sha256, test_plookup_55_bytes) { - typedef plonk::stdlib::field_t field_pt; - typedef plonk::stdlib::packed_byte_array packed_byte_array_pt; + typedef stdlib::field_t field_pt; + typedef stdlib::packed_byte_array packed_byte_array_pt; // 55 bytes is the largest number of bytes that can be hashed in a single block, // accounting for the single padding bit, and the 64 size bits required by the SHA-256 standard. - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input(&composer, "An 8 character password? Snow White and the 7 Dwarves.."); - packed_byte_array_pt output_bits = plonk::stdlib::sha256(input); + packed_byte_array_pt output_bits = stdlib::sha256(input); std::vector output = output_bits.to_unverified_byte_slices(4); @@ -206,7 +208,7 @@ TEST(stdlib_sha256, test_55_bytes) Composer composer = Composer(); packed_byte_array_ct input(&composer, "An 8 character password? Snow White and the 7 Dwarves.."); - packed_byte_array_ct output_bits = plonk::stdlib::sha256(input); + packed_byte_array_ct output_bits = stdlib::sha256(input); std::vector output = output_bits.to_unverified_byte_slices(4); @@ -232,13 +234,13 @@ TEST(stdlib_sha256, test_55_bytes) TEST(stdlib_sha256, test_NIST_vector_one_packed_byte_array) { - typedef plonk::stdlib::field_t field_pt; - typedef plonk::stdlib::packed_byte_array packed_byte_array_pt; + typedef stdlib::field_t field_pt; + typedef stdlib::packed_byte_array packed_byte_array_pt; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input(&composer, "abc"); - packed_byte_array_pt output_bytes = plonk::stdlib::sha256(input); + packed_byte_array_pt output_bytes = stdlib::sha256(input); std::vector output = output_bytes.to_unverified_byte_slices(4); EXPECT_EQ(uint256_t(output[0].get_value()).data[0], (uint64_t)0xBA7816BFU); EXPECT_EQ(uint256_t(output[1].get_value()).data[0], (uint64_t)0x8F01CFEAU); @@ -263,14 +265,14 @@ TEST(stdlib_sha256, test_NIST_vector_one_packed_byte_array) TEST(stdlib_sha256, test_NIST_vector_one) { - typedef plonk::stdlib::field_t field_pt; - typedef plonk::stdlib::packed_byte_array packed_byte_array_pt; + typedef stdlib::field_t field_pt; + typedef stdlib::packed_byte_array packed_byte_array_pt; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input(&composer, "abc"); - packed_byte_array_pt output_bits = plonk::stdlib::sha256(input); + packed_byte_array_pt output_bits = stdlib::sha256(input); std::vector output = output_bits.to_unverified_byte_slices(4); @@ -301,7 +303,7 @@ TEST(stdlib_sha256, test_NIST_vector_two) byte_array_ct input(&composer, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"); - byte_array_ct output_bits = plonk::stdlib::sha256(input); + byte_array_ct output_bits = stdlib::sha256(input); std::vector output = packed_byte_array_ct(output_bits).to_unverified_byte_slices(4); @@ -333,7 +335,7 @@ TEST(stdlib_sha256, test_NIST_vector_three) // one byte, 0xbd byte_array_ct input(&composer, std::vector{ 0xbd }); - byte_array_ct output_bits = plonk::stdlib::sha256(input); + byte_array_ct output_bits = stdlib::sha256(input); std::vector output = packed_byte_array_ct(output_bits).to_unverified_byte_slices(4); @@ -364,7 +366,7 @@ TEST(stdlib_sha256, test_NIST_vector_four) // 4 bytes, 0xc98c8e55 byte_array_ct input(&composer, std::vector{ 0xc9, 0x8c, 0x8e, 0x55 }); - byte_array_ct output_bits = plonk::stdlib::sha256(input); + byte_array_ct output_bits = stdlib::sha256(input); std::vector output = packed_byte_array_ct(output_bits).to_unverified_byte_slices(4); @@ -390,10 +392,10 @@ TEST(stdlib_sha256, test_NIST_vector_four) HEAVY_TEST(stdlib_sha256, test_NIST_vector_five) { - typedef plonk::stdlib::field_t field_pt; - typedef plonk::stdlib::packed_byte_array packed_byte_array_pt; + typedef stdlib::field_t field_pt; + typedef stdlib::packed_byte_array packed_byte_array_pt; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input( &composer, @@ -408,7 +410,7 @@ HEAVY_TEST(stdlib_sha256, test_NIST_vector_five) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAA"); - packed_byte_array_pt output_bits = plonk::stdlib::sha256(input); + packed_byte_array_pt output_bits = stdlib::sha256(input); std::vector output = output_bits.to_unverified_byte_slices(4); @@ -442,7 +444,7 @@ TEST(stdlib_sha256, test_input_len_multiple) auto input_buf = std::vector(inp, 1); byte_array_ct input(&composer, input_buf); - byte_array_ct output_bits = plonk::stdlib::sha256(input); + byte_array_ct output_bits = stdlib::sha256(input); auto circuit_output = output_bits.get_value(); @@ -486,7 +488,7 @@ TEST(stdlib_sha256, test_input_str_len_multiple) auto input_buf = std::vector(input_str.begin(), input_str.end()); byte_array_ct input(&composer, input_buf); - byte_array_ct output_bits = plonk::stdlib::sha256(input); + byte_array_ct output_bits = stdlib::sha256(input); auto circuit_output = output_bits.get_value(); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp index c86ca331956..04a5632eabf 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp @@ -10,7 +10,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace sha256_plookup { @@ -361,4 +361,4 @@ packed_byte_array sha256(const packed_byte_array, 8> sha256_block(const std::array sha256(const packed_byte_array& input); } // namespace sha256_plookup } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp index 56af194120c..c24ccf60599 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp @@ -7,7 +7,7 @@ #include "barretenberg/stdlib/primitives/field/field.hpp" #include -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -28,4 +28,4 @@ inline barretenberg::fr compress_native(barretenberg::fr const& lhs, barretenber } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp index 34874b412cd..dbe178c3aef 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp @@ -4,14 +4,14 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; TEST(stdlib_merkle_tree_hash, compress_native_vs_circuit) { fr x = uint256_t(0x5ec473eb273a8011, 0x50160109385471ca, 0x2f3095267e02607d, 0x02586f4a39e69b86); Composer composer = Composer(); witness_ct y = witness_ct(&composer, x); - field_ct z = plonk::stdlib::pedersen::compress(y, y); + field_ct z = proof_system::plonk::stdlib::pedersen::compress(y, y); auto zz = crypto::pedersen::compress_native({ x, x }); EXPECT_EQ(z.get_value(), zz); } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp index 174db8b7e29..dbe62f26116 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp @@ -4,7 +4,7 @@ #include "barretenberg/stdlib/primitives/field/field.hpp" #include -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -64,7 +64,7 @@ inline fr zero_hash_at_height(size_t height) } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk // We add to std namespace as fr_hash_path is actually a std::vector, and this is the only way // to achieve effective ADL. diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp index 3273eefcf65..8b62921fbe4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp @@ -4,7 +4,7 @@ #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -262,4 +262,4 @@ void batch_update_membership(field_t const& new_root, } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp index 0dee1869322..53e43ff816a 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp @@ -6,8 +6,8 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; TEST(stdlib_merkle_tree, test_check_membership) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp index f0b735a1e45..d1aad8b5514 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp @@ -4,7 +4,7 @@ #include #include -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -88,4 +88,4 @@ class MemoryStore { } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp index 331d5a20758..cdfacca7ff5 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp @@ -1,7 +1,7 @@ #include "memory_tree.hpp" #include "hash.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -59,4 +59,4 @@ fr MemoryTree::update_element(size_t index, fr const& value) } // namespace merkle_tree } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp index 792ac7dbb0d..b0e2504c77b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp @@ -1,7 +1,7 @@ #pragma once #include "hash_path.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -43,4 +43,4 @@ class MemoryTree { } // namespace merkle_tree } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp index cdceef6ea4d..08dfd185955 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; static std::vector VALUES = []() { std::vector values(4); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp index 46a8ad93634..01d51b68c03 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp @@ -5,7 +5,7 @@ #include "barretenberg/numeric/random/engine.hpp" using namespace benchmark; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; namespace { auto& engine = numeric::random::get_debug_engine(); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp index f37ed0c901a..23765f24acb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp @@ -8,7 +8,7 @@ #include "barretenberg/numeric/uint128/uint128.hpp" #include -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -292,4 +292,4 @@ template class MerkleTree; } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp index 4d34c419475..a5c10135819 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp @@ -2,7 +2,7 @@ #include "hash_path.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -99,4 +99,4 @@ extern template class MerkleTree; } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp index 03e111b717b..a4b3607be92 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp @@ -7,7 +7,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; namespace { auto& engine = numeric::random::get_debug_engine(); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp index b7ede3f00bc..f3caaa88c15 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp @@ -119,11 +119,11 @@ FastRandom VarianceRNG(0); */ template class BigFieldBase { private: - typedef plonk::stdlib::bool_t bool_t; - typedef plonk::stdlib::field_t field_t; - typedef plonk::stdlib::witness_t witness_t; - typedef plonk::stdlib::public_witness_t public_witness_t; - typedef plonk::stdlib::bigfield bigfield_t; + typedef proof_system::plonk::stdlib::bool_t bool_t; + typedef proof_system::plonk::stdlib::field_t field_t; + typedef proof_system::plonk::stdlib::witness_t witness_t; + typedef proof_system::plonk::stdlib::public_witness_t public_witness_t; + typedef proof_system::plonk::stdlib::bigfield bigfield_t; public: /** diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp index 86b0d3f91fd..1552eb845a7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp @@ -11,7 +11,7 @@ #include "../composers/composers_fwd.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class bigfield { @@ -496,6 +496,6 @@ template inline std::ostream& operator<<(std::ostream& } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk #include "bigfield_impl.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp index b6e5626b346..899b4cf4d56 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp @@ -22,7 +22,7 @@ namespace test_stdlib_bigfield { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; /* A note regarding Plookup: stdlib_bigfield_plookup tests were present when this file was standardized @@ -994,7 +994,7 @@ TYPED_TEST(stdlib_bigfield, division_context) // // PLOOKUP TESTS // TEST(stdlib_bigfield_plookup, test_mul) // { -// plonk::UltraComposer composer = plonk::UltraComposer(); +// plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); // size_t num_repetitions = 1; // for (size_t i = 0; i < num_repetitions; ++i) { // fq inputs[3]{ fq::random_element(), fq::random_element(), fq::random_element() }; @@ -1041,7 +1041,7 @@ TYPED_TEST(stdlib_bigfield, division_context) // TEST(stdlib_bigfield_plookup, test_sqr) // { -// plonk::UltraComposer composer = plonk::UltraComposer(); +// plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); // size_t num_repetitions = 10; // for (size_t i = 0; i < num_repetitions; ++i) { // fq inputs[3]{ fq::random_element(), fq::random_element(), fq::random_element() }; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp index e7bbcf34ec1..218576684e7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp @@ -11,7 +11,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -56,7 +56,7 @@ bigfield::bigfield(const field_t& low_bits_in, field_t limb_3(context); if (low_bits_in.witness_index != IS_CONSTANT) { std::vector low_accumulator; - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { // MERGE NOTE: this was the if constexpr block introduced in ecebe7643 const auto limb_witnesses = context->decompose_non_native_field_double_width_limb(low_bits_in.normalize().witness_index); @@ -107,7 +107,7 @@ bigfield::bigfield(const field_t& low_bits_in, if (high_bits_in.witness_index != IS_CONSTANT) { std::vector high_accumulator; - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { const auto limb_witnesses = context->decompose_non_native_field_double_width_limb( high_bits_in.normalize().witness_index, (size_t)num_high_limb_bits); limb_2.witness_index = limb_witnesses[0]; @@ -187,7 +187,7 @@ bigfield bigfield::create_from_u512_as_witness(C* ctx, limbs[2] = value.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3).lo; limbs[3] = value.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4).lo; - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { field_t limb_0(ctx); field_t limb_1(ctx); field_t limb_2(ctx); @@ -1645,7 +1645,7 @@ template void bigfield::assert_is_in_field() cons r1 = r1.normalize(); r2 = r2.normalize(); r3 = r3.normalize(); - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { context->decompose_into_default_range(r0.witness_index, static_cast(NUM_LIMB_BITS)); context->decompose_into_default_range(r1.witness_index, static_cast(NUM_LIMB_BITS)); context->decompose_into_default_range(r2.witness_index, static_cast(NUM_LIMB_BITS)); @@ -1778,7 +1778,7 @@ template void bigfield::self_reduce() const // TODO: implicit assumption here - NUM_LIMB_BITS large enough for all the quotient uint32_t quotient_limb_index = context->add_variable(barretenberg::fr(quotient_value.lo)); field_t quotient_limb = field_t::from_witness_index(context, quotient_limb_index); - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { context->decompose_into_default_range(quotient_limb.witness_index, static_cast(maximum_quotient_bits)); } else { context->decompose_into_base4_accumulators(quotient_limb.witness_index, @@ -1880,7 +1880,7 @@ void bigfield::unsafe_evaluate_multiply_add(const bigfield& input_left, ++max_hi_bits; } - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { // The plookup custom bigfield gate requires inputs are witnesses. // If we're using constant values, instantiate them as circuit variables const auto convert_constant_to_witness = [ctx](const bigfield& input) { @@ -2238,7 +2238,7 @@ void bigfield::unsafe_evaluate_multiple_multiply_add(const std::vector::unsafe_evaluate_multiple_multiply_add(const std::vectordecompose_into_default_range(lo.normalize().witness_index, carry_lo_msb); } /* NOTE TO AUDITOR: An extraneous block - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { carry_lo = carry_lo.normalize(); carry_hi = carry_hi.normalize(); ctx->decompose_into_default_range(carry_lo.witness_index, static_cast(carry_lo_msb)); @@ -2604,7 +2604,7 @@ void bigfield::unsafe_evaluate_multiple_multiply_add(const std::vectordecompose_into_default_range(carry_lo.witness_index, static_cast(carry_lo_msb)); @@ -2643,7 +2643,7 @@ void bigfield::unsafe_evaluate_square_add(const bigfield& left, const bigfield& quotient, const bigfield& remainder) { - if (C::type == plonk::PLOOKUP) { + if (C::type == ComposerType::PLOOKUP) { unsafe_evaluate_multiply_add(left, left, to_add, quotient, { remainder }); return; } @@ -2764,7 +2764,7 @@ void bigfield::unsafe_evaluate_square_add(const bigfield& left, const uint64_t carry_hi_msb = max_hi_bits - (2 * NUM_LIMB_BITS); const barretenberg::fr carry_lo_shift(uint256_t(uint256_t(1) << carry_lo_msb)); - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { carry_lo = carry_lo.normalize(); carry_hi = carry_hi.normalize(); ctx->decompose_into_default_range(carry_lo.witness_index, static_cast(carry_lo_msb)); @@ -2863,4 +2863,4 @@ std::pair bigfield::get_quotient_reduction_info(const std::v } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp index a031f45dd0f..29d8e472c14 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp @@ -14,7 +14,7 @@ #include "../composers/composers_fwd.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // ( ͡° ͜ʖ ͡°) @@ -946,7 +946,7 @@ inline std::ostream& operator<<(std::ostream& os, element const& v return os << "{ " << v.x << " , " << v.y << " }"; } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk #include "biggroup_nafs.hpp" #include "biggroup_tables.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp index f16233e08fb..32eb7d5b80c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp @@ -20,7 +20,7 @@ auto& engine = numeric::random::get_debug_engine(); } // using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; // One can only define a TYPED_TEST with a single template paramter. // Our workaround is to pass parameters of the following type. @@ -900,7 +900,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, double_montgomery_ladder) HEAVY_TYPED_TEST(stdlib_biggroup, compute_naf) { // ULTRATODO: make this work for secp curves - if constexpr (TypeParam::Curve::type == bonk::CurveType::BN254) { + if constexpr (TypeParam::Curve::type == CurveType::BN254) { size_t num_repetitions = 1; for (size_t i = 0; i < num_repetitions; i++) { TestFixture::test_compute_naf(); @@ -913,7 +913,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, compute_naf) /* These tests only work for UltraComposer */ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_batch_mul) { - if constexpr (TypeParam::Curve::Composer::type == plonk::ComposerType::PLOOKUP) { + if constexpr (TypeParam::Curve::Composer::type == ComposerType::PLOOKUP) { TestFixture::test_compute_wnaf(); } else { GTEST_SKIP(); @@ -924,7 +924,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_batch_mul) Fr is a bigfield. */ HEAVY_TYPED_TEST(stdlib_biggroup, compute_wnaf) { - if constexpr (TypeParam::Curve::Composer::type != plonk::UltraComposer::type && TypeParam::use_bigfield) { + if constexpr (TypeParam::Curve::Composer::type != UltraComposer::type && TypeParam::use_bigfield) { GTEST_SKIP(); } else { TestFixture::test_compute_wnaf(); @@ -961,7 +961,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_batch_4) /* The following tests are specific to BN254 and don't work when Fr is a bigfield */ HEAVY_TYPED_TEST(stdlib_biggroup, bn254_endo_batch_mul) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::BN254 && !TypeParam::use_bigfield) { + if constexpr (TypeParam::Curve::type == CurveType::BN254 && !TypeParam::use_bigfield) { TestFixture::test_bn254_endo_batch_mul(); } else { GTEST_SKIP(); @@ -969,7 +969,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, bn254_endo_batch_mul) } HEAVY_TYPED_TEST(stdlib_biggroup, mixed_mul_bn254_endo) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::BN254 && !TypeParam::use_bigfield) { + if constexpr (TypeParam::Curve::type == CurveType::BN254 && !TypeParam::use_bigfield) { TestFixture::test_mixed_mul_bn254_endo(); } else { GTEST_SKIP(); @@ -979,7 +979,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, mixed_mul_bn254_endo) /* The following tests are specific to SECP256k1 */ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_secp256k1) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::SECP256K1) { + if constexpr (TypeParam::Curve::type == CurveType::SECP256K1) { TestFixture::test_wnaf_secp256k1(); } else { GTEST_SKIP(); @@ -987,7 +987,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_secp256k1) } HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_8bit_secp256k1) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::SECP256K1) { + if constexpr (TypeParam::Curve::type == CurveType::SECP256K1) { TestFixture::test_wnaf_8bit_secp256k1(); } else { GTEST_SKIP(); @@ -995,7 +995,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_8bit_secp256k1) } HEAVY_TYPED_TEST(stdlib_biggroup, ecdsa_mul_secp256k1) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::SECP256K1) { + if constexpr (TypeParam::Curve::type == CurveType::SECP256K1) { TestFixture::test_ecdsa_mul_secp256k1(); } else { GTEST_SKIP(); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp index ac732ae22ce..c237d0dfbb7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp @@ -1,6 +1,6 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -61,4 +61,4 @@ element element::wnaf_batch_mul(const std::vector element::bn254_endo_batch_mul(const std::vec return accumulator; } } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp index ea107e2300d..78d6f378554 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp @@ -11,7 +11,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -660,4 +660,4 @@ element element::operator*(const Fr& scalar) const return element(out_x, out_y) - element(offset_generators.second); } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp index 71cd984c30a..63257d56873 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -548,4 +548,4 @@ std::vector> element::compute_naf(const Fr& scalar, cons return naf_entries; } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp index 0b7ff33f0b2..7d510e2794a 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp @@ -5,7 +5,7 @@ * TODO: we should try to genericize this, but this method is super fiddly and we need it to be efficient! * **/ -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -138,4 +138,4 @@ element element::secp256k1_ecdsa_mul(const element& return accumulator; } } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp index e10ffdabc5a..9fee0738886 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp @@ -1,5 +1,5 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -583,4 +583,4 @@ element element::lookup_table_base::get( return element::one(bits[0].get_context()); } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp index 74dfad7126b..b8f9dbc3434 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp @@ -3,7 +3,7 @@ #include -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -163,4 +163,4 @@ template std::string bit_array::get_ INSTANTIATE_STDLIB_TYPE(bit_array) } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp index 2f1a1f65365..45a2b04ed4d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp @@ -30,8 +30,8 @@ FastRandom VarianceRNG(0); */ template class BitArrayFuzzBase { private: - typedef plonk::stdlib::bit_array bit_array_t; - typedef plonk::stdlib::byte_array byte_array_t; + typedef proof_system::plonk::stdlib::bit_array bit_array_t; + typedef proof_system::plonk::stdlib::byte_array byte_array_t; template static std::vector to_vector(std::array, NumWords>& a32) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp index dde913c8b1e..9cf0ac5a209 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp @@ -4,7 +4,7 @@ #include "barretenberg/honk/composer/standard_honk_composer.hpp" #include -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class bit_array { @@ -185,4 +185,4 @@ EXTERN_STDLIB_TYPE(bit_array); extern template class bit_array; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp index 56af6d4e667..54b4b7439b7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp @@ -6,7 +6,7 @@ namespace test_stdlib_bit_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -21,7 +21,7 @@ typedef stdlib::byte_array byte_array; TEST(stdlib_bit_array, test_uint32_input_output_consistency) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); uint32_t a_expected = engine.get_random_uint32(); uint32_t b_expected = engine.get_random_uint32(); @@ -47,7 +47,7 @@ TEST(stdlib_bit_array, test_uint32_input_output_consistency) TEST(stdlib_bit_array, test_binary_input_output_consistency) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bit_array test_bit_array = bit_array(&composer, 5); @@ -70,7 +70,7 @@ TEST(stdlib_bit_array, test_binary_input_output_consistency) TEST(stdlib_bit_array, test_string_input_output_consistency) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); std::string expected = "string literals inside a SNARK circuit? What nonsense!"; bit_array test_bit_array = bit_array(&composer, expected); @@ -82,7 +82,7 @@ TEST(stdlib_bit_array, test_string_input_output_consistency) TEST(stdlib_bit_array, test_byte_array_conversion) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); std::string expected = "string literals inside a SNARK circuit? What nonsense!"; bit_array test_bit_array = bit_array(&composer, expected); @@ -96,7 +96,7 @@ TEST(stdlib_bit_array, test_byte_array_conversion) TEST(stdlib_bit_array, test_uint32_vector_constructor) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); uint32_t a_expected = engine.get_random_uint32(); uint32_t b_expected = engine.get_random_uint32(); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp index 46c29f632dc..204b20790e9 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp @@ -3,9 +3,9 @@ #include "barretenberg/honk/composer/standard_honk_composer.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -474,4 +474,4 @@ template bool_t bool_t class BoolFuzzBase { private: - typedef plonk::stdlib::bool_t bool_t; - typedef plonk::stdlib::witness_t witness_t; + typedef proof_system::plonk::stdlib::bool_t bool_t; + typedef proof_system::plonk::stdlib::witness_t witness_t; public: /** diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp index 87eec13232a..86ddee1e4a6 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp @@ -3,7 +3,7 @@ #include "../witness/witness.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class bool_t { @@ -77,4 +77,4 @@ EXTERN_STDLIB_TYPE(bool_t); extern template class bool_t; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp index 4e481d93af9..d080f06f108 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp @@ -6,14 +6,14 @@ namespace test_stdlib_bool { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; typedef stdlib::bool_t bool_t; typedef stdlib::witness_t witness_t; TEST(stdlib_bool, test_basic_operations) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool_t a(&composer); bool_t b(&composer); a = stdlib::witness_t(&composer, barretenberg::fr::one()); @@ -26,7 +26,7 @@ TEST(stdlib_bool, test_basic_operations) bool_t f = e ^ b; // f = 0 d = (!f) & a; // d = 1 auto prover = composer.create_prover(); - // if constexpr (Composer::type == plonk::ComposerType::STANDARD_HONK) { + // if constexpr (Composer::type == ComposerType::STANDARD_HONK) { EXPECT_EQ(prover.wire_polynomials[0][3], fr(1)); EXPECT_EQ(prover.wire_polynomials[1][3], fr(1)); EXPECT_EQ(prover.wire_polynomials[2][3], fr(1)); @@ -70,7 +70,7 @@ TEST(stdlib_bool, test_basic_operations) TEST(stdlib_bool, xor) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t j = 0; j < 4; ++j) { bool lhs_constant = (bool)(j % 2); bool rhs_constant = (bool)(j > 1 ? true : false); @@ -95,7 +95,7 @@ TEST(stdlib_bool, xor) TEST(stdlib_bool, xor_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -123,7 +123,7 @@ TEST(stdlib_bool, xor_constants) TEST(stdlib_bool, xor_twin_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool_t c; for (size_t i = 0; i < 32; ++i) { bool_t a(&composer, (i % 1) == 0); @@ -153,7 +153,7 @@ TEST(stdlib_bool, xor_twin_constants) // TEST(stdlib_bool, logical_and) // { -// honk::StandardHonkComposer composer = honk::StandardHonkComposer(); +// honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); // bool_t a = witness_t(&composer, 1); // bool_t b = witness_t(&composer, 1); // (!a) && (!b); @@ -169,7 +169,7 @@ TEST(stdlib_bool, xor_twin_constants) TEST(stdlib_bool, and) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 1)); bool_t b = witness_t(&composer, (bool)(i % 2 == 1)); @@ -186,7 +186,7 @@ TEST(stdlib_bool, and) TEST(stdlib_bool, and_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -214,7 +214,7 @@ TEST(stdlib_bool, and_constants) TEST(stdlib_bool, or) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -231,7 +231,7 @@ TEST(stdlib_bool, or) TEST(stdlib_bool, or_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -259,7 +259,7 @@ TEST(stdlib_bool, or_constants) TEST(stdlib_bool, eq) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool a_alt[32]; bool b_alt[32]; bool c_alt[32]; @@ -311,7 +311,7 @@ TEST(stdlib_bool, eq) TEST(stdlib_bool, implies) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t j = 0; j < 4; ++j) { bool lhs_constant = (bool)(j % 2); bool rhs_constant = (bool)(j > 1 ? true : false); @@ -336,7 +336,7 @@ TEST(stdlib_bool, implies) TEST(stdlib_bool, implies_both_ways) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t j = 0; j < 4; ++j) { bool lhs_constant = (bool)(j % 2); bool rhs_constant = (bool)(j > 1 ? true : false); @@ -361,7 +361,7 @@ TEST(stdlib_bool, implies_both_ways) TEST(stdlib_bool, test_simple_proof) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool_t a(&composer); bool_t b(&composer); a = stdlib::witness_t(&composer, barretenberg::fr::one()); @@ -395,7 +395,7 @@ TEST(stdlib_bool, test_simple_proof) TEST(stdlib_bool, normalize) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); auto generate_constraints = [&composer](bool value, bool is_constant, bool is_inverted) { bool_t a = is_constant ? bool_t(&composer, value) : witness_t(&composer, value); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp index d500c251f5c..d63356bc19c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp @@ -6,7 +6,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // ULTRA: Further merging with @@ -383,4 +383,4 @@ typename byte_array::byte_slice byte_array::split_byte(const INSTANTIATE_STDLIB_TYPE(byte_array); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp index d0bef67e52c..5eda8ad5c16 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp @@ -31,9 +31,9 @@ FastRandom VarianceRNG(0); */ template class ByteArrayFuzzBase { private: - typedef plonk::stdlib::byte_array byte_array_t; - typedef plonk::stdlib::field_t field_t; - typedef plonk::stdlib::safe_uint_t suint_t; + typedef proof_system::plonk::stdlib::byte_array byte_array_t; + typedef proof_system::plonk::stdlib::field_t field_t; + typedef proof_system::plonk::stdlib::safe_uint_t suint_t; template static To from_to(const From& in, const std::optional size = std::nullopt) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp index 2f0b8a676c0..44675d51cc4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp @@ -4,7 +4,7 @@ #include "../field/field.hpp" #include "../safe_uint/safe_uint.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class byte_array { @@ -106,4 +106,4 @@ EXTERN_STDLIB_TYPE(byte_array); extern template class byte_array; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp index f0ebaa919a7..bcd0631bc29 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp @@ -7,7 +7,7 @@ // ULTRATODO: make these typed tests namespace test_stdlib_byte_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; typedef honk::StandardHonkComposer Composer; typedef stdlib::bool_t bool_t; typedef stdlib::field_t field_t; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp index 34246ac63cb..8f3b986dbbb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp @@ -1,16 +1,16 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { class StandardComposer; class TurboComposer; class UltraComposer; class StandardPlonkComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace honk { +namespace proof_system::honk { class StandardHonkComposer; -} // namespace honk +} // namespace proof_system::honk #define EXTERN_STDLIB_TYPE(stdlib_type) \ extern template class stdlib_type; \ diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp index c06ea60f3ae..4fc46e4e41e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp @@ -4,11 +4,11 @@ #include "../biggroup/biggroup.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template struct bn254 { - static constexpr bonk::CurveType type = bonk::CurveType::BN254; + static constexpr proof_system::CurveType type = proof_system::CurveType::BN254; typedef barretenberg::fq fq; typedef barretenberg::fr fr; @@ -29,4 +29,4 @@ template struct bn254 { }; // namespace bn254 } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp index 76173023205..a1e1cbe3af8 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp @@ -6,11 +6,11 @@ #include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template struct secp256k1 { - static constexpr bonk::CurveType type = bonk::CurveType::SECP256K1; + static constexpr proof_system::CurveType type = proof_system::CurveType::SECP256K1; typedef ::secp256k1::fq fq; typedef ::secp256k1::fr fr; @@ -30,4 +30,4 @@ template struct secp256k1 { typedef element g1_bigfr_ct; }; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp index 87da0893dc7..6157fa34d4c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp @@ -6,11 +6,11 @@ #include "barretenberg/ecc/curves/secp256r1/secp256r1.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template struct secp256r1 { - static constexpr bonk::CurveType type = bonk::CurveType::SECP256R1; + static constexpr proof_system::CurveType type = proof_system::CurveType::SECP256R1; typedef ::secp256r1::fq fq; typedef ::secp256r1::fr fr; @@ -30,4 +30,4 @@ template struct secp256r1 { typedef element g1_bigfr_ct; }; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.cpp index 918aaff4247..2a76d248720 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.cpp @@ -4,9 +4,9 @@ #include "../composers/composers.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -981,7 +981,7 @@ field_t field_t::accumulate(const std::vector< * * If num elements is not a multiple of 3, the final gate will be padded with zero_idx wires **/ - if constexpr (ComposerContext::type == plonk::PLOOKUP) { + if constexpr (ComposerContext::type == ComposerType::PLOOKUP) { ComposerContext* ctx = nullptr; std::vector accumulator; field_t constant_term = 0; @@ -1039,7 +1039,7 @@ field_t field_t::accumulate(const std::vector< accumulating_total = witness_t(ctx, new_total); } return total.normalize(); - } else if constexpr (ComposerContext::type == plonk::TURBO) { + } else if constexpr (ComposerContext::type == ComposerType::TURBO) { field_t total(0); bool odd_number = (input.size() & 0x01UL) == 0x01ULL; @@ -1180,4 +1180,4 @@ std::vector> field_t::decompose_into_bi INSTANTIATE_STDLIB_TYPE(field_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp index 612349149f9..764d4c83030 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp @@ -119,10 +119,10 @@ FastRandom VarianceRNG(0); */ template class FieldBase { private: - typedef plonk::stdlib::bool_t bool_t; - typedef plonk::stdlib::field_t field_t; - typedef plonk::stdlib::witness_t witness_t; - typedef plonk::stdlib::public_witness_t public_witness_t; + typedef proof_system::plonk::stdlib::bool_t bool_t; + typedef proof_system::plonk::stdlib::field_t field_t; + typedef proof_system::plonk::stdlib::witness_t witness_t; + typedef proof_system::plonk::stdlib::public_witness_t public_witness_t; public: /** @@ -1027,7 +1027,7 @@ template class FieldBase { * * TEST(stdlib_field, test_construct_via_bool_t) * { - * plonk::StandardComposer composer = plonk::StandardComposer(); + * plonk::StandardComposer composer = proof_system::plonk::StandardComposer(); * field_t a(witness_t(&composer, fr(uint256_t{0xf396b678452ebf15, 0x82ae10893982638b, * 0xdf185a29c65fbf80, 0x1d18b2de99e48308}))); field_t b = a - a; field_t c(static_cast(b)); * std::cout << c.get_value() << std::endl; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp index a175f62ab98..bbe7268727d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.hpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp" #include "barretenberg/common/assert.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class bool_t; @@ -366,4 +366,4 @@ template inline std::ostream& operator<<(std::ostream EXTERN_STDLIB_TYPE(field_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp index 071ffc8a56b..b78f492e3e0 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp @@ -8,7 +8,7 @@ #include "barretenberg/plonk/composer/turbo_composer.hpp" #include "barretenberg/numeric/random/engine.hpp" -using namespace bonk; +using namespace proof_system; namespace test_stdlib_field { @@ -19,7 +19,7 @@ auto& engine = numeric::random::get_debug_engine(); template void ignore_unused(T&) {} // use to ignore unused variables in lambdas using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; template class stdlib_field : public testing::Test { typedef stdlib::bool_t bool_ct; @@ -192,7 +192,7 @@ template class stdlib_field : public testing::Test { uint64_t expected = fidget(composer); auto prover = composer.create_prover(); - if constexpr (Composer::type == plonk::ComposerType::STANDARD_HONK) { + if constexpr (Composer::type == ComposerType::STANDARD_HONK) { EXPECT_EQ(prover.wire_polynomials[2][20], fr(expected)); } else { EXPECT_EQ(prover.key->polynomial_store.get("w_3_lagrange")[18], fr(expected)); @@ -249,7 +249,7 @@ template class stdlib_field : public testing::Test { auto prover = composer.create_prover(); - if constexpr (Composer::type == plonk::ComposerType::STANDARD_HONK) { + if constexpr (Composer::type == ComposerType::STANDARD_HONK) { EXPECT_EQ(prover.wire_polynomials[2][19], fr(4181)); } else { EXPECT_EQ(prover.key->polynomial_store.get("w_3_lagrange")[17], fr(4181)); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/group.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/group.hpp index 5886cc964f8..f3cf23e1d53 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/group.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/group.hpp @@ -8,9 +8,9 @@ #include "../../hash/pedersen/pedersen.hpp" #include "../../hash/pedersen/pedersen_gates.hpp" -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; @@ -237,4 +237,4 @@ auto group::fixed_base_scalar_mul_internal(const field_t; -using field_ct = plonk::stdlib::field_t; -using group_ct = plonk::stdlib::group; +using Composer = proof_system::honk::StandardHonkComposer; +using witness_ct = proof_system::plonk::stdlib::witness_t; +using field_ct = proof_system::plonk::stdlib::field_t; +using group_ct = proof_system::plonk::stdlib::group; TEST(stdlib_group, test_fixed_base_scalar_mul) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp index d3ae520aa80..47d1d848f0e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp @@ -3,8 +3,7 @@ #include "../composers/composers.hpp" #include "../plookup/plookup.hpp" -namespace plonk { -namespace stdlib { +namespace proof_system::plonk::stdlib { /** * @brief A logical AND or XOR over a variable number of bits. @@ -90,5 +89,4 @@ field_t logic::create_logic_constraint(field_pt& a, field_pt } } INSTANTIATE_STDLIB_TYPE(logic); -} // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk::stdlib diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp index 16423d3188c..2b8b99d5603 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp @@ -1,14 +1,14 @@ #pragma once -#include "../composers/composers_fwd.hpp" -#include "../field/field.hpp" +#include "barretenberg/stdlib/primitives/composers/composers_fwd.hpp" +#include "barretenberg/stdlib/primitives/field/field.hpp" +#include "barretenberg/stdlib/primitives/witness/witness.hpp" -namespace plonk { -namespace stdlib { +namespace proof_system::plonk::stdlib { template class logic { private: - typedef field_t field_pt; - typedef witness_t witness_pt; + using field_pt = field_t; + using witness_pt = witness_t; public: static field_pt create_logic_constraint(field_pt& a, field_pt& b, size_t num_bits, bool is_xor_gate); @@ -16,5 +16,4 @@ template class logic { EXTERN_STDLIB_TYPE(logic); -} // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk::stdlib \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp index 36f0384d2d3..bf1dd73e5f0 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp @@ -8,8 +8,6 @@ #include "barretenberg/plonk/composer/turbo_composer.hpp" #include "barretenberg/numeric/random/engine.hpp" -using namespace bonk; - namespace test_stdlib_logic { namespace { @@ -19,7 +17,7 @@ auto& engine = numeric::random::get_debug_engine(); template void ignore_unused(T&) {} // use to ignore unused variables in lambdas using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; template class stdlib_logic : public testing::Test { typedef stdlib::bool_t bool_ct; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp index 94ab20d0742..66937a23baf 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp @@ -3,7 +3,7 @@ #include "../composers/composers.hpp" #include "../bool/bool.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -25,7 +25,7 @@ DynamicArray::DynamicArray(Composer* composer, const size_t maximum_si , _max_size(maximum_size) , _length(0) { - static_assert(Composer::type == plonk::ComposerType::PLOOKUP); + static_assert(Composer::type == ComposerType::PLOOKUP); ASSERT(_context != nullptr); _inner_table = ram_table(_context, maximum_size); // Initialize the ram table with all zeroes @@ -276,4 +276,4 @@ template void DynamicArray::conditional_pop(const INSTANTIATE_STDLIB_ULTRA_TYPE(DynamicArray); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp index f5d81f71ff6..0f274fe4d77 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp @@ -1,7 +1,7 @@ #pragma once #include "ram_table.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -51,4 +51,4 @@ template class DynamicArray { EXTERN_STDLIB_ULTRA_TYPE(DynamicArray); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp index 9db1d609dcf..87ff2677ab8 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp @@ -10,14 +10,14 @@ namespace test_stdlib_dynamic_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); } // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using bool_ct = stdlib::bool_t; using field_ct = stdlib::field_t; using witness_ct = stdlib::witness_t; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp index d7a3e1ac16c..f68089e229b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp @@ -2,7 +2,7 @@ #include "../composers/composers.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -13,7 +13,7 @@ namespace stdlib { */ template ram_table::ram_table(Composer* composer, const size_t table_size) { - static_assert(Composer::type == plonk::ComposerType::PLOOKUP); + static_assert(Composer::type == ComposerType::PLOOKUP); _context = composer; _length = table_size; _index_initialized.resize(table_size); @@ -35,7 +35,7 @@ template ram_table::ram_table(Composer* composer, */ template ram_table::ram_table(const std::vector& table_entries) { - static_assert(Composer::type == plonk::ComposerType::PLOOKUP); + static_assert(Composer::type == ComposerType::PLOOKUP); // get the composer _context for (const auto& entry : table_entries) { if (entry.get_context() != nullptr) { @@ -254,4 +254,4 @@ template void ram_table::write(const field_pt& ind INSTANTIATE_STDLIB_ULTRA_TYPE(ram_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp index dd94b48dde6..c8c1b085b98 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp @@ -2,7 +2,7 @@ #include "../composers/composers_fwd.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // A runtime-defined read-only memory table. Table entries must be initialized in the constructor. @@ -60,4 +60,4 @@ template class ram_table { EXTERN_STDLIB_ULTRA_TYPE(ram_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp index 9731be64986..22ba93e225c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp @@ -7,10 +7,10 @@ #include "barretenberg/plonk/composer/ultra_composer.hpp" namespace test_stdlib_ram_table { -using namespace plonk; +using namespace proof_system::plonk; // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using field_ct = stdlib::field_t; using witness_ct = stdlib::witness_t; using ram_table_ct = stdlib::ram_table; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp index d1330e804f1..53ed2a80f41 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template rom_table::rom_table(const std::vector& table_entries) @@ -124,4 +124,4 @@ template field_t rom_table::operator[](c INSTANTIATE_STDLIB_ULTRA_TYPE(rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp index 0b93992e0f6..ee3f519c2b3 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp @@ -2,7 +2,7 @@ #include "../composers/composers_fwd.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // A runtime-defined read-only memory table. Table entries must be initialized in the constructor. @@ -44,4 +44,4 @@ template class rom_table { EXTERN_STDLIB_ULTRA_TYPE(rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp index a6c8189edde..515d930271e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp @@ -8,10 +8,10 @@ namespace test_stdlib_rom_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using field_ct = stdlib::field_t; using witness_ct = stdlib::witness_t; using rom_table_ct = stdlib::rom_table; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp index 5c6b914cdbb..e8aaff2af48 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -141,4 +141,4 @@ std::array, 2> twin_rom_table::operator[](const fiel INSTANTIATE_STDLIB_ULTRA_TYPE(twin_rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp index 555fe9efc2e..24651b259a3 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp @@ -2,7 +2,7 @@ #include "../composers/composers_fwd.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // A runtime-defined read-only memory table. Table entries must be initialized in the constructor. @@ -46,4 +46,4 @@ template class twin_rom_table { EXTERN_STDLIB_ULTRA_TYPE(twin_rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp index e2dcc732379..62d0d1bb6b3 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace { @@ -271,4 +271,4 @@ template std::string packed_byte_array::get_value( INSTANTIATE_STDLIB_TYPE(packed_byte_array); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp index b1355e3a9d1..79b4b4a7971 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp @@ -5,7 +5,7 @@ #include "../byte_array/byte_array.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class packed_byte_array { @@ -69,4 +69,4 @@ EXTERN_STDLIB_TYPE(packed_byte_array); extern template class packed_byte_array; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp index 3020c6e4d89..acd8d082dfc 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp @@ -9,7 +9,7 @@ namespace test_stdlib_packed_byte_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -21,7 +21,7 @@ TEST(packed_byte_array, string_constructor_and_get_value_consistency) { std::string input = "the quick brown fox jumped over the lazy dog."; - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, input); @@ -34,7 +34,7 @@ TEST(packed_byte_array, byte_array_constructor_consistency) { std::string input = "the quick brown fox jumped over the lazy dog."; - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); byte_array arr(&composer, input); packed_byte_array converted(arr); @@ -47,7 +47,7 @@ TEST(packed_byte_array, byte_array_cast_consistency) { std::string input = "the quick brown fox jumped over the lazy dog."; - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, input); byte_array converted(arr); @@ -71,7 +71,7 @@ TEST(packed_byte_array, unverified_byte_slices) uint32s.push_back(result); } - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, bytes); @@ -94,7 +94,7 @@ TEST(packed_byte_array, check_append_uint8) bytes.push_back(engine.get_random_uint8()); } - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, bytes); // append upto size (16x) @@ -149,7 +149,7 @@ TEST(packed_byte_array, check_append_uint32) uint32s.push_back(result); } - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, bytes); // append over size (16x) (this creates new limb internally) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp index ca69c951507..ac251c7081f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp @@ -3,11 +3,11 @@ #include "barretenberg/plonk/composer/plookup_tables/plookup_tables.hpp" #include "barretenberg/plonk/composer/plookup_tables/types.hpp" -namespace plonk { +namespace proof_system::plonk { class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; @@ -91,4 +91,4 @@ field_t plookup_::read_from_1_to_2_table(const MultiTableId template class plookup_; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp index 6c468e372d5..b178032b104 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/composer/plookup_tables/types.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace plookup; @@ -30,4 +30,4 @@ extern template class plookup_; typedef plookup_ plookup_read; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp index 60c59475365..235e966a677 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp @@ -12,11 +12,11 @@ namespace test_stdlib_plookups { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; using namespace plookup; // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using field_ct = stdlib::field_t; using witness_ct = stdlib::witness_t; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/point/point.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/point/point.hpp index 5252a6ee9a8..3c1f1143208 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/point/point.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/point/point.hpp @@ -4,7 +4,7 @@ #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template struct point { @@ -69,4 +69,4 @@ template std::ostream& operator<<(std::ostream& os, point @@ -102,4 +102,4 @@ std::array, 3> safe_uint_t::slice( INSTANTIATE_STDLIB_TYPE(safe_uint_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp index a5d706dc146..32faf9c2396 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp @@ -109,11 +109,11 @@ FastRandom VarianceRNG(0); */ template class SafeUintFuzzBase { private: - typedef plonk::stdlib::bool_t bool_t; - typedef plonk::stdlib::field_t field_t; - typedef plonk::stdlib::safe_uint_t suint_t; - typedef plonk::stdlib::witness_t witness_t; - typedef plonk::stdlib::public_witness_t public_witness_t; + typedef proof_system::plonk::stdlib::bool_t bool_t; + typedef proof_system::plonk::stdlib::field_t field_t; + typedef proof_system::plonk::stdlib::safe_uint_t suint_t; + typedef proof_system::plonk::stdlib::witness_t witness_t; + typedef proof_system::plonk::stdlib::public_witness_t public_witness_t; public: /** diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp index 15d3f8ad3a2..436970d490e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp @@ -11,7 +11,7 @@ // Despite the name, it is *not* a "safe" version of the uint class - as operations are positive integer // operations, and not modulo 2^t for some t, as they are in the uint class. -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class safe_uint_t { @@ -287,4 +287,4 @@ EXTERN_STDLIB_TYPE(safe_uint_t); extern template class safe_uint_t; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp index 9e566212f4c..622e896fee2 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp @@ -11,18 +11,18 @@ namespace { auto& engine = numeric::random::get_debug_engine(); } -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace test_stdlib_safe_uint { template void ignore_unused(T&) {} // use to ignore unused variables in lambdas -using Composer = honk::StandardHonkComposer; -typedef plonk::stdlib::bool_t bool_t; -typedef plonk::stdlib::field_t field_t; -typedef plonk::stdlib::safe_uint_t suint_t; -typedef plonk::stdlib::witness_t witness_t; -typedef plonk::stdlib::public_witness_t public_witness_t; -typedef plonk::stdlib::byte_array byte_array_t; +using Composer = proof_system::honk::StandardHonkComposer; +typedef proof_system::plonk::stdlib::bool_t bool_t; +typedef proof_system::plonk::stdlib::field_t field_t; +typedef proof_system::plonk::stdlib::safe_uint_t suint_t; +typedef proof_system::plonk::stdlib::witness_t witness_t; +typedef proof_system::plonk::stdlib::public_witness_t public_witness_t; +typedef proof_system::plonk::stdlib::byte_array byte_array_t; struct verify_logic_result { bool valid; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp index f45b109bbfd..fe4ea7284f8 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp @@ -2,9 +2,9 @@ #include "uint.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -413,4 +413,4 @@ template class uint; template class uint; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp index d4ce51b983a..505ed343608 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -122,4 +122,4 @@ template class uint; template class uint; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp index 17ec3cd5664..1a13734fbe3 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp @@ -3,9 +3,9 @@ #include "uint.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -545,4 +545,4 @@ template class uint; template class uint; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp index b4da7fa0372..6f479c0aa74 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp @@ -2,9 +2,9 @@ #include "uint.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -258,4 +258,4 @@ template class uint_plookup; template class uint_plookup; template class uint_plookup; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp index 891484cddbd..8868aae3a5a 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -78,4 +78,4 @@ template class uint_plookup; template class uint_plookup; template class uint_plookup; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp index 4268611822d..db45a6f7c38 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -331,4 +331,4 @@ template class uint_plookup; template class uint_plookup; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp index 6dba609b4ed..e626d348f95 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template @@ -246,4 +246,4 @@ INSTANTIATE_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint32_t); INSTANTIATE_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint64_t); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp index 2ba26991407..14eecbaf5e9 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp @@ -5,7 +5,7 @@ #include "../../field/field.hpp" #include "../../plookup/plookup.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template class uint_plookup { @@ -178,4 +178,4 @@ EXTERN_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint32_t); EXTERN_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint64_t); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp index 6aefd17b10f..c4718048047 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp @@ -2,9 +2,9 @@ #include "../composers/composers.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -16,7 +16,7 @@ std::vector uint::constrain_accumulators(Composer* c const size_t num_bits, std::string const& msg) const { - if constexpr (Composer::type == plonk::PLOOKUP) { + if constexpr (Composer::type == ComposerType::PLOOKUP) { // TODO: manage higher bit ranges const auto sequence = plookup_read::get_lookup_accumulators(plookup::MultiTableId::UINT32_XOR, @@ -405,4 +405,4 @@ INSTANTIATE_STDLIB_BASIC_TYPE_VA(uint, uint32_t); INSTANTIATE_STDLIB_BASIC_TYPE_VA(uint, uint64_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp index ba7dcaad1ac..3d617c35ced 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp @@ -31,13 +31,13 @@ FastRandom VarianceRNG(0); */ template class UintFuzzBase { private: - typedef plonk::stdlib::bool_t bool_t; - typedef plonk::stdlib::uint uint_8_t; - typedef plonk::stdlib::uint uint_16_t; - typedef plonk::stdlib::uint uint_32_t; - typedef plonk::stdlib::uint uint_64_t; - typedef plonk::stdlib::field_t field_t; - typedef plonk::stdlib::byte_array byte_array_t; + typedef proof_system::plonk::stdlib::bool_t bool_t; + typedef proof_system::plonk::stdlib::uint uint_8_t; + typedef proof_system::plonk::stdlib::uint uint_16_t; + typedef proof_system::plonk::stdlib::uint uint_32_t; + typedef proof_system::plonk::stdlib::uint uint_64_t; + typedef proof_system::plonk::stdlib::field_t field_t; + typedef proof_system::plonk::stdlib::byte_array byte_array_t; template static To from_to(const From& in, const std::optional size = std::nullopt) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp index 1747d12599f..44f82f8b7b4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp @@ -12,7 +12,7 @@ #include "barretenberg/plonk/composer/turbo_composer.hpp" #include "barretenberg/plonk/composer/ultra_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -216,4 +216,4 @@ EXTERN_STDLIB_BASIC_TYPE_VA(uint, uint32_t); EXTERN_STDLIB_BASIC_TYPE_VA(uint, uint64_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp index 8ce1326a9a7..5b098ba4e57 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp @@ -5,8 +5,8 @@ #include "barretenberg/numeric/random/engine.hpp" using namespace barretenberg; -using namespace plonk; -using namespace bonk; +using namespace proof_system::plonk; +using namespace proof_system; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -2107,10 +2107,10 @@ TYPED_TEST(stdlib_uint, test_at) // There was one plookup-specific test in the ./plookup/uint_plookup.test.cpp TEST(stdlib_uint32, test_accumulators_plookup_uint32) { - using uint32_ct = plonk::stdlib::uint32; - using witness_ct = plonk::stdlib::witness_t; + using uint32_ct = proof_system::plonk::stdlib::uint32; + using witness_ct = proof_system::plonk::stdlib::witness_t; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); uint32_t a_val = engine.get_random_uint32(); uint32_t b_val = engine.get_random_uint32(); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp index 33fadf1bc95..a157c9022d5 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp @@ -2,7 +2,7 @@ #include "barretenberg/plonk/composer/composer_base.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // indicates whether a witness index actually contains a constant @@ -84,4 +84,4 @@ template class public_witness_t : public witness_t class Transcript { @@ -25,7 +25,7 @@ template class Transcript { using witness_pt = witness_t; using fq_pt = bigfield; using group_pt = element; - using Key = plonk::stdlib::recursion::verification_key>; + using Key = proof_system::plonk::stdlib::recursion::verification_key>; Transcript(Composer* in_context, const transcript::Manifest input_manifest) : context(in_context) @@ -404,4 +404,4 @@ template class Transcript { }; } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp index 598e91ba79a..a5d7c9ddb2b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp @@ -6,7 +6,7 @@ #include "barretenberg/transcript/transcript.hpp" -using namespace plonk; +using namespace proof_system::plonk; // ULTRATODO: Add tests for other composers too (make tests modular?) @@ -195,7 +195,7 @@ TEST(stdlib_transcript, validate_transcript) TestData data = get_test_data(); transcript::Transcript normal_transcript = get_test_base_transcript(data); - plonk::TurboComposer composer = plonk::TurboComposer(); + plonk::TurboComposer composer = proof_system::plonk::TurboComposer(); plonk::stdlib::recursion::Transcript recursive_transcript = get_circuit_transcript(&composer, data); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp index b5b448bde98..4d6dc477c4f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp @@ -3,7 +3,7 @@ #include "barretenberg/srs/reference_string/reference_string.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" -#include "barretenberg/proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" #include "barretenberg/plonk/proof_system/utils/kate_verification.hpp" #include "barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp" @@ -21,7 +21,7 @@ #include "../../hash/pedersen/pedersen_plookup.hpp" #include "../../primitives/curves/bn254.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace recursion { @@ -107,7 +107,7 @@ template struct evaluation_domain { template struct verification_key { using Composer = typename Curve::Composer; static std::shared_ptr from_witness(Composer* ctx, - const std::shared_ptr& input_key) + const std::shared_ptr& input_key) { std::shared_ptr key = std::make_shared(); // Native data: @@ -129,7 +129,7 @@ template struct verification_key { } static std::shared_ptr from_constants(Composer* ctx, - const std::shared_ptr& input_key) + const std::shared_ptr& input_key) { std::shared_ptr key = std::make_shared(); key->context = ctx; @@ -150,7 +150,7 @@ template struct verification_key { return key; } - void validate_key_is_in_set(const std::vector>& keys_in_set) + void validate_key_is_in_set(const std::vector>& keys_in_set) { const auto circuit_key_compressed = compress(); bool found = false; @@ -213,7 +213,7 @@ template struct verification_key { return compressed_key; } - barretenberg::fr compress_native(const std::shared_ptr& key) + barretenberg::fr compress_native(const std::shared_ptr& key) { barretenberg::fr compressed_domain = evaluation_domain::compress_native(key->domain); @@ -265,16 +265,16 @@ template struct verification_key { // Native data: - std::shared_ptr reference_string; + std::shared_ptr reference_string; - bonk::PolynomialManifest polynomial_manifest; + PolynomialManifest polynomial_manifest; size_t program_width = 4; - std::shared_ptr base_key; + std::shared_ptr base_key; Composer* context; }; } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp index 4fc602071a3..7b681206f41 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp @@ -4,7 +4,7 @@ #include "../transcript/transcript.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace recursion { @@ -13,17 +13,19 @@ template class recursive_ultra_verifier_settings : public plonk typedef typename Curve::fr_ct fr_ct; typedef typename Curve::g1::affine_element g1; typedef typename Curve::Composer Composer; - typedef plonk::stdlib::recursion::Transcript Transcript_pt; - typedef plonk::VerifierPermutationWidget PermutationWidget; - typedef plonk::VerifierPlookupWidget PlookupWidget; + typedef proof_system::plonk::stdlib::recursion::Transcript Transcript_pt; + typedef proof_system::plonk::VerifierPermutationWidget PermutationWidget; + typedef proof_system::plonk::VerifierPlookupWidget PlookupWidget; - typedef plonk::ultra_settings base_settings; + typedef proof_system::plonk::ultra_settings base_settings; - typedef plonk::VerifierPlookupArithmeticWidget PlookupArithmeticWidget; - typedef plonk::VerifierTurboLogicWidget TurboLogicWidget; - typedef plonk::VerifierGenPermSortWidget GenPermSortWidget; - typedef plonk::VerifierEllipticWidget EllipticWidget; - typedef plonk::VerifierPlookupAuxiliaryWidget PlookupAuxiliaryWidget; + typedef proof_system::plonk::VerifierPlookupArithmeticWidget + PlookupArithmeticWidget; + typedef proof_system::plonk::VerifierTurboLogicWidget TurboLogicWidget; + typedef proof_system::plonk::VerifierGenPermSortWidget GenPermSortWidget; + typedef proof_system::plonk::VerifierEllipticWidget EllipticWidget; + typedef proof_system::plonk::VerifierPlookupAuxiliaryWidget + PlookupAuxiliaryWidget; static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PlookupPedersenBlake3s; @@ -89,17 +91,19 @@ class recursive_ultra_to_standard_verifier_settings : public recursive_ultra_ver typedef typename Curve::fr_ct fr_ct; typedef typename Curve::g1::affine_element g1; typedef typename Curve::Composer Composer; - typedef plonk::stdlib::recursion::Transcript Transcript_pt; - typedef plonk::VerifierPermutationWidget PermutationWidget; - typedef plonk::VerifierPlookupWidget PlookupWidget; + typedef proof_system::plonk::stdlib::recursion::Transcript Transcript_pt; + typedef proof_system::plonk::VerifierPermutationWidget PermutationWidget; + typedef proof_system::plonk::VerifierPlookupWidget PlookupWidget; - typedef plonk::ultra_to_standard_settings base_settings; + typedef proof_system::plonk::ultra_to_standard_settings base_settings; - typedef plonk::VerifierPlookupArithmeticWidget PlookupArithmeticWidget; - typedef plonk::VerifierTurboLogicWidget TurboLogicWidget; - typedef plonk::VerifierGenPermSortWidget GenPermSortWidget; - typedef plonk::VerifierEllipticWidget EllipticWidget; - typedef plonk::VerifierPlookupAuxiliaryWidget PlookupAuxiliaryWidget; + typedef proof_system::plonk::VerifierPlookupArithmeticWidget + PlookupArithmeticWidget; + typedef proof_system::plonk::VerifierTurboLogicWidget TurboLogicWidget; + typedef proof_system::plonk::VerifierGenPermSortWidget GenPermSortWidget; + typedef proof_system::plonk::VerifierEllipticWidget EllipticWidget; + typedef proof_system::plonk::VerifierPlookupAuxiliaryWidget + PlookupAuxiliaryWidget; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; }; @@ -110,14 +114,16 @@ template class recursive_turbo_verifier_settings : public plonk typedef typename Curve::g1::affine_element g1; typedef typename Curve::Composer Composer; typedef Transcript Transcript_pt; - typedef plonk::VerifierPermutationWidget PermutationWidget; + typedef proof_system::plonk::VerifierPermutationWidget PermutationWidget; - typedef plonk::turbo_settings base_settings; + typedef proof_system::plonk::turbo_settings base_settings; - typedef plonk::VerifierTurboFixedBaseWidget TurboFixedBaseWidget; - typedef plonk::VerifierTurboArithmeticWidget TurboArithmeticWidget; - typedef plonk::VerifierTurboRangeWidget TurboRangeWidget; - typedef plonk::VerifierTurboLogicWidget TurboLogicWidget; + typedef proof_system::plonk::VerifierTurboFixedBaseWidget + TurboFixedBaseWidget; + typedef proof_system::plonk::VerifierTurboArithmeticWidget + TurboArithmeticWidget; + typedef proof_system::plonk::VerifierTurboRangeWidget TurboRangeWidget; + typedef proof_system::plonk::VerifierTurboLogicWidget TurboLogicWidget; static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; @@ -162,4 +168,4 @@ template class recursive_turbo_verifier_settings : public plonk } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp index 1b87e6ab440..83800640ee8 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp @@ -15,7 +15,7 @@ #include "barretenberg/ecc/curves/bn254/fq12.hpp" #include "barretenberg/ecc/curves/bn254/pairing.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace recursion { @@ -61,7 +61,7 @@ void populate_kate_element_map(typename Curve::Composer* ctx, const std::string label(item.commitment_label); const std::string poly_label(item.polynomial_label); switch (item.source) { - case bonk::PolynomialSource::WITNESS: { + case PolynomialSource::WITNESS: { const auto element = transcript.get_group_element(label); ASSERT(element.on_curve()); if (element.is_point_at_infinity()) { @@ -72,8 +72,8 @@ void populate_kate_element_map(typename Curve::Composer* ctx, kate_g1_elements.insert({ label, g1_ct::from_witness(ctx, element) }); break; } - case bonk::PolynomialSource::SELECTOR: - case bonk::PolynomialSource::PERMUTATION: { + case PolynomialSource::SELECTOR: + case PolynomialSource::PERMUTATION: { const auto element = key->commitments.at(label); // TODO: with user-defined circuits, we will need verify that the point // lies on the curve with constraints @@ -87,7 +87,7 @@ void populate_kate_element_map(typename Curve::Composer* ctx, kate_g1_elements.insert({ label, element }); break; } - case bonk::PolynomialSource::OTHER: { + case PolynomialSource::OTHER: { break; } } @@ -118,7 +118,8 @@ void populate_kate_element_map(typename Curve::Composer* ctx, fr_ct u = transcript.get_challenge_field_element("separator", 0); - fr_ct batch_evaluation = plonk::compute_kate_batch_evaluation(key, transcript); + fr_ct batch_evaluation = + proof_system::plonk::compute_kate_batch_evaluation(key, transcript); batch_opening_scalar = -batch_evaluation; kate_g1_elements.insert({ "PI_Z_OMEGA", g1_ct::from_witness(ctx, PI_Z_OMEGA) }); @@ -424,4 +425,4 @@ recursion_output verify_proof(typename Curve::Composer* context, } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp index 1a6ee080bb7..25364b23580 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp @@ -1,7 +1,7 @@ #include "verifier.hpp" #include "barretenberg/common/test.hpp" #include "barretenberg/transcript/transcript.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/ecc/curves/bn254/fq12.hpp" #include "barretenberg/ecc/curves/bn254/pairing.hpp" @@ -9,16 +9,16 @@ #include "../../hash/pedersen/pedersen.hpp" #include "program_settings.hpp" -using namespace plonk; +using namespace proof_system::plonk; template class stdlib_verifier : public testing::Test { - using InnerComposer = plonk::UltraComposer; + using InnerComposer = proof_system::plonk::UltraComposer; typedef stdlib::bn254 inner_curve; typedef stdlib::bn254 outer_curve; - typedef plonk::stdlib::recursion::verification_key verification_key_pt; - typedef plonk::stdlib::recursion::recursive_ultra_verifier_settings recursive_settings; - typedef plonk::stdlib::recursion::recursive_ultra_to_standard_verifier_settings + typedef proof_system::plonk::stdlib::recursion::verification_key verification_key_pt; + typedef proof_system::plonk::stdlib::recursion::recursive_ultra_verifier_settings recursive_settings; + typedef proof_system::plonk::stdlib::recursion::recursive_ultra_to_standard_verifier_settings ultra_to_standard_recursive_settings; typedef inner_curve::fr_ct fr_ct; typedef inner_curve::public_witness_ct public_witness_ct; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp index 61d0b55a8f0..3766296af7b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp @@ -1,7 +1,7 @@ #include "verifier.hpp" #include "barretenberg/common/test.hpp" #include "barretenberg/transcript/transcript.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/ecc/curves/bn254/fq12.hpp" #include "barretenberg/ecc/curves/bn254/pairing.hpp" @@ -9,15 +9,15 @@ #include "../../hash/pedersen/pedersen.hpp" #include "program_settings.hpp" -using namespace plonk; +using namespace proof_system::plonk; template class stdlib_verifier_turbo : public testing::Test { - using InnerComposer = plonk::TurboComposer; + using InnerComposer = proof_system::plonk::TurboComposer; typedef stdlib::bn254 inner_curve; typedef stdlib::bn254 outer_curve; - typedef plonk::stdlib::recursion::verification_key verification_key_pt; - typedef plonk::stdlib::recursion::recursive_turbo_verifier_settings recursive_settings; + typedef proof_system::plonk::stdlib::recursion::verification_key verification_key_pt; + typedef proof_system::plonk::stdlib::recursion::recursive_turbo_verifier_settings recursive_settings; typedef inner_curve::fr_ct fr_ct; typedef inner_curve::public_witness_ct public_witness_ct; typedef inner_curve::witness_ct witness_ct; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/types/types.hpp b/barretenberg/cpp/src/barretenberg/stdlib/types/types.hpp index 4fdc71e1c0e..15f524d8ed3 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/types/types.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/types/types.hpp @@ -25,37 +25,39 @@ #include "barretenberg/stdlib/primitives/memory/rom_table.hpp" #include "barretenberg/stdlib/primitives/memory/dynamic_array.hpp" -namespace plonk::stdlib::types { +namespace proof_system::plonk::stdlib::types { -using namespace plonk; -static constexpr size_t SYSTEM_COMPOSER = plonk::SYSTEM_COMPOSER; +using namespace proof_system::plonk; +static constexpr size_t SYSTEM_COMPOSER = proof_system::plonk::SYSTEM_COMPOSER; typedef std::conditional_t< - SYSTEM_COMPOSER == plonk::STANDARD, + SYSTEM_COMPOSER == proof_system::STANDARD, plonk::StandardComposer, - std::conditional_t> + std::conditional_t> Composer; -typedef std::conditional_t> +typedef std::conditional_t< + SYSTEM_COMPOSER == proof_system::STANDARD, + plonk::Prover, + std::conditional_t> Prover; typedef std::conditional_t< - SYSTEM_COMPOSER == plonk::STANDARD, + SYSTEM_COMPOSER == proof_system::STANDARD, plonk::Verifier, - std::conditional_t> + std::conditional_t> Verifier; -typedef std::conditional_t> +typedef std::conditional_t< + SYSTEM_COMPOSER == proof_system::STANDARD, + plonk::Prover, + std::conditional_t> Prover; typedef std::conditional_t< - SYSTEM_COMPOSER == plonk::STANDARD, + SYSTEM_COMPOSER == proof_system::STANDARD, plonk::Verifier, - std::conditional_t> + std::conditional_t> Verifier; typedef stdlib::witness_t witness_ct; @@ -90,9 +92,9 @@ typedef stdlib::schnorr::signature_bits signature_bits; // Ultra-composer specific types typedef stdlib::rom_table rom_table_ct; -typedef std::conditional_t, recursion::recursive_ultra_verifier_settings> recursive_inner_verifier_settings; -} // namespace plonk::stdlib::types +} // namespace proof_system::plonk::stdlib::types diff --git a/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp b/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp index 8dd72033fa1..43d47e3972d 100644 --- a/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp +++ b/barretenberg/cpp/src/barretenberg/transcript/transcript.hpp @@ -6,7 +6,7 @@ #include #include -#include "../proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" namespace transcript { @@ -39,7 +39,7 @@ class Transcript { }; public: - typedef bonk::verification_key Key; + typedef proof_system::plonk::verification_key Key; /** * Create a new transcript for Prover based on the manifest. diff --git a/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp b/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp index d11e7413ac5..b953173ae5f 100644 --- a/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/transcript/transcript.test.cpp @@ -136,7 +136,7 @@ TEST(transcript, univariate_serialization) constexpr size_t LENGTH = 8; using Fr = barretenberg::fr; - using Univariate = honk::sumcheck::Univariate; + using Univariate = proof_system::honk::sumcheck::Univariate; using Transcript = transcript::StandardTranscript; std::vector g1_vector(64);