From 598b2e9685134d1b208d912bfb52da59d2bb5781 Mon Sep 17 00:00:00 2001 From: ludamad Date: Fri, 31 May 2024 16:13:18 +0000 Subject: [PATCH 1/8] stash --- .../dsl/acir_format/block_constraint.hpp | 6 +- .../dsl/acir_format/recursion_constraint.hpp | 4 +- .../src/barretenberg/dsl/builder_types.hpp | 9 ++ .../cpp/src/barretenberg/dsl/types.hpp | 129 +++++++++--------- .../circuits/blake_circuit.hpp | 13 +- .../stdlib/hash/pedersen/pedersen.hpp | 1 - .../stdlib/hash/poseidon2/poseidon2.hpp | 1 - .../hash/poseidon2/poseidon2_permutation.hpp | 1 - .../stdlib_circuit_builders/databus.hpp | 2 - .../mega_circuit_builder.hpp | 2 - .../ultra_circuit_builder.hpp | 2 - 11 files changed, 84 insertions(+), 86 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp index 0a5f2c2b40a..79d4fce0a45 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp @@ -8,8 +8,8 @@ namespace acir_format { struct MemOp { uint8_t access_type; - poly_triple index; - poly_triple value; + bb::poly_triple index; + bb::poly_triple value; }; enum BlockType { @@ -20,7 +20,7 @@ enum BlockType { }; struct BlockConstraint { - std::vector init; + std::vector init; std::vector trace; BlockType type; }; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp index b7cdde81f1e..a8856994419 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp @@ -1,6 +1,8 @@ #pragma once -#include "barretenberg/dsl/types.hpp" +#include "barretenberg/dsl/builder_types.hpp" +#include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/plonk/transcript/transcript_wrappers.hpp" #include namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp b/barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp new file mode 100644 index 00000000000..ab2d5741cb6 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" + +namespace acir_format { + +using Builder = bb::UltraCircuitBuilder; + +} // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/types.hpp b/barretenberg/cpp/src/barretenberg/dsl/types.hpp index fb48a69622d..8c0e9802afc 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/types.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/types.hpp @@ -1,76 +1,77 @@ -#pragma once -#include "barretenberg/plonk/composer/ultra_composer.hpp" +// #pragma once +// #include "barretenberg/plonk/composer/ultra_composer.hpp" -#include "barretenberg/crypto/merkle_tree/hash_path.hpp" -#include "barretenberg/goblin/goblin.hpp" -#include "barretenberg/plonk/proof_system/prover/prover.hpp" -#include "barretenberg/stdlib/commitment/pedersen/pedersen.hpp" -#include "barretenberg/stdlib/encryption/schnorr/schnorr.hpp" -#include "barretenberg/stdlib/plonk_recursion/aggregation_state/aggregation_state.hpp" -#include "barretenberg/stdlib/plonk_recursion/verification_key/verification_key.hpp" -#include "barretenberg/stdlib/plonk_recursion/verifier/program_settings.hpp" -#include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" -#include "barretenberg/stdlib/primitives/biggroup/biggroup.hpp" -#include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" -#include "barretenberg/stdlib/primitives/bool/bool.hpp" -#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -#include "barretenberg/stdlib/primitives/curves/bn254.hpp" -#include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" -#include "barretenberg/stdlib/primitives/curves/secp256r1.hpp" -#include "barretenberg/stdlib/primitives/databus/databus.hpp" -#include "barretenberg/stdlib/primitives/memory/ram_table.hpp" -#include "barretenberg/stdlib/primitives/memory/rom_table.hpp" -#include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp" -#include "barretenberg/stdlib/primitives/uint/uint.hpp" -#include "barretenberg/stdlib/primitives/witness/witness.hpp" +// #include "barretenberg/crypto/merkle_tree/hash_path.hpp" +// #include "barretenberg/goblin/goblin.hpp" +// #include "barretenberg/plonk/proof_system/prover/prover.hpp" +// #include "barretenberg/stdlib/commitment/pedersen/pedersen.hpp" +// #include "barretenberg/stdlib/encryption/schnorr/schnorr.hpp" +// #include "barretenberg/stdlib/plonk_recursion/aggregation_state/aggregation_state.hpp" +// #include "barretenberg/stdlib/plonk_recursion/verification_key/verification_key.hpp" +// #include "barretenberg/stdlib/plonk_recursion/verifier/program_settings.hpp" +// #include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" +// #include "barretenberg/stdlib/primitives/biggroup/biggroup.hpp" +// #include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" +// #include "barretenberg/stdlib/primitives/bool/bool.hpp" +// #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" +// #include "barretenberg/stdlib/primitives/curves/bn254.hpp" +// #include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" +// #include "barretenberg/stdlib/primitives/curves/secp256r1.hpp" +// #include "barretenberg/stdlib/primitives/databus/databus.hpp" +// #include "barretenberg/stdlib/primitives/memory/ram_table.hpp" +// #include "barretenberg/stdlib/primitives/memory/rom_table.hpp" +// #include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp" +// #include "barretenberg/stdlib/primitives/uint/uint.hpp" +// #include "barretenberg/stdlib/primitives/witness/witness.hpp" -namespace acir_format { +// namespace acir_format { -using Builder = bb::UltraCircuitBuilder; -using GoblinBuilder = bb::GoblinProver::Builder; -using Composer = plonk::UltraComposer; +// using Builder = bb::UltraCircuitBuilder; +// using GoblinBuilder = bb::GoblinProver::Builder; +// using Composer = plonk::UltraComposer; -using Prover = - std::conditional_t, plonk::UltraWithKeccakProver, plonk::Prover>; +// using Prover = +// std::conditional_t, plonk::UltraWithKeccakProver, plonk::Prover>; -using Verifier = - std::conditional_t, plonk::UltraWithKeccakVerifier, plonk::Verifier>; +// using Verifier = +// std::conditional_t, plonk::UltraWithKeccakVerifier, +// plonk::Verifier>; -using RecursiveProver = plonk::UltraProver; +// using RecursiveProver = plonk::UltraProver; -using witness_ct = bb::stdlib::witness_t; -using public_witness_ct = bb::stdlib::public_witness_t; -using bool_ct = bb::stdlib::bool_t; -using byte_array_ct = bb::stdlib::byte_array; -using packed_byte_array_ct = bb::stdlib::packed_byte_array; -using field_ct = bb::stdlib::field_t; -using suint_ct = bb::stdlib::safe_uint_t; -using uint8_ct = bb::stdlib::uint8; -using uint16_ct = bb::stdlib::uint16; -using uint32_ct = bb::stdlib::uint32; -using uint64_ct = bb::stdlib::uint64; -using bit_array_ct = bb::stdlib::bit_array; -using fq_ct = bb::stdlib::bigfield; -using biggroup_ct = bb::stdlib::element; -using cycle_group_ct = bb::stdlib::cycle_group; -using cycle_scalar_ct = bb::stdlib::cycle_group::cycle_scalar; -using pedersen_commitment = bb::stdlib::pedersen_commitment; -using bn254 = bb::stdlib::bn254; -using secp256k1_ct = bb::stdlib::secp256k1; -using secp256r1_ct = bb::stdlib::secp256r1; -using databus_ct = bb::stdlib::databus; +// using witness_ct = bb::stdlib::witness_t; +// using public_witness_ct = bb::stdlib::public_witness_t; +// using bool_ct = bb::stdlib::bool_t; +// using byte_array_ct = bb::stdlib::byte_array; +// using packed_byte_array_ct = bb::stdlib::packed_byte_array; +// using field_ct = bb::stdlib::field_t; +// using suint_ct = bb::stdlib::safe_uint_t; +// using uint8_ct = bb::stdlib::uint8; +// using uint16_ct = bb::stdlib::uint16; +// using uint32_ct = bb::stdlib::uint32; +// using uint64_ct = bb::stdlib::uint64; +// using bit_array_ct = bb::stdlib::bit_array; +// using fq_ct = bb::stdlib::bigfield; +// using biggroup_ct = bb::stdlib::element; +// using cycle_group_ct = bb::stdlib::cycle_group; +// using cycle_scalar_ct = bb::stdlib::cycle_group::cycle_scalar; +// using pedersen_commitment = bb::stdlib::pedersen_commitment; +// using bn254 = bb::stdlib::bn254; +// using secp256k1_ct = bb::stdlib::secp256k1; +// using secp256r1_ct = bb::stdlib::secp256r1; +// using databus_ct = bb::stdlib::databus; -using hash_path_ct = bb::crypto::merkle_tree::hash_path; +// using hash_path_ct = bb::crypto::merkle_tree::hash_path; -using schnorr_signature_bits_ct = bb::stdlib::schnorr_signature_bits; +// using schnorr_signature_bits_ct = bb::stdlib::schnorr_signature_bits; -// Ultra-composer specific typesv -using rom_table_ct = bb::stdlib::rom_table; -using ram_table_ct = bb::stdlib::ram_table; +// // Ultra-composer specific typesv +// using rom_table_ct = bb::stdlib::rom_table; +// using ram_table_ct = bb::stdlib::ram_table; -using verification_key_ct = bb::stdlib::recursion::verification_key; -using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; -using noir_recursive_settings = bb::stdlib::recursion::recursive_ultra_verifier_settings; -using Transcript_ct = bb::stdlib::recursion::Transcript; +// using verification_key_ct = bb::stdlib::recursion::verification_key; +// using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; +// using noir_recursive_settings = bb::stdlib::recursion::recursive_ultra_verifier_settings; +// using Transcript_ct = bb::stdlib::recursion::Transcript; -} // namespace acir_format +// } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/solidity_helpers/circuits/blake_circuit.hpp b/barretenberg/cpp/src/barretenberg/solidity_helpers/circuits/blake_circuit.hpp index ba6b641fc47..ff31d816301 100644 --- a/barretenberg/cpp/src/barretenberg/solidity_helpers/circuits/blake_circuit.hpp +++ b/barretenberg/cpp/src/barretenberg/solidity_helpers/circuits/blake_circuit.hpp @@ -3,16 +3,11 @@ #include "barretenberg/stdlib/primitives/field/field.hpp" #include "barretenberg/stdlib/primitives/witness/witness.hpp" -using namespace bb::plonk; -using namespace bb::stdlib; - -using numeric::uint256_t; - template class BlakeCircuit { public: - typedef stdlib::field_t field_ct; - typedef stdlib::public_witness_t public_witness_ct; - typedef stdlib::byte_array byte_array_ct; + using field_ct = bb::stdlib::field_t; + using public_witness_ct = bb::stdlib::public_witness_t; + using byte_array_ct = bb::stdlib::byte_array; static constexpr size_t NUM_PUBLIC_INPUTS = 4; @@ -25,7 +20,7 @@ template class BlakeCircuit { input_buffer.write(byte_array_ct(field_ct(public_witness_ct(&builder, public_inputs[i])))); } - stdlib::blake2s(input_buffer); + bb::stdlib::blake2s(input_buffer); return builder; } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp index 6ff9e689c06..178677bdbfe 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/pedersen/pedersen.hpp @@ -8,7 +8,6 @@ namespace bb::stdlib { -using namespace bb; /** * @brief stdlib class that evaluates in-circuit pedersen hashes, consistent with behavior in * crypto::pedersen_hash diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2.hpp index 2083bfb3951..403d5f39f58 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2.hpp @@ -8,7 +8,6 @@ namespace bb::stdlib { -using namespace bb; /** * @brief stdlib class that evaluates in-circuit poseidon2 hashes, consistent with behavior in * crypto::poseidon2 diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.hpp index 3c6a2f7dcef..1b03a236893 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.hpp @@ -9,7 +9,6 @@ namespace bb::stdlib { -using namespace bb; template class Poseidon2Permutation { public: using NativePermutation = crypto::Poseidon2Permutation; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp index 88434a81a43..b83c842e72a 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/databus.hpp @@ -3,8 +3,6 @@ #include namespace bb { -using namespace bb; - /** * @brief A DataBus column * diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp index ff811b9ff22..7cb00055547 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp @@ -7,8 +7,6 @@ namespace bb { -using namespace bb; - template class MegaCircuitBuilder_ : public UltraCircuitBuilder_> { private: DataBus databus; // Container for public calldata/returndata diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp index 3090061e984..ccc52083641 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp @@ -24,8 +24,6 @@ template struct non_native_field_witnesses { FF modulus; }; -using namespace bb; - template class UltraCircuitBuilder_ : public CircuitBuilderBase { public: From f7088f84b88c5846c637cbee6992321bddd40c54 Mon Sep 17 00:00:00 2001 From: ludamad Date: Fri, 31 May 2024 16:27:14 +0000 Subject: [PATCH 2/8] get compile fixing --- .../crypto/merkle_tree/hash_path.hpp | 1 - .../crypto/merkle_tree/merkle_tree.test.cpp | 1 + .../dsl/acir_format/aes128_constraint.cpp | 2 ++ .../dsl/acir_format/ecdsa_secp256k1.cpp | 2 +- .../dsl/acir_format/ecdsa_secp256k1.hpp | 21 ++++++++++++------- .../dsl/acir_format/recursion_constraint.cpp | 2 ++ 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash_path.hpp b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash_path.hpp index fb9130bda2e..44a1e1b4c7a 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash_path.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/hash_path.hpp @@ -6,7 +6,6 @@ namespace bb::crypto::merkle_tree { -using fr = bb::stdlib::fr; using fr_hash_path = std::vector>; using fr_sibling_path = std::vector; template using hash_path = std::vector, bb::stdlib::field_t>>; diff --git a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/merkle_tree.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/merkle_tree.test.cpp index 085f97555ab..e2fd2d55d56 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/merkle_tree.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/merkle_tree/merkle_tree.test.cpp @@ -5,6 +5,7 @@ #include "memory_store.hpp" #include "memory_tree.hpp" +using namespace bb; using namespace bb::stdlib; using namespace bb::crypto::merkle_tree; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.cpp index 41169d1f614..c835322b52c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.cpp @@ -4,6 +4,8 @@ #include #include +using namespace bb; + namespace acir_format { template void create_aes128_constraints(Builder& builder, const AES128Constraint& constraint) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp index 2b6c84ca795..7fcbd24b1ac 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp @@ -6,7 +6,7 @@ namespace acir_format { using namespace bb::plonk; template -secp256k1_ct::g1_ct ecdsa_convert_inputs(Builder* ctx, const secp256k1::g1::affine_element& input) +secp256k1::g1_ct ecdsa_convert_inputs(Builder* ctx, const secp256k1::g1::affine_element& input) { uint256_t x_u256(input.x); uint256_t y_u256(input.y); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp index d5eb6e2df85..05b0154009d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp @@ -1,11 +1,16 @@ #pragma once #include "barretenberg/crypto/ecdsa/ecdsa.hpp" +#include "barretenberg/dsl/builder_types.hpp" #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" +#include "barretenberg/stdlib/primitives/witness/witness.hpp" #include namespace acir_format { +using witness_ct = bb::stdlib::witness_t; + struct EcdsaSecp256k1Constraint { // This is the byte representation of the hashed message. std::array hashed_message; @@ -47,10 +52,10 @@ bb::stdlib::byte_array ecdsa_array_of_bytes_to_byte_array(Builder& buil // gcc needs to be able to see the implementation order to generate code for // all Builder specializations (e.g. bb::Goblin::Builder vs. bb::UltraCircuitBuilder) template -crypto::ecdsa_signature ecdsa_convert_signature(Builder& builder, std::array signature) +bb::crypto::ecdsa_signature ecdsa_convert_signature(Builder& builder, std::array signature) { - crypto::ecdsa_signature signature_cr; + bb::crypto::ecdsa_signature signature_cr; // Get the witness assignment for each witness index // Write the witness assignment to the byte_array @@ -58,11 +63,11 @@ crypto::ecdsa_signature ecdsa_convert_signature(Builder& builder, std::array fr_bytes(sizeof(fr)); + std::vector fr_bytes(sizeof(bb::fr)); - fr value = builder.get_variable(witness_index); + bb::fr value = builder.get_variable(witness_index); - fr::serialize_to_buffer(value, &fr_bytes[0]); + bb::fr::serialize_to_buffer(value, &fr_bytes[0]); signature_cr.r[i] = fr_bytes.back(); } @@ -70,11 +75,11 @@ crypto::ecdsa_signature ecdsa_convert_signature(Builder& builder, std::array fr_bytes(sizeof(fr)); + std::vector fr_bytes(sizeof(bb::fr)); - fr value = builder.get_variable(witness_index); + bb::fr value = builder.get_variable(witness_index); - fr::serialize_to_buffer(value, &fr_bytes[0]); + bb::fr::serialize_to_buffer(value, &fr_bytes[0]); signature_cr.s[i - 32] = fr_bytes.back(); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp index a31bc080d4f..493b52a153c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp @@ -5,6 +5,8 @@ #include "barretenberg/stdlib/plonk_recursion/verifier/verifier.hpp" #include "barretenberg/stdlib/primitives/bigfield/constants.hpp" +using namespace bb; + namespace acir_format { using namespace bb::plonk; From 537346ede820c9133ccc2691b3e7905eda015861 Mon Sep 17 00:00:00 2001 From: ludamad Date: Fri, 31 May 2024 18:20:00 +0000 Subject: [PATCH 3/8] up --- .../dsl/acir_format/acir_format.hpp | 2 +- .../dsl/acir_format/bigint_constraint.hpp | 3 +++ .../dsl/acir_format/ec_operations.cpp | 19 ++++++++++--------- .../dsl/acir_format/ecdsa_secp256k1.cpp | 4 +++- .../acir_format/honk_recursion_constraint.hpp | 5 ++--- .../dsl/acir_format/recursion_constraint.cpp | 5 +++++ 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp index 8c876d064a1..16ea138f48f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -63,7 +63,7 @@ struct AcirFormat { // A standard plonk arithmetic constraint, as defined in the poly_triple struct, consists of selector values // for q_M,q_L,q_R,q_O,q_C and indices of three variables taking the role of left, right and output wire // This could be a large vector so use slab allocator, we don't expect the blackbox implementations to be so large. - std::vector, + std::vector, ContainerSlabAllocator>> poly_triple_constraints; std::vector, ContainerSlabAllocator>> diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp index 9e6e4f087fd..537e36d3a38 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp @@ -1,6 +1,9 @@ #pragma once #include "barretenberg/dsl/types.hpp" +#include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp" +#include "barretenberg/ecc/curves/secp256r1/secp256r1.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp index 54c1f71d925..15dc145be3a 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp @@ -4,6 +4,7 @@ #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/ecc/groups/affine_element.hpp" #include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp" +#include "barretenberg/stdlib/primitives/group/cycle_group.hpp" namespace acir_format { @@ -22,14 +23,14 @@ void create_ec_add_constraint(Builder& builder, const EcAdd& input, bool has_val auto infinite1 = bool_ct(field_ct::from_witness_index(&builder, input.input1_infinite)); auto infinite2 = bool_ct(field_ct::from_witness_index(&builder, input.input2_infinite)); if (!has_valid_witness_assignments) { - auto g1 = grumpkin::g1::affine_one; + auto g1 = bb::grumpkin::g1::affine_one; // We need to have correct values representing points on the curve builder.variables[input.input1_x] = g1.x; builder.variables[input.input1_y] = g1.y; - builder.variables[input.input1_infinite] = fr(0); + builder.variables[input.input1_infinite] = bb::fr(0); builder.variables[input.input2_x] = g1.x; builder.variables[input.input2_y] = g1.y; - builder.variables[input.input2_infinite] = fr(0); + builder.variables[input.input2_infinite] = bb::fr(0); } cycle_group_ct input1_point(x1, y1, infinite1); cycle_group_ct input2_point(x2, y2, infinite2); @@ -44,11 +45,11 @@ void create_ec_add_constraint(Builder& builder, const EcAdd& input, bool has_val builder.assert_equal(infinite.witness_index, input.result_infinite); } -template void create_ec_add_constraint(UltraCircuitBuilder& builder, - const EcAdd& input, - bool has_valid_witness_assignments); -template void create_ec_add_constraint(MegaCircuitBuilder& builder, - const EcAdd& input, - bool has_valid_witness_assignments); +template void create_ec_add_constraint(bb::UltraCircuitBuilder& builder, + const EcAdd& input, + bool has_valid_witness_assignments); +template void create_ec_add_constraint(bb::MegaCircuitBuilder& builder, + const EcAdd& input, + bool has_valid_witness_assignments); } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp index 7fcbd24b1ac..bee578e869b 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp @@ -3,10 +3,12 @@ namespace acir_format { +using secp256k1_ct = bb::stdlib::secp256k1; + using namespace bb::plonk; template -secp256k1::g1_ct ecdsa_convert_inputs(Builder* ctx, const secp256k1::g1::affine_element& input) +secp256k1_ct::g1_ct ecdsa_convert_inputs(Builder* ctx, const bb::secp256k1::g1::affine_element& input) { uint256_t x_u256(input.x); uint256_t y_u256(input.y); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp index bf70c2866f2..ae7a2dfe98c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp @@ -1,11 +1,10 @@ #pragma once #include "barretenberg/dsl/types.hpp" +#include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" #include namespace acir_format { - -using namespace bb; - +using fq_ct = bb::stdlib::bigfield; /** * @brief HonkRecursionConstraint struct contains information required to recursively verify a proof! * diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp index 493b52a153c..9a994754dad 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp @@ -1,4 +1,5 @@ #include "recursion_constraint.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/transcript/transcript_wrappers.hpp" #include "barretenberg/stdlib/plonk_recursion/aggregation_state/aggregation_state.hpp" @@ -9,6 +10,10 @@ using namespace bb; namespace acir_format { +using Composer = plonk::UltraComposer; +using bn254 = bb::stdlib::bn254; +using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; + using namespace bb::plonk; // `NUM_LIMB_BITS_IN_FIELD_SIMULATION` is the limb size when simulating a non-native field using the bigfield class From e8441a4aa6403d2ecb948deecbe6dafa13684fbe Mon Sep 17 00:00:00 2001 From: ludamad Date: Sat, 1 Jun 2024 19:30:06 +0000 Subject: [PATCH 4/8] update --- barretenberg/cpp/src/barretenberg/bb/main.cpp | 1 + .../dsl/acir_format/acir_format.cpp | 7 +- .../dsl/acir_format/acir_format.hpp | 13 ++-- .../dsl/acir_format/acir_format.test.cpp | 3 + .../dsl/acir_format/acir_integration.test.cpp | 1 + .../acir_format/acir_to_constraint_buf.cpp | 35 +++++---- .../dsl/acir_format/aes128_constraint.hpp | 1 + .../dsl/acir_format/bigint_constraint.cpp | 2 + .../acir_format/bigint_constraint.test.cpp | 2 +- .../dsl/acir_format/blake2s_constraint.cpp | 10 ++- .../dsl/acir_format/blake2s_constraint.hpp | 1 + .../dsl/acir_format/blake3_constraint.cpp | 10 ++- .../dsl/acir_format/blake3_constraint.hpp | 1 + .../dsl/acir_format/block_constraint.cpp | 24 +++--- .../dsl/acir_format/block_constraint.hpp | 2 +- .../dsl/acir_format/ec_operations.test.cpp | 4 + .../dsl/acir_format/ecdsa_secp256k1.cpp | 1 + .../dsl/acir_format/ecdsa_secp256k1.test.cpp | 1 + .../dsl/acir_format/ecdsa_secp256r1.cpp | 3 + .../dsl/acir_format/ecdsa_secp256r1.hpp | 3 + .../acir_format/honk_recursion_constraint.cpp | 11 ++- .../acir_format/honk_recursion_constraint.hpp | 6 +- .../dsl/acir_format/keccak_constraint.cpp | 16 ++-- .../dsl/acir_format/keccak_constraint.hpp | 1 + .../dsl/acir_format/logic_constraint.cpp | 26 +++---- .../dsl/acir_format/logic_constraint.hpp | 4 +- .../dsl/acir_format/multi_scalar_mul.cpp | 11 ++- .../dsl/acir_format/multi_scalar_mul.hpp | 2 + .../barretenberg/dsl/acir_format/pedersen.cpp | 10 ++- .../barretenberg/dsl/acir_format/pedersen.hpp | 2 + .../dsl/acir_format/poseidon2_constraint.cpp | 12 ++- .../acir_format/poseidon2_constraint.test.cpp | 12 +-- .../dsl/acir_format/recursion_constraint.cpp | 78 ++++++++++--------- .../acir_format/recursion_constraint.test.cpp | 1 + .../dsl/acir_format/schnorr_verify.cpp | 17 ++-- .../dsl/acir_format/schnorr_verify.hpp | 3 + .../dsl/acir_format/sha256_constraint.cpp | 12 +-- .../dsl/acir_format/sha256_constraint.hpp | 1 + .../dsl/acir_proofs/acir_composer.cpp | 18 +++-- .../dsl/acir_proofs/acir_composer.hpp | 4 +- 40 files changed, 229 insertions(+), 143 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 480099200fa..b6d3082ca9d 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -1,5 +1,6 @@ #include "barretenberg/bb/file_io.hpp" #include "barretenberg/client_ivc/client_ivc.hpp" +#include "barretenberg/common/map.hpp" #include "barretenberg/common/serialize.hpp" #include "barretenberg/dsl/acir_format/acir_format.hpp" #include "barretenberg/dsl/types.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index bc44ee31956..bee50d76742 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -1,11 +1,14 @@ #include "acir_format.hpp" #include "barretenberg/common/log.hpp" +#include "barretenberg/stdlib/primitives/field/field_conversion.hpp" #include "barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp" #include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp" #include namespace acir_format { +using namespace bb; + template class DSLBigInts; template class DSLBigInts; @@ -284,11 +287,11 @@ void build_constraints(Builder& builder, size_t agg_obj_indices_idx = 0; for (fq val : aggregation_object_fq_values) { const uint256_t x = val; - std::array val_limbs = { + std::array val_limbs = { x.slice(0, fq_ct::NUM_LIMB_BITS), x.slice(fq_ct::NUM_LIMB_BITS, fq_ct::NUM_LIMB_BITS * 2), x.slice(fq_ct::NUM_LIMB_BITS * 2, fq_ct::NUM_LIMB_BITS * 3), - x.slice(fq_ct::NUM_LIMB_BITS * 3, bb::stdlib::field_conversion::TOTAL_BITS) + x.slice(fq_ct::NUM_LIMB_BITS * 3, stdlib::field_conversion::TOTAL_BITS) }; for (size_t i = 0; i < fq_ct::NUM_LIMBS; ++i) { uint32_t idx = builder.add_variable(val_limbs[i]); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp index 16ea138f48f..1821d64e259 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -63,10 +63,11 @@ struct AcirFormat { // A standard plonk arithmetic constraint, as defined in the poly_triple struct, consists of selector values // for q_M,q_L,q_R,q_O,q_C and indices of three variables taking the role of left, right and output wire // This could be a large vector so use slab allocator, we don't expect the blackbox implementations to be so large. - std::vector, - ContainerSlabAllocator>> + std::vector, + bb::ContainerSlabAllocator>> poly_triple_constraints; - std::vector, ContainerSlabAllocator>> + std::vector, + bb::ContainerSlabAllocator>> quad_constraints; std::vector block_constraints; @@ -101,7 +102,7 @@ struct AcirFormat { friend bool operator==(AcirFormat const& lhs, AcirFormat const& rhs) = default; }; -using WitnessVector = std::vector>; +using WitnessVector = std::vector>; using WitnessVectorStack = std::vector>; struct AcirProgram { @@ -139,12 +140,12 @@ struct AcirProgramStack { void pop_back() { witness_stack.pop_back(); } }; -template +template Builder create_circuit(const AcirFormat& constraint_system, size_t size_hint = 0, WitnessVector const& witness = {}, bool honk_recursion = false, - std::shared_ptr op_queue = std::make_shared()); + std::shared_ptr op_queue = std::make_shared()); template void build_constraints(Builder& builder, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp index cf6df51ea90..1e3f8a58046 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp @@ -3,6 +3,7 @@ #include "acir_format.hpp" #include "barretenberg/common/streams.hpp" +#include "barretenberg/plonk/composer/standard_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/serialize/test_helper.hpp" #include "ecdsa_secp256k1.hpp" @@ -11,6 +12,8 @@ using namespace bb; using namespace bb::crypto; using namespace acir_format; +using Composer = bb::plonk::StandardComposer; + class AcirFormatTests : public ::testing::Test { protected: static void SetUpTestSuite() { srs::init_crs_factory("../srs_db/ignition"); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp index 919c973b027..6217c8c85ce 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp @@ -9,6 +9,7 @@ // #define LOG_SIZES +using namespace bb; class AcirIntegrationTest : public ::testing::Test { public: static std::vector get_bytecode(const std::string& bytecodePath) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp index 9d081b85bb0..e292766d78f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp @@ -1,8 +1,13 @@ #include "acir_to_constraint_buf.hpp" +#include "barretenberg/common/container.hpp" #ifndef __wasm__ #include "barretenberg/bb/get_bytecode.hpp" #endif +#include "barretenberg/common/map.hpp" namespace acir_format { + +using namespace bb; + /** * @brief Construct a poly_tuple for a standard width-3 arithmetic gate from its acir representation * @@ -50,7 +55,7 @@ poly_triple serialize_arithmetic_gate(Program::Expression const& arg) // If necessary, set values for linears terms q_l * w_l, q_r * w_r and q_o * w_o ASSERT(arg.linear_combinations.size() <= 3); // We can only accommodate 3 linear terms for (const auto& linear_term : arg.linear_combinations) { - bb::fr selector_value(uint256_t(std::get<0>(linear_term))); + fr selector_value(uint256_t(std::get<0>(linear_term))); uint32_t witness_idx = std::get<1>(linear_term).value; // If the witness index has not yet been set or if the corresponding linear term is active, set the witness @@ -88,7 +93,7 @@ poly_triple serialize_arithmetic_gate(Program::Expression const& arg) pt.q_c = uint256_t(arg.q_c); return pt; } -mul_quad_ serialize_mul_quad_gate(Program::Expression const& arg) +mul_quad_ serialize_mul_quad_gate(Program::Expression const& arg) { // TODO(https://github.com/AztecProtocol/barretenberg/issues/816): The initialization of the witness indices a,b,c // to 0 is implicitly assuming that (builder.zero_idx == 0) which is no longer the case. Now, witness idx 0 in @@ -96,16 +101,16 @@ mul_quad_ serialize_mul_quad_gate(Program::Expression const& arg) // erroneously populated with this value. This does not cause failures however because the corresponding selector // will indeed be 0 so the gate will be satisfied. Still, its a bad idea to have erroneous wire values // even if they dont break the relation. They'll still add cost in commitments, for example. - mul_quad_ quad{ .a = 0, - .b = 0, - .c = 0, - .d = 0, - .mul_scaling = 0, - .a_scaling = 0, - .b_scaling = 0, - .c_scaling = 0, - .d_scaling = 0, - .const_scaling = 0 }; + mul_quad_ quad{ .a = 0, + .b = 0, + .c = 0, + .d = 0, + .mul_scaling = 0, + .a_scaling = 0, + .b_scaling = 0, + .c_scaling = 0, + .d_scaling = 0, + .const_scaling = 0 }; // Flags indicating whether each witness index for the present mul_quad has been set bool a_set = false; @@ -125,7 +130,7 @@ mul_quad_ serialize_mul_quad_gate(Program::Expression const& arg) // If necessary, set values for linears terms q_l * w_l, q_r * w_r and q_o * w_o ASSERT(arg.linear_combinations.size() <= 4); // We can only accommodate 4 linear terms for (const auto& linear_term : arg.linear_combinations) { - bb::fr selector_value(uint256_t(std::get<0>(linear_term))); + fr selector_value(uint256_t(std::get<0>(linear_term))); uint32_t witness_idx = std::get<1>(linear_term).value; // If the witness index has not yet been set or if the corresponding linear term is active, set the witness @@ -543,10 +548,10 @@ WitnessVector witness_map_to_witness_vector(WitnessStack::WitnessMap const& witn // To ensure that witnesses sit at the correct indices in the `WitnessVector`, we fill any indices // which do not exist within the `WitnessMap` with the dummy value of zero. while (index < e.first.value) { - wv.push_back(bb::fr(0)); + wv.push_back(fr(0)); index++; } - wv.push_back(bb::fr(uint256_t(e.second))); + wv.push_back(fr(uint256_t(e.second))); index++; } return wv; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp index b0833c1e447..069d144e54f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp @@ -1,6 +1,7 @@ #pragma once #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp index 1a7813e085a..f508e51c084 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp @@ -9,6 +9,8 @@ namespace acir_format { +using namespace bb; + ModulusId modulus_param_to_id(ModulusParam param) { if (Bn254FqParams::modulus_0 == param.modulus_0 && Bn254FqParams::modulus_1 == param.modulus_1 && diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp index 923d496fd8d..90e094c9c8a 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp @@ -228,7 +228,7 @@ TEST_F(BigIntTests, TestBigIntConstraintSimple) BigIntFromLeBytes from_le_bytes_constraint_bigint1{ .inputs = { 1 }, - .modulus = { 0x47, 0xFD, 0x7C, 0xD8, 0x16, 0x8C, 0x20, 0x3C, 0x8d, 0xca, 0x71, 0x68, 0x91, 0x6a, 0x81, 0x97, + .modulus = { 0x47, 0xFD, 0x7C, 0xD8, 0x16, 0x8C, 0x20, 0x3C, 0x8d, 0xca, 0x71, 0x68, 0x91, 0x6a, 0x81, 0x97, 0x5d, 0x58, 0x81, 0x81, 0xb6, 0x45, 0x50, 0xb8, 0x29, 0xa0, 0x31, 0xe1, 0x72, 0x4e, 0x64, 0x30, }, .result = 1, }; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp index d1446231482..f38b1e2b0dc 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp @@ -1,12 +1,16 @@ #include "blake2s_constraint.hpp" +#include "barretenberg/stdlib/hash/blake2s/blake2s.hpp" +#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" #include "round.hpp" namespace acir_format { +using namespace bb; + template void create_blake2s_constraints(Builder& builder, const Blake2sConstraint& constraint) { - using byte_array_ct = bb::stdlib::byte_array; - using field_ct = bb::stdlib::field_t; + using byte_array_ct = stdlib::byte_array; + using field_ct = stdlib::field_t; // Create byte array struct byte_array_ct arr(&builder); @@ -26,7 +30,7 @@ template void create_blake2s_constraints(Builder& builder, co arr.write(element_bytes); } - byte_array_ct output_bytes = bb::stdlib::blake2s(arr); + byte_array_ct output_bytes = stdlib::blake2s(arr); // Convert byte array to vector of field_t auto bytes = output_bytes.bytes(); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp index cf55b5fb7e7..fd881409b75 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp @@ -1,6 +1,7 @@ #pragma once #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.cpp index 9771efc2421..71fc56301a1 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.cpp @@ -1,4 +1,6 @@ #include "blake3_constraint.hpp" +#include "barretenberg/stdlib/hash/blake3s/blake3s.hpp" +#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" #include "round.hpp" namespace acir_format { @@ -36,9 +38,9 @@ template void create_blake3_constraints(Builder& builder, con } } -template void create_blake3_constraints(UltraCircuitBuilder& builder, - const Blake3Constraint& constraint); -template void create_blake3_constraints(MegaCircuitBuilder& builder, - const Blake3Constraint& constraint); +template void create_blake3_constraints(bb::UltraCircuitBuilder& builder, + const Blake3Constraint& constraint); +template void create_blake3_constraints(bb::MegaCircuitBuilder& builder, + const Blake3Constraint& constraint); } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp index c2d1ecafde7..6e1e2c7e243 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp @@ -1,6 +1,7 @@ #pragma once #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp index bb97cb2c4df..bb094b3392b 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.cpp @@ -1,14 +1,16 @@ #include "block_constraint.hpp" +#include "barretenberg/stdlib/primitives/databus/databus.hpp" #include "barretenberg/stdlib/primitives/memory/ram_table.hpp" #include "barretenberg/stdlib/primitives/memory/rom_table.hpp" -using namespace bb::plonk; - namespace acir_format { -template bb::stdlib::field_t poly_to_field_ct(const poly_triple poly, Builder& builder) +using namespace bb::plonk; +using namespace bb; + +template stdlib::field_t poly_to_field_ct(const poly_triple poly, Builder& builder) { - using field_ct = bb::stdlib::field_t; + using field_ct = stdlib::field_t; ASSERT(poly.q_m == 0); ASSERT(poly.q_r == 0); @@ -23,12 +25,12 @@ template bb::stdlib::field_t poly_to_field_ct(const } template -void create_block_constraints(Builder& builder, const BlockConstraint constraint, bool has_valid_witness_assignments) +void create_block_constraints(Builder& builder, const BlockConstraint& constraint, bool has_valid_witness_assignments) { - using field_ct = bb::stdlib::field_t; - using rom_table_ct = bb::stdlib::rom_table; - using ram_table_ct = bb::stdlib::ram_table; - using databus_ct = bb::stdlib::databus; + using field_ct = stdlib::field_t; + using rom_table_ct = stdlib::rom_table; + using ram_table_ct = stdlib::ram_table; + using databus_ct = stdlib::databus; std::vector init; for (auto i : constraint.init) { @@ -125,10 +127,10 @@ void create_block_constraints(Builder& builder, const BlockConstraint constraint } template void create_block_constraints(UltraCircuitBuilder& builder, - const BlockConstraint constraint, + const BlockConstraint& constraint, bool has_valid_witness_assignments); template void create_block_constraints(MegaCircuitBuilder& builder, - const BlockConstraint constraint, + const BlockConstraint& constraint, bool has_valid_witness_assignments); } // namespace acir_format \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp index 79d4fce0a45..cfd4dfac256 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp @@ -27,7 +27,7 @@ struct BlockConstraint { template void create_block_constraints(Builder& builder, - const BlockConstraint constraint, + const BlockConstraint& constraint, bool has_valid_witness_assignments = true); template inline void read(B& buf, MemOp& mem_op) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp index 1cd34c076f8..12a95add2f9 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp @@ -1,13 +1,17 @@ #include "ec_operations.hpp" #include "acir_format.hpp" #include "barretenberg/circuit_checker/circuit_checker.hpp" +#include "barretenberg/plonk/composer/standard_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" +#include "barretenberg/stdlib/primitives/group/cycle_group.hpp" #include #include namespace acir_format::tests { + using curve_ct = bb::stdlib::secp256k1; class EcOperations : public ::testing::Test { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp index bee578e869b..9d065853096 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp @@ -3,6 +3,7 @@ namespace acir_format { +using namespace bb; using secp256k1_ct = bb::stdlib::secp256k1; using namespace bb::plonk; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp index 90a5546068d..177093f6fcd 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp @@ -3,6 +3,7 @@ #include "barretenberg/crypto/ecdsa/ecdsa.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.cpp index 6d05950e09c..3e184224098 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.cpp @@ -1,6 +1,7 @@ #include "ecdsa_secp256r1.hpp" #include "barretenberg/crypto/ecdsa/ecdsa.hpp" #include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp" +#include "barretenberg/stdlib/primitives/curves/secp256r1.hpp" #include "ecdsa_secp256k1.hpp" using namespace bb; @@ -9,6 +10,8 @@ using namespace bb::plonk; namespace acir_format { +using secp256r1_ct = stdlib::secp256r1; + secp256r1_ct::g1_ct ecdsa_convert_inputs(Builder* ctx, const secp256r1::g1::affine_element& input) { uint256_t x_u256(input.x); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp index 701a0e23c41..520d03d8197 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp @@ -1,5 +1,8 @@ #pragma once +#include "barretenberg/common/serialize.hpp" #include "barretenberg/dsl/types.hpp" +#include +#include #include namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp index 54bf05f5e70..720500f5db6 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.cpp @@ -1,11 +1,18 @@ #include "honk_recursion_constraint.hpp" +#include "barretenberg/flavor/flavor.hpp" +#include "barretenberg/stdlib/honk_recursion/verifier/ultra_recursive_verifier.hpp" +#include "barretenberg/stdlib/plonk_recursion/aggregation_state/aggregation_state.hpp" #include "barretenberg/stdlib/primitives/bigfield/constants.hpp" +#include "barretenberg/stdlib/primitives/curves/bn254.hpp" +#include "barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp" #include "recursion_constraint.hpp" namespace acir_format { using namespace bb; -using namespace bb::stdlib::recursion::honk; +using field_ct = stdlib::field_t; +using bn254 = stdlib::bn254; +using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; std::array agg_points_from_witness_indicies( Builder& builder, const std::array& obj_witness_indices) @@ -46,7 +53,7 @@ std::array create_ho { using Flavor = UltraRecursiveFlavor_; using RecursiveVerificationKey = Flavor::VerificationKey; - using RecursiveVerifier = UltraRecursiveVerifier_; + using RecursiveVerifier = bb::stdlib::recursion::honk::UltraRecursiveVerifier_; // Ignore the case of invalid witness assignments for now. static_cast(has_valid_witness_assignments); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp index ae7a2dfe98c..89db49e7980 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp @@ -1,10 +1,14 @@ #pragma once +#include "barretenberg/dsl/builder_types.hpp" #include "barretenberg/dsl/types.hpp" #include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" #include namespace acir_format { -using fq_ct = bb::stdlib::bigfield; + +using namespace bb; +using fq_ct = stdlib::bigfield; + /** * @brief HonkRecursionConstraint struct contains information required to recursively verify a proof! * diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.cpp index c2e0359d4da..13c72f0f231 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.cpp @@ -60,15 +60,15 @@ template void create_keccak_permutations(Builder& builder, co builder.assert_equal(output_state[i].normalize().witness_index, constraint.result[i]); } } -template void create_keccak_constraints(UltraCircuitBuilder& builder, - const KeccakConstraint& constraint); -template void create_keccak_permutations(UltraCircuitBuilder& builder, - const Keccakf1600& constraint); +template void create_keccak_constraints(bb::UltraCircuitBuilder& builder, + const KeccakConstraint& constraint); +template void create_keccak_permutations(bb::UltraCircuitBuilder& builder, + const Keccakf1600& constraint); -template void create_keccak_constraints(MegaCircuitBuilder& builder, - const KeccakConstraint& constraint); +template void create_keccak_constraints(bb::MegaCircuitBuilder& builder, + const KeccakConstraint& constraint); -template void create_keccak_permutations(MegaCircuitBuilder& builder, - const Keccakf1600& constraint); +template void create_keccak_permutations(bb::MegaCircuitBuilder& builder, + const Keccakf1600& constraint); } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp index 14139cba419..4653651d67d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp @@ -1,6 +1,7 @@ #pragma once #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp index 70826ef4ef0..de6c2842d1d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp @@ -18,22 +18,22 @@ void create_logic_gate(Builder& builder, field_ct left = field_ct::from_witness_index(&builder, a); field_ct right = field_ct::from_witness_index(&builder, b); - field_ct res = stdlib::logic::create_logic_constraint(left, right, num_bits, is_xor_gate); + field_ct res = bb::stdlib::logic::create_logic_constraint(left, right, num_bits, is_xor_gate); field_ct our_res = field_ct::from_witness_index(&builder, result); res.assert_equal(our_res); } -template void create_logic_gate(MegaCircuitBuilder& builder, - const uint32_t a, - const uint32_t b, - const uint32_t result, - const size_t num_bits, - const bool is_xor_gate); -template void create_logic_gate(UltraCircuitBuilder& builder, - const uint32_t a, - const uint32_t b, - const uint32_t result, - const size_t num_bits, - const bool is_xor_gate); +template void create_logic_gate(bb::MegaCircuitBuilder& builder, + const uint32_t a, + const uint32_t b, + const uint32_t result, + const size_t num_bits, + const bool is_xor_gate); +template void create_logic_gate(bb::UltraCircuitBuilder& builder, + const uint32_t a, + const uint32_t b, + const uint32_t result, + const size_t num_bits, + const bool is_xor_gate); } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp index acff8b4ada3..a2457ccf52d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp @@ -1,4 +1,5 @@ #pragma once +#include "barretenberg/dsl/builder_types.hpp" #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include @@ -19,7 +20,8 @@ struct LogicConstraint { }; template -void create_logic_gate(Builder& builder, uint32_t a, uint32_t b, uint32_t result, size_t num_bits, bool is_xor_gate); +void create_logic_gate( + Builder& builder, uint32_t a, uint32_t b, uint32_t result, std::size_t num_bits, bool is_xor_gate); void xor_gate(Builder& builder, uint32_t a, uint32_t b, uint32_t result); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp index 94f2def1d62..db2680f63d2 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp @@ -4,15 +4,18 @@ #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp" #include "barretenberg/stdlib/primitives/biggroup/biggroup.hpp" +#include "barretenberg/stdlib/primitives/group/cycle_group.hpp" namespace acir_format { +using namespace bb; + template void create_multi_scalar_mul_constraint(Builder& builder, const MultiScalarMul& input) { - using cycle_group_ct = bb::stdlib::cycle_group; - using cycle_scalar_ct = typename bb::stdlib::cycle_group::cycle_scalar; - using field_ct = bb::stdlib::field_t; - using bool_ct = bb::stdlib::bool_t; + using cycle_group_ct = stdlib::cycle_group; + using cycle_scalar_ct = typename stdlib::cycle_group::cycle_scalar; + using field_ct = stdlib::field_t; + using bool_ct = stdlib::bool_t; std::vector points; std::vector scalars; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp index 57c143226d3..b206bd36fc5 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp @@ -2,12 +2,14 @@ #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include +#include namespace acir_format { struct MultiScalarMul { std::vector points; std::vector scalars; + uint32_t out_point_x; uint32_t out_point_y; uint32_t out_point_is_infinite; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp index ce6948ee0cf..becacc2fe15 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp @@ -1,12 +1,16 @@ #include "pedersen.hpp" +#include "barretenberg/stdlib/commitment/pedersen/pedersen.hpp" +#include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" +#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" +#include "barretenberg/stdlib/primitives/field/field.hpp" namespace acir_format { -using namespace bb::plonk; +using namespace bb; template void create_pedersen_constraint(Builder& builder, const PedersenConstraint& input) { - using field_ct = bb::stdlib::field_t; + using field_ct = stdlib::field_t; std::vector scalars; @@ -24,7 +28,7 @@ template void create_pedersen_constraint(Builder& builder, co template void create_pedersen_hash_constraint(Builder& builder, const PedersenHashConstraint& input) { - using field_ct = bb::stdlib::field_t; + using field_ct = stdlib::field_t; std::vector scalars; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp index cddeb9ce5c3..99f65e4583f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp @@ -1,5 +1,7 @@ #pragma once +#include "barretenberg/common/serialize.hpp" #include "barretenberg/dsl/types.hpp" +#include #include namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.cpp index e84fb6e052b..1a8e0821070 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.cpp @@ -1,11 +1,17 @@ #include "poseidon2_constraint.hpp" +#include "barretenberg/crypto/poseidon2/poseidon2_params.hpp" +#include "barretenberg/stdlib/hash/poseidon2/poseidon2_permutation.hpp" #include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" +#include "barretenberg/stdlib/primitives/field/field.hpp" namespace acir_format { + +using namespace bb; + template void create_poseidon2_permutations(Builder& builder, const Poseidon2Constraint& constraint) { - using field_ct = bb::stdlib::field_t; - using Poseidon2Params = bb::stdlib::crypto::Poseidon2Bn254ScalarFieldParams; + using field_ct = stdlib::field_t; + using Poseidon2Params = crypto::Poseidon2Bn254ScalarFieldParams; using State = std::array; ASSERT(constraint.state.size() == constraint.len); @@ -17,7 +23,7 @@ template void create_poseidon2_permutations(Builder& builder, state[i] = field_ct::from_witness_index(&builder, constraint.state[i]); } State output_state; - output_state = bb::stdlib::Poseidon2Permutation::permutation(&builder, state); + output_state = stdlib::Poseidon2Permutation::permutation(&builder, state); for (size_t i = 0; i < output_state.size(); ++i) { poly_triple assert_equal{ .a = output_state[i].normalize().witness_index, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp index 71e2cc2160f..17c9af262f7 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp @@ -10,9 +10,11 @@ namespace acir_format::tests { +using namespace bb; + class Poseidon2Tests : public ::testing::Test { protected: - static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } + static void SetUpTestSuite() { srs::init_crs_factory("../srs_db/ignition"); } }; using fr = field; @@ -65,10 +67,10 @@ TEST_F(Poseidon2Tests, TestPoseidon2Permutation) 1, 2, 3, - bb::fr(std::string("0x01bd538c2ee014ed5141b29e9ae240bf8db3fe5b9a38629a9647cf8d76c01737")), - bb::fr(std::string("0x239b62e7db98aa3a2a8f6a0d2fa1709e7a35959aa6c7034814d9daa90cbac662")), - bb::fr(std::string("0x04cbb44c61d928ed06808456bf758cbf0c18d1e15a7b6dbc8245fa7515d5e3cb")), - bb::fr(std::string("0x2e11c5cff2a22c64d01304b778d78f6998eff1ab73163a35603f54794c30847a")), + fr(std::string("0x01bd538c2ee014ed5141b29e9ae240bf8db3fe5b9a38629a9647cf8d76c01737")), + fr(std::string("0x239b62e7db98aa3a2a8f6a0d2fa1709e7a35959aa6c7034814d9daa90cbac662")), + fr(std::string("0x04cbb44c61d928ed06808456bf758cbf0c18d1e15a7b6dbc8245fa7515d5e3cb")), + fr(std::string("0x2e11c5cff2a22c64d01304b778d78f6998eff1ab73163a35603f54794c30847a")), }; auto builder = create_circuit(constraint_system, /*size_hint=*/0, witness); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp index 9a994754dad..1a2fc9e502c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp @@ -6,15 +6,20 @@ #include "barretenberg/stdlib/plonk_recursion/verifier/verifier.hpp" #include "barretenberg/stdlib/primitives/bigfield/constants.hpp" -using namespace bb; - namespace acir_format { +using namespace bb; + +using Transcript_ct = bb::stdlib::recursion::Transcript; +using bn254 = stdlib::bn254; +using noir_recursive_settings = stdlib::recursion::recursive_ultra_verifier_settings; +using verification_key_ct = stdlib::recursion::verification_key; +using field_ct = stdlib::field_t; using Composer = plonk::UltraComposer; -using bn254 = bb::stdlib::bn254; -using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; +using bn254 = stdlib::bn254; +using aggregation_state_ct = stdlib::recursion::aggregation_state; -using namespace bb::plonk; +using namespace plonk; // `NUM_LIMB_BITS_IN_FIELD_SIMULATION` is the limb size when simulating a non-native field using the bigfield class // A aggregation object is two acir_format::g1_ct types where each coordinate in a point is a non-native field. @@ -57,7 +62,7 @@ std::array create_recurs const std::vector dummy_key = export_dummy_key_in_recursion_format( PolynomialManifest(Builder::CIRCUIT_TYPE), inner_proof_contains_recursive_proof); const auto manifest = Composer::create_manifest(input.public_inputs.size()); - std::vector dummy_proof = + std::vector dummy_proof = export_dummy_transcript_in_recursion_format(manifest, inner_proof_contains_recursive_proof); for (size_t i = 0; i < input.public_inputs.size(); ++i) { @@ -65,8 +70,7 @@ std::array create_recurs // if we do NOT have a witness assignment (i.e. are just building the proving/verification keys), // we add our dummy public input values as Builder variables. // if we DO have a valid witness assignment, we use the real witness assignment - bb::fr dummy_field = - has_valid_witness_assignments ? builder.get_variable(public_input_idx) : dummy_proof[i]; + fr dummy_field = has_valid_witness_assignments ? builder.get_variable(public_input_idx) : dummy_proof[i]; // Create a copy constraint between our dummy field and the witness index provided by RecursionConstraint. // This will make the RecursionConstraint idx equal to `dummy_field`. // In the case of a valid witness assignment, this does nothing (as dummy_field = real value) @@ -85,12 +89,12 @@ std::array create_recurs dummy_proof.begin() + static_cast(input.public_inputs.size())); for (size_t i = 0; i < input.proof.size(); ++i) { const auto proof_field_idx = input.proof[i]; - bb::fr dummy_field = has_valid_witness_assignments ? builder.get_variable(proof_field_idx) : dummy_proof[i]; + fr dummy_field = has_valid_witness_assignments ? builder.get_variable(proof_field_idx) : dummy_proof[i]; builder.assert_equal(builder.add_variable(dummy_field), proof_field_idx); } for (size_t i = 0; i < input.key.size(); ++i) { const auto key_field_idx = input.key[i]; - bb::fr dummy_field = has_valid_witness_assignments ? builder.get_variable(key_field_idx) : dummy_key[i]; + fr dummy_field = has_valid_witness_assignments ? builder.get_variable(key_field_idx) : dummy_key[i]; builder.assert_equal(builder.add_variable(dummy_field), key_field_idx); } } @@ -155,7 +159,7 @@ std::array create_recurs vkey->program_width = noir_recursive_settings::program_width; Transcript_ct transcript(&builder, manifest, proof_fields, input.public_inputs.size()); - aggregation_state_ct result = bb::stdlib::recursion::verify_proof_( + aggregation_state_ct result = stdlib::recursion::verify_proof_( &builder, vkey, transcript, previous_aggregation); // Assign correct witness value to the verification key hash @@ -183,9 +187,9 @@ std::array create_recurs * This method exports the key formatted in the manner our recursive verifier expects. * NOTE: only used by the dsl at the moment. Might be cleaner to make this a dsl function? * - * @return std::vector + * @return std::vector */ -std::vector export_key_in_recursion_format(std::shared_ptr const& vkey) +std::vector export_key_in_recursion_format(std::shared_ptr const& vkey) { std::vector output; output.emplace_back(vkey->domain.root); @@ -233,10 +237,10 @@ std::vector export_key_in_recursion_format(std::shared_ptr + * @return std::vector */ -std::vector export_dummy_key_in_recursion_format(const PolynomialManifest& polynomial_manifest, - const bool contains_recursive_proof) +std::vector export_dummy_key_in_recursion_format(const PolynomialManifest& polynomial_manifest, + const bool contains_recursive_proof) { std::vector output; output.emplace_back(1); // domain.domain (will be inverted) @@ -259,8 +263,8 @@ std::vector export_dummy_key_in_recursion_format(const PolynomialManifes // This check can also trigger a runtime error due to causing 0 to be inverted. // When creating dummy verification key points we must be mindful of the above and make sure that each // transcript point is unique. - auto scalar = bb::fr::random_element(); - const auto element = bb::g1::affine_element(bb::g1::one * scalar); + auto scalar = fr::random_element(); + const auto element = g1::affine_element(g1::one * scalar); auto g1_as_fields = export_g1_affine_element_as_fields(element); output.emplace_back(g1_as_fields.x_lo); output.emplace_back(g1_as_fields.x_hi); @@ -275,14 +279,14 @@ std::vector export_dummy_key_in_recursion_format(const PolynomialManifes } /** - * @brief Returns transcript represented as a vector of bb::fr. + * @brief Returns transcript represented as a vector of fr. * Used to represent recursive proofs (i.e. proof represented as circuit-native field elements) * - * @return std::vector + * @return std::vector */ -std::vector export_transcript_in_recursion_format(const transcript::StandardTranscript& transcript) +std::vector export_transcript_in_recursion_format(const transcript::StandardTranscript& transcript) { - std::vector fields; + std::vector fields; const auto num_rounds = transcript.get_manifest().get_num_rounds(); for (size_t i = 0; i < num_rounds; ++i) { for (const auto& manifest_element : transcript.get_manifest().get_round_manifest(i).elements) { @@ -314,18 +318,18 @@ std::vector export_transcript_in_recursion_format(const transcript::Stan * errors being thrown. * * @param manifest - * @return std::vector + * @return std::vector */ -std::vector export_dummy_transcript_in_recursion_format(const transcript::Manifest& manifest, - const bool contains_recursive_proof) +std::vector export_dummy_transcript_in_recursion_format(const transcript::Manifest& manifest, + const bool contains_recursive_proof) { - std::vector fields; + std::vector fields; const auto num_rounds = manifest.get_num_rounds(); for (size_t i = 0; i < num_rounds; ++i) { for (const auto& manifest_element : manifest.get_round_manifest(i).elements) { if (!manifest_element.derived_by_verifier) { if (manifest_element.num_bytes == 32 && manifest_element.name != "public_inputs") { - // auto scalar = bb::fr::random_element(); + // auto scalar = fr::random_element(); fields.emplace_back(0); } else if (manifest_element.num_bytes == 64 && manifest_element.name != "public_inputs") { // the std::biggroup class creates unsatisfiable constraints when identical points are @@ -334,8 +338,8 @@ std::vector export_dummy_transcript_in_recursion_format(const transcript // identical. And prover points should contain randomness for an honest Prover). This check can // also trigger a runtime error due to causing 0 to be inverted. When creating dummy proof // points we must be mindful of the above and make sure that each point is unique. - auto scalar = bb::fr::random_element(); - const auto group_element = bb::g1::affine_element(bb::g1::one * scalar); + auto scalar = fr::random_element(); + const auto group_element = g1::affine_element(g1::one * scalar); auto g1_as_fields = export_g1_affine_element_as_fields(group_element); fields.emplace_back(g1_as_fields.x_lo); fields.emplace_back(g1_as_fields.x_hi); @@ -355,8 +359,8 @@ std::vector export_dummy_transcript_in_recursion_format(const transcript fields.emplace_back(0); } for (size_t k = 0; k < RecursionConstraint::NUM_AGGREGATION_ELEMENTS; ++k) { - auto scalar = bb::fr::random_element(); - const auto group_element = bb::g1::affine_element(bb::g1::one * scalar); + auto scalar = fr::random_element(); + const auto group_element = g1::affine_element(g1::one * scalar); auto g1_as_fields = export_g1_affine_element_as_fields(group_element); fields.emplace_back(g1_as_fields.x_lo); fields.emplace_back(g1_as_fields.x_hi); @@ -365,7 +369,7 @@ std::vector export_dummy_transcript_in_recursion_format(const transcript } } else { for (size_t j = 0; j < num_public_inputs; ++j) { - // auto scalar = bb::fr::random_element(); + // auto scalar = fr::random_element(); fields.emplace_back(0); } } @@ -383,14 +387,14 @@ size_t recursion_proof_size_without_public_inputs() return dummy_transcript.size(); } -G1AsFields export_g1_affine_element_as_fields(const bb::g1::affine_element& group_element) +G1AsFields export_g1_affine_element_as_fields(const g1::affine_element& group_element) { const uint256_t x = group_element.x; const uint256_t y = group_element.y; - const bb::fr x_lo = x.slice(0, TWO_LIMBS_BITS_IN_FIELD_SIMULATION); - const bb::fr x_hi = x.slice(TWO_LIMBS_BITS_IN_FIELD_SIMULATION, FOUR_LIMBS_BITS_IN_FIELD_SIMULATION); - const bb::fr y_lo = y.slice(0, TWO_LIMBS_BITS_IN_FIELD_SIMULATION); - const bb::fr y_hi = y.slice(TWO_LIMBS_BITS_IN_FIELD_SIMULATION, FOUR_LIMBS_BITS_IN_FIELD_SIMULATION); + const fr x_lo = x.slice(0, TWO_LIMBS_BITS_IN_FIELD_SIMULATION); + const fr x_hi = x.slice(TWO_LIMBS_BITS_IN_FIELD_SIMULATION, FOUR_LIMBS_BITS_IN_FIELD_SIMULATION); + const fr y_lo = y.slice(0, TWO_LIMBS_BITS_IN_FIELD_SIMULATION); + const fr y_hi = y.slice(TWO_LIMBS_BITS_IN_FIELD_SIMULATION, FOUR_LIMBS_BITS_IN_FIELD_SIMULATION); return G1AsFields{ x_lo, x_hi, y_lo, y_hi }; } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp index 65e049fe0ca..ff0f3963610 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp @@ -7,6 +7,7 @@ #include using namespace acir_format; +using namespace bb; using namespace bb::plonk; class AcirRecursionConstraint : public ::testing::Test { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp index e4dae9ca089..e65224b429c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.cpp @@ -4,6 +4,7 @@ namespace acir_format { +using namespace bb; using namespace bb::stdlib; template @@ -45,10 +46,10 @@ crypto::schnorr_signature convert_signature(Builder& builder, std::array -bb::stdlib::byte_array vector_of_bytes_to_byte_array(Builder& builder, std::vector vector_of_bytes) +stdlib::byte_array vector_of_bytes_to_byte_array(Builder& builder, std::vector vector_of_bytes) { - using byte_array_ct = bb::stdlib::byte_array; - using field_ct = bb::stdlib::field_t; + using byte_array_ct = stdlib::byte_array; + using field_ct = stdlib::field_t; byte_array_ct arr(&builder); @@ -65,7 +66,7 @@ bb::stdlib::byte_array vector_of_bytes_to_byte_array(Builder& builder, return arr; } -template bb::stdlib::witness_t index_to_witness(Builder& builder, uint32_t index) +template stdlib::witness_t index_to_witness(Builder& builder, uint32_t index) { fr value = builder.get_variable(index); return { &builder, value }; @@ -73,10 +74,10 @@ template bb::stdlib::witness_t index_to_witness(Buil template void create_schnorr_verify_constraints(Builder& builder, const SchnorrConstraint& input) { - using witness_ct = bb::stdlib::witness_t; - using cycle_group_ct = bb::stdlib::cycle_group; - using schnorr_signature_bits_ct = bb::stdlib::schnorr_signature_bits; - using bool_ct = bb::stdlib::bool_t; + using witness_ct = stdlib::witness_t; + using cycle_group_ct = stdlib::cycle_group; + using schnorr_signature_bits_ct = stdlib::schnorr_signature_bits; + using bool_ct = stdlib::bool_t; auto new_sig = convert_signature(builder, input.signature); // From ignorance, you will see me convert a bunch of witnesses from ByteArray -> BitArray diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp index a7dbc2b0344..79e7cbdaecd 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp @@ -1,5 +1,8 @@ #pragma once +#include "barretenberg/common/serialize.hpp" #include "barretenberg/dsl/types.hpp" +#include +#include #include namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp index 5ad69cffcb6..8a5a416975c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp @@ -6,12 +6,14 @@ namespace acir_format { +using namespace bb; + // This function does not work (properly) because the stdlib:sha256 function is not working correctly for 512 bits // pair template void create_sha256_constraints(Builder& builder, const Sha256Constraint& constraint) { - using byte_array_ct = bb::stdlib::byte_array; - using field_ct = bb::stdlib::field_t; + using byte_array_ct = stdlib::byte_array; + using field_ct = stdlib::field_t; // Create byte array struct byte_array_ct arr(&builder); @@ -32,7 +34,7 @@ template void create_sha256_constraints(Builder& builder, con } // Compute sha256 - byte_array_ct output_bytes = bb::stdlib::sha256(arr); + byte_array_ct output_bytes = stdlib::sha256(arr); // Convert byte array to vector of field_t auto bytes = output_bytes.bytes(); @@ -45,7 +47,7 @@ template void create_sha256_constraints(Builder& builder, con template void create_sha256_compression_constraints(Builder& builder, const Sha256Compression& constraint) { - using field_ct = bb::stdlib::field_t; + using field_ct = stdlib::field_t; std::array inputs; std::array hash_inputs; @@ -69,7 +71,7 @@ void create_sha256_compression_constraints(Builder& builder, const Sha256Compres } // Compute sha256 compression - auto output_bytes = bb::stdlib::sha256_plookup::sha256_block(hash_inputs, inputs); + auto output_bytes = stdlib::sha256_plookup::sha256_block(hash_inputs, inputs); for (size_t i = 0; i < 8; ++i) { poly_triple assert_equal{ diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp index 560f8e915d2..7a1393a2f22 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp @@ -1,6 +1,7 @@ #pragma once #include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp index 07bcd68137a..7db0ed21c51 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp @@ -3,6 +3,7 @@ #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/dsl/acir_format/acir_format.hpp" #include "barretenberg/dsl/types.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/plonk/proof_system/verification_key/sol_gen.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" @@ -12,6 +13,9 @@ namespace acir_proofs { +using namespace bb; +using Composer = plonk::UltraComposer; + AcirComposer::AcirComposer(size_t size_hint, bool verbose) : size_hint_(size_hint) , verbose_(verbose) @@ -35,7 +39,7 @@ void AcirComposer::create_circuit(acir_format::AcirFormat& constraint_system, Wi std::shared_ptr AcirComposer::init_proving_key() { - acir_format::Composer composer; + Composer composer; vinfo("computing proving key..."); proving_key_ = composer.compute_proving_key(builder_); return proving_key_; @@ -47,7 +51,7 @@ std::vector AcirComposer::create_proof() throw_or_abort("Must compute proving key before constructing proof."); } - acir_format::Composer composer(proving_key_, nullptr); + Composer composer(proving_key_, nullptr); vinfo("creating proof..."); std::vector proof; @@ -68,7 +72,7 @@ std::shared_ptr AcirComposer::init_verification_key throw_or_abort("Compute proving key first."); } vinfo("computing verification key..."); - acir_format::Composer composer(proving_key_, nullptr); + Composer composer(proving_key_, nullptr); verification_key_ = composer.compute_verification_key(builder_); vinfo("done."); @@ -83,7 +87,7 @@ void AcirComposer::load_verification_key(bb::plonk::verification_key_data&& data bool AcirComposer::verify_proof(std::vector const& proof) { - acir_format::Composer composer(proving_key_, verification_key_); + Composer composer(proving_key_, verification_key_); if (!verification_key_) { vinfo("computing verification key..."); @@ -123,10 +127,8 @@ std::string AcirComposer::get_solidity_verifier() std::vector AcirComposer::serialize_proof_into_fields(std::vector const& proof, size_t num_inner_public_inputs) { - plonk::transcript::StandardTranscript transcript(proof, - acir_format::Composer::create_manifest(num_inner_public_inputs), - plonk::transcript::HashType::PedersenBlake3s, - 16); + plonk::transcript::StandardTranscript transcript( + proof, Composer::create_manifest(num_inner_public_inputs), plonk::transcript::HashType::PedersenBlake3s, 16); return acir_format::export_transcript_in_recursion_format(transcript); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp index 9ff9b51ace3..e15c59fa60d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp @@ -11,12 +11,12 @@ namespace acir_proofs { */ class AcirComposer { - using WitnessVector = std::vector>; + using WitnessVector = std::vector>; public: AcirComposer(size_t size_hint = 0, bool verbose = true); - template + template void create_circuit(acir_format::AcirFormat& constraint_system, WitnessVector const& witness = {}); std::shared_ptr init_proving_key(); From f545adf0b12e3832ed894fd4deeea29f8a68661f Mon Sep 17 00:00:00 2001 From: ludamad Date: Sat, 1 Jun 2024 19:52:00 +0000 Subject: [PATCH 5/8] it lives --- .../benchmark/merkle_tree_bench/merkle_tree.bench.cpp | 1 + .../src/barretenberg/dsl/acir_format/acir_format.test.cpp | 4 +++- .../barretenberg/dsl/acir_format/acir_integration.test.cpp | 2 ++ .../barretenberg/dsl/acir_format/bigint_constraint.test.cpp | 3 +++ .../barretenberg/dsl/acir_format/block_constraint.test.cpp | 5 +++++ .../src/barretenberg/dsl/acir_format/ec_operations.test.cpp | 2 ++ .../barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp | 2 ++ .../barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp | 3 +++ .../dsl/acir_format/honk_recursion_constraint.test.cpp | 3 +++ .../dsl/acir_format/poseidon2_constraint.test.cpp | 2 ++ .../dsl/acir_format/recursion_constraint.test.cpp | 2 ++ .../barretenberg/dsl/acir_format/sha256_constraint.test.cpp | 3 +++ 12 files changed, 31 insertions(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/merkle_tree_bench/merkle_tree.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/merkle_tree_bench/merkle_tree.bench.cpp index cdc18ed6c80..39213815876 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/merkle_tree_bench/merkle_tree.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/merkle_tree_bench/merkle_tree.bench.cpp @@ -5,6 +5,7 @@ #include using namespace benchmark; +using namespace bb; using namespace bb::crypto::merkle_tree; using TreeType = MerkleTree; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp index 1e3f8a58046..0d1ef31040f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp @@ -3,7 +3,9 @@ #include "acir_format.hpp" #include "barretenberg/common/streams.hpp" +#include "barretenberg/crypto/schnorr/schnorr.hpp" #include "barretenberg/plonk/composer/standard_composer.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/serialize/test_helper.hpp" #include "ecdsa_secp256k1.hpp" @@ -12,7 +14,7 @@ using namespace bb; using namespace bb::crypto; using namespace acir_format; -using Composer = bb::plonk::StandardComposer; +using Composer = plonk::UltraComposer; class AcirFormatTests : public ::testing::Test { protected: diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp index 6217c8c85ce..bac815ed4ef 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp @@ -1,6 +1,8 @@ #include "barretenberg/client_ivc/client_ivc.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #ifndef __wasm__ #include "barretenberg/bb/exec_pipe.hpp" +#include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/common/streams.hpp" #include "barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp index 90e094c9c8a..69d40ffe965 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp @@ -2,6 +2,7 @@ #include "acir_format.hpp" #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" @@ -11,6 +12,8 @@ namespace acir_format::tests { +using Composer = plonk::UltraComposer; + class BigIntTests : public ::testing::Test { protected: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp index 98557d8146a..5da46acc95e 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp @@ -1,12 +1,17 @@ #include "block_constraint.hpp" #include "acir_format.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/stdlib_circuit_builders/mega_flavor.hpp" +#include "barretenberg/ultra_honk/ultra_prover.hpp" +#include "barretenberg/ultra_honk/ultra_verifier.hpp" #include #include using namespace acir_format; +using Composer = plonk::UltraComposer; class UltraPlonkRAM : public ::testing::Test { protected: diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp index 12a95add2f9..c006186494d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp @@ -2,6 +2,7 @@ #include "acir_format.hpp" #include "barretenberg/circuit_checker/circuit_checker.hpp" #include "barretenberg/plonk/composer/standard_composer.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" @@ -12,6 +13,7 @@ namespace acir_format::tests { +using Composer = plonk::UltraComposer; using curve_ct = bb::stdlib::secp256k1; class EcOperations : public ::testing::Test { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp index 177093f6fcd..88140210210 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp @@ -1,6 +1,7 @@ #include "ecdsa_secp256k1.hpp" #include "acir_format.hpp" #include "barretenberg/crypto/ecdsa/ecdsa.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" @@ -12,6 +13,7 @@ using namespace bb; using namespace bb::crypto; using namespace acir_format; using curve_ct = stdlib::secp256k1; +using Composer = plonk::UltraComposer; class ECDSASecp256k1 : public ::testing::Test { protected: diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp index 257bcf4a2e2..ac0d9a31938 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp @@ -1,8 +1,10 @@ #include "ecdsa_secp256r1.hpp" #include "acir_format.hpp" #include "barretenberg/crypto/ecdsa/ecdsa.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/stdlib/primitives/curves/secp256r1.hpp" #include #include @@ -10,6 +12,7 @@ using namespace bb; using namespace bb::crypto; using namespace acir_format; +using Composer = plonk::UltraComposer; using curve_ct = stdlib::secp256r1; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp index 9eb67c39bef..3b653fecc18 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.test.cpp @@ -1,5 +1,8 @@ #include "honk_recursion_constraint.hpp" #include "acir_format.hpp" +#include "barretenberg/sumcheck/instance/prover_instance.hpp" +#include "barretenberg/ultra_honk/ultra_prover.hpp" +#include "barretenberg/ultra_honk/ultra_verifier.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp index 17c9af262f7..dd01d0b9b3e 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.test.cpp @@ -1,6 +1,7 @@ #include "poseidon2_constraint.hpp" #include "acir_format.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" @@ -11,6 +12,7 @@ namespace acir_format::tests { using namespace bb; +using Composer = plonk::UltraComposer; class Poseidon2Tests : public ::testing::Test { protected: diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp index ff0f3963610..2715bc873a9 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp @@ -1,5 +1,6 @@ #include "recursion_constraint.hpp" #include "acir_format.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" @@ -10,6 +11,7 @@ using namespace acir_format; using namespace bb; using namespace bb::plonk; +using Composer = plonk::UltraComposer; class AcirRecursionConstraint : public ::testing::Test { protected: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp index 82fda6f8d81..902ac2944e9 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.test.cpp @@ -1,13 +1,16 @@ #include "sha256_constraint.hpp" #include "acir_format.hpp" +#include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" +#include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" #include #include namespace acir_format::tests { using curve_ct = bb::stdlib::secp256k1; +using Composer = plonk::UltraComposer; class Sha256Tests : public ::testing::Test { protected: From c3f370dcf919e24da379ccd805d07a44003e3580 Mon Sep 17 00:00:00 2001 From: ludamad Date: Sat, 1 Jun 2024 19:56:26 +0000 Subject: [PATCH 6/8] delete acir types.hpp --- barretenberg/cpp/src/barretenberg/bb/main.cpp | 1 - .../dsl/acir_format/acir_format.hpp | 1 + .../dsl/acir_format/aes128_constraint.hpp | 1 - .../dsl/acir_format/bigint_constraint.cpp | 1 - .../dsl/acir_format/bigint_constraint.hpp | 1 - .../dsl/acir_format/blake2s_constraint.hpp | 1 - .../dsl/acir_format/blake3_constraint.hpp | 1 - .../dsl/acir_format/block_constraint.hpp | 1 - .../dsl/acir_format/ec_operations.cpp | 1 - .../dsl/acir_format/ec_operations.hpp | 1 - .../dsl/acir_format/ecdsa_secp256k1.hpp | 1 - .../dsl/acir_format/ecdsa_secp256r1.hpp | 1 - .../acir_format/honk_recursion_constraint.hpp | 1 - .../dsl/acir_format/keccak_constraint.hpp | 1 - .../dsl/acir_format/logic_constraint.hpp | 1 - .../dsl/acir_format/multi_scalar_mul.cpp | 1 - .../dsl/acir_format/multi_scalar_mul.hpp | 1 - .../barretenberg/dsl/acir_format/pedersen.hpp | 1 - .../dsl/acir_format/poseidon2_constraint.hpp | 1 - .../dsl/acir_format/schnorr_verify.hpp | 1 - .../dsl/acir_format/sha256_constraint.cpp | 1 - .../dsl/acir_format/sha256_constraint.hpp | 1 - .../dsl/acir_proofs/acir_composer.cpp | 1 - .../src/barretenberg/dsl/builder_types.hpp | 9 --- .../cpp/src/barretenberg/dsl/types.hpp | 77 ------------------- 25 files changed, 1 insertion(+), 108 deletions(-) delete mode 100644 barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp delete mode 100644 barretenberg/cpp/src/barretenberg/dsl/types.hpp diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index b6d3082ca9d..ec7da2a62ea 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -3,7 +3,6 @@ #include "barretenberg/common/map.hpp" #include "barretenberg/common/serialize.hpp" #include "barretenberg/dsl/acir_format/acir_format.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/honk/proof_system/types/proof.hpp" #include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/vm/avm_trace/avm_execution.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp index 1821d64e259..493cfe84061 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -20,6 +20,7 @@ #include "schnorr_verify.hpp" #include "sha256_constraint.hpp" #include +#include namespace acir_format { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp index 069d144e54f..3149210a8be 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/aes128_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp index f508e51c084..0c1708dad96 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.cpp @@ -1,6 +1,5 @@ #include "bigint_constraint.hpp" #include "barretenberg/common/assert.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" #include "barretenberg/numeric/uintx/uintx.hpp" #include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp index 537e36d3a38..2bdc2adab85 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp" #include "barretenberg/ecc/curves/secp256r1/secp256r1.hpp" #include "barretenberg/serialize/msgpack.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp index fd881409b75..d0fd67eaa55 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp index 6e1e2c7e243..f5a9c0e546b 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp index cfd4dfac256..5f21ed8716a 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp index 15dc145be3a..8a89b1db7c0 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp @@ -1,5 +1,4 @@ #include "ec_operations.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/ecc/groups/affine_element.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp index 5c16505bc90..6c33bee13ee 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp index 05b0154009d..e57b60b09cf 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp @@ -1,7 +1,6 @@ #pragma once #include "barretenberg/crypto/ecdsa/ecdsa.hpp" #include "barretenberg/dsl/builder_types.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" #include "barretenberg/stdlib/primitives/witness/witness.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp index 520d03d8197..aac9f1b8ab3 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.hpp @@ -1,6 +1,5 @@ #pragma once #include "barretenberg/common/serialize.hpp" -#include "barretenberg/dsl/types.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp index 89db49e7980..8a5d97546e6 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp @@ -1,6 +1,5 @@ #pragma once #include "barretenberg/dsl/builder_types.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp index 4653651d67d..6ae65a6e8d2 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp index a2457ccf52d..a9af61e4395 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp @@ -1,6 +1,5 @@ #pragma once #include "barretenberg/dsl/builder_types.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp index db2680f63d2..bbe410ef642 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp @@ -1,5 +1,4 @@ #include "multi_scalar_mul.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/plonk_honk_shared/arithmetization/gate_data.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp index b206bd36fc5..65e9a7c1b16 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp index 99f65e4583f..5737da41e37 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp @@ -1,6 +1,5 @@ #pragma once #include "barretenberg/common/serialize.hpp" -#include "barretenberg/dsl/types.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.hpp index 8ce677b016c..342d709fd59 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/poseidon2_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp index 79e7cbdaecd..b125b3375ab 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/schnorr_verify.hpp @@ -1,6 +1,5 @@ #pragma once #include "barretenberg/common/serialize.hpp" -#include "barretenberg/dsl/types.hpp" #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp index 8a5a416975c..eef6327ab12 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp @@ -1,5 +1,4 @@ #include "sha256_constraint.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/stdlib/hash/sha256/sha256.hpp" #include "barretenberg/stdlib/hash/sha256/sha256_plookup.hpp" #include "round.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp index 7a1393a2f22..1843aa5198d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp index 7db0ed21c51..b54244cf9bb 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp @@ -2,7 +2,6 @@ #include "barretenberg/common/serialize.hpp" #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/dsl/acir_format/acir_format.hpp" -#include "barretenberg/dsl/types.hpp" #include "barretenberg/plonk/composer/ultra_composer.hpp" #include "barretenberg/plonk/proof_system/proving_key/serialize.hpp" #include "barretenberg/plonk/proof_system/verification_key/sol_gen.hpp" diff --git a/barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp b/barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp deleted file mode 100644 index ab2d5741cb6..00000000000 --- a/barretenberg/cpp/src/barretenberg/dsl/builder_types.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" - -namespace acir_format { - -using Builder = bb::UltraCircuitBuilder; - -} // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/types.hpp b/barretenberg/cpp/src/barretenberg/dsl/types.hpp deleted file mode 100644 index 8c0e9802afc..00000000000 --- a/barretenberg/cpp/src/barretenberg/dsl/types.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// #pragma once -// #include "barretenberg/plonk/composer/ultra_composer.hpp" - -// #include "barretenberg/crypto/merkle_tree/hash_path.hpp" -// #include "barretenberg/goblin/goblin.hpp" -// #include "barretenberg/plonk/proof_system/prover/prover.hpp" -// #include "barretenberg/stdlib/commitment/pedersen/pedersen.hpp" -// #include "barretenberg/stdlib/encryption/schnorr/schnorr.hpp" -// #include "barretenberg/stdlib/plonk_recursion/aggregation_state/aggregation_state.hpp" -// #include "barretenberg/stdlib/plonk_recursion/verification_key/verification_key.hpp" -// #include "barretenberg/stdlib/plonk_recursion/verifier/program_settings.hpp" -// #include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" -// #include "barretenberg/stdlib/primitives/biggroup/biggroup.hpp" -// #include "barretenberg/stdlib/primitives/bit_array/bit_array.hpp" -// #include "barretenberg/stdlib/primitives/bool/bool.hpp" -// #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" -// #include "barretenberg/stdlib/primitives/curves/bn254.hpp" -// #include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" -// #include "barretenberg/stdlib/primitives/curves/secp256r1.hpp" -// #include "barretenberg/stdlib/primitives/databus/databus.hpp" -// #include "barretenberg/stdlib/primitives/memory/ram_table.hpp" -// #include "barretenberg/stdlib/primitives/memory/rom_table.hpp" -// #include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp" -// #include "barretenberg/stdlib/primitives/uint/uint.hpp" -// #include "barretenberg/stdlib/primitives/witness/witness.hpp" - -// namespace acir_format { - -// using Builder = bb::UltraCircuitBuilder; -// using GoblinBuilder = bb::GoblinProver::Builder; -// using Composer = plonk::UltraComposer; - -// using Prover = -// std::conditional_t, plonk::UltraWithKeccakProver, plonk::Prover>; - -// using Verifier = -// std::conditional_t, plonk::UltraWithKeccakVerifier, -// plonk::Verifier>; - -// using RecursiveProver = plonk::UltraProver; - -// using witness_ct = bb::stdlib::witness_t; -// using public_witness_ct = bb::stdlib::public_witness_t; -// using bool_ct = bb::stdlib::bool_t; -// using byte_array_ct = bb::stdlib::byte_array; -// using packed_byte_array_ct = bb::stdlib::packed_byte_array; -// using field_ct = bb::stdlib::field_t; -// using suint_ct = bb::stdlib::safe_uint_t; -// using uint8_ct = bb::stdlib::uint8; -// using uint16_ct = bb::stdlib::uint16; -// using uint32_ct = bb::stdlib::uint32; -// using uint64_ct = bb::stdlib::uint64; -// using bit_array_ct = bb::stdlib::bit_array; -// using fq_ct = bb::stdlib::bigfield; -// using biggroup_ct = bb::stdlib::element; -// using cycle_group_ct = bb::stdlib::cycle_group; -// using cycle_scalar_ct = bb::stdlib::cycle_group::cycle_scalar; -// using pedersen_commitment = bb::stdlib::pedersen_commitment; -// using bn254 = bb::stdlib::bn254; -// using secp256k1_ct = bb::stdlib::secp256k1; -// using secp256r1_ct = bb::stdlib::secp256r1; -// using databus_ct = bb::stdlib::databus; - -// using hash_path_ct = bb::crypto::merkle_tree::hash_path; - -// using schnorr_signature_bits_ct = bb::stdlib::schnorr_signature_bits; - -// // Ultra-composer specific typesv -// using rom_table_ct = bb::stdlib::rom_table; -// using ram_table_ct = bb::stdlib::ram_table; - -// using verification_key_ct = bb::stdlib::recursion::verification_key; -// using aggregation_state_ct = bb::stdlib::recursion::aggregation_state; -// using noir_recursive_settings = bb::stdlib::recursion::recursive_ultra_verifier_settings; -// using Transcript_ct = bb::stdlib::recursion::Transcript; - -// } // namespace acir_format From 6e47468ceb3f3861eb960a1177e46185c2811333 Mon Sep 17 00:00:00 2001 From: ludamad Date: Sat, 1 Jun 2024 20:00:49 +0000 Subject: [PATCH 7/8] remove templates --- .../cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp | 2 +- .../dsl/acir_format/honk_recursion_constraint.hpp | 2 +- .../cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp | 4 +++- .../src/barretenberg/dsl/acir_format/recursion_constraint.hpp | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp index e57b60b09cf..3a00798ab2f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp @@ -1,6 +1,5 @@ #pragma once #include "barretenberg/crypto/ecdsa/ecdsa.hpp" -#include "barretenberg/dsl/builder_types.hpp" #include "barretenberg/serialize/msgpack.hpp" #include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp" #include "barretenberg/stdlib/primitives/witness/witness.hpp" @@ -8,6 +7,7 @@ namespace acir_format { +using Builder = bb::UltraCircuitBuilder; using witness_ct = bb::stdlib::witness_t; struct EcdsaSecp256k1Constraint { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp index 8a5d97546e6..a140f75932d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/honk_recursion_constraint.hpp @@ -1,9 +1,9 @@ #pragma once -#include "barretenberg/dsl/builder_types.hpp" #include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp" #include namespace acir_format { +using Builder = bb::UltraCircuitBuilder; using namespace bb; using fq_ct = stdlib::bigfield; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp index a9af61e4395..16b17f73830 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp @@ -1,10 +1,12 @@ #pragma once -#include "barretenberg/dsl/builder_types.hpp" #include "barretenberg/serialize/msgpack.hpp" +#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp" #include namespace acir_format { +using Builder = bb::UltraCircuitBuilder; + struct LogicConstraint { uint32_t a; uint32_t b; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp index a8856994419..6e17c6e88ff 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.hpp @@ -1,5 +1,4 @@ #pragma once -#include "barretenberg/dsl/builder_types.hpp" #include "barretenberg/plonk/proof_system/constants.hpp" #include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp" #include "barretenberg/plonk/transcript/transcript_wrappers.hpp" @@ -8,6 +7,7 @@ namespace acir_format { using namespace bb::plonk; +using Builder = bb::UltraCircuitBuilder; /** * @brief RecursionConstraint struct contains information required to recursively verify a proof! From 048a4ee1a0ef4add757667b708987bd86ef99828 Mon Sep 17 00:00:00 2001 From: ludamad Date: Sat, 1 Jun 2024 20:14:22 +0000 Subject: [PATCH 8/8] fix bb-gcc --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1bcf8b3ed1..9b79be21b8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -248,7 +248,7 @@ jobs: +bench-comment bb-gcc: - needs: [build, changes] + needs: [setup, changes] runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 if: ${{ needs.changes.outputs.barretenberg-cpp == 'true' }} steps: