Skip to content

Commit

Permalink
Merge branch 'master' into sync-noir
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored May 29, 2024
2 parents 2e61bda + 3f93757 commit d96d985
Show file tree
Hide file tree
Showing 95 changed files with 860 additions and 810 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ jobs:
non-misc-ci: ${{ steps.filter.outputs.non-misc-ci }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
id: filter
with:
filters: |
barretenberg:
- 'barretenberg/**'
barretenberg-cpp:
- 'barretenberg/cpp/**'
noir:
- 'noir/**'
l1-contracts:
- 'l1-contracts/**'
noir-projects:
- 'noir-projects/**'
non-docs:
- '!(docs/**)'
non-misc-ci:
- '!(.github/**)'
# Always rebuild when this file changes
- .github/workflows/ci.yml
- uses: actions/checkout@v4
with: { ref: "${{ env.GIT_COMMIT }}" }
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
id: filter
with:
filters: |
barretenberg:
- 'barretenberg/**'
barretenberg-cpp:
- 'barretenberg/cpp/**'
noir:
- 'noir/**'
l1-contracts:
- 'l1-contracts/**'
noir-projects:
- 'noir-projects/**'
non-docs:
- '!(docs/**)'
non-misc-ci:
- '!(.github/**)'
# Always rebuild when this file changes
- .github/workflows/ci.yml
build:
needs: [setup, changes]
Expand Down
4 changes: 0 additions & 4 deletions barretenberg/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ barretenberg-acir-tests-bb:
RUN FLOW=prove_and_verify_ultra_honk_program ./run_acir_tests.sh
# Fold and verify an ACIR program stack using ClientIvc
RUN FLOW=fold_and_verify_program ./run_acir_tests.sh fold_basic
# This is a "full" Goblin flow. It constructs and verifies four proofs: MegaHonk, ECCVM, Translator, and merge
RUN FLOW=prove_and_verify_goblin ./run_acir_tests.sh 6_array
# Run 1_mul through native bb build, all_cmds flow, to test all cli args.
RUN FLOW=all_cmds ./run_acir_tests.sh 1_mul

Expand Down Expand Up @@ -88,8 +86,6 @@ barretenberg-acir-tests-bb.js:
RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_ultra_honk ./run_acir_tests.sh 6_array
# Run a single arbitrary test not involving recursion through bb.js for MegaHonk
RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_mega_honk ./run_acir_tests.sh 6_array
# Run a single arbitrary test not involving recursion through bb.js for full Goblin
RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_goblin ./run_acir_tests.sh 6_array
# Run 1_mul through bb.js build, all_cmds flow, to test all cli args.
RUN BIN=../ts/dest/node/main.js FLOW=all_cmds ./run_acir_tests.sh 1_mul
# TODO(https://github.com/AztecProtocol/aztec-packages/issues/6672)
Expand Down
2 changes: 0 additions & 2 deletions barretenberg/acir_tests/Dockerfile.bb.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_ultra_honk ./run_acir_test
RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_mega_honk ./run_acir_tests.sh 6_array
# Fold and verify an ACIR program stack
RUN BIN=../ts/dest/node/main.js FLOW=fold_and_verify_program ./run_acir_tests.sh fold_basic
# Run a single arbitrary test not involving recursion through bb.js for full Goblin
RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_goblin ./run_acir_tests.sh 6_array
# Run 1_mul through bb.js build, all_cmds flow, to test all cli args.
RUN BIN=../ts/dest/node/main.js FLOW=all_cmds ./run_acir_tests.sh 1_mul
# TODO(https://github.com/AztecProtocol/aztec-packages/issues/6672)
Expand Down
9 changes: 0 additions & 9 deletions barretenberg/acir_tests/flows/prove_and_verify_goblin.sh

This file was deleted.

43 changes: 0 additions & 43 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <barretenberg/common/timer.hpp>
#include <barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp>
#include <barretenberg/dsl/acir_proofs/acir_composer.hpp>
#include <barretenberg/dsl/acir_proofs/goblin_acir_composer.hpp>
#include <barretenberg/srs/global_crs.hpp>
#include <cstdint>
#include <iostream>
Expand Down Expand Up @@ -248,45 +247,6 @@ bool foldAndVerifyProgram(const std::string& bytecodePath, const std::string& wi
return ivc.prove_and_verify();
}

/**
* @brief Proves and Verifies an ACIR circuit
*
* Communication:
* - proc_exit: A boolean value is returned indicating whether the proof is valid.
* an exit code of 0 will be returned for success and 1 for failure.
*
* @param bytecodePath Path to the file containing the serialized circuit
* @param witnessPath Path to the file containing the serialized witness
* @param recursive Whether to use recursive proof generation of non-recursive
* @return true if the proof is valid
* @return false if the proof is invalid
*/
bool proveAndVerifyGoblin(const std::string& bytecodePath, const std::string& witnessPath)
{
// TODO(https://github.com/AztecProtocol/barretenberg/issues/811): Don't hardcode dyadic circuit size. Currently set
// to max circuit size present in acir tests suite.
size_t hardcoded_bn254_dyadic_size_hack = 1 << 19;
init_bn254_crs(hardcoded_bn254_dyadic_size_hack);
size_t hardcoded_grumpkin_dyadic_size_hack = 1 << 10; // For eccvm only
init_grumpkin_crs(hardcoded_grumpkin_dyadic_size_hack);

// Populate the acir constraint system and witness from gzipped data
auto constraint_system = get_constraint_system(bytecodePath);
auto witness = get_witness(witnessPath);

// Instantiate a Goblin acir composer and construct a bberg circuit from the acir representation
acir_proofs::GoblinAcirComposer acir_composer;
acir_composer.create_circuit(constraint_system, witness);

// Generate a MegaHonk proof and a full Goblin proof
auto proof = acir_composer.accumulate_and_prove();

// Verify the MegaHonk proof and the full Goblin proof
auto verified = acir_composer.verify(proof);

return verified;
}

/**
* @brief Creates a proof for an ACIR circuit
*
Expand Down Expand Up @@ -867,9 +827,6 @@ int main(int argc, char* argv[])
if (command == "fold_and_verify_program") {
return foldAndVerifyProgram(bytecode_path, witness_path) ? 0 : 1;
}
if (command == "prove_and_verify_goblin") {
return proveAndVerifyGoblin(bytecode_path, witness_path) ? 0 : 1;
}

if (command == "prove") {
std::string output_path = get_option(args, "-o", "./proofs/proof");
Expand Down
31 changes: 0 additions & 31 deletions barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "barretenberg/common/serialize.hpp"
#include "barretenberg/common/slab_allocator.hpp"
#include "barretenberg/dsl/acir_format/acir_format.hpp"
#include "barretenberg/dsl/acir_proofs/goblin_acir_composer.hpp"
#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp"
#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp"
#include "barretenberg/srs/global_crs.hpp"
Expand All @@ -28,11 +27,6 @@ WASM_EXPORT void acir_new_acir_composer(uint32_t const* size_hint, out_ptr out)
*out = new acir_proofs::AcirComposer(ntohl(*size_hint));
}

WASM_EXPORT void acir_new_goblin_acir_composer(out_ptr out)
{
*out = new acir_proofs::GoblinAcirComposer();
}

WASM_EXPORT void acir_delete_acir_composer(in_ptr acir_composer_ptr)
{
delete reinterpret_cast<acir_proofs::AcirComposer*>(*acir_composer_ptr);
Expand Down Expand Up @@ -122,23 +116,6 @@ WASM_EXPORT void acir_prove_and_verify_mega_honk(uint8_t const* acir_vec, uint8_
*result = verifier.verify_proof(proof);
}

WASM_EXPORT void acir_goblin_prove(in_ptr acir_composer_ptr,
uint8_t const* acir_vec,
uint8_t const* witness_vec,
uint8_t** out)
{
auto acir_composer = reinterpret_cast<acir_proofs::GoblinAcirComposer*>(*acir_composer_ptr);
auto constraint_system = acir_format::circuit_buf_to_acir_format(from_buffer<std::vector<uint8_t>>(acir_vec));
auto witness = acir_format::witness_buf_to_witness_data(from_buffer<std::vector<uint8_t>>(witness_vec));

acir_composer->create_circuit(constraint_system, witness);
auto proof = acir_composer->accumulate_and_prove();
auto proof_data_buf = to_buffer</*include_size=*/true>(
proof); // template parameter needs to be set so that vector deserialization from
// buffer, which reads the size at the beginning can be done properly
*out = to_heap_buffer(proof_data_buf);
}

WASM_EXPORT void acir_load_verification_key(in_ptr acir_composer_ptr, uint8_t const* vk_buf)
{
auto acir_composer = reinterpret_cast<acir_proofs::AcirComposer*>(*acir_composer_ptr);
Expand Down Expand Up @@ -170,14 +147,6 @@ WASM_EXPORT void acir_get_proving_key(in_ptr acir_composer_ptr, uint8_t const* a
*out = to_heap_buffer(to_buffer(*pk));
}

WASM_EXPORT void acir_goblin_verify(in_ptr acir_composer_ptr, uint8_t const* proof_buf, bool* result)
{
auto acir_composer = reinterpret_cast<acir_proofs::GoblinAcirComposer*>(*acir_composer_ptr);
auto proof_data_buf = from_buffer<std::vector<uint8_t>>(proof_buf);
auto proof = from_buffer<std::vector<bb::fr>>(proof_data_buf);
*result = acir_composer->verify(proof);
}

WASM_EXPORT void acir_verify_proof(in_ptr acir_composer_ptr, uint8_t const* proof_buf, bool* result)
{
auto acir_composer = reinterpret_cast<acir_proofs::AcirComposer*>(*acir_composer_ptr);
Expand Down
18 changes: 0 additions & 18 deletions barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ WASM_EXPORT void acir_get_circuit_sizes(uint8_t const* constraint_system_buf,

WASM_EXPORT void acir_new_acir_composer(uint32_t const* size_hint, out_ptr out);

WASM_EXPORT void acir_new_goblin_acir_composer(out_ptr out);

WASM_EXPORT void acir_delete_acir_composer(in_ptr acir_composer_ptr);

WASM_EXPORT void acir_create_circuit(in_ptr acir_composer_ptr,
Expand Down Expand Up @@ -57,16 +55,6 @@ WASM_EXPORT void acir_fold_and_verify_program_stack(uint8_t const* constraint_sy
uint8_t const* witness_buf,
bool* result);

/**
* @brief Construct a full goblin proof
* @details Makes a call to accumulate to a final circuit before constructing a Goblin proof
*
*/
WASM_EXPORT void acir_goblin_prove(in_ptr acir_composer_ptr,
uint8_t const* constraint_system_buf,
uint8_t const* witness_buf,
uint8_t** out);

WASM_EXPORT void acir_load_verification_key(in_ptr acir_composer_ptr, uint8_t const* vk_buf);

WASM_EXPORT void acir_init_verification_key(in_ptr acir_composer_ptr);
Expand All @@ -77,12 +65,6 @@ WASM_EXPORT void acir_get_proving_key(in_ptr acir_composer_ptr, uint8_t const* a

WASM_EXPORT void acir_verify_proof(in_ptr acir_composer_ptr, uint8_t const* proof_buf, bool* result);

/**
* @brief Verifies a full goblin proof (and the MegaHonk proof produced by accumulation)
*
*/
WASM_EXPORT void acir_goblin_verify(in_ptr acir_composer_ptr, uint8_t const* proof_buf, bool* result);

WASM_EXPORT void acir_get_solidity_verifier(in_ptr acir_composer_ptr, out_str_buf out);

WASM_EXPORT void acir_serialize_proof_into_fields(in_ptr acir_composer_ptr,
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit d96d985

Please sign in to comment.