diff --git a/.circleci/config.yml b/.circleci/config.yml index fc233739e35..d7521495d85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/barretenberg/cpp/.gitignore b/barretenberg/cpp/.gitignore index a22d3fc9ce9..4db1b767cef 100644 --- a/barretenberg/cpp/.gitignore +++ b/barretenberg/cpp/.gitignore @@ -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* diff --git a/barretenberg/cpp/scripts/bb-tests.sh b/barretenberg/cpp/scripts/bb-tests.sh index 2106841e88b..c93712ba995 100755 --- a/barretenberg/cpp/scripts/bb-tests.sh +++ b/barretenberg/cpp/scripts/bb-tests.sh @@ -18,6 +18,7 @@ TESTS=( sumcheck_tests eccvm_tests translator_vm_tests + plonk_honk_shared_tests protogalaxy_tests ultra_honk_tests goblin_tests diff --git a/barretenberg/cpp/src/CMakeLists.txt b/barretenberg/cpp/src/CMakeLists.txt index 44809b913b6..7f7b588c58d 100644 --- a/barretenberg/cpp/src/CMakeLists.txt +++ b/barretenberg/cpp/src/CMakeLists.txt @@ -62,6 +62,7 @@ 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) @@ -69,14 +70,15 @@ 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) @@ -115,20 +117,22 @@ set(BARRETENBERG_TARGET_OBJECTS $ $ $ + $ $ $ $ $ $ $ + $ $ - $ $ $ $ $ $ $ + $ $ $ $ diff --git a/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp index 2ace58eb6e6..dcbcd0c39a5 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp @@ -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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/CMakeLists.txt index 4fac2ed6c97..7bf9c742dd9 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/CMakeLists.txt @@ -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) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp index e5d27b9ad4f..b76eb863f76 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/eccvm.bench.cpp @@ -1,7 +1,7 @@ #include +#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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp index 528aca8133a..95bce45dcac 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp @@ -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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp b/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp index 0fdf754812b..8ee44898988 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp @@ -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 #include diff --git a/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp index d1a5e501cb9..d918fa436fc 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp @@ -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 using namespace benchmark; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/standard_plonk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/standard_plonk.bench.cpp index 27ac98141ca..087bf16267c 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/standard_plonk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/plonk_bench/standard_plonk.bench.cpp @@ -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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp index 058b0244b7d..581e43a6db8 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp @@ -1,8 +1,8 @@ #include -#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" diff --git a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/protogalaxy_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/protogalaxy_rounds.bench.cpp index 308a84590d4..c8b5714e4e6 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/protogalaxy_rounds.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/protogalaxy_rounds.bench.cpp @@ -1,8 +1,8 @@ #include -#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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt index 7b4f4e0307b..8dd830f2a7d 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(relations_bench proof_system transcript) +barretenberg_module(relations_bench stdlib_circuit_builders transcript) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp index 49a77736219..48959e431e9 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp @@ -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 namespace { diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/goblin_ultra_honk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/goblin_ultra_honk.bench.cpp index f64a9e15c3d..f0b1ca9142c 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/goblin_ultra_honk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/goblin_ultra_honk.bench.cpp @@ -1,7 +1,7 @@ #include #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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp index 8afe05241fe..e5054bd02f5 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk.bench.cpp @@ -1,7 +1,7 @@ #include #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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp index 2ec4edfdbee..e9093518f54 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp @@ -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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk.bench.cpp index bdeaa4fc7f0..5b71e4e0a64 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk.bench.cpp @@ -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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp index 7512ad33606..19c82f368e4 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp @@ -1,7 +1,7 @@ #include #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; diff --git a/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/CMakeLists.txt index c3162881719..8fc9ca9d22c 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(widgets_bench polynomials proof_system transcript stdlib_primitives plonk) +barretenberg_module(widgets_bench polynomials transcript stdlib_primitives plonk) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/widget.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/widget.bench.cpp index cdc7a10240d..85244ace0cb 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/widget.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/widget.bench.cpp @@ -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" @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/circuit_checker/CMakeLists.txt index ae05d215dd7..2df338e4a0b 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(circuit_checker proof_system flavor) \ No newline at end of file +barretenberg_module(circuit_checker stdlib_circuit_builders) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/circuit_checker.hpp b/barretenberg/cpp/src/barretenberg/circuit_checker/circuit_checker.hpp index ba92230b6f4..d3398ea992d 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/circuit_checker.hpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/circuit_checker.hpp @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/goblin_ultra_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/circuit_checker/goblin_ultra_circuit_builder.test.cpp index 67a2b7e565a..3366b4d6c40 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/goblin_ultra_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/goblin_ultra_circuit_builder.test.cpp @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_builder.test.cpp index a2ee0e3b2f6..65d96e1c998 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_builder.test.cpp @@ -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" diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_checker.hpp b/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_checker.hpp index a38c6d35f77..545f4996728 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_checker.hpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/standard_circuit_checker.hpp @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_builder.test.cpp index 57516e1bdf9..ea3f510ff53 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_builder.test.cpp @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp index 3747c8063a6..afe06392009 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp @@ -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 #include diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp index 5aea34513b6..4e4ae0d32ac 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp @@ -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" @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp index 01b1abcdef5..a0729568475 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp @@ -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 using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp index 5d48c880294..ef232fcbf3f 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/common/fuzzer.hpp b/barretenberg/cpp/src/barretenberg/common/fuzzer.hpp index 563f711ddba..aaa2e71f676 100644 --- a/barretenberg/cpp/src/barretenberg/common/fuzzer.hpp +++ b/barretenberg/cpp/src/barretenberg/common/fuzzer.hpp @@ -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 // NOLINTBEGIN(cppcoreguidelines-macro-usage, google-runtime-int) diff --git a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/CMakeLists.txt index 9bf5c2967d9..475b8ae9829 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/CMakeLists.txt @@ -3,5 +3,5 @@ barretenberg_module( stdlib_primitives stdlib_blake3s stdlib_pedersen_hash - circuit_checker + crypto_poseidon2 ) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash.test.cpp index a8eeec7cc69..bbc17acbfca 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash.test.cpp @@ -3,7 +3,7 @@ #include #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; diff --git a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/membership.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/membership.test.cpp index a42df6d712b..3c6ebf06d87 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/membership.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/membership.test.cpp @@ -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; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index d8b1e2fdeb7..2cc00db97c7 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -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 namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp index 58d036f4e16..ddad2310a49 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp @@ -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 diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp index 805ea1d8427..15494fa871a 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp @@ -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 { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp index c31c57fdfd8..4128762ad62 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp @@ -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 { diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field_conversion.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field_conversion.hpp index 8e4962dd525..3e6cd34f41e 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field_conversion.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field_conversion.hpp @@ -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 { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_builder_types.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_builder_types.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_builder_types.hpp rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_builder_types.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_circuit_builder.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_circuit_builder.hpp index f4084ca4416..b24d7445328 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_circuit_builder.hpp @@ -6,11 +6,11 @@ #include "./transcript_builder.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" namespace bb { @@ -223,7 +223,7 @@ template class ECCVMCircuitBuilder { * @brief Compute the ECCVM flavor polynomial data required to generate an ECCVM Proof * * @details RawPolynomial member polynomials that this fn must populate described below - * For full details see `flavor/ecc_vm.hpp` + * For full details see `eccvm/eccvm_flavor.hpp` * * lagrange_first: lagrange_first[0] = 1, 0 elsewhere * lagrange_second: lagrange_second[1] = 1, 0 elsewhere diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_circuit_builder.test.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.test.cpp rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_circuit_builder.test.cpp diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp index c6c8bea829d..e8db55d7c30 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp @@ -1,6 +1,6 @@ #include "eccvm_composer.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" -#include "barretenberg/proof_system/composer/permutation_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp index a33446e6caa..750b579b9f9 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp @@ -1,9 +1,9 @@ #pragma once +#include "barretenberg/eccvm/eccvm_circuit_builder.hpp" #include "barretenberg/eccvm/eccvm_prover.hpp" #include "barretenberg/eccvm/eccvm_verifier.hpp" -#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" #include "barretenberg/srs/factories/file_crs_factory.hpp" #include "barretenberg/srs/global_crs.hpp" diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp index 5b7d207daf7..c0c464e8df8 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp @@ -3,11 +3,11 @@ #include #include +#include "barretenberg/eccvm/eccvm_circuit_builder.hpp" #include "barretenberg/eccvm/eccvm_composer.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/sumcheck_round.hpp" diff --git a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp index 1ea668d6ae6..6f16a7b1c6c 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp @@ -7,6 +7,7 @@ #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/flavor_macros.hpp" +#include "barretenberg/flavor/relation_definitions.hpp" #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp" #include "barretenberg/relations/ecc_vm/ecc_msm_relation.hpp" @@ -16,7 +17,6 @@ #include "barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/relations/relation_types.hpp" -#include "relation_definitions.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp index f7d367265ea..5710d5c5b67 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp @@ -4,8 +4,8 @@ #include "barretenberg/common/ref_array.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp index c4b895ecf88..bf607c47e2a 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp @@ -1,6 +1,6 @@ #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/goblin/translation_evaluations.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/relations/relation_parameters.hpp" diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp index 958453b42ea..c62d1b8762e 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp @@ -1,5 +1,5 @@ #pragma once -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/msm_builder.hpp b/barretenberg/cpp/src/barretenberg/eccvm/msm_builder.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/msm_builder.hpp rename to barretenberg/cpp/src/barretenberg/eccvm/msm_builder.hpp index 5630ca357e0..db02283fd37 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/msm_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/msm_builder.hpp @@ -3,7 +3,7 @@ #include #include "./eccvm_builder_types.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/precomputed_tables_builder.hpp b/barretenberg/cpp/src/barretenberg/eccvm/precomputed_tables_builder.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/precomputed_tables_builder.hpp rename to barretenberg/cpp/src/barretenberg/eccvm/precomputed_tables_builder.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/transcript_builder.hpp b/barretenberg/cpp/src/barretenberg/eccvm/transcript_builder.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/eccvm/transcript_builder.hpp rename to barretenberg/cpp/src/barretenberg/eccvm/transcript_builder.hpp diff --git a/barretenberg/cpp/src/barretenberg/examples/join_split/types.hpp b/barretenberg/cpp/src/barretenberg/examples/join_split/types.hpp index 3d4eae0ecc0..e056d10d2a8 100644 --- a/barretenberg/cpp/src/barretenberg/examples/join_split/types.hpp +++ b/barretenberg/cpp/src/barretenberg/examples/join_split/types.hpp @@ -1,7 +1,6 @@ #pragma once #include "barretenberg/crypto/merkle_tree/hash_path.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/stdlib/commitment/pedersen/pedersen.hpp" #include "barretenberg/stdlib/encryption/schnorr/schnorr.hpp" #include "barretenberg/stdlib/primitives/bool/bool.hpp" @@ -10,6 +9,7 @@ #include "barretenberg/stdlib/primitives/group/cycle_group.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include "barretenberg/stdlib/primitives/witness/witness.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" namespace bb::join_split_example { diff --git a/barretenberg/cpp/src/barretenberg/execution_trace/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/execution_trace/CMakeLists.txt new file mode 100644 index 00000000000..c64c6d2dde8 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/execution_trace/CMakeLists.txt @@ -0,0 +1 @@ +barretenberg_module(execution_trace plonk_honk_shared) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.cpp b/barretenberg/cpp/src/barretenberg/execution_trace/execution_trace.cpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.cpp rename to barretenberg/cpp/src/barretenberg/execution_trace/execution_trace.cpp index a55897bba72..005b7d523c6 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/execution_trace/execution_trace.cpp @@ -1,8 +1,8 @@ #include "execution_trace.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" #include "barretenberg/flavor/plonk_flavors.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" namespace bb { template diff --git a/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.hpp b/barretenberg/cpp/src/barretenberg/execution_trace/execution_trace.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.hpp rename to barretenberg/cpp/src/barretenberg/execution_trace/execution_trace.hpp index c28d0610c83..633dc618ff9 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/execution_trace/execution_trace.hpp @@ -1,6 +1,6 @@ #pragma once #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/proof_system/composer/permutation_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" #include "barretenberg/srs/global_crs.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/flavor/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/flavor/CMakeLists.txt index f2c41054b03..9c033cd6b3d 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/flavor/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(flavor commitment_schemes ecc polynomials proof_system) +barretenberg_module(flavor polynomials srs) diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index fd80d637de5..5b1f4824f03 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -68,10 +68,10 @@ #include "barretenberg/common/std_array.hpp" #include "barretenberg/common/std_vector.hpp" #include "barretenberg/common/zip_view.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/polynomials/univariate.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp index 0f00e1950cf..889f4f9504c 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.test.cpp @@ -1,6 +1,6 @@ -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/srs/factories/crs_factory.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/flavor/plonk_flavors.hpp b/barretenberg/cpp/src/barretenberg/flavor/plonk_flavors.hpp index f2c180a593a..bad2062b805 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/plonk_flavors.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/plonk_flavors.hpp @@ -2,8 +2,8 @@ #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/transcript/transcript.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" namespace bb::plonk::flavor { class Standard { diff --git a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp index d590482e05b..5a341d518c1 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp @@ -1,13 +1,13 @@ #pragma once +#include "barretenberg/eccvm/eccvm_circuit_builder.hpp" #include "barretenberg/eccvm/eccvm_composer.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" #include "barretenberg/goblin/mock_circuits.hpp" -#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/instance_inspector.hpp" +#include "barretenberg/plonk_honk_shared/instance_inspector.hpp" #include "barretenberg/stdlib/honk_recursion/verifier/merge_recursive_verifier.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/translator_vm/goblin_translator_circuit_builder.hpp" #include "barretenberg/translator_vm/goblin_translator_prover.hpp" #include "barretenberg/translator_vm/goblin_translator_verifier.hpp" #include "barretenberg/ultra_honk/merge_prover.hpp" diff --git a/barretenberg/cpp/src/barretenberg/goblin/goblin_recursion.test.cpp b/barretenberg/cpp/src/barretenberg/goblin/goblin_recursion.test.cpp index 708250fb2d7..49b3f08028f 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/goblin_recursion.test.cpp +++ b/barretenberg/cpp/src/barretenberg/goblin/goblin_recursion.test.cpp @@ -1,7 +1,7 @@ #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 diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp index f797bfae5cd..4f4fbdee852 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp @@ -6,8 +6,6 @@ #include "barretenberg/crypto/merkle_tree/membership.hpp" #include "barretenberg/crypto/merkle_tree/memory_store.hpp" #include "barretenberg/crypto/merkle_tree/merkle_tree.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/proof_system/circuit_builder/mock_circuits.hpp" #include "barretenberg/srs/global_crs.hpp" #include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp" #include "barretenberg/stdlib/hash/sha256/sha256.hpp" @@ -15,6 +13,8 @@ #include "barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp" #include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" #include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/mock_circuits.hpp" namespace bb { class GoblinMockCircuits { diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp index 752e2b32afb..ed23f29679e 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits_pinning.test.cpp @@ -1,6 +1,6 @@ #include "barretenberg/goblin/goblin.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 diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp index 4647323de23..f4b016460b3 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.cpp @@ -4,9 +4,9 @@ #include "barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp" #include "barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp" #include "barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" -#include "barretenberg/proof_system/composer/permutation_lib.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp index bf464f79873..fe1d7eb7ede 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.hpp @@ -6,9 +6,8 @@ #include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" -#include "barretenberg/proof_system/execution_trace/execution_trace.hpp" #include "barretenberg/srs/factories/file_crs_factory.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" #include namespace bb::plonk { diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp index bb60fa8c41e..bfc8c9cff84 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/crypto/generators/generator_data.hpp" #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" -#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" #include using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp index 951716ece8c..e0e24ca7efb 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp @@ -4,8 +4,8 @@ #include "barretenberg/plonk/proof_system/types/program_settings.hpp" #include "barretenberg/plonk/proof_system/types/prover_settings.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/composer/permutation_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp index d6f01e6f43e..3bad4a3b5d2 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp @@ -5,10 +5,9 @@ #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" -#include "barretenberg/proof_system/execution_trace/execution_trace.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" #include "barretenberg/srs/factories/file_crs_factory.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp index 683ed6ba372..4c401884a01 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp @@ -5,9 +5,9 @@ #include "barretenberg/numeric/uintx/uintx.hpp" #include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/plookup_tables/sha256.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/sha256.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" using namespace bb; using namespace bb::plonk; diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp index 13d8c80b3c5..cb9ab7eec2f 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp @@ -11,10 +11,10 @@ #include "barretenberg/srs/factories/crs_factory.hpp" #ifdef __wasm__ -#include "barretenberg/proof_system/polynomial_store/polynomial_store_cache.hpp" -// #include "barretenberg/proof_system/polynomial_store/polynomial_store_wasm.hpp" +#include "barretenberg/polynomials/polynomial_store_cache.hpp" +// #include "barretenberg/polynomials/polynomial_store_wasm.hpp" #else -#include "barretenberg/proof_system/polynomial_store/polynomial_store.hpp" +#include "barretenberg/polynomials/polynomial_store.hpp" #endif namespace bb::plonk { diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp index ec6f62141d8..862fd57e285 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp @@ -3,8 +3,8 @@ #include "barretenberg/common/test.hpp" #include "barretenberg/plonk/composer/standard_composer.hpp" #include "barretenberg/plonk/composer/ultra_composer.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 "serialize.hpp" #ifndef __wasm__ @@ -100,7 +100,7 @@ StandardComposer(); fr a = fr::one(); builder.add_public_variable(a); // Write each precomputed polynomial in the proving key to // its own file using write_mmap - std::string pk_dir = "../src/barretenberg/proof_system/proving_key/fixtures"; + std::string pk_dir = "../src/barretenberg/plonk_honk_shared/proving_key/fixtures"; std::filesystem::create_directories(pk_dir); std::string pk_path = pk_dir + "/proving_key"; std::ofstream os(pk_path); diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp index 4f51a58ad17..01202ea190c 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp @@ -1,6 +1,6 @@ #pragma once -#include "barretenberg/proof_system/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp index 44469d3c775..0f0d5c96891 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp @@ -1,5 +1,5 @@ #pragma once -#include "barretenberg/proof_system/arithmetization/arithmetization.hpp" +#include "barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb::plonk { class settings_base { diff --git a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/CMakeLists.txt new file mode 100644 index 00000000000..d3024bcdbb1 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/CMakeLists.txt @@ -0,0 +1 @@ +barretenberg_module(plonk_honk_shared polynomials) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp index 7a21b0eaf81..eed7d43370d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/common/ref_array.hpp" #include "barretenberg/ecc/curves/bn254/bn254.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/composer_lib.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/composer_lib.hpp index 0d067c03f63..b4ab7818f40 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/composer_lib.hpp @@ -1,6 +1,6 @@ #pragma once #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/proof_system/polynomial_store/polynomial_store.hpp" +#include "barretenberg/polynomials/polynomial_store.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.test.cpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/composer_lib.test.cpp similarity index 75% rename from barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.test.cpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/composer_lib.test.cpp index 9f780a49327..94219c72a48 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/composer_lib.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/composer_lib.test.cpp @@ -1,8 +1,8 @@ -#include "barretenberg/proof_system/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" #include "barretenberg/common/slab_allocator.hpp" -#include "barretenberg/flavor/ultra.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" #include "barretenberg/srs/factories/crs_factory.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/permutation_lib.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/permutation_lib.hpp diff --git a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/instance_inspector.cpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/instance_inspector.cpp new file mode 100644 index 00000000000..529a3b46b02 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/instance_inspector.cpp @@ -0,0 +1,3 @@ +#include "instance_inspector.hpp" + +// Hack to make the module compile. \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/instance_inspector.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/instance_inspector.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/instance_inspector.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/instance_inspector.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_delta.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_delta.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_delta.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_delta.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_library.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_library.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/types/circuit_type.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/types/circuit_type.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/types/circuit_type.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/types/circuit_type.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/types/merkle_hash_type.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/types/merkle_hash_type.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/types/merkle_hash_type.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/types/merkle_hash_type.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/types/pedersen_commitment_type.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/types/pedersen_commitment_type.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/types/pedersen_commitment_type.hpp rename to barretenberg/cpp/src/barretenberg/plonk_honk_shared/types/pedersen_commitment_type.hpp diff --git a/barretenberg/cpp/src/barretenberg/polynomials/evaluation_domain.cpp b/barretenberg/cpp/src/barretenberg/polynomials/evaluation_domain.cpp index 6af376c70d6..4124ece17af 100644 --- a/barretenberg/cpp/src/barretenberg/polynomials/evaluation_domain.cpp +++ b/barretenberg/cpp/src/barretenberg/polynomials/evaluation_domain.cpp @@ -5,7 +5,7 @@ #include "barretenberg/common/thread.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.cpp b/barretenberg/cpp/src/barretenberg/polynomials/polynomial_store.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.cpp rename to barretenberg/cpp/src/barretenberg/polynomials/polynomial_store.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp b/barretenberg/cpp/src/barretenberg/polynomials/polynomial_store.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp rename to barretenberg/cpp/src/barretenberg/polynomials/polynomial_store.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp b/barretenberg/cpp/src/barretenberg/polynomials/polynomial_store.test.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp rename to barretenberg/cpp/src/barretenberg/polynomials/polynomial_store.test.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_cache.cpp b/barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_cache.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_cache.cpp rename to barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_cache.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_cache.hpp b/barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_cache.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_cache.hpp rename to barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_cache.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_wasm.cpp b/barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_wasm.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_wasm.cpp rename to barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_wasm.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_wasm.hpp b/barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_wasm.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store_wasm.hpp rename to barretenberg/cpp/src/barretenberg/polynomials/polynomial_store_wasm.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/proof_system/CMakeLists.txt deleted file mode 100644 index fbfab98569f..00000000000 --- a/barretenberg/cpp/src/barretenberg/proof_system/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -barretenberg_module(proof_system relations crypto_pedersen_hash srs) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/protogalaxy/CMakeLists.txt index 6d6edb4cb8b..59413abd24a 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(protogalaxy ultra_honk flavor relations sumcheck) \ No newline at end of file +barretenberg_module(protogalaxy ultra_honk) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp index b9fd0f9d8c0..4c5d2bc763f 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp @@ -1,8 +1,8 @@ -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/utils/testing.hpp" #include "barretenberg/polynomials/pow.hpp" #include "barretenberg/protogalaxy/protogalaxy_prover.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/instances.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp index 4c113531d69..977605f5a7d 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp @@ -1,9 +1,9 @@ #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/prover_instance.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp index eb896654430..9d9f8ae777b 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_verifier.hpp @@ -1,8 +1,8 @@ #pragma once -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/srs/global_crs.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/verifier_instance.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp index bb4be8dbb3d..935598af791 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp @@ -3,13 +3,13 @@ #include "barretenberg/common/thread.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/polynomials/pow.hpp" #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/protogalaxy/folding_result.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/relations/utils.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/instances.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp index 54930916236..9d6eb95e88f 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.cpp @@ -1,5 +1,5 @@ #include "protogalaxy_verifier.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" #include "barretenberg/ultra_honk/oink_verifier.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp index 9a39986fe4b..e6dbb6b5530 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_verifier.hpp @@ -1,8 +1,8 @@ #pragma once #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/protogalaxy/folding_result.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/instances.hpp" #include "barretenberg/transcript/transcript.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp index 46fc53baad3..e42028a487e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/flavor/relation_definitions.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" #include "ecc_msm_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp index 44f11fe6a58..b71b5a6e4a0 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.cpp @@ -1,5 +1,5 @@ #include "ecc_msm_relation.hpp" -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/flavor/relation_definitions.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp index a6ef32a0376..0efec02d548 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.cpp @@ -1,5 +1,5 @@ #include "ecc_point_table_relation.hpp" -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/flavor/relation_definitions.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp index d52e0599c91..852ceded699 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/flavor/relation_definitions.hpp" #include "ecc_msm_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp index 5e617a02a00..4e7a4cdbdb6 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.cpp @@ -2,7 +2,7 @@ #include #include "./ecc_transcript_relation.hpp" -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/flavor/relation_definitions.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp index b8077336928..3c7e7ca8433 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.cpp @@ -1,5 +1,5 @@ #include "ecc_wnaf_relation.hpp" -#include "barretenberg/flavor/ecc_vm.hpp" +#include "barretenberg/eccvm/eccvm_flavor.hpp" #include "barretenberg/flavor/relation_definitions.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp index 2f55d2d8885..bac3b7b1a99 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp @@ -11,7 +11,7 @@ * satisfied in general by random inputs) only that the two implementations are equivalent. * */ -#include "barretenberg/flavor/goblin_translator.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" #include using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp index 07691f0aa21..7c097207fb3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.cpp @@ -1,5 +1,5 @@ #include "barretenberg/relations/translator_vm/translator_decomposition_relation.hpp" -#include "barretenberg/flavor/goblin_translator.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.cpp index 70c0456e884..9489cec0042 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.cpp @@ -1,5 +1,5 @@ #include "barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp" -#include "barretenberg/flavor/goblin_translator.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp index 5852d95e681..70379dae2b7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.cpp @@ -1,5 +1,5 @@ #include "barretenberg/relations/translator_vm/translator_extra_relations.hpp" -#include "barretenberg/flavor/goblin_translator.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp index d4231625ff3..26a5f0f7961 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.cpp @@ -1,5 +1,5 @@ #include "barretenberg/relations/translator_vm/translator_non_native_field_relation.hpp" -#include "barretenberg/flavor/goblin_translator.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" namespace bb { /** diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp index de6aa1d350d..6fd66d454f6 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.cpp @@ -1,5 +1,5 @@ #include "barretenberg/relations/translator_vm/translator_permutation_relation.hpp" -#include "barretenberg/flavor/goblin_translator.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/relations/utils.hpp b/barretenberg/cpp/src/barretenberg/relations/utils.hpp index 9818249f3ad..0eced14c195 100644 --- a/barretenberg/cpp/src/barretenberg/relations/utils.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/utils.hpp @@ -1,9 +1,9 @@ #pragma once #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/polynomials/pow.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/serialize/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/serialize/CMakeLists.txt index f7c49f1111e..fb4b1261d48 100644 --- a/barretenberg/cpp/src/barretenberg/serialize/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/serialize/CMakeLists.txt @@ -2,6 +2,5 @@ # The non-test portion of barretenberg (the part you actually use) is header only barretenberg_module( serialize-tests - proof_system transcript ) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/circuit/circuit.test.cpp b/barretenberg/cpp/src/barretenberg/smt_verification/circuit/circuit.test.cpp index 9530188a597..ff4815fc633 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/circuit/circuit.test.cpp +++ b/barretenberg/cpp/src/barretenberg/smt_verification/circuit/circuit.test.cpp @@ -2,9 +2,9 @@ #include #include -#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" #include "barretenberg/smt_verification/circuit/circuit.hpp" #include "barretenberg/smt_verification/util/smt_util.hpp" diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.hpp b/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.hpp index 53d6a9aeb85..bd2e9896aec 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.hpp +++ b/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.hpp @@ -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 "barretenberg/smt_verification/circuit/circuit_schema.hpp" diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.test.cpp b/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.test.cpp index e46800aa39b..650c9cdda4c 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.test.cpp +++ b/barretenberg/cpp/src/barretenberg/smt_verification/circuit/subcircuits.test.cpp @@ -1,8 +1,8 @@ #include #include -#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 "barretenberg/smt_verification/circuit/subcircuits.hpp" diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp b/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp index 2a934d7fc8a..f4a5355533f 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp +++ b/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp @@ -1,5 +1,5 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" -#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp b/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp index 416c95e3f8e..f3d9582a13b 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp +++ b/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp @@ -4,9 +4,9 @@ #include #include -#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" #include "barretenberg/serialize/cbind.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" #include "barretenberg/smt_verification/circuit/circuit.hpp" #include "barretenberg/smt_verification/util/smt_util.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp index 2ee2add3d29..90959ee9ccc 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp @@ -1,7 +1,7 @@ #include "aes128.hpp" #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/crypto/aes128/aes128.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp index f43bf940cae..c2706b3adf4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "schnorr.hpp" using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp index 9ef976a3f9e..1bba02baf90 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp @@ -1,6 +1,6 @@ #include "barretenberg/crypto/blake2s/blake2s.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" #include "blake2s.hpp" #include "blake2s_plookup.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp index bcdd2742ad5..c543c1e1d56 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp @@ -1,12 +1,12 @@ #include "blake2s_plookup.hpp" #include "blake_util.hpp" -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" -#include "barretenberg/proof_system/plookup_tables/sha256.hpp" #include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/sha256.hpp" /** * Optimizations: diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp index 9361402185c..06784f44403 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp @@ -1,6 +1,6 @@ #pragma once -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" #include #include "barretenberg/numeric/bitop/sparse_form.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp index 25a65a5abbc..30e93e40db2 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp @@ -1,8 +1,8 @@ #pragma once -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" namespace bb::stdlib::blake_util { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp index c6e01225d31..06b0666040b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp @@ -1,11 +1,11 @@ #include "blake3s_plookup.hpp" #include "../blake2s/blake_util.hpp" -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" #include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" namespace bb::stdlib::blake3s_plookup { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp index dac38f225e5..5b8f2f94e05 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp @@ -1,6 +1,6 @@ #pragma once -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" #include #include "barretenberg/numeric/bitop/sparse_form.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.cpp index d16e19712c1..aa3392130f6 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.cpp @@ -1,8 +1,8 @@ #include "poseidon2_permutation.hpp" -#include "barretenberg/proof_system/arithmetization/gate_data.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" +#include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp" #include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp" namespace bb::stdlib { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp index 009a8a82135..f44eafe3d9c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp @@ -1,9 +1,9 @@ #include "barretenberg/crypto/sha256/sha256.hpp" #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/common/test.hpp" -#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "sha256.hpp" #include "barretenberg/numeric/bitop/rotate.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp index bffa757acd7..130400be39f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp @@ -1,11 +1,11 @@ #include "sha256_plookup.hpp" -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" -#include "barretenberg/proof_system/plookup_tables/sha256.hpp" #include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/sha256.hpp" using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp index c2f0a4c14f0..d4a11b6d11f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp @@ -1,6 +1,6 @@ #pragma once -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" #include #include "barretenberg/numeric/bitop/sparse_form.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/CMakeLists.txt index dc032e51f21..926522ed055 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/CMakeLists.txt @@ -1,10 +1,9 @@ barretenberg_module( stdlib_honk_recursion - proof_system + stdlib_circuit_builders stdlib_pedersen_commitment stdlib_blake3s ultra_honk - translator_vm stdlib_poseidon2 protogalaxy ) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/transcript/transcript.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/transcript/transcript.test.cpp index fff2164b440..3f4b4d68886 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/transcript/transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/transcript/transcript.test.cpp @@ -3,9 +3,9 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/bn254/g1.hpp" -#include "barretenberg/flavor/ultra.hpp" -#include "barretenberg/flavor/ultra_recursive.hpp" #include "barretenberg/polynomials/univariate.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb::stdlib::recursion::honk { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/decider_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/decider_recursive_verifier.hpp index efcc7b50eb2..c4e52795bb7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/decider_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/decider_recursive_verifier.hpp @@ -1,9 +1,9 @@ #pragma once -#include "barretenberg/flavor/goblin_ultra_recursive.hpp" -#include "barretenberg/flavor/ultra_recursive.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/stdlib/honk_recursion/transcript/transcript.hpp" #include "barretenberg/stdlib/honk_recursion/verifier/recursive_verifier_instance.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_recursive_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" namespace bb::stdlib::recursion::honk { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/goblin_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/goblin_verifier.test.cpp index e49c72b0c3a..84e0d6e0807 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/goblin_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/goblin_verifier.test.cpp @@ -1,10 +1,10 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/common/test.hpp" -#include "barretenberg/flavor/ultra_recursive.hpp" #include "barretenberg/stdlib/hash/blake3s/blake3s.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" #include "barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.cpp index 7069a0eb0cf..6fd55434863 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.cpp @@ -1,6 +1,6 @@ #include "protogalaxy_recursive_verifier.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" #include "barretenberg/stdlib/honk_recursion/verifier/recursive_instances.hpp" namespace bb::stdlib::recursion::honk { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.hpp index a4d5096d94b..97bdbd8b5f6 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.hpp @@ -1,11 +1,11 @@ #pragma once #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/flavor/goblin_ultra_recursive.hpp" -#include "barretenberg/flavor/ultra_recursive.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/protogalaxy/folding_result.hpp" #include "barretenberg/stdlib/honk_recursion/transcript/transcript.hpp" #include "barretenberg/stdlib/honk_recursion/verifier/recursive_instances.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_recursive_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" namespace bb::stdlib::recursion::honk { template class ProtoGalaxyRecursiveVerifier_ { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.test.cpp index 27583976cb8..22c9b7f29f4 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.test.cpp @@ -1,7 +1,6 @@ #include "barretenberg/stdlib/honk_recursion/verifier/protogalaxy_recursive_verifier.hpp" #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/common/test.hpp" -#include "barretenberg/flavor/ultra_recursive.hpp" #include "barretenberg/protogalaxy/decider_prover.hpp" #include "barretenberg/protogalaxy/decider_verifier.hpp" #include "barretenberg/protogalaxy/protogalaxy_prover.hpp" @@ -10,6 +9,7 @@ #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" #include "barretenberg/stdlib/honk_recursion/verifier/decider_recursive_verifier.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" #include "barretenberg/sumcheck/instance/instances.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.cpp index bf457cf0e18..334ad876caf 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.cpp @@ -1,7 +1,7 @@ #include "barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp" #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb::stdlib::recursion::honk { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp index 07c1c4f20a3..aa8077c11ca 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp @@ -1,8 +1,8 @@ #pragma once -#include "barretenberg/flavor/goblin_ultra_recursive.hpp" -#include "barretenberg/flavor/ultra_recursive.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/stdlib/honk_recursion/transcript/transcript.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_recursive_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" namespace bb::stdlib::recursion::honk { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/verifier.test.cpp index e1158eba311..d7af1325196 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_recursion/verifier/verifier.test.cpp @@ -1,10 +1,10 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/common/test.hpp" -#include "barretenberg/flavor/ultra_recursive.hpp" #include "barretenberg/stdlib/hash/blake3s/blake3s.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" #include "barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/CMakeLists.txt index 746421b9792..e7e9d9d9847 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/CMakeLists.txt @@ -1,6 +1,6 @@ barretenberg_module( stdlib_plonk_recursion - proof_system + stdlib_circuit_builders stdlib_pedersen_commitment stdlib_blake3s plonk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/verification_key/verification_key.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/verification_key/verification_key.test.cpp index b579681391c..2f6969c6235 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/verification_key/verification_key.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/plonk_recursion/verification_key/verification_key.test.cpp @@ -2,9 +2,9 @@ #include "barretenberg/common/test.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" -#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/srs/factories/file_crs_factory.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" namespace { auto& engine = numeric::get_debug_randomness(); diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/stdlib/primitives/CMakeLists.txt index 3480f457e60..0765712a96d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(stdlib_primitives proof_system circuit_checker) \ No newline at end of file +barretenberg_module(stdlib_primitives stdlib_circuit_builders circuit_checker) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp index b7247e2c806..78cc53e03b7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp @@ -1,5 +1,5 @@ #pragma once -#include "barretenberg/proof_system/plookup_tables/types.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp" namespace bb::stdlib { using plookup::MultiTableId; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp index a73bbd43c0a..60d564e52cd 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp @@ -3,9 +3,9 @@ * instantiate templates. */ #pragma once -#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.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/goblin_ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" template concept HasPlookup = bb::IsAnyOf; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.cpp index 61fe555d88f..51cc5554ebc 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.cpp @@ -3,8 +3,8 @@ #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "./cycle_group.hpp" -#include "barretenberg/proof_system/plookup_tables/types.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp" namespace bb::stdlib { template diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.hpp index a707728a1ee..f8baf4af0bd 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/group/cycle_group.hpp @@ -2,10 +2,10 @@ #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -#include "barretenberg/proof_system/plookup_tables/fixed_base/fixed_base_params.hpp" #include "barretenberg/stdlib/primitives/bool/bool.hpp" #include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base_params.hpp" #include namespace bb::stdlib { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp index ac48c222104..55cefd0f3f0 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp @@ -5,7 +5,7 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/numeric/random/engine.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" #include "logic.hpp" #pragma GCC diagnostic ignored "-Wunused-local-typedefs" diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp index 0027949679c..848e97cf970 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp @@ -2,7 +2,7 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/numeric/random/engine.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "ram_table.hpp" using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp index 79f12192d7f..bb0eecf8756 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/numeric/random/engine.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "rom_table.hpp" using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp index 103784ba2de..6e065c1d7f0 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp @@ -1,7 +1,7 @@ #include "./plookup.hpp" -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" -#include "barretenberg/proof_system/plookup_tables/types.hpp" #include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp" namespace bb { class UltraPlonkBuilder; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp index eb85f164242..184f503c60c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp @@ -1,8 +1,8 @@ #pragma once -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" -#include "barretenberg/proof_system/plookup_tables/types.hpp" #include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/CMakeLists.txt new file mode 100644 index 00000000000..e66fa014596 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/CMakeLists.txt @@ -0,0 +1 @@ +barretenberg_module(stdlib_circuit_builders relations execution_trace crypto_pedersen_hash srs) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/circuit_builder_base.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/circuit_builder_base.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/circuit_builder_base.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/circuit_builder_base.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp index b4b188ee856..e857b08ad8d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/circuit_builder_base.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp @@ -1,8 +1,8 @@ #pragma once #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -#include "barretenberg/proof_system/arithmetization/arithmetization.hpp" -#include "barretenberg/proof_system/arithmetization/gate_data.hpp" +#include "barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp" +#include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp" #include "barretenberg/serialize/cbind.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.cpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.cpp index 1b5e4c91229..0267a5be4fa 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.cpp @@ -1,6 +1,6 @@ #include "goblin_ultra_circuit_builder.hpp" #include "barretenberg/crypto/poseidon2/poseidon2_params.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp index e41dd9647fe..d0f77eee38a 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp @@ -1,7 +1,7 @@ #pragma once -#include "barretenberg/proof_system/arithmetization/arithmetization.hpp" -#include "barretenberg/proof_system/execution_trace/execution_trace.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" +#include "barretenberg/execution_trace/execution_trace.hpp" +#include "barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" #include "ultra_circuit_builder.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp index 07eb6cfc1c9..f66ef9e28bb 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp @@ -3,11 +3,11 @@ #include "barretenberg/common/ref_vector.hpp" #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/flavor_macros.hpp" +#include "barretenberg/flavor/relation_definitions.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/polynomials/univariate.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" #include "barretenberg/relations/databus_lookup_relation.hpp" #include "barretenberg/relations/delta_range_constraint_relation.hpp" @@ -19,8 +19,8 @@ #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/goblin_ultra_circuit_builder.hpp" #include "barretenberg/transcript/transcript.hpp" -#include "relation_definitions.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_recursive_flavor.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_recursive_flavor.hpp index 040439dc3c3..44f04655429 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/goblin_ultra_recursive_flavor.hpp @@ -4,15 +4,15 @@ #include "barretenberg/ecc/curves/bn254/g1.hpp" #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/flavor_macros.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/polynomials/univariate.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" #include "barretenberg/stdlib/honk_recursion/transcript/transcript.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/grand_product_library.test.cpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.test.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/grand_product_library.test.cpp index d2699259044..55edddad961 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/library/grand_product_library.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/grand_product_library.test.cpp @@ -1,8 +1,8 @@ -#include "grand_product_library.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/ecc/curves/bn254/bn254.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/polynomials/polynomial.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/srs/factories/file_crs_factory.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/mock_circuits.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mock_circuits.hpp similarity index 97% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/mock_circuits.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mock_circuits.hpp index 5c6c035b270..8b27ab0afb2 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/mock_circuits.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mock_circuits.hpp @@ -1,5 +1,5 @@ #pragma once -#include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/op_queue/ecc_op_queue.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/op_queue/ecc_op_queue.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp index 3c4df9a3d18..9873c78b22d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/op_queue/ecc_op_queue.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/ecc/curves/bn254/bn254.hpp" -#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_builder_types.hpp" +#include "barretenberg/eccvm/eccvm_builder_types.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/op_queue/ecc_op_queue.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.test.cpp similarity index 97% rename from barretenberg/cpp/src/barretenberg/proof_system/op_queue/ecc_op_queue.test.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.test.cpp index 265727f4dd0..093a88caf69 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/op_queue/ecc_op_queue.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.test.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" #include using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/permutation_lib.test.cpp similarity index 92% rename from barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.test.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/permutation_lib.test.cpp index c0d61b918a2..a47fdc8cbc7 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/permutation_lib.test.cpp @@ -1,8 +1,8 @@ -#include "barretenberg/proof_system/composer/permutation_lib.hpp" -#include "barretenberg/flavor/ultra.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" #include "barretenberg/srs/global_crs.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/aes128.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/aes128.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/aes128.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/aes128.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/blake2s.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/blake2s.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/blake2s.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/blake2s.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/dummy.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/dummy.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/dummy.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/dummy.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base_params.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base_params.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base_params.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base_params.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_chi.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_chi.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_chi.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_chi.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_input.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_input.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_input.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_input.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_output.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_output.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_output.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_output.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_rho.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_rho.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_rho.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_rho.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_theta.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_theta.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_theta.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/keccak/keccak_theta.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/non_native_group_generator.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/non_native_group_generator.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/non_native_group_generator.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/non_native_group_generator.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sha256.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/sha256.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sha256.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/sha256.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sparse.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/sparse.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sparse.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/sparse.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/types.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/types.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/uint.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/uint.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/uint.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/uint.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/standard_circuit_builder.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/standard_circuit_builder.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp similarity index 95% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp index 82b8dcc4b0b..e6ede171ffa 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/standard_circuit_builder.hpp @@ -1,10 +1,10 @@ #pragma once #include "barretenberg/ecc/curves/bn254/bn254.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -#include "barretenberg/proof_system/execution_trace/execution_trace.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" -#include "barretenberg/proof_system/types/merkle_hash_type.hpp" -#include "barretenberg/proof_system/types/pedersen_commitment_type.hpp" +#include "barretenberg/execution_trace/execution_trace.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/types/merkle_hash_type.hpp" +#include "barretenberg/plonk_honk_shared/types/pedersen_commitment_type.hpp" #include "circuit_builder_base.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp index d008be7fadc..feecbf0938d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp @@ -1,12 +1,12 @@ #pragma once +#include "barretenberg/execution_trace/execution_trace.hpp" +#include "barretenberg/plonk_honk_shared/types/circuit_type.hpp" +#include "barretenberg/plonk_honk_shared/types/merkle_hash_type.hpp" +#include "barretenberg/plonk_honk_shared/types/pedersen_commitment_type.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/execution_trace/execution_trace.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" -#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp" -#include "barretenberg/proof_system/plookup_tables/types.hpp" -#include "barretenberg/proof_system/types/circuit_type.hpp" -#include "barretenberg/proof_system/types/merkle_hash_type.hpp" -#include "barretenberg/proof_system/types/pedersen_commitment_type.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/plookup_tables.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp" #include "circuit_builder_base.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/flavor/ultra.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp index 54ffa7b53e8..7a17c01f54a 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp @@ -3,13 +3,12 @@ #include "barretenberg/ecc/curves/bn254/g1.hpp" #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/flavor_macros.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/polynomials/univariate.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" #include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" @@ -17,6 +16,7 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp rename to barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp index 5f905863c4c..85120696e25 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp @@ -4,12 +4,10 @@ #include "barretenberg/ecc/curves/bn254/g1.hpp" #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/flavor_macros.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/polynomials/univariate.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/elliptic_relation.hpp" @@ -17,6 +15,8 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" #include "barretenberg/srs/factories/crs_factory.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/sumcheck/CMakeLists.txt index 742bc30a7aa..11294e6f5e5 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/sumcheck/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(sumcheck flavor srs transcript) \ No newline at end of file +barretenberg_module(sumcheck stdlib_circuit_builders transcript) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp index fcb6a975ec3..9900d20b9de 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.cpp @@ -1,7 +1,7 @@ #include "prover_instance.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/composer/permutation_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" namespace bb { /** diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp index f820f66f0cc..6d8437530dc 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.hpp @@ -1,11 +1,11 @@ #pragma once +#include "barretenberg/execution_trace/execution_trace.hpp" #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" -#include "barretenberg/proof_system/composer/permutation_lib.hpp" -#include "barretenberg/proof_system/execution_trace/execution_trace.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" namespace bb { /** diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp index 78f87455419..bd45fe665f0 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/prover_instance.test.cpp @@ -1,8 +1,8 @@ #include "prover_instance.hpp" #include "barretenberg/ecc/curves/bn254/bn254.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/srs/factories/file_crs_factory.hpp" #include using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp index f10e968e6c8..0919b5aa46f 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/partial_evaluation.test.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/flavor/ultra.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp index 5fa9ba4b246..3e5a3461a85 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp @@ -1,5 +1,5 @@ #pragma once -#include "barretenberg/proof_system/library/grand_product_delta.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" #include "barretenberg/sumcheck/instance/prover_instance.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp index a3d94d3ac79..05c0938fa10 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp @@ -1,12 +1,12 @@ #include "sumcheck.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" -#include "barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" #include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.hpp" #include "barretenberg/transcript/transcript.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp index 98381ca823e..932ab785acf 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.test.cpp @@ -1,6 +1,6 @@ #include "sumcheck_round.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/relations/utils.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator.fuzzer.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator.fuzzer.hpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator.fuzzer.hpp rename to barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator.fuzzer.hpp diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.cpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp rename to barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.cpp index 30c62aad83a..b41e59afa04 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.cpp @@ -11,7 +11,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" #include "barretenberg/plonk/proof_system/constants.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" #include namespace bb { using ECCVMOperation = ECCOpQueue::ECCVMOperation; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.fuzzer.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.fuzzer.cpp similarity index 96% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.fuzzer.cpp rename to barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.fuzzer.cpp index 981dc5777be..97385fedd82 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.fuzzer.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.fuzzer.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/proof_system/circuit_builder/goblin_translator.fuzzer.hpp" +#include "barretenberg/translator_vm/goblin_translator.fuzzer.hpp" /** * @brief A very primitive fuzzing harness, no interesting mutations, just parse and throw at the circuit builder * diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.hpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp rename to barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.hpp index e261871d210..680a0b57472 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.hpp @@ -11,14 +11,10 @@ #include "barretenberg/common/constexpr_utils.hpp" #include "barretenberg/ecc/curves/bn254/fq.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" -#include "barretenberg/proof_system/arithmetization/arithmetization.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" -#include "circuit_builder_base.hpp" -#include -#include -#include -#include -#include +#include "barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp" +#include "barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" + namespace bb { /** * @brief GoblinTranslatorCircuitBuilder creates a circuit that evaluates the correctness of the evaluation of diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.test.cpp similarity index 98% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.test.cpp rename to barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.test.cpp index e08938d1957..1b975652c9c 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_circuit_builder.test.cpp @@ -1,6 +1,6 @@ #include "goblin_translator_circuit_builder.hpp" #include "barretenberg/ecc/curves/bn254/bn254.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.fuzzer.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.fuzzer.cpp index c84224a9fe6..9865675145d 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.fuzzer.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.fuzzer.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/proof_system/circuit_builder/goblin_translator.fuzzer.hpp" +#include "barretenberg/translator_vm/goblin_translator.fuzzer.hpp" #include "barretenberg/translator_vm/goblin_translator_prover.hpp" #include "barretenberg/translator_vm/goblin_translator_verifier.hpp" extern "C" void LLVMFuzzerInitialize(int*, char***) diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp index 346a3b9891f..ce8ea528f12 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_composer.test.cpp @@ -1,8 +1,8 @@ #include "barretenberg/common/log.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/sumcheck_round.hpp" +#include "barretenberg/translator_vm/goblin_translator_circuit_builder.hpp" #include "barretenberg/translator_vm/goblin_translator_prover.hpp" #include "barretenberg/translator_vm/goblin_translator_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_flavor.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp rename to barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_flavor.hpp index 9c5108340c2..164b11be335 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_flavor.hpp @@ -5,17 +5,17 @@ #include "barretenberg/ecc/curves/bn254/bn254.hpp" #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/flavor_macros.hpp" +#include "barretenberg/flavor/relation_definitions.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" +#include "barretenberg/plonk_honk_shared/arithmetization/arithmetization.hpp" #include "barretenberg/polynomials/univariate.hpp" -#include "barretenberg/proof_system/arithmetization/arithmetization.hpp" -#include "barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/relations/translator_vm/translator_decomposition_relation.hpp" #include "barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp" #include "barretenberg/relations/translator_vm/translator_extra_relations.hpp" #include "barretenberg/relations/translator_vm/translator_non_native_field_relation.hpp" #include "barretenberg/relations/translator_vm/translator_permutation_relation.hpp" -#include "relation_definitions.hpp" +#include "barretenberg/translator_vm/goblin_translator_circuit_builder.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_mini.fuzzer.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_mini.fuzzer.cpp similarity index 100% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_mini.fuzzer.cpp rename to barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_mini.fuzzer.cpp diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp index ffeaa978161..4022070e958 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.cpp @@ -3,7 +3,7 @@ #include "barretenberg/commitment_schemes/commitment_key.hpp" #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp index 3daf2218f48..72c0e4010bf 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp @@ -1,8 +1,8 @@ #pragma once -#include "barretenberg/flavor/goblin_translator.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp index a7ded5cc915..7bed2936b6a 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_verifier.hpp @@ -1,7 +1,7 @@ #pragma once -#include "barretenberg/flavor/goblin_translator.hpp" #include "barretenberg/goblin/translation_evaluations.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" #include "barretenberg/translator_vm/goblin_translator_prover.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/relation_correctness.test.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/relation_correctness.test.cpp new file mode 100644 index 00000000000..69edc563945 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/translator_vm/relation_correctness.test.cpp @@ -0,0 +1,850 @@ +#include "barretenberg/honk/proof_system/permutation_library.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" +#include "barretenberg/translator_vm/goblin_translator_flavor.hpp" + +#include +using namespace bb; + +/** + * @brief Check that a given relation is satified for a set of polynomials + * + * @tparam relation_idx Index into a tuple of provided relations + * @tparam Flavor + */ +template void check_relation(auto circuit_size, auto& polynomials, auto params) +{ + for (size_t i = 0; i < circuit_size; i++) { + // Define the appropriate SumcheckArrayOfValuesOverSubrelations type for this relation and initialize to zero + using SumcheckArrayOfValuesOverSubrelations = typename Relation::SumcheckArrayOfValuesOverSubrelations; + SumcheckArrayOfValuesOverSubrelations result; + for (auto& element : result) { + element = 0; + } + + // Evaluate each constraint in the relation and check that each is satisfied + Relation::accumulate(result, polynomials.get_row(i), params, 1); + for (auto& element : result) { + ASSERT_EQ(element, 0); + } + } +} + +class GoblinTranslatorRelationCorrectnessTests : public ::testing::Test { + protected: + static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } +}; + +/** + * @brief Test the correctness of GolbinTranslator's Permutation Relation + * + */ +TEST_F(GoblinTranslatorRelationCorrectnessTests, Permutation) +{ + using Flavor = GoblinTranslatorFlavor; + using FF = typename Flavor::FF; + using ProverPolynomials = typename Flavor::ProverPolynomials; + using Polynomial = bb::Polynomial; + auto& engine = numeric::get_debug_randomness(); + const size_t mini_circuit_size = 2048; + auto full_circuit_size = mini_circuit_size * Flavor::CONCATENATION_GROUP_SIZE; + + // We only need gamma, because permutationr elation only uses gamma + FF gamma = FF::random_element(); + + // Fill relation parameters + RelationParameters params; + params.gamma = gamma; + + // Create storage for polynomials + ProverPolynomials prover_polynomials; + for (Polynomial& prover_poly : prover_polynomials.get_all()) { + prover_poly = Polynomial{ full_circuit_size }; + } + + // Fill in lagrange polynomials used in the permutation relation + prover_polynomials.lagrange_first[0] = 1; + prover_polynomials.lagrange_last[full_circuit_size - 1] = 1; + + // Put random values in all the non-concatenated constraint polynomials used to range constrain the values + auto fill_polynomial_with_random_14_bit_values = [&](auto& polynomial) { + for (size_t i = 0; i < mini_circuit_size; i++) { + polynomial[i] = engine.get_random_uint16() & ((1 << Flavor::MICRO_LIMB_BITS) - 1); + } + }; + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_3); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_4); + fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_tail); + fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_0); + fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_1); + fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_2); + fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_3); + + // Compute ordered range constraint polynomials that go in the denominator of the grand product polynomial + compute_goblin_translator_range_constraint_ordered_polynomials(&prover_polynomials, mini_circuit_size); + + // Compute the fixed numerator (part of verification key) + prover_polynomials.compute_extra_range_constraint_numerator(); + + // Compute concatenated polynomials (4 polynomials produced from other constraint polynomials by concatenation) + compute_concatenated_polynomials(&prover_polynomials); + + // Compute the grand product polynomial + compute_grand_product>( + full_circuit_size, prover_polynomials, params); + prover_polynomials.z_perm_shift = prover_polynomials.z_perm.shifted(); + + using Relations = typename Flavor::Relations; + + // Check that permutation relation is satisfied across each row of the prover polynomials + check_relation>(full_circuit_size, prover_polynomials, params); +} + +TEST_F(GoblinTranslatorRelationCorrectnessTests, DeltaRangeConstraint) +{ + using Flavor = GoblinTranslatorFlavor; + using FF = typename Flavor::FF; + using ProverPolynomials = typename Flavor::ProverPolynomials; + using Polynomial = bb::Polynomial; + auto& engine = numeric::get_debug_randomness(); + const size_t mini_circuit_size = 2048; + const auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; + const auto sort_step = Flavor::SORT_STEP; + const auto max_value = (1 << Flavor::MICRO_LIMB_BITS) - 1; + + // No relation parameters are used in this relation + RelationParameters params; + + ProverPolynomials prover_polynomials; + // Allocate polynomials + for (Polynomial& polynomial : prover_polynomials.get_all()) { + polynomial = Polynomial{ circuit_size }; + } + + // Construct lagrange polynomials that are needed for Goblin Translator's DeltaRangeConstraint Relation + prover_polynomials.lagrange_first[0] = 1; + prover_polynomials.lagrange_last[circuit_size - 1] = 1; + + // Create a vector and fill with necessary steps for the DeltaRangeConstraint relation + auto sorted_elements_count = (max_value / sort_step) + 1; + std::vector vector_for_sorting(circuit_size); + for (size_t i = 0; i < sorted_elements_count - 1; i++) { + vector_for_sorting[i] = i * sort_step; + } + vector_for_sorting[sorted_elements_count - 1] = max_value; + + // Add random values to fill the leftover space + for (size_t i = sorted_elements_count; i < circuit_size; i++) { + vector_for_sorting[i] = engine.get_random_uint16() & ((1 << Flavor::MICRO_LIMB_BITS) - 1); + } + + // Get ordered polynomials + auto polynomial_pointers = std::vector{ &prover_polynomials.ordered_range_constraints_0, + &prover_polynomials.ordered_range_constraints_1, + &prover_polynomials.ordered_range_constraints_2, + &prover_polynomials.ordered_range_constraints_3, + &prover_polynomials.ordered_range_constraints_4 }; + + // Sort the vector + std::sort(vector_for_sorting.begin(), vector_for_sorting.end()); + + // Copy values, transforming them into Finite Field elements + std::transform(vector_for_sorting.cbegin(), + vector_for_sorting.cend(), + prover_polynomials.ordered_range_constraints_0.begin(), + [](uint64_t in) { return FF(in); }); + + // Copy the same polynomial into the 4 other ordered polynomials (they are not the same in an actual proof, but we + // only need to check the correctness of the relation and it acts independently on each polynomial) + parallel_for(4, [&](size_t i) { + std::copy(prover_polynomials.ordered_range_constraints_0.begin(), + prover_polynomials.ordered_range_constraints_0.end(), + polynomial_pointers[i + 1]->begin()); + }); + + // Get shifted polynomials + prover_polynomials.ordered_range_constraints_0_shift = prover_polynomials.ordered_range_constraints_0.shifted(); + prover_polynomials.ordered_range_constraints_1_shift = prover_polynomials.ordered_range_constraints_1.shifted(); + prover_polynomials.ordered_range_constraints_2_shift = prover_polynomials.ordered_range_constraints_2.shifted(); + prover_polynomials.ordered_range_constraints_3_shift = prover_polynomials.ordered_range_constraints_3.shifted(); + prover_polynomials.ordered_range_constraints_4_shift = prover_polynomials.ordered_range_constraints_4.shifted(); + + using Relations = typename Flavor::Relations; + + // Check that DeltaRangeConstraint relation is satisfied across each row of the prover polynomials + check_relation>(circuit_size, prover_polynomials, params); +} + +/** + * @brief Test the correctness of GoblinTranslatorFlavor's extra relations (GoblinTranslatorOpcodeConstraintRelation + * and GoblinTranslatorAccumulatorTransferRelation) + * + */ +TEST_F(GoblinTranslatorRelationCorrectnessTests, GoblinTranslatorExtraRelationsCorrectness) +{ + using Flavor = GoblinTranslatorFlavor; + using FF = typename Flavor::FF; + using ProverPolynomials = typename Flavor::ProverPolynomials; + using ProverPolynomialIds = typename Flavor::ProverPolynomialIds; + using Polynomial = bb::Polynomial; + + auto& engine = numeric::get_debug_randomness(); + + const size_t mini_circuit_size = 2048; + const auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; + + // We only use accumulated_result from relation parameters in this relation + RelationParameters params; + params.accumulated_result = { + FF::random_element(), FF::random_element(), FF::random_element(), FF::random_element() + }; + + // Create storage for polynomials + ProverPolynomials prover_polynomials; + // We use polynomial ids to make shifting the polynomials easier + ProverPolynomialIds prover_polynomial_ids; + auto polynomial_id_get_all = prover_polynomial_ids.get_all(); + std::vector polynomial_container; + std::vector polynomial_ids; + for (size_t i = 0; i < polynomial_id_get_all.size(); i++) { + Polynomial temporary_polynomial(circuit_size); + // Allocate polynomials + polynomial_container.push_back(temporary_polynomial); + // Push sequential ids to polynomial ids + polynomial_ids.push_back(i); + polynomial_id_get_all[i] = polynomial_ids[i]; + } + // Get ids of shifted polynomials and put them in a set + auto shifted_ids = prover_polynomial_ids.get_shifted(); + std::unordered_set shifted_id_set; + for (auto& id : shifted_ids) { + shifted_id_set.emplace(id); + } + // Assign to non-shifted prover polynomials + auto polynomial_get_all = prover_polynomials.get_all(); + for (size_t i = 0; i < polynomial_get_all.size(); i++) { + if (!shifted_id_set.contains(i)) { + polynomial_get_all[i] = polynomial_container[i].share(); + } + } + + // Assign to shifted prover polynomials using ids + for (size_t i = 0; i < shifted_ids.size(); i++) { + auto shifted_id = shifted_ids[i]; + auto to_be_shifted_id = prover_polynomial_ids.get_to_be_shifted()[i]; + polynomial_get_all[shifted_id] = polynomial_container[to_be_shifted_id].shifted(); + } + + // Fill in lagrange even polynomial + for (size_t i = 2; i < mini_circuit_size; i += 2) { + prover_polynomials.lagrange_even_in_minicircuit[i] = 1; + } + constexpr size_t NUMBER_OF_POSSIBLE_OPCODES = 6; + constexpr std::array possible_opcode_values = { 0, 1, 2, 3, 4, 8 }; + + // Assign random opcode values + for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { + prover_polynomials.op[i] = + possible_opcode_values[static_cast(engine.get_random_uint8() % NUMBER_OF_POSSIBLE_OPCODES)]; + } + + // Initialize used lagrange polynomials + prover_polynomials.lagrange_second[1] = 1; + prover_polynomials.lagrange_second_to_last_in_minicircuit[mini_circuit_size - 2] = 1; + + // Put random values in accumulator binary limbs (values should be preserved across even->next odd shift) + for (size_t i = 2; i < mini_circuit_size - 2; i += 2) { + prover_polynomials.accumulators_binary_limbs_0[i] = FF ::random_element(); + prover_polynomials.accumulators_binary_limbs_1[i] = FF ::random_element(); + prover_polynomials.accumulators_binary_limbs_2[i] = FF ::random_element(); + prover_polynomials.accumulators_binary_limbs_3[i] = FF ::random_element(); + prover_polynomials.accumulators_binary_limbs_0[i + 1] = prover_polynomials.accumulators_binary_limbs_0[i]; + prover_polynomials.accumulators_binary_limbs_1[i + 1] = prover_polynomials.accumulators_binary_limbs_1[i]; + prover_polynomials.accumulators_binary_limbs_2[i + 1] = prover_polynomials.accumulators_binary_limbs_2[i]; + prover_polynomials.accumulators_binary_limbs_3[i + 1] = prover_polynomials.accumulators_binary_limbs_3[i]; + } + + // The values of accumulator binary limbs at index 1 should equal the accumulated result from relation parameters + prover_polynomials.accumulators_binary_limbs_0[1] = params.accumulated_result[0]; + prover_polynomials.accumulators_binary_limbs_1[1] = params.accumulated_result[1]; + prover_polynomials.accumulators_binary_limbs_2[1] = params.accumulated_result[2]; + prover_polynomials.accumulators_binary_limbs_3[1] = params.accumulated_result[3]; + + using Relations = typename Flavor::Relations; + + // Check that Opcode Constraint relation is satisfied across each row of the prover polynomials + check_relation>(circuit_size, prover_polynomials, params); + + // Check that Accumulator Transfer relation is satisfied across each row of the prover polynomials + check_relation>(circuit_size, prover_polynomials, params); +} +/** + * @brief Test the correctness of GoblinTranslatorFlavor's Decomposition Relation + * + */ +TEST_F(GoblinTranslatorRelationCorrectnessTests, Decomposition) +{ + using Flavor = GoblinTranslatorFlavor; + using FF = typename Flavor::FF; + using BF = typename Flavor::BF; + using ProverPolynomials = typename Flavor::ProverPolynomials; + using ProverPolynomialIds = typename Flavor::ProverPolynomialIds; + using Polynomial = bb::Polynomial; + auto& engine = numeric::get_debug_randomness(); + + constexpr size_t mini_circuit_size = 2048; + const auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; + + // Decomposition relation doesn't use any relation parameters + RelationParameters params; + + // Create storage for polynomials + ProverPolynomials prover_polynomials; + // We use polynomial ids to make shifting the polynomials easier + ProverPolynomialIds prover_polynomial_ids; + std::vector polynomial_container; + std::vector polynomial_ids; + auto polynomial_id_get_all = prover_polynomial_ids.get_all(); + auto polynomial_get_all = prover_polynomials.get_all(); + for (size_t i = 0; i < polynomial_id_get_all.size(); i++) { + Polynomial temporary_polynomial(circuit_size); + // Allocate polynomials + polynomial_container.push_back(temporary_polynomial); + // Push sequential ids to polynomial ids + polynomial_ids.push_back(i); + polynomial_id_get_all[i] = polynomial_ids[i]; + } + // Get ids of shifted polynomials and put them in a set + auto shifted_ids = prover_polynomial_ids.get_shifted(); + std::unordered_set shifted_id_set; + for (auto& id : shifted_ids) { + shifted_id_set.emplace(id); + } + // Assign spans to non-shifted prover polynomials + for (size_t i = 0; i < polynomial_get_all.size(); i++) { + if (!shifted_id_set.contains(i)) { + polynomial_get_all[i] = polynomial_container[i].share(); + } + } + + // Assign shifted spans to shifted prover polynomials using ids + for (size_t i = 0; i < shifted_ids.size(); i++) { + auto shifted_id = shifted_ids[i]; + auto to_be_shifted_id = prover_polynomial_ids.get_to_be_shifted()[i]; + polynomial_get_all[shifted_id] = polynomial_container[to_be_shifted_id].shifted(); + } + + // Fill in lagrange odd polynomial (the only non-witness one we are using) + for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { + prover_polynomials.lagrange_odd_in_minicircuit[i] = 1; + } + + constexpr size_t NUM_LIMB_BITS = Flavor::CircuitBuilder::NUM_LIMB_BITS; + constexpr size_t HIGH_WIDE_LIMB_WIDTH = + Flavor::CircuitBuilder::NUM_LIMB_BITS + Flavor::CircuitBuilder::NUM_LAST_LIMB_BITS; + constexpr size_t LOW_WIDE_LIMB_WIDTH = Flavor::CircuitBuilder::NUM_LIMB_BITS * 2; + constexpr size_t Z_LIMB_WIDTH = 128; + constexpr size_t MICRO_LIMB_WIDTH = Flavor::MICRO_LIMB_BITS; + constexpr size_t SHIFT_12_TO_14 = 4; + constexpr size_t SHIFT_10_TO_14 = 16; + constexpr size_t SHIFT_8_TO_14 = 64; + constexpr size_t SHIFT_4_TO_14 = 1024; + + /** + * @brief Decompose a standard 68-bit limb of binary into 5 14-bit limbs and the 6th limb that is the same as the + * 5th but shifted by 2 bits + * + */ + auto decompose_standard_limb = + [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& limb_4, auto& shifted_limb) { + limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); + limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); + limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); + limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); + limb_4 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 4, MICRO_LIMB_WIDTH * 5); + shifted_limb = limb_4 * SHIFT_12_TO_14; + }; + + /** + * @brief Decompose a standard 50-bit top limb into 4 14-bit limbs and the 5th limb that is the same as 5th, but + * shifted by 6 bits + * + */ + auto decompose_standard_top_limb = + [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& shifted_limb) { + limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); + limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); + limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); + limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); + shifted_limb = limb_3 * SHIFT_8_TO_14; + }; + + /** + * @brief Decompose the 60-bit top limb of z1 or z2 into 5 14-bit limbs and a 6th limb which is equal to the 5th, + * but shifted by 10 bits. + * + */ + auto decompose_standard_top_z_limb = + [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& limb_4, auto& shifted_limb) { + limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); + limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); + limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); + limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); + limb_4 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 4, MICRO_LIMB_WIDTH * 5); + shifted_limb = limb_4 * SHIFT_4_TO_14; + }; + + /** + * @brief Decompose the 52-bit top limb of quotient into 4 14-bit limbs and the 5th limb that is the same as 5th, + * but shifted by 4 bits + * + */ + auto decompose_top_quotient_limb = + [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& shifted_limb) { + limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); + limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); + limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); + limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); + shifted_limb = limb_3 * SHIFT_10_TO_14; + }; + + /** + * @brief Decompose relation wide limb into 6 14-bit limbs + * + */ + auto decompose_relation_limb = + [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& limb_4, auto& limb_5) { + limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); + limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); + limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); + limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); + limb_4 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 4, MICRO_LIMB_WIDTH * 5); + limb_5 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 5, MICRO_LIMB_WIDTH * 6); + }; + + // Put random values in all the non-concatenated constraint polynomials used to range constrain the values + for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { + // P.x + prover_polynomials.x_lo_y_hi[i] = FF(engine.get_random_uint256() & ((uint256_t(1) << LOW_WIDE_LIMB_WIDTH) - 1)); + prover_polynomials.x_hi_z_1[i] = FF(engine.get_random_uint256() & ((uint256_t(1) << HIGH_WIDE_LIMB_WIDTH) - 1)); + + // P.y + prover_polynomials.y_lo_z_2[i] = FF(engine.get_random_uint256() & ((uint256_t(1) << LOW_WIDE_LIMB_WIDTH) - 1)); + prover_polynomials.x_lo_y_hi[i + 1] = + FF(engine.get_random_uint256() & ((uint256_t(1) << HIGH_WIDE_LIMB_WIDTH) - 1)); + + // z1 and z2 + prover_polynomials.x_hi_z_1[i + 1] = FF(engine.get_random_uint256() & ((uint256_t(1) << Z_LIMB_WIDTH) - 1)); + prover_polynomials.y_lo_z_2[i + 1] = FF(engine.get_random_uint256() & ((uint256_t(1) << Z_LIMB_WIDTH) - 1)); + + // Slice P.x into chunks + prover_polynomials.p_x_low_limbs[i] = uint256_t(prover_polynomials.x_lo_y_hi[i]).slice(0, NUM_LIMB_BITS); + prover_polynomials.p_x_low_limbs[i + 1] = + uint256_t(prover_polynomials.x_lo_y_hi[i]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); + prover_polynomials.p_x_high_limbs[i] = uint256_t(prover_polynomials.x_hi_z_1[i]).slice(0, NUM_LIMB_BITS); + prover_polynomials.p_x_high_limbs[i + 1] = + uint256_t(prover_polynomials.x_hi_z_1[i]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); + + // Slice P.y into chunks + prover_polynomials.p_y_low_limbs[i] = uint256_t(prover_polynomials.y_lo_z_2[i]).slice(0, NUM_LIMB_BITS); + prover_polynomials.p_y_low_limbs[i + 1] = + uint256_t(prover_polynomials.y_lo_z_2[i]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); + prover_polynomials.p_y_high_limbs[i] = uint256_t(prover_polynomials.x_lo_y_hi[i + 1]).slice(0, NUM_LIMB_BITS); + prover_polynomials.p_y_high_limbs[i + 1] = + uint256_t(prover_polynomials.x_lo_y_hi[i + 1]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); + + // Slice z1 and z2 into chunks + prover_polynomials.z_low_limbs[i] = uint256_t(prover_polynomials.x_hi_z_1[i + 1]).slice(0, NUM_LIMB_BITS); + prover_polynomials.z_low_limbs[i + 1] = uint256_t(prover_polynomials.y_lo_z_2[i + 1]).slice(0, NUM_LIMB_BITS); + prover_polynomials.z_high_limbs[i] = + uint256_t(prover_polynomials.x_hi_z_1[i + 1]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); + prover_polynomials.z_high_limbs[i + 1] = + uint256_t(prover_polynomials.y_lo_z_2[i + 1]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); + + // Slice accumulator + auto tmp = uint256_t(BF::random_element(&engine)); + prover_polynomials.accumulators_binary_limbs_0[i] = tmp.slice(0, NUM_LIMB_BITS); + prover_polynomials.accumulators_binary_limbs_1[i] = tmp.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2); + prover_polynomials.accumulators_binary_limbs_2[i] = tmp.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3); + prover_polynomials.accumulators_binary_limbs_3[i] = tmp.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4); + + // Slice low limbs of P.x into range constraint microlimbs + decompose_standard_limb(prover_polynomials.p_x_low_limbs[i], + prover_polynomials.p_x_low_limbs_range_constraint_0[i], + prover_polynomials.p_x_low_limbs_range_constraint_1[i], + prover_polynomials.p_x_low_limbs_range_constraint_2[i], + prover_polynomials.p_x_low_limbs_range_constraint_3[i], + prover_polynomials.p_x_low_limbs_range_constraint_4[i], + prover_polynomials.p_x_low_limbs_range_constraint_tail[i]); + + decompose_standard_limb(prover_polynomials.p_x_low_limbs[i + 1], + prover_polynomials.p_x_low_limbs_range_constraint_0[i + 1], + prover_polynomials.p_x_low_limbs_range_constraint_1[i + 1], + prover_polynomials.p_x_low_limbs_range_constraint_2[i + 1], + prover_polynomials.p_x_low_limbs_range_constraint_3[i + 1], + prover_polynomials.p_x_low_limbs_range_constraint_4[i + 1], + prover_polynomials.p_x_low_limbs_range_constraint_tail[i + 1]); + + // Slice high limbs of P.x into range constraint microlimbs + decompose_standard_limb(prover_polynomials.p_x_high_limbs[i], + prover_polynomials.p_x_high_limbs_range_constraint_0[i], + prover_polynomials.p_x_high_limbs_range_constraint_1[i], + prover_polynomials.p_x_high_limbs_range_constraint_2[i], + prover_polynomials.p_x_high_limbs_range_constraint_3[i], + prover_polynomials.p_x_high_limbs_range_constraint_4[i], + prover_polynomials.p_x_high_limbs_range_constraint_tail[i]); + + decompose_standard_top_limb(prover_polynomials.p_x_high_limbs[i + 1], + prover_polynomials.p_x_high_limbs_range_constraint_0[i + 1], + prover_polynomials.p_x_high_limbs_range_constraint_1[i + 1], + prover_polynomials.p_x_high_limbs_range_constraint_2[i + 1], + prover_polynomials.p_x_high_limbs_range_constraint_3[i + 1], + prover_polynomials.p_x_high_limbs_range_constraint_4[i + 1]); + + // Slice low limbs of P.y into range constraint microlimbs + decompose_standard_limb(prover_polynomials.p_y_low_limbs[i], + prover_polynomials.p_y_low_limbs_range_constraint_0[i], + prover_polynomials.p_y_low_limbs_range_constraint_1[i], + prover_polynomials.p_y_low_limbs_range_constraint_2[i], + prover_polynomials.p_y_low_limbs_range_constraint_3[i], + prover_polynomials.p_y_low_limbs_range_constraint_4[i], + prover_polynomials.p_y_low_limbs_range_constraint_tail[i]); + + decompose_standard_limb(prover_polynomials.p_y_low_limbs[i + 1], + prover_polynomials.p_y_low_limbs_range_constraint_0[i + 1], + prover_polynomials.p_y_low_limbs_range_constraint_1[i + 1], + prover_polynomials.p_y_low_limbs_range_constraint_2[i + 1], + prover_polynomials.p_y_low_limbs_range_constraint_3[i + 1], + prover_polynomials.p_y_low_limbs_range_constraint_4[i + 1], + prover_polynomials.p_y_low_limbs_range_constraint_tail[i + 1]); + + // Slice high limbs of P.y into range constraint microlimbs + decompose_standard_limb(prover_polynomials.p_y_high_limbs[i], + prover_polynomials.p_y_high_limbs_range_constraint_0[i], + prover_polynomials.p_y_high_limbs_range_constraint_1[i], + prover_polynomials.p_y_high_limbs_range_constraint_2[i], + prover_polynomials.p_y_high_limbs_range_constraint_3[i], + prover_polynomials.p_y_high_limbs_range_constraint_4[i], + prover_polynomials.p_y_high_limbs_range_constraint_tail[i]); + + decompose_standard_top_limb(prover_polynomials.p_y_high_limbs[i + 1], + prover_polynomials.p_y_high_limbs_range_constraint_0[i + 1], + prover_polynomials.p_y_high_limbs_range_constraint_1[i + 1], + prover_polynomials.p_y_high_limbs_range_constraint_2[i + 1], + prover_polynomials.p_y_high_limbs_range_constraint_3[i + 1], + prover_polynomials.p_y_high_limbs_range_constraint_4[i + 1]); + + // Slice low limb of of z1 and z2 into range constraints + decompose_standard_limb(prover_polynomials.z_low_limbs[i], + prover_polynomials.z_low_limbs_range_constraint_0[i], + prover_polynomials.z_low_limbs_range_constraint_1[i], + prover_polynomials.z_low_limbs_range_constraint_2[i], + prover_polynomials.z_low_limbs_range_constraint_3[i], + prover_polynomials.z_low_limbs_range_constraint_4[i], + prover_polynomials.z_low_limbs_range_constraint_tail[i]); + + decompose_standard_limb(prover_polynomials.z_low_limbs[i + 1], + prover_polynomials.z_low_limbs_range_constraint_0[i + 1], + prover_polynomials.z_low_limbs_range_constraint_1[i + 1], + prover_polynomials.z_low_limbs_range_constraint_2[i + 1], + prover_polynomials.z_low_limbs_range_constraint_3[i + 1], + prover_polynomials.z_low_limbs_range_constraint_4[i + 1], + prover_polynomials.z_low_limbs_range_constraint_tail[i + 1]); + + // Slice high limb of of z1 and z2 into range constraints + decompose_standard_top_z_limb(prover_polynomials.z_high_limbs[i], + prover_polynomials.z_high_limbs_range_constraint_0[i], + prover_polynomials.z_high_limbs_range_constraint_1[i], + prover_polynomials.z_high_limbs_range_constraint_2[i], + prover_polynomials.z_high_limbs_range_constraint_3[i], + prover_polynomials.z_high_limbs_range_constraint_4[i], + prover_polynomials.z_high_limbs_range_constraint_tail[i]); + + decompose_standard_top_z_limb(prover_polynomials.z_high_limbs[i + 1], + prover_polynomials.z_high_limbs_range_constraint_0[i + 1], + prover_polynomials.z_high_limbs_range_constraint_1[i + 1], + prover_polynomials.z_high_limbs_range_constraint_2[i + 1], + prover_polynomials.z_high_limbs_range_constraint_3[i + 1], + prover_polynomials.z_high_limbs_range_constraint_4[i + 1], + prover_polynomials.z_high_limbs_range_constraint_tail[i + 1]); + + // Slice accumulator limbs into range constraints + decompose_standard_limb(prover_polynomials.accumulators_binary_limbs_0[i], + prover_polynomials.accumulator_low_limbs_range_constraint_0[i], + prover_polynomials.accumulator_low_limbs_range_constraint_1[i], + prover_polynomials.accumulator_low_limbs_range_constraint_2[i], + prover_polynomials.accumulator_low_limbs_range_constraint_3[i], + prover_polynomials.accumulator_low_limbs_range_constraint_4[i], + prover_polynomials.accumulator_low_limbs_range_constraint_tail[i]); + decompose_standard_limb(prover_polynomials.accumulators_binary_limbs_1[i], + prover_polynomials.accumulator_low_limbs_range_constraint_0[i + 1], + prover_polynomials.accumulator_low_limbs_range_constraint_1[i + 1], + prover_polynomials.accumulator_low_limbs_range_constraint_2[i + 1], + prover_polynomials.accumulator_low_limbs_range_constraint_3[i + 1], + prover_polynomials.accumulator_low_limbs_range_constraint_4[i + 1], + prover_polynomials.accumulator_low_limbs_range_constraint_tail[i + 1]); + + decompose_standard_limb(prover_polynomials.accumulators_binary_limbs_2[i], + prover_polynomials.accumulator_high_limbs_range_constraint_0[i], + prover_polynomials.accumulator_high_limbs_range_constraint_1[i], + prover_polynomials.accumulator_high_limbs_range_constraint_2[i], + prover_polynomials.accumulator_high_limbs_range_constraint_3[i], + prover_polynomials.accumulator_high_limbs_range_constraint_4[i], + prover_polynomials.accumulator_high_limbs_range_constraint_tail[i]); + decompose_standard_top_limb(prover_polynomials.accumulators_binary_limbs_3[i], + prover_polynomials.accumulator_high_limbs_range_constraint_0[i + 1], + prover_polynomials.accumulator_high_limbs_range_constraint_1[i + 1], + prover_polynomials.accumulator_high_limbs_range_constraint_2[i + 1], + prover_polynomials.accumulator_high_limbs_range_constraint_3[i + 1], + prover_polynomials.accumulator_high_limbs_range_constraint_4[i + 1]); + + // Slice quotient limbs into range constraints + decompose_standard_limb(prover_polynomials.quotient_low_binary_limbs[i], + prover_polynomials.quotient_low_limbs_range_constraint_0[i], + prover_polynomials.quotient_low_limbs_range_constraint_1[i], + prover_polynomials.quotient_low_limbs_range_constraint_2[i], + prover_polynomials.quotient_low_limbs_range_constraint_3[i], + prover_polynomials.quotient_low_limbs_range_constraint_4[i], + prover_polynomials.quotient_low_limbs_range_constraint_tail[i]); + decompose_standard_limb(prover_polynomials.quotient_low_binary_limbs_shift[i], + prover_polynomials.quotient_low_limbs_range_constraint_0[i + 1], + prover_polynomials.quotient_low_limbs_range_constraint_1[i + 1], + prover_polynomials.quotient_low_limbs_range_constraint_2[i + 1], + prover_polynomials.quotient_low_limbs_range_constraint_3[i + 1], + prover_polynomials.quotient_low_limbs_range_constraint_4[i + 1], + prover_polynomials.quotient_low_limbs_range_constraint_tail[i + 1]); + + decompose_standard_limb(prover_polynomials.quotient_high_binary_limbs[i], + prover_polynomials.quotient_high_limbs_range_constraint_0[i], + prover_polynomials.quotient_high_limbs_range_constraint_1[i], + prover_polynomials.quotient_high_limbs_range_constraint_2[i], + prover_polynomials.quotient_high_limbs_range_constraint_3[i], + prover_polynomials.quotient_high_limbs_range_constraint_4[i], + prover_polynomials.quotient_high_limbs_range_constraint_tail[i]); + + decompose_top_quotient_limb(prover_polynomials.quotient_high_binary_limbs_shift[i], + prover_polynomials.quotient_high_limbs_range_constraint_0[i + 1], + prover_polynomials.quotient_high_limbs_range_constraint_1[i + 1], + prover_polynomials.quotient_high_limbs_range_constraint_2[i + 1], + prover_polynomials.quotient_high_limbs_range_constraint_3[i + 1], + prover_polynomials.quotient_high_limbs_range_constraint_4[i + 1]); + + // Decompose wide relation limbs into range constraints + decompose_relation_limb(prover_polynomials.relation_wide_limbs[i], + prover_polynomials.relation_wide_limbs_range_constraint_0[i], + prover_polynomials.relation_wide_limbs_range_constraint_1[i], + prover_polynomials.relation_wide_limbs_range_constraint_2[i], + prover_polynomials.relation_wide_limbs_range_constraint_3[i], + prover_polynomials.p_x_high_limbs_range_constraint_tail[i + 1], + prover_polynomials.accumulator_high_limbs_range_constraint_tail[i + 1]); + + decompose_relation_limb(prover_polynomials.relation_wide_limbs[i + 1], + prover_polynomials.relation_wide_limbs_range_constraint_0[i + 1], + prover_polynomials.relation_wide_limbs_range_constraint_1[i + 1], + prover_polynomials.relation_wide_limbs_range_constraint_2[i + 1], + prover_polynomials.relation_wide_limbs_range_constraint_3[i + 1], + prover_polynomials.p_y_high_limbs_range_constraint_tail[i + 1], + prover_polynomials.quotient_high_limbs_range_constraint_tail[i + 1]); + } + + using Relations = Flavor::Relations; + // Check that Decomposition relation is satisfied across each row of the prover polynomials + check_relation>(circuit_size, prover_polynomials, params); +} + +/** + * @brief Test the correctness of GoblinTranslatorFlavor's NonNativeField Relation + * + */ +TEST_F(GoblinTranslatorRelationCorrectnessTests, NonNative) +{ + using Flavor = GoblinTranslatorFlavor; + using FF = typename Flavor::FF; + using BF = typename Flavor::BF; + using ProverPolynomials = typename Flavor::ProverPolynomials; + using ProverPolynomialIds = typename Flavor::ProverPolynomialIds; + using GroupElement = typename Flavor::GroupElement; + using Polynomial = bb::Polynomial; + + constexpr size_t NUM_LIMB_BITS = Flavor::NUM_LIMB_BITS; + constexpr auto mini_circuit_size = 2048; + constexpr auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; + + auto& engine = numeric::get_debug_randomness(); + + auto op_queue = std::make_shared(); + + // Generate random EccOpQueue actions + for (size_t i = 0; i < ((mini_circuit_size >> 1) - 1); i++) { + switch (engine.get_random_uint8() & 3) { + case 0: + op_queue->empty_row(); + break; + case 1: + op_queue->eq(); + break; + case 2: + op_queue->add_accumulate(GroupElement::random_element(&engine)); + break; + case 3: + op_queue->mul_accumulate(GroupElement::random_element(&engine), FF::random_element(&engine)); + break; + } + } + const auto batching_challenge_v = BF::random_element(&engine); + const auto evaluation_input_x = BF::random_element(&engine); + + // Generating all the values is pretty tedious, so just use CircuitBuilder + auto circuit_builder = GoblinTranslatorCircuitBuilder(batching_challenge_v, evaluation_input_x, op_queue); + + // The non-native field relation uses limbs of evaluation_input_x and powers of batching_challenge_v as inputs + RelationParameters params; + auto v_power = BF::one(); + for (size_t i = 0; i < 4 /*Number of powers of v that we need {1,2,3,4}*/; i++) { + v_power *= batching_challenge_v; + auto uint_v_power = uint256_t(v_power); + params.batching_challenge_v[i] = { uint_v_power.slice(0, NUM_LIMB_BITS), + uint_v_power.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2), + uint_v_power.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3), + uint_v_power.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4), + uint_v_power }; + } + auto uint_input_x = uint256_t(evaluation_input_x); + params.evaluation_input_x = { uint_input_x.slice(0, NUM_LIMB_BITS), + uint_input_x.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2), + uint_input_x.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3), + uint_input_x.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4), + uint_input_x }; + + // Create storage for polynomials + ProverPolynomials prover_polynomials; + // We use polynomial ids to make shifting the polynomials easier + ProverPolynomialIds prover_polynomial_ids; + std::vector polynomial_container; + std::vector polynomial_ids; + auto polynomial_get_all = prover_polynomials.get_all(); + auto polynomial_id_get_all = prover_polynomial_ids.get_all(); + for (size_t i = 0; i < polynomial_get_all.size(); i++) { + Polynomial temporary_polynomial(circuit_size); + // Allocate polynomials + polynomial_container.push_back(temporary_polynomial); + // Push sequential ids to polynomial ids + polynomial_ids.push_back(i); + polynomial_id_get_all[i] = polynomial_ids[i]; + } + // Get ids of shifted polynomials and put them in a set + auto shifted_ids = prover_polynomial_ids.get_shifted(); + std::unordered_set shifted_id_set; + for (auto& id : shifted_ids) { + shifted_id_set.emplace(id); + } + // Assign to non-shifted prover polynomials + for (size_t i = 0; i < polynomial_get_all.size(); i++) { + if (!shifted_id_set.contains(i)) { + polynomial_get_all[i] = polynomial_container[i].share(); + } + } + + // Assign to shifted prover polynomials using ids + for (size_t i = 0; i < shifted_ids.size(); i++) { + auto shifted_id = shifted_ids[i]; + auto to_be_shifted_id = prover_polynomial_ids.get_to_be_shifted()[i]; + polynomial_get_all[shifted_id] = polynomial_container[to_be_shifted_id].shifted(); + } + + // Copy values of wires used in the non-native field relation from the circuit builder + for (size_t i = 1; i < circuit_builder.get_num_gates(); i++) { + prover_polynomials.op[i] = circuit_builder.get_variable(circuit_builder.wires[circuit_builder.OP][i]); + prover_polynomials.p_x_low_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_X_LOW_LIMBS][i]); + prover_polynomials.p_x_high_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_X_HIGH_LIMBS][i]); + prover_polynomials.p_y_low_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_Y_LOW_LIMBS][i]); + prover_polynomials.p_y_high_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_Y_HIGH_LIMBS][i]); + prover_polynomials.z_low_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.Z_LOW_LIMBS][i]); + prover_polynomials.z_high_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.Z_HIGH_LIMBS][i]); + prover_polynomials.accumulators_binary_limbs_0[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_0][i]); + prover_polynomials.accumulators_binary_limbs_1[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_1][i]); + prover_polynomials.accumulators_binary_limbs_2[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_2][i]); + prover_polynomials.accumulators_binary_limbs_3[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_3][i]); + prover_polynomials.quotient_low_binary_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.QUOTIENT_LOW_BINARY_LIMBS][i]); + prover_polynomials.quotient_high_binary_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.QUOTIENT_HIGH_BINARY_LIMBS][i]); + prover_polynomials.relation_wide_limbs[i] = + circuit_builder.get_variable(circuit_builder.wires[circuit_builder.RELATION_WIDE_LIMBS][i]); + } + + // Fill in lagrange odd polynomial + for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { + prover_polynomials.lagrange_odd_in_minicircuit[i] = 1; + } + + using Relations = Flavor::Relations; + // Check that Non-Native Field relation is satisfied across each row of the prover polynomials + check_relation>(circuit_size, prover_polynomials, params); +} diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp index 6c2452e2057..b7729c1099f 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/databus_composer.test.cpp @@ -4,9 +4,9 @@ #include "barretenberg/common/log.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/proof_system/instance_inspector.hpp" +#include "barretenberg/plonk_honk_shared/instance_inspector.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp index f998b8f492a..0de11685844 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/goblin_ultra_composer.test.cpp @@ -4,8 +4,8 @@ #include "barretenberg/common/log.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 "barretenberg/ultra_honk/merge_prover.hpp" #include "barretenberg/ultra_honk/merge_verifier.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp index c4002403382..6645ae2d1c5 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp @@ -1,10 +1,10 @@ #pragma once #include "barretenberg/commitment_schemes/claim.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp index 38749c1347f..f6305a6aef0 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp @@ -1,11 +1,11 @@ #pragma once #include "barretenberg/commitment_schemes/claim.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" -#include "barretenberg/proof_system/op_queue/ecc_op_queue.hpp" #include "barretenberg/srs/global_crs.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/op_queue/ecc_op_queue.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.hpp index fcf81279651..ba92115bdc5 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.hpp @@ -19,8 +19,8 @@ // clang-format on #include -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/oink_verifier.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/oink_verifier.hpp index 1386c1717b5..41d6faaad18 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/oink_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/oink_verifier.hpp @@ -1,10 +1,10 @@ #pragma once #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp index 4f7e2c1ed41..9a8f16b282b 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp @@ -1,8 +1,5 @@ -#include "barretenberg/flavor/goblin_translator.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" #include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/ecc_op_queue_relation.hpp" @@ -11,6 +8,8 @@ #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/prover_instance.hpp" #include @@ -229,7 +228,7 @@ template void create_some_ecc_op_queue_gates(auto& circuit_bui } } -class RelationCorrectnessTests : public ::testing::Test { +class UltraRelationCorrectnessTests : public ::testing::Test { protected: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } }; @@ -245,7 +244,7 @@ class RelationCorrectnessTests : public ::testing::Test { * */ // TODO(luke): Add a gate that sets q_arith = 3 to check secondary arithmetic relation -TEST_F(RelationCorrectnessTests, UltraRelationCorrectness) +TEST_F(UltraRelationCorrectnessTests, Ultra) { using Flavor = UltraFlavor; using FF = typename Flavor::FF; @@ -296,7 +295,7 @@ TEST_F(RelationCorrectnessTests, UltraRelationCorrectness) check_relation>(circuit_size, prover_polynomials, params); } -TEST_F(RelationCorrectnessTests, GoblinUltraRelationCorrectness) +TEST_F(UltraRelationCorrectnessTests, GoblinUltra) { using Flavor = GoblinUltraFlavor; using FF = typename Flavor::FF; @@ -357,819 +356,4 @@ TEST_F(RelationCorrectnessTests, GoblinUltraRelationCorrectness) check_relation>(circuit_size, prover_polynomials, params); check_linearly_dependent_relation>( circuit_size, prover_polynomials, params); -} - -/** - * @brief Test the correctness of GolbinTranslator's Permutation Relation - * - */ -TEST_F(RelationCorrectnessTests, GoblinTranslatorPermutationRelationCorrectness) -{ - using Flavor = GoblinTranslatorFlavor; - using FF = typename Flavor::FF; - using ProverPolynomials = typename Flavor::ProverPolynomials; - using Polynomial = bb::Polynomial; - auto& engine = numeric::get_debug_randomness(); - const size_t mini_circuit_size = 2048; - auto full_circuit_size = mini_circuit_size * Flavor::CONCATENATION_GROUP_SIZE; - - // We only need gamma, because permutationr elation only uses gamma - FF gamma = FF::random_element(); - - // Fill relation parameters - RelationParameters params; - params.gamma = gamma; - - // Create storage for polynomials - ProverPolynomials prover_polynomials; - for (Polynomial& prover_poly : prover_polynomials.get_all()) { - prover_poly = Polynomial{ full_circuit_size }; - } - - // Fill in lagrange polynomials used in the permutation relation - prover_polynomials.lagrange_first[0] = 1; - prover_polynomials.lagrange_last[full_circuit_size - 1] = 1; - - // Put random values in all the non-concatenated constraint polynomials used to range constrain the values - auto fill_polynomial_with_random_14_bit_values = [&](auto& polynomial) { - for (size_t i = 0; i < mini_circuit_size; i++) { - polynomial[i] = engine.get_random_uint16() & ((1 << Flavor::MICRO_LIMB_BITS) - 1); - } - }; - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_low_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_x_high_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_low_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.p_y_high_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_low_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.z_high_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_low_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.accumulator_high_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_low_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_3); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_4); - fill_polynomial_with_random_14_bit_values(prover_polynomials.quotient_high_limbs_range_constraint_tail); - fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_0); - fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_1); - fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_2); - fill_polynomial_with_random_14_bit_values(prover_polynomials.relation_wide_limbs_range_constraint_3); - - // Compute ordered range constraint polynomials that go in the denominator of the grand product polynomial - compute_goblin_translator_range_constraint_ordered_polynomials(&prover_polynomials, mini_circuit_size); - - // Compute the fixed numerator (part of verification key) - prover_polynomials.compute_extra_range_constraint_numerator(); - - // Compute concatenated polynomials (4 polynomials produced from other constraint polynomials by concatenation) - compute_concatenated_polynomials(&prover_polynomials); - - // Compute the grand product polynomial - compute_grand_product>( - full_circuit_size, prover_polynomials, params); - prover_polynomials.z_perm_shift = prover_polynomials.z_perm.shifted(); - - using Relations = typename Flavor::Relations; - - // Check that permutation relation is satisfied across each row of the prover polynomials - check_relation>(full_circuit_size, prover_polynomials, params); -} - -TEST_F(RelationCorrectnessTests, GoblinTranslatorDeltaRangeConstraintRelationCorrectness) -{ - using Flavor = GoblinTranslatorFlavor; - using FF = typename Flavor::FF; - using ProverPolynomials = typename Flavor::ProverPolynomials; - using Polynomial = bb::Polynomial; - auto& engine = numeric::get_debug_randomness(); - const size_t mini_circuit_size = 2048; - const auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; - const auto sort_step = Flavor::SORT_STEP; - const auto max_value = (1 << Flavor::MICRO_LIMB_BITS) - 1; - - // No relation parameters are used in this relation - RelationParameters params; - - ProverPolynomials prover_polynomials; - // Allocate polynomials - for (Polynomial& polynomial : prover_polynomials.get_all()) { - polynomial = Polynomial{ circuit_size }; - } - - // Construct lagrange polynomials that are needed for Goblin Translator's DeltaRangeConstraint Relation - prover_polynomials.lagrange_first[0] = 1; - prover_polynomials.lagrange_last[circuit_size - 1] = 1; - - // Create a vector and fill with necessary steps for the DeltaRangeConstraint relation - auto sorted_elements_count = (max_value / sort_step) + 1; - std::vector vector_for_sorting(circuit_size); - for (size_t i = 0; i < sorted_elements_count - 1; i++) { - vector_for_sorting[i] = i * sort_step; - } - vector_for_sorting[sorted_elements_count - 1] = max_value; - - // Add random values to fill the leftover space - for (size_t i = sorted_elements_count; i < circuit_size; i++) { - vector_for_sorting[i] = engine.get_random_uint16() & ((1 << Flavor::MICRO_LIMB_BITS) - 1); - } - - // Get ordered polynomials - auto polynomial_pointers = std::vector{ &prover_polynomials.ordered_range_constraints_0, - &prover_polynomials.ordered_range_constraints_1, - &prover_polynomials.ordered_range_constraints_2, - &prover_polynomials.ordered_range_constraints_3, - &prover_polynomials.ordered_range_constraints_4 }; - - // Sort the vector - std::sort(vector_for_sorting.begin(), vector_for_sorting.end()); - - // Copy values, transforming them into Finite Field elements - std::transform(vector_for_sorting.cbegin(), - vector_for_sorting.cend(), - prover_polynomials.ordered_range_constraints_0.begin(), - [](uint64_t in) { return FF(in); }); - - // Copy the same polynomial into the 4 other ordered polynomials (they are not the same in an actual proof, but we - // only need to check the correctness of the relation and it acts independently on each polynomial) - parallel_for(4, [&](size_t i) { - std::copy(prover_polynomials.ordered_range_constraints_0.begin(), - prover_polynomials.ordered_range_constraints_0.end(), - polynomial_pointers[i + 1]->begin()); - }); - - // Get shifted polynomials - prover_polynomials.ordered_range_constraints_0_shift = prover_polynomials.ordered_range_constraints_0.shifted(); - prover_polynomials.ordered_range_constraints_1_shift = prover_polynomials.ordered_range_constraints_1.shifted(); - prover_polynomials.ordered_range_constraints_2_shift = prover_polynomials.ordered_range_constraints_2.shifted(); - prover_polynomials.ordered_range_constraints_3_shift = prover_polynomials.ordered_range_constraints_3.shifted(); - prover_polynomials.ordered_range_constraints_4_shift = prover_polynomials.ordered_range_constraints_4.shifted(); - - using Relations = typename Flavor::Relations; - - // Check that DeltaRangeConstraint relation is satisfied across each row of the prover polynomials - check_relation>(circuit_size, prover_polynomials, params); -} - -/** - * @brief Test the correctness of GoblinTranslatorFlavor's extra relations (GoblinTranslatorOpcodeConstraintRelation - * and GoblinTranslatorAccumulatorTransferRelation) - * - */ -TEST_F(RelationCorrectnessTests, GoblinTranslatorExtraRelationsCorrectness) -{ - using Flavor = GoblinTranslatorFlavor; - using FF = typename Flavor::FF; - using ProverPolynomials = typename Flavor::ProverPolynomials; - using ProverPolynomialIds = typename Flavor::ProverPolynomialIds; - using Polynomial = bb::Polynomial; - - auto& engine = numeric::get_debug_randomness(); - - const size_t mini_circuit_size = 2048; - const auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; - - // We only use accumulated_result from relation parameters in this relation - RelationParameters params; - params.accumulated_result = { - FF::random_element(), FF::random_element(), FF::random_element(), FF::random_element() - }; - - // Create storage for polynomials - ProverPolynomials prover_polynomials; - // We use polynomial ids to make shifting the polynomials easier - ProverPolynomialIds prover_polynomial_ids; - auto polynomial_id_get_all = prover_polynomial_ids.get_all(); - std::vector polynomial_container; - std::vector polynomial_ids; - for (size_t i = 0; i < polynomial_id_get_all.size(); i++) { - Polynomial temporary_polynomial(circuit_size); - // Allocate polynomials - polynomial_container.push_back(temporary_polynomial); - // Push sequential ids to polynomial ids - polynomial_ids.push_back(i); - polynomial_id_get_all[i] = polynomial_ids[i]; - } - // Get ids of shifted polynomials and put them in a set - auto shifted_ids = prover_polynomial_ids.get_shifted(); - std::unordered_set shifted_id_set; - for (auto& id : shifted_ids) { - shifted_id_set.emplace(id); - } - // Assign to non-shifted prover polynomials - auto polynomial_get_all = prover_polynomials.get_all(); - for (size_t i = 0; i < polynomial_get_all.size(); i++) { - if (!shifted_id_set.contains(i)) { - polynomial_get_all[i] = polynomial_container[i].share(); - } - } - - // Assign to shifted prover polynomials using ids - for (size_t i = 0; i < shifted_ids.size(); i++) { - auto shifted_id = shifted_ids[i]; - auto to_be_shifted_id = prover_polynomial_ids.get_to_be_shifted()[i]; - polynomial_get_all[shifted_id] = polynomial_container[to_be_shifted_id].shifted(); - } - - // Fill in lagrange even polynomial - for (size_t i = 2; i < mini_circuit_size; i += 2) { - prover_polynomials.lagrange_even_in_minicircuit[i] = 1; - } - constexpr size_t NUMBER_OF_POSSIBLE_OPCODES = 6; - constexpr std::array possible_opcode_values = { 0, 1, 2, 3, 4, 8 }; - - // Assign random opcode values - for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { - prover_polynomials.op[i] = - possible_opcode_values[static_cast(engine.get_random_uint8() % NUMBER_OF_POSSIBLE_OPCODES)]; - } - - // Initialize used lagrange polynomials - prover_polynomials.lagrange_second[1] = 1; - prover_polynomials.lagrange_second_to_last_in_minicircuit[mini_circuit_size - 2] = 1; - - // Put random values in accumulator binary limbs (values should be preserved across even->next odd shift) - for (size_t i = 2; i < mini_circuit_size - 2; i += 2) { - prover_polynomials.accumulators_binary_limbs_0[i] = FF ::random_element(); - prover_polynomials.accumulators_binary_limbs_1[i] = FF ::random_element(); - prover_polynomials.accumulators_binary_limbs_2[i] = FF ::random_element(); - prover_polynomials.accumulators_binary_limbs_3[i] = FF ::random_element(); - prover_polynomials.accumulators_binary_limbs_0[i + 1] = prover_polynomials.accumulators_binary_limbs_0[i]; - prover_polynomials.accumulators_binary_limbs_1[i + 1] = prover_polynomials.accumulators_binary_limbs_1[i]; - prover_polynomials.accumulators_binary_limbs_2[i + 1] = prover_polynomials.accumulators_binary_limbs_2[i]; - prover_polynomials.accumulators_binary_limbs_3[i + 1] = prover_polynomials.accumulators_binary_limbs_3[i]; - } - - // The values of accumulator binary limbs at index 1 should equal the accumulated result from relation parameters - prover_polynomials.accumulators_binary_limbs_0[1] = params.accumulated_result[0]; - prover_polynomials.accumulators_binary_limbs_1[1] = params.accumulated_result[1]; - prover_polynomials.accumulators_binary_limbs_2[1] = params.accumulated_result[2]; - prover_polynomials.accumulators_binary_limbs_3[1] = params.accumulated_result[3]; - - using Relations = typename Flavor::Relations; - - // Check that Opcode Constraint relation is satisfied across each row of the prover polynomials - check_relation>(circuit_size, prover_polynomials, params); - - // Check that Accumulator Transfer relation is satisfied across each row of the prover polynomials - check_relation>(circuit_size, prover_polynomials, params); -} -/** - * @brief Test the correctness of GoblinTranslatorFlavor's Decomposition Relation - * - */ -TEST_F(RelationCorrectnessTests, GoblinTranslatorDecompositionRelationCorrectness) -{ - using Flavor = GoblinTranslatorFlavor; - using FF = typename Flavor::FF; - using BF = typename Flavor::BF; - using ProverPolynomials = typename Flavor::ProverPolynomials; - using ProverPolynomialIds = typename Flavor::ProverPolynomialIds; - using Polynomial = bb::Polynomial; - auto& engine = numeric::get_debug_randomness(); - - constexpr size_t mini_circuit_size = 2048; - const auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; - - // Decomposition relation doesn't use any relation parameters - RelationParameters params; - - // Create storage for polynomials - ProverPolynomials prover_polynomials; - // We use polynomial ids to make shifting the polynomials easier - ProverPolynomialIds prover_polynomial_ids; - std::vector polynomial_container; - std::vector polynomial_ids; - auto polynomial_id_get_all = prover_polynomial_ids.get_all(); - auto polynomial_get_all = prover_polynomials.get_all(); - for (size_t i = 0; i < polynomial_id_get_all.size(); i++) { - Polynomial temporary_polynomial(circuit_size); - // Allocate polynomials - polynomial_container.push_back(temporary_polynomial); - // Push sequential ids to polynomial ids - polynomial_ids.push_back(i); - polynomial_id_get_all[i] = polynomial_ids[i]; - } - // Get ids of shifted polynomials and put them in a set - auto shifted_ids = prover_polynomial_ids.get_shifted(); - std::unordered_set shifted_id_set; - for (auto& id : shifted_ids) { - shifted_id_set.emplace(id); - } - // Assign spans to non-shifted prover polynomials - for (size_t i = 0; i < polynomial_get_all.size(); i++) { - if (!shifted_id_set.contains(i)) { - polynomial_get_all[i] = polynomial_container[i].share(); - } - } - - // Assign shifted spans to shifted prover polynomials using ids - for (size_t i = 0; i < shifted_ids.size(); i++) { - auto shifted_id = shifted_ids[i]; - auto to_be_shifted_id = prover_polynomial_ids.get_to_be_shifted()[i]; - polynomial_get_all[shifted_id] = polynomial_container[to_be_shifted_id].shifted(); - } - - // Fill in lagrange odd polynomial (the only non-witness one we are using) - for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { - prover_polynomials.lagrange_odd_in_minicircuit[i] = 1; - } - - constexpr size_t NUM_LIMB_BITS = Flavor::CircuitBuilder::NUM_LIMB_BITS; - constexpr size_t HIGH_WIDE_LIMB_WIDTH = - Flavor::CircuitBuilder::NUM_LIMB_BITS + Flavor::CircuitBuilder::NUM_LAST_LIMB_BITS; - constexpr size_t LOW_WIDE_LIMB_WIDTH = Flavor::CircuitBuilder::NUM_LIMB_BITS * 2; - constexpr size_t Z_LIMB_WIDTH = 128; - constexpr size_t MICRO_LIMB_WIDTH = Flavor::MICRO_LIMB_BITS; - constexpr size_t SHIFT_12_TO_14 = 4; - constexpr size_t SHIFT_10_TO_14 = 16; - constexpr size_t SHIFT_8_TO_14 = 64; - constexpr size_t SHIFT_4_TO_14 = 1024; - - /** - * @brief Decompose a standard 68-bit limb of binary into 5 14-bit limbs and the 6th limb that is the same as the - * 5th but shifted by 2 bits - * - */ - auto decompose_standard_limb = - [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& limb_4, auto& shifted_limb) { - limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); - limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); - limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); - limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); - limb_4 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 4, MICRO_LIMB_WIDTH * 5); - shifted_limb = limb_4 * SHIFT_12_TO_14; - }; - - /** - * @brief Decompose a standard 50-bit top limb into 4 14-bit limbs and the 5th limb that is the same as 5th, but - * shifted by 6 bits - * - */ - auto decompose_standard_top_limb = - [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& shifted_limb) { - limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); - limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); - limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); - limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); - shifted_limb = limb_3 * SHIFT_8_TO_14; - }; - - /** - * @brief Decompose the 60-bit top limb of z1 or z2 into 5 14-bit limbs and a 6th limb which is equal to the 5th, - * but shifted by 10 bits. - * - */ - auto decompose_standard_top_z_limb = - [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& limb_4, auto& shifted_limb) { - limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); - limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); - limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); - limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); - limb_4 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 4, MICRO_LIMB_WIDTH * 5); - shifted_limb = limb_4 * SHIFT_4_TO_14; - }; - - /** - * @brief Decompose the 52-bit top limb of quotient into 4 14-bit limbs and the 5th limb that is the same as 5th, - * but shifted by 4 bits - * - */ - auto decompose_top_quotient_limb = - [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& shifted_limb) { - limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); - limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); - limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); - limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); - shifted_limb = limb_3 * SHIFT_10_TO_14; - }; - - /** - * @brief Decompose relation wide limb into 6 14-bit limbs - * - */ - auto decompose_relation_limb = - [](auto& input, auto& limb_0, auto& limb_1, auto& limb_2, auto& limb_3, auto& limb_4, auto& limb_5) { - limb_0 = uint256_t(input).slice(0, MICRO_LIMB_WIDTH); - limb_1 = uint256_t(input).slice(MICRO_LIMB_WIDTH, MICRO_LIMB_WIDTH * 2); - limb_2 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 2, MICRO_LIMB_WIDTH * 3); - limb_3 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 3, MICRO_LIMB_WIDTH * 4); - limb_4 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 4, MICRO_LIMB_WIDTH * 5); - limb_5 = uint256_t(input).slice(MICRO_LIMB_WIDTH * 5, MICRO_LIMB_WIDTH * 6); - }; - - // Put random values in all the non-concatenated constraint polynomials used to range constrain the values - for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { - // P.x - prover_polynomials.x_lo_y_hi[i] = FF(engine.get_random_uint256() & ((uint256_t(1) << LOW_WIDE_LIMB_WIDTH) - 1)); - prover_polynomials.x_hi_z_1[i] = FF(engine.get_random_uint256() & ((uint256_t(1) << HIGH_WIDE_LIMB_WIDTH) - 1)); - - // P.y - prover_polynomials.y_lo_z_2[i] = FF(engine.get_random_uint256() & ((uint256_t(1) << LOW_WIDE_LIMB_WIDTH) - 1)); - prover_polynomials.x_lo_y_hi[i + 1] = - FF(engine.get_random_uint256() & ((uint256_t(1) << HIGH_WIDE_LIMB_WIDTH) - 1)); - - // z1 and z2 - prover_polynomials.x_hi_z_1[i + 1] = FF(engine.get_random_uint256() & ((uint256_t(1) << Z_LIMB_WIDTH) - 1)); - prover_polynomials.y_lo_z_2[i + 1] = FF(engine.get_random_uint256() & ((uint256_t(1) << Z_LIMB_WIDTH) - 1)); - - // Slice P.x into chunks - prover_polynomials.p_x_low_limbs[i] = uint256_t(prover_polynomials.x_lo_y_hi[i]).slice(0, NUM_LIMB_BITS); - prover_polynomials.p_x_low_limbs[i + 1] = - uint256_t(prover_polynomials.x_lo_y_hi[i]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); - prover_polynomials.p_x_high_limbs[i] = uint256_t(prover_polynomials.x_hi_z_1[i]).slice(0, NUM_LIMB_BITS); - prover_polynomials.p_x_high_limbs[i + 1] = - uint256_t(prover_polynomials.x_hi_z_1[i]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); - - // Slice P.y into chunks - prover_polynomials.p_y_low_limbs[i] = uint256_t(prover_polynomials.y_lo_z_2[i]).slice(0, NUM_LIMB_BITS); - prover_polynomials.p_y_low_limbs[i + 1] = - uint256_t(prover_polynomials.y_lo_z_2[i]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); - prover_polynomials.p_y_high_limbs[i] = uint256_t(prover_polynomials.x_lo_y_hi[i + 1]).slice(0, NUM_LIMB_BITS); - prover_polynomials.p_y_high_limbs[i + 1] = - uint256_t(prover_polynomials.x_lo_y_hi[i + 1]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); - - // Slice z1 and z2 into chunks - prover_polynomials.z_low_limbs[i] = uint256_t(prover_polynomials.x_hi_z_1[i + 1]).slice(0, NUM_LIMB_BITS); - prover_polynomials.z_low_limbs[i + 1] = uint256_t(prover_polynomials.y_lo_z_2[i + 1]).slice(0, NUM_LIMB_BITS); - prover_polynomials.z_high_limbs[i] = - uint256_t(prover_polynomials.x_hi_z_1[i + 1]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); - prover_polynomials.z_high_limbs[i + 1] = - uint256_t(prover_polynomials.y_lo_z_2[i + 1]).slice(NUM_LIMB_BITS, 2 * NUM_LIMB_BITS); - - // Slice accumulator - auto tmp = uint256_t(BF::random_element(&engine)); - prover_polynomials.accumulators_binary_limbs_0[i] = tmp.slice(0, NUM_LIMB_BITS); - prover_polynomials.accumulators_binary_limbs_1[i] = tmp.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2); - prover_polynomials.accumulators_binary_limbs_2[i] = tmp.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3); - prover_polynomials.accumulators_binary_limbs_3[i] = tmp.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4); - - // Slice low limbs of P.x into range constraint microlimbs - decompose_standard_limb(prover_polynomials.p_x_low_limbs[i], - prover_polynomials.p_x_low_limbs_range_constraint_0[i], - prover_polynomials.p_x_low_limbs_range_constraint_1[i], - prover_polynomials.p_x_low_limbs_range_constraint_2[i], - prover_polynomials.p_x_low_limbs_range_constraint_3[i], - prover_polynomials.p_x_low_limbs_range_constraint_4[i], - prover_polynomials.p_x_low_limbs_range_constraint_tail[i]); - - decompose_standard_limb(prover_polynomials.p_x_low_limbs[i + 1], - prover_polynomials.p_x_low_limbs_range_constraint_0[i + 1], - prover_polynomials.p_x_low_limbs_range_constraint_1[i + 1], - prover_polynomials.p_x_low_limbs_range_constraint_2[i + 1], - prover_polynomials.p_x_low_limbs_range_constraint_3[i + 1], - prover_polynomials.p_x_low_limbs_range_constraint_4[i + 1], - prover_polynomials.p_x_low_limbs_range_constraint_tail[i + 1]); - - // Slice high limbs of P.x into range constraint microlimbs - decompose_standard_limb(prover_polynomials.p_x_high_limbs[i], - prover_polynomials.p_x_high_limbs_range_constraint_0[i], - prover_polynomials.p_x_high_limbs_range_constraint_1[i], - prover_polynomials.p_x_high_limbs_range_constraint_2[i], - prover_polynomials.p_x_high_limbs_range_constraint_3[i], - prover_polynomials.p_x_high_limbs_range_constraint_4[i], - prover_polynomials.p_x_high_limbs_range_constraint_tail[i]); - - decompose_standard_top_limb(prover_polynomials.p_x_high_limbs[i + 1], - prover_polynomials.p_x_high_limbs_range_constraint_0[i + 1], - prover_polynomials.p_x_high_limbs_range_constraint_1[i + 1], - prover_polynomials.p_x_high_limbs_range_constraint_2[i + 1], - prover_polynomials.p_x_high_limbs_range_constraint_3[i + 1], - prover_polynomials.p_x_high_limbs_range_constraint_4[i + 1]); - - // Slice low limbs of P.y into range constraint microlimbs - decompose_standard_limb(prover_polynomials.p_y_low_limbs[i], - prover_polynomials.p_y_low_limbs_range_constraint_0[i], - prover_polynomials.p_y_low_limbs_range_constraint_1[i], - prover_polynomials.p_y_low_limbs_range_constraint_2[i], - prover_polynomials.p_y_low_limbs_range_constraint_3[i], - prover_polynomials.p_y_low_limbs_range_constraint_4[i], - prover_polynomials.p_y_low_limbs_range_constraint_tail[i]); - - decompose_standard_limb(prover_polynomials.p_y_low_limbs[i + 1], - prover_polynomials.p_y_low_limbs_range_constraint_0[i + 1], - prover_polynomials.p_y_low_limbs_range_constraint_1[i + 1], - prover_polynomials.p_y_low_limbs_range_constraint_2[i + 1], - prover_polynomials.p_y_low_limbs_range_constraint_3[i + 1], - prover_polynomials.p_y_low_limbs_range_constraint_4[i + 1], - prover_polynomials.p_y_low_limbs_range_constraint_tail[i + 1]); - - // Slice high limbs of P.y into range constraint microlimbs - decompose_standard_limb(prover_polynomials.p_y_high_limbs[i], - prover_polynomials.p_y_high_limbs_range_constraint_0[i], - prover_polynomials.p_y_high_limbs_range_constraint_1[i], - prover_polynomials.p_y_high_limbs_range_constraint_2[i], - prover_polynomials.p_y_high_limbs_range_constraint_3[i], - prover_polynomials.p_y_high_limbs_range_constraint_4[i], - prover_polynomials.p_y_high_limbs_range_constraint_tail[i]); - - decompose_standard_top_limb(prover_polynomials.p_y_high_limbs[i + 1], - prover_polynomials.p_y_high_limbs_range_constraint_0[i + 1], - prover_polynomials.p_y_high_limbs_range_constraint_1[i + 1], - prover_polynomials.p_y_high_limbs_range_constraint_2[i + 1], - prover_polynomials.p_y_high_limbs_range_constraint_3[i + 1], - prover_polynomials.p_y_high_limbs_range_constraint_4[i + 1]); - - // Slice low limb of of z1 and z2 into range constraints - decompose_standard_limb(prover_polynomials.z_low_limbs[i], - prover_polynomials.z_low_limbs_range_constraint_0[i], - prover_polynomials.z_low_limbs_range_constraint_1[i], - prover_polynomials.z_low_limbs_range_constraint_2[i], - prover_polynomials.z_low_limbs_range_constraint_3[i], - prover_polynomials.z_low_limbs_range_constraint_4[i], - prover_polynomials.z_low_limbs_range_constraint_tail[i]); - - decompose_standard_limb(prover_polynomials.z_low_limbs[i + 1], - prover_polynomials.z_low_limbs_range_constraint_0[i + 1], - prover_polynomials.z_low_limbs_range_constraint_1[i + 1], - prover_polynomials.z_low_limbs_range_constraint_2[i + 1], - prover_polynomials.z_low_limbs_range_constraint_3[i + 1], - prover_polynomials.z_low_limbs_range_constraint_4[i + 1], - prover_polynomials.z_low_limbs_range_constraint_tail[i + 1]); - - // Slice high limb of of z1 and z2 into range constraints - decompose_standard_top_z_limb(prover_polynomials.z_high_limbs[i], - prover_polynomials.z_high_limbs_range_constraint_0[i], - prover_polynomials.z_high_limbs_range_constraint_1[i], - prover_polynomials.z_high_limbs_range_constraint_2[i], - prover_polynomials.z_high_limbs_range_constraint_3[i], - prover_polynomials.z_high_limbs_range_constraint_4[i], - prover_polynomials.z_high_limbs_range_constraint_tail[i]); - - decompose_standard_top_z_limb(prover_polynomials.z_high_limbs[i + 1], - prover_polynomials.z_high_limbs_range_constraint_0[i + 1], - prover_polynomials.z_high_limbs_range_constraint_1[i + 1], - prover_polynomials.z_high_limbs_range_constraint_2[i + 1], - prover_polynomials.z_high_limbs_range_constraint_3[i + 1], - prover_polynomials.z_high_limbs_range_constraint_4[i + 1], - prover_polynomials.z_high_limbs_range_constraint_tail[i + 1]); - - // Slice accumulator limbs into range constraints - decompose_standard_limb(prover_polynomials.accumulators_binary_limbs_0[i], - prover_polynomials.accumulator_low_limbs_range_constraint_0[i], - prover_polynomials.accumulator_low_limbs_range_constraint_1[i], - prover_polynomials.accumulator_low_limbs_range_constraint_2[i], - prover_polynomials.accumulator_low_limbs_range_constraint_3[i], - prover_polynomials.accumulator_low_limbs_range_constraint_4[i], - prover_polynomials.accumulator_low_limbs_range_constraint_tail[i]); - decompose_standard_limb(prover_polynomials.accumulators_binary_limbs_1[i], - prover_polynomials.accumulator_low_limbs_range_constraint_0[i + 1], - prover_polynomials.accumulator_low_limbs_range_constraint_1[i + 1], - prover_polynomials.accumulator_low_limbs_range_constraint_2[i + 1], - prover_polynomials.accumulator_low_limbs_range_constraint_3[i + 1], - prover_polynomials.accumulator_low_limbs_range_constraint_4[i + 1], - prover_polynomials.accumulator_low_limbs_range_constraint_tail[i + 1]); - - decompose_standard_limb(prover_polynomials.accumulators_binary_limbs_2[i], - prover_polynomials.accumulator_high_limbs_range_constraint_0[i], - prover_polynomials.accumulator_high_limbs_range_constraint_1[i], - prover_polynomials.accumulator_high_limbs_range_constraint_2[i], - prover_polynomials.accumulator_high_limbs_range_constraint_3[i], - prover_polynomials.accumulator_high_limbs_range_constraint_4[i], - prover_polynomials.accumulator_high_limbs_range_constraint_tail[i]); - decompose_standard_top_limb(prover_polynomials.accumulators_binary_limbs_3[i], - prover_polynomials.accumulator_high_limbs_range_constraint_0[i + 1], - prover_polynomials.accumulator_high_limbs_range_constraint_1[i + 1], - prover_polynomials.accumulator_high_limbs_range_constraint_2[i + 1], - prover_polynomials.accumulator_high_limbs_range_constraint_3[i + 1], - prover_polynomials.accumulator_high_limbs_range_constraint_4[i + 1]); - - // Slice quotient limbs into range constraints - decompose_standard_limb(prover_polynomials.quotient_low_binary_limbs[i], - prover_polynomials.quotient_low_limbs_range_constraint_0[i], - prover_polynomials.quotient_low_limbs_range_constraint_1[i], - prover_polynomials.quotient_low_limbs_range_constraint_2[i], - prover_polynomials.quotient_low_limbs_range_constraint_3[i], - prover_polynomials.quotient_low_limbs_range_constraint_4[i], - prover_polynomials.quotient_low_limbs_range_constraint_tail[i]); - decompose_standard_limb(prover_polynomials.quotient_low_binary_limbs_shift[i], - prover_polynomials.quotient_low_limbs_range_constraint_0[i + 1], - prover_polynomials.quotient_low_limbs_range_constraint_1[i + 1], - prover_polynomials.quotient_low_limbs_range_constraint_2[i + 1], - prover_polynomials.quotient_low_limbs_range_constraint_3[i + 1], - prover_polynomials.quotient_low_limbs_range_constraint_4[i + 1], - prover_polynomials.quotient_low_limbs_range_constraint_tail[i + 1]); - - decompose_standard_limb(prover_polynomials.quotient_high_binary_limbs[i], - prover_polynomials.quotient_high_limbs_range_constraint_0[i], - prover_polynomials.quotient_high_limbs_range_constraint_1[i], - prover_polynomials.quotient_high_limbs_range_constraint_2[i], - prover_polynomials.quotient_high_limbs_range_constraint_3[i], - prover_polynomials.quotient_high_limbs_range_constraint_4[i], - prover_polynomials.quotient_high_limbs_range_constraint_tail[i]); - - decompose_top_quotient_limb(prover_polynomials.quotient_high_binary_limbs_shift[i], - prover_polynomials.quotient_high_limbs_range_constraint_0[i + 1], - prover_polynomials.quotient_high_limbs_range_constraint_1[i + 1], - prover_polynomials.quotient_high_limbs_range_constraint_2[i + 1], - prover_polynomials.quotient_high_limbs_range_constraint_3[i + 1], - prover_polynomials.quotient_high_limbs_range_constraint_4[i + 1]); - - // Decompose wide relation limbs into range constraints - decompose_relation_limb(prover_polynomials.relation_wide_limbs[i], - prover_polynomials.relation_wide_limbs_range_constraint_0[i], - prover_polynomials.relation_wide_limbs_range_constraint_1[i], - prover_polynomials.relation_wide_limbs_range_constraint_2[i], - prover_polynomials.relation_wide_limbs_range_constraint_3[i], - prover_polynomials.p_x_high_limbs_range_constraint_tail[i + 1], - prover_polynomials.accumulator_high_limbs_range_constraint_tail[i + 1]); - - decompose_relation_limb(prover_polynomials.relation_wide_limbs[i + 1], - prover_polynomials.relation_wide_limbs_range_constraint_0[i + 1], - prover_polynomials.relation_wide_limbs_range_constraint_1[i + 1], - prover_polynomials.relation_wide_limbs_range_constraint_2[i + 1], - prover_polynomials.relation_wide_limbs_range_constraint_3[i + 1], - prover_polynomials.p_y_high_limbs_range_constraint_tail[i + 1], - prover_polynomials.quotient_high_limbs_range_constraint_tail[i + 1]); - } - - using Relations = Flavor::Relations; - // Check that Decomposition relation is satisfied across each row of the prover polynomials - check_relation>(circuit_size, prover_polynomials, params); -} - -/** - * @brief Test the correctness of GoblinTranslatorFlavor's NonNativeField Relation - * - */ -TEST_F(RelationCorrectnessTests, GoblinTranslatorNonNativeRelationCorrectness) -{ - using Flavor = GoblinTranslatorFlavor; - using FF = typename Flavor::FF; - using BF = typename Flavor::BF; - using ProverPolynomials = typename Flavor::ProverPolynomials; - using ProverPolynomialIds = typename Flavor::ProverPolynomialIds; - using GroupElement = typename Flavor::GroupElement; - using Polynomial = bb::Polynomial; - - constexpr size_t NUM_LIMB_BITS = Flavor::NUM_LIMB_BITS; - constexpr auto mini_circuit_size = 2048; - constexpr auto circuit_size = Flavor::CONCATENATION_GROUP_SIZE * mini_circuit_size; - - auto& engine = numeric::get_debug_randomness(); - - auto op_queue = std::make_shared(); - - // Generate random EccOpQueue actions - for (size_t i = 0; i < ((mini_circuit_size >> 1) - 1); i++) { - switch (engine.get_random_uint8() & 3) { - case 0: - op_queue->empty_row(); - break; - case 1: - op_queue->eq(); - break; - case 2: - op_queue->add_accumulate(GroupElement::random_element(&engine)); - break; - case 3: - op_queue->mul_accumulate(GroupElement::random_element(&engine), FF::random_element(&engine)); - break; - } - } - const auto batching_challenge_v = BF::random_element(&engine); - const auto evaluation_input_x = BF::random_element(&engine); - - // Generating all the values is pretty tedious, so just use CircuitBuilder - auto circuit_builder = GoblinTranslatorCircuitBuilder(batching_challenge_v, evaluation_input_x, op_queue); - - // The non-native field relation uses limbs of evaluation_input_x and powers of batching_challenge_v as inputs - RelationParameters params; - auto v_power = BF::one(); - for (size_t i = 0; i < 4 /*Number of powers of v that we need {1,2,3,4}*/; i++) { - v_power *= batching_challenge_v; - auto uint_v_power = uint256_t(v_power); - params.batching_challenge_v[i] = { uint_v_power.slice(0, NUM_LIMB_BITS), - uint_v_power.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2), - uint_v_power.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3), - uint_v_power.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4), - uint_v_power }; - } - auto uint_input_x = uint256_t(evaluation_input_x); - params.evaluation_input_x = { uint_input_x.slice(0, NUM_LIMB_BITS), - uint_input_x.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2), - uint_input_x.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3), - uint_input_x.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4), - uint_input_x }; - - // Create storage for polynomials - ProverPolynomials prover_polynomials; - // We use polynomial ids to make shifting the polynomials easier - ProverPolynomialIds prover_polynomial_ids; - std::vector polynomial_container; - std::vector polynomial_ids; - auto polynomial_get_all = prover_polynomials.get_all(); - auto polynomial_id_get_all = prover_polynomial_ids.get_all(); - for (size_t i = 0; i < polynomial_get_all.size(); i++) { - Polynomial temporary_polynomial(circuit_size); - // Allocate polynomials - polynomial_container.push_back(temporary_polynomial); - // Push sequential ids to polynomial ids - polynomial_ids.push_back(i); - polynomial_id_get_all[i] = polynomial_ids[i]; - } - // Get ids of shifted polynomials and put them in a set - auto shifted_ids = prover_polynomial_ids.get_shifted(); - std::unordered_set shifted_id_set; - for (auto& id : shifted_ids) { - shifted_id_set.emplace(id); - } - // Assign to non-shifted prover polynomials - for (size_t i = 0; i < polynomial_get_all.size(); i++) { - if (!shifted_id_set.contains(i)) { - polynomial_get_all[i] = polynomial_container[i].share(); - } - } - - // Assign to shifted prover polynomials using ids - for (size_t i = 0; i < shifted_ids.size(); i++) { - auto shifted_id = shifted_ids[i]; - auto to_be_shifted_id = prover_polynomial_ids.get_to_be_shifted()[i]; - polynomial_get_all[shifted_id] = polynomial_container[to_be_shifted_id].shifted(); - } - - // Copy values of wires used in the non-native field relation from the circuit builder - for (size_t i = 1; i < circuit_builder.get_num_gates(); i++) { - prover_polynomials.op[i] = circuit_builder.get_variable(circuit_builder.wires[circuit_builder.OP][i]); - prover_polynomials.p_x_low_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_X_LOW_LIMBS][i]); - prover_polynomials.p_x_high_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_X_HIGH_LIMBS][i]); - prover_polynomials.p_y_low_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_Y_LOW_LIMBS][i]); - prover_polynomials.p_y_high_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.P_Y_HIGH_LIMBS][i]); - prover_polynomials.z_low_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.Z_LOW_LIMBS][i]); - prover_polynomials.z_high_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.Z_HIGH_LIMBS][i]); - prover_polynomials.accumulators_binary_limbs_0[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_0][i]); - prover_polynomials.accumulators_binary_limbs_1[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_1][i]); - prover_polynomials.accumulators_binary_limbs_2[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_2][i]); - prover_polynomials.accumulators_binary_limbs_3[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.ACCUMULATORS_BINARY_LIMBS_3][i]); - prover_polynomials.quotient_low_binary_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.QUOTIENT_LOW_BINARY_LIMBS][i]); - prover_polynomials.quotient_high_binary_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.QUOTIENT_HIGH_BINARY_LIMBS][i]); - prover_polynomials.relation_wide_limbs[i] = - circuit_builder.get_variable(circuit_builder.wires[circuit_builder.RELATION_WIDE_LIMBS][i]); - } - - // Fill in lagrange odd polynomial - for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { - prover_polynomials.lagrange_odd_in_minicircuit[i] = 1; - } - - using Relations = Flavor::Relations; - // Check that Non-Native Field relation is satisfied across each row of the prover polynomials - check_relation>(circuit_size, prover_polynomials, params); -} +} \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp index 0cd4c773619..9bb65c3dec6 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp @@ -1,14 +1,14 @@ #include "barretenberg/sumcheck/sumcheck.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" -#include "barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" #include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.hpp" #include "barretenberg/transcript/transcript.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp index 43d1ad26498..448e47384c2 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp @@ -1,12 +1,12 @@ #include "barretenberg/common/serialize.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" -#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" -#include "barretenberg/proof_system/library/grand_product_delta.hpp" -#include "barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp" -#include "barretenberg/proof_system/plookup_tables/types.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_delta.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.hpp" +#include "barretenberg/stdlib_circuit_builders/plookup_tables/types.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include "barretenberg/sumcheck/sumcheck_round.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" #include "barretenberg/ultra_honk/ultra_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp index b30fda61969..e5831b778ca 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp @@ -1,9 +1,9 @@ #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/prover_instance.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp index 17383a15d2c..cf1cc93c681 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_transcript.test.cpp @@ -1,8 +1,8 @@ #include "barretenberg/ecc/curves/bn254/g1.hpp" #include "barretenberg/flavor/flavor.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/polynomials/univariate.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/instance/prover_instance.hpp" #include "barretenberg/transcript/transcript.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp index ee8e31c3ec4..e84305d66b0 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_verifier.hpp @@ -1,8 +1,8 @@ #pragma once -#include "barretenberg/flavor/goblin_ultra.hpp" -#include "barretenberg/flavor/ultra.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/srs/global_crs.hpp" +#include "barretenberg/stdlib_circuit_builders/goblin_ultra_flavor.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_flavor.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp index 51c35cfa290..2d3e9e9ecb6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp @@ -1,7 +1,7 @@ #pragma once -#include "barretenberg/proof_system/circuit_builder/circuit_builder_base.hpp" -#include "barretenberg/proof_system/circuit_builder/generated/avm_circuit_builder.hpp" +#include "barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp" +#include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include namespace bb::avm_trace { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp index f1c95d0e927..2ac52622538 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp @@ -1,13 +1,13 @@ #include "avm_execution.hpp" #include "barretenberg/common/serialize.hpp" -#include "barretenberg/flavor/generated/avm_flavor.hpp" -#include "barretenberg/proof_system/circuit_builder/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/avm_trace/avm_common.hpp" #include "barretenberg/vm/avm_trace/avm_deserialization.hpp" #include "barretenberg/vm/avm_trace/avm_instructions.hpp" #include "barretenberg/vm/avm_trace/avm_opcode.hpp" #include "barretenberg/vm/avm_trace/avm_trace.hpp" +#include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/generated/avm_composer.hpp" +#include "barretenberg/vm/generated/avm_flavor.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/avm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/avm_circuit_builder.hpp rename to barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp index 72277958eb8..ee78ecf56ee 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -7,11 +7,10 @@ #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" -#include "barretenberg/proof_system/circuit_builder/circuit_builder_base.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" +#include "barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp" -#include "barretenberg/flavor/generated/avm_flavor.hpp" #include "barretenberg/relations/generated/avm/avm_alu.hpp" #include "barretenberg/relations/generated/avm/avm_main.hpp" #include "barretenberg/relations/generated/avm/avm_mem.hpp" @@ -24,6 +23,7 @@ #include "barretenberg/relations/generated/avm/perm_main_mem_ind_a.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_ind_b.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_ind_c.hpp" +#include "barretenberg/vm/generated/avm_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp index 8ed61fbdd8f..a95109f38ca 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.cpp @@ -1,9 +1,9 @@ #include "./avm_composer.hpp" -#include "barretenberg/proof_system/circuit_builder/generated/avm_circuit_builder.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" -#include "barretenberg/proof_system/composer/permutation_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/permutation_lib.hpp" +#include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/generated/avm_verifier.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp index d00f490fa45..1c072ebdf4e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_composer.hpp @@ -2,9 +2,9 @@ #pragma once -#include "barretenberg/proof_system/circuit_builder/generated/avm_circuit_builder.hpp" -#include "barretenberg/proof_system/composer/composer_lib.hpp" +#include "barretenberg/plonk_honk_shared/composer/composer_lib.hpp" #include "barretenberg/srs/global_crs.hpp" +#include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/generated/avm_prover.hpp" #include "barretenberg/vm/generated/avm_verifier.hpp" diff --git a/barretenberg/cpp/src/barretenberg/flavor/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp similarity index 99% rename from barretenberg/cpp/src/barretenberg/flavor/generated/avm_flavor.hpp rename to barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index 1b92d03a22b..2d5393cdf9c 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -1,9 +1,9 @@ #pragma once -#include "../relation_definitions.hpp" #include "barretenberg/commitment_schemes/kzg/kzg.hpp" #include "barretenberg/ecc/curves/bn254/g1.hpp" +#include "barretenberg/flavor/relation_definitions.hpp" #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/univariate.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp index 8a5dd977b6b..e887045bb96 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp @@ -5,8 +5,8 @@ #include "barretenberg/commitment_schemes/commitment_key.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" +#include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp index 8c36d7dabac..e5463dc4a45 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.hpp @@ -2,11 +2,11 @@ #pragma once #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" -#include "barretenberg/flavor/generated/avm_flavor.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/sumcheck/sumcheck_output.hpp" #include "barretenberg/transcript/transcript.hpp" +#include "barretenberg/vm/generated/avm_flavor.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp index c0ecba92fcd..866eee52b19 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.hpp @@ -1,9 +1,9 @@ #pragma once -#include "barretenberg/flavor/generated/avm_flavor.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" +#include "barretenberg/vm/generated/avm_flavor.hpp" namespace bb { class AvmVerifier { diff --git a/barretenberg/sol/README.md b/barretenberg/sol/README.md index 061a39c6e9e..30572db0b3c 100644 --- a/barretenberg/sol/README.md +++ b/barretenberg/sol/README.md @@ -10,7 +10,7 @@ The verifier will follow an overall architecture below, consisting of 3 contract ![Verifier architecture](./figures/verifier.png) -The verification key is currently generated via [Barretenberg](https://github.com/AztecProtocol/barretenberg/blob/master/cpp/src/aztec/proof_system/verification_key/sol_gen.hpp), Aztec's backend for generating proofs. +The verification key is currently generated via [Barretenberg](https://github.com/AztecProtocol/barretenberg/blob/master/cpp/src/aztec/plonk_honk_shared/verification_key/sol_gen.hpp), Aztec's backend for generating proofs. ## Current implementations