Skip to content

Commit

Permalink
Merge branch 'master' into mm/pg-verifier-circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
maramihali committed Jan 19, 2024
2 parents 06089f7 + ed71a57 commit a86f207
Show file tree
Hide file tree
Showing 716 changed files with 6,551 additions and 4,877 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
23 changes: 0 additions & 23 deletions .github/workflows/mirror_repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,8 @@ on:
- cron: "0 2 * * *"

jobs:
mirror-to-build-system-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
- name: Push to build-system repo
run: |
SUBREPO_PATH=build-system
git config --global user.name AztecBot
git config --global user.email [email protected]
if ./scripts/git_subrepo.sh push $SUBREPO_PATH --branch=master; then
git fetch # in case a commit came after this
git rebase origin/master
git commit --amend -m "$(git log -1 --pretty=%B) [skip ci]"
git push
fi
mirror-to-barretenberg-repo:
runs-on: ubuntu-latest
# Force sequential.
needs: mirror-to-build-system-repo
steps:
- name: Checkout
uses: actions/checkout@v3
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ All the packages that make up [Aztec](https://docs.aztec.network).

## Issues Board

All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/aztec/milestones) section of our docs.
All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/about_aztec/roadmap/main) section of our docs.

## Development Setup

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 = 4f7bac9189d6b75b9591ecad688f964646783e2b
parent = 50b4a728b4c20503f6ab56c07feaa29d767cec10
commit = f01329ccb7a07c8828a06a19d0a4d77d3f89087a
parent = b77afb14c609cfc04663a318eecaa8cbd3b2fa85
method = merge
cmdver = 0.4.6
3 changes: 2 additions & 1 deletion barretenberg/cpp/scripts/ci/upload_benchmarks_to_s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ elif [ -n "${PULL_REQUEST:-}" ]; then
TARGET_FOLDER="barretenberg-bench-v1/pulls/${PULL_REQUEST##*/}"
else
echo Skipping upload since no target folder was defined
exit
fi
echo "Uploading to s3://$BUCKET_NAME/$TARGET_FOLDER"
aws s3 cp extracted-repo/src/barretenberg/cpp/build/ultra_honk_rounds_bench.json "s3://$BUCKET_NAME/$TARGET_FOLDER/ultra_honk_rounds_bench.json"
aws s3 cp extracted-repo/src/barretenberg/cpp/build/ultra_honk_rounds_bench.json "s3://$BUCKET_NAME/$TARGET_FOLDER/ultra_honk_rounds_bench.json"
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
Loading

0 comments on commit a86f207

Please sign in to comment.