From 532dd0b5d4729a19a991f719281db74d64f34ab8 Mon Sep 17 00:00:00 2001 From: Suyash Bagad Date: Wed, 19 Apr 2023 17:17:54 +0000 Subject: [PATCH 01/18] More generators for aztec3. --- .../crypto/generators/generator_data.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cpp/src/barretenberg/crypto/generators/generator_data.cpp b/cpp/src/barretenberg/crypto/generators/generator_data.cpp index 1ad6127923..982003c682 100644 --- a/cpp/src/barretenberg/crypto/generators/generator_data.cpp +++ b/cpp/src/barretenberg/crypto/generators/generator_data.cpp @@ -6,14 +6,18 @@ namespace { // The number of unique base points with default main index with precomputed ladders #ifdef __wasm__ -constexpr size_t num_default_generators = 32; +constexpr size_t num_default_generators = 64; +constexpr size_t num_generators_per_hash_index = 16; +constexpr size_t num_hash_indices = 32; +constexpr size_t hash_indices_generator_offset = 64; +// TODO need to resolve memory out of bounds when these are too high #else constexpr size_t num_default_generators = 2048; +constexpr size_t num_hash_indices = 32; +constexpr size_t num_generators_per_hash_index = 128; +constexpr size_t hash_indices_generator_offset = 2048; #endif -constexpr size_t hash_indices_generator_offset = 2048; -constexpr size_t num_hash_indices = 16; -constexpr size_t num_generators_per_hash_index = 8; constexpr size_t num_indexed_generators = num_hash_indices * num_generators_per_hash_index; constexpr size_t size_of_generator_data_array = hash_indices_generator_offset + num_indexed_generators; constexpr size_t num_generator_types = 3; From 7605af99e385844397fef56c3d423f3b1f1a0a2b Mon Sep 17 00:00:00 2001 From: Suyash Bagad Date: Thu, 20 Apr 2023 09:55:21 +0000 Subject: [PATCH 02/18] update js vk (because we now use UP for merkle hashing) --- .../join_split_example/proofs/join_split/join_split.test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp index 25b802cd62..10c44f8ec8 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp @@ -806,7 +806,7 @@ TEST_F(join_split_tests, test_0_input_notes_and_detect_circuit_change) constexpr uint32_t CIRCUIT_GATE_COUNT = 185573; constexpr uint32_t GATES_NEXT_POWER_OF_TWO = 524288; - const uint256_t VK_HASH("13eb88883e80efb9bf306af2962cd1a49e9fa1b0bfb2d4b563b95217a17bcc74"); + const uint256_t VK_HASH("21389d5392ee23ffc96984689150b63d62113678b1ba127346a0ec72df842354"); auto number_of_gates_js = result.number_of_gates; auto vk_hash_js = get_verification_key()->sha256_hash(); From a93f7680ede20f6b7dd9262b16f7ab70675022b1 Mon Sep 17 00:00:00 2001 From: Suyash Bagad Date: Thu, 20 Apr 2023 15:50:17 +0530 Subject: [PATCH 03/18] Helpers for ECDSA in A3 (#364) * Add `stdlib_keccak` in cmake. Correct an assertion in `to_byte_array` in bigfield. * Add `random_element` to affine element. * negate y conditionally. --- cpp/src/CMakeLists.txt | 3 ++ .../ecc/groups/affine_element.hpp | 7 +++++ .../ecc/groups/affine_element_impl.hpp | 29 +++++++++++++++++++ .../stdlib/primitives/bigfield/bigfield.hpp | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index 350392c187..f441c80fa4 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -91,6 +91,7 @@ if(WASM) $ $ $ + $ $ $ $ @@ -193,6 +194,7 @@ if(WASM) $ $ $ + $ $ $ $ @@ -228,6 +230,7 @@ else() $ $ $ + $ $ $ $ diff --git a/cpp/src/barretenberg/ecc/groups/affine_element.hpp b/cpp/src/barretenberg/ecc/groups/affine_element.hpp index 82ba93bfef..8d85003a51 100644 --- a/cpp/src/barretenberg/ecc/groups/affine_element.hpp +++ b/cpp/src/barretenberg/ecc/groups/affine_element.hpp @@ -62,6 +62,13 @@ template class alignas(64) affine_el constexpr bool on_curve() const noexcept; + /** + * @brief Samples a random point on the curve. + * + * @return A randomly chosen point on the curve + */ + static affine_element random_element(numeric::random::Engine* engine = nullptr) noexcept; + /** * @brief Hash a seed value to curve. * diff --git a/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp b/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp index f5b2e1705a..b685bc05a0 100644 --- a/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp +++ b/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp @@ -229,5 +229,34 @@ affine_element affine_element::hash_to_curve(const uint64_ return affine_element(x_out, y_out_); } + +template +affine_element affine_element::random_element(numeric::random::Engine* engine) noexcept +{ + bool found_one = false; + Fq yy; + Fq x; + Fq y; + while (!found_one) { + // Sample a random x-coordinate and check if it satisfies curve equation. + x = Fq::random_element(engine); + yy = x.sqr() * x + T::b; + if constexpr (T::has_a) { + yy += (x * T::a); + } + auto [found_root, y1] = yy.sqrt(); + y = y1; + + // Negate the y-coordinate based on a randomly sampled bit. + bool random_bit = (engine->get_random_uint8() & 1); + if (random_bit) { + y = -y; + } + + found_one = found_root; + } + return affine_element(x, y); +} + } // namespace group_elements } // namespace barretenberg diff --git a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp index 2a1829ce22..865ce21bb1 100644 --- a/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp +++ b/cpp/src/barretenberg/stdlib/primitives/bigfield/bigfield.hpp @@ -160,7 +160,7 @@ template class bigfield { field_t lo = binary_basis_limbs[0].element + (binary_basis_limbs[1].element * shift_1); field_t hi = binary_basis_limbs[2].element + (binary_basis_limbs[3].element * shift_1); // n.b. this only works if NUM_LIMB_BITS * 2 is divisible by 8 - ASSERT((NUM_LIMB_BITS / 8) * 8 == NUM_LIMB_BITS); + ASSERT((NUM_LIMB_BITS * 2 / 8) * 8 == NUM_LIMB_BITS * 2); result.write(byte_array(hi, 32 - (NUM_LIMB_BITS / 4))); result.write(byte_array(lo, (NUM_LIMB_BITS / 4))); return result; From 1b6c57c9e0d76f37cdb38df11d418a9652469f0c Mon Sep 17 00:00:00 2001 From: Suyash Bagad Date: Fri, 21 Apr 2023 15:22:23 +0000 Subject: [PATCH 04/18] Change pedersen hash c_bind to use `pedersen_hash::lookup`. --- cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp b/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp index fc28d6fff0..ffffc314dc 100644 --- a/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp +++ b/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp @@ -11,6 +11,7 @@ extern "C" { WASM_EXPORT void pedersen_hash__init() { + // TODO: do we need this if we are using lookup-pedersen in merkle trees? crypto::generators::init_generator_data(); } @@ -18,7 +19,7 @@ WASM_EXPORT void pedersen__hash_pair(uint8_t const* left, uint8_t const* right, { auto lhs = barretenberg::fr::serialize_from_buffer(left); auto rhs = barretenberg::fr::serialize_from_buffer(right); - auto r = crypto::pedersen_hash::hash_multiple({ lhs, rhs }); + auto r = crypto::pedersen_hash::lookup::hash_multiple({ lhs, rhs }); barretenberg::fr::serialize_to_buffer(r, result); } @@ -26,7 +27,7 @@ WASM_EXPORT void pedersen__hash_multiple(uint8_t const* inputs_buffer, uint8_t* { std::vector to_compress; read(inputs_buffer, to_compress); - auto r = crypto::pedersen_hash::hash_multiple(to_compress); + auto r = crypto::pedersen_hash::lookup::hash_multiple(to_compress); barretenberg::fr::serialize_to_buffer(r, output); } @@ -36,7 +37,7 @@ WASM_EXPORT void pedersen__hash_multiple_with_hash_index(uint8_t const* inputs_b { std::vector to_compress; read(inputs_buffer, to_compress); - auto r = crypto::pedersen_hash::hash_multiple(to_compress, hash_index); + auto r = crypto::pedersen_hash::lookup::hash_multiple(to_compress, hash_index); barretenberg::fr::serialize_to_buffer(r, output); } @@ -54,7 +55,7 @@ WASM_EXPORT uint8_t* pedersen__hash_to_tree(uint8_t const* data) fields.reserve(num_outputs); for (size_t i = 0; fields.size() < num_outputs; i += 2) { - fields.push_back(crypto::pedersen_hash::hash_multiple({ fields[i], fields[i + 1] })); + fields.push_back(crypto::pedersen_hash::lookup::hash_multiple({ fields[i], fields[i + 1] })); } auto buf_size = 4 + num_outputs * sizeof(grumpkin::fq); From c25bd08a69ea8f8cf42726d6ebedf9487176171d Mon Sep 17 00:00:00 2001 From: Suyash Bagad Date: Wed, 3 May 2023 01:11:48 +0530 Subject: [PATCH 05/18] c_binds and other ECDSA related fixes (#407) * Add v to stdlib ecdsa. * create an engine if its empty. * Add ecdsa c_bind. * print v as a uint32. * Add secp256k1 cbind. add c_bind.hpp Change hpp to h. remove hpp. * Add ecdsa in cmakelists. remove stdlib_ecdsa from build. --- cpp/src/CMakeLists.txt | 4 ++ cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp | 70 +++++++++++++++++++ cpp/src/barretenberg/crypto/ecdsa/c_bind.h | 29 ++++++++ cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp | 6 +- .../dsl/acir_format/ecdsa_secp256k1.cpp | 4 +- .../ecc/curves/secp256k1/c_bind.cpp | 30 ++++++++ .../ecc/curves/secp256k1/c_bind.hpp | 12 ++++ .../ecc/groups/affine_element_impl.hpp | 4 ++ .../stdlib/encryption/ecdsa/ecdsa.hpp | 4 ++ .../stdlib/encryption/ecdsa/ecdsa.test.cpp | 5 +- .../stdlib/encryption/ecdsa/ecdsa_impl.hpp | 5 ++ 11 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp create mode 100644 cpp/src/barretenberg/crypto/ecdsa/c_bind.h create mode 100644 cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.cpp create mode 100644 cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.hpp diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index f441c80fa4..69d867a2f7 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -76,6 +76,7 @@ if(WASM) $ $ $ + $ $ $ $ @@ -125,6 +126,7 @@ if(WASM) $ $ $ + $ $ $ $ @@ -179,6 +181,7 @@ if(WASM) $ $ $ + $ $ $ $ @@ -215,6 +218,7 @@ else() $ $ $ + $ $ $ $ diff --git a/cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp b/cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp new file mode 100644 index 0000000000..b7a8d6f5a9 --- /dev/null +++ b/cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp @@ -0,0 +1,70 @@ +#include "ecdsa.hpp" +#include + +#define WASM_EXPORT __attribute__((visibility("default"))) + +extern "C" { + +WASM_EXPORT void ecdsa__compute_public_key(uint8_t const* private_key, uint8_t* public_key_buf) +{ + auto priv_key = from_buffer(private_key); + secp256k1::g1::affine_element pub_key = secp256k1::g1::one * priv_key; + write(public_key_buf, pub_key); +} + +WASM_EXPORT void ecdsa__construct_signature(uint8_t const* message, + size_t msg_len, + uint8_t const* private_key, + uint8_t* output_sig_r, + uint8_t* output_sig_s, + uint8_t* output_sig_v) +{ + using serialize::write; + auto priv_key = from_buffer(private_key); + secp256k1::g1::affine_element pub_key = secp256k1::g1::one * priv_key; + crypto::ecdsa::key_pair key_pair = { priv_key, pub_key }; + + auto sig = crypto::ecdsa::construct_signature( + std::string((char*)message, msg_len), key_pair); + write(output_sig_r, sig.r); + write(output_sig_s, sig.s); + write(output_sig_v, sig.v); +} + +WASM_EXPORT void ecdsa__recover_public_key_from_signature(uint8_t const* message, + size_t msg_len, + uint8_t const* sig_r, + uint8_t const* sig_s, + uint8_t* sig_v, + uint8_t* output_pub_key) +{ + std::array r, s; + std::copy(sig_r, sig_r + 32, r.begin()); + std::copy(sig_s, sig_s + 32, s.begin()); + const uint8_t v = *sig_v; + + crypto::ecdsa::signature sig = { r, s, v }; + auto recovered_pub_key = + crypto::ecdsa::recover_public_key( + std::string((char*)message, msg_len), sig); + write(output_pub_key, recovered_pub_key); +} + +WASM_EXPORT bool ecdsa__verify_signature(uint8_t const* message, + size_t msg_len, + uint8_t const* pub_key, + uint8_t const* sig_r, + uint8_t const* sig_s, + uint8_t const* sig_v) +{ + auto pubk = from_buffer(pub_key); + std::array r, s; + std::copy(sig_r, sig_r + 32, r.begin()); + std::copy(sig_s, sig_s + 32, s.begin()); + const uint8_t v = *sig_v; + + crypto::ecdsa::signature sig = { r, s, v }; + return crypto::ecdsa::verify_signature( + std::string((char*)message, msg_len), pubk, sig); +} +} \ No newline at end of file diff --git a/cpp/src/barretenberg/crypto/ecdsa/c_bind.h b/cpp/src/barretenberg/crypto/ecdsa/c_bind.h new file mode 100644 index 0000000000..897202a372 --- /dev/null +++ b/cpp/src/barretenberg/crypto/ecdsa/c_bind.h @@ -0,0 +1,29 @@ +#include + +#define WASM_EXPORT __attribute__((visibility("default"))) + +extern "C" { + +WASM_EXPORT void ecdsa__compute_public_key(uint8_t const* private_key, uint8_t* public_key_buf); + +WASM_EXPORT void ecdsa__construct_signature(uint8_t const* message, + size_t msg_len, + uint8_t const* private_key, + uint8_t* output_sig_r, + uint8_t* output_sig_s, + uint8_t* output_sig_v); + +WASM_EXPORT void ecdsa__recover_public_key_from_signature(uint8_t const* message, + size_t msg_len, + uint8_t const* sig_r, + uint8_t const* sig_s, + uint8_t* sig_v, + uint8_t* output_pub_key); + +WASM_EXPORT bool ecdsa__verify_signature(uint8_t const* message, + size_t msg_len, + uint8_t const* pub_key, + uint8_t const* sig_r, + uint8_t const* sig_s, + uint8_t const* sig_v); +} diff --git a/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp b/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp index dea2e18658..57e9074a1b 100644 --- a/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp +++ b/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp @@ -30,17 +30,18 @@ bool verify_signature(const std::string& message, inline bool operator==(signature const& lhs, signature const& rhs) { - return lhs.r == rhs.r && lhs.s == rhs.s; + return lhs.r == rhs.r && lhs.s == rhs.s && lhs.v == rhs.v; } inline std::ostream& operator<<(std::ostream& os, signature const& sig) { - os << "{ " << sig.r << ", " << sig.s << " }"; + os << "{ " << sig.r << ", " << sig.s << ", " << static_cast(sig.v) << " }"; return os; } template inline void read(B& it, signature& sig) { + using serialize::read; read(it, sig.r); read(it, sig.s); read(it, sig.v); @@ -48,6 +49,7 @@ template inline void read(B& it, signature& sig) template inline void write(B& buf, signature const& sig) { + using serialize::write; write(buf, sig.r); write(buf, sig.s); write(buf, sig.v); diff --git a/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp b/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp index c18a426e20..21abc4e8e2 100644 --- a/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp +++ b/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp @@ -96,9 +96,11 @@ void create_ecdsa_verify_constraints(Composer& composer, const EcdsaSecp256k1Con std::vector rr(new_sig.r.begin(), new_sig.r.end()); std::vector ss(new_sig.s.begin(), new_sig.s.end()); + uint8_t vv = new_sig.v; stdlib::ecdsa::signature sig{ stdlib::byte_array(&composer, rr), - stdlib::byte_array(&composer, ss) }; + stdlib::byte_array(&composer, ss), + stdlib::uint8(&composer, vv) }; pub_key_x_fq.assert_is_in_field(); pub_key_y_fq.assert_is_in_field(); diff --git a/cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.cpp b/cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.cpp new file mode 100644 index 0000000000..107d889d4c --- /dev/null +++ b/cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.cpp @@ -0,0 +1,30 @@ +#include "secp256k1.hpp" + +#define WASM_EXPORT __attribute__((visibility("default"))) + +extern "C" { + +WASM_EXPORT void ecc_secp256k1__mul(uint8_t const* point_buf, uint8_t const* scalar_buf, uint8_t* result) +{ + auto point = from_buffer(point_buf); + auto scalar = from_buffer(scalar_buf); + secp256k1::g1::affine_element r = point * scalar; + write(result, r); +} + +WASM_EXPORT void ecc_secp256k1__get_random_scalar_mod_circuit_modulus(uint8_t* result) +{ + barretenberg::fr output = barretenberg::fr::random_element(); + write(result, output); +} + +WASM_EXPORT void ecc_secp256k1__reduce512_buffer_mod_circuit_modulus(uint8_t* input, uint8_t* result) +{ + uint512_t bigint_input = from_buffer(input); + + uint512_t barretenberg_modulus(barretenberg::fr::modulus); + + uint512_t target_output = bigint_input % barretenberg_modulus; + write(result, target_output.lo); +} +} \ No newline at end of file diff --git a/cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.hpp b/cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.hpp new file mode 100644 index 0000000000..b1b1983239 --- /dev/null +++ b/cpp/src/barretenberg/ecc/curves/secp256k1/c_bind.hpp @@ -0,0 +1,12 @@ +#include "secp256k1.hpp" + +#define WASM_EXPORT __attribute__((visibility("default"))) + +extern "C" { + +WASM_EXPORT void ecc_secp256k1__mul(uint8_t const* point_buf, uint8_t const* scalar_buf, uint8_t* result); + +WASM_EXPORT void ecc_secp256k1__get_random_scalar_mod_circuit_modulus(uint8_t* result); + +WASM_EXPORT void ecc_secp256k1__reduce512_buffer_mod_circuit_modulus(uint8_t* input, uint8_t* result); +} diff --git a/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp b/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp index b685bc05a0..c1e61e729f 100644 --- a/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp +++ b/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp @@ -233,6 +233,10 @@ affine_element affine_element::hash_to_curve(const uint64_ template affine_element affine_element::random_element(numeric::random::Engine* engine) noexcept { + if (engine == nullptr) { + engine = &numeric::random::get_engine(); + } + bool found_one = false; Fq yy; Fq x; diff --git a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp index 1864557af4..ea5f890fd5 100644 --- a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp +++ b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp @@ -2,6 +2,7 @@ #include "barretenberg/crypto/ecdsa/ecdsa.hpp" #include "../../primitives/byte_array/byte_array.hpp" +#include "../../primitives/uint/uint.hpp" #include "../../primitives/composers/composers_fwd.hpp" namespace proof_system::plonk { @@ -11,6 +12,7 @@ namespace ecdsa { template struct signature { stdlib::byte_array r; stdlib::byte_array s; + stdlib::uint8 v; }; template @@ -25,9 +27,11 @@ static signature from_witness(Composer* ctx, const crypto::ecdsa::sign std::vector s_vec(std::begin(input.s), std::end(input.s)); stdlib::byte_array r(ctx, r_vec); stdlib::byte_array s(ctx, s_vec); + stdlib::uint8 v(ctx, input.v); signature out; out.r = r; out.s = s; + out.v = v; return out; } diff --git a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp index b1edc24d84..405d28f33c 100644 --- a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp +++ b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa.test.cpp @@ -35,8 +35,11 @@ TEST(stdlib_ecdsa, verify_signature) std::vector rr(signature.r.begin(), signature.r.end()); std::vector ss(signature.s.begin(), signature.s.end()); + uint8_t vv = signature.v; - stdlib::ecdsa::signature sig{ curve::byte_array_ct(&composer, rr), curve::byte_array_ct(&composer, ss) }; + stdlib::ecdsa::signature sig{ curve::byte_array_ct(&composer, rr), + curve::byte_array_ct(&composer, ss), + stdlib::uint8(&composer, vv) }; curve::byte_array_ct message(&composer, message_string); diff --git a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp index 12355453d6..4262555396 100644 --- a/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp +++ b/cpp/src/barretenberg/stdlib/encryption/ecdsa/ecdsa_impl.hpp @@ -13,6 +13,11 @@ bool_t verify_signature(const stdlib::byte_array& message, { Composer* ctx = message.get_context() ? message.get_context() : public_key.x.context; + // Check if revovery id v is either 27 ot 28. + // TODO(Suyash): check with Zac/Kesha/Cody. + field_t(sig.v).assert_is_in_set({ field_t(27), field_t(28) }, + "signature is non-standard"); + stdlib::byte_array hashed_message = static_cast>(stdlib::sha256(message)); From a44848650305e2f34eca14d737729e2e8a7c960c Mon Sep 17 00:00:00 2001 From: ludamad Date: Tue, 2 May 2023 15:59:04 -0400 Subject: [PATCH 06/18] hack: (aztec3) introduce barretenberg crypto generator parameters hack (#408) * hack: introduce BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK * doc: concise --- .../crypto/generators/generator_data.cpp | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/cpp/src/barretenberg/crypto/generators/generator_data.cpp b/cpp/src/barretenberg/crypto/generators/generator_data.cpp index 982003c682..a0c4e522fa 100644 --- a/cpp/src/barretenberg/crypto/generators/generator_data.cpp +++ b/cpp/src/barretenberg/crypto/generators/generator_data.cpp @@ -4,22 +4,30 @@ namespace crypto { namespace generators { namespace { -// The number of unique base points with default main index with precomputed ladders +// Parameters for generator table construction +struct GeneratorParameters { + size_t num_default_generators; // Number of unique base points with default main index + size_t num_hash_indices; // Number of unique hash indices + size_t num_generators_per_hash_index; // Number of generators per hash index + size_t hash_indices_generator_offset; // Offset for hash index generators +}; + +// Define BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK to use custom values for generator parameters +// This hack is to avoid breakage due to generators in aztec circuits while maintaining compatibility +// with the barretenberg master. +#ifdef BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK +constexpr GeneratorParameters GEN_PARAMS = {BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK}; +#else #ifdef __wasm__ -constexpr size_t num_default_generators = 64; -constexpr size_t num_generators_per_hash_index = 16; -constexpr size_t num_hash_indices = 32; -constexpr size_t hash_indices_generator_offset = 64; +constexpr GeneratorParameters GEN_PARAMS = {64, 16, 32, 64}; // TODO need to resolve memory out of bounds when these are too high #else -constexpr size_t num_default_generators = 2048; -constexpr size_t num_hash_indices = 32; -constexpr size_t num_generators_per_hash_index = 128; -constexpr size_t hash_indices_generator_offset = 2048; +constexpr GeneratorParameters GEN_PARAMS = {2048, 32, 128, 2048}; +#endif #endif -constexpr size_t num_indexed_generators = num_hash_indices * num_generators_per_hash_index; -constexpr size_t size_of_generator_data_array = hash_indices_generator_offset + num_indexed_generators; +constexpr size_t num_indexed_generators = GEN_PARAMS.num_hash_indices * GEN_PARAMS.num_generators_per_hash_index; +constexpr size_t size_of_generator_data_array = GEN_PARAMS.hash_indices_generator_offset + num_indexed_generators; constexpr size_t num_generator_types = 3; ladder_t g1_ladder; @@ -216,11 +224,11 @@ std::vector> const& init_generator_data() global_generator_data.resize(size_of_generator_data_array); - for (size_t i = 0; i < num_default_generators; i++) { + for (size_t i = 0; i < GEN_PARAMS.num_default_generators; i++) { global_generator_data[i] = compute_generator_data(generators[i], aux_generators[i], skew_generators[i]); } - for (size_t i = hash_indices_generator_offset; i < size_of_generator_data_array; i++) { + for (size_t i = GEN_PARAMS.hash_indices_generator_offset; i < size_of_generator_data_array; i++) { global_generator_data[i] = compute_generator_data(generators[i], aux_generators[i], skew_generators[i]); } @@ -264,12 +272,12 @@ generator_data const& get_generator_data(generator_index_t index) { auto& global_generator_data = init_generator_data(); if (index.index == 0) { - ASSERT(index.sub_index < num_default_generators); + ASSERT(index.sub_index < GEN_PARAMS.num_default_generators); return *global_generator_data[index.sub_index]; } - ASSERT(index.index <= num_hash_indices); - ASSERT(index.sub_index < num_generators_per_hash_index); - return *global_generator_data[hash_indices_generator_offset + ((index.index - 1) * num_generators_per_hash_index) + + ASSERT(index.index <= GEN_PARAMS.num_hash_indices); + ASSERT(index.sub_index < GEN_PARAMS.num_generators_per_hash_index); + return *global_generator_data[GEN_PARAMS.hash_indices_generator_offset + ((index.index - 1) * GEN_PARAMS.num_generators_per_hash_index) + index.sub_index]; } From cc45c9c560233eecd542124b662668718a9a6233 Mon Sep 17 00:00:00 2001 From: ludamad Date: Tue, 2 May 2023 16:58:35 -0400 Subject: [PATCH 07/18] chore: align BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK usage --- cpp/src/barretenberg/crypto/generators/generator_data.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/barretenberg/crypto/generators/generator_data.cpp b/cpp/src/barretenberg/crypto/generators/generator_data.cpp index a0c4e522fa..20345bae16 100644 --- a/cpp/src/barretenberg/crypto/generators/generator_data.cpp +++ b/cpp/src/barretenberg/crypto/generators/generator_data.cpp @@ -6,7 +6,7 @@ namespace { // Parameters for generator table construction struct GeneratorParameters { - size_t num_default_generators; // Number of unique base points with default main index + size_t num_default_generators; // Number of unique base points with default main index with precomputed ladders size_t num_hash_indices; // Number of unique hash indices size_t num_generators_per_hash_index; // Number of generators per hash index size_t hash_indices_generator_offset; // Offset for hash index generators @@ -19,10 +19,10 @@ struct GeneratorParameters { constexpr GeneratorParameters GEN_PARAMS = {BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK}; #else #ifdef __wasm__ -constexpr GeneratorParameters GEN_PARAMS = {64, 16, 32, 64}; +constexpr GeneratorParameters GEN_PARAMS = {32, 16, 8, 2048}; // TODO need to resolve memory out of bounds when these are too high #else -constexpr GeneratorParameters GEN_PARAMS = {2048, 32, 128, 2048}; +constexpr GeneratorParameters GEN_PARAMS = {2048, 16, 8, 2048}; #endif #endif @@ -294,4 +294,4 @@ const fixed_base_ladder* generator_data::get_hash_ladder(size_t num_bits) const } } // namespace generators -} // namespace crypto +} // namespace crypto \ No newline at end of file From 12feebab41b41cad6f574cb0fcf25db095d3bc82 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 3 May 2023 19:38:34 +0000 Subject: [PATCH 08/18] CI to test aztec circuits with current commit of bberg --- .circleci/cond_spot_run_build | 2 +- .circleci/cond_spot_run_tests_custom | 13 ++++ .circleci/config.yml | 69 ++++++++++++++++++- cpp/.aztec-packages-commit | 1 + ...e.circuits-wasm-linux-clang-builder-runner | 8 +++ ...circuits-x86_64-linux-clang-builder-runner | 18 +++++ cpp/scripts/run_aztec_circuits_tests | 52 ++++++++++++++ 7 files changed, 161 insertions(+), 2 deletions(-) create mode 100755 .circleci/cond_spot_run_tests_custom create mode 100644 cpp/.aztec-packages-commit create mode 100644 cpp/dockerfiles/Dockerfile.circuits-wasm-linux-clang-builder-runner create mode 100644 cpp/dockerfiles/Dockerfile.circuits-x86_64-linux-clang-builder-runner create mode 100755 cpp/scripts/run_aztec_circuits_tests diff --git a/.circleci/cond_spot_run_build b/.circleci/cond_spot_run_build index d4fa4723ea..6aa18b7ffe 100755 --- a/.circleci/cond_spot_run_build +++ b/.circleci/cond_spot_run_build @@ -13,7 +13,7 @@ LAST_SUCCESSFUL_COMMIT=$(last_successful_commit $REPOSITORY) echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" if check_rebuild "$LAST_SUCCESSFUL_COMMIT" $REPOSITORY; then - spot_run_script $SPEC ../.circleci/remote_build/remote_build $REPOSITORY $@ + spot_run_script $SPEC $BUILD_SYSTEM_PATH/remote_build/remote_build $REPOSITORY $@ else echo "No rebuild necessary. Retagging..." STAGES=$(cat $DOCKERFILE | sed -n -e 's/^FROM .* AS \(.*\)/\1/p') diff --git a/.circleci/cond_spot_run_tests_custom b/.circleci/cond_spot_run_tests_custom new file mode 100755 index 0000000000..044777b673 --- /dev/null +++ b/.circleci/cond_spot_run_tests_custom @@ -0,0 +1,13 @@ +#!/bin/bash +set -e +REPOSITORY=$1 +SCRIPT_PATH=$2 +shift +shift + +cd $(query_manifest projectDir $REPOSITORY) + +mkdir -p /tmp/test-logs + +set -o pipefail +cond_spot_run_script $REPOSITORY $JOB_NAME 32 $SCRIPT_PATH $@ | tee "/tmp/test-logs/$JOB_NAME.log" diff --git a/.circleci/config.yml b/.circleci/config.yml index c4618ddcca..7e8bba35f3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,7 +82,16 @@ benchmark_add_keys: &benchmark_add_keys setup_env: &setup_env run: name: "Setup environment" - command: cd .circleci && ./setup_env "$CIRCLE_SHA1" "$CIRCLE_TAG" "$CIRCLE_JOB" "$CIRCLE_REPOSITORY_URL" "$CIRCLE_BRANCH" + command: | + cd .circleci && ./setup_env "$CIRCLE_SHA1" "$CIRCLE_TAG" "$CIRCLE_JOB" "$CIRCLE_REPOSITORY_URL" "$CIRCLE_BRANCH" + +setup_aztec_commit: &setup_aztec_commit + run: + name: "Setup environment for Aztec Integration Testing" + command: | + # Load the aztec commit into env for use in integration tests + echo "export AZTEC_COMMIT=$(cat cpp/.aztec-packages-commit 2>/dev/null || echo master)" >> "$BASH_ENV" + source "$BASH_ENV" # This step is used to save logs from various barretenberg test to the workspace so that they can be used later to parse benchmark values out of them save_logs: &save_logs @@ -235,6 +244,56 @@ jobs: name: "Test" command: store_test_benchmark_logs barretenberg-x86_64-linux-clang-assert + ################################### + # Aztec integration tests + circuits-wasm-linux-clang-builder-runner: + docker: + - image: aztecprotocol/alpine-build-image + resource_class: small + steps: + - *checkout + - *setup_env + - run: + name: "Build" + command: cond_spot_run_build barretenberg-circuits-wasm-linux-clang-builder-runner 64 + + circuits-x86_64-linux-clang-builder-runner: + docker: + - image: aztecprotocol/alpine-build-image + resource_class: small + steps: + - *checkout + - *setup_env + - run: + name: "Build" + command: cond_spot_run_build barretenberg-circuits-x86_64-linux-clang-builder-runner 64 + + circuits-wasm-tests: + docker: + - image: aztecprotocol/alpine-build-image + resource_class: small + steps: + - *checkout + - *setup_env + - *setup_aztec_commit + - run: + name: "Build" + command: cond_spot_run_tests_custom barretenberg-circuits-wasm-linux-clang-builder-runner ./scripts/run_aztec_circuits_tests "$AZTEC_COMMIT" 1 wasm scripts/a3-tests -*.skip*:*.circuit* + + circuits-x86_64-tests: + docker: + - image: aztecprotocol/alpine-build-image + resource_class: small + steps: + - *checkout + - *setup_env + - *setup_aztec_commit + - run: + name: "Build" + command: cond_spot_run_tests_custom barretenberg-circuits-x86_64-linux-clang-builder-runner ./scripts/run_aztec_circuits_tests "$AZTEC_COMMIT" 1 x86_64 scripts/a3-tests -*.skip* + # End Aztec integration tests + ################################### + # Repeatable config for defining the workflow below. bb_test: &bb_test requires: @@ -266,3 +325,11 @@ workflows: branches: only: - master + - circuits-wasm-linux-clang-builder-runner + - circuits-x86_64-linux-clang-builder-runner + - circuits-wasm-tests: + requires: + - circuits-wasm-linux-clang-builder-runner + - circuits-x86_64-tests: + requires: + - circuits-x86_64-linux-clang-builder-runner \ No newline at end of file diff --git a/cpp/.aztec-packages-commit b/cpp/.aztec-packages-commit new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/cpp/.aztec-packages-commit @@ -0,0 +1 @@ +master diff --git a/cpp/dockerfiles/Dockerfile.circuits-wasm-linux-clang-builder-runner b/cpp/dockerfiles/Dockerfile.circuits-wasm-linux-clang-builder-runner new file mode 100644 index 0000000000..0b634d1ad8 --- /dev/null +++ b/cpp/dockerfiles/Dockerfile.circuits-wasm-linux-clang-builder-runner @@ -0,0 +1,8 @@ +FROM ubuntu:kinetic +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y bash build-essential git libssl-dev cmake ninja-build curl binaryen xz-utils curl + +RUN curl https://wasmtime.dev/install.sh -sSf | bash /dev/stdin --version v3.0.1 +WORKDIR /usr/src/barretenberg/cpp/src +RUN curl -s -L https://github.com/CraneStation/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz | tar zxfv - +WORKDIR /usr/src/barretenberg/cpp +COPY . . \ No newline at end of file diff --git a/cpp/dockerfiles/Dockerfile.circuits-x86_64-linux-clang-builder-runner b/cpp/dockerfiles/Dockerfile.circuits-x86_64-linux-clang-builder-runner new file mode 100644 index 0000000000..7ac0ea01a0 --- /dev/null +++ b/cpp/dockerfiles/Dockerfile.circuits-x86_64-linux-clang-builder-runner @@ -0,0 +1,18 @@ +FROM alpine:3.17 +RUN apk update \ + && apk upgrade \ + && apk add --no-cache \ + bash \ + build-base \ + clang15 \ + openmp \ + openmp-dev \ + cmake \ + ninja \ + git \ + curl \ + perl + +WORKDIR /usr/src/barretenberg/cpp + +COPY . . \ No newline at end of file diff --git a/cpp/scripts/run_aztec_circuits_tests b/cpp/scripts/run_aztec_circuits_tests new file mode 100755 index 0000000000..0c3358300c --- /dev/null +++ b/cpp/scripts/run_aztec_circuits_tests @@ -0,0 +1,52 @@ +#!/bin/bash +set -e + +# To be called from CI for testing with docker and AWS. +# Can't be called locally unless AWS credentials are set up. +# +# Call from config.yml +# Example: +# command: cond_spot_run_script circuits-wasm-linux-clang-assert 1 wasm scripts/a3-tests -*.skip*:*.circuit* + +AZTEC_COMMIT=$1 # Aztec commit/branch to checkout (MANDATORY) +NUM_TRANSCRIPTS=$2 # integer (MANDATORY) +ARCH=$3 # x86_64 or wasm (MUST BE LOWERCASE) (MANDATORY) used in aztec's circuits `run_tests_local` +# TESTS=$4 (MANDATORY) used in aztec's circuits `run_tests_local` (test files rel to circuits/cpp) +# GTEST_FILTER=$5 (optional) used in aztec's circuits `run_tests_local` +# *** See `run_tests_local` for the args forwarded to that script +shift # arg1 (aztec commit) and arg2 (num transcripts) are not forwarded +shift # to aztec's circuits `run_tests_local` + +$(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null + +IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/barretenberg-circuits-${ARCH}-linux-clang-builder-runner:cache-$COMMIT_HASH +docker pull $IMAGE_URI + +if [ "$ARCH" != "wasm" ]; then + # x86_64 / anything other than wasm + PRESET=default + CONFIGURE_OPTS="-DCMAKE_BUILD_TYPE=RelWithAssert -DCI=ON" + BUILD_DIR=build +else + PRESET=wasm + BUILD_DIR=build-wasm +fi + +echo "*** Running Aztec circuits tests on commit: $AZTEC_COMMIT" +# run tests in docker +RUN_ARGS="$@" # helper var necessary for some reason to pass all args to docker run +docker run --rm -t $IMAGE_URI /bin/sh -c "\ + set -e; \ + cd /usr/src/; \ + git clone https://github.com/AztecProtocol/aztec3-packages.git; \ + cd /usr/src/aztec3-packages/circuits/cpp; \ + git checkout $AZTEC_COMMIT; \ + rm -rf /usr/src/aztec3-packages/circuits/cpp/barretenberg; + mv /usr/src/barretenberg .; \ + cmake --preset $PRESET $CONFIGURE_OPTS; \ + cmake --build --preset $PRESET; \ + cd /usr/src/aztec3-packages/circuits/cpp/barretenberg/cpp/srs_db; \ + ./download_ignition.sh $NUM_TRANSCRIPTS; \ + cd /usr/src/aztec3-packages/circuits/cpp; \ + export PATH=\$PATH:~/.wasmtime/bin/; \ + ./scripts/run_tests_local $RUN_ARGS;" From cf2f7ad60f025cba2a7d277681defbfc72472065 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 3 May 2023 19:41:27 +0000 Subject: [PATCH 09/18] build manifest --- build_manifest.json | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/build_manifest.json b/build_manifest.json index a44071b71e..364f8fd272 100644 --- a/build_manifest.json +++ b/build_manifest.json @@ -23,10 +23,16 @@ "rebuildPatterns": ["^cpp/"], "dependencies": [] }, - "barretenberg.js": { - "buildDir": "js", - "dockerfile": "js/Dockerfile", - "rebuildPatterns": ["^js/"], - "dependencies": ["barretenberg-wasm-linux-clang"] + "barretenberg-circuits-x86_64-linux-clang-builder-runner": { + "buildDir": "cpp", + "dockerfile": "dockerfiles/Dockerfile.circuits-x86_64-linux-clang-builder-runner", + "rebuildPatterns": ["^cpp/"], + "dependencies": [] + }, + "barretenberg-circuits-wasm-linux-clang-builder-runner": { + "buildDir": "cpp", + "dockerfile": "dockerfiles/Dockerfile.circuits-wasm-linux-clang-builder-runner", + "rebuildPatterns": ["^cpp/"], + "dependencies": [] } } From 7864270c2e0c7caa447f3fd042f7e2e381a7b75c Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 3 May 2023 15:43:08 -0400 Subject: [PATCH 10/18] chore: align BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK usage (#411) --- cpp/src/barretenberg/crypto/generators/generator_data.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/barretenberg/crypto/generators/generator_data.cpp b/cpp/src/barretenberg/crypto/generators/generator_data.cpp index a0c4e522fa..20345bae16 100644 --- a/cpp/src/barretenberg/crypto/generators/generator_data.cpp +++ b/cpp/src/barretenberg/crypto/generators/generator_data.cpp @@ -6,7 +6,7 @@ namespace { // Parameters for generator table construction struct GeneratorParameters { - size_t num_default_generators; // Number of unique base points with default main index + size_t num_default_generators; // Number of unique base points with default main index with precomputed ladders size_t num_hash_indices; // Number of unique hash indices size_t num_generators_per_hash_index; // Number of generators per hash index size_t hash_indices_generator_offset; // Offset for hash index generators @@ -19,10 +19,10 @@ struct GeneratorParameters { constexpr GeneratorParameters GEN_PARAMS = {BARRETENBERG_CRYPTO_GENERATOR_PARAMETERS_HACK}; #else #ifdef __wasm__ -constexpr GeneratorParameters GEN_PARAMS = {64, 16, 32, 64}; +constexpr GeneratorParameters GEN_PARAMS = {32, 16, 8, 2048}; // TODO need to resolve memory out of bounds when these are too high #else -constexpr GeneratorParameters GEN_PARAMS = {2048, 32, 128, 2048}; +constexpr GeneratorParameters GEN_PARAMS = {2048, 16, 8, 2048}; #endif #endif @@ -294,4 +294,4 @@ const fixed_base_ladder* generator_data::get_hash_ladder(size_t num_bits) const } } // namespace generators -} // namespace crypto +} // namespace crypto \ No newline at end of file From 9b274157aa94c56b0eaf59b0319a94085d0736cb Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 3 May 2023 19:57:10 +0000 Subject: [PATCH 11/18] try other branch of aztec packages --- cpp/.aztec-packages-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/.aztec-packages-commit b/cpp/.aztec-packages-commit index 1f7391f92b..e0985bbe68 100644 --- a/cpp/.aztec-packages-commit +++ b/cpp/.aztec-packages-commit @@ -1 +1 @@ -master +ad/close-bb-master-gap From 8305c1af3eabc1314921c2febadb1b7e9d247a4a Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 3 May 2023 20:01:23 +0000 Subject: [PATCH 12/18] ci rename script --- .../{cond_spot_run_tests_custom => cond_spot_run_test_script} | 0 .circleci/config.yml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename .circleci/{cond_spot_run_tests_custom => cond_spot_run_test_script} (100%) diff --git a/.circleci/cond_spot_run_tests_custom b/.circleci/cond_spot_run_test_script similarity index 100% rename from .circleci/cond_spot_run_tests_custom rename to .circleci/cond_spot_run_test_script diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e8bba35f3..d626441352 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -278,7 +278,7 @@ jobs: - *setup_aztec_commit - run: name: "Build" - command: cond_spot_run_tests_custom barretenberg-circuits-wasm-linux-clang-builder-runner ./scripts/run_aztec_circuits_tests "$AZTEC_COMMIT" 1 wasm scripts/a3-tests -*.skip*:*.circuit* + command: cond_spot_run_test_script barretenberg-circuits-wasm-linux-clang-builder-runner ./scripts/run_aztec_circuits_tests "$AZTEC_COMMIT" 1 wasm scripts/a3-tests -*.skip*:*.circuit* circuits-x86_64-tests: docker: @@ -290,7 +290,7 @@ jobs: - *setup_aztec_commit - run: name: "Build" - command: cond_spot_run_tests_custom barretenberg-circuits-x86_64-linux-clang-builder-runner ./scripts/run_aztec_circuits_tests "$AZTEC_COMMIT" 1 x86_64 scripts/a3-tests -*.skip* + command: cond_spot_run_test_script barretenberg-circuits-x86_64-linux-clang-builder-runner ./scripts/run_aztec_circuits_tests "$AZTEC_COMMIT" 1 x86_64 scripts/a3-tests -*.skip* # End Aztec integration tests ################################### From 14c41f635cf26351f38507843fe365276e1f5edb Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 3 May 2023 16:08:10 -0400 Subject: [PATCH 13/18] Update join_split test --- .../join_split_example/proofs/join_split/join_split.test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp index 10c44f8ec8..25b802cd62 100644 --- a/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp +++ b/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp @@ -806,7 +806,7 @@ TEST_F(join_split_tests, test_0_input_notes_and_detect_circuit_change) constexpr uint32_t CIRCUIT_GATE_COUNT = 185573; constexpr uint32_t GATES_NEXT_POWER_OF_TWO = 524288; - const uint256_t VK_HASH("21389d5392ee23ffc96984689150b63d62113678b1ba127346a0ec72df842354"); + const uint256_t VK_HASH("13eb88883e80efb9bf306af2962cd1a49e9fa1b0bfb2d4b563b95217a17bcc74"); auto number_of_gates_js = result.number_of_gates; auto vk_hash_js = get_verification_key()->sha256_hash(); From 5a9c240f33c0cc6277e4e7901389ee42c9e15901 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 3 May 2023 20:16:59 +0000 Subject: [PATCH 14/18] bump aztec version and merge in aztec3-temporary fixes --- cpp/.aztec-packages-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/.aztec-packages-commit b/cpp/.aztec-packages-commit index e0985bbe68..4f40e1e910 100644 --- a/cpp/.aztec-packages-commit +++ b/cpp/.aztec-packages-commit @@ -1 +1 @@ -ad/close-bb-master-gap +aztec3-temporary From 50974636d4a5e87610e4bd0f5cc82a6e4cda296e Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 3 May 2023 20:20:09 +0000 Subject: [PATCH 15/18] aztec commit switched to branch --- cpp/.aztec-packages-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/.aztec-packages-commit b/cpp/.aztec-packages-commit index 4f40e1e910..e0985bbe68 100644 --- a/cpp/.aztec-packages-commit +++ b/cpp/.aztec-packages-commit @@ -1 +1 @@ -aztec3-temporary +ad/close-bb-master-gap From 9366263a77428deb8571d8a840af9424e0bc8321 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 4 May 2023 14:15:20 +0000 Subject: [PATCH 16/18] bump aztec commit and document --- README.md | 4 ++++ cpp/.aztec-packages-commit | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ef207aa92b..ea8f6efbd6 100644 --- a/README.md +++ b/README.md @@ -199,3 +199,7 @@ Alternatively you can build separate test binaries, e.g. honk_tests or numeric_t ### VS Code configuration A default configuration for VS Code is provided by the file [`barretenberg.code-workspace`](barretenberg.code-workspace). These settings can be overridden by placing configuration files in `.vscode/`. + +### Integration tests with Aztec Circuits + +CI will automatically run integration tests against Aztec's circuits which live [here](https://github.com/AztecProtocol/aztec-packages/tree/master/circuits). To change which Aztec branch or commit for CI to tests against, modify [`.aztec-packages-commit`](./cpp/.aztec-packages-commit). \ No newline at end of file diff --git a/cpp/.aztec-packages-commit b/cpp/.aztec-packages-commit index e0985bbe68..1f7391f92b 100644 --- a/cpp/.aztec-packages-commit +++ b/cpp/.aztec-packages-commit @@ -1 +1 @@ -ad/close-bb-master-gap +master From 576749dcee43d5fee5e08b8984f46ddf17c42f00 Mon Sep 17 00:00:00 2001 From: David Banks <47112877+dbanks12@users.noreply.github.com> Date: Thu, 4 May 2023 10:16:09 -0400 Subject: [PATCH 17/18] typo README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea8f6efbd6..c532c13c87 100644 --- a/README.md +++ b/README.md @@ -202,4 +202,4 @@ A default configuration for VS Code is provided by the file [`barretenberg.code- ### Integration tests with Aztec Circuits -CI will automatically run integration tests against Aztec's circuits which live [here](https://github.com/AztecProtocol/aztec-packages/tree/master/circuits). To change which Aztec branch or commit for CI to tests against, modify [`.aztec-packages-commit`](./cpp/.aztec-packages-commit). \ No newline at end of file +CI will automatically run integration tests against Aztec's circuits which live [here](https://github.com/AztecProtocol/aztec-packages/tree/master/circuits). To change which Aztec branch or commit for CI to test against, modify [`.aztec-packages-commit`](./cpp/.aztec-packages-commit). From bab4c6db82eadd217c782f2731a4d3716cf1594d Mon Sep 17 00:00:00 2001 From: David Banks <47112877+dbanks12@users.noreply.github.com> Date: Thu, 4 May 2023 10:19:09 -0400 Subject: [PATCH 18/18] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c532c13c87..eba775746a 100644 --- a/README.md +++ b/README.md @@ -203,3 +203,5 @@ A default configuration for VS Code is provided by the file [`barretenberg.code- ### Integration tests with Aztec Circuits CI will automatically run integration tests against Aztec's circuits which live [here](https://github.com/AztecProtocol/aztec-packages/tree/master/circuits). To change which Aztec branch or commit for CI to test against, modify [`.aztec-packages-commit`](./cpp/.aztec-packages-commit). + +When working on a PR, you may want to point this file to a adifferent Aztec branch or commit, but then it should probably be pointed back to master before merging.