From 887ed39230bed428048c3f3f8af7926b9245e093 Mon Sep 17 00:00:00 2001 From: Cody Gunton <codygunton@gmail.com> Date: Wed, 5 Apr 2023 16:20:08 -0400 Subject: [PATCH] Prep: move composer type, proving key and verification key. (#303) * Move composer type from plonk to bonk. * Move pk & vk into plonk. * bonk ~> proof_system; nest plonk and honk in it. * proof_system independent of plonk. --- .../benchmark/honk_bench/honk.bench.cpp | 8 +- .../benchmark/pippenger_bench/main.cpp | 2 +- .../benchmark/plonk_bench/plonk.bench.cpp | 6 +- .../dsl/acir_format/acir_format.cpp | 4 +- .../dsl/acir_format/acir_format.hpp | 2 +- .../dsl/acir_format/blake2s_constraint.cpp | 4 +- .../dsl/acir_format/ecdsa_secp256k1.cpp | 2 +- .../dsl/acir_format/fixed_base_scalar_mul.cpp | 2 +- .../dsl/acir_format/hash_to_field.cpp | 4 +- .../dsl/acir_format/logic_constraint.cpp | 2 +- .../merkle_membership_constraint.cpp | 4 +- .../barretenberg/dsl/acir_format/pedersen.cpp | 2 +- .../dsl/acir_format/schnorr_verify.cpp | 2 +- .../dsl/acir_format/sha256_constraint.cpp | 4 +- .../dsl/acir_proofs/acir_proofs.cpp | 28 +- cpp/src/barretenberg/ecc/curves/types.hpp | 2 +- cpp/src/barretenberg/honk/CMakeLists.txt | 3 +- .../standard_honk_composer_helper.cpp | 25 +- .../standard_honk_composer_helper.hpp | 37 +-- .../honk/composer/standard_honk_composer.hpp | 20 +- .../composer/standard_honk_composer.test.cpp | 8 +- cpp/src/barretenberg/honk/flavor/flavor.hpp | 10 +- cpp/src/barretenberg/honk/oracle/oracle.hpp | 4 +- cpp/src/barretenberg/honk/pcs/claim.hpp | 4 +- .../barretenberg/honk/pcs/commitment_key.hpp | 12 +- .../honk/pcs/commitment_key.test.hpp | 4 +- .../barretenberg/honk/pcs/gemini/gemini.hpp | 4 +- .../honk/pcs/gemini/gemini.test.cpp | 4 +- cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp | 10 +- .../barretenberg/honk/pcs/ipa/ipa.test.cpp | 4 +- cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp | 4 +- .../barretenberg/honk/pcs/kzg/kzg.test.cpp | 4 +- .../barretenberg/honk/pcs/shplonk/shplonk.hpp | 4 +- .../honk/pcs/shplonk/shplonk.test.cpp | 4 +- .../honk/pcs/shplonk/shplonk_single.hpp | 4 +- cpp/src/barretenberg/honk/pcs/wrapper.hpp | 4 +- .../honk/proof_system/program_settings.hpp | 8 +- .../barretenberg/honk/proof_system/prover.cpp | 12 +- .../barretenberg/honk/proof_system/prover.hpp | 14 +- .../honk/proof_system/prover_library.cpp | 14 +- .../honk/proof_system/prover_library.hpp | 12 +- .../honk/proof_system/prover_library.test.cpp | 20 +- .../honk/proof_system/verifier.cpp | 8 +- .../honk/proof_system/verifier.hpp | 10 +- .../honk/proof_system/verifier.test.cpp | 27 +- .../sumcheck/polynomials/barycentric_data.hpp | 4 +- .../polynomials/barycentric_data.test.cpp | 2 +- .../polynomials/multivariates.test.cpp | 4 +- .../honk/sumcheck/polynomials/pow.hpp | 4 +- .../honk/sumcheck/polynomials/pow.test.cpp | 6 +- .../honk/sumcheck/polynomials/univariate.hpp | 4 +- .../sumcheck/polynomials/univariate.test.cpp | 2 +- .../relations/arithmetic_relation.hpp | 4 +- .../grand_product_computation_relation.hpp | 4 +- .../grand_product_initialization_relation.hpp | 4 +- .../honk/sumcheck/relations/relation.hpp | 4 +- .../honk/sumcheck/relations/relation.test.cpp | 10 +- .../barretenberg/honk/sumcheck/sumcheck.hpp | 6 +- .../honk/sumcheck/sumcheck.test.cpp | 8 +- .../honk/sumcheck/sumcheck_output.hpp | 4 +- .../honk/sumcheck/sumcheck_round.hpp | 4 +- .../honk/sumcheck/sumcheck_round.test.cpp | 8 +- .../honk/transcript/transcript.hpp | 4 +- .../honk/transcript/transcript.test.cpp | 4 +- .../honk/utils/power_polynomial.hpp | 4 +- .../honk/utils/power_polynomial.test.cpp | 4 +- .../barretenberg/honk/utils/public_inputs.hpp | 4 +- .../proofs/compute_circuit_data.hpp | 40 +-- .../proofs/join_split/c_bind.cpp | 16 +- .../join_split/compute_circuit_data.cpp | 6 +- .../join_split/compute_circuit_data.hpp | 2 +- .../proofs/join_split/join_split.cpp | 27 +- .../proofs/join_split/join_split.hpp | 19 +- .../proofs/join_split/join_split.test.cpp | 10 +- .../proofs/join_split/join_split_circuit.cpp | 4 +- .../proofs/join_split/join_split_circuit.hpp | 2 +- .../join_split/join_split_js_parity.test.cpp | 10 +- .../proofs/join_split/join_split_tx.hpp | 2 +- .../proofs/mock/mock_circuit.hpp | 2 +- .../proofs/mock/mock_circuit.test.cpp | 2 +- .../notes/circuit/account/account_note.hpp | 2 +- .../proofs/notes/circuit/account/commit.hpp | 2 +- .../proofs/notes/circuit/asset_id.cpp | 2 +- .../proofs/notes/circuit/asset_id.hpp | 2 +- .../proofs/notes/circuit/bridge_call_data.hpp | 2 +- .../proofs/notes/circuit/claim/claim_note.hpp | 2 +- .../claim/complete_partial_commitment.hpp | 2 +- .../notes/circuit/claim/compute_nullifier.hpp | 2 +- .../claim/create_partial_commitment.hpp | 2 +- .../notes/circuit/claim/witness_data.hpp | 2 +- .../value/complete_partial_commitment.hpp | 2 +- .../notes/circuit/value/compute_nullifier.cpp | 4 +- .../notes/circuit/value/compute_nullifier.hpp | 2 +- .../circuit/value/compute_nullifier.test.cpp | 2 +- .../value/create_partial_commitment.hpp | 2 +- .../proofs/notes/circuit/value/value_note.hpp | 2 +- .../notes/circuit/value/value_note.test.cpp | 2 +- .../notes/circuit/value/witness_data.hpp | 2 +- .../join_split_example/proofs/verify.hpp | 4 +- .../plonk/composer/composer_base.cpp | 6 +- .../plonk/composer/composer_base.hpp | 4 +- .../composer_helper/composer_helper_lib.cpp | 77 ++++++ .../composer_helper/composer_helper_lib.hpp | 29 +++ .../standard_plonk_composer_helper.cpp | 25 +- .../standard_plonk_composer_helper.hpp | 37 ++- .../turbo_plonk_composer_helper.cpp | 25 +- .../turbo_plonk_composer_helper.hpp | 25 +- .../ultra_plonk_composer_helper.cpp | 17 +- .../ultra_plonk_composer_helper.hpp | 21 +- .../splitting_tmp/standard_plonk_composer.hpp | 20 +- .../standard_plonk_composer.test.cpp | 14 +- .../splitting_tmp/turbo_plonk_composer.hpp | 22 +- .../turbo_plonk_composer.test.cpp | 17 +- .../splitting_tmp/ultra_plonk_composer.hpp | 8 +- .../ultra_plonk_composer.test.cpp | 7 +- .../plonk/composer/standard_composer.cpp | 6 +- .../plonk/composer/standard_composer.hpp | 5 +- .../plonk/composer/standard_composer.test.cpp | 18 +- .../plonk/composer/turbo_composer.cpp | 6 +- .../plonk/composer/turbo_composer.hpp | 14 +- .../plonk/composer/turbo_composer.test.cpp | 18 +- .../plonk/composer/ultra_composer.cpp | 4 +- .../plonk/composer/ultra_composer.hpp | 6 +- .../plonk/composer/ultra_composer.test.cpp | 6 +- .../commitment_scheme/commitment_scheme.hpp | 10 +- .../commitment_scheme.test.cpp | 10 +- .../kate_commitment_scheme.cpp | 13 +- .../kate_commitment_scheme.hpp | 10 +- .../plonk/proof_system/constants.hpp | 13 +- .../plonk/proof_system/prover/c_bind.cpp | 8 +- .../proof_system/prover/c_bind_unrolled.cpp | 3 +- .../plonk/proof_system/prover/prover.cpp | 6 +- .../plonk/proof_system/prover/prover.hpp | 8 +- .../plonk/proof_system/prover/prover.test.cpp | 6 +- .../proof_system/proving_key/proving_key.cpp | 11 +- .../proof_system/proving_key/proving_key.hpp | 8 +- .../proving_key/proving_key.test.cpp | 28 +- .../proof_system/proving_key/serialize.hpp | 4 +- .../public_inputs/public_inputs.hpp | 2 +- .../public_inputs/public_inputs.test.cpp | 4 +- .../public_inputs/public_inputs_impl.hpp | 4 +- .../types/commitment_open_proof.hpp | 4 +- .../types/polynomial_manifest.hpp | 17 +- .../proof_system/types/program_settings.hpp | 4 +- .../plonk/proof_system/types/proof.hpp | 4 +- .../proof_system/types/prover_settings.hpp | 4 +- .../utils/generalized_permutation.hpp | 4 +- .../proof_system/utils/kate_verification.hpp | 4 +- .../plonk/proof_system/utils/permutation.hpp | 4 +- .../proof_system/verification_key/sol_gen.hpp | 20 +- .../verification_key/verification_key.cpp | 6 +- .../verification_key/verification_key.hpp | 6 +- .../verification_key.test.cpp | 9 +- .../plonk/proof_system/verifier/verifier.cpp | 4 +- .../plonk/proof_system/verifier/verifier.hpp | 4 +- .../proof_system/verifier/verifier.test.cpp | 10 +- .../random_widgets/permutation_widget.hpp | 4 +- .../permutation_widget_impl.hpp | 6 +- .../widgets/random_widgets/plookup_widget.hpp | 4 +- .../random_widgets/plookup_widget_impl.hpp | 8 +- .../widgets/random_widgets/random_widget.hpp | 4 +- .../transition_widgets/arithmetic_widget.hpp | 31 ++- .../transition_widgets/elliptic_widget.hpp | 37 ++- .../transition_widgets/fixed_base_widget.hpp | 15 +- .../genperm_sort_widget.hpp | 24 +- .../plookup_arithmetic_widget.hpp | 42 ++- .../plookup_auxiliary_widget.hpp | 48 ++-- .../transition_widgets/transition_widget.hpp | 11 +- .../turbo_arithmetic_widget.hpp | 50 ++-- .../transition_widgets/turbo_logic_widget.hpp | 32 +-- .../transition_widgets/turbo_range_widget.hpp | 30 +-- .../barretenberg/proof_system/CMakeLists.txt | 2 +- .../arithmetization/gate_data.hpp | 4 +- .../circuit_constructor_base.cpp | 4 +- .../circuit_constructor_base.hpp | 4 +- .../standard_circuit_constructor.cpp | 4 +- .../standard_circuit_constructor.hpp | 8 +- .../standard_circuit_constructor.test.cpp | 2 +- .../turbo_circuit_constructor.cpp | 4 +- .../turbo_circuit_constructor.hpp | 8 +- .../turbo_circuit_constructor.test.cpp | 4 +- .../ultra_circuit_constructor.cpp | 4 +- .../ultra_circuit_constructor.hpp | 10 +- .../composer/composer_helper_lib.cpp | 240 ------------------ .../composer/composer_helper_lib.hpp | 145 ++++++++--- .../composer/permutation_helper.hpp | 27 +- .../polynomial_store/polynomial_store.hpp | 6 +- .../polynomial_store.test.cpp | 4 +- .../proof_system/types/composer_type.hpp | 6 + .../proof_system/work_queue/work_queue.cpp | 6 +- .../proof_system/work_queue/work_queue.hpp | 11 +- .../reference_string/env_reference_string.hpp | 6 +- .../env_reference_string.test.cpp | 10 +- .../file_reference_string.cpp | 4 +- .../file_reference_string.hpp | 4 +- .../reference_string/mem_reference_string.cpp | 4 +- .../reference_string/mem_reference_string.hpp | 4 +- .../mem_reference_string.test.cpp | 4 +- .../pippenger_reference_string.hpp | 4 +- .../srs/reference_string/reference_string.hpp | 4 +- .../stdlib/encryption/aes128/aes128.cpp | 8 +- .../stdlib/encryption/aes128/aes128.hpp | 4 +- .../stdlib/encryption/aes128/aes128.test.cpp | 10 +- .../stdlib/encryption/ecdsa/ecdsa.hpp | 4 +- .../stdlib/encryption/ecdsa/ecdsa.test.cpp | 4 +- .../stdlib/encryption/ecdsa/ecdsa_impl.hpp | 6 +- .../stdlib/encryption/schnorr/schnorr.cpp | 12 +- .../stdlib/encryption/schnorr/schnorr.hpp | 4 +- .../encryption/schnorr/schnorr.test.cpp | 4 +- .../stdlib/hash/blake2s/blake2s.cpp | 4 +- .../stdlib/hash/blake2s/blake2s.hpp | 8 +- .../stdlib/hash/blake2s/blake2s.test.cpp | 8 +- .../stdlib/hash/blake2s/blake2s_plookup.cpp | 4 +- .../stdlib/hash/blake2s/blake2s_plookup.hpp | 4 +- .../stdlib/hash/blake2s/blake_util.hpp | 4 +- .../stdlib/hash/blake3s/blake3s.cpp | 4 +- .../stdlib/hash/blake3s/blake3s.hpp | 8 +- .../stdlib/hash/blake3s/blake3s.test.cpp | 8 +- .../stdlib/hash/blake3s/blake3s_plookup.cpp | 4 +- .../stdlib/hash/blake3s/blake3s_plookup.hpp | 4 +- .../stdlib/hash/keccak/keccak.cpp | 4 +- .../stdlib/hash/keccak/keccak.hpp | 8 +- .../stdlib/hash/keccak/keccak.test.cpp | 4 +- .../stdlib/hash/pedersen/pedersen.bench.cpp | 2 +- .../stdlib/hash/pedersen/pedersen.cpp | 10 +- .../stdlib/hash/pedersen/pedersen.hpp | 12 +- .../stdlib/hash/pedersen/pedersen.test.cpp | 8 +- .../stdlib/hash/pedersen/pedersen_gates.hpp | 11 +- .../stdlib/hash/pedersen/pedersen_plookup.cpp | 6 +- .../stdlib/hash/pedersen/pedersen_plookup.hpp | 12 +- .../stdlib/hash/sha256/sha256.bench.cpp | 2 +- .../stdlib/hash/sha256/sha256.cpp | 4 +- .../stdlib/hash/sha256/sha256.hpp | 8 +- .../stdlib/hash/sha256/sha256.test.cpp | 56 ++-- .../stdlib/hash/sha256/sha256_plookup.cpp | 4 +- .../stdlib/hash/sha256/sha256_plookup.hpp | 8 +- .../barretenberg/stdlib/merkle_tree/hash.hpp | 4 +- .../stdlib/merkle_tree/hash.test.cpp | 4 +- .../stdlib/merkle_tree/hash_path.hpp | 4 +- .../stdlib/merkle_tree/membership.hpp | 4 +- .../stdlib/merkle_tree/membership.test.cpp | 4 +- .../stdlib/merkle_tree/memory_store.hpp | 4 +- .../stdlib/merkle_tree/memory_tree.cpp | 4 +- .../stdlib/merkle_tree/memory_tree.hpp | 4 +- .../stdlib/merkle_tree/memory_tree.test.cpp | 2 +- .../stdlib/merkle_tree/merkle_tree.bench.cpp | 2 +- .../stdlib/merkle_tree/merkle_tree.cpp | 4 +- .../stdlib/merkle_tree/merkle_tree.hpp | 4 +- .../stdlib/merkle_tree/merkle_tree.test.cpp | 2 +- .../primitives/bigfield/bigfield.fuzzer.hpp | 10 +- .../stdlib/primitives/bigfield/bigfield.hpp | 4 +- .../primitives/bigfield/bigfield.test.cpp | 6 +- .../primitives/bigfield/bigfield_impl.hpp | 26 +- .../stdlib/primitives/biggroup/biggroup.hpp | 4 +- .../primitives/biggroup/biggroup.test.cpp | 18 +- .../biggroup/biggroup_batch_mul.hpp | 4 +- .../primitives/biggroup/biggroup_bn254.hpp | 4 +- .../primitives/biggroup/biggroup_impl.hpp | 4 +- .../primitives/biggroup/biggroup_nafs.hpp | 4 +- .../biggroup/biggroup_secp256k1.hpp | 4 +- .../primitives/biggroup/biggroup_tables.hpp | 4 +- .../stdlib/primitives/bit_array/bit_array.cpp | 4 +- .../primitives/bit_array/bit_array.fuzzer.hpp | 4 +- .../stdlib/primitives/bit_array/bit_array.hpp | 4 +- .../primitives/bit_array/bit_array.test.cpp | 12 +- .../stdlib/primitives/bool/bool.cpp | 6 +- .../stdlib/primitives/bool/bool.fuzzer.hpp | 4 +- .../stdlib/primitives/bool/bool.hpp | 4 +- .../stdlib/primitives/bool/bool.test.cpp | 32 +-- .../primitives/byte_array/byte_array.cpp | 4 +- .../byte_array/byte_array.fuzzer.hpp | 6 +- .../primitives/byte_array/byte_array.hpp | 4 +- .../primitives/byte_array/byte_array.test.cpp | 2 +- .../primitives/composers/composers_fwd.hpp | 8 +- .../stdlib/primitives/curves/bn254.hpp | 6 +- .../stdlib/primitives/curves/secp256k1.hpp | 6 +- .../stdlib/primitives/curves/secp256r1.hpp | 6 +- .../stdlib/primitives/field/field.cpp | 10 +- .../stdlib/primitives/field/field.fuzzer.hpp | 10 +- .../stdlib/primitives/field/field.hpp | 4 +- .../stdlib/primitives/field/field.test.cpp | 8 +- .../stdlib/primitives/group/group.hpp | 6 +- .../stdlib/primitives/group/group.test.cpp | 10 +- .../stdlib/primitives/logic/logic.cpp | 6 +- .../stdlib/primitives/logic/logic.hpp | 15 +- .../stdlib/primitives/logic/logic.test.cpp | 4 +- .../primitives/memory/dynamic_array.cpp | 6 +- .../primitives/memory/dynamic_array.hpp | 4 +- .../primitives/memory/dynamic_array.test.cpp | 4 +- .../stdlib/primitives/memory/ram_table.cpp | 8 +- .../stdlib/primitives/memory/ram_table.hpp | 4 +- .../primitives/memory/ram_table.test.cpp | 4 +- .../stdlib/primitives/memory/rom_table.cpp | 4 +- .../stdlib/primitives/memory/rom_table.hpp | 4 +- .../primitives/memory/rom_table.test.cpp | 4 +- .../primitives/memory/twin_rom_table.cpp | 4 +- .../primitives/memory/twin_rom_table.hpp | 4 +- .../packed_byte_array/packed_byte_array.cpp | 4 +- .../packed_byte_array/packed_byte_array.hpp | 4 +- .../packed_byte_array.test.cpp | 14 +- .../stdlib/primitives/plookup/plookup.cpp | 8 +- .../stdlib/primitives/plookup/plookup.hpp | 4 +- .../primitives/plookup/plookup.test.cpp | 4 +- .../stdlib/primitives/point/point.hpp | 4 +- .../stdlib/primitives/safe_uint/safe_uint.cpp | 4 +- .../primitives/safe_uint/safe_uint.fuzzer.hpp | 10 +- .../stdlib/primitives/safe_uint/safe_uint.hpp | 4 +- .../primitives/safe_uint/safe_uint.test.cpp | 16 +- .../stdlib/primitives/uint/arithmetic.cpp | 6 +- .../stdlib/primitives/uint/comparison.cpp | 4 +- .../stdlib/primitives/uint/logic.cpp | 6 +- .../primitives/uint/plookup/arithmetic.cpp | 6 +- .../primitives/uint/plookup/comparison.cpp | 4 +- .../stdlib/primitives/uint/plookup/logic.cpp | 4 +- .../stdlib/primitives/uint/plookup/uint.cpp | 4 +- .../stdlib/primitives/uint/plookup/uint.hpp | 4 +- .../stdlib/primitives/uint/uint.cpp | 8 +- .../stdlib/primitives/uint/uint.fuzzer.hpp | 14 +- .../stdlib/primitives/uint/uint.hpp | 4 +- .../stdlib/primitives/uint/uint.test.cpp | 10 +- .../stdlib/primitives/witness/witness.hpp | 4 +- .../recursion/transcript/transcript.hpp | 6 +- .../recursion/transcript/transcript.test.cpp | 4 +- .../verification_key/verification_key.hpp | 20 +- .../recursion/verifier/program_settings.hpp | 58 +++-- .../stdlib/recursion/verifier/verifier.hpp | 15 +- .../recursion/verifier/verifier.test.cpp | 12 +- .../verifier/verifier_turbo.test.cpp | 10 +- cpp/src/barretenberg/stdlib/types/types.hpp | 36 +-- .../barretenberg/transcript/transcript.hpp | 4 +- .../transcript/transcript.test.cpp | 2 +- 331 files changed, 1571 insertions(+), 1642 deletions(-) create mode 100644 cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.cpp create mode 100644 cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp rename cpp/src/barretenberg/{ => plonk}/proof_system/proving_key/proving_key.cpp (92%) rename cpp/src/barretenberg/{ => plonk}/proof_system/proving_key/proving_key.hpp (92%) rename cpp/src/barretenberg/{ => plonk}/proof_system/proving_key/proving_key.test.cpp (85%) rename cpp/src/barretenberg/{ => plonk}/proof_system/proving_key/serialize.hpp (98%) rename cpp/src/barretenberg/{ => plonk}/proof_system/types/polynomial_manifest.hpp (96%) rename cpp/src/barretenberg/{ => plonk}/proof_system/verification_key/sol_gen.hpp (92%) rename cpp/src/barretenberg/{ => plonk}/proof_system/verification_key/verification_key.cpp (96%) rename cpp/src/barretenberg/{ => plonk}/proof_system/verification_key/verification_key.hpp (95%) rename cpp/src/barretenberg/{ => plonk}/proof_system/verification_key/verification_key.test.cpp (80%) delete mode 100644 cpp/src/barretenberg/proof_system/composer/composer_helper_lib.cpp create mode 100644 cpp/src/barretenberg/proof_system/types/composer_type.hpp diff --git a/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp b/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp index 4b9a049dad..aa472edd18 100644 --- a/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp +++ b/cpp/src/barretenberg/benchmark/honk_bench/honk.bench.cpp @@ -34,7 +34,7 @@ void create_prover_bench(State& state) noexcept for (auto _ : state) { state.PauseTiming(); auto num_gates = 1 << (size_t)state.range(0); - auto composer = honk::StandardHonkComposer(static_cast<size_t>(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast<size_t>(num_gates)); generate_test_plonk_circuit(composer, static_cast<size_t>(num_gates)); state.ResumeTiming(); @@ -51,7 +51,7 @@ void create_verifier_bench(State& state) noexcept for (auto _ : state) { state.PauseTiming(); auto num_gates = 1 << (size_t)state.range(0); - auto composer = honk::StandardHonkComposer(static_cast<size_t>(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast<size_t>(num_gates)); generate_test_plonk_circuit(composer, static_cast<size_t>(num_gates)); state.ResumeTiming(); @@ -68,7 +68,7 @@ void construct_proof_bench(State& state) noexcept auto num_gates = 1 << (size_t)state.range(0); for (auto _ : state) { state.PauseTiming(); - auto composer = honk::StandardHonkComposer(static_cast<size_t>(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast<size_t>(num_gates)); generate_test_plonk_circuit(composer, static_cast<size_t>(num_gates)); auto ext_prover = composer.create_prover(); state.ResumeTiming(); @@ -90,7 +90,7 @@ void verify_proof_bench(State& state) noexcept for (auto _ : state) { state.PauseTiming(); auto num_gates = (size_t)state.range(0); - auto composer = honk::StandardHonkComposer(static_cast<size_t>(num_gates)); + auto composer = proof_system::honk::StandardHonkComposer(static_cast<size_t>(num_gates)); generate_test_plonk_circuit(composer, static_cast<size_t>(num_gates)); auto prover = composer.create_prover(); auto proof = prover.construct_proof(); diff --git a/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp b/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp index 2208ce5228..40f2b15284 100644 --- a/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp +++ b/cpp/src/barretenberg/benchmark/pippenger_bench/main.cpp @@ -41,7 +41,7 @@ constexpr size_t NUM_POINTS = 1 << 16; std::vector<fr> scalars; static barretenberg::evaluation_domain small_domain; static barretenberg::evaluation_domain large_domain; -auto reference_string = std::make_shared<bonk::FileReferenceString>(NUM_POINTS, "../srs_db/ignition"); +auto reference_string = std::make_shared<proof_system::FileReferenceString>(NUM_POINTS, "../srs_db/ignition"); const auto init = []() { small_domain = barretenberg::evaluation_domain(NUM_POINTS); diff --git a/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp b/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp index 38581ff231..475499bd72 100644 --- a/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp +++ b/cpp/src/barretenberg/benchmark/plonk_bench/plonk.bench.cpp @@ -36,7 +36,7 @@ void construct_witnesses_bench(State& state) noexcept { for (auto _ : state) { state.PauseTiming(); - plonk::StandardComposer composer = plonk::StandardComposer(static_cast<size_t>(state.range(0))); + plonk::StandardComposer composer = proof_system::plonk::StandardComposer(static_cast<size_t>(state.range(0))); generate_test_plonk_circuit(composer, static_cast<size_t>(state.range(0))); composer.compute_proving_key(); state.ResumeTiming(); @@ -49,7 +49,7 @@ BENCHMARK(construct_witnesses_bench)->RangeMultiplier(2)->Range(START, MAX_GATES void construct_proving_keys_bench(State& state) noexcept { for (auto _ : state) { - plonk::StandardComposer composer = plonk::StandardComposer(static_cast<size_t>(state.range(0))); + plonk::StandardComposer composer = proof_system::plonk::StandardComposer(static_cast<size_t>(state.range(0))); generate_test_plonk_circuit(composer, static_cast<size_t>(state.range(0))); size_t idx = static_cast<size_t>(numeric::get_msb((uint64_t)state.range(0))) - static_cast<size_t>(numeric::get_msb(START)); @@ -65,7 +65,7 @@ void construct_instances_bench(State& state) noexcept { for (auto _ : state) { state.PauseTiming(); - plonk::StandardComposer composer = plonk::StandardComposer(static_cast<size_t>(state.range(0))); + plonk::StandardComposer composer = proof_system::plonk::StandardComposer(static_cast<size_t>(state.range(0))); generate_test_plonk_circuit(composer, static_cast<size_t>(state.range(0))); size_t idx = static_cast<size_t>(numeric::get_msb((uint64_t)state.range(0))) - static_cast<size_t>(numeric::get_msb(START)); diff --git a/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index 30160837c7..a10eb40468 100644 --- a/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -1,6 +1,6 @@ #include "acir_format.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -88,7 +88,7 @@ void create_circuit(Composer& composer, const acir_format& constraint_system) } Composer create_circuit(const acir_format& constraint_system, - std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory) + std::unique_ptr<proof_system::ReferenceStringFactory>&& crs_factory) { if (constraint_system.public_inputs.size() > constraint_system.varnum) { std::cout << "too many public inputs!" << std::endl; diff --git a/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp b/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp index b6f2f2ae4b..55d5ee969e 100644 --- a/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -41,7 +41,7 @@ void read_witness(plonk::stdlib::types::Composer& composer, std::vector<barreten void create_circuit(plonk::stdlib::types::Composer& composer, const acir_format& constraint_system); plonk::stdlib::types::Composer create_circuit(const acir_format& constraint_system, - std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory); + std::unique_ptr<proof_system::ReferenceStringFactory>&& crs_factory); plonk::stdlib::types::Composer create_circuit_with_witness(const acir_format& constraint_system, std::vector<fr> witness, diff --git a/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp b/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp index 56fe6a521f..03deb176f6 100644 --- a/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp @@ -1,7 +1,7 @@ #include "blake2s_constraint.hpp" #include "round.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -26,7 +26,7 @@ void create_blake2s_constraints(Composer& composer, const Blake2sConstraint& con arr.write(element_bytes); } - byte_array_ct output_bytes = plonk::stdlib::blake2s<Composer>(arr); + byte_array_ct output_bytes = proof_system::plonk::stdlib::blake2s<Composer>(arr); // Convert byte array to vector of field_t auto bytes = output_bytes.bytes(); diff --git a/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp b/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp index 4287faf643..d81a670cb0 100644 --- a/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp @@ -2,7 +2,7 @@ #include "barretenberg/crypto/ecdsa/ecdsa.hpp" #include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp b/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp index 6e829a8a9a..81251944e6 100644 --- a/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/fixed_base_scalar_mul.cpp @@ -1,6 +1,6 @@ #include "fixed_base_scalar_mul.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp b/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp index 564cd13c2e..998b414cd4 100644 --- a/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/hash_to_field.cpp @@ -1,7 +1,7 @@ #include "hash_to_field.hpp" #include "round.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -30,7 +30,7 @@ void create_hash_to_field_constraints(Composer& composer, const HashToFieldConst // Hash To Field using blake2s. // Note: It does not need to be blake2s in the future - byte_array_ct out_bytes = plonk::stdlib::blake2s<Composer>(arr); + byte_array_ct out_bytes = proof_system::plonk::stdlib::blake2s<Composer>(arr); field_ct out(out_bytes); field_ct normalised_out = out.normalize(); diff --git a/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp b/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp index b25530fa80..ca14b7cbc4 100644 --- a/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp @@ -1,7 +1,7 @@ #include "logic_constraint.hpp" #include "barretenberg/stdlib/primitives/logic/logic.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp b/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp index 8ff90de39d..3f30a61fcb 100644 --- a/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/merkle_membership_constraint.cpp @@ -1,8 +1,8 @@ #include "merkle_membership_constraint.hpp" #include "barretenberg/stdlib/merkle_tree/membership.hpp" -using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; namespace acir_format { diff --git a/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp b/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp index 466929df42..03a8c4fe1f 100644 --- a/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp @@ -1,6 +1,6 @@ #include "pedersen.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp b/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp index 7c80c4208c..f92176bd08 100644 --- a/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp @@ -1,7 +1,7 @@ #include "schnorr_verify.hpp" #include "barretenberg/crypto/schnorr/schnorr.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { diff --git a/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp b/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp index 4da8a53567..e54697d4e7 100644 --- a/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp @@ -2,7 +2,7 @@ #include "round.hpp" #include "barretenberg/stdlib/hash/sha256/sha256.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_format { @@ -30,7 +30,7 @@ void create_sha256_constraints(Composer& composer, const Sha256Constraint& const } // Compute sha256 - byte_array_ct output_bytes = plonk::stdlib::sha256<Composer>(arr); + byte_array_ct output_bytes = proof_system::plonk::stdlib::sha256<Composer>(arr); // Convert byte array to vector of field_t auto bytes = output_bytes.bytes(); diff --git a/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp b/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp index ef70c7af1e..21585f6df4 100644 --- a/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp +++ b/cpp/src/barretenberg/dsl/acir_proofs/acir_proofs.cpp @@ -1,21 +1,21 @@ #include "acir_proofs.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/dsl/acir_format/acir_format.hpp" #include "barretenberg/stdlib/types/types.hpp" #include "barretenberg/srs/reference_string/pippenger_reference_string.hpp" -#include "barretenberg/proof_system/verification_key/sol_gen.hpp" +#include "barretenberg/plonk/proof_system/verification_key/sol_gen.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace acir_proofs { size_t get_solidity_verifier(uint8_t const* g2x, uint8_t const* vk_buf, uint8_t** output_buf) { auto crs = std::make_shared<VerifierMemReferenceString>(g2x); - bonk::verification_key_data vk_data; + proof_system::plonk::verification_key_data vk_data; read(vk_buf, vk_data); - auto verification_key = std::make_shared<bonk::verification_key>(std::move(vk_data), crs); + auto verification_key = std::make_shared<proof_system::plonk::verification_key>(std::move(vk_data), crs); std::ostringstream stream; // TODO(blaine): Should we just use "VerificationKey" generically? @@ -32,7 +32,7 @@ size_t get_solidity_verifier(uint8_t const* g2x, uint8_t const* vk_buf, uint8_t* uint32_t get_exact_circuit_size(uint8_t const* constraint_system_buf) { auto constraint_system = from_buffer<acir_format::acir_format>(constraint_system_buf); - auto crs_factory = std::make_unique<bonk::ReferenceStringFactory>(); + auto crs_factory = std::make_unique<proof_system::ReferenceStringFactory>(); auto composer = create_circuit(constraint_system, std::move(crs_factory)); auto num_gates = composer.get_num_gates(); @@ -42,7 +42,7 @@ uint32_t get_exact_circuit_size(uint8_t const* constraint_system_buf) uint32_t get_total_circuit_size(uint8_t const* constraint_system_buf) { auto constraint_system = from_buffer<acir_format::acir_format>(constraint_system_buf); - auto crs_factory = std::make_unique<bonk::ReferenceStringFactory>(); + auto crs_factory = std::make_unique<proof_system::ReferenceStringFactory>(); auto composer = create_circuit(constraint_system, std::move(crs_factory)); return static_cast<uint32_t>(composer.get_total_circuit_size()); @@ -69,9 +69,9 @@ size_t init_proving_key(uint8_t const* constraint_system_buf, uint8_t const** pk size_t init_verification_key(void* pippenger, uint8_t const* g2x, uint8_t const* pk_buf, uint8_t const** vk_buf) { std::shared_ptr<ProverReferenceString> crs; - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read(pk_buf, pk_data); - auto proving_key = std::make_shared<bonk::proving_key>(std::move(pk_data), crs); + auto proving_key = std::make_shared<plonk::proving_key>(std::move(pk_data), crs); auto crs_factory = std::make_unique<PippengerReferenceStringFactory>( reinterpret_cast<scalar_multiplication::Pippenger*>(pippenger), g2x); @@ -83,7 +83,7 @@ size_t init_verification_key(void* pippenger, uint8_t const* g2x, uint8_t const* // The composer_type has not yet been set. We need to set the composer_type for when we later read in and // construct the verification key so that we have the correct polynomial manifest - verification_key->composer_type = ComposerType::PLOOKUP; + verification_key->composer_type = proof_system::ComposerType::PLOOKUP; auto buffer = to_buffer(*verification_key); auto raw_buf = (uint8_t*)malloc(buffer.size()); @@ -103,9 +103,9 @@ size_t new_proof(void* pippenger, auto constraint_system = from_buffer<acir_format::acir_format>(constraint_system_buf); std::shared_ptr<ProverReferenceString> crs; - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read(pk_buf, pk_data); - auto proving_key = std::make_shared<bonk::proving_key>(std::move(pk_data), crs); + auto proving_key = std::make_shared<plonk::proving_key>(std::move(pk_data), crs); auto witness = from_buffer<std::vector<fr>>(witness_buf); @@ -136,9 +136,9 @@ bool verify_proof( #endif auto constraint_system = from_buffer<acir_format::acir_format>(constraint_system_buf); auto crs = std::make_shared<VerifierMemReferenceString>(g2x); - bonk::verification_key_data vk_data; + plonk::verification_key_data vk_data; read(vk_buf, vk_data); - auto verification_key = std::make_shared<bonk::verification_key>(std::move(vk_data), crs); + auto verification_key = std::make_shared<proof_system::plonk::verification_key>(std::move(vk_data), crs); Composer composer(nullptr, verification_key); create_circuit(composer, constraint_system); diff --git a/cpp/src/barretenberg/ecc/curves/types.hpp b/cpp/src/barretenberg/ecc/curves/types.hpp index f716c7c4d1..deb7384216 100644 --- a/cpp/src/barretenberg/ecc/curves/types.hpp +++ b/cpp/src/barretenberg/ecc/curves/types.hpp @@ -1,5 +1,5 @@ #pragma once -namespace bonk { +namespace proof_system { enum CurveType { BN254, SECP256K1, SECP256R1, GRUMPKIN }; } diff --git a/cpp/src/barretenberg/honk/CMakeLists.txt b/cpp/src/barretenberg/honk/CMakeLists.txt index ac0dc30fd0..529a54878b 100644 --- a/cpp/src/barretenberg/honk/CMakeLists.txt +++ b/cpp/src/barretenberg/honk/CMakeLists.txt @@ -1,4 +1,5 @@ -barretenberg_module(honk numeric ecc srs proof_system transcript) +# TODO(Cody): Remove plonk dependency +barretenberg_module(honk numeric ecc srs proof_system transcript plonk) if(TESTING) # TODO: Re-enable all these warnings once PoC is finished diff --git a/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp b/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp index 4117dbcdd2..2bbf1c596d 100644 --- a/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp +++ b/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.cpp @@ -8,7 +8,7 @@ #include <cstdint> #include <string> -namespace honk { +namespace proof_system::honk { /** * Compute proving key base. @@ -23,16 +23,13 @@ namespace honk { * @return Pointer to the initialized proving key updated with selector polynomials. * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::proving_key> StandardHonkComposerHelper<CircuitConstructor>::compute_proving_key_base( +std::shared_ptr<plonk::proving_key> StandardHonkComposerHelper<CircuitConstructor>::compute_proving_key_base( const CircuitConstructor& constructor, const size_t minimum_circuit_size, const size_t num_randomized_gates) { // Initialize circuit_proving_key // TODO(#229)(Kesha): replace composer types. - circuit_proving_key = initialize_proving_key(constructor, - crs_factory_.get(), - minimum_circuit_size, - num_randomized_gates, - plonk::ComposerType::STANDARD_HONK); + circuit_proving_key = initialize_proving_key( + constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::STANDARD_HONK); // Compute lagrange selectors construct_lagrange_selector_forms(constructor, circuit_proving_key.get()); @@ -46,10 +43,10 @@ std::shared_ptr<bonk::proving_key> StandardHonkComposerHelper<CircuitConstructor */ template <typename CircuitConstructor> -std::shared_ptr<bonk::verification_key> StandardHonkComposerHelper<CircuitConstructor>::compute_verification_key_base( - std::shared_ptr<bonk::proving_key> const& proving_key, std::shared_ptr<bonk::VerifierReferenceString> const& vrs) +std::shared_ptr<plonk::verification_key> StandardHonkComposerHelper<CircuitConstructor>::compute_verification_key_base( + std::shared_ptr<plonk::proving_key> const& proving_key, std::shared_ptr<VerifierReferenceString> const& vrs) { - auto key = std::make_shared<bonk::verification_key>( + auto key = std::make_shared<plonk::verification_key>( proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->composer_type); // TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc auto commitment_key = pcs::kzg::CommitmentKey(proving_key->circuit_size, "../srs_db/ignition"); @@ -101,14 +98,14 @@ void StandardHonkComposerHelper<CircuitConstructor>::compute_witness(const Circu * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::proving_key> StandardHonkComposerHelper<CircuitConstructor>::compute_proving_key( +std::shared_ptr<plonk::proving_key> StandardHonkComposerHelper<CircuitConstructor>::compute_proving_key( const CircuitConstructor& circuit_constructor) { if (circuit_proving_key) { return circuit_proving_key; } // Compute q_l, q_r, q_o, etc polynomials - StandardHonkComposerHelper::compute_proving_key_base(circuit_constructor, plonk::ComposerType::STANDARD_HONK); + StandardHonkComposerHelper::compute_proving_key_base(circuit_constructor, ComposerType::STANDARD_HONK); // Compute sigma polynomials (we should update that late) compute_standard_honk_sigma_permutations<CircuitConstructor::num_wires>(circuit_constructor, @@ -126,7 +123,7 @@ std::shared_ptr<bonk::proving_key> StandardHonkComposerHelper<CircuitConstructor * @return Pointer to created circuit verification key. * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::verification_key> StandardHonkComposerHelper<CircuitConstructor>::compute_verification_key( +std::shared_ptr<plonk::verification_key> StandardHonkComposerHelper<CircuitConstructor>::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -182,4 +179,4 @@ StandardProver StandardHonkComposerHelper<CircuitConstructor>::create_prover( template class StandardHonkComposerHelper<StandardCircuitConstructor>; template StandardProver StandardHonkComposerHelper<StandardCircuitConstructor>::create_prover<StandardHonk>( const StandardCircuitConstructor& circuit_constructor); -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp b/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp index 80e48a5eeb..5b033996d5 100644 --- a/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp +++ b/cpp/src/barretenberg/honk/composer/composer_helper/standard_honk_composer_helper.hpp @@ -2,12 +2,12 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/honk/proof_system/prover.hpp" #include "barretenberg/honk/proof_system/verifier.hpp" #include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" #include "barretenberg/proof_system/arithmetization/gate_data.hpp" #include "barretenberg/proof_system/composer/composer_helper_lib.hpp" @@ -15,32 +15,34 @@ #include <utility> -namespace honk { +namespace proof_system::honk { // TODO(Kesha): change initializations to specify this parameter // Cody: What does this mean? template <typename CircuitConstructor> class StandardHonkComposerHelper { public: static constexpr size_t NUM_RANDOMIZED_GATES = 2; // equal to the number of multilinear evaluations leaked static constexpr size_t num_wires = CircuitConstructor::num_wires; - std::shared_ptr<bonk::proving_key> circuit_proving_key; + std::shared_ptr<plonk::proving_key> circuit_proving_key; std::vector<barretenberg::polynomial> wire_polynomials; - std::shared_ptr<bonk::verification_key> circuit_verification_key; + std::shared_ptr<plonk::verification_key> circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr<bonk::ReferenceStringFactory> crs_factory_; + std::shared_ptr<ReferenceStringFactory> crs_factory_; bool computed_witness = false; + // TODO(Luke): use make_shared StandardHonkComposerHelper() - : StandardHonkComposerHelper( - std::shared_ptr<bonk::ReferenceStringFactory>(new bonk::FileReferenceStringFactory("../srs_db/ignition"))) + : StandardHonkComposerHelper(std::shared_ptr<ReferenceStringFactory>( + new proof_system::FileReferenceStringFactory("../srs_db/ignition"))) {} - StandardHonkComposerHelper(std::shared_ptr<bonk::ReferenceStringFactory> crs_factory) + StandardHonkComposerHelper(std::shared_ptr<ReferenceStringFactory> crs_factory) : crs_factory_(std::move(crs_factory)) {} - StandardHonkComposerHelper(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory) + StandardHonkComposerHelper(std::unique_ptr<ReferenceStringFactory>&& crs_factory) : crs_factory_(std::move(crs_factory)) {} - StandardHonkComposerHelper(std::shared_ptr<bonk::proving_key> p_key, std::shared_ptr<bonk::verification_key> v_key) + StandardHonkComposerHelper(std::shared_ptr<plonk::proving_key> p_key, + std::shared_ptr<plonk::verification_key> v_key) : circuit_proving_key(std::move(p_key)) , circuit_verification_key(std::move(v_key)) {} @@ -50,8 +52,8 @@ template <typename CircuitConstructor> class StandardHonkComposerHelper { StandardHonkComposerHelper& operator=(const StandardHonkComposerHelper& other) = delete; ~StandardHonkComposerHelper() = default; - std::shared_ptr<bonk::proving_key> compute_proving_key(const CircuitConstructor& circuit_constructor); - std::shared_ptr<bonk::verification_key> compute_verification_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr<plonk::proving_key> compute_proving_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr<plonk::verification_key> compute_verification_key(const CircuitConstructor& circuit_constructor); StandardVerifier create_verifier(const CircuitConstructor& circuit_constructor); @@ -59,17 +61,16 @@ template <typename CircuitConstructor> class StandardHonkComposerHelper { // TODO(#216)(Adrian): Seems error prone to provide the number of randomized gates // Cody: Where should this go? In the flavor (or whatever that becomes)? - std::shared_ptr<bonk::proving_key> compute_proving_key_base( + std::shared_ptr<plonk::proving_key> compute_proving_key_base( const CircuitConstructor& circuit_constructor, const size_t minimum_ciricut_size = 0, const size_t num_randomized_gates = NUM_RANDOMIZED_GATES); // This needs to be static as it may be used only to compute the selector commitments. - static std::shared_ptr<bonk::verification_key> compute_verification_key_base( - std::shared_ptr<bonk::proving_key> const& proving_key, - std::shared_ptr<bonk::VerifierReferenceString> const& vrs); + static std::shared_ptr<plonk::verification_key> compute_verification_key_base( + std::shared_ptr<plonk::proving_key> const& proving_key, std::shared_ptr<VerifierReferenceString> const& vrs); void compute_witness(const CircuitConstructor& circuit_constructor, const size_t minimum_circuit_size = 0); }; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp b/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp index 52d4579fd5..ab2c344514 100644 --- a/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp +++ b/cpp/src/barretenberg/honk/composer/standard_honk_composer.hpp @@ -6,7 +6,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/honk/flavor/flavor.hpp" -namespace honk { +namespace proof_system::honk { /** * @brief Standard Honk Composer has everything required to construct a prover and verifier, just as the legacy classes. * @@ -15,7 +15,7 @@ namespace honk { */ class StandardHonkComposer { public: - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD_HONK; + static constexpr ComposerType type = ComposerType::STANDARD_HONK; static constexpr size_t UINT_LOG2_BASE = 2; // An instantiation of the circuit constructor that only depends on arithmetization, not on the proof system @@ -39,17 +39,17 @@ class StandardHonkComposer { StandardHonkComposer(std::string const& crs_path, const size_t size_hint = 0) : StandardHonkComposer( - std::unique_ptr<bonk::ReferenceStringFactory>(new bonk::FileReferenceStringFactory(crs_path)), + std::unique_ptr<ReferenceStringFactory>(new proof_system::FileReferenceStringFactory(crs_path)), size_hint){}; - StandardHonkComposer(std::shared_ptr<bonk::ReferenceStringFactory> const& crs_factory, const size_t size_hint = 0) + StandardHonkComposer(std::shared_ptr<ReferenceStringFactory> const& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(crs_factory) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables) {} - StandardHonkComposer(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory, const size_t size_hint = 0) + StandardHonkComposer(std::unique_ptr<ReferenceStringFactory>&& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(std::move(crs_factory)) , num_gates(circuit_constructor.num_gates) @@ -57,8 +57,8 @@ class StandardHonkComposer { {} - StandardHonkComposer(std::shared_ptr<bonk::proving_key> const& p_key, - std::shared_ptr<bonk::verification_key> const& v_key, + StandardHonkComposer(std::shared_ptr<plonk::proving_key> const& p_key, + std::shared_ptr<plonk::verification_key> const& v_key, size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(p_key, v_key) @@ -161,12 +161,12 @@ class StandardHonkComposer { /**Proof and verification-related methods*/ - std::shared_ptr<bonk::proving_key> compute_proving_key() + std::shared_ptr<plonk::proving_key> compute_proving_key() { return composer_helper.compute_proving_key(circuit_constructor); } - std::shared_ptr<bonk::verification_key> compute_verification_key() + std::shared_ptr<plonk::verification_key> compute_verification_key() { return composer_helper.compute_verification_key(circuit_constructor); } @@ -184,4 +184,4 @@ class StandardHonkComposer { const std::string& err() const { return circuit_constructor.err(); }; void failure(std::string msg) { circuit_constructor.failure(msg); } }; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp b/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp index a9970add68..84717e21a4 100644 --- a/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp +++ b/cpp/src/barretenberg/honk/composer/standard_honk_composer.test.cpp @@ -11,7 +11,7 @@ #include <gtest/gtest.h> -using namespace honk; +using namespace proof_system::honk; namespace test_standard_honk_composer { /** @@ -93,7 +93,7 @@ TEST(StandardHonkComposer, SigmaIDCorrectness) } // test correctness of the public input delta - auto delta = honk::compute_public_input_delta<fr>(public_inputs, beta, gamma, n); + auto delta = proof_system::honk::compute_public_input_delta<fr>(public_inputs, beta, gamma, n); EXPECT_EQ(left / right, delta); for (size_t i = 0; i < num_public_inputs; ++i) { @@ -348,7 +348,7 @@ TEST(StandardHonkComposer, SumcheckRelationCorrectness) .public_input_delta = public_input_delta, }; - constexpr size_t num_polynomials = honk::StandardArithmetization::NUM_POLYNOMIALS; + constexpr size_t num_polynomials = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; // Compute grand product polynomial polynomial z_perm_poly = prover_library::compute_permutation_grand_product<num_wires>(prover.key, prover.wire_polynomials, beta, gamma); @@ -359,7 +359,7 @@ TEST(StandardHonkComposer, SumcheckRelationCorrectness) // in the list below std::array<std::span<const fr>, num_polynomials> evaluations_array; - using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; + using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; evaluations_array[POLYNOMIAL::W_L] = prover.wire_polynomials[0]; evaluations_array[POLYNOMIAL::W_R] = prover.wire_polynomials[1]; evaluations_array[POLYNOMIAL::W_O] = prover.wire_polynomials[2]; diff --git a/cpp/src/barretenberg/honk/flavor/flavor.hpp b/cpp/src/barretenberg/honk/flavor/flavor.hpp index 0d8903f945..ad47783e1d 100644 --- a/cpp/src/barretenberg/honk/flavor/flavor.hpp +++ b/cpp/src/barretenberg/honk/flavor/flavor.hpp @@ -5,7 +5,7 @@ #include "barretenberg/proof_system/arithmetization/arithmetization.hpp" #include "barretenberg/transcript/manifest.hpp" -namespace honk { +namespace proof_system::honk { // TODO(Cody) This _should_ be shared with Plonk, but it isn't. struct StandardArithmetization { /** @@ -59,14 +59,14 @@ struct StandardArithmetization { "LAGRANGE_LAST", "W_1", "W_2", "W_3", "Z_PERM", "Z_PERM_SHIFT" }; }; -} // namespace honk +} // namespace proof_system::honk -namespace honk { +namespace proof_system::honk { struct StandardHonk { public: // This whole file is broken; changes here are in anticipation of a follow-up rework of the flavor specificaiton. using Arithmetization = arithmetization::Standard; - using MULTIVARIATE = honk::StandardArithmetization::POLYNOMIAL; + using MULTIVARIATE = proof_system::honk::StandardArithmetization::POLYNOMIAL; // // TODO(Cody): Where to specify? is this polynomial manifest size? // static constexpr size_t STANDARD_HONK_MANIFEST_SIZE = 16; // TODO(Cody): Maybe relation should be supplied and this should be computed as is done in sumcheck? @@ -187,4 +187,4 @@ struct StandardHonk { return output; } }; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/oracle/oracle.hpp b/cpp/src/barretenberg/honk/oracle/oracle.hpp index 0a78654fa9..52beed5d12 100644 --- a/cpp/src/barretenberg/honk/oracle/oracle.hpp +++ b/cpp/src/barretenberg/honk/oracle/oracle.hpp @@ -3,7 +3,7 @@ #include <cstddef> #include <array> -namespace honk { +namespace proof_system::honk { template <typename TranscriptType> struct Oracle { size_t consumed{ 0 }; @@ -271,4 +271,4 @@ template <typename TranscriptType> struct Oracle { // Fr public_input_delta = 1; // TODO FIX // }; -} // namespace honk \ No newline at end of file +} // namespace proof_system::honk \ No newline at end of file diff --git a/cpp/src/barretenberg/honk/pcs/claim.hpp b/cpp/src/barretenberg/honk/pcs/claim.hpp index 55f26bfd15..d009edc0d3 100644 --- a/cpp/src/barretenberg/honk/pcs/claim.hpp +++ b/cpp/src/barretenberg/honk/pcs/claim.hpp @@ -2,7 +2,7 @@ #include "barretenberg/polynomials/polynomial.hpp" -namespace honk::pcs { +namespace proof_system::honk::pcs { /** * @brief Opening pair (r,v) for some witness polynomial p(X) such that p(r) = v * @@ -90,4 +90,4 @@ template <typename Params> class MLEOpeningClaim { // v↺ = g(u) = a₁⋅L₀(u) + … + aₙ₋₁⋅Lₙ₋₂(u) Fr evaluation; }; -} // namespace honk::pcs +} // namespace proof_system::honk::pcs diff --git a/cpp/src/barretenberg/honk/pcs/commitment_key.hpp b/cpp/src/barretenberg/honk/pcs/commitment_key.hpp index 81aec686f4..ce29e5fe7d 100644 --- a/cpp/src/barretenberg/honk/pcs/commitment_key.hpp +++ b/cpp/src/barretenberg/honk/pcs/commitment_key.hpp @@ -15,7 +15,7 @@ #include <string_view> #include <memory> -namespace honk::pcs { +namespace proof_system::honk::pcs { namespace kzg { @@ -66,7 +66,7 @@ class CommitmentKey { private: barretenberg::scalar_multiplication::pippenger_runtime_state pippenger_runtime_state; - bonk::FileReferenceString srs; + proof_system::FileReferenceString srs; }; class VerificationKey { @@ -108,7 +108,7 @@ class VerificationKey { } private: - bonk::VerifierFileReferenceString verifier_srs; + proof_system::VerifierFileReferenceString verifier_srs; }; struct Params { @@ -243,7 +243,7 @@ class CommitmentKey { }; barretenberg::scalar_multiplication::pippenger_runtime_state pippenger_runtime_state; - bonk::FileReferenceString srs; + proof_system::FileReferenceString srs; }; class VerificationKey { @@ -268,7 +268,7 @@ class VerificationKey { {} barretenberg::scalar_multiplication::pippenger_runtime_state pippenger_runtime_state; - bonk::FileReferenceString srs; + proof_system::FileReferenceString srs; }; struct Params { @@ -284,4 +284,4 @@ struct Params { } // namespace ipa -} // namespace honk::pcs +} // namespace proof_system::honk::pcs diff --git a/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp b/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp index 47623ee453..0676a2631f 100644 --- a/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp +++ b/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp @@ -19,7 +19,7 @@ #include "claim.hpp" #include "commitment_key.hpp" -namespace honk::pcs { +namespace proof_system::honk::pcs { namespace { constexpr std::string_view kzg_srs_path = "../srs_db/ignition"; } @@ -202,4 +202,4 @@ using IpaCommitmentSchemeParams = ::testing::Types<ipa::Params>; // using CommitmentSchemeParams = // ::testing::Types<fake::Params<barretenberg::g1>, fake::Params<grumpkin::g1>, kzg::Params>; -} // namespace honk::pcs +} // namespace proof_system::honk::pcs diff --git a/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp b/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp index e4b0126949..6e2cd50fe7 100644 --- a/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp +++ b/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp @@ -46,7 +46,7 @@ * The verifier is able to computed the simulated commitments to A₀₊(X) and A₀₋(X) * since they are linear-combinations of the commitments [fⱼ] and [gⱼ]. */ -namespace honk::pcs::gemini { +namespace proof_system::honk::pcs::gemini { /** * @brief Prover output (evalutation pair, witness) that can be passed on to Shplonk batch opening. @@ -346,4 +346,4 @@ template <typename Params> class MultilinearReductionScheme { return { C0_r_pos, C0_r_neg }; }; }; -} // namespace honk::pcs::gemini +} // namespace proof_system::honk::pcs::gemini diff --git a/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp b/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp index 17af010e23..cf2e0549cf 100644 --- a/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp +++ b/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp @@ -7,7 +7,7 @@ #include <gtest/gtest.h> #include <span> -namespace honk::pcs::gemini { +namespace proof_system::honk::pcs::gemini { template <class Params> class GeminiTest : public CommitmentTest<Params> { using Gemini = MultilinearReductionScheme<Params>; @@ -237,4 +237,4 @@ TYPED_TEST(GeminiTest, DoubleWithShift) multilinear_commitments_to_be_shifted); } -} // namespace honk::pcs::gemini +} // namespace proof_system::honk::pcs::gemini diff --git a/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp b/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp index b4add52fe5..6175d4da46 100644 --- a/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp +++ b/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp @@ -17,7 +17,7 @@ * https://hackmd.io/q-A8y6aITWyWJrvsGGMWNA?view. * */ -namespace honk::pcs::ipa { +namespace proof_system::honk::pcs::ipa { template <typename Params> class InnerProductArgument { using Fr = typename Params::Fr; using element = typename Params::Commitment; @@ -66,9 +66,9 @@ template <typename Params> class InnerProductArgument { "The poly_degree should be positive and a power of two"); auto& aux_generator = pub_input.aux_generator; auto a_vec = polynomial; - // TODO(#220)(Arijit): to make it more efficient by directly using G_vector for the input points when i = 0 and write the - // output points to G_vec_local. Then use G_vec_local for rounds where i>0, this can be done after we use SRS - // instead of G_vector. + // TODO(#220)(Arijit): to make it more efficient by directly using G_vector for the input points when i = 0 and + // write the output points to G_vec_local. Then use G_vec_local for rounds where i>0, this can be done after we + // use SRS instead of G_vector. auto srs_elements = ck->srs.get_monomial_points(); std::vector<affine_element> G_vec_local(poly_degree); for (size_t i = 0; i < poly_degree; i++) { @@ -251,4 +251,4 @@ template <typename Params> class InnerProductArgument { } }; -} // namespace honk::pcs::ipa +} // namespace proof_system::honk::pcs::ipa diff --git a/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp b/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp index 39bd880312..513e931d47 100644 --- a/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp +++ b/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp @@ -7,7 +7,7 @@ #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/honk/pcs/commitment_key.test.hpp" using namespace barretenberg; -namespace honk::pcs::ipa { +namespace proof_system::honk::pcs::ipa { template <class Params> class IpaCommitmentTest : public CommitmentTest<Params> { using Fr = typename Params::Fr; @@ -58,4 +58,4 @@ TYPED_TEST(IpaCommitmentTest, open) auto result = IPA::reduce_verify(this->vk(), proof, pub_input); EXPECT_TRUE(result); } -} // namespace honk::pcs::ipa +} // namespace proof_system::honk::pcs::ipa diff --git a/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp b/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp index 0a38b09c3a..b6ba93653a 100644 --- a/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp +++ b/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp @@ -7,7 +7,7 @@ #include <memory> #include <utility> -namespace honk::pcs::kzg { +namespace proof_system::honk::pcs::kzg { /** * @brief A transformed polynomial commitment opening claim of the form (P₀, P₁) ∈ 𝔾₁ * which should satisfy e(P₀, [1]₂) ⋅ e(P₁, [x]₂)=1. @@ -93,4 +93,4 @@ template <typename Params> class UnivariateOpeningScheme { return Accumulator(claim, quotient_commitment); }; }; -} // namespace honk::pcs::kzg +} // namespace proof_system::honk::pcs::kzg diff --git a/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp b/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp index ebbf44af0a..5d4e53a8c1 100644 --- a/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp +++ b/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp @@ -13,7 +13,7 @@ #include <gtest/gtest.h> #include <vector> -namespace honk::pcs::kzg { +namespace proof_system::honk::pcs::kzg { template <class Params> class BilinearAccumulationTest : public CommitmentTest<Params> { public: @@ -170,4 +170,4 @@ TYPED_TEST(BilinearAccumulationTest, GeminiShplonkKzgWithShift) EXPECT_EQ(verified, true); } -} // namespace honk::pcs::kzg +} // namespace proof_system::honk::pcs::kzg diff --git a/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp b/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp index f09be9da05..af84e1b632 100644 --- a/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp +++ b/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp @@ -17,7 +17,7 @@ * The challenges are ρ (batching) and r (random evaluation). * */ -namespace honk::pcs::shplonk { +namespace proof_system::honk::pcs::shplonk { /** * @brief Single commitment to Q(X) = ∑ₖ ( Bₖ(X) − Tₖ(X) ) / zₖ(X) @@ -43,4 +43,4 @@ template <typename Params> struct ProverOutput { OutputWitness<Params> witness; // single polynomial G(X) }; -} // namespace honk::pcs::shplonk +} // namespace proof_system::honk::pcs::shplonk diff --git a/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp b/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp index 2e406414f5..072b665e8c 100644 --- a/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp +++ b/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp @@ -10,7 +10,7 @@ #include "../commitment_key.test.hpp" #include "barretenberg/honk/pcs/claim.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace honk::pcs::shplonk { +namespace proof_system::honk::pcs::shplonk { template <class Params> class ShplonkTest : public CommitmentTest<Params> {}; TYPED_TEST_SUITE(ShplonkTest, CommitmentSchemeParams); @@ -63,4 +63,4 @@ TYPED_TEST(ShplonkTest, ShplonkSimple) this->verify_opening_claim(verifier_claim, shplonk_prover_witness); } -} // namespace honk::pcs::shplonk +} // namespace proof_system::honk::pcs::shplonk diff --git a/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp b/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp index f68a0f98d5..099e73962a 100644 --- a/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp +++ b/cpp/src/barretenberg/honk/pcs/shplonk/shplonk_single.hpp @@ -4,7 +4,7 @@ #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/honk/transcript/transcript.hpp" -namespace honk::pcs::shplonk { +namespace proof_system::honk::pcs::shplonk { /** * @brief Protocol for opening several polynomials, each in a single different point. @@ -164,4 +164,4 @@ template <typename Params> class SingleBatchOpeningScheme { return { { z_challenge, Fr::zero() }, G_commitment }; }; }; -} // namespace honk::pcs::shplonk +} // namespace proof_system::honk::pcs::shplonk diff --git a/cpp/src/barretenberg/honk/pcs/wrapper.hpp b/cpp/src/barretenberg/honk/pcs/wrapper.hpp index d5f60d8cd7..eb04f99565 100644 --- a/cpp/src/barretenberg/honk/pcs/wrapper.hpp +++ b/cpp/src/barretenberg/honk/pcs/wrapper.hpp @@ -4,7 +4,7 @@ #include "gemini/gemini.hpp" #include "barretenberg/ecc/curves/bn254/g1.hpp" -namespace honk { +namespace proof_system::honk { struct OpeningProof { std::vector<barretenberg::g1::affine_element> gemini; @@ -12,4 +12,4 @@ struct OpeningProof { barretenberg::g1::affine_element kzg; }; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/proof_system/program_settings.hpp b/cpp/src/barretenberg/honk/proof_system/program_settings.hpp index 037d24362e..b3df26bec6 100644 --- a/cpp/src/barretenberg/honk/proof_system/program_settings.hpp +++ b/cpp/src/barretenberg/honk/proof_system/program_settings.hpp @@ -6,7 +6,7 @@ #include "../../plonk/proof_system/types/prover_settings.hpp" #include "barretenberg/honk/flavor/flavor.hpp" -namespace honk { +namespace proof_system::honk { // TODO(#221)(Luke/Cody): Shouldn't subclass plonk settings here. Also, define standard_settings for Honk prover. class standard_verifier_settings : public plonk::standard_settings { @@ -15,8 +15,8 @@ class standard_verifier_settings : public plonk::standard_settings { typedef transcript::StandardTranscript Transcript; static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; - static constexpr size_t num_wires = honk::StandardHonk::Arithmetization::num_wires; - static constexpr size_t num_polys = honk::StandardArithmetization::NUM_POLYNOMIALS; + static constexpr size_t num_wires = proof_system::honk::StandardHonk::Arithmetization::num_wires; + static constexpr size_t num_polys = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; }; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/proof_system/prover.cpp b/cpp/src/barretenberg/honk/proof_system/prover.cpp index e0c580099f..7dbd085f40 100644 --- a/cpp/src/barretenberg/honk/proof_system/prover.cpp +++ b/cpp/src/barretenberg/honk/proof_system/prover.cpp @@ -22,12 +22,12 @@ #include <string> #include "barretenberg/honk/pcs/claim.hpp" -namespace honk { +namespace proof_system::honk { using Fr = barretenberg::fr; using Commitment = barretenberg::g1::affine_element; using Polynomial = barretenberg::Polynomial<Fr>; -using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; +using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; /** * Create Prover from proving key, witness and manifest. @@ -39,7 +39,7 @@ using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; * */ template <typename settings> Prover<settings>::Prover(std::vector<barretenberg::polynomial>&& wire_polys, - std::shared_ptr<bonk::proving_key> input_key) + std::shared_ptr<plonk::proving_key> input_key) : wire_polynomials(wire_polys) , key(input_key) , commitment_key(std::make_unique<pcs::kzg::CommitmentKey>( @@ -182,8 +182,8 @@ template <typename settings> void Prover<settings>::execute_relation_check_round * */ template <typename settings> void Prover<settings>::execute_univariatization_round() { - const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; - const size_t NUM_UNSHIFTED_POLYS = honk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; + const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; + const size_t NUM_UNSHIFTED_POLYS = proof_system::honk::StandardArithmetization::NUM_UNSHIFTED_POLYNOMIALS; // Generate batching challenge ρ and powers 1,ρ,…,ρᵐ⁻¹ Fr rho = transcript.get_challenge("rho"); @@ -317,4 +317,4 @@ template <typename settings> plonk::proof& Prover<settings>::construct_proof() template class Prover<plonk::standard_settings>; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/proof_system/prover.hpp b/cpp/src/barretenberg/honk/proof_system/prover.hpp index 5c9aa39ad8..43d2d27f38 100644 --- a/cpp/src/barretenberg/honk/proof_system/prover.hpp +++ b/cpp/src/barretenberg/honk/proof_system/prover.hpp @@ -4,7 +4,7 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/honk/flavor/flavor.hpp" #include <array> -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/types/program_settings.hpp" @@ -25,7 +25,7 @@ #include "barretenberg/honk/pcs/claim.hpp" #include "barretenberg/honk/proof_system/prover_library.hpp" -namespace honk { +namespace proof_system::honk { using Fr = barretenberg::fr; using Polynomial = Polynomial<Fr>; @@ -33,7 +33,7 @@ using Polynomial = Polynomial<Fr>; template <typename settings> class Prover { public: - Prover(std::vector<barretenberg::polynomial>&& wire_polys, std::shared_ptr<bonk::proving_key> input_key = nullptr); + Prover(std::vector<barretenberg::polynomial>&& wire_polys, std::shared_ptr<plonk::proving_key> input_key = nullptr); void execute_preamble_round(); void execute_wire_commitments_round(); @@ -61,7 +61,7 @@ template <typename settings> class Prover { std::vector<barretenberg::polynomial> wire_polynomials; barretenberg::polynomial z_permutation; - std::shared_ptr<bonk::proving_key> key; + std::shared_ptr<plonk::proving_key> key; std::shared_ptr<pcs::kzg::CommitmentKey> commitment_key; @@ -74,9 +74,9 @@ template <typename settings> class Prover { // Honk only needs a small portion of the functionality but may be fine to use existing work_queue // NOTE: this is not currently in use, but it may well be used in the future. // TODO(Adrian): Uncomment when we need this again. - // bonk::work_queue queue; + // proof_system::work_queue queue; // void flush_queued_work_items() { queue.flush_queue(); } - // bonk::work_queue::work_item_info get_queued_work_item_info() const { + // proof_system::work_queue::work_item_info get_queued_work_item_info() const { // return queue.get_queued_work_item_info(); // } // size_t get_scalar_multiplication_size(const size_t work_item_number) const @@ -103,4 +103,4 @@ extern template class Prover<plonk::standard_settings>; using StandardProver = Prover<plonk::standard_settings>; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/proof_system/prover_library.cpp b/cpp/src/barretenberg/honk/proof_system/prover_library.cpp index fe102bcd2c..d99a2947a4 100644 --- a/cpp/src/barretenberg/honk/proof_system/prover_library.cpp +++ b/cpp/src/barretenberg/honk/proof_system/prover_library.cpp @@ -2,7 +2,7 @@ #include "barretenberg/plonk/proof_system/types/prover_settings.hpp" #include <span> -namespace honk::prover_library { +namespace proof_system::honk::prover_library { using Fr = barretenberg::fr; using Polynomial = barretenberg::Polynomial<Fr>; @@ -35,7 +35,7 @@ using Polynomial = barretenberg::Polynomial<Fr>; */ // TODO(#222)(luke): Parallelize template <size_t program_width> -Polynomial compute_permutation_grand_product(std::shared_ptr<bonk::proving_key>& key, +Polynomial compute_permutation_grand_product(std::shared_ptr<plonk::proving_key>& key, std::vector<Polynomial>& wire_polynomials, Fr beta, Fr gamma) @@ -181,7 +181,7 @@ Polynomial compute_permutation_grand_product(std::shared_ptr<bonk::proving_key>& * @param gamma * @return Polynomial */ -Polynomial compute_lookup_grand_product(std::shared_ptr<bonk::proving_key>& key, +Polynomial compute_lookup_grand_product(std::shared_ptr<plonk::proving_key>& key, std::vector<Polynomial>& wire_polynomials, Polynomial& sorted_list_accumulator, Fr eta, @@ -327,7 +327,7 @@ Polynomial compute_lookup_grand_product(std::shared_ptr<bonk::proving_key>& key, * @param eta random challenge * @return Polynomial */ -Polynomial compute_sorted_list_accumulator(std::shared_ptr<bonk::proving_key>& key, +Polynomial compute_sorted_list_accumulator(std::shared_ptr<plonk::proving_key>& key, std::vector<Polynomial>& sorted_list_polynomials, Fr eta) { @@ -353,8 +353,8 @@ Polynomial compute_sorted_list_accumulator(std::shared_ptr<bonk::proving_key>& k } template Polynomial compute_permutation_grand_product<plonk::standard_settings::program_width>( - std::shared_ptr<bonk::proving_key>&, std::vector<Polynomial>&, Fr, Fr); + std::shared_ptr<plonk::proving_key>&, std::vector<Polynomial>&, Fr, Fr); template Polynomial compute_permutation_grand_product<plonk::ultra_settings::program_width>( - std::shared_ptr<bonk::proving_key>&, std::vector<Polynomial>&, Fr, Fr); + std::shared_ptr<plonk::proving_key>&, std::vector<Polynomial>&, Fr, Fr); -} // namespace honk::prover_library +} // namespace proof_system::honk::prover_library diff --git a/cpp/src/barretenberg/honk/proof_system/prover_library.hpp b/cpp/src/barretenberg/honk/proof_system/prover_library.hpp index 0fc6d1662f..c88a089f85 100644 --- a/cpp/src/barretenberg/honk/proof_system/prover_library.hpp +++ b/cpp/src/barretenberg/honk/proof_system/prover_library.hpp @@ -1,30 +1,30 @@ #pragma once #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/types/program_settings.hpp" -namespace honk::prover_library { +namespace proof_system::honk::prover_library { using Fr = barretenberg::fr; using Polynomial = barretenberg::Polynomial<Fr>; template <size_t program_width> -Polynomial compute_permutation_grand_product(std::shared_ptr<bonk::proving_key>& key, +Polynomial compute_permutation_grand_product(std::shared_ptr<plonk::proving_key>& key, std::vector<Polynomial>& wire_polynomials, Fr beta, Fr gamma); -Polynomial compute_lookup_grand_product(std::shared_ptr<bonk::proving_key>& key, +Polynomial compute_lookup_grand_product(std::shared_ptr<plonk::proving_key>& key, std::vector<Polynomial>& wire_polynomials, Polynomial& sorted_list_accumulator, Fr eta, Fr beta, Fr gamma); -Polynomial compute_sorted_list_accumulator(std::shared_ptr<bonk::proving_key>& key, +Polynomial compute_sorted_list_accumulator(std::shared_ptr<plonk::proving_key>& key, std::vector<Polynomial>& sorted_list_polynomials, Fr eta); -} // namespace honk::prover_library +} // namespace proof_system::honk::prover_library diff --git a/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp b/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp index 205d249581..0902129370 100644 --- a/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp +++ b/cpp/src/barretenberg/honk/proof_system/prover_library.test.cpp @@ -10,7 +10,7 @@ #include <cstddef> #include <gtest/gtest.h> -using namespace honk; +using namespace proof_system::honk; namespace prover_library_tests { // field is named Fscalar here because of clash with the Fr @@ -47,11 +47,11 @@ template <class FF> class ProverLibraryTests : public testing::Test { // Define some mock inputs for proving key constructor static const size_t num_gates = 8; static const size_t num_public_inputs = 0; - auto reference_string = std::make_shared<bonk::FileReferenceString>(num_gates + 1, "../srs_db/ignition"); + auto reference_string = std::make_shared<FileReferenceString>(num_gates + 1, "../srs_db/ignition"); // Instatiate a proving_key and make a pointer to it. This will be used to instantiate a Prover. - auto proving_key = std::make_shared<bonk::proving_key>( - num_gates, num_public_inputs, reference_string, plonk::ComposerType::STANDARD_HONK); + auto proving_key = std::make_shared<plonk::proving_key>( + num_gates, num_public_inputs, reference_string, ComposerType::STANDARD_HONK); // static const size_t program_width = StandardProver::settings_::program_width; @@ -156,11 +156,11 @@ template <class FF> class ProverLibraryTests : public testing::Test { // Define some mock inputs for proving key constructor static const size_t circuit_size = 8; static const size_t num_public_inputs = 0; - auto reference_string = std::make_shared<bonk::FileReferenceString>(circuit_size + 1, "../srs_db/ignition"); + auto reference_string = std::make_shared<FileReferenceString>(circuit_size + 1, "../srs_db/ignition"); // Instatiate a proving_key and make a pointer to it. This will be used to instantiate a Prover. - auto proving_key = std::make_shared<bonk::proving_key>( - circuit_size, num_public_inputs, reference_string, plonk::ComposerType::STANDARD_HONK); + auto proving_key = std::make_shared<plonk::proving_key>( + circuit_size, num_public_inputs, reference_string, ComposerType::STANDARD_HONK); // Construct mock wire and permutation polynomials. // Note: for the purpose of checking the consistency between two methods of computing z_perm, these polynomials @@ -285,9 +285,9 @@ template <class FF> class ProverLibraryTests : public testing::Test { // Construct a proving_key static const size_t circuit_size = 8; static const size_t num_public_inputs = 0; - auto reference_string = std::make_shared<bonk::FileReferenceString>(circuit_size + 1, "../srs_db/ignition"); - auto proving_key = std::make_shared<bonk::proving_key>( - circuit_size, num_public_inputs, reference_string, plonk::ComposerType::STANDARD_HONK); + auto reference_string = std::make_shared<FileReferenceString>(circuit_size + 1, "../srs_db/ignition"); + auto proving_key = std::make_shared<plonk::proving_key>( + circuit_size, num_public_inputs, reference_string, ComposerType::STANDARD_HONK); // Get random challenge eta auto eta = FF::random_element(); diff --git a/cpp/src/barretenberg/honk/proof_system/verifier.cpp b/cpp/src/barretenberg/honk/proof_system/verifier.cpp index 4eae6955d3..26e4b7e033 100644 --- a/cpp/src/barretenberg/honk/proof_system/verifier.cpp +++ b/cpp/src/barretenberg/honk/proof_system/verifier.cpp @@ -26,11 +26,11 @@ #include "barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp" using namespace barretenberg; -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; -namespace honk { +namespace proof_system::honk { template <typename program_settings> -Verifier<program_settings>::Verifier(std::shared_ptr<bonk::verification_key> verifier_key) +Verifier<program_settings>::Verifier(std::shared_ptr<plonk::verification_key> verifier_key) : key(verifier_key) {} @@ -199,4 +199,4 @@ template <typename program_settings> bool Verifier<program_settings>::verify_pro template class Verifier<honk::standard_verifier_settings>; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/proof_system/verifier.hpp b/cpp/src/barretenberg/honk/proof_system/verifier.hpp index e4ef74d667..ed4fe608a1 100644 --- a/cpp/src/barretenberg/honk/proof_system/verifier.hpp +++ b/cpp/src/barretenberg/honk/proof_system/verifier.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "./program_settings.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp" #include "../sumcheck/sumcheck.hpp" @@ -12,11 +12,11 @@ #include "barretenberg/honk/pcs/shplonk/shplonk_single.hpp" #include "barretenberg/honk/pcs/kzg/kzg.hpp" -namespace honk { +namespace proof_system::honk { template <typename program_settings> class Verifier { public: - Verifier(std::shared_ptr<bonk::verification_key> verifier_key = nullptr); + Verifier(std::shared_ptr<plonk::verification_key> verifier_key = nullptr); Verifier(Verifier&& other); Verifier(const Verifier& other) = delete; Verifier& operator=(const Verifier& other) = delete; @@ -24,7 +24,7 @@ template <typename program_settings> class Verifier { bool verify_proof(const plonk::proof& proof); - std::shared_ptr<bonk::verification_key> key; + std::shared_ptr<plonk::verification_key> key; std::map<std::string, barretenberg::g1::affine_element> kate_g1_elements; std::map<std::string, barretenberg::fr> kate_fr_elements; std::shared_ptr<pcs::kzg::VerificationKey> kate_verification_key; @@ -35,4 +35,4 @@ extern template class Verifier<honk::standard_verifier_settings>; typedef Verifier<honk::standard_verifier_settings> StandardVerifier; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp b/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp index 42689b9282..42f559aabf 100644 --- a/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp +++ b/cpp/src/barretenberg/honk/proof_system/verifier.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/honk/flavor/flavor.hpp" #include "prover.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/transcript/transcript.hpp" #include "verifier.hpp" #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" @@ -15,7 +15,7 @@ #include <vector> using namespace barretenberg; -using namespace honk; +using namespace proof_system::honk; namespace test_honk_verifier { @@ -26,7 +26,7 @@ template <class FF> class VerifierTests : public testing::Test { return honk::StandardHonk::create_manifest(num_public_inputs, num_sumcheck_rounds); } - static StandardVerifier generate_verifier(std::shared_ptr<bonk::proving_key> circuit_proving_key) + static StandardVerifier generate_verifier(std::shared_ptr<plonk::proving_key> circuit_proving_key) { std::array<fr*, 8> poly_coefficients; poly_coefficients[0] = circuit_proving_key->polynomial_store.get("q_1_lagrange").get_coefficients(); @@ -50,11 +50,12 @@ template <class FF> class VerifierTests : public testing::Test { prover)); } - auto crs = std::make_shared<bonk::VerifierFileReferenceString>("../srs_db/ignition"); - auto circuit_verification_key = std::make_shared<bonk::verification_key>(circuit_proving_key->circuit_size, - circuit_proving_key->num_public_inputs, - crs, - circuit_proving_key->composer_type); + auto crs = std::make_shared<VerifierFileReferenceString>("../srs_db/ignition"); + auto circuit_verification_key = + std::make_shared<plonk::verification_key>(circuit_proving_key->circuit_size, + circuit_proving_key->num_public_inputs, + crs, + circuit_proving_key->composer_type); circuit_verification_key->commitments.insert({ "Q_1", commitments[0] }); circuit_verification_key->commitments.insert({ "Q_2", commitments[1] }); @@ -81,9 +82,9 @@ template <class FF> class VerifierTests : public testing::Test { // Create some constraints that satisfy our arithmetic circuit relation // even indices = mul gates, odd incides = add gates - auto crs = std::make_shared<bonk::FileReferenceString>(n + 1, "../srs_db/ignition"); - std::shared_ptr<bonk::proving_key> proving_key = - std::make_shared<bonk::proving_key>(n, 0, crs, plonk::STANDARD_HONK); + auto crs = std::make_shared<FileReferenceString>(n + 1, "../srs_db/ignition"); + std::shared_ptr<plonk::proving_key> proving_key = + std::make_shared<plonk::proving_key>(n, 0, crs, ComposerType::STANDARD_HONK); polynomial w_l(n); polynomial w_r(n); @@ -177,8 +178,8 @@ template <class FF> class VerifierTests : public testing::Test { proving_key->polynomial_store.put("sigma_2_lagrange", std::move(sigma_2_lagrange_base)); proving_key->polynomial_store.put("sigma_3_lagrange", std::move(sigma_3_lagrange_base)); - bonk::compute_standard_honk_id_polynomials<3>(proving_key); - bonk::compute_first_and_last_lagrange_polynomials(proving_key); + compute_standard_honk_id_polynomials<3>(proving_key); + compute_first_and_last_lagrange_polynomials(proving_key); proving_key->polynomial_store.put("w_1_lagrange", std::move(w_l)); proving_key->polynomial_store.put("w_2_lagrange", std::move(w_r)); diff --git a/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp b/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp index 7fb7667368..ae2d5f5d9b 100644 --- a/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.hpp @@ -13,7 +13,7 @@ 4) There should be more thorough testing of this class in isolation. */ -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /** * NOTE: We should definitely consider question of optimal choice of domain, but if decide on {0,1,...,t-1} then we can @@ -147,4 +147,4 @@ template <class Fr, size_t domain_size, size_t num_evals> class BarycentricData return result; }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp b/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp index baee00800e..ed2471d01e 100644 --- a/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp +++ b/cpp/src/barretenberg/honk/sumcheck/polynomials/barycentric_data.test.cpp @@ -4,7 +4,7 @@ #include <gtest/gtest.h> #include "barretenberg/numeric/random/engine.hpp" -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; namespace test_sumcheck_polynomials { template <class FF> class BarycentricDataTests : public testing::Test {}; diff --git a/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp b/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp index c5d7756b8a..d30650154a 100644 --- a/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp +++ b/cpp/src/barretenberg/honk/sumcheck/polynomials/multivariates.test.cpp @@ -6,13 +6,13 @@ #include "barretenberg/honk/transcript/transcript.hpp" #include "barretenberg/numeric/random/engine.hpp" -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; namespace test_sumcheck_polynomials { template <class FF> class MultivariatesTests : public testing::Test {}; using FieldTypes = testing::Types<barretenberg::fr>; -using Transcript = honk::ProverTranscript<barretenberg::fr>; +using Transcript = proof_system::honk::ProverTranscript<barretenberg::fr>; TYPED_TEST_SUITE(MultivariatesTests, FieldTypes); #define MULTIVARIATES_TESTS_TYPE_ALIASES using FF = TypeParam; diff --git a/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp b/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp index 8cd92ac17e..654c348753 100644 --- a/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.hpp @@ -1,6 +1,6 @@ #pragma once -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /** * @brief Succinct representation of the `pow` polynomial that can be partially evaluated variable-by-variable. @@ -126,4 +126,4 @@ template <typename FF> struct PowUnivariate { partial_evaluation_constant *= current_univariate_eval; } }; -} // namespace honk::sumcheck \ No newline at end of file +} // namespace proof_system::honk::sumcheck \ No newline at end of file diff --git a/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp b/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp index 91bbad1a50..a8dd2f5ef3 100644 --- a/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp +++ b/cpp/src/barretenberg/honk/sumcheck/polynomials/pow.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include <gtest/gtest.h> -namespace honk::sumcheck::pow_test { +namespace proof_system::honk::sumcheck::pow_test { using FF = barretenberg::fr; @@ -20,7 +20,7 @@ TEST(SumcheckPow, FullPowConsistency) pow_univariate.partially_evaluate(u_i); } - FF expected_eval = honk::power_polynomial::evaluate<FF>(zeta, variables); + FF expected_eval = proof_system::honk::power_polynomial::evaluate<FF>(zeta, variables); EXPECT_EQ(pow_univariate.partial_evaluation_constant, expected_eval); } -} // namespace honk::sumcheck::pow_test +} // namespace proof_system::honk::sumcheck::pow_test diff --git a/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp b/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp index 89804ebc8f..a3cc9cf82f 100644 --- a/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.hpp @@ -6,7 +6,7 @@ #include "barretenberg/common/serialize.hpp" #include "barretenberg/common/assert.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template <class Fr, size_t view_length> class UnivariateView; @@ -349,4 +349,4 @@ template <typename T, typename U, std::size_t N> std::array<T, N> array_to_array return array_to_array_aux<T, U, N>(elements, std::make_index_sequence<N>()); }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp b/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp index e1e5477858..ffc870e46d 100644 --- a/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp +++ b/cpp/src/barretenberg/honk/sumcheck/polynomials/univariate.test.cpp @@ -5,7 +5,7 @@ #include <gtest/gtest.h> #include "barretenberg/numeric/random/engine.hpp" -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; namespace test_univariate { template <typename FF> class UnivariateTest : public testing::Test { diff --git a/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp b/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp index 4bfd999bd4..55947abeb4 100644 --- a/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/relations/arithmetic_relation.hpp @@ -6,7 +6,7 @@ #include "../polynomials/univariate.hpp" #include "relation.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template <typename FF> class ArithmeticRelation { public: @@ -68,4 +68,4 @@ template <typename FF> class ArithmeticRelation { full_honk_relation_value += q_c; }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp b/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp index c2cab137ce..5ecdedf61d 100644 --- a/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_computation_relation.hpp @@ -3,7 +3,7 @@ #include "barretenberg/honk/flavor/flavor.hpp" #include "../polynomials/univariate.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template <typename FF> class GrandProductComputationRelation { public: @@ -90,4 +90,4 @@ template <typename FF> class GrandProductComputationRelation { (w_2 + beta * sigma_2 + gamma) * (w_3 + beta * sigma_3 + gamma)); }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp b/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp index 66853b2e23..788cec7f52 100644 --- a/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/relations/grand_product_initialization_relation.hpp @@ -3,7 +3,7 @@ #include "barretenberg/honk/flavor/flavor.hpp" #include "../polynomials/univariate.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template <typename FF> class GrandProductInitializationRelation { public: @@ -45,4 +45,4 @@ template <typename FF> class GrandProductInitializationRelation { full_honk_relation_value += lagrange_last * z_perm_shift; }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp b/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp index 8218aaa3f0..a7860faeeb 100644 --- a/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/relations/relation.hpp @@ -1,6 +1,6 @@ #pragma once -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { // TODO(#226)(Adrian): Remove zeta, alpha as they are not used by the relations. template <typename FF> struct RelationParameters { @@ -8,4 +8,4 @@ template <typename FF> struct RelationParameters { FF gamma; FF public_input_delta; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp b/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp index 8a2620badc..6b7e1ac521 100644 --- a/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp +++ b/cpp/src/barretenberg/honk/sumcheck/relations/relation.test.cpp @@ -10,7 +10,7 @@ #include "barretenberg/numeric/random/engine.hpp" #include <gtest/gtest.h> -using namespace honk::sumcheck; +using namespace proof_system::honk::sumcheck; /** * We want to test if all three relations (namely, ArithmeticRelation, GrandProductComputationRelation, * GrandProductInitializationRelation) provide correct contributions by manually computing their @@ -23,15 +23,15 @@ using namespace honk::sumcheck; */ static const size_t input_univariate_length = 2; static constexpr size_t FULL_RELATION_LENGTH = 5; -static const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; +static const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; -namespace honk_relation_tests { +namespace proof_system::honk_relation_tests { template <class FF> class SumcheckRelation : public testing::Test { public: template <size_t t> using Univariate = Univariate<FF, t>; template <size_t t> using UnivariateView = UnivariateView<FF, t>; - using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; + using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; // TODO(#225)(Adrian): Accept FULL_RELATION_LENGTH as a template parameter for this function only, so that the test // can decide to which degree the polynomials must be extended. Possible accept an existing list of "edges" and // extend them to the degree. @@ -311,4 +311,4 @@ TYPED_TEST(SumcheckRelation, GrandProductInitializationRelation) run_test(/* is_random_input=*/false); }; -} // namespace honk_relation_tests +} // namespace proof_system::honk_relation_tests diff --git a/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp b/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp index b96bd99d67..837922feb2 100644 --- a/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp @@ -17,13 +17,13 @@ #include "barretenberg/honk/sumcheck/sumcheck_output.hpp" #include <optional> -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { template <typename FF, class Transcript, template <class> class... Relations> class Sumcheck { public: static constexpr size_t MAX_RELATION_LENGTH = std::max({ Relations<FF>::RELATION_LENGTH... }); - static constexpr size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; + static constexpr size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; std::array<FF, NUM_POLYNOMIALS> purported_evaluations; Transcript& transcript; @@ -217,4 +217,4 @@ template <typename FF, class Transcript, template <class> class... Relations> cl } }; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp b/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp index 9f3092c5be..95316ca5cb 100644 --- a/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp +++ b/cpp/src/barretenberg/honk/sumcheck/sumcheck.test.cpp @@ -20,11 +20,11 @@ #include <sys/types.h> #include <vector> -using namespace honk; -using namespace honk::sumcheck; +using namespace proof_system::honk; +using namespace proof_system::honk::sumcheck; using FF = barretenberg::fr; -const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; -using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; +const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; +using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; namespace test_sumcheck_round { diff --git a/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp b/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp index ab47f20e6c..52383cc80b 100644 --- a/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/sumcheck_output.hpp @@ -2,7 +2,7 @@ #include <array> #include <vector> -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /** * @brief Contains the multi-linear evaluations of the polynomials at the challenge point 'u'. @@ -16,4 +16,4 @@ template <typename FF> struct SumcheckOutput { bool operator==(const SumcheckOutput& other) const = default; }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp b/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp index 021d14730f..8a10169b8a 100644 --- a/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp +++ b/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.hpp @@ -8,7 +8,7 @@ #include "polynomials/pow.hpp" #include "relations/relation.hpp" -namespace honk::sumcheck { +namespace proof_system::honk::sumcheck { /* Notation: The polynomial P(X0, X1) that is the low-degree extension of its values vij = P(i,j) @@ -318,4 +318,4 @@ template <class FF, size_t num_multivariates, template <class> class... Relation } } }; -} // namespace honk::sumcheck +} // namespace proof_system::honk::sumcheck diff --git a/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp b/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp index f0129c1061..97b8ab4c47 100644 --- a/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp +++ b/cpp/src/barretenberg/honk/sumcheck/sumcheck_round.test.cpp @@ -19,13 +19,13 @@ * similar approach. */ -using namespace honk; -using namespace honk::sumcheck; +using namespace proof_system::honk; +using namespace proof_system::honk::sumcheck; const size_t max_relation_length = 5; const size_t input_polynomial_length = 2; using FF = barretenberg::fr; -const size_t NUM_POLYNOMIALS = honk::StandardArithmetization::NUM_POLYNOMIALS; -using POLYNOMIAL = honk::StandardArithmetization::POLYNOMIAL; +const size_t NUM_POLYNOMIALS = proof_system::honk::StandardArithmetization::NUM_POLYNOMIALS; +using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL; namespace test_sumcheck_round { /** diff --git a/cpp/src/barretenberg/honk/transcript/transcript.hpp b/cpp/src/barretenberg/honk/transcript/transcript.hpp index 89cef26219..15d92c679b 100644 --- a/cpp/src/barretenberg/honk/transcript/transcript.hpp +++ b/cpp/src/barretenberg/honk/transcript/transcript.hpp @@ -15,7 +15,7 @@ #include <map> #include <algorithm> -namespace honk { +namespace proof_system::honk { class TranscriptManifest { struct RoundData { @@ -272,4 +272,4 @@ template <class FF> class VerifierTranscript : public BaseTranscript<FF> { return element; } }; -} // namespace honk +} // namespace proof_system::honk diff --git a/cpp/src/barretenberg/honk/transcript/transcript.test.cpp b/cpp/src/barretenberg/honk/transcript/transcript.test.cpp index d9c8bc8c74..1e2de3d9d9 100644 --- a/cpp/src/barretenberg/honk/transcript/transcript.test.cpp +++ b/cpp/src/barretenberg/honk/transcript/transcript.test.cpp @@ -8,7 +8,7 @@ #include <gtest/gtest.h> #include <string> -using namespace honk; +using namespace proof_system::honk; template <typename FF> class TranscriptTest : public testing::Test { public: @@ -158,7 +158,7 @@ TYPED_TEST(TranscriptTest, ProverAndVerifierBasic) constexpr size_t LENGTH = 8; using Fr = barretenberg::fr; - using Univariate = honk::sumcheck::Univariate<Fr, LENGTH>; + using Univariate = proof_system::honk::sumcheck::Univariate<Fr, LENGTH>; using Commitment = barretenberg::g1::affine_element; std::array<Fr, LENGTH> evaluations; diff --git a/cpp/src/barretenberg/honk/utils/power_polynomial.hpp b/cpp/src/barretenberg/honk/utils/power_polynomial.hpp index 3459679e37..4f2e1ed5b2 100644 --- a/cpp/src/barretenberg/honk/utils/power_polynomial.hpp +++ b/cpp/src/barretenberg/honk/utils/power_polynomial.hpp @@ -5,7 +5,7 @@ #ifndef NO_MULTITHREADING #include "omp.h" #endif -namespace honk::power_polynomial { +namespace proof_system::honk::power_polynomial { /** * @brief Generate the power polynomial vector * @@ -71,4 +71,4 @@ template <typename Fr> Fr evaluate(Fr zeta, std::span<const Fr> variables) } return evaluation; } -} // namespace honk::power_polynomial +} // namespace proof_system::honk::power_polynomial diff --git a/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp b/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp index d62658e592..748731f014 100644 --- a/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp +++ b/cpp/src/barretenberg/honk/utils/power_polynomial.test.cpp @@ -7,7 +7,7 @@ TEST(power_polynomial, test_full_polynomial_correctness) const size_t order = 17; const size_t n = size_t(1) << order; barretenberg::fr zeta = barretenberg::fr::random_element(); - barretenberg::polynomial power_polynomial = honk::power_polynomial::generate_vector(zeta, n); + barretenberg::polynomial power_polynomial = proof_system::honk::power_polynomial::generate_vector(zeta, n); barretenberg::fr current_power = barretenberg::fr::one(); for (size_t i = 0; i < n; i++) { @@ -31,5 +31,5 @@ TEST(power_polynomial, test_evaluation_correctness) variables.emplace_back((random_index >> i) & 1); } EXPECT_EQ(zeta.pow(static_cast<size_t>(random_index)), - honk::power_polynomial::evaluate<barretenberg::fr>(zeta, variables)); + proof_system::honk::power_polynomial::evaluate<barretenberg::fr>(zeta, variables)); } diff --git a/cpp/src/barretenberg/honk/utils/public_inputs.hpp b/cpp/src/barretenberg/honk/utils/public_inputs.hpp index e281aeab8e..52c66cff94 100644 --- a/cpp/src/barretenberg/honk/utils/public_inputs.hpp +++ b/cpp/src/barretenberg/honk/utils/public_inputs.hpp @@ -1,7 +1,7 @@ #pragma once #include <span> -namespace honk { +namespace proof_system::honk { /** * @brief Compute the correction term for the permutation argument. @@ -54,4 +54,4 @@ Field compute_public_input_delta(std::span<const Field> public_inputs, return numerator / denominator; } -} // namespace honk \ No newline at end of file +} // namespace proof_system::honk \ No newline at end of file diff --git a/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp b/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp index f50bb31eba..e5371b8bd0 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp @@ -5,7 +5,7 @@ #include <fstream> #include <sys/stat.h> #include "barretenberg/common/timer.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #ifndef __wasm__ #include <filesystem> @@ -19,9 +19,9 @@ struct circuit_data { : num_gates(0) {} - std::shared_ptr<bonk::ReferenceStringFactory> srs; - std::shared_ptr<bonk::proving_key> proving_key; - std::shared_ptr<bonk::verification_key> verification_key; + std::shared_ptr<proof_system::ReferenceStringFactory> srs; + std::shared_ptr<plonk::proving_key> proving_key; + std::shared_ptr<plonk::verification_key> verification_key; size_t num_gates; std::vector<uint8_t> padding_proof; bool mock; @@ -38,7 +38,7 @@ inline bool exists(std::string const& path) template <typename ComposerType, typename F> circuit_data get_circuit_data(std::string const& name, std::string const& path_name, - std::shared_ptr<bonk::ReferenceStringFactory> const& srs, + std::shared_ptr<proof_system::ReferenceStringFactory> const& srs, std::string const& key_path, bool compute, bool save, @@ -70,12 +70,12 @@ circuit_data get_circuit_data(std::string const& name, Timer timer; build_circuit(composer); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Build time", timer.toString()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Gates", @@ -86,7 +86,7 @@ circuit_data get_circuit_data(std::string const& name, auto public_inputs = composer.get_public_inputs(); mock::mock_circuit(mock_proof_composer, public_inputs); info(name, ": Mock circuit size: ", mock_proof_composer.get_num_gates()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Mock Gates", @@ -107,13 +107,13 @@ circuit_data get_circuit_data(std::string const& name, if (exists(pk_path) && load) { info(name, ": Loading proving key: ", pk_path); auto pk_stream = std::ifstream(pk_path); - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read_mmap(pk_stream, pk_dir, pk_data); data.proving_key = - std::make_shared<bonk::proving_key>(std::move(pk_data), srs->get_prover_crs(pk_data.circuit_size + 1)); + std::make_shared<plonk::proving_key>(std::move(pk_data), srs->get_prover_crs(pk_data.circuit_size + 1)); data.num_gates = pk_data.circuit_size; info(name, ": Circuit size 2^n: ", data.num_gates); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Gates 2^n", @@ -127,7 +127,7 @@ circuit_data get_circuit_data(std::string const& name, data.proving_key = composer.compute_proving_key(); info(name, ": Circuit size 2^n: ", data.proving_key->circuit_size); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Gates 2^n", @@ -136,7 +136,7 @@ circuit_data get_circuit_data(std::string const& name, data.num_gates = mock_proof_composer.get_num_gates(); data.proving_key = mock_proof_composer.compute_proving_key(); info(name, ": Mock circuit size 2^n: ", data.proving_key->circuit_size); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Mock Gates 2^n", @@ -145,7 +145,7 @@ circuit_data get_circuit_data(std::string const& name, info(name, ": Proving key computed in ", timer.toString(), "s"); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Proving key computed in", @@ -170,12 +170,12 @@ circuit_data get_circuit_data(std::string const& name, if (exists(vk_path) && load) { info(name, ": Loading verification key from: ", vk_path); auto vk_stream = std::ifstream(vk_path); - bonk::verification_key_data vk_data; + plonk::verification_key_data vk_data; read(vk_stream, vk_data); data.verification_key = - std::make_shared<bonk::verification_key>(std::move(vk_data), data.srs->get_verifier_crs()); + std::make_shared<plonk::verification_key>(std::move(vk_data), data.srs->get_verifier_crs()); info(name, ": Verification key hash: ", data.verification_key->sha256_hash()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Verification key hash", @@ -191,13 +191,13 @@ circuit_data get_circuit_data(std::string const& name, } info(name, ": Computed verification key in ", timer.toString(), "s"); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Verification key computed in", timer.toString()); info(name, ": Verification key hash: ", data.verification_key->sha256_hash()); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Verification key hash", @@ -246,7 +246,7 @@ circuit_data get_circuit_data(std::string const& name, info(name, ": Padding verified: ", verifier.verify_proof(proof)); } info(name, ": Padding proof computed in ", timer.toString(), "s"); - benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(ComposerType), + benchmark_collator.benchmark_info_deferred(GET_COMPOSER_NAME_STRING(proof_system::ComposerType), "Core", name + name_suffix_for_benchmarks, "Padding proof computed in", diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp index 88ffa3bf80..cb35a19d27 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/c_bind.cpp @@ -8,11 +8,11 @@ #include <cstdint> #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/srs/reference_string/pippenger_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include <sstream> using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; using namespace join_split_example::proofs::join_split; #define WASM_EXPORT __attribute__((visibility("default"))) @@ -23,14 +23,14 @@ WASM_EXPORT void join_split__init_proving_key(bool mock) { // We know that we don't actually need any CRS to create a proving key, so just feed in a nothing. // Hacky, but, right now it needs *something*. - auto crs_factory = std::make_shared<bonk::ReferenceStringFactory>(); + auto crs_factory = std::make_shared<proof_system::ReferenceStringFactory>(); init_proving_key(crs_factory, mock); } WASM_EXPORT void join_split__init_proving_key_from_buffer(uint8_t const* pk_buf) { - std::shared_ptr<bonk::ProverReferenceString> crs; - bonk::proving_key_data pk_data; + std::shared_ptr<proof_system::ProverReferenceString> crs; + plonk::proving_key_data pk_data; read(pk_buf, pk_data); init_proving_key(crs, std::move(pk_data)); } @@ -70,15 +70,15 @@ WASM_EXPORT uint32_t join_split__get_new_proving_key_data(uint8_t** output) WASM_EXPORT void join_split__init_verification_key(void* pippenger, uint8_t const* g2x) { - auto crs_factory = std::make_unique<bonk::PippengerReferenceStringFactory>( + auto crs_factory = std::make_unique<proof_system::PippengerReferenceStringFactory>( reinterpret_cast<scalar_multiplication::Pippenger*>(pippenger), g2x); init_verification_key(std::move(crs_factory)); } WASM_EXPORT void join_split__init_verification_key_from_buffer(uint8_t const* vk_buf, uint8_t const* g2x) { - auto crs = std::make_shared<bonk::VerifierMemReferenceString>(g2x); - bonk::verification_key_data vk_data; + auto crs = std::make_shared<proof_system::VerifierMemReferenceString>(g2x); + plonk::verification_key_data vk_data; read(vk_buf, vk_data); init_verification_key(crs, std::move(vk_data)); } diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp index 700310f724..47fc4deec2 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp @@ -9,9 +9,9 @@ namespace proofs { namespace join_split { using namespace join_split_example::proofs::join_split; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; using namespace join_split_example::proofs::notes::native; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; join_split_tx noop_tx() { @@ -58,7 +58,7 @@ join_split_tx noop_tx() return tx; } -circuit_data get_circuit_data(std::shared_ptr<bonk::ReferenceStringFactory> const& srs, bool mock) +circuit_data get_circuit_data(std::shared_ptr<proof_system::ReferenceStringFactory> const& srs, bool mock) { std::cerr << "Getting join-split circuit data..." << std::endl; diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp index 8e4c533e6e..6c01a5b144 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.hpp @@ -10,7 +10,7 @@ join_split_tx noop_tx(); using circuit_data = proofs::circuit_data; -circuit_data get_circuit_data(std::shared_ptr<bonk::ReferenceStringFactory> const& srs, bool mock = false); +circuit_data get_circuit_data(std::shared_ptr<proof_system::ReferenceStringFactory> const& srs, bool mock = false); } // namespace join_split } // namespace proofs diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp index 213628a18f..44567b5b26 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp @@ -7,13 +7,13 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk; +using namespace proof_system::plonk::stdlib::merkle_tree; -static std::shared_ptr<bonk::proving_key> proving_key; -static std::shared_ptr<bonk::verification_key> verification_key; +static std::shared_ptr<plonk::proving_key> proving_key; +static std::shared_ptr<plonk::verification_key> verification_key; -void init_proving_key(std::shared_ptr<bonk::ReferenceStringFactory> const& crs_factory, bool mock) +void init_proving_key(std::shared_ptr<proof_system::ReferenceStringFactory> const& crs_factory, bool mock) { if (proving_key) { return; @@ -35,10 +35,11 @@ void init_proving_key(std::shared_ptr<bonk::ReferenceStringFactory> const& crs_f } } -void init_proving_key(std::shared_ptr<bonk::ProverReferenceString> const& crs, bonk::proving_key_data&& pk_data) +void init_proving_key(std::shared_ptr<proof_system::ProverReferenceString> const& crs, + plonk::proving_key_data&& pk_data) { release_key(); - proving_key = std::make_shared<bonk::proving_key>(std::move(pk_data), crs); + proving_key = std::make_shared<plonk::proving_key>(std::move(pk_data), crs); } void release_key() @@ -46,7 +47,7 @@ void release_key() proving_key.reset(); } -void init_verification_key(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory) +void init_verification_key(std::unique_ptr<proof_system::ReferenceStringFactory>&& crs_factory) { if (!proving_key) { std::abort(); @@ -58,10 +59,10 @@ void init_verification_key(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_f plonk::stdlib::types::Composer::compute_verification_key_base(proving_key, crs_factory->get_verifier_crs()); } -void init_verification_key(std::shared_ptr<bonk::VerifierMemReferenceString> const& crs, - bonk::verification_key_data&& vk_data) +void init_verification_key(std::shared_ptr<proof_system::VerifierMemReferenceString> const& crs, + plonk::verification_key_data&& vk_data) { - verification_key = std::make_shared<bonk::verification_key>(std::move(vk_data), crs); + verification_key = std::make_shared<plonk::verification_key>(std::move(vk_data), crs); } stdlib::types::Prover new_join_split_prover(join_split_tx const& tx, bool mock) @@ -104,12 +105,12 @@ bool verify_proof(plonk::proof const& proof) return verifier.verify_proof(proof); } -std::shared_ptr<bonk::proving_key> get_proving_key() +std::shared_ptr<plonk::proving_key> get_proving_key() { return proving_key; } -std::shared_ptr<bonk::verification_key> get_verification_key() +std::shared_ptr<plonk::verification_key> get_verification_key() { return verification_key; } diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp index e4fe781700..6c9b4ac5ab 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp @@ -7,27 +7,28 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk::stdlib::merkle_tree; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; -void init_proving_key(std::shared_ptr<bonk::ReferenceStringFactory> const& crs_factory, bool mock); +void init_proving_key(std::shared_ptr<proof_system::ReferenceStringFactory> const& crs_factory, bool mock); -void init_proving_key(std::shared_ptr<bonk::ProverReferenceString> const& crs, bonk::proving_key_data&& pk_data); +void init_proving_key(std::shared_ptr<proof_system::ProverReferenceString> const& crs, + plonk::proving_key_data&& pk_data); void release_key(); -void init_verification_key(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory); +void init_verification_key(std::unique_ptr<proof_system::ReferenceStringFactory>&& crs_factory); -void init_verification_key(std::shared_ptr<bonk::VerifierMemReferenceString> const& crs, - bonk::verification_key_data&& vk_data); +void init_verification_key(std::shared_ptr<proof_system::VerifierMemReferenceString> const& crs, + plonk::verification_key_data&& vk_data); stdlib::types::Prover new_join_split_prover(join_split_tx const& tx, bool mock); bool verify_proof(plonk::proof const& proof); -std::shared_ptr<bonk::proving_key> get_proving_key(); +std::shared_ptr<plonk::proving_key> get_proving_key(); -std::shared_ptr<bonk::verification_key> get_verification_key(); +std::shared_ptr<plonk::verification_key> get_verification_key(); } // namespace join_split } // namespace proofs diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp index e7564dc63a..46a45c6150 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp @@ -6,7 +6,7 @@ #include "barretenberg/common/streams.hpp" #include "barretenberg/common/test.hpp" #include <gtest/gtest.h> -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/merkle_tree/index.hpp" namespace join_split_example::proofs::join_split { @@ -122,8 +122,8 @@ constexpr bool CIRCUIT_CHANGE_EXPECTED = false; #endif using namespace barretenberg; -using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; using namespace join_split_example::proofs::notes::native; using key_pair = join_split_example::fixtures::grumpkin_key_pair; @@ -139,9 +139,9 @@ class join_split_tests : public ::testing::Test { static constexpr size_t ACCOUNT_INDEX = 14; static void SetUpTestCase() { - auto null_crs_factory = std::make_shared<bonk::ReferenceStringFactory>(); + auto null_crs_factory = std::make_shared<proof_system::ReferenceStringFactory>(); init_proving_key(null_crs_factory, false); - auto crs_factory = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto crs_factory = std::make_unique<proof_system::FileReferenceStringFactory>("../srs_db/ignition"); init_verification_key(std::move(crs_factory)); info("vk hash: ", get_verification_key()->sha256_hash()); } diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp index 0bc3b796b1..a0061cde88 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp @@ -11,9 +11,9 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk; +using namespace proof_system::plonk; using namespace notes::circuit; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; /** * Check that the input note data, follows the given hash paths, to the publically given merkle root. diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp index 5e28d1e161..b8821989b4 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp @@ -9,7 +9,7 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct join_split_inputs { field_ct proof_id; diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp index e470b98f88..0294983f7c 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp @@ -4,7 +4,7 @@ #include "../notes/native/index.hpp" #include "barretenberg/common/streams.hpp" #include "barretenberg/common/test.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/merkle_tree/index.hpp" #include "barretenberg/crypto/sha256/sha256.hpp" @@ -13,8 +13,8 @@ namespace proofs { namespace join_split { using namespace barretenberg; -// using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +// using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; using namespace join_split_example::proofs::notes::native; using key_pair = join_split_example::fixtures::grumpkin_key_pair; @@ -25,9 +25,9 @@ class join_split_js_parity_tests : public ::testing::Test { protected: static void SetUpTestCase() { - auto null_crs_factory = std::make_shared<bonk::ReferenceStringFactory>(); + auto null_crs_factory = std::make_shared<proof_system::ReferenceStringFactory>(); init_proving_key(null_crs_factory, false); - auto crs_factory = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto crs_factory = std::make_unique<proof_system::FileReferenceStringFactory>("../srs_db/ignition"); init_verification_key(std::move(crs_factory)); info("vk hash: ", get_verification_key()->sha256_hash()); } diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp index 38c9cc4624..4dae8f30e3 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp @@ -9,7 +9,7 @@ namespace join_split_example { namespace proofs { namespace join_split { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct join_split_tx { uint32_t proof_id; diff --git a/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp b/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp index 6f61e4e936..f629a32f18 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp @@ -7,7 +7,7 @@ namespace join_split_example { namespace proofs { namespace mock { -using namespace plonk::stdlib; +using namespace proof_system::plonk::stdlib; template <typename Composer> void mock_circuit(Composer& composer, std::vector<fr> const& public_inputs_) { diff --git a/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp b/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp index dc4683353a..16004e9787 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/common/test.hpp" #include "barretenberg/stdlib/types/types.hpp" -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace rollup { namespace proofs { diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp index 7252072da9..334b2edfc3 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/account_note.hpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { namespace account { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct account_note { field_ct account_alias_hash; diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp index b1e6f3eadb..ca668b94f6 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/account/commit.hpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { namespace account { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto commit(field_ct const& account_alias_hash, point_ct const& account_public_key, diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp index b2c5d86c18..5163231bc5 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.cpp @@ -3,7 +3,7 @@ namespace join_split_example::proofs::notes::circuit { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; std::pair<bool_ct, suint_ct> deflag_asset_id(suint_ct const& asset_id) { diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp index 8a4b5a5520..3c67f16695 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/asset_id.hpp @@ -3,7 +3,7 @@ namespace join_split_example::proofs::notes::circuit { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; std::pair<bool_ct, suint_ct> deflag_asset_id(suint_ct const& asset_id); diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp index 40040322ee..f5b1bbd319 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp @@ -9,7 +9,7 @@ namespace proofs { namespace notes { namespace circuit { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; constexpr uint32_t input_asset_id_a_shift = DEFI_BRIDGE_ADDRESS_ID_LEN; constexpr uint32_t input_asset_id_b_shift = input_asset_id_a_shift + DEFI_BRIDGE_INPUT_A_ASSET_ID_LEN; diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp index f2f24a5a91..8021265a43 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp @@ -12,7 +12,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct partial_claim_note { suint_ct deposit_value; diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp index d92ded2135..c1ea735d12 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto complete_partial_commitment(field_ct const& partial_commitment, field_ct const& interaction_nonce, diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp index 27f7284ea5..05666cacc4 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline field_ct compute_nullifier(field_ct const& note_commitment) { diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp index b5c6180b5e..d903e5688d 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto create_partial_commitment(field_ct const& deposit_value, field_ct const& bridge_call_data, diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp index a5fd321a85..b49bddd3bb 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp @@ -11,7 +11,7 @@ namespace notes { namespace circuit { namespace claim { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; /** * Convert native claim note data into circuit witness data. diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp index cb1c475283..2ec86fc763 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto complete_partial_commitment(field_ct const& value_note_partial_commitment, suint_ct const& value, diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp index f501e2df2b..08f00dbf16 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp @@ -8,7 +8,7 @@ namespace notes { namespace circuit { using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; field_ct compute_nullifier(field_ct const& note_commitment, field_ct const& account_private_key, @@ -42,7 +42,7 @@ field_ct compute_nullifier(field_ct const& note_commitment, * eth address. */ auto blake_input = byte_array_ct(compressed_inputs); - auto blake_result = plonk::stdlib::blake2s(blake_input); + auto blake_result = proof_system::plonk::stdlib::blake2s(blake_input); return field_ct(blake_result); } diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp index 7b78685348..3271035abb 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp @@ -7,7 +7,7 @@ namespace notes { namespace circuit { using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; field_ct compute_nullifier(field_ct const& note_commitment, field_ct const& account_private_key, diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp index c6c7f83861..063ef93edd 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp @@ -7,7 +7,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace join_split_example::proofs::notes; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; TEST(compute_nullifier_circuit, native_consistency) { diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp index bedd3d0688..2cb12fa9d2 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; inline auto create_partial_commitment(field_ct const& secret, point_ct const& owner, diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp index 10ef82d110..a4f8cc04c8 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct value_note { point_ct owner; diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp index 3bdee7e2c4..e243b35fb8 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp @@ -5,7 +5,7 @@ #include <gtest/gtest.h> using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; using namespace join_split_example::proofs::notes; using namespace join_split_example::proofs::notes::circuit::value; diff --git a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp index 69e26fd9e2..ff0cbc0cc2 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp @@ -9,7 +9,7 @@ namespace notes { namespace circuit { namespace value { -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; struct witness_data { point_ct owner; diff --git a/cpp/src/barretenberg/join_split_example/proofs/verify.hpp b/cpp/src/barretenberg/join_split_example/proofs/verify.hpp index 140203f0c9..b37b511691 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/verify.hpp +++ b/cpp/src/barretenberg/join_split_example/proofs/verify.hpp @@ -20,13 +20,13 @@ template <typename Composer> struct verify_result { std::vector<uint8_t> proof_data; bool verified; - std::shared_ptr<bonk::verification_key> verification_key; + std::shared_ptr<plonk::verification_key> verification_key; size_t number_of_gates; }; template <typename Composer> inline bool pairing_check(plonk::stdlib::recursion::recursion_output<plonk::stdlib::bn254<Composer>> recursion_output, - std::shared_ptr<bonk::VerifierReferenceString> const& srs) + std::shared_ptr<VerifierReferenceString> const& srs) { g1::affine_element P[2]; P[0].x = barretenberg::fq(recursion_output.P0.x.get_value().lo); diff --git a/cpp/src/barretenberg/plonk/composer/composer_base.cpp b/cpp/src/barretenberg/plonk/composer/composer_base.cpp index 1dde96b0db..46e404a57e 100644 --- a/cpp/src/barretenberg/plonk/composer/composer_base.cpp +++ b/cpp/src/barretenberg/plonk/composer/composer_base.cpp @@ -1,8 +1,8 @@ #include "composer_base.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/utils/permutation.hpp" -namespace plonk { +namespace proof_system::plonk { /** * Join variable class b to variable class a. @@ -422,4 +422,4 @@ template void ComposerBase::compute_witness_base<4>(const size_t); // turbo and template void ComposerBase::compute_wire_copy_cycles<3>(); template void ComposerBase::compute_wire_copy_cycles<4>(); -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/composer_base.hpp b/cpp/src/barretenberg/plonk/composer/composer_base.hpp index 6f2c356510..6c93da04b1 100644 --- a/cpp/src/barretenberg/plonk/composer/composer_base.hpp +++ b/cpp/src/barretenberg/plonk/composer/composer_base.hpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/proof_system/types/prover_settings.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -namespace plonk { +namespace proof_system::plonk { static constexpr uint32_t DUMMY_TAG = 0; class ComposerBase { public: @@ -350,7 +350,7 @@ extern template void ComposerBase::compute_witness_base<3>(const size_t); // sta extern template void ComposerBase::compute_witness_base<4>(const size_t); // turbo and ultra extern template void ComposerBase::compute_sigma_permutations<4, true>(proving_key* key); -} // namespace plonk +} // namespace proof_system::plonk /** * Composer Example: Pythagorean triples. diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.cpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.cpp new file mode 100644 index 0000000000..4ab16d7434 --- /dev/null +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.cpp @@ -0,0 +1,77 @@ +/** + * @file composer_helper_lib.cpp + * @brief Contains implementations of some of the functions used both by Honk and Plonk-style composers (excluding + * permutation functions) + * + */ +#include "composer_helper_lib.hpp" +#include "barretenberg/honk/pcs/commitment_key.hpp" + +namespace proof_system::plonk { + +/** + * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into + * cache + * + * @param key Pointer to the proving key + * @param selector_properties Names of selectors + */ +void compute_monomial_and_coset_selector_forms(plonk::proving_key* circuit_proving_key, + std::vector<SelectorProperties> selector_properties) +{ + for (size_t i = 0; i < selector_properties.size(); i++) { + // Compute monomial form of selector polynomial + auto& selector_poly_lagrange = + circuit_proving_key->polynomial_store.get(selector_properties[i].name + "_lagrange"); + barretenberg::polynomial selector_poly(circuit_proving_key->circuit_size); + barretenberg::polynomial_arithmetic::ifft( + &selector_poly_lagrange[0], &selector_poly[0], circuit_proving_key->small_domain); + + // Compute coset FFT of selector polynomial + barretenberg::polynomial selector_poly_fft(selector_poly, circuit_proving_key->circuit_size * 4 + 4); + selector_poly_fft.coset_fft(circuit_proving_key->large_domain); + + // TODO(luke): For Standard/Turbo, the lagrange polynomials can be removed from the store at this point but this + // is not the case for Ultra. Implement? + circuit_proving_key->polynomial_store.put(selector_properties[i].name, std::move(selector_poly)); + circuit_proving_key->polynomial_store.put(selector_properties[i].name + "_fft", std::move(selector_poly_fft)); + } +} + +/** + * @brief Computes the verification key by computing the: + * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, + * (2) sets the polynomial manifest using the data from proving key. + */ +std::shared_ptr<plonk::verification_key> compute_verification_key_common( + std::shared_ptr<plonk::proving_key> const& proving_key, std::shared_ptr<VerifierReferenceString> const& vrs) +{ + auto circuit_verification_key = std::make_shared<plonk::verification_key>( + proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->composer_type); + // TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc + auto commitment_key = proof_system::honk::pcs::kzg::CommitmentKey(proving_key->circuit_size, "../srs_db/ignition"); + + for (size_t i = 0; i < proving_key->polynomial_manifest.size(); ++i) { + const auto& poly_info = proving_key->polynomial_manifest[i]; + + const std::string poly_label(poly_info.polynomial_label); + const std::string selector_commitment_label(poly_info.commitment_label); + + if (poly_info.source == PolynomialSource::SELECTOR || poly_info.source == PolynomialSource::PERMUTATION || + poly_info.source == PolynomialSource::OTHER) { + // Fetch the polynomial in its vector form. + + // Commit to the constraint selector polynomial and insert the commitment in the verification key. + + auto poly_commitment = commitment_key.commit(proving_key->polynomial_store.get(poly_label)); + circuit_verification_key->commitments.insert({ selector_commitment_label, poly_commitment }); + } + } + + // Set the polynomial manifest in verification key. + circuit_verification_key->polynomial_manifest = proof_system::plonk::PolynomialManifest(proving_key->composer_type); + + return circuit_verification_key; +} + +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp new file mode 100644 index 0000000000..927174cc0f --- /dev/null +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp @@ -0,0 +1,29 @@ +#pragma once +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" + +namespace proof_system::plonk { +struct SelectorProperties { + std::string name; + bool requires_lagrange_base_polynomial = false; // does the prover need the raw lagrange-base selector values? +}; + +/** + * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into + * cache + * + * @param key Pointer to the proving key + * @param selector_properties Names of selectors + */ +void compute_monomial_and_coset_selector_forms(plonk::proving_key* key, + std::vector<SelectorProperties> selector_properties); + +/** + * @brief Computes the verification key by computing the: + * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, + * (2) sets the polynomial manifest using the data from proving key. + */ +std::shared_ptr<plonk::verification_key> compute_verification_key_common( + std::shared_ptr<plonk::proving_key> const& proving_key, std::shared_ptr<VerifierReferenceString> const& vrs); + +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp index 6205c0d9b1..601de58dac 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.cpp @@ -5,12 +5,15 @@ #include "barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp" #include "barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp" #include "barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp" +#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" +#include "barretenberg/proof_system/composer/permutation_helper.hpp" #include <cstddef> #include <cstdint> #include <string> -namespace plonk { +namespace proof_system::plonk { /** * Compute witness polynomials (w_1, w_2, w_3, w_4). @@ -52,7 +55,7 @@ void StandardPlonkComposerHelper<CircuitConstructor>::compute_witness(const Circ * @return Pointer to the initialized proving key updated with selector polynomials. * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::proving_key> StandardPlonkComposerHelper<CircuitConstructor>::compute_proving_key( +std::shared_ptr<plonk::proving_key> StandardPlonkComposerHelper<CircuitConstructor>::compute_proving_key( const CircuitConstructor& circuit_constructor) { if (circuit_proving_key) { @@ -62,11 +65,8 @@ std::shared_ptr<bonk::proving_key> StandardPlonkComposerHelper<CircuitConstructo const size_t num_randomized_gates = NUM_RANDOMIZED_GATES; // Initialize circuit_proving_key // TODO(#229)(Kesha): replace composer types. - circuit_proving_key = initialize_proving_key(circuit_constructor, - crs_factory_.get(), - minimum_circuit_size, - num_randomized_gates, - plonk::ComposerType::STANDARD); + circuit_proving_key = proof_system::initialize_proving_key( + circuit_constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::STANDARD); // Compute lagrange selectors construct_lagrange_selector_forms(circuit_constructor, circuit_proving_key.get()); // Make all selectors nonzero @@ -75,8 +75,8 @@ std::shared_ptr<bonk::proving_key> StandardPlonkComposerHelper<CircuitConstructo compute_monomial_and_coset_selector_forms(circuit_proving_key.get(), standard_selector_properties()); // Compute sigma polynomials (we should update that late) - bonk::compute_standard_plonk_sigma_permutations<CircuitConstructor::program_width>(circuit_constructor, - circuit_proving_key.get()); + compute_standard_plonk_sigma_permutations<CircuitConstructor::program_width>(circuit_constructor, + circuit_proving_key.get()); circuit_proving_key->recursive_proof_public_input_indices = std::vector<uint32_t>(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); @@ -91,7 +91,7 @@ std::shared_ptr<bonk::proving_key> StandardPlonkComposerHelper<CircuitConstructo * @return Pointer to created circuit verification key. * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::verification_key> StandardPlonkComposerHelper<CircuitConstructor>::compute_verification_key( +std::shared_ptr<plonk::verification_key> StandardPlonkComposerHelper<CircuitConstructor>::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -101,7 +101,8 @@ std::shared_ptr<bonk::verification_key> StandardPlonkComposerHelper<CircuitConst compute_proving_key(circuit_constructor); } - circuit_verification_key = compute_verification_key_common(circuit_proving_key, crs_factory_->get_verifier_crs()); + circuit_verification_key = + plonk::compute_verification_key_common(circuit_proving_key, crs_factory_->get_verifier_crs()); circuit_verification_key->composer_type = circuit_proving_key->composer_type; circuit_verification_key->recursive_proof_public_input_indices = std::vector<uint32_t>(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); @@ -172,4 +173,4 @@ plonk::Prover StandardPlonkComposerHelper<CircuitConstructor>::create_prover( } template class StandardPlonkComposerHelper<StandardCircuitConstructor>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp index 976290b1bc..32085fcb57 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/standard_plonk_composer_helper.hpp @@ -1,49 +1,46 @@ #pragma once #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" #include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" #include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" -#include "barretenberg/proof_system/composer/permutation_helper.hpp" - +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" #include <utility> -namespace plonk { +namespace proof_system::plonk { // TODO(Kesha): change initializations to specify this parameter // Cody: What does this mean? template <typename CircuitConstructor> class StandardPlonkComposerHelper { public: static constexpr size_t NUM_RANDOMIZED_GATES = 2; // equal to the number of multilinear evaluations leaked static constexpr size_t program_width = CircuitConstructor::program_width; - std::shared_ptr<bonk::proving_key> circuit_proving_key; - std::shared_ptr<bonk::verification_key> circuit_verification_key; + std::shared_ptr<plonk::proving_key> circuit_proving_key; + std::shared_ptr<plonk::verification_key> circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr<bonk::ReferenceStringFactory> crs_factory_; + std::shared_ptr<ReferenceStringFactory> crs_factory_; std::vector<uint32_t> recursive_proof_public_input_indices; bool contains_recursive_proof = false; bool computed_witness = false; StandardPlonkComposerHelper() - : StandardPlonkComposerHelper( - std::shared_ptr<bonk::ReferenceStringFactory>(new bonk::FileReferenceStringFactory("../srs_db/ignition"))) + : StandardPlonkComposerHelper(std::shared_ptr<ReferenceStringFactory>( + new proof_system::FileReferenceStringFactory("../srs_db/ignition"))) {} - - StandardPlonkComposerHelper(std::shared_ptr<bonk::ReferenceStringFactory> crs_factory) + StandardPlonkComposerHelper(std::shared_ptr<ReferenceStringFactory> crs_factory) : crs_factory_(std::move(crs_factory)) {} - StandardPlonkComposerHelper(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory) + StandardPlonkComposerHelper(std::unique_ptr<ReferenceStringFactory>&& crs_factory) : crs_factory_(std::move(crs_factory)) {} - - StandardPlonkComposerHelper(std::shared_ptr<bonk::proving_key> p_key, std::shared_ptr<bonk::verification_key> v_key) + StandardPlonkComposerHelper(std::shared_ptr<plonk::proving_key> p_key, + std::shared_ptr<plonk::verification_key> v_key) : circuit_proving_key(std::move(p_key)) , circuit_verification_key(std::move(v_key)) {} @@ -54,7 +51,7 @@ template <typename CircuitConstructor> class StandardPlonkComposerHelper { StandardPlonkComposerHelper& operator=(const StandardPlonkComposerHelper& other) = delete; ~StandardPlonkComposerHelper() = default; - inline std::vector<bonk::SelectorProperties> standard_selector_properties() + inline std::vector<SelectorProperties> standard_selector_properties() { std::vector<SelectorProperties> result{ { "q_m", false }, { "q_c", false }, { "q_1", false }, { "q_2", false }, { "q_3", false }, @@ -75,8 +72,8 @@ template <typename CircuitConstructor> class StandardPlonkComposerHelper { recursive_proof_public_input_indices.push_back((uint32_t)(circuit_constructor.public_inputs.size() - 1)); } } - std::shared_ptr<bonk::proving_key> compute_proving_key(const CircuitConstructor& circuit_constructor); - std::shared_ptr<bonk::verification_key> compute_verification_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr<plonk::proving_key> compute_proving_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr<plonk::verification_key> compute_verification_key(const CircuitConstructor& circuit_constructor); plonk::Verifier create_verifier(const CircuitConstructor& circuit_constructor); plonk::Prover create_prover(const CircuitConstructor& circuit_constructor); @@ -174,4 +171,4 @@ template <typename CircuitConstructor> class StandardPlonkComposerHelper { } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp index 2a28ffd204..c24524a928 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.cpp @@ -11,9 +11,12 @@ #include "barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp" #include "barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp" #include "barretenberg/proof_system/composer/permutation_helper.hpp" +#include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" + using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { /** * Compute proving key @@ -27,7 +30,7 @@ namespace plonk { * @return Pointer to the initialized proving key updated with selector polynomials. * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::proving_key> TurboPlonkComposerHelper<CircuitConstructor>::compute_proving_key( +std::shared_ptr<plonk::proving_key> TurboPlonkComposerHelper<CircuitConstructor>::compute_proving_key( const CircuitConstructor& circuit_constructor) { if (circuit_proving_key) { @@ -37,11 +40,8 @@ std::shared_ptr<bonk::proving_key> TurboPlonkComposerHelper<CircuitConstructor>: const size_t num_randomized_gates = NUM_RANDOMIZED_GATES; // Initialize circuit_proving_key // TODO(#229)(Kesha): replace composer types. - circuit_proving_key = initialize_proving_key(circuit_constructor, - crs_factory_.get(), - minimum_circuit_size, - num_randomized_gates, - plonk::ComposerType::TURBO); + circuit_proving_key = initialize_proving_key( + circuit_constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::TURBO); construct_lagrange_selector_forms(circuit_constructor, circuit_proving_key.get()); @@ -50,8 +50,8 @@ std::shared_ptr<bonk::proving_key> TurboPlonkComposerHelper<CircuitConstructor>: compute_monomial_and_coset_selector_forms(circuit_proving_key.get(), turbo_selector_properties()); // Compute sigma polynomials (TODO(kesha): we should update that late) - bonk::compute_standard_plonk_sigma_permutations<CircuitConstructor::program_width>(circuit_constructor, - circuit_proving_key.get()); + compute_standard_plonk_sigma_permutations<CircuitConstructor::program_width>(circuit_constructor, + circuit_proving_key.get()); circuit_proving_key->recursive_proof_public_input_indices = std::vector<uint32_t>(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); circuit_proving_key->contains_recursive_proof = contains_recursive_proof; @@ -64,7 +64,7 @@ std::shared_ptr<bonk::proving_key> TurboPlonkComposerHelper<CircuitConstructor>: * @return Pointer to created circuit verification key. * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::verification_key> TurboPlonkComposerHelper<CircuitConstructor>::compute_verification_key( +std::shared_ptr<plonk::verification_key> TurboPlonkComposerHelper<CircuitConstructor>::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -74,7 +74,8 @@ std::shared_ptr<bonk::verification_key> TurboPlonkComposerHelper<CircuitConstruc compute_proving_key(circuit_constructor); } - circuit_verification_key = compute_verification_key_common(circuit_proving_key, crs_factory_->get_verifier_crs()); + circuit_verification_key = + plonk::compute_verification_key_common(circuit_proving_key, crs_factory_->get_verifier_crs()); circuit_verification_key->composer_type = circuit_proving_key->composer_type; circuit_verification_key->recursive_proof_public_input_indices = std::vector<uint32_t>(recursive_proof_public_input_indices.begin(), recursive_proof_public_input_indices.end()); @@ -177,4 +178,4 @@ plonk::TurboVerifier TurboPlonkComposerHelper<CircuitConstructor>::create_verifi } template class TurboPlonkComposerHelper<TurboCircuitConstructor>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp index 94920b2046..2f12901330 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/turbo_plonk_composer_helper.hpp @@ -1,12 +1,13 @@ #pragma once +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" #include "barretenberg/proof_system/composer/composer_helper_lib.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" -namespace plonk { +namespace proof_system::plonk { template <typename CircuitConstructor> class TurboPlonkComposerHelper { public: static constexpr size_t NUM_RANDOMIZED_GATES = 2; // equal to the number of multilinear evaluations leaked @@ -14,29 +15,29 @@ template <typename CircuitConstructor> class TurboPlonkComposerHelper { static constexpr ComposerType type = ComposerType::TURBO; static constexpr MerkleHashType merkle_hash_type = MerkleHashType::FIXED_BASE_PEDERSEN; static constexpr size_t UINT_LOG2_BASE = 2; - std::shared_ptr<bonk::proving_key> circuit_proving_key; - std::shared_ptr<bonk::verification_key> circuit_verification_key; + std::shared_ptr<plonk::proving_key> circuit_proving_key; + std::shared_ptr<plonk::verification_key> circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr<bonk::ReferenceStringFactory> crs_factory_; + std::shared_ptr<ReferenceStringFactory> crs_factory_; std::vector<uint32_t> recursive_proof_public_input_indices; bool contains_recursive_proof = false; bool computed_witness = false; TurboPlonkComposerHelper() - : TurboPlonkComposerHelper( - std::shared_ptr<bonk::ReferenceStringFactory>(new bonk::FileReferenceStringFactory("../srs_db/ignition"))) + : TurboPlonkComposerHelper(std::shared_ptr<ReferenceStringFactory>( + new proof_system::FileReferenceStringFactory("../srs_db/ignition"))) {} - TurboPlonkComposerHelper(std::shared_ptr<bonk::ReferenceStringFactory> crs_factory) + TurboPlonkComposerHelper(std::shared_ptr<ReferenceStringFactory> crs_factory) : crs_factory_(std::move(crs_factory)) {} - TurboPlonkComposerHelper(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory) + TurboPlonkComposerHelper(std::unique_ptr<ReferenceStringFactory>&& crs_factory) : crs_factory_(std::move(crs_factory)) {} - TurboPlonkComposerHelper(std::shared_ptr<bonk::proving_key> p_key, std::shared_ptr<bonk::verification_key> v_key) + TurboPlonkComposerHelper(std::shared_ptr<plonk::proving_key> p_key, std::shared_ptr<plonk::verification_key> v_key) : circuit_proving_key(std::move(p_key)) , circuit_verification_key(std::move(v_key)) {} @@ -50,7 +51,7 @@ template <typename CircuitConstructor> class TurboPlonkComposerHelper { TurboProver create_prover(const CircuitConstructor& circuit_constructor); TurboVerifier create_verifier(const CircuitConstructor& circuit_constructor); - inline std::vector<bonk::SelectorProperties> turbo_selector_properties() + inline std::vector<SelectorProperties> turbo_selector_properties() { const std::vector<SelectorProperties> result{ { "q_m", false }, { "q_c", false }, { "q_1", false }, { "q_2", false }, @@ -132,4 +133,4 @@ template <typename CircuitConstructor> class TurboPlonkComposerHelper { return output; } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp index 9049ed0e0b..26e7049443 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.cpp @@ -10,7 +10,7 @@ #include <cstdint> #include <string> -namespace plonk { +namespace proof_system::plonk { /** * @brief Computes `this.witness`, which is basiclly a set of polynomials mapped-to by strings. @@ -228,11 +228,8 @@ std::shared_ptr<proving_key> UltraPlonkComposerHelper<CircuitConstructor>::compu const size_t num_randomized_gates = NUM_RANDOMIZED_GATES; // Initialize circuit_proving_key // TODO(#229)(Kesha): replace composer types. - circuit_proving_key = initialize_proving_key(circuit_constructor, - crs_factory_.get(), - minimum_circuit_size, - num_randomized_gates, - plonk::ComposerType::PLOOKUP); + circuit_proving_key = initialize_proving_key( + circuit_constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::PLOOKUP); construct_lagrange_selector_forms(circuit_constructor, circuit_proving_key.get()); @@ -240,8 +237,8 @@ std::shared_ptr<proving_key> UltraPlonkComposerHelper<CircuitConstructor>::compu compute_monomial_and_coset_selector_forms(circuit_proving_key.get(), ultra_selector_properties()); - bonk::compute_plonk_generalized_sigma_permutations<CircuitConstructor::program_width>(circuit_constructor, - circuit_proving_key.get()); + compute_plonk_generalized_sigma_permutations<CircuitConstructor::program_width>(circuit_constructor, + circuit_proving_key.get()); const size_t subgroup_size = circuit_proving_key->circuit_size; @@ -350,7 +347,7 @@ std::shared_ptr<proving_key> UltraPlonkComposerHelper<CircuitConstructor>::compu * @return Pointer to created circuit verification key. * */ template <typename CircuitConstructor> -std::shared_ptr<bonk::verification_key> UltraPlonkComposerHelper<CircuitConstructor>::compute_verification_key( +std::shared_ptr<plonk::verification_key> UltraPlonkComposerHelper<CircuitConstructor>::compute_verification_key( const CircuitConstructor& circuit_constructor) { if (circuit_verification_key) { @@ -391,4 +388,4 @@ void UltraPlonkComposerHelper<CircuitConstructor>::add_table_column_selector_pol } template class UltraPlonkComposerHelper<UltraCircuitConstructor>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp index 45b218460d..c66ce7eea0 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp @@ -1,15 +1,16 @@ #pragma once #include "barretenberg/proof_system/composer/composer_helper_lib.hpp" +#include "barretenberg/plonk/composer/splitting_tmp/composer_helper/composer_helper_lib.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/prover/prover.hpp" #include "barretenberg/plonk/proof_system/verifier/verifier.hpp" #include <cstddef> #include <utility> -namespace plonk { +namespace proof_system::plonk { // TODO(Kesha): change initializations to specify this parameter // Cody: What does this mean? template <typename CircuitConstructor> class UltraPlonkComposerHelper { @@ -21,11 +22,11 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper { // simultaneously here and in the other split composers. static constexpr size_t NUM_RANDOMIZED_GATES = 4; // equal to the number of multilinear evaluations leaked static constexpr size_t program_width = CircuitConstructor::program_width; - std::shared_ptr<bonk::proving_key> circuit_proving_key; - std::shared_ptr<bonk::verification_key> circuit_verification_key; + std::shared_ptr<plonk::proving_key> circuit_proving_key; + std::shared_ptr<plonk::verification_key> circuit_verification_key; // TODO(#218)(kesha): we need to put this into the commitment key, so that the composer doesn't have to handle srs // at all - std::shared_ptr<bonk::ReferenceStringFactory> crs_factory_; + std::shared_ptr<ReferenceStringFactory> crs_factory_; std::vector<uint32_t> recursive_proof_public_input_indices; bool contains_recursive_proof = false; @@ -52,7 +53,7 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper { UltraPlonkComposerHelper& operator=(UltraPlonkComposerHelper const& other) noexcept = default; ~UltraPlonkComposerHelper() = default; - std::vector<bonk::SelectorProperties> ultra_selector_properties() + std::vector<SelectorProperties> ultra_selector_properties() { // When reading and writing the proving key from a buffer we must precompute the Lagrange form of certain // selector polynomials. In order to avoid a new selector type and definitions in the polynomial manifest, we @@ -63,7 +64,7 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper { // { "q_m", true }, { "q_c", true }, { "q_1", true }, { "q_2", true }, // { "q_3", true }, { "q_4", false }, { "q_arith", false }, { "q_sort", false }, // { "q_elliptic", false }, { "q_aux", false }, { "table_type", true }, - std::vector<bonk::SelectorProperties> result{ + std::vector<SelectorProperties> result{ { "q_m", true }, { "q_c", true }, { "q_1", true }, { "q_2", true }, { "q_3", true }, { "q_4", true }, { "q_arith", true }, { "q_sort", true }, { "q_elliptic", true }, { "q_aux", true }, { "table_type", true }, @@ -75,8 +76,8 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper { void finalize_circuit(CircuitConstructor& circuit_constructor) { circuit_constructor.finalize_circuit(); }; - std::shared_ptr<bonk::proving_key> compute_proving_key(const CircuitConstructor& circuit_constructor); - std::shared_ptr<bonk::verification_key> compute_verification_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr<plonk::proving_key> compute_proving_key(const CircuitConstructor& circuit_constructor); + std::shared_ptr<plonk::verification_key> compute_verification_key(const CircuitConstructor& circuit_constructor); void compute_witness(CircuitConstructor& circuit_constructor); @@ -208,4 +209,4 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper { } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp index 083ac264dc..34e51f92de 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp @@ -6,7 +6,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" -namespace plonk { +namespace proof_system::plonk { /** * @brief Standard Plonk Composer has everything required to construct a prover and verifier, just as the legacy * classes. @@ -16,7 +16,7 @@ namespace plonk { */ class StandardPlonkComposer { public: - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD; + static constexpr ComposerType type = ComposerType::STANDARD; static constexpr size_t UINT_LOG2_BASE = 2; // An instantiation of the circuit constructor that only depends on arithmetization, not on the proof system @@ -40,17 +40,17 @@ class StandardPlonkComposer { StandardPlonkComposer(std::string const& crs_path, const size_t size_hint = 0) : StandardPlonkComposer( - std::unique_ptr<bonk::ReferenceStringFactory>(new bonk::FileReferenceStringFactory(crs_path)), + std::unique_ptr<ReferenceStringFactory>(new proof_system::FileReferenceStringFactory(crs_path)), size_hint){}; - StandardPlonkComposer(std::shared_ptr<bonk::ReferenceStringFactory> const& crs_factory, const size_t size_hint = 0) + StandardPlonkComposer(std::shared_ptr<ReferenceStringFactory> const& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(crs_factory) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables) {} - StandardPlonkComposer(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory, const size_t size_hint = 0) + StandardPlonkComposer(std::unique_ptr<ReferenceStringFactory>&& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(std::move(crs_factory)) , num_gates(circuit_constructor.num_gates) @@ -58,8 +58,8 @@ class StandardPlonkComposer { {} - StandardPlonkComposer(std::shared_ptr<bonk::proving_key> const& p_key, - std::shared_ptr<bonk::verification_key> const& v_key, + StandardPlonkComposer(std::shared_ptr<plonk::proving_key> const& p_key, + std::shared_ptr<plonk::verification_key> const& v_key, size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(p_key, v_key) @@ -162,12 +162,12 @@ class StandardPlonkComposer { /**Proof and verification-related methods*/ - std::shared_ptr<bonk::proving_key> compute_proving_key() + std::shared_ptr<plonk::proving_key> compute_proving_key() { return composer_helper.compute_proving_key(circuit_constructor); } - std::shared_ptr<bonk::verification_key> compute_verification_key() + std::shared_ptr<plonk::verification_key> compute_verification_key() { return composer_helper.compute_verification_key(circuit_constructor); } @@ -200,4 +200,4 @@ class StandardPlonkComposer { const std::string& err() const { return circuit_constructor.err(); }; void failure(std::string msg) { circuit_constructor.failure(msg); } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp index d371578b52..0ff53d40b0 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.test.cpp @@ -2,10 +2,10 @@ #include <gtest/gtest.h> #include "barretenberg/crypto/pedersen/pedersen.hpp" #include "barretenberg/crypto/pedersen/generator_data.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -33,13 +33,13 @@ TEST(standard_plonk_composer_splitting_tmp, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer<bonk::proving_key_data>(pk_buf); - auto vk_data = from_buffer<bonk::verification_key_data>(vk_buf); + auto pk_data = from_buffer<plonk::proving_key_data>(pk_buf); + auto vk_data = from_buffer<plonk::verification_key_data>(vk_buf); - auto crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto crs = std::make_unique<FileReferenceStringFactory>("../srs_db/ignition"); auto proving_key = - std::make_shared<bonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared<bonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared<plonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared<plonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); plonk::StandardPlonkComposer composer2 = plonk::StandardPlonkComposer(proving_key, verification_key); composer2.add_public_variable(a); diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp index 985e5529e2..6019662bb5 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.hpp @@ -1,8 +1,8 @@ #pragma once #include "composer_helper/turbo_plonk_composer_helper.hpp" #include "barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp" -using namespace bonk; -namespace plonk { + +namespace proof_system::plonk { /** * @brief Standard Plonk Composer has everything required to construct a prover and verifier, just as the legacy * classes. @@ -12,7 +12,7 @@ namespace plonk { */ class TurboPlonkComposer { public: - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD; + static constexpr ComposerType type = ComposerType::STANDARD; static constexpr size_t UINT_LOG2_BASE = 2; @@ -39,23 +39,23 @@ class TurboPlonkComposer { TurboPlonkComposer(std::string const& crs_path, const size_t size_hint = 0) : TurboPlonkComposer( - std::unique_ptr<bonk::ReferenceStringFactory>(new bonk::FileReferenceStringFactory(crs_path)), + std::unique_ptr<ReferenceStringFactory>(new proof_system::FileReferenceStringFactory(crs_path)), size_hint){}; - TurboPlonkComposer(std::shared_ptr<bonk::ReferenceStringFactory> const& crs_factory, const size_t size_hint = 0) + TurboPlonkComposer(std::shared_ptr<ReferenceStringFactory> const& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(crs_factory) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables){}; - TurboPlonkComposer(std::unique_ptr<bonk::ReferenceStringFactory>&& crs_factory, const size_t size_hint = 0) + TurboPlonkComposer(std::unique_ptr<ReferenceStringFactory>&& crs_factory, const size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(std::move(crs_factory)) , num_gates(circuit_constructor.num_gates) , variables(circuit_constructor.variables){}; - TurboPlonkComposer(std::shared_ptr<bonk::proving_key> const& p_key, - std::shared_ptr<bonk::verification_key> const& v_key, + TurboPlonkComposer(std::shared_ptr<plonk::proving_key> const& p_key, + std::shared_ptr<plonk::verification_key> const& v_key, size_t size_hint = 0) : circuit_constructor(size_hint) , composer_helper(p_key, v_key) @@ -169,12 +169,12 @@ class TurboPlonkComposer { barretenberg::fr get_variable(const uint32_t index) const { return circuit_constructor.get_variable(index); } /**Proof and verification-related methods*/ - std::shared_ptr<bonk::proving_key> compute_proving_key() + std::shared_ptr<plonk::proving_key> compute_proving_key() { return composer_helper.compute_proving_key(circuit_constructor); } - std::shared_ptr<bonk::verification_key> compute_verification_key() + std::shared_ptr<plonk::verification_key> compute_verification_key() { return composer_helper.compute_verification_key(circuit_constructor); } @@ -205,4 +205,4 @@ class TurboPlonkComposer { const std::string& err() const { return circuit_constructor.err(); }; void failure(std::string msg) { circuit_constructor.failure(msg); } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp index 24ac9a02be..007afa3e19 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/turbo_plonk_composer.test.cpp @@ -1,15 +1,17 @@ #include "turbo_plonk_composer.hpp" #include "barretenberg/crypto/pedersen/pedersen.hpp" #include <gtest/gtest.h> -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; using namespace crypto::pedersen; +namespace proof_system::plonk::test_turbo_plonk_composer { namespace { auto& engine = numeric::random::get_debug_engine(); } + TEST(turbo_plonk_composer_splitting_tmp, base_case) { TurboPlonkComposer composer = TurboPlonkComposer(); @@ -33,13 +35,13 @@ TEST(turbo_plonk_composer_splitting_tmp, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer<bonk::proving_key_data>(pk_buf); - auto vk_data = from_buffer<bonk::verification_key_data>(vk_buf); + auto pk_data = from_buffer<plonk::proving_key_data>(pk_buf); + auto vk_data = from_buffer<plonk::verification_key_data>(vk_buf); - auto crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto crs = std::make_unique<proof_system::FileReferenceStringFactory>("../srs_db/ignition"); auto proving_key = - std::make_shared<bonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared<bonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared<plonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared<plonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); TurboPlonkComposer composer2 = TurboPlonkComposer(proving_key, verification_key); composer2.add_public_variable(a); @@ -1151,3 +1153,4 @@ TEST(turbo_plonk_composer_splitting_tmp, test_check_circuit_xor) EXPECT_EQ(result, true); } +} // namespace proof_system::plonk::test_turbo_plonk_composer \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp index 4c448818ad..d66c99aa1d 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.hpp @@ -6,9 +6,7 @@ #include "barretenberg/plonk/composer/splitting_tmp/composer_helper/ultra_plonk_composer_helper.hpp" #include <optional> -using namespace bonk; - -namespace plonk { +namespace proof_system::plonk { class UltraPlonkComposer { @@ -364,7 +362,7 @@ class UltraPlonkComposer { // std::array<uint32_t, 2> decompose_non_native_field_double_width_limb( // const uint32_t limb_idx, const size_t num_limb_bits = (2 * DEFAULT_NON_NATIVE_FIELD_LIMB_BITS)); std::array<uint32_t, 2> evaluate_non_native_field_multiplication( - const bonk::non_native_field_witnesses& input, const bool range_constrain_quotient_and_remainder = true) + const non_native_field_witnesses& input, const bool range_constrain_quotient_and_remainder = true) { return circuit_constructor.evaluate_non_native_field_multiplication(input, range_constrain_quotient_and_remainder); @@ -473,4 +471,4 @@ class UltraPlonkComposer { // std::vector<uint32_t> recursive_proof_public_input_indices; // bool contains_recursive_proof = false; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp b/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp index 416cee213e..d5c2128e05 100644 --- a/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp +++ b/cpp/src/barretenberg/plonk/composer/splitting_tmp/ultra_plonk_composer.test.cpp @@ -9,9 +9,8 @@ #include "barretenberg/numeric/uintx/uintx.hpp" using namespace barretenberg; -using namespace bonk; -namespace plonk { +namespace proof_system::plonk { namespace { auto& engine = numeric::random::get_debug_engine(); @@ -780,7 +779,7 @@ TEST(ultra_plonk_composer_splitting_tmp, non_native_field_multiplication) const auto q_indices = get_limb_witness_indices(split_into_limbs(uint256_t(q))); const auto r_indices = get_limb_witness_indices(split_into_limbs(uint256_t(r))); - bonk::non_native_field_witnesses inputs{ + non_native_field_witnesses inputs{ a_indices, b_indices, q_indices, r_indices, modulus_limbs, fr(uint256_t(modulus)), }; const auto [lo_1_idx, hi_1_idx] = composer.evaluate_non_native_field_multiplication(inputs); @@ -914,4 +913,4 @@ TEST(ultra_plonk_composer_splitting_tmp, ram) EXPECT_EQ(result, true); } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/standard_composer.cpp b/cpp/src/barretenberg/plonk/composer/standard_composer.cpp index dfa084e79f..1158590acf 100644 --- a/cpp/src/barretenberg/plonk/composer/standard_composer.cpp +++ b/cpp/src/barretenberg/plonk/composer/standard_composer.cpp @@ -9,9 +9,9 @@ #include <unordered_map> using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { #define STANDARD_SELECTOR_REFS \ auto& q_m = selectors[StandardSelectors::QM]; \ auto& q_c = selectors[StandardSelectors::QC]; \ @@ -616,4 +616,4 @@ bool StandardComposer::check_circuit() } return true; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/standard_composer.hpp b/cpp/src/barretenberg/plonk/composer/standard_composer.hpp index 0a7015767f..f8ec645533 100644 --- a/cpp/src/barretenberg/plonk/composer/standard_composer.hpp +++ b/cpp/src/barretenberg/plonk/composer/standard_composer.hpp @@ -3,8 +3,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/srs/reference_string/file_reference_string.hpp" -using namespace bonk; -namespace plonk { +namespace proof_system::plonk { enum StandardSelectors { QM, QC, Q1, Q2, Q3, NUM }; inline std::vector<ComposerBase::SelectorProperties> standard_selector_properties() @@ -230,4 +229,4 @@ class StandardComposer : public ComposerBase { bool check_circuit(); }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp b/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp index 632b40da09..c4413ce080 100644 --- a/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp +++ b/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp @@ -2,15 +2,15 @@ #include <gtest/gtest.h> #include "barretenberg/crypto/pedersen/pedersen.hpp" #include "barretenberg/crypto/pedersen/generator_data.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; namespace { auto& engine = numeric::random::get_debug_engine(); } -namespace plonk { +namespace proof_system::plonk { TEST(standard_composer, base_case) { StandardComposer composer = StandardComposer(); @@ -34,13 +34,13 @@ TEST(standard_composer, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer<bonk::proving_key_data>(pk_buf); - auto vk_data = from_buffer<bonk::verification_key_data>(vk_buf); + auto pk_data = from_buffer<plonk::proving_key_data>(pk_buf); + auto vk_data = from_buffer<plonk::verification_key_data>(vk_buf); - auto crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto crs = std::make_unique<FileReferenceStringFactory>("../srs_db/ignition"); auto proving_key = - std::make_shared<bonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared<bonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared<plonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared<plonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); StandardComposer composer2 = StandardComposer(proving_key, verification_key); composer2.add_public_variable(a); @@ -540,4 +540,4 @@ TEST(standard_composer, test_check_circuit_broken) bool result = composer.check_circuit(); EXPECT_EQ(result, false); } -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp b/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp index cf599e26b6..f3339cf147 100644 --- a/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp +++ b/cpp/src/barretenberg/plonk/composer/turbo_composer.cpp @@ -12,9 +12,9 @@ #include "barretenberg/srs/reference_string/file_reference_string.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { #define TURBO_SELECTOR_REFS \ auto& q_m = selectors[TurboSelectors::QM]; \ @@ -1039,4 +1039,4 @@ TurboVerifier TurboComposer::create_verifier() return output_state; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp b/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp index ab71116a85..5f4ffda9af 100644 --- a/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp +++ b/cpp/src/barretenberg/plonk/composer/turbo_composer.hpp @@ -1,9 +1,7 @@ #pragma once #include "composer_base.hpp" -using namespace bonk; - -namespace plonk { +namespace proof_system::plonk { class TurboComposer : public ComposerBase { public: static constexpr ComposerType type = ComposerType::TURBO; @@ -229,8 +227,8 @@ class CheckGetter { } }; -using TurboArithmeticChecker = plonk::widget::TurboArithmeticKernel<barretenberg::fr, CheckGetter, TurboComposer>; -using TurboRangeChecker = plonk::widget::TurboRangeKernel<barretenberg::fr, CheckGetter, TurboComposer>; -using TurboLogicChecker = plonk::widget::TurboLogicKernel<barretenberg::fr, CheckGetter, TurboComposer>; -using TurboFixedBaseChecker = plonk::widget::TurboFixedBaseKernel<barretenberg::fr, CheckGetter, TurboComposer>; -} // namespace plonk +using TurboArithmeticChecker = widget::TurboArithmeticKernel<barretenberg::fr, CheckGetter, TurboComposer>; +using TurboRangeChecker = widget::TurboRangeKernel<barretenberg::fr, CheckGetter, TurboComposer>; +using TurboLogicChecker = widget::TurboLogicKernel<barretenberg::fr, CheckGetter, TurboComposer>; +using TurboFixedBaseChecker = widget::TurboFixedBaseKernel<barretenberg::fr, CheckGetter, TurboComposer>; +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp b/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp index 2cbefaa1ae..14b448db48 100644 --- a/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp +++ b/cpp/src/barretenberg/plonk/composer/turbo_composer.test.cpp @@ -1,16 +1,16 @@ #include "turbo_composer.hpp" #include "barretenberg/crypto/pedersen/pedersen.hpp" #include <gtest/gtest.h> -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; using namespace crypto::pedersen; namespace { auto& engine = numeric::random::get_debug_engine(); } -namespace plonk { +namespace proof_system::plonk { TEST(turbo_composer, base_case) { TurboComposer composer = TurboComposer(); @@ -34,13 +34,13 @@ TEST(turbo_composer, composer_from_serialized_keys) auto pk_buf = to_buffer(*composer.compute_proving_key()); auto vk_buf = to_buffer(*composer.compute_verification_key()); - auto pk_data = from_buffer<bonk::proving_key_data>(pk_buf); - auto vk_data = from_buffer<bonk::verification_key_data>(vk_buf); + auto pk_data = from_buffer<plonk::proving_key_data>(pk_buf); + auto vk_data = from_buffer<plonk::verification_key_data>(vk_buf); - auto crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto crs = std::make_unique<proof_system::FileReferenceStringFactory>("../srs_db/ignition"); auto proving_key = - std::make_shared<bonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); - auto verification_key = std::make_shared<bonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); + std::make_shared<plonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + auto verification_key = std::make_shared<plonk::verification_key>(std::move(vk_data), crs->get_verifier_crs()); TurboComposer composer2 = TurboComposer(proving_key, verification_key); composer2.add_public_variable(a); @@ -1152,4 +1152,4 @@ TEST(turbo_composer, test_check_circuit_xor) EXPECT_EQ(result, true); } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp b/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp index 0cb677d6b2..597b2ddea0 100644 --- a/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp +++ b/cpp/src/barretenberg/plonk/composer/ultra_composer.cpp @@ -29,7 +29,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { #define ULTRA_SELECTOR_REFS \ auto& q_m = selectors[UltraSelectors::QM]; \ @@ -2828,4 +2828,4 @@ void UltraComposer::process_RAM_arrays(const size_t gate_offset_from_public_inpu process_RAM_array(i, gate_offset_from_public_inputs); } } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp b/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp index 769ec09a34..7fa42ed939 100644 --- a/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp +++ b/cpp/src/barretenberg/plonk/composer/ultra_composer.hpp @@ -3,9 +3,7 @@ #include "plookup_tables/plookup_tables.hpp" #include <optional> -using namespace bonk; - -namespace plonk { +namespace proof_system::plonk { class UltraComposer : public ComposerBase { @@ -690,4 +688,4 @@ class UltraComposer : public ComposerBase { return create_manifest(num_public_inputs); } }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp b/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp index 51e0838b5f..5b0f6b6ce8 100644 --- a/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp +++ b/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp @@ -8,9 +8,9 @@ #include "./plookup_tables/sha256.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace { auto& engine = numeric::random::get_debug_engine(); @@ -856,4 +856,4 @@ TEST(ultra_composer, ram) EXPECT_EQ(result, true); } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp index 0e3712b3ba..8dc934984f 100644 --- a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp @@ -7,7 +7,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { class CommitmentScheme { public: @@ -35,16 +35,16 @@ class CommitmentScheme { virtual void batch_open(const transcript::StandardTranscript& transcript, work_queue& queue, - std::shared_ptr<bonk::proving_key> input_key = nullptr) = 0; + std::shared_ptr<plonk::proving_key> input_key = nullptr) = 0; virtual void batch_verify(const transcript::StandardTranscript& transcript, std::map<std::string, g1::affine_element>& kate_g1_elements, std::map<std::string, fr>& kate_fr_elements, - std::shared_ptr<bonk::verification_key> input_key = nullptr) = 0; + std::shared_ptr<plonk::verification_key> input_key = nullptr) = 0; virtual void add_opening_evaluations_to_transcript(transcript::StandardTranscript& trancript, - std::shared_ptr<bonk::proving_key> input_key = nullptr, + std::shared_ptr<plonk::proving_key> input_key = nullptr, bool in_lagrange_form = false) = 0; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp index 200e44a281..933de8cd5d 100644 --- a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.test.cpp @@ -15,7 +15,7 @@ #include "barretenberg/ecc/curves/bn254/pairing.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; TEST(commitment_scheme, kate_open) { @@ -36,9 +36,9 @@ TEST(commitment_scheme, kate_open) plonk::KateCommitmentScheme<turbo_settings> newKate; // std::shared_ptr<ReferenceStringFactory> crs_factory = (new FileReferenceStringFactory("../srs_db/ignition")); - auto file_crs = std::make_shared<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto file_crs = std::make_shared<FileReferenceStringFactory>("../srs_db/ignition"); auto crs = file_crs->get_prover_crs(n); - auto circuit_proving_key = std::make_shared<proving_key>(n, 0, crs, plonk::STANDARD); + auto circuit_proving_key = std::make_shared<proving_key>(n, 0, crs, ComposerType::STANDARD); work_queue queue(circuit_proving_key.get(), &inp_tx); newKate.commit(&coeffs[0], "F_COMM", 0, queue); @@ -93,9 +93,9 @@ TEST(commitment_scheme, kate_batch_open) transcript::StandardTranscript inp_tx = transcript::StandardTranscript(transcript::Manifest()); plonk::KateCommitmentScheme<turbo_settings> newKate; - auto file_crs = std::make_shared<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto file_crs = std::make_shared<FileReferenceStringFactory>("../srs_db/ignition"); auto crs = file_crs->get_prover_crs(n); - auto circuit_proving_key = std::make_shared<proving_key>(n, 0, crs, plonk::STANDARD); + auto circuit_proving_key = std::make_shared<proving_key>(n, 0, crs, ComposerType::STANDARD); work_queue queue(circuit_proving_key.get(), &inp_tx); // commit to individual polynomials diff --git a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp index 5465b68ac4..1992b97435 100644 --- a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.cpp @@ -2,7 +2,7 @@ #include "kate_commitment_scheme.hpp" #include "../../../polynomials/polynomial_arithmetic.hpp" -namespace plonk { +namespace proof_system::plonk { // Constructors for KateCommitmentScheme template <typename settings> @@ -133,7 +133,7 @@ void KateCommitmentScheme<settings>::generic_batch_open(const fr* src, template <typename settings> void KateCommitmentScheme<settings>::batch_open(const transcript::StandardTranscript& transcript, work_queue& queue, - std::shared_ptr<bonk::proving_key> input_key) + std::shared_ptr<plonk::proving_key> input_key) { /* Compute batch opening polynomials according to the Kate commitment scheme. @@ -233,7 +233,7 @@ template <typename settings> void KateCommitmentScheme<settings>::batch_verify(const transcript::StandardTranscript& transcript, std::map<std::string, g1::affine_element>& kate_g1_elements, std::map<std::string, fr>& kate_fr_elements, - std::shared_ptr<bonk::verification_key> input_key) + std::shared_ptr<plonk::verification_key> input_key) { // Compute batch evaluation commitment [F]_1 // In this method, we accumulate scalars and corresponding group elements for the multi-scalar @@ -345,9 +345,8 @@ void KateCommitmentScheme<settings>::batch_verify(const transcript::StandardTran } template <typename settings> -void KateCommitmentScheme<settings>::add_opening_evaluations_to_transcript(transcript::StandardTranscript& transcript, - std::shared_ptr<bonk::proving_key> input_key, - bool in_lagrange_form) +void KateCommitmentScheme<settings>::add_opening_evaluations_to_transcript( + transcript::StandardTranscript& transcript, std::shared_ptr<plonk::proving_key> input_key, bool in_lagrange_form) { // In this function, we compute the evaluations of all polynomials in the polynomial manifest at the // evaluation challenge "zeta", as well as the needed evaluations at shifts. @@ -391,4 +390,4 @@ template class KateCommitmentScheme<standard_settings>; template class KateCommitmentScheme<turbo_settings>; template class KateCommitmentScheme<ultra_settings>; template class KateCommitmentScheme<ultra_to_standard_settings>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp index 48f49a6055..653340dbdf 100644 --- a/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/commitment_scheme/kate_commitment_scheme.hpp @@ -1,7 +1,7 @@ #pragma once #include "commitment_scheme.hpp" -namespace plonk { +namespace proof_system::plonk { template <typename settings> class KateCommitmentScheme : public CommitmentScheme { public: @@ -24,15 +24,15 @@ template <typename settings> class KateCommitmentScheme : public CommitmentSchem void batch_open(const transcript::StandardTranscript& transcript, work_queue& queue, - std::shared_ptr<bonk::proving_key> input_key = nullptr) override; + std::shared_ptr<plonk::proving_key> input_key = nullptr) override; void batch_verify(const transcript::StandardTranscript& transcript, std::map<std::string, g1::affine_element>& kate_g1_elements, std::map<std::string, fr>& kate_fr_elements, - std::shared_ptr<bonk::verification_key> input_key = nullptr) override; + std::shared_ptr<plonk::verification_key> input_key = nullptr) override; void add_opening_evaluations_to_transcript(transcript::StandardTranscript& transcript, - std::shared_ptr<bonk::proving_key> input_key = nullptr, + std::shared_ptr<plonk::proving_key> input_key = nullptr, bool in_lagrange_form = false) override; private: @@ -44,4 +44,4 @@ extern template class KateCommitmentScheme<turbo_settings>; extern template class KateCommitmentScheme<ultra_settings>; extern template class KateCommitmentScheme<ultra_to_standard_settings>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/constants.hpp b/cpp/src/barretenberg/plonk/proof_system/constants.hpp index f919f636cf..debf064c8f 100644 --- a/cpp/src/barretenberg/plonk/proof_system/constants.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/constants.hpp @@ -1,14 +1,7 @@ #pragma once #include <cstdint> - -namespace plonk { - -enum ComposerType { - STANDARD, - TURBO, - PLOOKUP, - STANDARD_HONK, // Todo(Arijit): We should replace STANDARD_HONK outside plonk or the namespace should be bonk -}; +#include "barretenberg/proof_system/types/composer_type.hpp" +namespace proof_system::plonk { // This variable sets the composer (TURBO or ULTRA) of the entire stdlib and rollup modules. // To switch to using a new composer, only changing this variable should activate the new composer @@ -29,4 +22,4 @@ enum MerkleHashType { static constexpr uint64_t NUM_LIMB_BITS_IN_FIELD_SIMULATION = 68; static constexpr uint32_t NUM_QUOTIENT_PARTS = 4; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp b/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp index 633c4562c1..6cd4d4c7af 100644 --- a/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/prover/c_bind.cpp @@ -1,6 +1,7 @@ #include "prover.hpp" #include "barretenberg/env/data_store.hpp" #include "barretenberg/env/crs.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" #define WASM_EXPORT __attribute__((visibility("default"))) @@ -31,7 +32,7 @@ WASM_EXPORT void* test_async_func(size_t size, int val) } } /** - * @brief Simple wrapper for env_load_verifier_crs. + * @brief Simple wrapper for env_load_verifier_crs. * @return The CRS. */ WASM_EXPORT void* test_env_load_verifier_crs() @@ -39,7 +40,7 @@ WASM_EXPORT void* test_env_load_verifier_crs() return env_load_verifier_crs(); } /** - * @brief Simple wrapper for env_load_verifier_crs. + * @brief Simple wrapper for env_load_verifier_crs. * @param The number of points to load of the prover CRS. * @return The CRS. */ @@ -47,7 +48,8 @@ WASM_EXPORT void* test_env_load_prover_crs(size_t num_points) { return env_load_prover_crs(num_points); } -typedef std::conditional_t<plonk::SYSTEM_COMPOSER == plonk::TURBO, plonk::TurboProver, plonk::UltraProver> WasmProver; +typedef std::conditional_t<plonk::SYSTEM_COMPOSER == ComposerType::TURBO, plonk::TurboProver, plonk::UltraProver> + WasmProver; WASM_EXPORT void prover_process_queue(WasmProver* prover) { diff --git a/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp b/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp index 2a7fe494ab..66cfdc7496 100644 --- a/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/prover/c_bind_unrolled.cpp @@ -1,4 +1,5 @@ #include "prover.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" #define WASM_EXPORT __attribute__((visibility("default"))) @@ -7,7 +8,7 @@ using namespace barretenberg; extern "C" { // TODO(Cody): Removed "unrolled" here when the time comes, if it does. -typedef std::conditional_t<plonk::SYSTEM_COMPOSER == plonk::TURBO, plonk::TurboProver, plonk::UltraProver> +typedef std::conditional_t<plonk::SYSTEM_COMPOSER == ComposerType::TURBO, plonk::TurboProver, plonk::UltraProver> WasmUnrolledProver; WASM_EXPORT void unrolled_prover_process_queue(WasmUnrolledProver* prover) diff --git a/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp b/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp index 12c5a3b1ea..3c3647e7f0 100644 --- a/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/prover/prover.cpp @@ -8,7 +8,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { /** * Create ProverBase from proving key, witness and manifest. @@ -468,7 +468,7 @@ template <typename settings> void ProverBase<settings>::execute_fourth_round() diff = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); std::cerr << "compute quotient commitment: " << diff.count() << "ms" << std::endl; #endif -} // namespace plonk +} // namespace proof_system::plonk template <typename settings> void ProverBase<settings>::execute_fifth_round() { @@ -640,4 +640,4 @@ template class ProverBase<turbo_settings>; template class ProverBase<ultra_settings>; template class ProverBase<ultra_to_standard_settings>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp b/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp index 50d303c81a..d0476608e2 100644 --- a/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp @@ -1,13 +1,13 @@ #pragma once -#include "../../../proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "../types/proof.hpp" #include "../types/program_settings.hpp" #include "../widgets/random_widgets/random_widget.hpp" #include "../../../proof_system/work_queue/work_queue.hpp" #include "../widgets/transition_widgets/transition_widget.hpp" #include "../commitment_scheme/commitment_scheme.hpp" -using namespace plonk; -namespace plonk { + +namespace proof_system::plonk { template <typename settings> class ProverBase { @@ -110,4 +110,4 @@ typedef ProverBase<ultra_settings> UltraProver; // TODO(Mike): maybe just return // TODO(Cody): Make this into an issue? typedef ProverBase<ultra_to_standard_settings> UltraToStandardProver; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp b/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp index bdcbad74e5..50a535f946 100644 --- a/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/prover/prover.test.cpp @@ -65,7 +65,7 @@ sigma_3 = [39, 23, 4, 40, 41, 25, 33, 36, 37, 42, 43, 44, 45, 46, 47, 48] ``` */ using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace prover_helpers { @@ -112,8 +112,8 @@ plonk::Prover generate_test_data(const size_t n) // even indices = mul gates, odd incides = add gates - auto reference_string = std::make_shared<bonk::FileReferenceString>(n + 1, "../srs_db/ignition"); - std::shared_ptr<proving_key> key = std::make_shared<proving_key>(n, 0, reference_string, plonk::STANDARD); + auto reference_string = std::make_shared<FileReferenceString>(n + 1, "../srs_db/ignition"); + std::shared_ptr<proving_key> key = std::make_shared<proving_key>(n, 0, reference_string, ComposerType::STANDARD); polynomial w_l(n); polynomial w_r(n); diff --git a/cpp/src/barretenberg/proof_system/proving_key/proving_key.cpp b/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.cpp similarity index 92% rename from cpp/src/barretenberg/proof_system/proving_key/proving_key.cpp rename to cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.cpp index ad66e30fa0..ea22d7f366 100644 --- a/cpp/src/barretenberg/proof_system/proving_key/proving_key.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.cpp @@ -2,7 +2,8 @@ #include "barretenberg/polynomials/polynomial_arithmetic.hpp" #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" -namespace bonk { + +namespace proof_system::plonk { // In all the constructors below, the pippenger_runtime_state takes (n + 1) as the input // as the degree of t_{high}(X) is (n + 1) for standard plonk. Refer to @@ -23,8 +24,8 @@ namespace bonk { * */ proving_key::proving_key(const size_t num_gates, const size_t num_inputs, - std::shared_ptr<ProverReferenceString> const& crs, - plonk::ComposerType type = plonk::STANDARD) // TODO(Cody): Don't use default for Honk + std::shared_ptr<proof_system::ProverReferenceString> const& crs, + ComposerType type = ComposerType::STANDARD) // TODO(Cody): Don't use default for Honk : composer_type(type) , circuit_size(num_gates) , log_circuit_size(numeric::get_msb(num_gates)) @@ -44,7 +45,7 @@ proving_key::proving_key(const size_t num_gates, * @param data * @param crs */ -proving_key::proving_key(proving_key_data&& data, std::shared_ptr<ProverReferenceString> const& crs) +proving_key::proving_key(proving_key_data&& data, std::shared_ptr<proof_system::ProverReferenceString> const& crs) : composer_type(data.composer_type) , circuit_size(data.circuit_size) , num_public_inputs(data.num_public_inputs) @@ -88,4 +89,4 @@ void proving_key::init() memset((void*)"ient_polynomial_parts[3][0], 0x00, sizeof(barretenberg::fr) * circuit_size); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/proof_system/proving_key/proving_key.hpp b/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp similarity index 92% rename from cpp/src/barretenberg/proof_system/proving_key/proving_key.hpp rename to cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp index 7df19d2e64..f3198a5cbb 100644 --- a/cpp/src/barretenberg/proof_system/proving_key/proving_key.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.hpp @@ -7,10 +7,10 @@ #include "barretenberg/proof_system/polynomial_store/polynomial_store.hpp" #include "barretenberg/srs/reference_string/reference_string.hpp" #include "barretenberg/plonk/proof_system/constants.hpp" -#include "barretenberg/proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" #include <unordered_map> -namespace bonk { +namespace proof_system::plonk { struct proving_key_data { uint32_t composer_type; @@ -36,7 +36,7 @@ struct proving_key { proving_key(const size_t num_gates, const size_t num_inputs, std::shared_ptr<ProverReferenceString> const& crs, - plonk::ComposerType type); + ComposerType type); proving_key(std::ostream& is, std::string const& crs_path); @@ -69,4 +69,4 @@ struct proving_key { static constexpr size_t min_thread_block = 4UL; }; -} // namespace bonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/proof_system/proving_key/proving_key.test.cpp b/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp similarity index 85% rename from cpp/src/barretenberg/proof_system/proving_key/proving_key.test.cpp rename to cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp index fd4a0ff2cf..c3d2969fbf 100644 --- a/cpp/src/barretenberg/proof_system/proving_key/proving_key.test.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp @@ -10,7 +10,7 @@ #endif using namespace barretenberg; -using namespace bonk; +using namespace proof_system; // Test proving key serialization/deserialization to/from buffer TEST(proving_key, proving_key_from_serialized_key) @@ -19,17 +19,17 @@ TEST(proving_key, proving_key_from_serialized_key) fr a = fr::one(); composer.add_public_variable(a); - bonk::proving_key& p_key = *composer.compute_proving_key(); + plonk::proving_key& p_key = *composer.compute_proving_key(); auto pk_buf = to_buffer(p_key); - auto pk_data = from_buffer<bonk::proving_key_data>(pk_buf); - auto crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto pk_data = from_buffer<plonk::proving_key_data>(pk_buf); + auto crs = std::make_unique<FileReferenceStringFactory>("../srs_db/ignition"); auto proving_key = - std::make_shared<bonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + std::make_shared<plonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); // Loop over all pre-computed polys for the given composer type and ensure equality // between original proving key polynomial store and the polynomial store that was // serialized/deserialized from buffer - bonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); + plonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); bool all_polys_are_equal{ true }; for (size_t i = 0; i < precomputed_poly_list.size(); ++i) { std::string poly_id = precomputed_poly_list[i]; @@ -55,17 +55,17 @@ TEST(proving_key, proving_key_from_serialized_key_ultra) fr a = fr::one(); composer.add_public_variable(a); - bonk::proving_key& p_key = *composer.compute_proving_key(); + plonk::proving_key& p_key = *composer.compute_proving_key(); auto pk_buf = to_buffer(p_key); - auto pk_data = from_buffer<bonk::proving_key_data>(pk_buf); - auto crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto pk_data = from_buffer<plonk::proving_key_data>(pk_buf); + auto crs = std::make_unique<FileReferenceStringFactory>("../srs_db/ignition"); auto proving_key = - std::make_shared<bonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); + std::make_shared<plonk::proving_key>(std::move(pk_data), crs->get_prover_crs(pk_data.circuit_size + 1)); // Loop over all pre-computed polys for the given composer type and ensure equality // between original proving key polynomial store and the polynomial store that was // serialized/deserialized from buffer - bonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); + plonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); bool all_polys_are_equal{ true }; for (size_t i = 0; i < precomputed_poly_list.size(); ++i) { std::string poly_id = precomputed_poly_list[i]; @@ -115,7 +115,7 @@ TEST(proving_key, proving_key_from_mmaped_key) if (!os.good()) { std::cerr << "OS failed in composer_from_mmap_keys! \n"; } - bonk::proving_key& p_key = *composer.compute_proving_key(); + plonk::proving_key& p_key = *composer.compute_proving_key(); write_mmap(os, pk_dir, p_key); os.close(); @@ -125,14 +125,14 @@ TEST(proving_key, proving_key_from_mmaped_key) if (!pk_stream.good()) { std::cerr << "IS failed in composer_from_mmap_keys! \n"; } - bonk::proving_key_data pk_data; + plonk::proving_key_data pk_data; read_mmap(pk_stream, pk_dir, pk_data); pk_stream.close(); // Loop over all pre-computed polys for the given composer type and ensure equality // between original proving key polynomial store and the polynomial store that was // serialized/deserialized via mmap - bonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); + plonk::PrecomputedPolyList precomputed_poly_list(p_key.composer_type); bool all_polys_are_equal{ true }; for (size_t i = 0; i < precomputed_poly_list.size(); ++i) { std::string poly_id = precomputed_poly_list[i]; diff --git a/cpp/src/barretenberg/proof_system/proving_key/serialize.hpp b/cpp/src/barretenberg/plonk/proof_system/proving_key/serialize.hpp similarity index 98% rename from cpp/src/barretenberg/proof_system/proving_key/serialize.hpp rename to cpp/src/barretenberg/plonk/proof_system/proving_key/serialize.hpp index 4248d0a5cc..6bc7e79ed5 100644 --- a/cpp/src/barretenberg/proof_system/proving_key/serialize.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/proving_key/serialize.hpp @@ -4,7 +4,7 @@ #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/common/serialize.hpp" -namespace bonk { +namespace proof_system::plonk { // Read the pre-computed polynomials template <typename B> inline void read(B& any, proving_key_data& key) @@ -115,4 +115,4 @@ template <typename B> inline void write_mmap(B& os, std::string const& path, pro write(os, key.memory_write_records); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp b/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp index a137bca18c..13b9effd29 100644 --- a/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp @@ -2,7 +2,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include <vector> -namespace plonk { +namespace proof_system::plonk { template <typename Field> Field compute_public_input_delta(const std::vector<Field>& inputs, const Field& beta, diff --git a/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp b/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp index 8730d41afe..33e47a32e8 100644 --- a/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs.test.cpp @@ -61,7 +61,7 @@ sigma_3 = [39, 23, 4, 40, 41, 25, 33, 36, 37, 42, 43, 44, 45, 46, 47, 48] ``` */ using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { @@ -138,7 +138,7 @@ TEST(test_public_inputs, compute_delta) for (size_t i = 0; i < num_public_inputs; ++i) { public_inputs.push_back(left[i]); } - fr target_delta = plonk::compute_public_input_delta<fr>(public_inputs, beta, gamma, domain.root); + fr target_delta = proof_system::plonk::compute_public_input_delta<fr>(public_inputs, beta, gamma, domain.root); EXPECT_EQ((modified_result == target_delta), true); } diff --git a/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp b/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp index 5f14716eb6..cb28bca3c4 100644 --- a/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/public_inputs/public_inputs_impl.hpp @@ -1,6 +1,6 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { /** * Public inputs! @@ -137,4 +137,4 @@ Field compute_public_input_delta(const std::vector<Field>& public_inputs, T0 = numerator / denominator; return T0; } -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp b/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp index b7269f79e5..e35951dc9b 100644 --- a/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/types/commitment_open_proof.hpp @@ -3,10 +3,10 @@ #include <cstdint> #include <vector> -namespace plonk { +namespace proof_system::plonk { struct commitment_open_proof { std::vector<uint8_t> proof_data; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/proof_system/types/polynomial_manifest.hpp b/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp similarity index 96% rename from cpp/src/barretenberg/proof_system/types/polynomial_manifest.hpp rename to cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp index 4052d4ebff..aefd348ff9 100644 --- a/cpp/src/barretenberg/proof_system/types/polynomial_manifest.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/types/polynomial_manifest.hpp @@ -4,9 +4,8 @@ #include <vector> #include <string> #include "barretenberg/plonk/proof_system/constants.hpp" -// ToDo(Arijit): The below namespace should be plonk once all the honk related stuffs are moved out -// ToDo(Cody): This is now plonk-specific. -namespace bonk { + +namespace proof_system::plonk { enum PolynomialSource { WITNESS, SELECTOR, PERMUTATION, OTHER }; @@ -87,7 +86,7 @@ struct PolynomialDescriptor { std::string_view polynomial_label; bool requires_shifted_evaluation; PolynomialSource source; - bonk::PolynomialIndex index; + PolynomialIndex index; }; static constexpr size_t STANDARD_MANIFEST_SIZE = 12; @@ -176,19 +175,19 @@ class PolynomialManifest { PolynomialManifest(uint32_t composer_type) { switch (composer_type) { - case plonk::ComposerType::STANDARD: { + case ComposerType::STANDARD: { std::copy(standard_polynomial_manifest, standard_polynomial_manifest + STANDARD_MANIFEST_SIZE, std::back_inserter(manifest)); break; }; - case plonk::ComposerType::TURBO: { + case ComposerType::TURBO: { std::copy(turbo_polynomial_manifest, turbo_polynomial_manifest + TURBO_MANIFEST_SIZE, std::back_inserter(manifest)); break; }; - case plonk::ComposerType::PLOOKUP: { + case ComposerType::PLOOKUP: { std::copy(ultra_polynomial_manifest, ultra_polynomial_manifest + ULTRA_MANIFEST_SIZE, std::back_inserter(manifest)); @@ -236,7 +235,7 @@ class PrecomputedPolyList { precomputed_poly_ids.emplace_back(label); precomputed_poly_ids.emplace_back(label + "_fft"); // Store all lagrange forms of selector polynomials for ultra - if (composer_type == plonk::ComposerType::PLOOKUP) { + if (composer_type == ComposerType::PLOOKUP) { precomputed_poly_ids.emplace_back(label + "_lagrange"); } break; @@ -256,4 +255,4 @@ class PrecomputedPolyList { std::string operator[](size_t index) const { return precomputed_poly_ids[index]; } }; -} // namespace bonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp b/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp index 8e4b072c67..b4b9d5d753 100644 --- a/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/types/program_settings.hpp @@ -17,7 +17,7 @@ #include "../widgets/random_widgets/plookup_widget.hpp" #include "./prover_settings.hpp" -namespace plonk { +namespace proof_system::plonk { class standard_verifier_settings : public standard_settings { public: @@ -187,4 +187,4 @@ class ultra_to_standard_verifier_settings : public ultra_verifier_settings { static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp b/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp index eb0398d35a..9d4713ccd6 100644 --- a/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/types/proof.hpp @@ -2,10 +2,10 @@ #include <cstdint> #include <vector> -namespace plonk { +namespace proof_system::plonk { struct proof { std::vector<uint8_t> proof_data; }; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp b/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp index 0862073254..fd439df766 100644 --- a/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/types/prover_settings.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/proof_system/arithmetization/arithmetization.hpp" #include "barretenberg/transcript/transcript.hpp" -namespace plonk { +namespace proof_system::plonk { class settings_base { public: static constexpr bool requires_shifted_wire(const uint64_t wire_shift_settings, const uint64_t wire_index) @@ -57,4 +57,4 @@ class ultra_to_standard_settings : public ultra_settings { static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; }; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp b/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp index a85f9a6e3d..fbf08b9c10 100644 --- a/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/utils/generalized_permutation.hpp @@ -3,7 +3,7 @@ #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace plonk { +namespace proof_system::plonk { template <typename program_settings> inline void compute_gen_permutation_lagrange_base_single(barretenberg::polynomial& output, const std::vector<uint32_t>& permutation, @@ -63,4 +63,4 @@ inline void compute_gen_permutation_lagrange_base_single(barretenberg::polynomia } ITERATE_OVER_DOMAIN_END; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp b/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp index 91ee51d3b7..5fa5eeda39 100644 --- a/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/utils/kate_verification.hpp @@ -2,7 +2,7 @@ #include <map> -namespace plonk { +namespace proof_system::plonk { template <typename Field, typename Transcript, typename program_settings> Field compute_kate_batch_evaluation(typename Transcript::Key* key, const Transcript& transcript) @@ -146,4 +146,4 @@ inline void print_turbo_verification_key(verification_key* key) print_fr("permutation_non_residues[1]", 6); print_fr("permutation_non_residues[2]", 7); } -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp b/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp index d33cf98d46..24ae1810f0 100644 --- a/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/utils/permutation.hpp @@ -4,7 +4,7 @@ #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace plonk { +namespace proof_system::plonk { struct permutation_subgroup_element { uint32_t subgroup_index = 0; @@ -107,4 +107,4 @@ inline void compute_permutation_lagrange_base_single(barretenberg::polynomial& o } ITERATE_OVER_DOMAIN_END; } -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/proof_system/verification_key/sol_gen.hpp b/cpp/src/barretenberg/plonk/proof_system/verification_key/sol_gen.hpp similarity index 92% rename from cpp/src/barretenberg/proof_system/verification_key/sol_gen.hpp rename to cpp/src/barretenberg/plonk/proof_system/verification_key/sol_gen.hpp index 29fd773f0b..6342ea042f 100644 --- a/cpp/src/barretenberg/proof_system/verification_key/sol_gen.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/verification_key/sol_gen.hpp @@ -1,11 +1,11 @@ -namespace bonk { +namespace proof_system { /** * Write a solidity file containing the vk params to the given stream. * Uses StandardPlonk **/ inline void output_vk_sol_standard(std::ostream& os, - std::shared_ptr<verification_key> const& key, + std::shared_ptr<plonk::verification_key> const& key, std::string const& class_name) { const auto print_u256 = [&](const std::string& offset, const barretenberg::fr& element, const std::string& name) { @@ -65,7 +65,7 @@ inline void output_vk_sol_standard(std::ostream& os, * Write a solidity file containing the vk params to the given stream. * Uses UltraPlonk **/ -inline void output_vk_sol_ultra(std::ostream& os, std::shared_ptr<verification_key> const& key, std::string const& class_name) +inline void output_vk_sol_ultra(std::ostream& os, std::shared_ptr<plonk::verification_key> const& key, std::string const& class_name) { const auto print_u256 = [&](const std::string& offset, const barretenberg::fr& element, const std::string& name) { os << " mstore(add(_vk, " << offset << "), " << element << ") // " << name << std::endl; @@ -141,26 +141,26 @@ inline void output_vk_sol_ultra(std::ostream& os, std::shared_ptr<verification_k * @param key * @param class_name */ -inline void output_vk_sol(std::ostream& os, std::shared_ptr<verification_key> const& key, std::string const& class_name) +inline void output_vk_sol(std::ostream& os, std::shared_ptr<plonk::verification_key> const& key, std::string const& class_name) { - plonk::ComposerType composer_type = static_cast<plonk::ComposerType>(key->composer_type); + ComposerType composer_type = static_cast<ComposerType>(key->composer_type); switch (composer_type) { - case plonk::ComposerType::STANDARD: { + case ComposerType::STANDARD: { return output_vk_sol_standard(os, key, class_name); break; } - // case plonk::ComposerType::TURBO: { + // case ComposerType::TURBO: { // return output_vk_sol_turbo(os, key, class_name); // break; // } - case plonk::ComposerType::PLOOKUP: { + case ComposerType::PLOOKUP: { return output_vk_sol_ultra(os, key, class_name); break; } default: { - std::cerr << "bonk::output_vk_sol unsupported composer type. Defaulting to standard composer" << std::endl; + std::cerr << "proof_system::output_vk_sol unsupported composer type. Defaulting to standard composer" << std::endl; return output_vk_sol_standard(os, key, class_name); } } } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/verification_key/verification_key.cpp b/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.cpp similarity index 96% rename from cpp/src/barretenberg/proof_system/verification_key/verification_key.cpp rename to cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.cpp index 3838656c8a..ef6913f184 100644 --- a/cpp/src/barretenberg/proof_system/verification_key/verification_key.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.cpp @@ -1,8 +1,8 @@ #include "barretenberg/crypto/sha256/sha256.hpp" #include "verification_key.hpp" -#include "../../plonk/proof_system/constants.hpp" +#include "barretenberg/plonk/proof_system/constants.hpp" -namespace bonk { +namespace proof_system::plonk { verification_key::verification_key(const size_t num_gates, const size_t num_inputs, @@ -87,4 +87,4 @@ sha256::hash verification_key::sha256_hash() return sha256::sha256(to_buffer(vk_data)); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/proof_system/verification_key/verification_key.hpp b/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.hpp similarity index 95% rename from cpp/src/barretenberg/proof_system/verification_key/verification_key.hpp rename to cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.hpp index 08b0f85751..3d1a31a67f 100644 --- a/cpp/src/barretenberg/proof_system/verification_key/verification_key.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.hpp @@ -3,9 +3,9 @@ #include "barretenberg/srs/reference_string/reference_string.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" #include "barretenberg/crypto/sha256/sha256.hpp" -#include "../../proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" -namespace bonk { +namespace proof_system::plonk { struct verification_key_data { uint32_t composer_type; @@ -91,4 +91,4 @@ template <typename B> inline void write(B& buf, verification_key const& key) write(buf, key.recursive_proof_public_input_indices); } -} // namespace bonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/proof_system/verification_key/verification_key.test.cpp b/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.test.cpp similarity index 80% rename from cpp/src/barretenberg/proof_system/verification_key/verification_key.test.cpp rename to cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.test.cpp index 8f74d875d6..bb049af011 100644 --- a/cpp/src/barretenberg/proof_system/verification_key/verification_key.test.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/verification_key/verification_key.test.cpp @@ -3,12 +3,14 @@ #include "verification_key.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system::plonk; + +namespace proof_system::plonk::test_verification_key { TEST(verification_key, buffer_serialization) { verification_key_data key; - key.composer_type = static_cast<uint32_t>(plonk::ComposerType::STANDARD); + key.composer_type = static_cast<uint32_t>(ComposerType::STANDARD); key.circuit_size = 1234; key.num_public_inputs = 10; key.commitments["test1"] = g1::element::random_element(); @@ -25,7 +27,7 @@ TEST(verification_key, buffer_serialization) TEST(verification_key, stream_serialization) { verification_key_data key; - key.composer_type = static_cast<uint32_t>(plonk::ComposerType::STANDARD); + key.composer_type = static_cast<uint32_t>(ComposerType::STANDARD); key.circuit_size = 1234; key.num_public_inputs = 10; key.commitments["test1"] = g1::element::random_element(); @@ -41,3 +43,4 @@ TEST(verification_key, stream_serialization) EXPECT_EQ(key, result); } +} // namespace proof_system::plonk::test_verification_key \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp b/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp index 4986bec460..2a4681df5f 100644 --- a/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.cpp @@ -10,7 +10,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { template <typename program_settings> VerifierBase<program_settings>::VerifierBase(std::shared_ptr<verification_key> verifier_key, const transcript::Manifest& input_manifest) @@ -242,4 +242,4 @@ template class VerifierBase<turbo_verifier_settings>; template class VerifierBase<ultra_verifier_settings>; template class VerifierBase<ultra_to_standard_verifier_settings>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp b/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp index 32be98f126..151117ba10 100644 --- a/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.hpp @@ -5,7 +5,7 @@ #include "barretenberg/transcript/manifest.hpp" #include "barretenberg/plonk/proof_system/commitment_scheme/commitment_scheme.hpp" -namespace plonk { +namespace proof_system::plonk { template <typename program_settings> class VerifierBase { public: @@ -38,4 +38,4 @@ typedef VerifierBase<turbo_verifier_settings> TurboVerifier; typedef VerifierBase<ultra_verifier_settings> UltraVerifier; typedef VerifierBase<ultra_to_standard_verifier_settings> UltraToStandardVerifier; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp b/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp index 79be2fab2e..701a465189 100644 --- a/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp +++ b/cpp/src/barretenberg/plonk/proof_system/verifier/verifier.test.cpp @@ -1,5 +1,5 @@ #include "../prover/prover.hpp" -#include "../../../proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "../utils/permutation.hpp" #include "../widgets/transition_widgets/arithmetic_widget.hpp" #include "../../../transcript/transcript.hpp" @@ -14,7 +14,7 @@ namespace verifier_helpers { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; plonk::Verifier generate_verifier(std::shared_ptr<proving_key> circuit_proving_key) { @@ -40,7 +40,7 @@ plonk::Verifier generate_verifier(std::shared_ptr<proving_key> circuit_proving_k state)); } - auto crs = std::make_shared<bonk::VerifierFileReferenceString>("../srs_db/ignition"); + auto crs = std::make_shared<VerifierFileReferenceString>("../srs_db/ignition"); std::shared_ptr<verification_key> circuit_verification_key = std::make_shared<verification_key>(circuit_proving_key->circuit_size, circuit_proving_key->num_public_inputs, @@ -76,8 +76,8 @@ plonk::Prover generate_test_data(const size_t n) // even indices = mul gates, odd incides = add gates - auto crs = std::make_shared<bonk::FileReferenceString>(n + 1, "../srs_db/ignition"); - std::shared_ptr<proving_key> key = std::make_shared<proving_key>(n, 0, crs, plonk::STANDARD); + auto crs = std::make_shared<FileReferenceString>(n + 1, "../srs_db/ignition"); + std::shared_ptr<proving_key> key = std::make_shared<proving_key>(n, 0, crs, ComposerType::STANDARD); polynomial w_l(n); polynomial w_r(n); diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp index 92606be5e4..98e58b0bad 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget.hpp @@ -1,7 +1,7 @@ #pragma once #include "random_widget.hpp" -namespace plonk { +namespace proof_system::plonk { template <typename Field, typename Group, typename Transcript, @@ -42,6 +42,6 @@ class ProverPermutationWidget : public ProverRandomWidget { const transcript::StandardTranscript& transcript) override; }; -} // namespace plonk +} // namespace proof_system::plonk #include "./permutation_widget_impl.hpp" \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget_impl.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget_impl.hpp index a25000f72f..e85c0a616e 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget_impl.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/permutation_widget_impl.hpp @@ -1,13 +1,13 @@ #pragma once #include "barretenberg/common/mem.hpp" #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp" #include "barretenberg/transcript/transcript.hpp" #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "barretenberg/polynomials/polynomial_arithmetic.hpp" -namespace plonk { +namespace proof_system::plonk { template <size_t program_width, bool idpolys, const size_t num_roots_cut_out_of_vanishing_polynomial> ProverPermutationWidget<program_width, idpolys, num_roots_cut_out_of_vanishing_polynomial>::ProverPermutationWidget( @@ -789,4 +789,4 @@ template class VerifierPermutationWidget<barretenberg::fr, barretenberg::g1::affine_element, transcript::StandardTranscript>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp index 003f292769..623f3a6193 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget.hpp @@ -1,7 +1,7 @@ #pragma once #include "random_widget.hpp" -namespace plonk { +namespace proof_system::plonk { template <typename Field, typename Group, typename Transcript, @@ -46,6 +46,6 @@ class ProverPlookupWidget : public ProverRandomWidget { const transcript::StandardTranscript& transcript) override; }; -} // namespace plonk +} // namespace proof_system::plonk #include "./plookup_widget_impl.hpp" \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget_impl.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget_impl.hpp index 7a9a09ef4f..3b933a91b5 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget_impl.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/plookup_widget_impl.hpp @@ -1,13 +1,13 @@ #pragma once -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include "barretenberg/transcript/transcript.hpp" #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" #include "barretenberg/polynomials/polynomial_arithmetic.hpp" #include "barretenberg/common/mem.hpp" -namespace plonk { +namespace proof_system::plonk { template <const size_t num_roots_cut_out_of_vanishing_polynomial> ProverPlookupWidget<num_roots_cut_out_of_vanishing_polynomial>::ProverPlookupWidget(proving_key* input_key) @@ -734,7 +734,7 @@ Field VerifierPlookupWidget<Field, Group, Transcript, num_roots_cut_out_of_vanis T0 = numerator - denominator; quotient_numerator_eval += T0 * alpha_base; return alpha_base * alpha.sqr() * alpha; -} // namespace plonk +} // namespace proof_system::plonk template <typename Field, typename Group, typename Transcript, const size_t num_roots_cut_out_of_vanishing_polynomial> Field VerifierPlookupWidget<Field, Group, Transcript, num_roots_cut_out_of_vanishing_polynomial>:: @@ -751,4 +751,4 @@ template class VerifierPlookupWidget<barretenberg::fr, barretenberg::g1::affine_element, transcript::StandardTranscript>; -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp index 56fb3ae1f9..39829799cc 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/random_widgets/random_widget.hpp @@ -9,7 +9,7 @@ class Transcript; } // TODO(Cody) Fix this namespace. -namespace bonk { +namespace proof_system::plonk { struct proving_key; @@ -53,4 +53,4 @@ class ProverRandomWidget { proving_key* key; }; -} // namespace bonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp index 7b403a5897..e21da0141e 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/arithmetic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -32,13 +32,12 @@ template <class Field, class Getters, typename PolyContainer> class ArithmeticKe typedef containers::coefficient_array<Field> coefficient_array; public: - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_M, bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3 - }; + static const std::set<PolynomialIndex> required_polynomial_ids = { PolynomialIndex::Q_1, PolynomialIndex::Q_2, + PolynomialIndex::Q_3, PolynomialIndex::Q_M, + PolynomialIndex::Q_C, PolynomialIndex::W_1, + PolynomialIndex::W_2, PolynomialIndex::W_3 }; return required_polynomial_ids; } @@ -58,11 +57,11 @@ template <class Field, class Getters, typename PolyContainer> class ArithmeticKe const size_t i = 0) { const Field& w_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); linear_terms[0] = w_1 * w_2; linear_terms[1] = w_1; @@ -94,15 +93,15 @@ template <class Field, class Getters, typename PolyContainer> class ArithmeticKe { const Field& alpha = challenges.alpha_powers[0]; const Field& q_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_1>(polynomials, i); const Field& q_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_2>(polynomials, i); const Field& q_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_3>(polynomials, i); const Field& q_m = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_M>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_M>(polynomials, i); const Field& q_c = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_C>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_C>(polynomials, i); Field result = linear_terms[0] * q_m; result += (linear_terms[1] * q_1); @@ -155,4 +154,4 @@ using ProverArithmeticWidget = widget::TransitionWidget<barretenberg::fr, Settin template <typename Field, typename Group, typename Transcript, typename Settings> using VerifierArithmeticWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::ArithmeticKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp index 65e545a37b..e628a85563 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/elliptic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -73,12 +73,11 @@ template <class Field, class Getters, typename PolyContainer> class EllipticKern typedef containers::coefficient_array<Field> coefficient_array; public: - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_3, bonk::PolynomialIndex::Q_4, - bonk::PolynomialIndex::Q_ELLIPTIC, bonk::PolynomialIndex::W_1, bonk::PolynomialIndex::W_2, - bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set<PolynomialIndex> required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_3, PolynomialIndex::Q_4, PolynomialIndex::Q_ELLIPTIC, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -97,27 +96,23 @@ template <class Field, class Getters, typename PolyContainer> class EllipticKern const size_t i = 0) { const Field& x_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& y_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); - const Field& x_2 = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); - const Field& y_2 = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); - const Field& x_3 = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); - const Field& y_3 = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); + const Field& x_2 = Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_1>(polynomials, i); + const Field& y_2 = Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_4>(polynomials, i); + const Field& x_3 = Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_2>(polynomials, i); + const Field& y_3 = Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_3>(polynomials, i); // Endomorphism coefficient for when we add and multiply by beta at the same time const Field& q_beta = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_3>(polynomials, i); // Square of endomorphism coefficient const Field& q_beta_sqr = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_4>(polynomials, i); // sign const Field& q_sign = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_1>(polynomials, i); // TODO: Can this be implemented more efficiently? // It seems that Zac wanted to group the elements by selectors to use several linear terms initially, @@ -165,7 +160,7 @@ template <class Field, class Getters, typename PolyContainer> class EllipticKern const size_t i = 0) { const Field& q_elliptic = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_ELLIPTIC>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_ELLIPTIC>(polynomials, i); return linear_terms[0] * q_elliptic; } @@ -193,4 +188,4 @@ using ProverEllipticWidget = widget::TransitionWidget<barretenberg::fr, Settings template <typename Field, typename Group, typename Transcript, typename Settings> using VerifierEllipticWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::EllipticKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp index d5b7e9c4ef..8ee5d507b6 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/fixed_base_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -86,13 +86,12 @@ template <class Field, class Getters, typename PolyContainer, bool turbo> class typedef containers::coefficient_array<Field> coefficient_array; public: - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_5, bonk::PolynomialIndex::Q_M, - PolynomialIndex::Q_C, PolynomialIndex::Q_FIXED_BASE, PolynomialIndex::W_1, - PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 + static const std::set<PolynomialIndex> required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_5, PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_FIXED_BASE, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -329,4 +328,4 @@ using VerifierTurboFixedBaseWidget = template <typename Field, typename Group, typename Transcript, typename Settings> using VerifierUltraFixedBaseWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::UltraFixedBaseKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp index b7e7e3453a..ee8afe2dc9 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/genperm_sort_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { template <class Field, class Getters, typename PolyContainer> class GenPermSortKernel { @@ -18,11 +18,11 @@ template <class Field, class Getters, typename PolyContainer> class GenPermSortK typedef containers::coefficient_array<Field> coefficient_array; public: - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_SORT, bonk::PolynomialIndex::W_1, bonk::PolynomialIndex::W_2, - bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4, bonk::PolynomialIndex::Z + static const std::set<PolynomialIndex> required_polynomial_ids = { + PolynomialIndex::Q_SORT, PolynomialIndex::W_1, PolynomialIndex::W_2, + PolynomialIndex::W_3, PolynomialIndex::W_4, PolynomialIndex::Z }; return required_polynomial_ids; } @@ -38,15 +38,15 @@ template <class Field, class Getters, typename PolyContainer> class GenPermSortK const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& w_1_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_1>(polynomials, i); Field alpha_a = alpha_base; Field alpha_b = alpha_a * alpha; @@ -105,7 +105,7 @@ template <class Field, class Getters, typename PolyContainer> class GenPermSortK const size_t i = 0) { const Field& q_sort = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_SORT>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_SORT>(polynomials, i); return linear_terms[0] * q_sort; } @@ -126,4 +126,4 @@ using ProverGenPermSortWidget = widget::TransitionWidget<barretenberg::fr, Setti template <typename Field, typename Group, typename Transcript, typename Settings> using VerifierGenPermSortWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::GenPermSortKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp index bf6458fb6e..3a10bb9787 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_arithmetic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -64,13 +64,12 @@ template <class Field, class Getters, typename PolyContainer> class PlookupArith typedef containers::coefficient_array<Field> coefficient_array; public: - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_5, bonk::PolynomialIndex::Q_M, - bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::Q_ARITHMETIC, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set<PolynomialIndex> required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_5, PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_ARITHMETIC, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -100,32 +99,31 @@ template <class Field, class Getters, typename PolyContainer> class PlookupArith { // For subgroup element i, this term evaluates to W_4(i \omega) * 2 iff Q_ARITH(i \omega) = 2 const Field& q_arith = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_ARITHMETIC>(polynomials, - i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_ARITHMETIC>(polynomials, i); const Field& w_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& w_1_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_4_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& q_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_1>(polynomials, i); const Field& q_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_2>(polynomials, i); const Field& q_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_3>(polynomials, i); const Field& q_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_4>(polynomials, i); const Field& q_m = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_M>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_M>(polynomials, i); const Field& q_c = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_C>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_C>(polynomials, i); const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; @@ -207,4 +205,4 @@ template <typename Field, typename Group, typename Transcript, typename Settings using VerifierPlookupArithmeticWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::PlookupArithmeticKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp index 894ec072e1..093568b58a 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -52,13 +52,12 @@ template <class Field, class Getters, typename PolyContainer> class PlookupAuxil typedef containers::coefficient_array<Field> coefficient_array; public: - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_M, bonk::PolynomialIndex::Q_C, - bonk::PolynomialIndex::Q_ARITHMETIC, bonk::PolynomialIndex::Q_AUX, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set<PolynomialIndex> required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_ARITHMETIC, PolynomialIndex::Q_AUX, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -78,43 +77,42 @@ template <class Field, class Getters, typename PolyContainer> class PlookupAuxil constexpr barretenberg::fr SUBLIMB_SHIFT(uint256_t(1) << 14); const Field& w_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& w_1_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& eta = challenges.elements[ChallengeIndex::ETA]; const Field& q_aux = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_AUX>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_AUX>(polynomials, i); const Field& q_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_1>(polynomials, i); const Field& q_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_2>(polynomials, i); const Field& q_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_3>(polynomials, i); const Field& q_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_4>(polynomials, i); const Field& q_m = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_M>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_M>(polynomials, i); const Field& q_c = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_C>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_C>(polynomials, i); const Field& q_arith = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_ARITHMETIC>(polynomials, - i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_ARITHMETIC>(polynomials, i); /** * Non native field arithmetic gate 2 @@ -350,4 +348,4 @@ template <typename Field, typename Group, typename Transcript, typename Settings using VerifierPlookupAuxiliaryWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::PlookupAuxiliaryKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp index 006ea63e45..5dc62aa2a9 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/transition_widget.hpp @@ -7,10 +7,11 @@ #include "barretenberg/polynomials/iterate_over_domain.hpp" #include "../../types/prover_settings.hpp" -#include "../../../../proof_system/proving_key/proving_key.hpp" -#include "../../../../proof_system/work_queue/work_queue.hpp" -using namespace bonk; -namespace plonk { +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/proof_system/work_queue/work_queue.hpp" + +using namespace proof_system; +namespace proof_system::plonk { namespace widget { enum ChallengeIndex { @@ -386,4 +387,4 @@ class GenericVerifierWidget { } }; } // namespace widget -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp index 39098e68ac..9daaba1f0c 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_arithmetic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /** @@ -49,18 +49,16 @@ template <class Field, class Getters, typename PolyContainer> class TurboArithme inline static bool gate_enabled(PolyContainer& polynomials, const size_t i = 0) { const Field& q_arith = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_ARITHMETIC>(polynomials, - i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_ARITHMETIC>(polynomials, i); return !q_arith.is_zero(); } - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_1, bonk::PolynomialIndex::Q_2, bonk::PolynomialIndex::Q_3, - bonk::PolynomialIndex::Q_4, bonk::PolynomialIndex::Q_5, bonk::PolynomialIndex::Q_M, - bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::Q_ARITHMETIC, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set<PolynomialIndex> required_polynomial_ids = { + PolynomialIndex::Q_1, PolynomialIndex::Q_2, PolynomialIndex::Q_3, PolynomialIndex::Q_4, + PolynomialIndex::Q_5, PolynomialIndex::Q_M, PolynomialIndex::Q_C, PolynomialIndex::Q_ARITHMETIC, + PolynomialIndex::W_1, PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -87,17 +85,16 @@ template <class Field, class Getters, typename PolyContainer> class TurboArithme constexpr barretenberg::fr minus_two(-2); const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& q_arith = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_ARITHMETIC>(polynomials, - i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_ARITHMETIC>(polynomials, i); Field T0; Field T1; @@ -147,12 +144,11 @@ template <class Field, class Getters, typename PolyContainer> class TurboArithme constexpr barretenberg::fr minus_seven(-7); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& q_arith = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_ARITHMETIC>(polynomials, - i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_ARITHMETIC>(polynomials, i); const Field& alpha_base = challenges.alpha_powers[0]; Field T1; @@ -242,19 +238,19 @@ template <class Field, class Getters, typename PolyContainer> class TurboArithme { const Field& alpha_base = challenges.alpha_powers[0]; const Field& q_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_1>(polynomials, i); const Field& q_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_2>(polynomials, i); const Field& q_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_3>(polynomials, i); const Field& q_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_4>(polynomials, i); const Field& q_5 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_5>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_5>(polynomials, i); const Field& q_m = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_M>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_M>(polynomials, i); const Field& q_c = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_C>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_C>(polynomials, i); Field result = linear_terms[0] * q_m; result += (linear_terms[1] * q_1); @@ -309,4 +305,4 @@ template <typename Field, typename Group, typename Transcript, typename Settings using VerifierTurboArithmeticWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::TurboArithmeticKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp index 239c548f51..95ade04896 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_logic_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { template <class Field, class Getters, typename PolyContainer> class TurboLogicKernel { @@ -18,11 +18,11 @@ template <class Field, class Getters, typename PolyContainer> class TurboLogicKe typedef containers::coefficient_array<Field> coefficient_array; public: - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { - bonk::PolynomialIndex::Q_C, bonk::PolynomialIndex::Q_LOGIC, bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, bonk::PolynomialIndex::W_3, bonk::PolynomialIndex::W_4 + static const std::set<PolynomialIndex> required_polynomial_ids = { + PolynomialIndex::Q_C, PolynomialIndex::Q_LOGIC, PolynomialIndex::W_1, + PolynomialIndex::W_2, PolynomialIndex::W_3, PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -37,7 +37,7 @@ template <class Field, class Getters, typename PolyContainer> class TurboLogicKe inline static bool gate_enabled(PolyContainer& polynomials, const size_t i = 0) { const Field& q_logic = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_LOGIC>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_LOGIC>(polynomials, i); return !q_logic.is_zero(); } @@ -53,22 +53,22 @@ template <class Field, class Getters, typename PolyContainer> class TurboLogicKe const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& w_1_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_4_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& q_c = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_C>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_C>(polynomials, i); Field delta_sum; Field delta_squared_sum; @@ -212,7 +212,7 @@ template <class Field, class Getters, typename PolyContainer> class TurboLogicKe const size_t i = 0) { const Field& q_logic = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_LOGIC>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_LOGIC>(polynomials, i); return linear_terms[0] * q_logic; } @@ -233,4 +233,4 @@ using ProverTurboLogicWidget = widget::TransitionWidget<barretenberg::fr, Settin template <typename Field, typename Group, typename Transcript, typename Settings> using VerifierTurboLogicWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::TurboLogicKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp index afb7e0f574..ffa9852c11 100644 --- a/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp +++ b/cpp/src/barretenberg/plonk/proof_system/widgets/transition_widgets/turbo_range_widget.hpp @@ -2,7 +2,7 @@ #include "./transition_widget.hpp" -namespace plonk { +namespace proof_system::plonk { namespace widget { /* @@ -85,17 +85,17 @@ template <class Field, class Getters, typename PolyContainer> class TurboRangeKe inline static bool gate_enabled(PolyContainer& polynomials, const size_t i = 0) { const Field& q_range = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_RANGE>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_RANGE>(polynomials, i); return !q_range.is_zero(); } - inline static std::set<bonk::PolynomialIndex> const& get_required_polynomial_ids() + inline static std::set<PolynomialIndex> const& get_required_polynomial_ids() { - static const std::set<bonk::PolynomialIndex> required_polynomial_ids = { bonk::PolynomialIndex::Q_RANGE, - bonk::PolynomialIndex::W_1, - bonk::PolynomialIndex::W_2, - bonk::PolynomialIndex::W_3, - bonk::PolynomialIndex::W_4 }; + static const std::set<PolynomialIndex> required_polynomial_ids = { PolynomialIndex::Q_RANGE, + PolynomialIndex::W_1, + PolynomialIndex::W_2, + PolynomialIndex::W_3, + PolynomialIndex::W_4 }; return required_polynomial_ids; } @@ -110,15 +110,15 @@ template <class Field, class Getters, typename PolyContainer> class TurboRangeKe const Field& alpha_base = challenges.alpha_powers[0]; const Field& alpha = challenges.elements[ChallengeIndex::ALPHA]; const Field& w_1 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_1>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_1>(polynomials, i); const Field& w_2 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_2>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_2>(polynomials, i); const Field& w_3 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_3>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_3>(polynomials, i); const Field& w_4 = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::W_4>(polynomials, i); const Field& w_4_omega = - Getters::template get_value<EvaluationType::SHIFTED, bonk::PolynomialIndex::W_4>(polynomials, i); + Getters::template get_value<EvaluationType::SHIFTED, PolynomialIndex::W_4>(polynomials, i); Field alpha_a = alpha_base; Field alpha_b = alpha_a * alpha; @@ -188,7 +188,7 @@ template <class Field, class Getters, typename PolyContainer> class TurboRangeKe const size_t i = 0) { const Field& q_range = - Getters::template get_value<EvaluationType::NON_SHIFTED, bonk::PolynomialIndex::Q_RANGE>(polynomials, i); + Getters::template get_value<EvaluationType::NON_SHIFTED, PolynomialIndex::Q_RANGE>(polynomials, i); return linear_terms[0] * q_range; } @@ -209,4 +209,4 @@ using ProverTurboRangeWidget = widget::TransitionWidget<barretenberg::fr, Settin template <typename Field, typename Group, typename Transcript, typename Settings> using VerifierTurboRangeWidget = widget::GenericVerifierWidget<Field, Transcript, Settings, widget::TurboRangeKernel>; -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/proof_system/CMakeLists.txt b/cpp/src/barretenberg/proof_system/CMakeLists.txt index 99041b45c2..3cb2621334 100644 --- a/cpp/src/barretenberg/proof_system/CMakeLists.txt +++ b/cpp/src/barretenberg/proof_system/CMakeLists.txt @@ -1 +1 @@ -barretenberg_module(proof_system plonk) \ No newline at end of file +barretenberg_module(proof_system polynomials crypto_pedersen) \ No newline at end of file diff --git a/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp b/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp index f62a121960..5175867bfd 100644 --- a/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp +++ b/cpp/src/barretenberg/proof_system/arithmetization/gate_data.hpp @@ -3,7 +3,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/common/serialize.hpp" -namespace bonk { +namespace proof_system { struct add_triple { uint32_t a; uint32_t b; @@ -121,4 +121,4 @@ struct ecc_add_gate { barretenberg::fr endomorphism_coefficient; barretenberg::fr sign_coefficient; }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp b/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp index ee2cbb9fff..2f1f190805 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.cpp @@ -1,6 +1,6 @@ #include "circuit_constructor_base.hpp" -namespace bonk { +namespace proof_system { /** * Join variable class b to variable class a. @@ -43,4 +43,4 @@ void CircuitConstructorBase<Arithmetization>::assert_equal(const uint32_t a_vari // Standard honk/ plonk instantiation template class CircuitConstructorBase<arithmetization::Standard>; template class CircuitConstructorBase<arithmetization::Turbo>; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp b/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp index 619d8fbffd..325349708d 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/circuit_constructor_base.hpp @@ -4,7 +4,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include <utility> -namespace bonk { +namespace proof_system { static constexpr uint32_t DUMMY_TAG = 0; template <typename Arithmetization> class CircuitConstructorBase { @@ -236,7 +236,7 @@ template <typename Arithmetization> class CircuitConstructorBase { } }; -} // namespace bonk +} // namespace proof_system // TODO(#217)(Cody): This will need updating based on the approach we take to ensure no multivariate is zero. /** diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp b/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp index 7960064700..61c6ed8de5 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace bonk { +namespace proof_system { /** * Create an addition gate. @@ -496,4 +496,4 @@ bool StandardCircuitConstructor::check_circuit() } return true; } -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp b/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp index b1e03f89b3..b627b17a9b 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp @@ -1,10 +1,10 @@ #pragma once #include <array> #include "circuit_constructor_base.hpp" -#include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" -namespace bonk { +namespace proof_system { inline std::vector<std::string> standard_selector_names() { std::vector<std::string> result{ "q_m", "q_1", "q_2", "q_3", "q_c" }; @@ -23,7 +23,7 @@ class StandardCircuitConstructor : public CircuitConstructorBase<arithmetization std::vector<barretenberg::fr>& q_3 = std::get<3>(selectors); std::vector<barretenberg::fr>& q_c = std::get<4>(selectors); - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD_HONK; // TODO(Cody): Get rid of this. + static constexpr ComposerType type = ComposerType::STANDARD_HONK; // TODO(Cody): Get rid of this. static constexpr size_t UINT_LOG2_BASE = 2; // These are variables that we have used a gate on, to enforce that they are @@ -101,4 +101,4 @@ class StandardCircuitConstructor : public CircuitConstructorBase<arithmetization bool check_circuit(); }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.test.cpp b/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.test.cpp index 3822ad63fe..3dcd8dab1a 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.test.cpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.test.cpp @@ -4,7 +4,7 @@ #include "barretenberg/crypto/pedersen/generator_data.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; namespace { auto& engine = numeric::random::get_debug_engine(); diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.cpp b/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.cpp index 6a4042b07b..517587f750 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.cpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace bonk { +namespace proof_system { /** * Turbo circuit initialization, where you can specify the probable number of gates in your circuit. @@ -1509,4 +1509,4 @@ bool TurboCircuitConstructor::check_circuit() #endif } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp b/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp index 1a982d86ce..71dcca5c5e 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp @@ -1,10 +1,10 @@ #pragma once #include <array> #include "circuit_constructor_base.hpp" -#include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" +#include "barretenberg/proof_system/types/composer_type.hpp" -namespace bonk { +namespace proof_system { inline std::vector<std::string> turbo_selector_names() { @@ -32,7 +32,7 @@ class TurboCircuitConstructor : public CircuitConstructorBase<arithmetization::T std::vector<barretenberg::fr>& q_range = std::get<9>(selectors); std::vector<barretenberg::fr>& q_logic = std::get<10>(selectors); - static constexpr plonk::ComposerType type = plonk::ComposerType::TURBO; + static constexpr ComposerType type = ComposerType::TURBO; static constexpr size_t UINT_LOG2_BASE = 2; TurboCircuitConstructor(const size_t size_hint = 0); @@ -114,4 +114,4 @@ class TurboCircuitConstructor : public CircuitConstructorBase<arithmetization::T // these are variables that we have used a gate on, to enforce that they are equal to a defined value std::map<barretenberg::fr, uint32_t> constant_variable_indices; }; -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp b/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp index 3be6bbea1e..1efacb4622 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.test.cpp @@ -8,7 +8,7 @@ using namespace crypto::pedersen; namespace { auto& engine = numeric::random::get_debug_engine(); } -namespace bonk { +namespace proof_system { TEST(turbo_circuit_constructor, base_case) { TurboCircuitConstructor circuit_constructor = TurboCircuitConstructor(); @@ -687,4 +687,4 @@ TEST(turbo_circuit_constructor, big_add_gate_with_bit_extract) EXPECT_EQ(result, true); } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp b/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp index c26a3380f5..d606ab173d 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace bonk { +namespace proof_system { void UltraCircuitConstructor::finalize_circuit() { @@ -2321,4 +2321,4 @@ void UltraCircuitConstructor::process_RAM_arrays(const size_t gate_offset_from_p } } -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp b/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp index fe9d23830f..65f73f724d 100644 --- a/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp +++ b/cpp/src/barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp @@ -1,6 +1,6 @@ #pragma once #include "barretenberg/proof_system/arithmetization/arithmetization.hpp" -#include "barretenberg/proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" #include "circuit_constructor_base.hpp" #include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/proof_system/flavor/flavor.hpp" @@ -10,9 +10,9 @@ #include "barretenberg/plonk/proof_system/types/prover_settings.hpp" #include <optional> -namespace bonk { +namespace proof_system { -static constexpr plonk::ComposerType type = plonk::ComposerType::PLOOKUP; +static constexpr ComposerType type = ComposerType::PLOOKUP; static constexpr plonk::MerkleHashType merkle_hash_type = plonk::MerkleHashType::LOOKUP_PEDERSEN; static constexpr size_t NUM_RESERVED_GATES = 4; // This must be >= num_roots_cut_out_of_vanishing_polynomial // See the comment in plonk/proof_system/prover/prover.cpp @@ -167,7 +167,7 @@ class UltraCircuitConstructor : public CircuitConstructorBase<arithmetization::U // TODO(#216)(Kesha): replace this with Honk enums after we have a verifier and no longer depend on plonk // prover/verifier - static constexpr plonk::ComposerType type = plonk::ComposerType::STANDARD_HONK; + static constexpr ComposerType type = ComposerType::STANDARD_HONK; static constexpr size_t UINT_LOG2_BASE = 2; // These are variables that we have used a gate on, to enforce that they are @@ -536,4 +536,4 @@ class UltraCircuitConstructor : public CircuitConstructorBase<arithmetization::U void process_RAM_array(const size_t ram_id, const size_t gate_offset_from_public_inputs); void process_RAM_arrays(const size_t gate_offset_from_public_inputs); }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.cpp b/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.cpp deleted file mode 100644 index 0ea9320ccd..0000000000 --- a/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/** - * @file composer_helper_lib.cpp - * @brief Contains implementations of some of the functions used both by Honk and Plonk-style composers (excluding - * permutation functions) - * - */ -#include "composer_helper_lib.hpp" -#include "barretenberg/honk/pcs/commitment_key.hpp" -#include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp" -#include "barretenberg/proof_system/circuit_constructors/turbo_circuit_constructor.hpp" -#include "barretenberg/proof_system/circuit_constructors/ultra_circuit_constructor.hpp" -namespace bonk { - -/** - * @brief Initialize proving key and load the crs - * - * @tparam CircuitConstructor Class containing the circuit - * @param circuit_constructor Object containing the circuit - * @param minimum_circuit_size The minimum size of polynomials without randomized elements - * @param num_randomized_gates Number of gates with randomized witnesses - * @param composer_type The type of composer we are using - * @return std::shared_ptr<bonk::proving_key> - */ -template <typename CircuitConstructor> -std::shared_ptr<bonk::proving_key> initialize_proving_key(const CircuitConstructor& circuit_constructor, - bonk::ReferenceStringFactory* crs_factory, - const size_t minimum_circuit_size, - const size_t num_randomized_gates, - plonk::ComposerType composer_type) -{ - const size_t num_gates = circuit_constructor.num_gates; - std::span<const uint32_t> public_inputs = circuit_constructor.public_inputs; - - const size_t num_public_inputs = public_inputs.size(); - const size_t num_constraints = num_gates + num_public_inputs; - const size_t total_num_constraints = std::max(minimum_circuit_size, num_constraints); - const size_t subgroup_size = - circuit_constructor.get_circuit_subgroup_size(total_num_constraints + num_randomized_gates); // next power of 2 - - auto crs = crs_factory->get_prover_crs(subgroup_size + 1); - - return std::make_shared<bonk::proving_key>(subgroup_size, num_public_inputs, crs, composer_type); -} - -/** - * @brief Construct lagrange selector polynomials from ciruit selector information and put into polynomial cache - * - * @tparam CircuitConstructor The class holding the circuit - * @param circuit_constructor The object holding the circuit - * @param key Pointer to the proving key - */ -template <typename CircuitConstructor> -void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constructor, - bonk::proving_key* circuit_proving_key) -{ - const size_t num_public_inputs = circuit_constructor.public_inputs.size(); - for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { - std::span<const barretenberg::fr> selector_values = circuit_constructor.selectors[j]; - ASSERT(circuit_proving_key->circuit_size >= selector_values.size()); - - // Compute selector vector, initialized to 0. - // Copy the selector values for all gates, keeping the rows at which we store public inputs as 0. - // Initializing the polynomials in this way automatically applies 0-padding to the selectors. - barretenberg::polynomial selector_poly_lagrange(circuit_proving_key->circuit_size); - for (size_t i = 0; i < selector_values.size(); ++i) { - selector_poly_lagrange[num_public_inputs + i] = selector_values[i]; - } - // TODO(#217)(Adrian): We may want to add a unique value (e.g. j+1) in the last position of each selector - // polynomial to guard against some edge cases that may occur during the MSM. If we do so, we should ensure that - // this does not clash with any other values we want to place at the end of of the witness vectors. In later - // iterations of the Sumcheck, we will be able to efficiently cancel out any checks in the last 2^k rows, so any - // randomness or unique values should be placed there. - circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", - std::move(selector_poly_lagrange)); - } -} - -/** - * @brief Fill the last index of each selector polynomial in lagrange form with a non-zero value - * - * @tparam CircuitConstructor The class holding the circuit - * @param circuit_constructor The object holding the circuit - * @param key Pointer to the proving key - */ -template <typename CircuitConstructor> -void enforce_nonzero_polynomial_selectors(const CircuitConstructor& circuit_constructor, - bonk::proving_key* circuit_proving_key) -{ - for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { - auto current_selector = - circuit_proving_key->polynomial_store.get(circuit_constructor.selector_names_[j] + "_lagrange"); - current_selector[current_selector.size() - 1] = j + 1; - circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", - std::move(current_selector)); - } -} - -/** - * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into - * cache - * - * @param key Pointer to the proving key - * @param selector_properties Names of selectors - */ -void compute_monomial_and_coset_selector_forms(bonk::proving_key* circuit_proving_key, - std::vector<SelectorProperties> selector_properties) -{ - for (size_t i = 0; i < selector_properties.size(); i++) { - // Compute monomial form of selector polynomial - auto& selector_poly_lagrange = - circuit_proving_key->polynomial_store.get(selector_properties[i].name + "_lagrange"); - barretenberg::polynomial selector_poly(circuit_proving_key->circuit_size); - barretenberg::polynomial_arithmetic::ifft( - &selector_poly_lagrange[0], &selector_poly[0], circuit_proving_key->small_domain); - - // Compute coset FFT of selector polynomial - barretenberg::polynomial selector_poly_fft(selector_poly, circuit_proving_key->circuit_size * 4 + 4); - selector_poly_fft.coset_fft(circuit_proving_key->large_domain); - - // TODO(luke): For Standard/Turbo, the lagrange polynomials can be removed from the store at this point but this - // is not the case for Ultra. Implement? - circuit_proving_key->polynomial_store.put(selector_properties[i].name, std::move(selector_poly)); - circuit_proving_key->polynomial_store.put(selector_properties[i].name + "_fft", std::move(selector_poly_fft)); - } -} - -/** - * Compute witness polynomials (w_1, w_2, w_3, w_4) and put them into polynomial cache - * - * @details Fills 3 or 4 witness polynomials w_1, w_2, w_3, w_4 with the values of in-circuit variables. The beginning - * of w_1, w_2 polynomials is filled with public_input values. - * @return Witness with computed witness polynomials. - * - * @tparam Program settings needed to establish if w_4 is being used. - * */ -template <typename CircuitConstructor> -std::vector<barretenberg::polynomial> compute_witness_base(const CircuitConstructor& circuit_constructor, - const size_t minimum_circuit_size, - const size_t number_of_randomized_gates) -{ - const size_t program_width = CircuitConstructor::program_width; - const size_t num_gates = circuit_constructor.num_gates; - std::span<const uint32_t> public_inputs = circuit_constructor.public_inputs; - const size_t num_public_inputs = public_inputs.size(); - - const size_t num_constraints = std::max(minimum_circuit_size, num_gates + num_public_inputs); - // TODO(#216)(Adrian): Not a fan of specifying NUM_RANDOMIZED_GATES everywhere, - // Each flavor of Honk should have a "fixed" number of random places to add randomness to. - // It should be taken care of in as few places possible. - const size_t subgroup_size = - circuit_constructor.get_circuit_subgroup_size(num_constraints + number_of_randomized_gates); - - // construct a view over all the wire's variable indices - // w[j][i] is the index of the variable in the j-th wire, at gate i - // Each array should be of size `num_gates` - std::array<std::span<const uint32_t>, program_width> w; - w[0] = circuit_constructor.w_l; - w[1] = circuit_constructor.w_r; - w[2] = circuit_constructor.w_o; - if constexpr (program_width > 3) { - w[3] = circuit_constructor.w_4; - } - std::vector<barretenberg::polynomial> wires; - // Note: randomness is added to 3 of the last 4 positions in plonk/proof_system/prover/prover.cpp - // StandardProverBase::execute_preamble_round(). - for (size_t j = 0; j < program_width; ++j) { - // Initialize the polynomial with all the actual copies variable values - // Expect all values to be set to 0 initially - barretenberg::polynomial w_lagrange(subgroup_size); - - // Place all public inputs at the start of w_l and w_r. - // All selectors at these indices are set to 0 so these values are not constrained at all. - if ((j == 0) || (j == 1)) { - for (size_t i = 0; i < num_public_inputs; ++i) { - w_lagrange[i] = circuit_constructor.get_variable(public_inputs[i]); - } - } - - // Assign the variable values (which are pointed-to by the `w_` wires) to the wire witness polynomials - // `poly_w_`, shifted to make room for the public inputs at the beginning. - for (size_t i = 0; i < num_gates; ++i) { - w_lagrange[num_public_inputs + i] = circuit_constructor.get_variable(w[j][i]); - } - wires.push_back(std::move(w_lagrange)); - } - return wires; -} - -/** - * @brief Computes the verification key by computing the: - * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, - * (2) sets the polynomial manifest using the data from proving key. - */ -std::shared_ptr<bonk::verification_key> compute_verification_key_common( - std::shared_ptr<bonk::proving_key> const& proving_key, std::shared_ptr<bonk::VerifierReferenceString> const& vrs) -{ - auto circuit_verification_key = std::make_shared<bonk::verification_key>( - proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->composer_type); - // TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc - auto commitment_key = honk::pcs::kzg::CommitmentKey(proving_key->circuit_size, "../srs_db/ignition"); - - for (size_t i = 0; i < proving_key->polynomial_manifest.size(); ++i) { - const auto& poly_info = proving_key->polynomial_manifest[i]; - - const std::string poly_label(poly_info.polynomial_label); - const std::string selector_commitment_label(poly_info.commitment_label); - - if (poly_info.source == bonk::PolynomialSource::SELECTOR || - poly_info.source == bonk::PolynomialSource::PERMUTATION || - poly_info.source == bonk::PolynomialSource::OTHER) { - // Fetch the polynomial in its vector form. - - // Commit to the constraint selector polynomial and insert the commitment in the verification key. - - auto poly_commitment = commitment_key.commit(proving_key->polynomial_store.get(poly_label)); - circuit_verification_key->commitments.insert({ selector_commitment_label, poly_commitment }); - } - } - - // Set the polynomial manifest in verification key. - circuit_verification_key->polynomial_manifest = bonk::PolynomialManifest(proving_key->composer_type); - - return circuit_verification_key; -} -// Ensure we compile all versions so that there are no issues during linkage -#define COMPILE_FOR_CIRCUIT_CONSTRUCTOR(circuit_constructor) \ - template std::shared_ptr<bonk::proving_key> initialize_proving_key<circuit_constructor>( \ - const circuit_constructor&, bonk::ReferenceStringFactory*, const size_t, const size_t, plonk::ComposerType); \ - template void construct_lagrange_selector_forms<circuit_constructor>(const circuit_constructor&, \ - bonk::proving_key*); \ - template std::vector<barretenberg::polynomial> compute_witness_base<circuit_constructor>( \ - const circuit_constructor&, const size_t, const size_t); \ - template void enforce_nonzero_polynomial_selectors<circuit_constructor>(const circuit_constructor& constructor, \ - bonk::proving_key* circuit_proving_key); - -COMPILE_FOR_CIRCUIT_CONSTRUCTOR(StandardCircuitConstructor) -COMPILE_FOR_CIRCUIT_CONSTRUCTOR(TurboCircuitConstructor) -COMPILE_FOR_CIRCUIT_CONSTRUCTOR(UltraCircuitConstructor) - -} // namespace bonk diff --git a/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp b/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp index 7387270fb5..c31dfe13b9 100644 --- a/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp +++ b/cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp @@ -1,13 +1,8 @@ #pragma once -#include "barretenberg/proof_system/proving_key/proving_key.hpp" -#include "barretenberg/proof_system/verification_key/verification_key.hpp" -#include "barretenberg/polynomials/polynomial_arithmetic.hpp" -#include "barretenberg/polynomials/polynomial.hpp" -namespace bonk { -struct SelectorProperties { - std::string name; - bool requires_lagrange_base_polynomial = false; // does the prover need the raw lagrange-base selector values? -}; +#include <memory> +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" + +namespace proof_system { /** * @brief Initialize proving key and load the crs @@ -17,24 +12,61 @@ struct SelectorProperties { * @param minimum_circuit_size The minimum size of polynomials without randomized elements * @param num_randomized_gates Number of gates with randomized witnesses * @param composer_type The type of composer we are using - * @return std::shared_ptr<bonk::proving_key> + * @return std::shared_ptr<plonk::proving_key> */ template <typename CircuitConstructor> -std::shared_ptr<bonk::proving_key> initialize_proving_key(const CircuitConstructor& circuit_constructor, - bonk::ReferenceStringFactory* crs_factory, - const size_t minimum_circuit_size, - const size_t num_randomized_gates, - plonk::ComposerType composer_type); +std::shared_ptr<plonk::proving_key> initialize_proving_key(const CircuitConstructor& circuit_constructor, + ReferenceStringFactory* crs_factory, + const size_t minimum_circuit_size, + const size_t num_randomized_gates, + ComposerType composer_type) +{ + const size_t num_gates = circuit_constructor.num_gates; + std::span<const uint32_t> public_inputs = circuit_constructor.public_inputs; + + const size_t num_public_inputs = public_inputs.size(); + const size_t num_constraints = num_gates + num_public_inputs; + const size_t total_num_constraints = std::max(minimum_circuit_size, num_constraints); + const size_t subgroup_size = + circuit_constructor.get_circuit_subgroup_size(total_num_constraints + num_randomized_gates); // next power of 2 + + auto crs = crs_factory->get_prover_crs(subgroup_size + 1); + + return std::make_shared<plonk::proving_key>(subgroup_size, num_public_inputs, crs, composer_type); +} /** - * @brief Construct lagrange selector polynomials from circuit selector information and put into polynomial cache + * @brief Construct lagrange selector polynomials from ciruit selector information and put into polynomial cache * * @tparam CircuitConstructor The class holding the circuit * @param circuit_constructor The object holding the circuit * @param key Pointer to the proving key */ template <typename CircuitConstructor> -void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constructor, bonk::proving_key* key); +void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constructor, + plonk::proving_key* circuit_proving_key) +{ + const size_t num_public_inputs = circuit_constructor.public_inputs.size(); + for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { + std::span<const barretenberg::fr> selector_values = circuit_constructor.selectors[j]; + ASSERT(circuit_proving_key->circuit_size >= selector_values.size()); + + // Compute selector vector, initialized to 0. + // Copy the selector values for all gates, keeping the rows at which we store public inputs as 0. + // Initializing the polynomials in this way automatically applies 0-padding to the selectors. + barretenberg::polynomial selector_poly_lagrange(circuit_proving_key->circuit_size); + for (size_t i = 0; i < selector_values.size(); ++i) { + selector_poly_lagrange[num_public_inputs + i] = selector_values[i]; + } + // TODO(#217)(Adrian): We may want to add a unique value (e.g. j+1) in the last position of each selector + // polynomial to guard against some edge cases that may occur during the MSM. If we do so, we should ensure that + // this does not clash with any other values we want to place at the end of of the witness vectors. In later + // iterations of the Sumcheck, we will be able to efficiently cancel out any checks in the last 2^k rows, so any + // randomness or unique values should be placed there. + circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", + std::move(selector_poly_lagrange)); + } +} /** * @brief Fill the last index of each selector polynomial in lagrange form with a non-zero value @@ -44,17 +76,17 @@ void construct_lagrange_selector_forms(const CircuitConstructor& circuit_constru * @param key Pointer to the proving key */ template <typename CircuitConstructor> -void enforce_nonzero_polynomial_selectors(const CircuitConstructor& circuit_constructor, bonk::proving_key* key); - -/** - * @brief Retrieve lagrange forms of selector polynomials and compute monomial and coset-monomial forms and put into - * cache - * - * @param key Pointer to the proving key - * @param selector_properties Names of selectors - */ -void compute_monomial_and_coset_selector_forms(bonk::proving_key* key, - std::vector<SelectorProperties> selector_properties); +void enforce_nonzero_polynomial_selectors(const CircuitConstructor& circuit_constructor, + plonk::proving_key* circuit_proving_key) +{ + for (size_t j = 0; j < circuit_constructor.num_selectors; ++j) { + auto current_selector = + circuit_proving_key->polynomial_store.get(circuit_constructor.selector_names_[j] + "_lagrange"); + current_selector[current_selector.size() - 1] = j + 1; + circuit_proving_key->polynomial_store.put(circuit_constructor.selector_names_[j] + "_lagrange", + std::move(current_selector)); + } +} /** * Compute witness polynomials (w_1, w_2, w_3, w_4) and put them into polynomial cache @@ -68,14 +100,53 @@ void compute_monomial_and_coset_selector_forms(bonk::proving_key* key, template <typename CircuitConstructor> std::vector<barretenberg::polynomial> compute_witness_base(const CircuitConstructor& circuit_constructor, const size_t minimum_circuit_size, - const size_t number_of_randomized_gates); + const size_t number_of_randomized_gates) +{ + const size_t program_width = CircuitConstructor::program_width; + const size_t num_gates = circuit_constructor.num_gates; + std::span<const uint32_t> public_inputs = circuit_constructor.public_inputs; + const size_t num_public_inputs = public_inputs.size(); -/** - * @brief Computes the verification key by computing the: - * (1) commitments to the selector, permutation, and lagrange (first/last) polynomials, - * (2) sets the polynomial manifest using the data from proving key. - */ -std::shared_ptr<bonk::verification_key> compute_verification_key_common( - std::shared_ptr<bonk::proving_key> const& proving_key, std::shared_ptr<bonk::VerifierReferenceString> const& vrs); + const size_t num_constraints = std::max(minimum_circuit_size, num_gates + num_public_inputs); + // TODO(#216)(Adrian): Not a fan of specifying NUM_RANDOMIZED_GATES everywhere, + // Each flavor of Honk should have a "fixed" number of random places to add randomness to. + // It should be taken care of in as few places possible. + const size_t subgroup_size = + circuit_constructor.get_circuit_subgroup_size(num_constraints + number_of_randomized_gates); + + // construct a view over all the wire's variable indices + // w[j][i] is the index of the variable in the j-th wire, at gate i + // Each array should be of size `num_gates` + std::array<std::span<const uint32_t>, program_width> w; + w[0] = circuit_constructor.w_l; + w[1] = circuit_constructor.w_r; + w[2] = circuit_constructor.w_o; + if constexpr (program_width > 3) { + w[3] = circuit_constructor.w_4; + } + std::vector<barretenberg::polynomial> wires; + // Note: randomness is added to 3 of the last 4 positions in plonk/proof_system/prover/prover.cpp + // StandardProverBase::execute_preamble_round(). + for (size_t j = 0; j < program_width; ++j) { + // Initialize the polynomial with all the actual copies variable values + // Expect all values to be set to 0 initially + barretenberg::polynomial w_lagrange(subgroup_size); + + // Place all public inputs at the start of w_l and w_r. + // All selectors at these indices are set to 0 so these values are not constrained at all. + if ((j == 0) || (j == 1)) { + for (size_t i = 0; i < num_public_inputs; ++i) { + w_lagrange[i] = circuit_constructor.get_variable(public_inputs[i]); + } + } -} // namespace bonk + // Assign the variable values (which are pointed-to by the `w_` wires) to the wire witness polynomials + // `poly_w_`, shifted to make room for the public inputs at the beginning. + for (size_t i = 0; i < num_gates; ++i) { + w_lagrange[num_public_inputs + i] = circuit_constructor.get_variable(w[j][i]); + } + wires.push_back(std::move(w_lagrange)); + } + return wires; +} +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp b/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp index d9baedaef4..793204ea11 100644 --- a/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp +++ b/cpp/src/barretenberg/proof_system/composer/permutation_helper.hpp @@ -10,7 +10,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/polynomials/polynomial.hpp" -#include "barretenberg/proof_system/proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" #include <algorithm> #include <cstdint> @@ -21,7 +21,7 @@ #include <utility> #include <vector> -namespace bonk { +namespace proof_system { /** * @brief cycle_node represents the index of a value of the circuit. @@ -131,8 +131,8 @@ std::vector<CyclicPermutation> compute_wire_copy_cycles(const CircuitConstructor * @param key Pointer to the proving key */ template <size_t program_width, typename CircuitConstructor> -std::array<std::vector<permutation_subgroup_element>, program_width> compute_basic_bonk_sigma_permutations( - const CircuitConstructor& circuit_constructor, bonk::proving_key* key) +std::array<std::vector<permutation_subgroup_element>, program_width> compute_basic_proof_system_sigma_permutations( + const CircuitConstructor& circuit_constructor, plonk::proving_key* key) { // Compute wire copy cycles (cycles of permutations) auto wire_copy_cycles = compute_wire_copy_cycles<program_width>(circuit_constructor); @@ -192,7 +192,7 @@ std::array<std::vector<permutation_subgroup_element>, program_width> compute_bas */ template <size_t program_width> void compute_honk_style_sigma_lagrange_polynomials_from_mapping( - std::array<std::vector<permutation_subgroup_element>, program_width>& sigma_mappings, bonk::proving_key* key) + std::array<std::vector<permutation_subgroup_element>, program_width>& sigma_mappings, plonk::proving_key* key) { const size_t num_gates = key->circuit_size; @@ -317,7 +317,7 @@ template <size_t program_width> void compute_plonk_permutation_lagrange_polynomials_from_mapping( std::string label, std::array<std::vector<permutation_subgroup_element>, program_width>& mappings, - bonk::proving_key* key) + plonk::proving_key* key) { for (size_t i = 0; i < program_width; i++) { std::string index = std::to_string(i + 1); @@ -337,7 +337,7 @@ void compute_plonk_permutation_lagrange_polynomials_from_mapping( * @param key Pointer to the proving key */ template <size_t program_width> -void compute_monomial_and_coset_fft_polynomials_from_lagrange(std::string label, bonk::proving_key* key) +void compute_monomial_and_coset_fft_polynomials_from_lagrange(std::string label, plonk::proving_key* key) { for (size_t i = 0; i < program_width; ++i) { std::string index = std::to_string(i + 1); @@ -400,10 +400,10 @@ void compute_standard_honk_id_polynomials(auto key) // proving_key* and shared_p */ // TODO(#293): Update this (and all similar functions) to take a smart pointer. template <size_t program_width, typename CircuitConstructor> -void compute_standard_honk_sigma_permutations(CircuitConstructor& circuit_constructor, bonk::proving_key* key) +void compute_standard_honk_sigma_permutations(CircuitConstructor& circuit_constructor, plonk::proving_key* key) { // Compute the permutation table specifying which element becomes which - auto sigma_mappings = compute_basic_bonk_sigma_permutations<program_width>(circuit_constructor, key); + auto sigma_mappings = compute_basic_proof_system_sigma_permutations<program_width>(circuit_constructor, key); // Compute Honk-style sigma polynomial fromt the permutation table compute_honk_style_sigma_lagrange_polynomials_from_mapping(sigma_mappings, key); } @@ -417,10 +417,10 @@ void compute_standard_honk_sigma_permutations(CircuitConstructor& circuit_constr * @param key Pointer to a proving key */ template <size_t program_width, typename CircuitConstructor> -void compute_standard_plonk_sigma_permutations(CircuitConstructor& circuit_constructor, bonk::proving_key* key) +void compute_standard_plonk_sigma_permutations(CircuitConstructor& circuit_constructor, plonk::proving_key* key) { // Compute the permutation table specifying which element becomes which - auto sigma_mappings = compute_basic_bonk_sigma_permutations<program_width>(circuit_constructor, key); + auto sigma_mappings = compute_basic_proof_system_sigma_permutations<program_width>(circuit_constructor, key); // Compute Plonk-style sigma polynomials from the mapping compute_plonk_permutation_lagrange_polynomials_from_mapping("sigma", sigma_mappings, key); // Compute their monomial and coset versions @@ -453,7 +453,8 @@ inline void compute_first_and_last_lagrange_polynomials(auto key) // proving_key * @return std::array<std::vector<permutation_subgroup_element>, program_width> */ template <size_t program_width, typename CircuitConstructor> -void compute_plonk_generalized_sigma_permutations(const CircuitConstructor& circuit_constructor, bonk::proving_key* key) +void compute_plonk_generalized_sigma_permutations(const CircuitConstructor& circuit_constructor, + plonk::proving_key* key) { // Compute wire copy cycles for public and private variables auto wire_copy_cycles = compute_wire_copy_cycles<program_width>(circuit_constructor); @@ -536,4 +537,4 @@ void compute_plonk_generalized_sigma_permutations(const CircuitConstructor& circ compute_monomial_and_coset_fft_polynomials_from_lagrange<program_width>("id", key); } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp b/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp index 01b1e7c777..cd91bd4414 100644 --- a/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp +++ b/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.hpp @@ -6,12 +6,14 @@ #include <map> #include <string> #include <unordered_map> -namespace bonk { + +namespace proof_system { /** * @brief Basic storage class for Polynomials * * @tparam Fr */ +// TODO(Cody): Move into plonk namespace. template <typename Fr> class PolynomialStore { using Polynomial = barretenberg::Polynomial<Fr>; @@ -96,4 +98,4 @@ template <typename Fr> class PolynomialStore { typename std::unordered_map<std::string, Polynomial>::const_iterator end() const { return polynomial_map.end(); } }; -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp b/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp index f0486cccbf..a068cce790 100644 --- a/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp +++ b/cpp/src/barretenberg/proof_system/polynomial_store/polynomial_store.test.cpp @@ -4,7 +4,7 @@ #include "polynomial_store.hpp" #include "barretenberg/polynomials/polynomial.hpp" -namespace bonk { +namespace proof_system { using namespace barretenberg; using Fr = barretenberg::fr; @@ -111,4 +111,4 @@ TEST(PolynomialStore, RangeBasedFor) } } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/types/composer_type.hpp b/cpp/src/barretenberg/proof_system/types/composer_type.hpp new file mode 100644 index 0000000000..295967e136 --- /dev/null +++ b/cpp/src/barretenberg/proof_system/types/composer_type.hpp @@ -0,0 +1,6 @@ +#pragma once + +namespace proof_system { +// TODO(Cody) Get rid of this. +enum ComposerType { STANDARD, TURBO, PLOOKUP, STANDARD_HONK }; +} // namespace proof_system \ No newline at end of file diff --git a/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp b/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp index ef8e51616b..54d29fad31 100644 --- a/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp +++ b/cpp/src/barretenberg/proof_system/work_queue/work_queue.cpp @@ -3,9 +3,9 @@ #include "barretenberg/ecc/curves/bn254/scalar_multiplication/scalar_multiplication.hpp" #include "barretenberg/polynomials/polynomial_arithmetic.hpp" -namespace bonk { +namespace proof_system { -work_queue::work_queue(proving_key* prover_key, transcript::StandardTranscript* prover_transcript) +work_queue::work_queue(plonk::proving_key* prover_key, transcript::StandardTranscript* prover_transcript) : key(prover_key) , transcript(prover_transcript) , work_item_queue() @@ -305,4 +305,4 @@ std::vector<work_queue::work_item> work_queue::get_queue() const return work_item_queue; } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp b/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp index 88aff2c4c4..4cbf548149 100644 --- a/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp +++ b/cpp/src/barretenberg/proof_system/work_queue/work_queue.hpp @@ -1,9 +1,10 @@ #pragma once #include "../../transcript/transcript_wrappers.hpp" -#include "../proving_key/proving_key.hpp" +#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp" -namespace bonk { +namespace proof_system { +// TODO(Cody): Template by flavor? class work_queue { public: @@ -29,7 +30,7 @@ class work_queue { barretenberg::fr shift_factor; }; - work_queue(proving_key* prover_key = nullptr, transcript::StandardTranscript* prover_transcript = nullptr); + work_queue(plonk::proving_key* prover_key = nullptr, transcript::StandardTranscript* prover_transcript = nullptr); work_queue(const work_queue& other) = default; work_queue(work_queue&& other) = default; @@ -61,8 +62,8 @@ class work_queue { std::vector<work_item> get_queue() const; private: - proving_key* key; + plonk::proving_key* key; transcript::StandardTranscript* transcript; std::vector<work_item> work_item_queue; }; -} // namespace bonk \ No newline at end of file +} // namespace proof_system \ No newline at end of file diff --git a/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp b/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp index 9f91243678..e4eebec39f 100644 --- a/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp +++ b/cpp/src/barretenberg/srs/reference_string/env_reference_string.hpp @@ -1,7 +1,7 @@ /** * Create reference strings given an environment that implements env/crs.hpp. * Usable in both native and WASM code, but particularly useful for accessing - * reference strings from a WASM context. + * reference strings from a WASM context. * In a native context, the implementations assume a hard-coded string path. * For that reason, ideally this is only used in c-bind functions to maintain flexibility. */ @@ -17,7 +17,7 @@ #include <utility> #include <cstddef> -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -50,4 +50,4 @@ class EnvReferenceStringFactory : public ReferenceStringFactory { } }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp b/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp index b8c7e3787e..d71c5c34f9 100644 --- a/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp +++ b/cpp/src/barretenberg/srs/reference_string/env_reference_string.test.cpp @@ -9,9 +9,9 @@ TEST(reference_string, env_file_consistency) { - auto env_crs = std::make_unique<bonk::EnvReferenceStringFactory>(); + auto env_crs = std::make_unique<proof_system::EnvReferenceStringFactory>(); - auto file_crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto file_crs = std::make_unique<proof_system::FileReferenceStringFactory>("../srs_db/ignition"); auto file_verifier = file_crs->get_verifier_crs(); EXPECT_EQ(env_crs->get_verifier_crs()->get_g2x(), file_verifier->get_g2x()); @@ -19,8 +19,6 @@ TEST(reference_string, env_file_consistency) file_verifier->get_precomputed_g2_lines(), sizeof(barretenberg::pairing::miller_lines) * 2), 0); - EXPECT_EQ( - env_crs->get_prover_crs(1)->get_monomial_points()[0], - file_crs->get_prover_crs(1)->get_monomial_points()[0] - ); + EXPECT_EQ(env_crs->get_prover_crs(1)->get_monomial_points()[0], + file_crs->get_prover_crs(1)->get_monomial_points()[0]); } diff --git a/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp b/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp index e4dbae0bdd..99f09c776c 100644 --- a/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp +++ b/cpp/src/barretenberg/srs/reference_string/file_reference_string.cpp @@ -3,7 +3,7 @@ #include "barretenberg/ecc/curves/bn254/pairing.hpp" -namespace bonk { +namespace proof_system { VerifierFileReferenceString::VerifierFileReferenceString(std::string const& path) : precomputed_g2_lines( @@ -20,4 +20,4 @@ VerifierFileReferenceString::~VerifierFileReferenceString() aligned_free(precomputed_g2_lines); } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp b/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp index 02ff6e6a0a..ef6bebfc0a 100644 --- a/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp +++ b/cpp/src/barretenberg/srs/reference_string/file_reference_string.hpp @@ -15,7 +15,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -99,4 +99,4 @@ class DynamicFileReferenceStringFactory : public ReferenceStringFactory { std::shared_ptr<VerifierFileReferenceString> verifier_crs_; }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp b/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp index 8fe33b25f3..0a9c71b40a 100644 --- a/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp +++ b/cpp/src/barretenberg/srs/reference_string/mem_reference_string.cpp @@ -6,7 +6,7 @@ #include <sstream> -namespace bonk { +namespace proof_system { VerifierMemReferenceString::VerifierMemReferenceString(uint8_t const* g2x) : precomputed_g2_lines( @@ -23,4 +23,4 @@ VerifierMemReferenceString::~VerifierMemReferenceString() aligned_free(precomputed_g2_lines); } -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp b/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp index 95a9598b88..608446fa77 100644 --- a/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp +++ b/cpp/src/barretenberg/srs/reference_string/mem_reference_string.hpp @@ -11,7 +11,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -29,4 +29,4 @@ class VerifierMemReferenceString : public VerifierReferenceString { pairing::miller_lines* precomputed_g2_lines; }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp b/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp index 598d6aa9cf..18701cc537 100644 --- a/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp +++ b/cpp/src/barretenberg/srs/reference_string/mem_reference_string.test.cpp @@ -20,9 +20,9 @@ TEST(reference_string, mem_file_consistency) transcript.read((char*)g2x.data(), 128); transcript.close(); - auto mem_verifier = std::make_unique<bonk::VerifierMemReferenceString>(g2x.data()); + auto mem_verifier = std::make_unique<proof_system::VerifierMemReferenceString>(g2x.data()); - auto file_crs = std::make_unique<bonk::FileReferenceStringFactory>("../srs_db/ignition"); + auto file_crs = std::make_unique<proof_system::FileReferenceStringFactory>("../srs_db/ignition"); auto file_verifier = file_crs->get_verifier_crs(); EXPECT_EQ(mem_verifier->get_g2x(), file_verifier->get_g2x()); diff --git a/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp b/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp index f409b9225d..53c6867018 100644 --- a/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp +++ b/cpp/src/barretenberg/srs/reference_string/pippenger_reference_string.hpp @@ -9,7 +9,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { using namespace barretenberg; @@ -51,4 +51,4 @@ class PippengerReferenceStringFactory : public ReferenceStringFactory { uint8_t const* g2x_; }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/srs/reference_string/reference_string.hpp b/cpp/src/barretenberg/srs/reference_string/reference_string.hpp index 13033d9f37..e43d9fa798 100644 --- a/cpp/src/barretenberg/srs/reference_string/reference_string.hpp +++ b/cpp/src/barretenberg/srs/reference_string/reference_string.hpp @@ -10,7 +10,7 @@ namespace barretenberg::pairing { struct miller_lines; } // namespace barretenberg::pairing -namespace bonk { +namespace proof_system { class VerifierReferenceString { public: @@ -40,4 +40,4 @@ class ReferenceStringFactory { virtual std::shared_ptr<VerifierReferenceString> get_verifier_crs() { return nullptr; } }; -} // namespace bonk +} // namespace proof_system diff --git a/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp b/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp index fa45398119..6e99674ba9 100644 --- a/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp +++ b/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp @@ -11,13 +11,13 @@ using namespace crypto::aes128; using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace aes128 { constexpr uint32_t AES128_BASE = 9; -typedef plonk::stdlib::field_t<plonk::UltraComposer> field_t; -typedef plonk::stdlib::witness_t<plonk::UltraComposer> witness_t; +typedef stdlib::field_t<plonk::UltraComposer> field_t; +typedef stdlib::witness_t<plonk::UltraComposer> witness_t; typedef std::pair<field_t, field_t> byte_pair; @@ -296,4 +296,4 @@ std::vector<field_t> encrypt_buffer_cbc(const std::vector<field_t>& input, const } // namespace aes128 } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp b/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp index 14dea9b396..fc9dbfcc1d 100644 --- a/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp +++ b/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.hpp @@ -8,7 +8,7 @@ #include "../../primitives/field/field.hpp" #include "../../primitives/witness/witness.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace aes128 { @@ -19,4 +19,4 @@ std::vector<field_t<plonk::UltraComposer>> encrypt_buffer_cbc(const std::vector< } // namespace aes128 } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp b/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp index ca97c0b11e..da1fc78a6d 100644 --- a/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp +++ b/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.test.cpp @@ -7,12 +7,12 @@ #include <gtest/gtest.h> using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; TEST(stdlib_aes128, encrypt_64_bytes) { - typedef plonk::stdlib::field_t<plonk::UltraComposer> field_pt; - typedef plonk::stdlib::witness_t<plonk::UltraComposer> witness_pt; + typedef stdlib::field_t<plonk::UltraComposer> field_pt; + typedef stdlib::witness_t<plonk::UltraComposer> witness_pt; uint8_t key[16]{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; uint8_t out[64]{ 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, @@ -34,7 +34,7 @@ TEST(stdlib_aes128, encrypt_64_bytes) return converted; }; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::vector<field_pt> in_field{ witness_pt(&composer, fr(convert_bytes(in))), @@ -50,7 +50,7 @@ TEST(stdlib_aes128, encrypt_64_bytes) convert_bytes(out), convert_bytes(out + 16), convert_bytes(out + 32), convert_bytes(out + 48) }; - const auto result = plonk::stdlib::aes128::encrypt_buffer_cbc(in_field, iv_field, key_field); + const auto result = stdlib::aes128::encrypt_buffer_cbc(in_field, iv_field, key_field); for (size_t i = 0; i < 4; ++i) { EXPECT_EQ(result[i].get_value(), expected[i]); diff --git a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp index bdd67f46b4..c6ab50fbae 100644 --- a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp +++ b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp @@ -3,7 +3,7 @@ #include "../../primitives/byte_array/byte_array.hpp" #include "../../primitives/composers/composers_fwd.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace ecdsa { @@ -18,6 +18,6 @@ bool_t<Composer> verify_signature(const stdlib::byte_array<Composer>& message, const signature<Composer>& sig); } // namespace ecdsa } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk #include "./ecdsa_impl.hpp" \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp index 808bfbdf04..b1edc24d84 100644 --- a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp +++ b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp @@ -7,10 +7,10 @@ #include "barretenberg/common/test.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace test_stdlib_ecdsa { -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using curve = stdlib::secp256k1<Composer>; TEST(stdlib_ecdsa, verify_signature) diff --git a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp index 882a4b083a..12355453d6 100644 --- a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp +++ b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp @@ -2,7 +2,7 @@ #include "../../hash/sha256/sha256.hpp" #include "../../primitives/bit_array/bit_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace ecdsa { @@ -34,7 +34,7 @@ bool_t<Composer> verify_signature(const stdlib::byte_array<Composer>& message, G1 result; if constexpr (Composer::type == ComposerType::PLOOKUP) { - ASSERT(Curve::type == bonk::CurveType::SECP256K1); + ASSERT(Curve::type == proof_system::CurveType::SECP256K1); public_key.validate_on_curve(); result = G1::secp256k1_ecdsa_mul(public_key, u1, u2); } else { @@ -68,4 +68,4 @@ bool_t<Composer> verify_signature(const stdlib::byte_array<Composer>& message, } // namespace ecdsa } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp b/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp index 35ebcde4b9..86f419095c 100644 --- a/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp +++ b/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.cpp @@ -6,7 +6,7 @@ #include "../../primitives/composers/composers.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace schnorr { @@ -119,12 +119,12 @@ point<C> variable_base_mul(const point<C>& pub_key, const field_t<C>& low_bits, field_t<C> zero_test = (low_bits * high_bits); zero_test.assert_is_not_zero(); - const auto low_wnaf = plonk::stdlib::schnorr::convert_field_into_wnaf(context, low_bits); - const auto high_wnaf = plonk::stdlib::schnorr::convert_field_into_wnaf(context, high_bits); + const auto low_wnaf = stdlib::schnorr::convert_field_into_wnaf(context, low_bits); + const auto high_wnaf = stdlib::schnorr::convert_field_into_wnaf(context, high_bits); // current_accumulator is pub_key, so init is true, so high_output is [high_wnaf]pub_key - point<C> high_output = plonk::stdlib::schnorr::variable_base_mul(pub_key, pub_key, high_wnaf); + point<C> high_output = stdlib::schnorr::variable_base_mul(pub_key, pub_key, high_wnaf); // compute output = [low_wnaf]pub_key + [2^128]high_output. - point<C> output = plonk::stdlib::schnorr::variable_base_mul(pub_key, high_output, low_wnaf); + point<C> output = stdlib::schnorr::variable_base_mul(pub_key, high_output, low_wnaf); return output; } @@ -376,4 +376,4 @@ template signature_bits<plonk::UltraComposer> convert_signature<plonk::UltraComp plonk::UltraComposer*, const crypto::schnorr::signature&); } // namespace schnorr } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.hpp b/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.hpp index 1e47ba80f5..39a4ff4363 100644 --- a/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.hpp +++ b/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.hpp @@ -7,7 +7,7 @@ #include "../../primitives/point/point.hpp" #include "../../primitives/group/group.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace schnorr { @@ -90,4 +90,4 @@ extern template signature_bits<plonk::UltraComposer> convert_signature<plonk::Ul } // namespace schnorr } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp b/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp index c5e43842f7..08ae0dc983 100644 --- a/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp +++ b/cpp/src/barretenberg/stdlib/encryption/schnorr/schnorr.test.cpp @@ -7,8 +7,8 @@ namespace test_stdlib_schnorr { using namespace barretenberg; -using namespace plonk::stdlib::types; -using namespace plonk::stdlib::schnorr; +using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::schnorr; auto run_scalar_mul_test = [](grumpkin::fr scalar_mont, bool expect_verify) { Composer composer = Composer(); diff --git a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.cpp b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.cpp index d2a20d8137..dfbacf2baf 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.cpp +++ b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.cpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/stdlib/primitives/uint/uint.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace { @@ -144,4 +144,4 @@ template byte_array<plonk::TurboComposer> blake2s(const byte_array<plonk::TurboC template byte_array<plonk::UltraComposer> blake2s(const byte_array<plonk::UltraComposer>& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp index 242fbbc607..aeaf759b6c 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp +++ b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.hpp @@ -1,13 +1,13 @@ #pragma once #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { class StandardComposer; class TurboComposer; class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> byte_array<Composer> blake2s(const byte_array<Composer>& input); @@ -17,4 +17,4 @@ extern template byte_array<plonk::TurboComposer> blake2s(const byte_array<plonk: extern template byte_array<plonk::UltraComposer> blake2s(const byte_array<plonk::UltraComposer>& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp index ac920961f9..b61cbc305d 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp +++ b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s.test.cpp @@ -5,9 +5,9 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; typedef stdlib::byte_array<Composer> byte_array; typedef stdlib::byte_array<plonk::UltraComposer> byte_array_plookup; typedef stdlib::public_witness_t<Composer> public_witness_t; @@ -39,7 +39,7 @@ TEST(stdlib_blake2s, test_single_block) TEST(stdlib_blake2s, test_single_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01"; std::vector<uint8_t> input_v(input.begin(), input.end()); @@ -87,7 +87,7 @@ TEST(stdlib_blake2s, test_double_block) TEST(stdlib_blake2s, test_double_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789"; std::vector<uint8_t> input_v(input.begin(), input.end()); diff --git a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp index c967769cea..3fad189ef2 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp +++ b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.cpp @@ -16,7 +16,7 @@ * 2. replace use of uint32 with basic field_t type * **/ -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake2s_plookup { @@ -171,4 +171,4 @@ template byte_array<plonk::UltraComposer> blake2s(const byte_array<plonk::UltraC } // namespace blake2s_plookup } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp index 97452fbce6..a729018f9f 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp +++ b/cpp/src/barretenberg/stdlib/hash/blake2s/blake2s_plookup.hpp @@ -9,7 +9,7 @@ #include "../../primitives/composers/composers_fwd.hpp" #include "../../primitives/packed_byte_array/packed_byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake2s_plookup { @@ -21,4 +21,4 @@ extern template byte_array<plonk::UltraComposer> blake2s(const byte_array<plonk: } // namespace blake2s_plookup } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp b/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp index ce1e5ddc31..fe7650bbb5 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp +++ b/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/composer/plookup_tables/plookup_tables.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake_util { @@ -255,4 +255,4 @@ void round_fn_lookup(field_t<Composer> state[BLAKE3_STATE_SIZE], } // namespace blake_util } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp index f8af0692ac..dad4d64204 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp +++ b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.cpp @@ -5,7 +5,7 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include "../blake2s/blake_util.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake3_internal { @@ -264,4 +264,4 @@ template byte_array<plonk::TurboComposer> blake3s(const byte_array<plonk::TurboC template byte_array<plonk::UltraComposer> blake3s(const byte_array<plonk::UltraComposer>& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp index 70e4c14b2e..79e265586a 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp +++ b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.hpp @@ -1,12 +1,12 @@ #pragma once #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { class TurboComposer; class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> byte_array<Composer> blake3s(const byte_array<Composer>& input); @@ -16,4 +16,4 @@ extern template byte_array<plonk::TurboComposer> blake3s(const byte_array<plonk: extern template byte_array<plonk::UltraComposer> blake3s(const byte_array<plonk::UltraComposer>& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp index 3b9db59eec..583bd87db4 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp +++ b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s.test.cpp @@ -6,9 +6,9 @@ #include "barretenberg/plonk/composer/ultra_composer.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; -typedef plonk::TurboComposer Composer; +typedef proof_system::plonk::TurboComposer Composer; typedef stdlib::byte_array<Composer> byte_array; typedef stdlib::byte_array<plonk::UltraComposer> byte_array_plookup; typedef stdlib::public_witness_t<Composer> public_witness_t; @@ -52,7 +52,7 @@ TEST(stdlib_blake3s, test_single_block) TEST(stdlib_blake3s, test_single_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01"; std::vector<uint8_t> input_v(input.begin(), input.end()); @@ -100,7 +100,7 @@ TEST(stdlib_blake3s, test_double_block) TEST(stdlib_blake3s, test_double_block_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); std::string input = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789"; std::vector<uint8_t> input_v(input.begin(), input.end()); diff --git a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp index b27c488bea..3253483722 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp +++ b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.cpp @@ -8,7 +8,7 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake3s_plookup { @@ -264,4 +264,4 @@ template byte_array<plonk::UltraComposer> blake3s(const byte_array<plonk::UltraC } // namespace blake3s_plookup } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp index 4d8a077955..789c0b96bf 100644 --- a/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp +++ b/cpp/src/barretenberg/stdlib/hash/blake3s/blake3s_plookup.hpp @@ -9,7 +9,7 @@ #include "../../primitives/composers/composers_fwd.hpp" #include "../../primitives/packed_byte_array/packed_byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace blake3s_plookup { @@ -21,4 +21,4 @@ extern template byte_array<plonk::UltraComposer> blake3s(const byte_array<plonk: } // namespace blake3s_plookup } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp b/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp index 09489e028c..c35da9781c 100644 --- a/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp +++ b/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp @@ -3,7 +3,7 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include "barretenberg/common/constexpr_utils.hpp" #include "barretenberg/numeric/bitop/sparse_form.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -617,4 +617,4 @@ template <typename Composer> stdlib::byte_array<Composer> keccak<Composer>::hash template class keccak<plonk::UltraComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp b/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp index 5c8423a03f..ec52db7fab 100644 --- a/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp +++ b/cpp/src/barretenberg/stdlib/hash/keccak/keccak.hpp @@ -4,11 +4,11 @@ #include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp" #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> class bit_array; @@ -186,4 +186,4 @@ template <typename Composer> class keccak { extern template class keccak<plonk::UltraComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp b/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp index 5a914402c8..589d14dd0e 100644 --- a/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp +++ b/cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp @@ -6,9 +6,9 @@ #include "../../primitives/plookup/plookup.hpp" using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; -typedef plonk::UltraComposer Composer; +typedef proof_system::plonk::UltraComposer Composer; typedef stdlib::byte_array<Composer> byte_array; typedef stdlib::public_witness_t<Composer> public_witness_t; typedef stdlib::field_t<Composer> field_ct; diff --git a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp index 1f330830d0..5fd4073dea 100644 --- a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp +++ b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.bench.cpp @@ -43,7 +43,7 @@ void generate_test_pedersen_circuit(plonk::TurboComposer& turbo_composer, size_t plonk::stdlib::witness_t(&turbo_composer, barretenberg::fr::random_element())); for (size_t i = 0; i < num_repetitions; ++i) { - out = plonk::stdlib::pedersen<plonk::TurboComposer>::compress(left, out); + out = proof_system::plonk::stdlib::pedersen<plonk::TurboComposer>::compress(left, out); } } diff --git a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp index 5db83ffca1..d0ebf02f5a 100644 --- a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp +++ b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.cpp @@ -7,12 +7,12 @@ #include "../../primitives/composers/composers.hpp" #include "../../primitives/packed_byte_array/packed_byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; using namespace crypto::pedersen; -using namespace bonk; +using namespace proof_system; namespace { /** @@ -225,8 +225,8 @@ point<C> pedersen<C>::hash_single(const field_t& in, if (i > 0) { gates.create_fixed_group_add_gate(round_quad); } else { - if constexpr (C::type == plonk::PLOOKUP && - C::merkle_hash_type == plonk::MerkleHashType::FIXED_BASE_PEDERSEN) { + if constexpr (C::type == ComposerType::PLOOKUP && + C::merkle_hash_type == MerkleHashType::FIXED_BASE_PEDERSEN) { /* In TurboComposer, the selector q_5 is used to show that w_1 and w_2 are properly initialized to the * coordinates of P_s = (-s + 4^n)[g]. In UltraPlonK, we have removed q_5 for overall efficiency (it * would only be used here in this gate), but this presents us a cost in the present circuit: we must @@ -577,4 +577,4 @@ template class pedersen<plonk::TurboComposer>; template class pedersen<plonk::UltraComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp index 1f8b1afd52..c2cf7957ef 100644 --- a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp +++ b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp @@ -5,17 +5,17 @@ #include "../../primitives/point/point.hpp" #include "../../primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { constexpr uint64_t WNAF_MASK = crypto::pedersen::WNAF_MASK; template <typename ComposerContext> class pedersen { private: - typedef plonk::stdlib::field_t<ComposerContext> field_t; - typedef plonk::stdlib::point<ComposerContext> point; - typedef plonk::stdlib::byte_array<ComposerContext> byte_array; - typedef plonk::stdlib::bool_t<ComposerContext> bool_t; + typedef stdlib::field_t<ComposerContext> field_t; + typedef stdlib::point<ComposerContext> point; + typedef stdlib::byte_array<ComposerContext> byte_array; + typedef stdlib::bool_t<ComposerContext> bool_t; static point hash_single(const field_t& in, const crypto::pedersen::generator_index_t hash_index, @@ -54,4 +54,4 @@ extern template class pedersen<plonk::TurboComposer>; extern template class pedersen<plonk::UltraComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp index 725d09752f..5450ab5b8f 100644 --- a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp +++ b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.test.cpp @@ -9,7 +9,7 @@ namespace test_stdlib_pedersen { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); } @@ -454,7 +454,7 @@ typedef stdlib::field_t<plonk::UltraComposer> field_ct; typedef stdlib::witness_t<plonk::UltraComposer> witness_ct; TEST(stdlib_pedersen, test_pedersen_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); fr left_in = fr::random_element(); fr right_in = fr::random_element(); @@ -481,7 +481,7 @@ TEST(stdlib_pedersen, test_pedersen_plookup) TEST(stdlib_pedersen, test_compress_many_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::vector<fr> input_values{ fr::random_element(), fr::random_element(), fr::random_element(), @@ -513,7 +513,7 @@ TEST(stdlib_pedersen, test_compress_many_plookup) TEST(stdlib_pedersen, test_merkle_damgard_compress_plookup) { - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); std::vector<fr> input_values{ fr::random_element(), fr::random_element(), fr::random_element(), diff --git a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp index 6d708abee1..211b01e3fd 100644 --- a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp +++ b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_gates.hpp @@ -5,7 +5,7 @@ #include "../../primitives/point/point.hpp" #include "../../primitives/byte_array/byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -22,10 +22,9 @@ namespace stdlib { */ template <typename Composer> class pedersen_gates { public: - using fixed_group_add_quad = bonk::fixed_group_add_quad; - using fixed_group_init_quad = bonk::fixed_group_init_quad; - using add_quad = bonk::add_quad; - using ComposerType = plonk::ComposerType; + using fixed_group_add_quad = proof_system::fixed_group_add_quad; + using fixed_group_init_quad = proof_system::fixed_group_init_quad; + using add_quad = proof_system::add_quad; Composer* context; fixed_group_add_quad previous_add_quad; @@ -313,4 +312,4 @@ template <typename Composer> class pedersen_gates { }; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp index f2f3d85148..d7c062d77f 100644 --- a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp +++ b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.cpp @@ -6,9 +6,9 @@ #include "../../primitives/composers/composers.hpp" #include "../../primitives/plookup/plookup.hpp" -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; @@ -168,4 +168,4 @@ field_t<C> pedersen_plookup<C>::compress(const std::vector<field_t>& inputs, con template class pedersen_plookup<plonk::UltraComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp index bc01ff94a8..2d14bf73cb 100644 --- a/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp +++ b/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen_plookup.hpp @@ -4,15 +4,15 @@ #include "../../primitives/point/point.hpp" #include "../../primitives/packed_byte_array/packed_byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> class pedersen_plookup { private: - typedef plonk::stdlib::field_t<ComposerContext> field_t; - typedef plonk::stdlib::point<ComposerContext> point; - typedef plonk::stdlib::packed_byte_array<ComposerContext> packed_byte_array; - typedef plonk::stdlib::bool_t<ComposerContext> bool_t; + typedef stdlib::field_t<ComposerContext> field_t; + typedef stdlib::point<ComposerContext> point; + typedef stdlib::packed_byte_array<ComposerContext> packed_byte_array; + typedef stdlib::bool_t<ComposerContext> bool_t; enum AddType { LAMBDA, @@ -43,4 +43,4 @@ template <typename ComposerContext> class pedersen_plookup { extern template class pedersen_plookup<plonk::UltraComposer>; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp index 00d00082e1..1c5947c669 100644 --- a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp +++ b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.bench.cpp @@ -5,7 +5,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace benchmark; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; constexpr size_t NUM_HASHES = 8; constexpr size_t BYTES_PER_CHUNK = 512; diff --git a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp index 150f91b636..22bc5ac9de 100644 --- a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp +++ b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.cpp @@ -5,7 +5,7 @@ #include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace internal { constexpr uint32_t init_constants[8]{ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, @@ -186,4 +186,4 @@ template packed_byte_array<plonk::StandardComposer> sha256(const packed_byte_arr template packed_byte_array<plonk::TurboComposer> sha256(const packed_byte_array<plonk::TurboComposer>& input); template packed_byte_array<plonk::UltraComposer> sha256(const packed_byte_array<plonk::UltraComposer>& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp index ec30872a8f..57ec0a7253 100644 --- a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp +++ b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.hpp @@ -6,13 +6,13 @@ #include "sha256_plookup.hpp" -namespace plonk { +namespace proof_system::plonk { class UltraComposer; class StandardComposer; class TurboComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> class bit_array; @@ -41,4 +41,4 @@ extern template packed_byte_array<plonk::StandardComposer> sha256( extern template packed_byte_array<plonk::UltraComposer> sha256(const packed_byte_array<plonk::UltraComposer>& input); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp index b9d9d3add7..9379e2382a 100644 --- a/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp +++ b/cpp/src/barretenberg/stdlib/hash/sha256/sha256.test.cpp @@ -16,7 +16,8 @@ auto& engine = numeric::random::get_debug_engine(); namespace test_stdlib_sha256 { using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk; +using namespace proof_system::plonk::stdlib::types; constexpr uint64_t ror(uint64_t val, uint64_t shift) { @@ -111,7 +112,7 @@ std::array<uint64_t, 8> inner_block(std::array<uint64_t, 64>& w) TEST(stdlib_sha256, test_duplicate_proving_key) { - plonk::StandardComposer first_composer = plonk::StandardComposer(); + plonk::StandardComposer first_composer = StandardComposer(); stdlib::packed_byte_array input(&first_composer, "An 8 character password? Snow White and the 7 Dwarves.."); plonk::stdlib::sha256(input); auto prover = first_composer.create_prover(); @@ -124,7 +125,7 @@ TEST(stdlib_sha256, test_duplicate_proving_key) auto circuit_size = prover.circuit_size; // Test a second time with same keys and different input. - plonk::StandardComposer second_composer = plonk::StandardComposer(proving_key, verification_key, circuit_size); + plonk::StandardComposer second_composer = StandardComposer(proving_key, verification_key, circuit_size); stdlib::packed_byte_array input2(&second_composer, "An 8 character password? Snow White and the 9 Dwarves.."); plonk::stdlib::sha256(input2); auto second_prover = second_composer.create_prover(); @@ -137,14 +138,15 @@ TEST(stdlib_sha256, test_duplicate_proving_key) // TEST(stdlib_sha256_plookup, test_round) // { -// plonk::UltraComposer composer = plonk::UltraComposer(); +// plonk::UltraComposer composer = UltraComposer(); // std::array<uint64_t, 64> w_inputs; // std::array<plonk::stdlib::field_t<plonk::UltraComposer>, 64> w_elements; // for (size_t i = 0; i < 64; ++i) { // w_inputs[i] = engine.get_random_uint32(); -// w_elements[i] = plonk::stdlib::witness_t<plonk::UltraComposer>(&composer, barretenberg::fr(w_inputs[i])); +// w_elements[i] = stdlib::witness_t<plonk::UltraComposer>(&composer, +// barretenberg::fr(w_inputs[i])); // } // const auto expected = inner_block(w_inputs); @@ -167,15 +169,15 @@ TEST(stdlib_sha256, test_duplicate_proving_key) TEST(stdlib_sha256, test_plookup_55_bytes) { - typedef plonk::stdlib::field_t<plonk::UltraComposer> field_pt; - typedef plonk::stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; + typedef stdlib::field_t<plonk::UltraComposer> field_pt; + typedef stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; // 55 bytes is the largest number of bytes that can be hashed in a single block, // accounting for the single padding bit, and the 64 size bits required by the SHA-256 standard. - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input(&composer, "An 8 character password? Snow White and the 7 Dwarves.."); - packed_byte_array_pt output_bits = plonk::stdlib::sha256(input); + packed_byte_array_pt output_bits = stdlib::sha256(input); std::vector<field_pt> output = output_bits.to_unverified_byte_slices(4); @@ -206,7 +208,7 @@ TEST(stdlib_sha256, test_55_bytes) Composer composer = Composer(); packed_byte_array_ct input(&composer, "An 8 character password? Snow White and the 7 Dwarves.."); - packed_byte_array_ct output_bits = plonk::stdlib::sha256(input); + packed_byte_array_ct output_bits = stdlib::sha256(input); std::vector<field_ct> output = output_bits.to_unverified_byte_slices(4); @@ -232,13 +234,13 @@ TEST(stdlib_sha256, test_55_bytes) TEST(stdlib_sha256, test_NIST_vector_one_packed_byte_array) { - typedef plonk::stdlib::field_t<plonk::UltraComposer> field_pt; - typedef plonk::stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; + typedef stdlib::field_t<plonk::UltraComposer> field_pt; + typedef stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input(&composer, "abc"); - packed_byte_array_pt output_bytes = plonk::stdlib::sha256(input); + packed_byte_array_pt output_bytes = stdlib::sha256(input); std::vector<field_pt> output = output_bytes.to_unverified_byte_slices(4); EXPECT_EQ(uint256_t(output[0].get_value()).data[0], (uint64_t)0xBA7816BFU); EXPECT_EQ(uint256_t(output[1].get_value()).data[0], (uint64_t)0x8F01CFEAU); @@ -263,14 +265,14 @@ TEST(stdlib_sha256, test_NIST_vector_one_packed_byte_array) TEST(stdlib_sha256, test_NIST_vector_one) { - typedef plonk::stdlib::field_t<plonk::UltraComposer> field_pt; - typedef plonk::stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; + typedef stdlib::field_t<plonk::UltraComposer> field_pt; + typedef stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input(&composer, "abc"); - packed_byte_array_pt output_bits = plonk::stdlib::sha256(input); + packed_byte_array_pt output_bits = stdlib::sha256(input); std::vector<field_pt> output = output_bits.to_unverified_byte_slices(4); @@ -301,7 +303,7 @@ TEST(stdlib_sha256, test_NIST_vector_two) byte_array_ct input(&composer, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"); - byte_array_ct output_bits = plonk::stdlib::sha256<Composer>(input); + byte_array_ct output_bits = stdlib::sha256<Composer>(input); std::vector<field_ct> output = packed_byte_array_ct(output_bits).to_unverified_byte_slices(4); @@ -333,7 +335,7 @@ TEST(stdlib_sha256, test_NIST_vector_three) // one byte, 0xbd byte_array_ct input(&composer, std::vector<uint8_t>{ 0xbd }); - byte_array_ct output_bits = plonk::stdlib::sha256<Composer>(input); + byte_array_ct output_bits = stdlib::sha256<Composer>(input); std::vector<field_ct> output = packed_byte_array_ct(output_bits).to_unverified_byte_slices(4); @@ -364,7 +366,7 @@ TEST(stdlib_sha256, test_NIST_vector_four) // 4 bytes, 0xc98c8e55 byte_array_ct input(&composer, std::vector<uint8_t>{ 0xc9, 0x8c, 0x8e, 0x55 }); - byte_array_ct output_bits = plonk::stdlib::sha256<Composer>(input); + byte_array_ct output_bits = stdlib::sha256<Composer>(input); std::vector<field_ct> output = packed_byte_array_ct(output_bits).to_unverified_byte_slices(4); @@ -390,10 +392,10 @@ TEST(stdlib_sha256, test_NIST_vector_four) HEAVY_TEST(stdlib_sha256, test_NIST_vector_five) { - typedef plonk::stdlib::field_t<plonk::UltraComposer> field_pt; - typedef plonk::stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; + typedef stdlib::field_t<plonk::UltraComposer> field_pt; + typedef stdlib::packed_byte_array<plonk::UltraComposer> packed_byte_array_pt; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = UltraComposer(); packed_byte_array_pt input( &composer, @@ -408,7 +410,7 @@ HEAVY_TEST(stdlib_sha256, test_NIST_vector_five) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAA"); - packed_byte_array_pt output_bits = plonk::stdlib::sha256<plonk::UltraComposer>(input); + packed_byte_array_pt output_bits = stdlib::sha256<plonk::UltraComposer>(input); std::vector<field_pt> output = output_bits.to_unverified_byte_slices(4); @@ -442,7 +444,7 @@ TEST(stdlib_sha256, test_input_len_multiple) auto input_buf = std::vector<uint8_t>(inp, 1); byte_array_ct input(&composer, input_buf); - byte_array_ct output_bits = plonk::stdlib::sha256<Composer>(input); + byte_array_ct output_bits = stdlib::sha256<Composer>(input); auto circuit_output = output_bits.get_value(); @@ -486,7 +488,7 @@ TEST(stdlib_sha256, test_input_str_len_multiple) auto input_buf = std::vector<uint8_t>(input_str.begin(), input_str.end()); byte_array_ct input(&composer, input_buf); - byte_array_ct output_bits = plonk::stdlib::sha256<Composer>(input); + byte_array_ct output_bits = stdlib::sha256<Composer>(input); auto circuit_output = output_bits.get_value(); diff --git a/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp b/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp index c86ca33195..04a5632eab 100644 --- a/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp +++ b/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp @@ -10,7 +10,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace sha256_plookup { @@ -361,4 +361,4 @@ packed_byte_array<plonk::UltraComposer> sha256(const packed_byte_array<plonk::Ul } // namespace sha256_plookup } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp b/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp index 93c9dd861a..b1801ad2b7 100644 --- a/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp +++ b/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.hpp @@ -9,11 +9,11 @@ #include "../../primitives/field/field.hpp" #include "../../primitives/packed_byte_array/packed_byte_array.hpp" -namespace plonk { +namespace proof_system::plonk { class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace sha256_plookup { @@ -88,4 +88,4 @@ std::array<field_t<plonk::UltraComposer>, 8> sha256_block(const std::array<field packed_byte_array<plonk::UltraComposer> sha256(const packed_byte_array<plonk::UltraComposer>& input); } // namespace sha256_plookup } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp b/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp index 56af194120..c24ccf6059 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/hash.hpp @@ -7,7 +7,7 @@ #include "barretenberg/stdlib/primitives/field/field.hpp" #include <vector> -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -28,4 +28,4 @@ inline barretenberg::fr compress_native(barretenberg::fr const& lhs, barretenber } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp b/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp index 34874b412c..dbe178c3ae 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/hash.test.cpp @@ -4,14 +4,14 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; TEST(stdlib_merkle_tree_hash, compress_native_vs_circuit) { fr x = uint256_t(0x5ec473eb273a8011, 0x50160109385471ca, 0x2f3095267e02607d, 0x02586f4a39e69b86); Composer composer = Composer(); witness_ct y = witness_ct(&composer, x); - field_ct z = plonk::stdlib::pedersen<Composer>::compress(y, y); + field_ct z = proof_system::plonk::stdlib::pedersen<Composer>::compress(y, y); auto zz = crypto::pedersen::compress_native({ x, x }); EXPECT_EQ(z.get_value(), zz); } diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp b/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp index 174db8b7e2..dbe62f2611 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/hash_path.hpp @@ -4,7 +4,7 @@ #include "barretenberg/stdlib/primitives/field/field.hpp" #include <vector> -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -64,7 +64,7 @@ inline fr zero_hash_at_height(size_t height) } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk // We add to std namespace as fr_hash_path is actually a std::vector, and this is the only way // to achieve effective ADL. diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp b/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp index 3273eefcf6..8b62921fbe 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/membership.hpp @@ -4,7 +4,7 @@ #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -262,4 +262,4 @@ void batch_update_membership(field_t<Composer> const& new_root, } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp b/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp index 0dee186932..53e43ff816 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/membership.test.cpp @@ -6,8 +6,8 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::types; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::merkle_tree; TEST(stdlib_merkle_tree, test_check_membership) { diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp b/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp index f0b735a1e4..d1aad8b551 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/memory_store.hpp @@ -4,7 +4,7 @@ #include <map> #include <set> -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -88,4 +88,4 @@ class MemoryStore { } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp b/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp index 331d5a2075..cdfacca7ff 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.cpp @@ -1,7 +1,7 @@ #include "memory_tree.hpp" #include "hash.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -59,4 +59,4 @@ fr MemoryTree::update_element(size_t index, fr const& value) } // namespace merkle_tree } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp b/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp index 792ac7dbb0..b0e2504c77 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.hpp @@ -1,7 +1,7 @@ #pragma once #include "hash_path.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -43,4 +43,4 @@ class MemoryTree { } // namespace merkle_tree } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp b/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp index cdceef6ea4..08dfd18595 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/memory_tree.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; static std::vector<fr> VALUES = []() { std::vector<fr> values(4); diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp index 46a8ad9363..01d51b68c0 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.bench.cpp @@ -5,7 +5,7 @@ #include "barretenberg/numeric/random/engine.hpp" using namespace benchmark; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; namespace { auto& engine = numeric::random::get_debug_engine(); diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp index f37ed0c901..23765f24ac 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.cpp @@ -8,7 +8,7 @@ #include "barretenberg/numeric/uint128/uint128.hpp" #include <sstream> -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -292,4 +292,4 @@ template class MerkleTree<MemoryStore>; } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp index 4d34c41947..a5c1013581 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.hpp @@ -2,7 +2,7 @@ #include "hash_path.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace merkle_tree { @@ -99,4 +99,4 @@ extern template class MerkleTree<MemoryStore>; } // namespace merkle_tree } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp index 03e111b717..a4b3607be9 100644 --- a/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp +++ b/cpp/src/barretenberg/stdlib/merkle_tree/merkle_tree.test.cpp @@ -7,7 +7,7 @@ #include "barretenberg/stdlib/types/types.hpp" using namespace barretenberg; -using namespace plonk::stdlib::merkle_tree; +using namespace proof_system::plonk::stdlib::merkle_tree; namespace { auto& engine = numeric::random::get_debug_engine(); diff --git a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp index b7ede3f00b..f3caaa88c1 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.fuzzer.hpp @@ -119,11 +119,11 @@ FastRandom VarianceRNG(0); */ template <typename Composer> class BigFieldBase { private: - typedef plonk::stdlib::bool_t<Composer> bool_t; - typedef plonk::stdlib::field_t<Composer> field_t; - typedef plonk::stdlib::witness_t<Composer> witness_t; - typedef plonk::stdlib::public_witness_t<Composer> public_witness_t; - typedef plonk::stdlib::bigfield<Composer, barretenberg::Bn254FqParams> bigfield_t; + typedef proof_system::plonk::stdlib::bool_t<Composer> bool_t; + typedef proof_system::plonk::stdlib::field_t<Composer> field_t; + typedef proof_system::plonk::stdlib::witness_t<Composer> witness_t; + typedef proof_system::plonk::stdlib::public_witness_t<Composer> public_witness_t; + typedef proof_system::plonk::stdlib::bigfield<Composer, barretenberg::Bn254FqParams> bigfield_t; public: /** diff --git a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp index 86b0d3f91f..1552eb845a 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp @@ -11,7 +11,7 @@ #include "../composers/composers_fwd.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename T> class bigfield { @@ -496,6 +496,6 @@ template <typename C, typename T> inline std::ostream& operator<<(std::ostream& } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk #include "bigfield_impl.hpp" diff --git a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp index b6e5626b34..899b4cf4d5 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.test.cpp @@ -22,7 +22,7 @@ namespace test_stdlib_bigfield { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; /* A note regarding Plookup: stdlib_bigfield_plookup tests were present when this file was standardized @@ -994,7 +994,7 @@ TYPED_TEST(stdlib_bigfield, division_context) // // PLOOKUP TESTS // TEST(stdlib_bigfield_plookup, test_mul) // { -// plonk::UltraComposer composer = plonk::UltraComposer(); +// plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); // size_t num_repetitions = 1; // for (size_t i = 0; i < num_repetitions; ++i) { // fq inputs[3]{ fq::random_element(), fq::random_element(), fq::random_element() }; @@ -1041,7 +1041,7 @@ TYPED_TEST(stdlib_bigfield, division_context) // TEST(stdlib_bigfield_plookup, test_sqr) // { -// plonk::UltraComposer composer = plonk::UltraComposer(); +// plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); // size_t num_repetitions = 10; // for (size_t i = 0; i < num_repetitions; ++i) { // fq inputs[3]{ fq::random_element(), fq::random_element(), fq::random_element() }; diff --git a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp index e7bbcf34ec..218576684e 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield_impl.hpp @@ -11,7 +11,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename C, typename T> @@ -56,7 +56,7 @@ bigfield<C, T>::bigfield(const field_t<C>& low_bits_in, field_t<C> limb_3(context); if (low_bits_in.witness_index != IS_CONSTANT) { std::vector<uint32_t> low_accumulator; - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { // MERGE NOTE: this was the if constexpr block introduced in ecebe7643 const auto limb_witnesses = context->decompose_non_native_field_double_width_limb(low_bits_in.normalize().witness_index); @@ -107,7 +107,7 @@ bigfield<C, T>::bigfield(const field_t<C>& low_bits_in, if (high_bits_in.witness_index != IS_CONSTANT) { std::vector<uint32_t> high_accumulator; - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { const auto limb_witnesses = context->decompose_non_native_field_double_width_limb( high_bits_in.normalize().witness_index, (size_t)num_high_limb_bits); limb_2.witness_index = limb_witnesses[0]; @@ -187,7 +187,7 @@ bigfield<C, T> bigfield<C, T>::create_from_u512_as_witness(C* ctx, limbs[2] = value.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3).lo; limbs[3] = value.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4).lo; - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { field_t<C> limb_0(ctx); field_t<C> limb_1(ctx); field_t<C> limb_2(ctx); @@ -1645,7 +1645,7 @@ template <typename C, typename T> void bigfield<C, T>::assert_is_in_field() cons r1 = r1.normalize(); r2 = r2.normalize(); r3 = r3.normalize(); - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { context->decompose_into_default_range(r0.witness_index, static_cast<size_t>(NUM_LIMB_BITS)); context->decompose_into_default_range(r1.witness_index, static_cast<size_t>(NUM_LIMB_BITS)); context->decompose_into_default_range(r2.witness_index, static_cast<size_t>(NUM_LIMB_BITS)); @@ -1778,7 +1778,7 @@ template <typename C, typename T> void bigfield<C, T>::self_reduce() const // TODO: implicit assumption here - NUM_LIMB_BITS large enough for all the quotient uint32_t quotient_limb_index = context->add_variable(barretenberg::fr(quotient_value.lo)); field_t<C> quotient_limb = field_t<C>::from_witness_index(context, quotient_limb_index); - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { context->decompose_into_default_range(quotient_limb.witness_index, static_cast<size_t>(maximum_quotient_bits)); } else { context->decompose_into_base4_accumulators(quotient_limb.witness_index, @@ -1880,7 +1880,7 @@ void bigfield<C, T>::unsafe_evaluate_multiply_add(const bigfield& input_left, ++max_hi_bits; } - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { // The plookup custom bigfield gate requires inputs are witnesses. // If we're using constant values, instantiate them as circuit variables const auto convert_constant_to_witness = [ctx](const bigfield& input) { @@ -2238,7 +2238,7 @@ void bigfield<C, T>::unsafe_evaluate_multiple_multiply_add(const std::vector<big ++max_hi_bits; } - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { // The plookup custom bigfield gate requires inputs are witnesses. // If we're using constant values, instantiate them as circuit variables @@ -2441,7 +2441,7 @@ void bigfield<C, T>::unsafe_evaluate_multiple_multiply_add(const std::vector<big ctx->decompose_into_default_range(lo.normalize().witness_index, carry_lo_msb); } /* NOTE TO AUDITOR: An extraneous block - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { carry_lo = carry_lo.normalize(); carry_hi = carry_hi.normalize(); ctx->decompose_into_default_range(carry_lo.witness_index, static_cast<size_t>(carry_lo_msb)); @@ -2604,7 +2604,7 @@ void bigfield<C, T>::unsafe_evaluate_multiple_multiply_add(const std::vector<big const barretenberg::fr carry_lo_shift(uint256_t(uint256_t(1) << carry_lo_msb)); - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { carry_lo = carry_lo.normalize(); carry_hi = carry_hi.normalize(); ctx->decompose_into_default_range(carry_lo.witness_index, static_cast<size_t>(carry_lo_msb)); @@ -2643,7 +2643,7 @@ void bigfield<C, T>::unsafe_evaluate_square_add(const bigfield& left, const bigfield& quotient, const bigfield& remainder) { - if (C::type == plonk::PLOOKUP) { + if (C::type == ComposerType::PLOOKUP) { unsafe_evaluate_multiply_add(left, left, to_add, quotient, { remainder }); return; } @@ -2764,7 +2764,7 @@ void bigfield<C, T>::unsafe_evaluate_square_add(const bigfield& left, const uint64_t carry_hi_msb = max_hi_bits - (2 * NUM_LIMB_BITS); const barretenberg::fr carry_lo_shift(uint256_t(uint256_t(1) << carry_lo_msb)); - if constexpr (C::type == plonk::PLOOKUP) { + if constexpr (C::type == ComposerType::PLOOKUP) { carry_lo = carry_lo.normalize(); carry_hi = carry_hi.normalize(); ctx->decompose_into_default_range(carry_lo.witness_index, static_cast<size_t>(carry_lo_msb)); @@ -2863,4 +2863,4 @@ std::pair<bool, size_t> bigfield<C, T>::get_quotient_reduction_info(const std::v } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp index a031f45dd0..29d8e472c1 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.hpp @@ -14,7 +14,7 @@ #include "../composers/composers_fwd.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // ( ͡° ͜ʖ ͡°) @@ -946,7 +946,7 @@ inline std::ostream& operator<<(std::ostream& os, element<C, Fq, Fr, G> const& v return os << "{ " << v.x << " , " << v.y << " }"; } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk #include "biggroup_nafs.hpp" #include "biggroup_tables.hpp" diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp index f16233e08f..32eb7d5b80 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp @@ -20,7 +20,7 @@ auto& engine = numeric::random::get_debug_engine(); } // using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; // One can only define a TYPED_TEST with a single template paramter. // Our workaround is to pass parameters of the following type. @@ -900,7 +900,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, double_montgomery_ladder) HEAVY_TYPED_TEST(stdlib_biggroup, compute_naf) { // ULTRATODO: make this work for secp curves - if constexpr (TypeParam::Curve::type == bonk::CurveType::BN254) { + if constexpr (TypeParam::Curve::type == CurveType::BN254) { size_t num_repetitions = 1; for (size_t i = 0; i < num_repetitions; i++) { TestFixture::test_compute_naf(); @@ -913,7 +913,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, compute_naf) /* These tests only work for UltraComposer */ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_batch_mul) { - if constexpr (TypeParam::Curve::Composer::type == plonk::ComposerType::PLOOKUP) { + if constexpr (TypeParam::Curve::Composer::type == ComposerType::PLOOKUP) { TestFixture::test_compute_wnaf(); } else { GTEST_SKIP(); @@ -924,7 +924,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_batch_mul) Fr is a bigfield. */ HEAVY_TYPED_TEST(stdlib_biggroup, compute_wnaf) { - if constexpr (TypeParam::Curve::Composer::type != plonk::UltraComposer::type && TypeParam::use_bigfield) { + if constexpr (TypeParam::Curve::Composer::type != UltraComposer::type && TypeParam::use_bigfield) { GTEST_SKIP(); } else { TestFixture::test_compute_wnaf(); @@ -961,7 +961,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_batch_4) /* The following tests are specific to BN254 and don't work when Fr is a bigfield */ HEAVY_TYPED_TEST(stdlib_biggroup, bn254_endo_batch_mul) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::BN254 && !TypeParam::use_bigfield) { + if constexpr (TypeParam::Curve::type == CurveType::BN254 && !TypeParam::use_bigfield) { TestFixture::test_bn254_endo_batch_mul(); } else { GTEST_SKIP(); @@ -969,7 +969,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, bn254_endo_batch_mul) } HEAVY_TYPED_TEST(stdlib_biggroup, mixed_mul_bn254_endo) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::BN254 && !TypeParam::use_bigfield) { + if constexpr (TypeParam::Curve::type == CurveType::BN254 && !TypeParam::use_bigfield) { TestFixture::test_mixed_mul_bn254_endo(); } else { GTEST_SKIP(); @@ -979,7 +979,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, mixed_mul_bn254_endo) /* The following tests are specific to SECP256k1 */ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_secp256k1) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::SECP256K1) { + if constexpr (TypeParam::Curve::type == CurveType::SECP256K1) { TestFixture::test_wnaf_secp256k1(); } else { GTEST_SKIP(); @@ -987,7 +987,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_secp256k1) } HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_8bit_secp256k1) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::SECP256K1) { + if constexpr (TypeParam::Curve::type == CurveType::SECP256K1) { TestFixture::test_wnaf_8bit_secp256k1(); } else { GTEST_SKIP(); @@ -995,7 +995,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, wnaf_8bit_secp256k1) } HEAVY_TYPED_TEST(stdlib_biggroup, ecdsa_mul_secp256k1) { - if constexpr (TypeParam::Curve::type == bonk::CurveType::SECP256K1) { + if constexpr (TypeParam::Curve::type == CurveType::SECP256K1) { TestFixture::test_ecdsa_mul_secp256k1(); } else { GTEST_SKIP(); diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp index ac732ae22c..c237d0dfbb 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_batch_mul.hpp @@ -1,6 +1,6 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -61,4 +61,4 @@ element<C, Fq, Fr, G> element<C, Fq, Fr, G>::wnaf_batch_mul(const std::vector<el return accumulator; } } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_bn254.hpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_bn254.hpp index d944a9b203..834a1b01ef 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_bn254.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_bn254.hpp @@ -7,7 +7,7 @@ * We use a special case algorithm to split bn254 scalar multipliers into endomorphism scalars * **/ -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -422,4 +422,4 @@ element<C, Fq, Fr, G> element<C, Fq, Fr, G>::bn254_endo_batch_mul(const std::vec return accumulator; } } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp index ea107e2300..78d6f37855 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_impl.hpp @@ -11,7 +11,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename C, class Fq, class Fr, class G> @@ -660,4 +660,4 @@ element<C, Fq, Fr, G> element<C, Fq, Fr, G>::operator*(const Fr& scalar) const return element(out_x, out_y) - element(offset_generators.second); } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp index 71cd984c30..63257d5687 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp @@ -1,7 +1,7 @@ #pragma once #include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -548,4 +548,4 @@ std::vector<bool_t<C>> element<C, Fq, Fr, G>::compute_naf(const Fr& scalar, cons return naf_entries; } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp index 0b7ff33f0b..7d510e2794 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_secp256k1.hpp @@ -5,7 +5,7 @@ * TODO: we should try to genericize this, but this method is super fiddly and we need it to be efficient! * **/ -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename C, class Fq, class Fr, class G> @@ -138,4 +138,4 @@ element<C, Fq, Fr, G> element<C, Fq, Fr, G>::secp256k1_ecdsa_mul(const element& return accumulator; } } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp index e10ffdabc5..9fee073888 100644 --- a/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_tables.hpp @@ -1,5 +1,5 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename C, class Fq, class Fr, class G> @@ -583,4 +583,4 @@ element<C, Fq, Fr, G> element<C, Fq, Fr, G>::lookup_table_base<length>::get( return element::one(bits[0].get_context()); } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp index 74dfad7126..b8f9dbc343 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.cpp @@ -3,7 +3,7 @@ #include <bitset> -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> @@ -163,4 +163,4 @@ template <typename ComposerContext> std::string bit_array<ComposerContext>::get_ INSTANTIATE_STDLIB_TYPE(bit_array) } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp index 2f1a1f6536..45a2b04ed4 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.fuzzer.hpp @@ -30,8 +30,8 @@ FastRandom VarianceRNG(0); */ template <typename Composer> class BitArrayFuzzBase { private: - typedef plonk::stdlib::bit_array<Composer> bit_array_t; - typedef plonk::stdlib::byte_array<Composer> byte_array_t; + typedef proof_system::plonk::stdlib::bit_array<Composer> bit_array_t; + typedef proof_system::plonk::stdlib::byte_array<Composer> byte_array_t; template <size_t NumBytes, size_t NumWords> static std::vector<uint8_t> to_vector(std::array<plonk::stdlib::uint32<Composer>, NumWords>& a32) { diff --git a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp index dde913c8b1..9cf0ac5a20 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.hpp @@ -4,7 +4,7 @@ #include "barretenberg/honk/composer/standard_honk_composer.hpp" #include <algorithm> -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> class bit_array { @@ -185,4 +185,4 @@ EXTERN_STDLIB_TYPE(bit_array); extern template class bit_array<honk::StandardHonkComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp index 56af6d4e66..54b4b7439b 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/bit_array/bit_array.test.cpp @@ -6,7 +6,7 @@ namespace test_stdlib_bit_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -21,7 +21,7 @@ typedef stdlib::byte_array<honk::StandardHonkComposer> byte_array; TEST(stdlib_bit_array, test_uint32_input_output_consistency) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); uint32_t a_expected = engine.get_random_uint32(); uint32_t b_expected = engine.get_random_uint32(); @@ -47,7 +47,7 @@ TEST(stdlib_bit_array, test_uint32_input_output_consistency) TEST(stdlib_bit_array, test_binary_input_output_consistency) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bit_array test_bit_array = bit_array(&composer, 5); @@ -70,7 +70,7 @@ TEST(stdlib_bit_array, test_binary_input_output_consistency) TEST(stdlib_bit_array, test_string_input_output_consistency) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); std::string expected = "string literals inside a SNARK circuit? What nonsense!"; bit_array test_bit_array = bit_array(&composer, expected); @@ -82,7 +82,7 @@ TEST(stdlib_bit_array, test_string_input_output_consistency) TEST(stdlib_bit_array, test_byte_array_conversion) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); std::string expected = "string literals inside a SNARK circuit? What nonsense!"; bit_array test_bit_array = bit_array(&composer, expected); @@ -96,7 +96,7 @@ TEST(stdlib_bit_array, test_byte_array_conversion) TEST(stdlib_bit_array, test_uint32_vector_constructor) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); uint32_t a_expected = engine.get_random_uint32(); uint32_t b_expected = engine.get_random_uint32(); diff --git a/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp b/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp index 46c29f632d..204b20790e 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/bool/bool.cpp @@ -3,9 +3,9 @@ #include "barretenberg/honk/composer/standard_honk_composer.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> @@ -474,4 +474,4 @@ template <typename ComposerContext> bool_t<ComposerContext> bool_t<ComposerConte INSTANTIATE_STDLIB_TYPE(bool_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp b/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp index 3b9e9c501e..724c86c714 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bool/bool.fuzzer.hpp @@ -27,8 +27,8 @@ FastRandom VarianceRNG(0); */ template <typename Composer> class BoolFuzzBase { private: - typedef plonk::stdlib::bool_t<Composer> bool_t; - typedef plonk::stdlib::witness_t<Composer> witness_t; + typedef proof_system::plonk::stdlib::bool_t<Composer> bool_t; + typedef proof_system::plonk::stdlib::witness_t<Composer> witness_t; public: /** diff --git a/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp b/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp index 87eec13232..86ddee1e4a 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bool/bool.hpp @@ -3,7 +3,7 @@ #include "../witness/witness.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> class bool_t { @@ -77,4 +77,4 @@ EXTERN_STDLIB_TYPE(bool_t); extern template class bool_t<honk::StandardHonkComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp b/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp index 4e481d93af..d080f06f10 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/bool/bool.test.cpp @@ -6,14 +6,14 @@ namespace test_stdlib_bool { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; typedef stdlib::bool_t<honk::StandardHonkComposer> bool_t; typedef stdlib::witness_t<honk::StandardHonkComposer> witness_t; TEST(stdlib_bool, test_basic_operations) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool_t a(&composer); bool_t b(&composer); a = stdlib::witness_t(&composer, barretenberg::fr::one()); @@ -26,7 +26,7 @@ TEST(stdlib_bool, test_basic_operations) bool_t f = e ^ b; // f = 0 d = (!f) & a; // d = 1 auto prover = composer.create_prover(); - // if constexpr (Composer::type == plonk::ComposerType::STANDARD_HONK) { + // if constexpr (Composer::type == ComposerType::STANDARD_HONK) { EXPECT_EQ(prover.wire_polynomials[0][3], fr(1)); EXPECT_EQ(prover.wire_polynomials[1][3], fr(1)); EXPECT_EQ(prover.wire_polynomials[2][3], fr(1)); @@ -70,7 +70,7 @@ TEST(stdlib_bool, test_basic_operations) TEST(stdlib_bool, xor) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t j = 0; j < 4; ++j) { bool lhs_constant = (bool)(j % 2); bool rhs_constant = (bool)(j > 1 ? true : false); @@ -95,7 +95,7 @@ TEST(stdlib_bool, xor) TEST(stdlib_bool, xor_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -123,7 +123,7 @@ TEST(stdlib_bool, xor_constants) TEST(stdlib_bool, xor_twin_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool_t c; for (size_t i = 0; i < 32; ++i) { bool_t a(&composer, (i % 1) == 0); @@ -153,7 +153,7 @@ TEST(stdlib_bool, xor_twin_constants) // TEST(stdlib_bool, logical_and) // { -// honk::StandardHonkComposer composer = honk::StandardHonkComposer(); +// honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); // bool_t a = witness_t(&composer, 1); // bool_t b = witness_t(&composer, 1); // (!a) && (!b); @@ -169,7 +169,7 @@ TEST(stdlib_bool, xor_twin_constants) TEST(stdlib_bool, and) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 1)); bool_t b = witness_t(&composer, (bool)(i % 2 == 1)); @@ -186,7 +186,7 @@ TEST(stdlib_bool, and) TEST(stdlib_bool, and_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -214,7 +214,7 @@ TEST(stdlib_bool, and_constants) TEST(stdlib_bool, or) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -231,7 +231,7 @@ TEST(stdlib_bool, or) TEST(stdlib_bool, or_constants) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t i = 0; i < 32; ++i) { bool_t a = witness_t(&composer, (bool)(i % 2)); bool_t b = witness_t(&composer, (bool)(i % 3 == 1)); @@ -259,7 +259,7 @@ TEST(stdlib_bool, or_constants) TEST(stdlib_bool, eq) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool a_alt[32]; bool b_alt[32]; bool c_alt[32]; @@ -311,7 +311,7 @@ TEST(stdlib_bool, eq) TEST(stdlib_bool, implies) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t j = 0; j < 4; ++j) { bool lhs_constant = (bool)(j % 2); bool rhs_constant = (bool)(j > 1 ? true : false); @@ -336,7 +336,7 @@ TEST(stdlib_bool, implies) TEST(stdlib_bool, implies_both_ways) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); for (size_t j = 0; j < 4; ++j) { bool lhs_constant = (bool)(j % 2); bool rhs_constant = (bool)(j > 1 ? true : false); @@ -361,7 +361,7 @@ TEST(stdlib_bool, implies_both_ways) TEST(stdlib_bool, test_simple_proof) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); bool_t a(&composer); bool_t b(&composer); a = stdlib::witness_t(&composer, barretenberg::fr::one()); @@ -395,7 +395,7 @@ TEST(stdlib_bool, test_simple_proof) TEST(stdlib_bool, normalize) { - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); auto generate_constraints = [&composer](bool value, bool is_constant, bool is_inverted) { bool_t a = is_constant ? bool_t(&composer, value) : witness_t(&composer, value); diff --git a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp index d500c251f5..d63356bc19 100644 --- a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.cpp @@ -6,7 +6,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // ULTRA: Further merging with @@ -383,4 +383,4 @@ typename byte_array<Composer>::byte_slice byte_array<Composer>::split_byte(const INSTANTIATE_STDLIB_TYPE(byte_array); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp index d0bef67e52..5eda8ad5c1 100644 --- a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.fuzzer.hpp @@ -31,9 +31,9 @@ FastRandom VarianceRNG(0); */ template <typename Composer> class ByteArrayFuzzBase { private: - typedef plonk::stdlib::byte_array<Composer> byte_array_t; - typedef plonk::stdlib::field_t<Composer> field_t; - typedef plonk::stdlib::safe_uint_t<Composer> suint_t; + typedef proof_system::plonk::stdlib::byte_array<Composer> byte_array_t; + typedef proof_system::plonk::stdlib::field_t<Composer> field_t; + typedef proof_system::plonk::stdlib::safe_uint_t<Composer> suint_t; template <class From, class To> static To from_to(const From& in, const std::optional<size_t> size = std::nullopt) { diff --git a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp index 2f0b8a676c..44675d51cc 100644 --- a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.hpp @@ -4,7 +4,7 @@ #include "../field/field.hpp" #include "../safe_uint/safe_uint.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> class byte_array { @@ -106,4 +106,4 @@ EXTERN_STDLIB_TYPE(byte_array); extern template class byte_array<honk::StandardHonkComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp index f0ebaa919a..bcd0631bc2 100644 --- a/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/byte_array/byte_array.test.cpp @@ -7,7 +7,7 @@ // ULTRATODO: make these typed tests namespace test_stdlib_byte_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; typedef honk::StandardHonkComposer Composer; typedef stdlib::bool_t<Composer> bool_t; typedef stdlib::field_t<Composer> field_t; diff --git a/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp b/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp index 34246ac63c..8f3b986dbb 100644 --- a/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/composers/composers_fwd.hpp @@ -1,16 +1,16 @@ #pragma once -namespace plonk { +namespace proof_system::plonk { class StandardComposer; class TurboComposer; class UltraComposer; class StandardPlonkComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace honk { +namespace proof_system::honk { class StandardHonkComposer; -} // namespace honk +} // namespace proof_system::honk #define EXTERN_STDLIB_TYPE(stdlib_type) \ extern template class stdlib_type<plonk::StandardComposer>; \ diff --git a/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp b/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp index c06ea60f3a..4fc46e4e41 100644 --- a/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/curves/bn254.hpp @@ -4,11 +4,11 @@ #include "../biggroup/biggroup.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerType> struct bn254 { - static constexpr bonk::CurveType type = bonk::CurveType::BN254; + static constexpr proof_system::CurveType type = proof_system::CurveType::BN254; typedef barretenberg::fq fq; typedef barretenberg::fr fr; @@ -29,4 +29,4 @@ template <typename ComposerType> struct bn254 { }; // namespace bn254 } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp b/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp index 7617302320..a1e1cbe3af 100644 --- a/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/curves/secp256k1.hpp @@ -6,11 +6,11 @@ #include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerType> struct secp256k1 { - static constexpr bonk::CurveType type = bonk::CurveType::SECP256K1; + static constexpr proof_system::CurveType type = proof_system::CurveType::SECP256K1; typedef ::secp256k1::fq fq; typedef ::secp256k1::fr fr; @@ -30,4 +30,4 @@ template <typename ComposerType> struct secp256k1 { typedef element<Composer, fq_ct, bigfr_ct, g1> g1_bigfr_ct; }; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp b/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp index 87da0893dc..6157fa34d4 100644 --- a/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/curves/secp256r1.hpp @@ -6,11 +6,11 @@ #include "barretenberg/ecc/curves/secp256r1/secp256r1.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerType> struct secp256r1 { - static constexpr bonk::CurveType type = bonk::CurveType::SECP256R1; + static constexpr proof_system::CurveType type = proof_system::CurveType::SECP256R1; typedef ::secp256r1::fq fq; typedef ::secp256r1::fr fr; @@ -30,4 +30,4 @@ template <typename ComposerType> struct secp256r1 { typedef element<Composer, fq_ct, bigfr_ct, g1> g1_bigfr_ct; }; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/field/field.cpp b/cpp/src/barretenberg/stdlib/primitives/field/field.cpp index 918aaff424..2a76d24872 100644 --- a/cpp/src/barretenberg/stdlib/primitives/field/field.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/field/field.cpp @@ -4,9 +4,9 @@ #include "../composers/composers.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> @@ -981,7 +981,7 @@ field_t<ComposerContext> field_t<ComposerContext>::accumulate(const std::vector< * * If num elements is not a multiple of 3, the final gate will be padded with zero_idx wires **/ - if constexpr (ComposerContext::type == plonk::PLOOKUP) { + if constexpr (ComposerContext::type == ComposerType::PLOOKUP) { ComposerContext* ctx = nullptr; std::vector<field_t> accumulator; field_t constant_term = 0; @@ -1039,7 +1039,7 @@ field_t<ComposerContext> field_t<ComposerContext>::accumulate(const std::vector< accumulating_total = witness_t<ComposerContext>(ctx, new_total); } return total.normalize(); - } else if constexpr (ComposerContext::type == plonk::TURBO) { + } else if constexpr (ComposerContext::type == ComposerType::TURBO) { field_t total(0); bool odd_number = (input.size() & 0x01UL) == 0x01ULL; @@ -1180,4 +1180,4 @@ std::vector<bool_t<ComposerContext>> field_t<ComposerContext>::decompose_into_bi INSTANTIATE_STDLIB_TYPE(field_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp b/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp index 612349149f..764d4c8303 100644 --- a/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/field/field.fuzzer.hpp @@ -119,10 +119,10 @@ FastRandom VarianceRNG(0); */ template <typename Composer> class FieldBase { private: - typedef plonk::stdlib::bool_t<Composer> bool_t; - typedef plonk::stdlib::field_t<Composer> field_t; - typedef plonk::stdlib::witness_t<Composer> witness_t; - typedef plonk::stdlib::public_witness_t<Composer> public_witness_t; + typedef proof_system::plonk::stdlib::bool_t<Composer> bool_t; + typedef proof_system::plonk::stdlib::field_t<Composer> field_t; + typedef proof_system::plonk::stdlib::witness_t<Composer> witness_t; + typedef proof_system::plonk::stdlib::public_witness_t<Composer> public_witness_t; public: /** @@ -1027,7 +1027,7 @@ template <typename Composer> class FieldBase { * * TEST(stdlib_field, test_construct_via_bool_t) * { - * plonk::StandardComposer composer = plonk::StandardComposer(); + * plonk::StandardComposer composer = proof_system::plonk::StandardComposer(); * field_t a(witness_t(&composer, fr(uint256_t{0xf396b678452ebf15, 0x82ae10893982638b, * 0xdf185a29c65fbf80, 0x1d18b2de99e48308}))); field_t b = a - a; field_t c(static_cast<bool_t>(b)); * std::cout << c.get_value() << std::endl; diff --git a/cpp/src/barretenberg/stdlib/primitives/field/field.hpp b/cpp/src/barretenberg/stdlib/primitives/field/field.hpp index a175f62ab9..bbe7268727 100644 --- a/cpp/src/barretenberg/stdlib/primitives/field/field.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/field/field.hpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/composer/splitting_tmp/standard_plonk_composer.hpp" #include "barretenberg/common/assert.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> class bool_t; @@ -366,4 +366,4 @@ template <typename ComposerContext> inline std::ostream& operator<<(std::ostream EXTERN_STDLIB_TYPE(field_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp b/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp index 071ffc8a56..b78f492e3e 100644 --- a/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp @@ -8,7 +8,7 @@ #include "barretenberg/plonk/composer/turbo_composer.hpp" #include "barretenberg/numeric/random/engine.hpp" -using namespace bonk; +using namespace proof_system; namespace test_stdlib_field { @@ -19,7 +19,7 @@ auto& engine = numeric::random::get_debug_engine(); template <class T> void ignore_unused(T&) {} // use to ignore unused variables in lambdas using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; template <typename Composer> class stdlib_field : public testing::Test { typedef stdlib::bool_t<Composer> bool_ct; @@ -192,7 +192,7 @@ template <typename Composer> class stdlib_field : public testing::Test { uint64_t expected = fidget(composer); auto prover = composer.create_prover(); - if constexpr (Composer::type == plonk::ComposerType::STANDARD_HONK) { + if constexpr (Composer::type == ComposerType::STANDARD_HONK) { EXPECT_EQ(prover.wire_polynomials[2][20], fr(expected)); } else { EXPECT_EQ(prover.key->polynomial_store.get("w_3_lagrange")[18], fr(expected)); @@ -249,7 +249,7 @@ template <typename Composer> class stdlib_field : public testing::Test { auto prover = composer.create_prover(); - if constexpr (Composer::type == plonk::ComposerType::STANDARD_HONK) { + if constexpr (Composer::type == ComposerType::STANDARD_HONK) { EXPECT_EQ(prover.wire_polynomials[2][19], fr(4181)); } else { EXPECT_EQ(prover.key->polynomial_store.get("w_3_lagrange")[17], fr(4181)); diff --git a/cpp/src/barretenberg/stdlib/primitives/group/group.hpp b/cpp/src/barretenberg/stdlib/primitives/group/group.hpp index 5886cc964f..f3cf23e1d5 100644 --- a/cpp/src/barretenberg/stdlib/primitives/group/group.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/group/group.hpp @@ -8,9 +8,9 @@ #include "../../hash/pedersen/pedersen.hpp" #include "../../hash/pedersen/pedersen_gates.hpp" -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; @@ -237,4 +237,4 @@ auto group<ComposerContext>::fixed_base_scalar_mul_internal(const field_t<Compos // static point variable_base_mul(const point& p, const field_t& s); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/group/group.test.cpp b/cpp/src/barretenberg/stdlib/primitives/group/group.test.cpp index 2c69100a8d..f59f8b8888 100644 --- a/cpp/src/barretenberg/stdlib/primitives/group/group.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/group/group.test.cpp @@ -5,16 +5,16 @@ #include "barretenberg/numeric/random/engine.hpp" using namespace barretenberg; -// using namespace plonk::stdlib::types; +// using namespace proof_system::plonk::stdlib::types; namespace stdlib_group_tests { namespace { auto& engine = numeric::random::get_debug_engine(); } -using Composer = honk::StandardHonkComposer; -using witness_ct = plonk::stdlib::witness_t<Composer>; -using field_ct = plonk::stdlib::field_t<Composer>; -using group_ct = plonk::stdlib::group<Composer>; +using Composer = proof_system::honk::StandardHonkComposer; +using witness_ct = proof_system::plonk::stdlib::witness_t<Composer>; +using field_ct = proof_system::plonk::stdlib::field_t<Composer>; +using group_ct = proof_system::plonk::stdlib::group<Composer>; TEST(stdlib_group, test_fixed_base_scalar_mul) { diff --git a/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp b/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp index d3ae520aa8..47d1d848f0 100644 --- a/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp @@ -3,8 +3,7 @@ #include "../composers/composers.hpp" #include "../plookup/plookup.hpp" -namespace plonk { -namespace stdlib { +namespace proof_system::plonk::stdlib { /** * @brief A logical AND or XOR over a variable number of bits. @@ -90,5 +89,4 @@ field_t<Composer> logic<Composer>::create_logic_constraint(field_pt& a, field_pt } } INSTANTIATE_STDLIB_TYPE(logic); -} // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk::stdlib diff --git a/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp b/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp index 16423d3188..2b8b99d560 100644 --- a/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp @@ -1,14 +1,14 @@ #pragma once -#include "../composers/composers_fwd.hpp" -#include "../field/field.hpp" +#include "barretenberg/stdlib/primitives/composers/composers_fwd.hpp" +#include "barretenberg/stdlib/primitives/field/field.hpp" +#include "barretenberg/stdlib/primitives/witness/witness.hpp" -namespace plonk { -namespace stdlib { +namespace proof_system::plonk::stdlib { template <typename Composer> class logic { private: - typedef field_t<Composer> field_pt; - typedef witness_t<Composer> witness_pt; + using field_pt = field_t<Composer>; + using witness_pt = witness_t<Composer>; public: static field_pt create_logic_constraint(field_pt& a, field_pt& b, size_t num_bits, bool is_xor_gate); @@ -16,5 +16,4 @@ template <typename Composer> class logic { EXTERN_STDLIB_TYPE(logic); -} // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk::stdlib \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp b/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp index 36f0384d2d..bf1dd73e5f 100644 --- a/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/logic/logic.test.cpp @@ -8,8 +8,6 @@ #include "barretenberg/plonk/composer/turbo_composer.hpp" #include "barretenberg/numeric/random/engine.hpp" -using namespace bonk; - namespace test_stdlib_logic { namespace { @@ -19,7 +17,7 @@ auto& engine = numeric::random::get_debug_engine(); template <class T> void ignore_unused(T&) {} // use to ignore unused variables in lambdas using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; template <typename Composer> class stdlib_logic : public testing::Test { typedef stdlib::bool_t<Composer> bool_ct; diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp b/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp index 94ab20d074..66937a23ba 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.cpp @@ -3,7 +3,7 @@ #include "../composers/composers.hpp" #include "../bool/bool.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -25,7 +25,7 @@ DynamicArray<Composer>::DynamicArray(Composer* composer, const size_t maximum_si , _max_size(maximum_size) , _length(0) { - static_assert(Composer::type == plonk::ComposerType::PLOOKUP); + static_assert(Composer::type == ComposerType::PLOOKUP); ASSERT(_context != nullptr); _inner_table = ram_table(_context, maximum_size); // Initialize the ram table with all zeroes @@ -276,4 +276,4 @@ template <typename Composer> void DynamicArray<Composer>::conditional_pop(const INSTANTIATE_STDLIB_ULTRA_TYPE(DynamicArray); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp b/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp index f5d81f71ff..0f274fe4d7 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.hpp @@ -1,7 +1,7 @@ #pragma once #include "ram_table.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -51,4 +51,4 @@ template <typename Composer> class DynamicArray { EXTERN_STDLIB_ULTRA_TYPE(DynamicArray); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp b/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp index 9db1d609dc..87ff2677ab 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/dynamic_array.test.cpp @@ -10,14 +10,14 @@ namespace test_stdlib_dynamic_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); } // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using bool_ct = stdlib::bool_t<plonk::UltraComposer>; using field_ct = stdlib::field_t<Composer>; using witness_ct = stdlib::witness_t<Composer>; diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp b/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp index d7a3e1ac16..f68089e229 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.cpp @@ -2,7 +2,7 @@ #include "../composers/composers.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -13,7 +13,7 @@ namespace stdlib { */ template <typename Composer> ram_table<Composer>::ram_table(Composer* composer, const size_t table_size) { - static_assert(Composer::type == plonk::ComposerType::PLOOKUP); + static_assert(Composer::type == ComposerType::PLOOKUP); _context = composer; _length = table_size; _index_initialized.resize(table_size); @@ -35,7 +35,7 @@ template <typename Composer> ram_table<Composer>::ram_table(Composer* composer, */ template <typename Composer> ram_table<Composer>::ram_table(const std::vector<field_pt>& table_entries) { - static_assert(Composer::type == plonk::ComposerType::PLOOKUP); + static_assert(Composer::type == ComposerType::PLOOKUP); // get the composer _context for (const auto& entry : table_entries) { if (entry.get_context() != nullptr) { @@ -254,4 +254,4 @@ template <typename Composer> void ram_table<Composer>::write(const field_pt& ind INSTANTIATE_STDLIB_ULTRA_TYPE(ram_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp b/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp index dd94b48dde..c8c1b085b9 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.hpp @@ -2,7 +2,7 @@ #include "../composers/composers_fwd.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // A runtime-defined read-only memory table. Table entries must be initialized in the constructor. @@ -60,4 +60,4 @@ template <typename Composer> class ram_table { EXTERN_STDLIB_ULTRA_TYPE(ram_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp b/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp index 9731be6498..22ba93e225 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/ram_table.test.cpp @@ -7,10 +7,10 @@ #include "barretenberg/plonk/composer/ultra_composer.hpp" namespace test_stdlib_ram_table { -using namespace plonk; +using namespace proof_system::plonk; // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using field_ct = stdlib::field_t<Composer>; using witness_ct = stdlib::witness_t<Composer>; using ram_table_ct = stdlib::ram_table<Composer>; diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp b/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp index d1330e804f..53ed2a80f4 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> rom_table<Composer>::rom_table(const std::vector<field_pt>& table_entries) @@ -124,4 +124,4 @@ template <typename Composer> field_t<Composer> rom_table<Composer>::operator[](c INSTANTIATE_STDLIB_ULTRA_TYPE(rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp b/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp index 0b93992e0f..ee3f519c2b 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.hpp @@ -2,7 +2,7 @@ #include "../composers/composers_fwd.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // A runtime-defined read-only memory table. Table entries must be initialized in the constructor. @@ -44,4 +44,4 @@ template <typename Composer> class rom_table { EXTERN_STDLIB_ULTRA_TYPE(rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp b/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp index a6c8189edd..515d930271 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/rom_table.test.cpp @@ -8,10 +8,10 @@ namespace test_stdlib_rom_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using field_ct = stdlib::field_t<Composer>; using witness_ct = stdlib::witness_t<Composer>; using rom_table_ct = stdlib::rom_table<Composer>; diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp b/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp index 5c6b914cdb..e8aaff2af4 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> @@ -141,4 +141,4 @@ std::array<field_t<Composer>, 2> twin_rom_table<Composer>::operator[](const fiel INSTANTIATE_STDLIB_ULTRA_TYPE(twin_rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp b/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp index 555fe9efc2..24651b259a 100644 --- a/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/memory/twin_rom_table.hpp @@ -2,7 +2,7 @@ #include "../composers/composers_fwd.hpp" #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // A runtime-defined read-only memory table. Table entries must be initialized in the constructor. @@ -46,4 +46,4 @@ template <typename Composer> class twin_rom_table { EXTERN_STDLIB_ULTRA_TYPE(twin_rom_table); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp b/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp index e2dcc73237..62d0d1bb6b 100644 --- a/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.cpp @@ -4,7 +4,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace { @@ -271,4 +271,4 @@ template <typename Composer> std::string packed_byte_array<Composer>::get_value( INSTANTIATE_STDLIB_TYPE(packed_byte_array); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp b/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp index b1355e3a9d..79b4b4a797 100644 --- a/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp @@ -5,7 +5,7 @@ #include "../byte_array/byte_array.hpp" #include "barretenberg/honk/composer/standard_honk_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> class packed_byte_array { @@ -69,4 +69,4 @@ EXTERN_STDLIB_TYPE(packed_byte_array); extern template class packed_byte_array<honk::StandardHonkComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp b/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp index 3020c6e4d8..acd8d082df 100644 --- a/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.test.cpp @@ -9,7 +9,7 @@ namespace test_stdlib_packed_byte_array { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -21,7 +21,7 @@ TEST(packed_byte_array, string_constructor_and_get_value_consistency) { std::string input = "the quick brown fox jumped over the lazy dog."; - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, input); @@ -34,7 +34,7 @@ TEST(packed_byte_array, byte_array_constructor_consistency) { std::string input = "the quick brown fox jumped over the lazy dog."; - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); byte_array arr(&composer, input); packed_byte_array converted(arr); @@ -47,7 +47,7 @@ TEST(packed_byte_array, byte_array_cast_consistency) { std::string input = "the quick brown fox jumped over the lazy dog."; - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, input); byte_array converted(arr); @@ -71,7 +71,7 @@ TEST(packed_byte_array, unverified_byte_slices) uint32s.push_back(result); } - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, bytes); @@ -94,7 +94,7 @@ TEST(packed_byte_array, check_append_uint8) bytes.push_back(engine.get_random_uint8()); } - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, bytes); // append upto size (16x) @@ -149,7 +149,7 @@ TEST(packed_byte_array, check_append_uint32) uint32s.push_back(result); } - honk::StandardHonkComposer composer = honk::StandardHonkComposer(); + honk::StandardHonkComposer composer = proof_system::honk::StandardHonkComposer(); packed_byte_array arr(&composer, bytes); // append over size (16x) (this creates new limb internally) diff --git a/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp b/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp index ca69c95150..ac251c7081 100644 --- a/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp @@ -3,11 +3,11 @@ #include "barretenberg/plonk/composer/plookup_tables/plookup_tables.hpp" #include "barretenberg/plonk/composer/plookup_tables/types.hpp" -namespace plonk { +namespace proof_system::plonk { class UltraComposer; -} // namespace plonk +} // namespace proof_system::plonk -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace barretenberg; @@ -91,4 +91,4 @@ field_t<Composer> plookup_<Composer>::read_from_1_to_2_table(const MultiTableId template class plookup_<plonk::UltraComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp b/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp index 6c468e372d..b178032b10 100644 --- a/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp @@ -6,7 +6,7 @@ #include "barretenberg/plonk/composer/plookup_tables/types.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { using namespace plookup; @@ -30,4 +30,4 @@ extern template class plookup_<plonk::UltraComposer>; typedef plookup_<plonk::UltraComposer> plookup_read; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp b/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp index 60c5947536..235e966a67 100644 --- a/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp @@ -12,11 +12,11 @@ namespace test_stdlib_plookups { using namespace barretenberg; -using namespace plonk; +using namespace proof_system::plonk; using namespace plookup; // Defining ultra-specific types for local testing. -using Composer = plonk::UltraComposer; +using Composer = proof_system::plonk::UltraComposer; using field_ct = stdlib::field_t<Composer>; using witness_ct = stdlib::witness_t<Composer>; diff --git a/cpp/src/barretenberg/stdlib/primitives/point/point.hpp b/cpp/src/barretenberg/stdlib/primitives/point/point.hpp index 5252a6ee9a..3c1f114320 100644 --- a/cpp/src/barretenberg/stdlib/primitives/point/point.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/point/point.hpp @@ -4,7 +4,7 @@ #include "../field/field.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer> struct point { @@ -69,4 +69,4 @@ template <typename Composer> std::ostream& operator<<(std::ostream& os, point<Co } } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.cpp b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.cpp index 5669eea8ba..344ffe3d02 100644 --- a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.cpp @@ -3,7 +3,7 @@ #include "../composers/composers.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> @@ -102,4 +102,4 @@ std::array<safe_uint_t<ComposerContext>, 3> safe_uint_t<ComposerContext>::slice( INSTANTIATE_STDLIB_TYPE(safe_uint_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp index a5d706dc14..32faf9c239 100644 --- a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.fuzzer.hpp @@ -109,11 +109,11 @@ FastRandom VarianceRNG(0); */ template <typename Composer> class SafeUintFuzzBase { private: - typedef plonk::stdlib::bool_t<Composer> bool_t; - typedef plonk::stdlib::field_t<Composer> field_t; - typedef plonk::stdlib::safe_uint_t<Composer> suint_t; - typedef plonk::stdlib::witness_t<Composer> witness_t; - typedef plonk::stdlib::public_witness_t<Composer> public_witness_t; + typedef proof_system::plonk::stdlib::bool_t<Composer> bool_t; + typedef proof_system::plonk::stdlib::field_t<Composer> field_t; + typedef proof_system::plonk::stdlib::safe_uint_t<Composer> suint_t; + typedef proof_system::plonk::stdlib::witness_t<Composer> witness_t; + typedef proof_system::plonk::stdlib::public_witness_t<Composer> public_witness_t; public: /** diff --git a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp index 15d3f8ad3a..436970d490 100644 --- a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.hpp @@ -11,7 +11,7 @@ // Despite the name, it is *not* a "safe" version of the uint class - as operations are positive integer // operations, and not modulo 2^t for some t, as they are in the uint class. -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename ComposerContext> class safe_uint_t { @@ -287,4 +287,4 @@ EXTERN_STDLIB_TYPE(safe_uint_t); extern template class safe_uint_t<honk::StandardHonkComposer>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp index 9e566212f4..622e896fee 100644 --- a/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/safe_uint/safe_uint.test.cpp @@ -11,18 +11,18 @@ namespace { auto& engine = numeric::random::get_debug_engine(); } -using namespace plonk::stdlib::types; +using namespace proof_system::plonk::stdlib::types; namespace test_stdlib_safe_uint { template <class T> void ignore_unused(T&) {} // use to ignore unused variables in lambdas -using Composer = honk::StandardHonkComposer; -typedef plonk::stdlib::bool_t<Composer> bool_t; -typedef plonk::stdlib::field_t<Composer> field_t; -typedef plonk::stdlib::safe_uint_t<Composer> suint_t; -typedef plonk::stdlib::witness_t<Composer> witness_t; -typedef plonk::stdlib::public_witness_t<Composer> public_witness_t; -typedef plonk::stdlib::byte_array<Composer> byte_array_t; +using Composer = proof_system::honk::StandardHonkComposer; +typedef proof_system::plonk::stdlib::bool_t<Composer> bool_t; +typedef proof_system::plonk::stdlib::field_t<Composer> field_t; +typedef proof_system::plonk::stdlib::safe_uint_t<Composer> suint_t; +typedef proof_system::plonk::stdlib::witness_t<Composer> witness_t; +typedef proof_system::plonk::stdlib::public_witness_t<Composer> public_witness_t; +typedef proof_system::plonk::stdlib::byte_array<Composer> byte_array_t; struct verify_logic_result { bool valid; diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp index f45b109bbf..fe4ea7284f 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/arithmetic.cpp @@ -2,9 +2,9 @@ #include "uint.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -413,4 +413,4 @@ template class uint<plonk::StandardPlonkComposer, uint32_t>; template class uint<plonk::StandardPlonkComposer, uint64_t>; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp index d4ce51b983..505ed34360 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/comparison.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename Native> @@ -122,4 +122,4 @@ template class uint<plonk::StandardPlonkComposer, uint32_t>; template class uint<plonk::StandardPlonkComposer, uint64_t>; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp index 17ec3cd566..1a13734fbe 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/logic.cpp @@ -3,9 +3,9 @@ #include "uint.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename Native> @@ -545,4 +545,4 @@ template class uint<plonk::StandardPlonkComposer, uint32_t>; template class uint<plonk::StandardPlonkComposer, uint64_t>; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp index b4da7fa037..6f479c0aa7 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/arithmetic.cpp @@ -2,9 +2,9 @@ #include "uint.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename Native> @@ -258,4 +258,4 @@ template class uint_plookup<plonk::UltraComposer, uint16_t>; template class uint_plookup<plonk::UltraComposer, uint32_t>; template class uint_plookup<plonk::UltraComposer, uint64_t>; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp index 891484cddb..8868aae3a5 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/comparison.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename Native> @@ -78,4 +78,4 @@ template class uint_plookup<plonk::UltraComposer, uint16_t>; template class uint_plookup<plonk::UltraComposer, uint32_t>; template class uint_plookup<plonk::UltraComposer, uint64_t>; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp index 4268611822..db45a6f7c3 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename Native> @@ -331,4 +331,4 @@ template class uint_plookup<plonk::UltraComposer, uint32_t>; template class uint_plookup<plonk::UltraComposer, uint64_t>; } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp index 6dba609b4e..e626d348f9 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.cpp @@ -3,7 +3,7 @@ using namespace barretenberg; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename Native> @@ -246,4 +246,4 @@ INSTANTIATE_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint32_t); INSTANTIATE_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint64_t); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp index 2ba2699140..14eecbaf5e 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/plookup/uint.hpp @@ -5,7 +5,7 @@ #include "../../field/field.hpp" #include "../../plookup/plookup.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { template <typename Composer, typename Native> class uint_plookup { @@ -178,4 +178,4 @@ EXTERN_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint32_t); EXTERN_STDLIB_ULTRA_TYPE_VA(uint_plookup, uint64_t); } // namespace stdlib -} // namespace plonk \ No newline at end of file +} // namespace proof_system::plonk \ No newline at end of file diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp index 6aefd17b10..c471804804 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/uint.cpp @@ -2,9 +2,9 @@ #include "../composers/composers.hpp" using namespace barretenberg; -using namespace bonk; +using namespace proof_system; -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -16,7 +16,7 @@ std::vector<uint32_t> uint<Composer, Native>::constrain_accumulators(Composer* c const size_t num_bits, std::string const& msg) const { - if constexpr (Composer::type == plonk::PLOOKUP) { + if constexpr (Composer::type == ComposerType::PLOOKUP) { // TODO: manage higher bit ranges const auto sequence = plookup_read::get_lookup_accumulators(plookup::MultiTableId::UINT32_XOR, @@ -405,4 +405,4 @@ INSTANTIATE_STDLIB_BASIC_TYPE_VA(uint, uint32_t); INSTANTIATE_STDLIB_BASIC_TYPE_VA(uint, uint64_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp b/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp index ba7dcaad1a..3d617c35ce 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/uint.fuzzer.hpp @@ -31,13 +31,13 @@ FastRandom VarianceRNG(0); */ template <typename Composer> class UintFuzzBase { private: - typedef plonk::stdlib::bool_t<Composer> bool_t; - typedef plonk::stdlib::uint<Composer, uint8_t> uint_8_t; - typedef plonk::stdlib::uint<Composer, uint16_t> uint_16_t; - typedef plonk::stdlib::uint<Composer, uint32_t> uint_32_t; - typedef plonk::stdlib::uint<Composer, uint64_t> uint_64_t; - typedef plonk::stdlib::field_t<Composer> field_t; - typedef plonk::stdlib::byte_array<Composer> byte_array_t; + typedef proof_system::plonk::stdlib::bool_t<Composer> bool_t; + typedef proof_system::plonk::stdlib::uint<Composer, uint8_t> uint_8_t; + typedef proof_system::plonk::stdlib::uint<Composer, uint16_t> uint_16_t; + typedef proof_system::plonk::stdlib::uint<Composer, uint32_t> uint_32_t; + typedef proof_system::plonk::stdlib::uint<Composer, uint64_t> uint_64_t; + typedef proof_system::plonk::stdlib::field_t<Composer> field_t; + typedef proof_system::plonk::stdlib::byte_array<Composer> byte_array_t; template <class From, class To> static To from_to(const From& in, const std::optional<size_t> size = std::nullopt) { diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp b/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp index 1747d12599..44f82f8b7b 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/uint.hpp @@ -12,7 +12,7 @@ #include "barretenberg/plonk/composer/turbo_composer.hpp" #include "barretenberg/plonk/composer/ultra_composer.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { /** @@ -216,4 +216,4 @@ EXTERN_STDLIB_BASIC_TYPE_VA(uint, uint32_t); EXTERN_STDLIB_BASIC_TYPE_VA(uint, uint64_t); } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp b/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp index 8ce1326a9a..5b098ba4e5 100644 --- a/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp +++ b/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp @@ -5,8 +5,8 @@ #include "barretenberg/numeric/random/engine.hpp" using namespace barretenberg; -using namespace plonk; -using namespace bonk; +using namespace proof_system::plonk; +using namespace proof_system; namespace { auto& engine = numeric::random::get_debug_engine(); @@ -2107,10 +2107,10 @@ TYPED_TEST(stdlib_uint, test_at) // There was one plookup-specific test in the ./plookup/uint_plookup.test.cpp TEST(stdlib_uint32, test_accumulators_plookup_uint32) { - using uint32_ct = plonk::stdlib::uint32<plonk::UltraComposer>; - using witness_ct = plonk::stdlib::witness_t<plonk::UltraComposer>; + using uint32_ct = proof_system::plonk::stdlib::uint32<plonk::UltraComposer>; + using witness_ct = proof_system::plonk::stdlib::witness_t<plonk::UltraComposer>; - plonk::UltraComposer composer = plonk::UltraComposer(); + plonk::UltraComposer composer = proof_system::plonk::UltraComposer(); uint32_t a_val = engine.get_random_uint32(); uint32_t b_val = engine.get_random_uint32(); diff --git a/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp b/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp index 33fadf1bc9..a157c9022d 100644 --- a/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/witness/witness.hpp @@ -2,7 +2,7 @@ #include "barretenberg/plonk/composer/composer_base.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { // indicates whether a witness index actually contains a constant @@ -84,4 +84,4 @@ template <typename ComposerContext> class public_witness_t : public witness_t<Co }; } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.hpp b/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.hpp index fd5352f78d..def7ead90a 100644 --- a/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.hpp +++ b/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.hpp @@ -16,7 +16,7 @@ #include "../../primitives/field/field.hpp" #include "../../primitives/witness/witness.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace recursion { template <typename Composer> class Transcript { @@ -25,7 +25,7 @@ template <typename Composer> class Transcript { using witness_pt = witness_t<Composer>; using fq_pt = bigfield<Composer, barretenberg::Bn254FqParams>; using group_pt = element<Composer, fq_pt, field_pt, barretenberg::g1>; - using Key = plonk::stdlib::recursion::verification_key<stdlib::bn254<Composer>>; + using Key = proof_system::plonk::stdlib::recursion::verification_key<stdlib::bn254<Composer>>; Transcript(Composer* in_context, const transcript::Manifest input_manifest) : context(in_context) @@ -404,4 +404,4 @@ template <typename Composer> class Transcript { }; } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp b/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp index 598e91ba79..a5d7c9ddb2 100644 --- a/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp +++ b/cpp/src/barretenberg/stdlib/recursion/transcript/transcript.test.cpp @@ -6,7 +6,7 @@ #include "barretenberg/transcript/transcript.hpp" -using namespace plonk; +using namespace proof_system::plonk; // ULTRATODO: Add tests for other composers too (make tests modular?) @@ -195,7 +195,7 @@ TEST(stdlib_transcript, validate_transcript) TestData data = get_test_data(); transcript::Transcript normal_transcript = get_test_base_transcript(data); - plonk::TurboComposer composer = plonk::TurboComposer(); + plonk::TurboComposer composer = proof_system::plonk::TurboComposer(); plonk::stdlib::recursion::Transcript<plonk::TurboComposer> recursive_transcript = get_circuit_transcript(&composer, data); diff --git a/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp b/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp index b5b448bde9..4d6dc477c4 100644 --- a/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp +++ b/cpp/src/barretenberg/stdlib/recursion/verification_key/verification_key.hpp @@ -3,7 +3,7 @@ #include "barretenberg/srs/reference_string/reference_string.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" -#include "barretenberg/proof_system/types/polynomial_manifest.hpp" +#include "barretenberg/plonk/proof_system/types/polynomial_manifest.hpp" #include "barretenberg/plonk/proof_system/utils/kate_verification.hpp" #include "barretenberg/plonk/proof_system/public_inputs/public_inputs.hpp" @@ -21,7 +21,7 @@ #include "../../hash/pedersen/pedersen_plookup.hpp" #include "../../primitives/curves/bn254.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace recursion { @@ -107,7 +107,7 @@ template <typename Composer> struct evaluation_domain { template <typename Curve> struct verification_key { using Composer = typename Curve::Composer; static std::shared_ptr<verification_key> from_witness(Composer* ctx, - const std::shared_ptr<bonk::verification_key>& input_key) + const std::shared_ptr<plonk::verification_key>& input_key) { std::shared_ptr<verification_key> key = std::make_shared<verification_key>(); // Native data: @@ -129,7 +129,7 @@ template <typename Curve> struct verification_key { } static std::shared_ptr<verification_key> from_constants(Composer* ctx, - const std::shared_ptr<bonk::verification_key>& input_key) + const std::shared_ptr<plonk::verification_key>& input_key) { std::shared_ptr<verification_key> key = std::make_shared<verification_key>(); key->context = ctx; @@ -150,7 +150,7 @@ template <typename Curve> struct verification_key { return key; } - void validate_key_is_in_set(const std::vector<std::shared_ptr<bonk::verification_key>>& keys_in_set) + void validate_key_is_in_set(const std::vector<std::shared_ptr<plonk::verification_key>>& keys_in_set) { const auto circuit_key_compressed = compress(); bool found = false; @@ -213,7 +213,7 @@ template <typename Curve> struct verification_key { return compressed_key; } - barretenberg::fr compress_native(const std::shared_ptr<bonk::verification_key>& key) + barretenberg::fr compress_native(const std::shared_ptr<plonk::verification_key>& key) { barretenberg::fr compressed_domain = evaluation_domain<Composer>::compress_native(key->domain); @@ -265,16 +265,16 @@ template <typename Curve> struct verification_key { // Native data: - std::shared_ptr<bonk::VerifierReferenceString> reference_string; + std::shared_ptr<VerifierReferenceString> reference_string; - bonk::PolynomialManifest polynomial_manifest; + PolynomialManifest polynomial_manifest; size_t program_width = 4; - std::shared_ptr<bonk::verification_key> base_key; + std::shared_ptr<plonk::verification_key> base_key; Composer* context; }; } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp b/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp index 4fc602071a..7b681206f4 100644 --- a/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp +++ b/cpp/src/barretenberg/stdlib/recursion/verifier/program_settings.hpp @@ -4,7 +4,7 @@ #include "../transcript/transcript.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace recursion { @@ -13,17 +13,19 @@ template <typename Curve> class recursive_ultra_verifier_settings : public plonk typedef typename Curve::fr_ct fr_ct; typedef typename Curve::g1::affine_element g1; typedef typename Curve::Composer Composer; - typedef plonk::stdlib::recursion::Transcript<Composer> Transcript_pt; - typedef plonk::VerifierPermutationWidget<fr_ct, g1, Transcript_pt> PermutationWidget; - typedef plonk::VerifierPlookupWidget<fr_ct, g1, Transcript_pt> PlookupWidget; + typedef proof_system::plonk::stdlib::recursion::Transcript<Composer> Transcript_pt; + typedef proof_system::plonk::VerifierPermutationWidget<fr_ct, g1, Transcript_pt> PermutationWidget; + typedef proof_system::plonk::VerifierPlookupWidget<fr_ct, g1, Transcript_pt> PlookupWidget; - typedef plonk::ultra_settings base_settings; + typedef proof_system::plonk::ultra_settings base_settings; - typedef plonk::VerifierPlookupArithmeticWidget<fr_ct, g1, Transcript_pt, base_settings> PlookupArithmeticWidget; - typedef plonk::VerifierTurboLogicWidget<fr_ct, g1, Transcript_pt, base_settings> TurboLogicWidget; - typedef plonk::VerifierGenPermSortWidget<fr_ct, g1, Transcript_pt, base_settings> GenPermSortWidget; - typedef plonk::VerifierEllipticWidget<fr_ct, g1, Transcript_pt, base_settings> EllipticWidget; - typedef plonk::VerifierPlookupAuxiliaryWidget<fr_ct, g1, Transcript_pt, base_settings> PlookupAuxiliaryWidget; + typedef proof_system::plonk::VerifierPlookupArithmeticWidget<fr_ct, g1, Transcript_pt, base_settings> + PlookupArithmeticWidget; + typedef proof_system::plonk::VerifierTurboLogicWidget<fr_ct, g1, Transcript_pt, base_settings> TurboLogicWidget; + typedef proof_system::plonk::VerifierGenPermSortWidget<fr_ct, g1, Transcript_pt, base_settings> GenPermSortWidget; + typedef proof_system::plonk::VerifierEllipticWidget<fr_ct, g1, Transcript_pt, base_settings> EllipticWidget; + typedef proof_system::plonk::VerifierPlookupAuxiliaryWidget<fr_ct, g1, Transcript_pt, base_settings> + PlookupAuxiliaryWidget; static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PlookupPedersenBlake3s; @@ -89,17 +91,19 @@ class recursive_ultra_to_standard_verifier_settings : public recursive_ultra_ver typedef typename Curve::fr_ct fr_ct; typedef typename Curve::g1::affine_element g1; typedef typename Curve::Composer Composer; - typedef plonk::stdlib::recursion::Transcript<Composer> Transcript_pt; - typedef plonk::VerifierPermutationWidget<fr_ct, g1, Transcript_pt> PermutationWidget; - typedef plonk::VerifierPlookupWidget<fr_ct, g1, Transcript_pt> PlookupWidget; + typedef proof_system::plonk::stdlib::recursion::Transcript<Composer> Transcript_pt; + typedef proof_system::plonk::VerifierPermutationWidget<fr_ct, g1, Transcript_pt> PermutationWidget; + typedef proof_system::plonk::VerifierPlookupWidget<fr_ct, g1, Transcript_pt> PlookupWidget; - typedef plonk::ultra_to_standard_settings base_settings; + typedef proof_system::plonk::ultra_to_standard_settings base_settings; - typedef plonk::VerifierPlookupArithmeticWidget<fr_ct, g1, Transcript_pt, base_settings> PlookupArithmeticWidget; - typedef plonk::VerifierTurboLogicWidget<fr_ct, g1, Transcript_pt, base_settings> TurboLogicWidget; - typedef plonk::VerifierGenPermSortWidget<fr_ct, g1, Transcript_pt, base_settings> GenPermSortWidget; - typedef plonk::VerifierEllipticWidget<fr_ct, g1, Transcript_pt, base_settings> EllipticWidget; - typedef plonk::VerifierPlookupAuxiliaryWidget<fr_ct, g1, Transcript_pt, base_settings> PlookupAuxiliaryWidget; + typedef proof_system::plonk::VerifierPlookupArithmeticWidget<fr_ct, g1, Transcript_pt, base_settings> + PlookupArithmeticWidget; + typedef proof_system::plonk::VerifierTurboLogicWidget<fr_ct, g1, Transcript_pt, base_settings> TurboLogicWidget; + typedef proof_system::plonk::VerifierGenPermSortWidget<fr_ct, g1, Transcript_pt, base_settings> GenPermSortWidget; + typedef proof_system::plonk::VerifierEllipticWidget<fr_ct, g1, Transcript_pt, base_settings> EllipticWidget; + typedef proof_system::plonk::VerifierPlookupAuxiliaryWidget<fr_ct, g1, Transcript_pt, base_settings> + PlookupAuxiliaryWidget; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; }; @@ -110,14 +114,16 @@ template <typename Curve> class recursive_turbo_verifier_settings : public plonk typedef typename Curve::g1::affine_element g1; typedef typename Curve::Composer Composer; typedef Transcript<Composer> Transcript_pt; - typedef plonk::VerifierPermutationWidget<fr_ct, g1, Transcript_pt> PermutationWidget; + typedef proof_system::plonk::VerifierPermutationWidget<fr_ct, g1, Transcript_pt> PermutationWidget; - typedef plonk::turbo_settings base_settings; + typedef proof_system::plonk::turbo_settings base_settings; - typedef plonk::VerifierTurboFixedBaseWidget<fr_ct, g1, Transcript_pt, base_settings> TurboFixedBaseWidget; - typedef plonk::VerifierTurboArithmeticWidget<fr_ct, g1, Transcript_pt, base_settings> TurboArithmeticWidget; - typedef plonk::VerifierTurboRangeWidget<fr_ct, g1, Transcript_pt, base_settings> TurboRangeWidget; - typedef plonk::VerifierTurboLogicWidget<fr_ct, g1, Transcript_pt, base_settings> TurboLogicWidget; + typedef proof_system::plonk::VerifierTurboFixedBaseWidget<fr_ct, g1, Transcript_pt, base_settings> + TurboFixedBaseWidget; + typedef proof_system::plonk::VerifierTurboArithmeticWidget<fr_ct, g1, Transcript_pt, base_settings> + TurboArithmeticWidget; + typedef proof_system::plonk::VerifierTurboRangeWidget<fr_ct, g1, Transcript_pt, base_settings> TurboRangeWidget; + typedef proof_system::plonk::VerifierTurboLogicWidget<fr_ct, g1, Transcript_pt, base_settings> TurboLogicWidget; static constexpr size_t num_challenge_bytes = 16; static constexpr transcript::HashType hash_type = transcript::HashType::PedersenBlake3s; @@ -162,4 +168,4 @@ template <typename Curve> class recursive_turbo_verifier_settings : public plonk } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp index 1b87e6ab44..83800640ee 100644 --- a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp +++ b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.hpp @@ -15,7 +15,7 @@ #include "barretenberg/ecc/curves/bn254/fq12.hpp" #include "barretenberg/ecc/curves/bn254/pairing.hpp" -namespace plonk { +namespace proof_system::plonk { namespace stdlib { namespace recursion { @@ -61,7 +61,7 @@ void populate_kate_element_map(typename Curve::Composer* ctx, const std::string label(item.commitment_label); const std::string poly_label(item.polynomial_label); switch (item.source) { - case bonk::PolynomialSource::WITNESS: { + case PolynomialSource::WITNESS: { const auto element = transcript.get_group_element(label); ASSERT(element.on_curve()); if (element.is_point_at_infinity()) { @@ -72,8 +72,8 @@ void populate_kate_element_map(typename Curve::Composer* ctx, kate_g1_elements.insert({ label, g1_ct::from_witness(ctx, element) }); break; } - case bonk::PolynomialSource::SELECTOR: - case bonk::PolynomialSource::PERMUTATION: { + case PolynomialSource::SELECTOR: + case PolynomialSource::PERMUTATION: { const auto element = key->commitments.at(label); // TODO: with user-defined circuits, we will need verify that the point // lies on the curve with constraints @@ -87,7 +87,7 @@ void populate_kate_element_map(typename Curve::Composer* ctx, kate_g1_elements.insert({ label, element }); break; } - case bonk::PolynomialSource::OTHER: { + case PolynomialSource::OTHER: { break; } } @@ -118,7 +118,8 @@ void populate_kate_element_map(typename Curve::Composer* ctx, fr_ct u = transcript.get_challenge_field_element("separator", 0); - fr_ct batch_evaluation = plonk::compute_kate_batch_evaluation<fr_ct, Transcript, program_settings>(key, transcript); + fr_ct batch_evaluation = + proof_system::plonk::compute_kate_batch_evaluation<fr_ct, Transcript, program_settings>(key, transcript); batch_opening_scalar = -batch_evaluation; kate_g1_elements.insert({ "PI_Z_OMEGA", g1_ct::from_witness(ctx, PI_Z_OMEGA) }); @@ -424,4 +425,4 @@ recursion_output<Curve> verify_proof(typename Curve::Composer* context, } // namespace recursion } // namespace stdlib -} // namespace plonk +} // namespace proof_system::plonk diff --git a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp index 1a6ee080bb..25364b2358 100644 --- a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp +++ b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier.test.cpp @@ -1,7 +1,7 @@ #include "verifier.hpp" #include "barretenberg/common/test.hpp" #include "barretenberg/transcript/transcript.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/ecc/curves/bn254/fq12.hpp" #include "barretenberg/ecc/curves/bn254/pairing.hpp" @@ -9,16 +9,16 @@ #include "../../hash/pedersen/pedersen.hpp" #include "program_settings.hpp" -using namespace plonk; +using namespace proof_system::plonk; template <typename OuterComposer> class stdlib_verifier : public testing::Test { - using InnerComposer = plonk::UltraComposer; + using InnerComposer = proof_system::plonk::UltraComposer; typedef stdlib::bn254<InnerComposer> inner_curve; typedef stdlib::bn254<OuterComposer> outer_curve; - typedef plonk::stdlib::recursion::verification_key<outer_curve> verification_key_pt; - typedef plonk::stdlib::recursion::recursive_ultra_verifier_settings<outer_curve> recursive_settings; - typedef plonk::stdlib::recursion::recursive_ultra_to_standard_verifier_settings<outer_curve> + typedef proof_system::plonk::stdlib::recursion::verification_key<outer_curve> verification_key_pt; + typedef proof_system::plonk::stdlib::recursion::recursive_ultra_verifier_settings<outer_curve> recursive_settings; + typedef proof_system::plonk::stdlib::recursion::recursive_ultra_to_standard_verifier_settings<outer_curve> ultra_to_standard_recursive_settings; typedef inner_curve::fr_ct fr_ct; typedef inner_curve::public_witness_ct public_witness_ct; diff --git a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp index 61d0b55a8f..3766296af7 100644 --- a/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp +++ b/cpp/src/barretenberg/stdlib/recursion/verifier/verifier_turbo.test.cpp @@ -1,7 +1,7 @@ #include "verifier.hpp" #include "barretenberg/common/test.hpp" #include "barretenberg/transcript/transcript.hpp" -#include "barretenberg/proof_system/proving_key/serialize.hpp" +#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/stdlib/primitives/curves/bn254.hpp" #include "barretenberg/ecc/curves/bn254/fq12.hpp" #include "barretenberg/ecc/curves/bn254/pairing.hpp" @@ -9,15 +9,15 @@ #include "../../hash/pedersen/pedersen.hpp" #include "program_settings.hpp" -using namespace plonk; +using namespace proof_system::plonk; template <typename OuterComposer> class stdlib_verifier_turbo : public testing::Test { - using InnerComposer = plonk::TurboComposer; + using InnerComposer = proof_system::plonk::TurboComposer; typedef stdlib::bn254<InnerComposer> inner_curve; typedef stdlib::bn254<OuterComposer> outer_curve; - typedef plonk::stdlib::recursion::verification_key<outer_curve> verification_key_pt; - typedef plonk::stdlib::recursion::recursive_turbo_verifier_settings<outer_curve> recursive_settings; + typedef proof_system::plonk::stdlib::recursion::verification_key<outer_curve> verification_key_pt; + typedef proof_system::plonk::stdlib::recursion::recursive_turbo_verifier_settings<outer_curve> recursive_settings; typedef inner_curve::fr_ct fr_ct; typedef inner_curve::public_witness_ct public_witness_ct; typedef inner_curve::witness_ct witness_ct; diff --git a/cpp/src/barretenberg/stdlib/types/types.hpp b/cpp/src/barretenberg/stdlib/types/types.hpp index 4fdc71e1c0..15f524d8ed 100644 --- a/cpp/src/barretenberg/stdlib/types/types.hpp +++ b/cpp/src/barretenberg/stdlib/types/types.hpp @@ -25,37 +25,39 @@ #include "barretenberg/stdlib/primitives/memory/rom_table.hpp" #include "barretenberg/stdlib/primitives/memory/dynamic_array.hpp" -namespace plonk::stdlib::types { +namespace proof_system::plonk::stdlib::types { -using namespace plonk; -static constexpr size_t SYSTEM_COMPOSER = plonk::SYSTEM_COMPOSER; +using namespace proof_system::plonk; +static constexpr size_t SYSTEM_COMPOSER = proof_system::plonk::SYSTEM_COMPOSER; typedef std::conditional_t< - SYSTEM_COMPOSER == plonk::STANDARD, + SYSTEM_COMPOSER == proof_system::STANDARD, plonk::StandardComposer, - std::conditional_t<SYSTEM_COMPOSER == plonk::TURBO, plonk::TurboComposer, plonk::UltraComposer>> + std::conditional_t<SYSTEM_COMPOSER == proof_system::TURBO, plonk::TurboComposer, plonk::UltraComposer>> Composer; -typedef std::conditional_t<SYSTEM_COMPOSER == plonk::STANDARD, - plonk::Prover, - std::conditional_t<SYSTEM_COMPOSER == plonk::TURBO, plonk::TurboProver, plonk::UltraProver>> +typedef std::conditional_t< + SYSTEM_COMPOSER == proof_system::STANDARD, + plonk::Prover, + std::conditional_t<SYSTEM_COMPOSER == proof_system::TURBO, plonk::TurboProver, plonk::UltraProver>> Prover; typedef std::conditional_t< - SYSTEM_COMPOSER == plonk::STANDARD, + SYSTEM_COMPOSER == proof_system::STANDARD, plonk::Verifier, - std::conditional_t<SYSTEM_COMPOSER == plonk::TURBO, plonk::TurboVerifier, plonk::UltraVerifier>> + std::conditional_t<SYSTEM_COMPOSER == proof_system::TURBO, plonk::TurboVerifier, plonk::UltraVerifier>> Verifier; -typedef std::conditional_t<SYSTEM_COMPOSER == plonk::STANDARD, - plonk::Prover, - std::conditional_t<SYSTEM_COMPOSER == plonk::TURBO, plonk::TurboProver, plonk::UltraProver>> +typedef std::conditional_t< + SYSTEM_COMPOSER == proof_system::STANDARD, + plonk::Prover, + std::conditional_t<SYSTEM_COMPOSER == proof_system::TURBO, plonk::TurboProver, plonk::UltraProver>> Prover; typedef std::conditional_t< - SYSTEM_COMPOSER == plonk::STANDARD, + SYSTEM_COMPOSER == proof_system::STANDARD, plonk::Verifier, - std::conditional_t<SYSTEM_COMPOSER == plonk::TURBO, plonk::TurboVerifier, plonk::UltraVerifier>> + std::conditional_t<SYSTEM_COMPOSER == proof_system::TURBO, plonk::TurboVerifier, plonk::UltraVerifier>> Verifier; typedef stdlib::witness_t<Composer> witness_ct; @@ -90,9 +92,9 @@ typedef stdlib::schnorr::signature_bits<Composer> signature_bits; // Ultra-composer specific types typedef stdlib::rom_table<plonk::UltraComposer> rom_table_ct; -typedef std::conditional_t<SYSTEM_COMPOSER == plonk::TURBO, +typedef std::conditional_t<SYSTEM_COMPOSER == proof_system::TURBO, recursion::recursive_turbo_verifier_settings<bn254>, recursion::recursive_ultra_verifier_settings<bn254>> recursive_inner_verifier_settings; -} // namespace plonk::stdlib::types +} // namespace proof_system::plonk::stdlib::types diff --git a/cpp/src/barretenberg/transcript/transcript.hpp b/cpp/src/barretenberg/transcript/transcript.hpp index 8dd72033fa..43d47e3972 100644 --- a/cpp/src/barretenberg/transcript/transcript.hpp +++ b/cpp/src/barretenberg/transcript/transcript.hpp @@ -6,7 +6,7 @@ #include <vector> #include <exception> -#include "../proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" namespace transcript { @@ -39,7 +39,7 @@ class Transcript { }; public: - typedef bonk::verification_key Key; + typedef proof_system::plonk::verification_key Key; /** * Create a new transcript for Prover based on the manifest. diff --git a/cpp/src/barretenberg/transcript/transcript.test.cpp b/cpp/src/barretenberg/transcript/transcript.test.cpp index d11e7413ac..b953173ae5 100644 --- a/cpp/src/barretenberg/transcript/transcript.test.cpp +++ b/cpp/src/barretenberg/transcript/transcript.test.cpp @@ -136,7 +136,7 @@ TEST(transcript, univariate_serialization) constexpr size_t LENGTH = 8; using Fr = barretenberg::fr; - using Univariate = honk::sumcheck::Univariate<Fr, LENGTH>; + using Univariate = proof_system::honk::sumcheck::Univariate<Fr, LENGTH>; using Transcript = transcript::StandardTranscript; std::vector<uint8_t> g1_vector(64);