Skip to content

Commit

Permalink
refactor: Meld flavor and and circuit builder modules (#5406)
Browse files Browse the repository at this point in the history
The proof_system module has become a pile of things, and the name is
useless. The PR resolves that and moves us toward a model where flavor
and circuit builders live side-by-side since this is how we implement
check_circuit.

Split proof_system module.
 
 - Ultra & GoblinUltra go into into stdlib_circuit_builders
- VM trace builders go into single folder alongside other stuff (no
stdlib dependency, so little benefit to building separately)
- Library stuff goes into plonk_honk_shared (library stuff); will
refactor when Plonk moves out.
 - Polynomials module gets the polynomial store.

We also simplify a little bit of the linking structure.
New module structure:
![barretenberg_modules](https://github.com/AztecProtocol/aztec-packages/assets/26756572/a773b29d-370a-434e-baa7-7d9780942a28)
  • Loading branch information
codygunton authored Mar 25, 2024
1 parent 2136a66 commit f0d9d1b
Show file tree
Hide file tree
Showing 238 changed files with 1,164 additions and 1,128 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_test barretenberg-x86_64-linux-clang-assert 32 ./scripts/run_tests 1 proof_system_tests
command: cond_spot_run_test barretenberg-x86_64-linux-clang-assert 32 ./scripts/run_tests 1 stdlib_circuit_builders_tests
aztec_manifest_key: barretenberg-x86_64-linux-clang-assert

barretenberg-stdlib-plonk-recursion-ultra-tests:
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.cache/
build*/
src/wasi-sdk*
src/barretenberg/proof_system/proving_key/fixtures
src/barretenberg/plonk_honk_shared/proving_key/fixtures
src/barretenberg/rollup/proofs/*/fixtures
srs_db/*/*/transcript*
srs_db/*/bn254_g*
Expand Down
1 change: 1 addition & 0 deletions barretenberg/cpp/scripts/bb-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ TESTS=(
sumcheck_tests
eccvm_tests
translator_vm_tests
plonk_honk_shared_tests
protogalaxy_tests
ultra_honk_tests
goblin_tests
Expand Down
8 changes: 6 additions & 2 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,23 @@ add_subdirectory(barretenberg/dsl)
add_subdirectory(barretenberg/ecc)
add_subdirectory(barretenberg/eccvm)
add_subdirectory(barretenberg/env)
add_subdirectory(barretenberg/execution_trace)
add_subdirectory(barretenberg/examples)
add_subdirectory(barretenberg/flavor)
add_subdirectory(barretenberg/goblin)
add_subdirectory(barretenberg/grumpkin_srs_gen)
add_subdirectory(barretenberg/honk)
add_subdirectory(barretenberg/numeric)
add_subdirectory(barretenberg/plonk)
add_subdirectory(barretenberg/plonk_honk_shared)
add_subdirectory(barretenberg/polynomials)
add_subdirectory(barretenberg/proof_system)
add_subdirectory(barretenberg/protogalaxy)
add_subdirectory(barretenberg/relations)
add_subdirectory(barretenberg/serialize)
add_subdirectory(barretenberg/solidity_helpers)
add_subdirectory(barretenberg/srs)
add_subdirectory(barretenberg/stdlib)
add_subdirectory(barretenberg/stdlib_circuit_builders)
add_subdirectory(barretenberg/sumcheck)
add_subdirectory(barretenberg/transcript)
add_subdirectory(barretenberg/translator_vm)
Expand Down Expand Up @@ -115,20 +117,22 @@ set(BARRETENBERG_TARGET_OBJECTS
$<TARGET_OBJECTS:dsl_objects>
$<TARGET_OBJECTS:ecc_objects>
$<TARGET_OBJECTS:eccvm_objects>
$<TARGET_OBJECTS:execution_trace_objects>
$<TARGET_OBJECTS:simple_example_objects>
$<TARGET_OBJECTS:flavor_objects>
$<TARGET_OBJECTS:goblin_objects>
$<TARGET_OBJECTS:honk_objects>
$<TARGET_OBJECTS:numeric_objects>
$<TARGET_OBJECTS:plonk_objects>
$<TARGET_OBJECTS:plonk_honk_shared_objects>
$<TARGET_OBJECTS:polynomials_objects>
$<TARGET_OBJECTS:proof_system_objects>
$<TARGET_OBJECTS:protogalaxy_objects>
$<TARGET_OBJECTS:relations_objects>
$<TARGET_OBJECTS:srs_objects>
$<TARGET_OBJECTS:stdlib_aes128_objects>
$<TARGET_OBJECTS:stdlib_blake2s_objects>
$<TARGET_OBJECTS:stdlib_blake3s_objects>
$<TARGET_OBJECTS:stdlib_circuit_builders_objects>
$<TARGET_OBJECTS:stdlib_keccak_objects>
$<TARGET_OBJECTS:crypto_merkle_tree_objects>
$<TARGET_OBJECTS:stdlib_pedersen_commitment_objects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "barretenberg/common/op_count.hpp"
#include "barretenberg/common/op_count_google_bench.hpp"
#include "barretenberg/goblin/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include "barretenberg/ultra_honk/ultra_verifier.hpp"

using namespace benchmark;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
barretenberg_module(goblin_bench eccvm stdlib_honk_recursion stdlib_sha256 crypto_merkle_tree)
barretenberg_module(goblin_bench eccvm translator_vm stdlib_honk_recursion stdlib_sha256 crypto_merkle_tree)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <benchmark/benchmark.h>

#include "barretenberg/eccvm/eccvm_circuit_builder.hpp"
#include "barretenberg/eccvm/eccvm_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp"

using namespace benchmark;
using namespace bb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "barretenberg/common/op_count_google_bench.hpp"
#include "barretenberg/goblin/goblin.hpp"
#include "barretenberg/goblin/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace bb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"

#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

#include <chrono>
#include <cstdlib>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp"
#include <benchmark/benchmark.h>

using namespace benchmark;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/benchmark/ultra_bench/mock_circuits.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp"

using namespace benchmark;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <benchmark/benchmark.h>

#include "barretenberg/proof_system/circuit_builder/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/protogalaxy/protogalaxy_prover.hpp"
#include "barretenberg/stdlib_circuit_builders/mock_circuits.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include "barretenberg/sumcheck/instance/instances.hpp"
#include "barretenberg/sumcheck/instance/prover_instance.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <benchmark/benchmark.h>

#include "barretenberg/proof_system/circuit_builder/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/protogalaxy/protogalaxy_prover.hpp"
#include "barretenberg/stdlib_circuit_builders/mock_circuits.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include "barretenberg/sumcheck/instance/instances.hpp"

using namespace benchmark;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
barretenberg_module(relations_bench proof_system transcript)
barretenberg_module(relations_bench stdlib_circuit_builders transcript)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "barretenberg/flavor/ecc_vm.hpp"
#include "barretenberg/flavor/goblin_translator.hpp"
#include "barretenberg/flavor/goblin_ultra.hpp"
#include "barretenberg/flavor/ultra.hpp"
#include "barretenberg/eccvm/eccvm_flavor.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp"
#include "barretenberg/translator_vm/goblin_translator_flavor.hpp"
#include <benchmark/benchmark.h>

namespace {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/ultra_bench/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace bb;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/ultra_bench/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace bb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "barretenberg/benchmark/ultra_bench/mock_circuits.hpp"
#include "barretenberg/common/op_count_google_bench.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include "barretenberg/ultra_honk/ultra_prover.hpp"

using namespace benchmark;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/benchmark/ultra_bench/mock_circuits.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace bb;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/ultra_bench/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

using namespace benchmark;
using namespace bb;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
barretenberg_module(widgets_bench polynomials proof_system transcript stdlib_primitives plonk)
barretenberg_module(widgets_bench polynomials transcript stdlib_primitives plonk)
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "barretenberg/benchmark/ultra_bench/mock_circuits.hpp"
#include "barretenberg/flavor/goblin_ultra.hpp"
#include "barretenberg/flavor/ultra.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"
#include "barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp"
Expand All @@ -9,6 +7,8 @@
#include "barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp"
#include "barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp"
#include "barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp"

// The widgets are implemented in a non-uniform way where the transition widgets provide a per-row execution function
// `accumulate_contribution` while the random widgets do not. Defining this preprocessor variable allows to derive a
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
barretenberg_module(circuit_checker proof_system flavor)
barretenberg_module(circuit_checker stdlib_circuit_builders)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "barretenberg/circuit_checker/standard_circuit_checker.hpp"
#include "barretenberg/circuit_checker/ultra_circuit_checker.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

#include <optional>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/stdlib/primitives/bigfield/constants.hpp"
#include <gtest/gtest.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/crypto/generators/generator_data.hpp"
#include "barretenberg/crypto/pedersen_commitment/pedersen.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp"

#include <optional>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/crypto/pedersen_commitment/pedersen.hpp"
#include <gtest/gtest.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ultra_circuit_checker.hpp"
#include "barretenberg/flavor/goblin_ultra.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp"
#include <barretenberg/plonk/proof_system/constants.hpp>
#include <unordered_set>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#pragma once
#include "barretenberg/flavor/ultra.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/relations/auxiliary_relation.hpp"
#include "barretenberg/relations/delta_range_constraint_relation.hpp"
#include "barretenberg/relations/ecc_op_queue_relation.hpp"
Expand All @@ -10,6 +7,9 @@
#include "barretenberg/relations/poseidon2_internal_relation.hpp"
#include "barretenberg/relations/relation_parameters.hpp"
#include "barretenberg/relations/ultra_arithmetic_relation.hpp"
#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp"

#include <optional>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "barretenberg/client_ivc/client_ivc.hpp"
#include "barretenberg/goblin/goblin.hpp"
#include "barretenberg/goblin/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

#include <gtest/gtest.h>
using namespace bb;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "barretenberg/client_ivc/client_ivc.hpp"
#include "barretenberg/goblin/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp"

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/common/fuzzer.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/numeric/uint256/uint256.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp"
#include <concepts>

// NOLINTBEGIN(cppcoreguidelines-macro-usage, google-runtime-int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ barretenberg_module(
stdlib_primitives
stdlib_blake3s
stdlib_pedersen_hash
circuit_checker
crypto_poseidon2
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <gtest/gtest.h>

#include "barretenberg/crypto/merkle_tree/membership.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

using namespace bb;
using namespace bb::crypto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "merkle_tree.hpp"

#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"

using namespace bb;
using namespace bb::crypto::merkle_tree;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "acir_format.hpp"
#include "barretenberg/common/log.hpp"
#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#include <cstddef>

namespace acir_format {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "barretenberg/dsl/acir_format/recursion_constraint.hpp"
#include "barretenberg/dsl/acir_format/schnorr_verify.hpp"
#include "barretenberg/dsl/acir_format/sha256_constraint.hpp"
#include "barretenberg/proof_system/arithmetization/gate_data.hpp"
#include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp"
#include "serde/index.hpp"
#include <iterator>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
#include "barretenberg/ecc/groups/affine_element.hpp"
#include "barretenberg/proof_system/arithmetization/gate_data.hpp"
#include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp"

namespace acir_format {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "barretenberg/dsl/types.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
#include "barretenberg/proof_system/arithmetization/gate_data.hpp"
#include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp"

namespace acir_format {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "barretenberg/ecc/curves/bn254/bn254.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp"
#include "barretenberg/polynomials/univariate.hpp"
#include "barretenberg/proof_system/types/circuit_type.hpp"

namespace bb::field_conversion {

Expand Down
Loading

0 comments on commit f0d9d1b

Please sign in to comment.