From fbbb34287fdef0e8fedb2e25c5431f17501ad653 Mon Sep 17 00:00:00 2001 From: David Banks <47112877+dbanks12@users.noreply.github.com> Date: Wed, 31 May 2023 17:20:11 -0400 Subject: [PATCH] feat(api): external cpp header for circuits (#489) * missing header includes * comments in api header with issues/todos --- cpp/.aztec-packages-commit | 2 +- cpp/src/CMakeLists.txt | 1 + cpp/src/barretenberg/barretenberg.hpp | 74 +++++++++++++++++++++++ cpp/src/barretenberg/common/container.hpp | 1 + cpp/src/barretenberg/common/map.hpp | 1 + 5 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 cpp/src/barretenberg/barretenberg.hpp diff --git a/cpp/.aztec-packages-commit b/cpp/.aztec-packages-commit index 9c53dd4c9f..9c6074054f 100644 --- a/cpp/.aztec-packages-commit +++ b/cpp/.aztec-packages-commit @@ -1 +1 @@ -84754bbb47e32c722a9c13de17c328ae15e58f01 \ No newline at end of file +a952e233e2a436e37f295d06d1ce344aafba90d0 diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index 7f12367c67..0623373a7f 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -247,6 +247,7 @@ else() if(INSTALL_BARRETENBERG) # The `install` function takes targets to install in different destinations on the system. install( + # TODO(dbanks12): should only need to install API headers TARGETS barretenberg barretenberg_headers # We also give it an optional export name in case something wants to target the install. EXPORT barretenbergTargets diff --git a/cpp/src/barretenberg/barretenberg.hpp b/cpp/src/barretenberg/barretenberg.hpp new file mode 100644 index 0000000000..951ef5897f --- /dev/null +++ b/cpp/src/barretenberg/barretenberg.hpp @@ -0,0 +1,74 @@ +#pragma once + +// External Barretenberg C++ API +#include "common/container.hpp" +#include "common/map.hpp" +#include "common/serialize.hpp" +#include "common/streams.hpp" +#include "common/throw_or_abort.hpp" +#include "crypto/blake2s/blake2s.hpp" +#include "crypto/blake3s/blake3s.hpp" +#include "crypto/ecdsa/ecdsa.hpp" +#include "crypto/generators/generator_data.hpp" +#include "crypto/keccak/keccak.hpp" +#include "crypto/pedersen_commitment/pedersen.hpp" +#include "crypto/pedersen_hash/pedersen.hpp" +#include "crypto/schnorr/schnorr.hpp" +#include "crypto/sha256/sha256.hpp" +#include "ecc/curves/bn254/fq.hpp" +#include "ecc/curves/bn254/fr.hpp" +#include "ecc/curves/bn254/g1.hpp" +#include "ecc/curves/grumpkin/grumpkin.hpp" +#include "numeric/random/engine.hpp" +#include "numeric/uint256/uint256.hpp" +#include "plonk/composer/turbo_plonk_composer.hpp" +#include "plonk/composer/ultra_plonk_composer.hpp" +#include "plonk/proof_system/types/proof.hpp" +#include "plonk/proof_system/verification_key/verification_key.hpp" +#include "proof_system/types/composer_type.hpp" +// TODO(https://github.com/AztecProtocol/barretenberg/issues/491): +// consider helper header(s) for serialization and other non-stdlib includes +// - possibly: common, serialize, srs, transcript +#include "serialize/cbind.hpp" +#include "serialize/cbind_fwd.hpp" +#include "serialize/msgpack.hpp" +#include "serialize/test_helper.hpp" +#include "srs/reference_string/env_reference_string.hpp" +#include "srs/reference_string/mem_reference_string.hpp" +#include "stdlib/commitment/pedersen/pedersen.hpp" +#include "stdlib/commitment/pedersen/pedersen_plookup.hpp" +#include "stdlib/encryption/ecdsa/ecdsa.hpp" +#include "stdlib/encryption/schnorr/schnorr.hpp" +#include "stdlib/hash/blake2s/blake2s.hpp" +#include "stdlib/hash/blake3s/blake3s.hpp" +#include "stdlib/hash/pedersen/pedersen.hpp" +#include "stdlib/merkle_tree/hash.hpp" +#include "stdlib/merkle_tree/membership.hpp" +#include "stdlib/merkle_tree/memory_store.hpp" +#include "stdlib/merkle_tree/memory_tree.hpp" +#include "stdlib/merkle_tree/merkle_tree.hpp" +// TODO(https://github.com/AztecProtocol/aztec-packages/issues/728): +// Consider moving nullifier tree logic out of barretenberg into aztec repo +#include "stdlib/merkle_tree/nullifier_tree/nullifier_leaf.hpp" +#include "stdlib/merkle_tree/nullifier_tree/nullifier_memory_tree.hpp" +#include "stdlib/merkle_tree/nullifier_tree/nullifier_tree.hpp" +#include "stdlib/primitives/address/address.hpp" +#include "stdlib/primitives/bigfield/bigfield.hpp" +#include "stdlib/primitives/biggroup/biggroup.hpp" +#include "stdlib/primitives/bit_array/bit_array.hpp" +#include "stdlib/primitives/bool/bool.hpp" +#include "stdlib/primitives/byte_array/byte_array.hpp" +#include "stdlib/primitives/curves/bn254.hpp" +#include "stdlib/primitives/field/array.hpp" +#include "stdlib/primitives/field/field.hpp" +#include "stdlib/primitives/group/group.hpp" +#include "stdlib/primitives/packed_byte_array/packed_byte_array.hpp" +#include "stdlib/primitives/point/point.hpp" +#include "stdlib/primitives/uint/uint.hpp" +#include "stdlib/primitives/witness/witness.hpp" +#include "stdlib/recursion/aggregation_state/aggregation_state.hpp" +#include "stdlib/recursion/aggregation_state/native_aggregation_state.hpp" +#include "stdlib/recursion/verification_key/verification_key.hpp" +#include "stdlib/recursion/verifier/program_settings.hpp" +#include "stdlib/recursion/verifier/verifier.hpp" +#include "transcript/manifest.hpp" diff --git a/cpp/src/barretenberg/common/container.hpp b/cpp/src/barretenberg/common/container.hpp index 1c87bb1224..f82a40075f 100644 --- a/cpp/src/barretenberg/common/container.hpp +++ b/cpp/src/barretenberg/common/container.hpp @@ -2,6 +2,7 @@ #include #include #include +#include template C slice(C const& container, size_t start) { diff --git a/cpp/src/barretenberg/common/map.hpp b/cpp/src/barretenberg/common/map.hpp index 79205f2bda..1118131e6f 100644 --- a/cpp/src/barretenberg/common/map.hpp +++ b/cpp/src/barretenberg/common/map.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include #include /*