Skip to content

Commit

Permalink
Merge branch 'master' into jc/dev-landing-page
Browse files Browse the repository at this point in the history
  • Loading branch information
critesjosh authored Jan 19, 2024
2 parents cf20f64 + 3b82be0 commit 8127b86
Show file tree
Hide file tree
Showing 546 changed files with 3,607 additions and 2,913 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,11 @@ jobs:
command: |
should_release || exit 0
yarn-project/deploy_npm.sh canary
- run:
name: "Release latest to NPM: bb.js"
command: |
should_release || exit 0
deploy_npm bb.js latest
- run:
name: "Release latest to NPM: yarn-project"
command: |
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/publish-bb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/* /usr/local/lib/
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/share/* /usr/local/share/
- name: Install yarn
- name: Install yarn # Needed to call 'yarn build' on barretenberg/ts
run: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Expand All @@ -104,7 +104,7 @@ jobs:
./scripts/install-wasi-sdk.sh
- name: Compile Typescript
- name: Compile Typescript # Compiles bb.js and wasms
run: |
cd barretenberg/ts
yarn install && yarn && yarn build
Expand All @@ -117,19 +117,19 @@ jobs:
working-directory: barretenberg/cpp/build-wasm/bin
run: tar -cvzf acvm_backend.wasm.tar.gz acvm_backend.wasm

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"

- name: Deploy Typescript to NPM
if: github.event.inputs.tag != 'nightly' && github.event.inputs.tag != '' # Do not deploy to npm if it is a nightly build
run: |
cd barretenberg/ts
yarn deploy
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# - name: Setup Node.js
# uses: actions/setup-node@v2
# with:
# node-version: "18"
# registry-url: "https://registry.npmjs.org"

# - name: Deploy Typescript to NPM
# if: github.event.inputs.tag != 'nightly' && github.event.inputs.tag != '' # Do not deploy to npm if it is a nightly build
# run: |
# cd barretenberg/ts
# yarn deploy
# env:
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down
4 changes: 2 additions & 2 deletions barretenberg/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/AztecProtocol/barretenberg
branch = master
commit = ee6b91e5ecd6bc57dd83834d27442008672dbddb
parent = 04f8e0dfde5a3d4f54621726891aedc071212a8a
commit = f01329ccb7a07c8828a06a19d0a4d77d3f89087a
parent = b77afb14c609cfc04663a318eecaa8cbd3b2fa85
method = merge
cmdver = 0.4.6
2 changes: 1 addition & 1 deletion barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# barretenberg
# copyright 2019 Spilsbury Holdings Ltd

cmake_minimum_required(VERSION 3.24)
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)

project(
Barretenberg
Expand Down
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,14 +12,14 @@ 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)
{
plonk::stdlib::field_t a(plonk::stdlib::witness_t(&builder, bb::fr::random_element()));
plonk::stdlib::field_t b(plonk::stdlib::witness_t(&builder, bb::fr::random_element()));
plonk::stdlib::field_t c(&builder);
stdlib::field_t a(stdlib::witness_t(&builder, bb::fr::random_element()));
stdlib::field_t b(stdlib::witness_t(&builder, bb::fr::random_element()));
stdlib::field_t c(&builder);
for (size_t i = 0; i < (num_gates / 4) - 4; ++i) {
c = a + b;
c = a * c;
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::stdlib::field_t a(bb::stdlib::witness_t(&builder, bb::fr::random_element()));
bb::stdlib::field_t b(bb::stdlib::witness_t(&builder, bb::fr::random_element()));
bb::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::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::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::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::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::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::stdlib::ecdsa::signature<Builder> sig{ typename curve::byte_array_ct(&builder, rr),
typename curve::byte_array_ct(&builder, ss),
bb::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::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::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
Loading

0 comments on commit 8127b86

Please sign in to comment.