Skip to content

Commit

Permalink
refactor(bb): namespace proof_system=>bb (#4116)
Browse files Browse the repository at this point in the history
This is just a rename. Followups include getting rid of 'using namespace
bb;' statements where now redundant

Co-authored-by: ludamad <adam@aztecprotocol.com>
  • Loading branch information
ludamad and ludamad0 authored Jan 19, 2024
1 parent deff54c commit 7438db3
Show file tree
Hide file tree
Showing 476 changed files with 1,611 additions and 1,668 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp"

using namespace benchmark;
using namespace proof_system;
using namespace bb;

using Flavor = honk::flavor::ECCVM;
using Builder = ECCVMCircuitBuilder<Flavor>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using namespace benchmark;
using namespace bb;
using namespace proof_system;
using namespace bb;

namespace {
void goblin_full(State& state) noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

using namespace benchmark;
using namespace bb;
using namespace proof_system;
using namespace proof_system::honk::pcs::ipa;
using namespace bb;
using namespace bb::honk::pcs::ipa;
namespace {
using Curve = curve::Grumpkin;
using Fr = Curve::ScalarField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ constexpr size_t START = (MAX_GATES) >> (NUM_CIRCUITS - 1);
// constexpr size_t MAX_HASH_ROUNDS = 8192;
// constexpr size_t START_HASH_ROUNDS = 64;

using Builder = proof_system::StandardCircuitBuilder;
using Composer = proof_system::plonk::StandardComposer;
using Builder = bb::StandardCircuitBuilder;
using Composer = bb::plonk::StandardComposer;

void generate_test_plonk_circuit(Builder& builder, size_t num_gates)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

using namespace benchmark;

using StandardBuilder = proof_system::StandardCircuitBuilder;
using StandardPlonk = proof_system::plonk::StandardComposer;
using StandardBuilder = bb::StandardCircuitBuilder;
using StandardPlonk = bb::plonk::StandardComposer;

/**
* @brief Benchmark: Construction of a Standard proof for a circuit determined by the provided circuit function
*/
static void construct_proof_standard_power_of_2(State& state) noexcept
{
auto log2_of_gates = static_cast<size_t>(state.range(0));
bench_utils::construct_proof_with_specified_num_iterations<proof_system::plonk::StandardComposer>(
state, &bench_utils::generate_basic_arithmetic_circuit<proof_system::StandardCircuitBuilder>, log2_of_gates);
bench_utils::construct_proof_with_specified_num_iterations<bb::plonk::StandardComposer>(
state, &bench_utils::generate_basic_arithmetic_circuit<bb::StandardCircuitBuilder>, log2_of_gates);
}

BENCHMARK(construct_proof_standard_power_of_2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

using namespace benchmark;

namespace proof_system::honk {
namespace bb::honk {
using Flavor = flavor::Ultra;
using Instance = ProverInstance_<Flavor>;
using Instances = ProverInstances_<Flavor, 2>;
Expand Down Expand Up @@ -38,4 +38,4 @@ void fold_one(State& state) noexcept
}

BENCHMARK(fold_one)->/* vary the circuit size */ DenseRange(14, 20)->Unit(kMillisecond);
} // namespace proof_system::honk
} // namespace bb::honk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using FF = bb::fr;
using bb::BarycentricData;
using bb::Univariate;

namespace proof_system::benchmark {
namespace bb::benchmark {

void extend_2_to_6(State& state) noexcept
{
Expand All @@ -23,4 +23,4 @@ void extend_2_to_6(State& state) noexcept
}
BENCHMARK(extend_2_to_6);

} // namespace proof_system::benchmark
} // namespace bb::benchmark
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace {
auto& engine = numeric::random::get_debug_engine();
}

using namespace proof_system::honk::sumcheck;
using namespace bb::honk::sumcheck;

namespace proof_system::benchmark::relations {
namespace bb::benchmark::relations {

using Fr = bb::fr;
using Fq = grumpkin::fr;
Expand All @@ -21,7 +21,7 @@ template <typename Flavor, typename Relation> void execute_relation(::benchmark:
using AllValues = typename Flavor::AllValues;
using SumcheckArrayOfValuesOverSubrelations = typename Relation::SumcheckArrayOfValuesOverSubrelations;

auto params = proof_system::RelationParameters<FF>::get_random();
auto params = bb::RelationParameters<FF>::get_random();

// Extract an array containing all the polynomial evaluations at a given row i
AllValues new_value{};
Expand Down Expand Up @@ -56,4 +56,4 @@ BENCHMARK(execute_relation<honk::flavor::ECCVM, ECCVMSetRelation<Fq>>);
BENCHMARK(execute_relation<honk::flavor::ECCVM, ECCVMTranscriptRelation<Fq>>);
BENCHMARK(execute_relation<honk::flavor::ECCVM, ECCVMWnafRelation<Fq>>);

} // namespace proof_system::benchmark::relations
} // namespace bb::benchmark::relations
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ namespace bench_utils {
*/
template <typename Builder> void generate_basic_arithmetic_circuit(Builder& builder, size_t log2_num_gates)
{
proof_system::plonk::stdlib::field_t a(proof_system::plonk::stdlib::witness_t(&builder, bb::fr::random_element()));
proof_system::plonk::stdlib::field_t b(proof_system::plonk::stdlib::witness_t(&builder, bb::fr::random_element()));
proof_system::plonk::stdlib::field_t c(&builder);
bb::plonk::stdlib::field_t a(bb::plonk::stdlib::witness_t(&builder, bb::fr::random_element()));
bb::plonk::stdlib::field_t b(bb::plonk::stdlib::witness_t(&builder, bb::fr::random_element()));
bb::plonk::stdlib::field_t c(&builder);
size_t passes = (1UL << log2_num_gates) / 4 - 4;
if (static_cast<int>(passes) <= 0) {
throw std::runtime_error("too few gates");
Expand All @@ -58,9 +58,9 @@ template <typename Builder> void generate_sha256_test_circuit(Builder& builder,
{
std::string in;
in.resize(32);
proof_system::plonk::stdlib::packed_byte_array<Builder> input(&builder, in);
bb::plonk::stdlib::packed_byte_array<Builder> input(&builder, in);
for (size_t i = 0; i < num_iterations; i++) {
input = proof_system::plonk::stdlib::sha256<Builder>(input);
input = bb::plonk::stdlib::sha256<Builder>(input);
}
}

Expand All @@ -74,9 +74,9 @@ template <typename Builder> void generate_keccak_test_circuit(Builder& builder,
{
std::string in = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01";

proof_system::plonk::stdlib::byte_array<Builder> input(&builder, in);
bb::plonk::stdlib::byte_array<Builder> input(&builder, in);
for (size_t i = 0; i < num_iterations; i++) {
input = proof_system::plonk::stdlib::keccak<Builder>::hash(input);
input = bb::plonk::stdlib::keccak<Builder>::hash(input);
}
}

Expand All @@ -88,7 +88,7 @@ template <typename Builder> void generate_keccak_test_circuit(Builder& builder,
*/
template <typename Builder> void generate_ecdsa_verification_test_circuit(Builder& builder, size_t num_iterations)
{
using curve = proof_system::plonk::stdlib::secp256k1<Builder>;
using curve = bb::plonk::stdlib::secp256k1<Builder>;
using fr = typename curve::fr;
using fq = typename curve::fq;
using g1 = typename curve::g1;
Expand All @@ -114,19 +114,18 @@ template <typename Builder> void generate_ecdsa_verification_test_circuit(Builde

typename curve::g1_bigfr_ct public_key = curve::g1_bigfr_ct::from_witness(&builder, account.public_key);

proof_system::plonk::stdlib::ecdsa::signature<Builder> sig{ typename curve::byte_array_ct(&builder, rr),
typename curve::byte_array_ct(&builder, ss),
proof_system::plonk::stdlib::uint8<Builder>(
&builder, vv) };
bb::plonk::stdlib::ecdsa::signature<Builder> sig{ typename curve::byte_array_ct(&builder, rr),
typename curve::byte_array_ct(&builder, ss),
bb::plonk::stdlib::uint8<Builder>(&builder, vv) };

typename curve::byte_array_ct message(&builder, message_string);

// Verify ecdsa signature
proof_system::plonk::stdlib::ecdsa::verify_signature<Builder,
curve,
typename curve::fq_ct,
typename curve::bigfr_ct,
typename curve::g1_bigfr_ct>(message, public_key, sig);
bb::plonk::stdlib::ecdsa::verify_signature<Builder,
curve,
typename curve::fq_ct,
typename curve::bigfr_ct,
typename curve::g1_bigfr_ct>(message, public_key, sig);
}
}

Expand All @@ -138,7 +137,7 @@ template <typename Builder> void generate_ecdsa_verification_test_circuit(Builde
*/
template <typename Builder> void generate_merkle_membership_test_circuit(Builder& builder, size_t num_iterations)
{
using namespace proof_system::plonk::stdlib;
using namespace bb::plonk::stdlib;
using field_ct = field_t<Builder>;
using witness_ct = witness_t<Builder>;
using witness_ct = witness_t<Builder>;
Expand All @@ -165,35 +164,33 @@ template <typename Builder> void generate_merkle_membership_test_circuit(Builder
}

// ultrahonk
inline proof_system::honk::UltraProver get_prover(
proof_system::honk::UltraComposer& composer,
void (*test_circuit_function)(proof_system::honk::UltraComposer::CircuitBuilder&, size_t),
size_t num_iterations)
inline bb::honk::UltraProver get_prover(bb::honk::UltraComposer& composer,
void (*test_circuit_function)(bb::honk::UltraComposer::CircuitBuilder&, size_t),
size_t num_iterations)
{
proof_system::honk::UltraComposer::CircuitBuilder builder;
bb::honk::UltraComposer::CircuitBuilder builder;
test_circuit_function(builder, num_iterations);
std::shared_ptr<proof_system::honk::UltraComposer::Instance> instance = composer.create_instance(builder);
std::shared_ptr<bb::honk::UltraComposer::Instance> instance = composer.create_instance(builder);
return composer.create_prover(instance);
}

// standard plonk
inline proof_system::plonk::Prover get_prover(proof_system::plonk::StandardComposer& composer,
void (*test_circuit_function)(proof_system::StandardCircuitBuilder&,
size_t),
size_t num_iterations)
inline bb::plonk::Prover get_prover(bb::plonk::StandardComposer& composer,
void (*test_circuit_function)(bb::StandardCircuitBuilder&, size_t),
size_t num_iterations)
{
proof_system::StandardCircuitBuilder builder;
bb::StandardCircuitBuilder builder;
test_circuit_function(builder, num_iterations);
return composer.create_prover(builder);
}

// ultraplonk
inline proof_system::plonk::UltraProver get_prover(
proof_system::plonk::UltraComposer& composer,
void (*test_circuit_function)(proof_system::honk::UltraComposer::CircuitBuilder&, size_t),
size_t num_iterations)
inline bb::plonk::UltraProver get_prover(bb::plonk::UltraComposer& composer,
void (*test_circuit_function)(bb::honk::UltraComposer::CircuitBuilder&,
size_t),
size_t num_iterations)
{
proof_system::plonk::UltraComposer::CircuitBuilder builder;
bb::plonk::UltraComposer::CircuitBuilder builder;
test_circuit_function(builder, num_iterations);
return composer.create_prover(builder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "barretenberg/ultra_honk/ultra_composer.hpp"

using namespace benchmark;
using namespace proof_system;
using namespace bb;

/**
* @brief Benchmark: Construction of a Ultra Honk proof for a circuit determined by the provided circuit function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "barretenberg/ultra_honk/ultra_prover.hpp"

using namespace benchmark;
using namespace proof_system;
using namespace bb;

// The rounds to measure
enum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace proof_system;
using namespace bb;

/**
* @brief Benchmark: Construction of a Ultra Plonk proof for a circuit determined by the provided circuit function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace proof_system;
using namespace bb;

// The rounds to measure
enum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace {
auto& engine = numeric::random::get_debug_engine();
}

namespace proof_system::plonk {
namespace bb::plonk {

#ifdef GET_PER_ROW_TIME
constexpr size_t LARGE_DOMAIN_SIZE = 4;
Expand Down Expand Up @@ -113,4 +113,4 @@ BENCHMARK(accumulate_contribution<ProverGenPermSortWidget<ultra_settings>>);
BENCHMARK(accumulate_contribution<ProverEllipticWidget<ultra_settings>>);
BENCHMARK(accumulate_contribution<ProverPlookupAuxiliaryWidget<ultra_settings>>);

} // namespace proof_system::plonk
} // namespace bb::plonk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"

namespace proof_system::honk::pcs {
namespace bb::honk::pcs {
/**
* @brief Opening pair (r,v) for some witness polynomial p(X) such that p(r) = v
*
Expand Down Expand Up @@ -72,4 +72,4 @@ template <typename Curve> class OpeningClaim {

bool operator==(const OpeningClaim& other) const = default;
};
} // namespace proof_system::honk::pcs
} // namespace bb::honk::pcs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <memory>
#include <string_view>

namespace proof_system::honk::pcs {
namespace bb::honk::pcs {

/**
* @brief CommitmentKey object over a pairing group 𝔾₁.
Expand Down Expand Up @@ -74,4 +74,4 @@ template <class Curve> class CommitmentKey {
std::shared_ptr<bb::srs::factories::ProverCrs<Curve>> srs;
};

} // namespace proof_system::honk::pcs
} // namespace bb::honk::pcs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <gtest/gtest.h>

namespace proof_system::honk::pcs {
namespace bb::honk::pcs {

template <class CK> inline std::shared_ptr<CK> CreateCommitmentKey();

Expand Down Expand Up @@ -206,4 +206,4 @@ using IpaCommitmentSchemeParams = ::testing::Types<curve::Grumpkin>;
// using CommitmentSchemeParams =
// ::testing::Types<fake::Params<bb::g1>, fake::Params<grumpkin::g1>, kzg::Params>;

} // namespace proof_system::honk::pcs
} // namespace bb::honk::pcs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* The verifier is able to computed the simulated commitments to A₀₊(X) and A₀₋(X)
* since they are linear-combinations of the commitments [fⱼ] and [gⱼ].
*/
namespace proof_system::honk::pcs::gemini {
namespace bb::honk::pcs::gemini {

/**
* @brief Computes d-1 fold polynomials Fold_i, i = 1, ..., d-1
Expand Down Expand Up @@ -188,4 +188,4 @@ ProverOutput<Curve> GeminiProver_<Curve>::compute_fold_polynomial_evaluations(

template class GeminiProver_<curve::BN254>;
template class GeminiProver_<curve::Grumpkin>;
}; // namespace proof_system::honk::pcs::gemini
}; // namespace bb::honk::pcs::gemini
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* The verifier is able to computed the simulated commitments to A₀₊(X) and A₀₋(X)
* since they are linear-combinations of the commitments [fⱼ] and [gⱼ].
*/
namespace proof_system::honk::pcs::gemini {
namespace bb::honk::pcs::gemini {

/**
* @brief Prover output (evalutation pair, witness) that can be passed on to Shplonk batch opening.
Expand Down Expand Up @@ -109,7 +109,7 @@ template <typename Curve> class GeminiProver_ {
static ProverOutput<Curve> compute_fold_polynomial_evaluations(std::span<const Fr> mle_opening_point,
std::vector<Polynomial>&& gemini_polynomials,
const Fr& r_challenge);
}; // namespace proof_system::honk::pcs::gemini
}; // namespace bb::honk::pcs::gemini

template <typename Curve> class GeminiVerifier_ {
using Fr = typename Curve::ScalarField;
Expand Down Expand Up @@ -262,6 +262,6 @@ template <typename Curve> class GeminiVerifier_ {
return { C0_r_pos, C0_r_neg };
}

}; // namespace proof_system::honk::pcs::gemini
}; // namespace bb::honk::pcs::gemini

} // namespace proof_system::honk::pcs::gemini
} // namespace bb::honk::pcs::gemini
Loading

0 comments on commit 7438db3

Please sign in to comment.