diff --git a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp index 40b95b7a7d2..d5416f24799 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp @@ -9,7 +9,6 @@ using namespace benchmark; using namespace bb; -using namespace bb; namespace { void goblin_full(State& state) noexcept diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp index e3da4560115..900b6cdbdf0 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ipa_bench/ipa.bench.cpp @@ -3,7 +3,6 @@ using namespace benchmark; using namespace bb; -using namespace bb; using namespace bb::honk::pcs::ipa; namespace { using Curve = curve::Grumpkin; diff --git a/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.cpp b/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.cpp index 629ca4e3c77..f107d4749c6 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.cpp @@ -6,8 +6,6 @@ #include #include -namespace crypto { -namespace aes128 { namespace { @@ -34,7 +32,7 @@ void sub_bytes(uint8_t* input) uint8_t i, j; for (i = 0; i < 4; ++i) { for (j = 0; j < 4; ++j) { - input[j * 4 + i] = sbox[input[j * 4 + i]]; + input[j * 4 + i] = bb::crypto::aes128_sbox[input[j * 4 + i]]; } } } @@ -43,7 +41,7 @@ void inverse_sub_bytes(uint8_t* input) { for (size_t i = 0; i < 4; ++i) { for (size_t j = 0; j < 4; ++j) { - input[j * 4 + i] = sbox_inverse[input[j * 4 + i]]; + input[j * 4 + i] = bb::crypto::aes128_sbox_inverse[input[j * 4 + i]]; } } } @@ -151,7 +149,9 @@ void inverse_mix_columns(uint8_t* input) } } // namespace -void expand_key(const uint8_t* key, uint8_t* round_key) +namespace bb::crypto { + +void aes128_expand_key(const uint8_t* key, uint8_t* round_key) { uint8_t temp[4]{}; @@ -176,10 +176,10 @@ void expand_key(const uint8_t* key, uint8_t* round_key) temp[2] = temp[3]; temp[3] = t; - temp[0] = sbox[temp[0]]; - temp[1] = sbox[temp[1]]; - temp[2] = sbox[temp[2]]; - temp[3] = sbox[temp[3]]; + temp[0] = aes128_sbox[temp[0]]; + temp[1] = aes128_sbox[temp[1]]; + temp[2] = aes128_sbox[temp[2]]; + temp[3] = aes128_sbox[temp[3]]; temp[0] = temp[0] ^ round_constants[i >> 2]; } @@ -224,10 +224,10 @@ void aes128_cipher(uint8_t* state, const uint8_t* round_key) add_round_key(state, round_key, 10); } -void encrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const size_t length) +void aes128_encrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const size_t length) { uint8_t round_key[176]; - expand_key(key, round_key); + aes128_expand_key(key, round_key); uint8_t block_state[16]{}; @@ -244,10 +244,10 @@ void encrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const } } -void decrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const size_t length) +void aes128_decrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const size_t length) { uint8_t round_key[176]; - expand_key(key, round_key); + aes128_expand_key(key, round_key); uint8_t block_state[16]{}; const size_t num_blocks = (length / 16); @@ -262,5 +262,4 @@ void decrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const } } -} // namespace aes128 -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.hpp b/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.hpp index dcc366f0d63..449b698413f 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.hpp @@ -14,19 +14,18 @@ #include #include -namespace crypto { -namespace aes128 { +namespace bb::crypto { -void expand_key(const uint8_t* key, uint8_t* round_key); +void aes128_expand_key(const uint8_t* key, uint8_t* round_key); void aes128_inverse_cipher(uint8_t* state, const uint8_t* round_key); void aes128_cipher(uint8_t* state, const uint8_t* round_key); // n.b. these methods will update the initialization vector -void encrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const size_t length); -void decrypt_buffer_cbc(uint8_t* buf, uint8_t* iv, const uint8_t* key, const size_t length); +void aes128_encrypt_buffer_cbc(uint8_t* buffer, uint8_t* iv, const uint8_t* key, const size_t length); +void aes128_decrypt_buffer_cbc(uint8_t* buf, uint8_t* iv, const uint8_t* key, const size_t length); -constexpr uint64_t sparse_base = 9; -static constexpr uint8_t sbox[256] = { +constexpr uint64_t aes128_sparse_base = 9; +static constexpr uint8_t aes128_sbox[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, @@ -44,7 +43,7 @@ static constexpr uint8_t sbox[256] = { 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16, }; -static constexpr uint8_t sbox_inverse[256] = { +static constexpr uint8_t aes128_sbox_inverse[256] = { 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, @@ -60,5 +59,4 @@ static constexpr uint8_t sbox_inverse[256] = { 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d }; -} // namespace aes128 -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.test.cpp index 9918545c8a2..e1880264942 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/aes128/aes128.test.cpp @@ -12,8 +12,8 @@ TEST(aes128, verify_cipher) uint8_t state[16]{ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a }; uint8_t round_key[176]; - crypto::aes128::expand_key(key, round_key); - crypto::aes128::aes128_cipher(state, round_key); + bb::crypto::aes128_expand_key(key, round_key); + bb::crypto::aes128_cipher(state, round_key); for (size_t i = 0; i < 16; ++i) { EXPECT_EQ(state[i], expected[i]); @@ -33,7 +33,7 @@ TEST(aes128, encrypt_buffer_cbc) 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }; - crypto::aes128::encrypt_buffer_cbc(in, iv, key, 64); + bb::crypto::aes128_encrypt_buffer_cbc(in, iv, key, 64); for (size_t i = 0; i < 64; ++i) { EXPECT_EQ(in[i], out[i]); @@ -53,7 +53,7 @@ TEST(aes128, decrypt_buffer_cbc) 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }; - crypto::aes128::decrypt_buffer_cbc(in, iv, key, 64); + bb::crypto::aes128_decrypt_buffer_cbc(in, iv, key, 64); for (size_t i = 0; i < 64; ++i) { EXPECT_EQ(in[i], out[i]); diff --git a/barretenberg/cpp/src/barretenberg/crypto/aes128/c_bind.cpp b/barretenberg/cpp/src/barretenberg/crypto/aes128/c_bind.cpp index 1b30cdedbb6..e71762fd06d 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/aes128/c_bind.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/aes128/c_bind.cpp @@ -6,7 +6,7 @@ WASM_EXPORT void aes_encrypt_buffer_cbc( uint8_t const* in, uint8_t const* iv, uint8_t const* key, uint32_t const* length, uint8_t** r) { auto len = ntohl(*length); - crypto::aes128::encrypt_buffer_cbc((uint8_t*)in, (uint8_t*)iv, key, len); + bb::crypto::aes128_encrypt_buffer_cbc((uint8_t*)in, (uint8_t*)iv, key, len); std::vector result(in, in + len); *r = to_heap_buffer(result); } @@ -15,7 +15,7 @@ WASM_EXPORT void aes_decrypt_buffer_cbc( uint8_t const* in, uint8_t const* iv, uint8_t const* key, uint32_t const* length, uint8_t** r) { auto len = ntohl(*length); - crypto::aes128::decrypt_buffer_cbc((uint8_t*)in, (uint8_t*)iv, key, len); + bb::crypto::aes128_decrypt_buffer_cbc((uint8_t*)in, (uint8_t*)iv, key, len); std::vector result(in, in + len); *r = to_heap_buffer(result); } diff --git a/barretenberg/cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp b/barretenberg/cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp index f2dfcceb56c..0f39a4f08eb 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/ecdsa/c_bind.cpp @@ -18,9 +18,9 @@ WASM_EXPORT void ecdsa__construct_signature(uint8_t const* message, 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 }; + bb::crypto::ecdsa::key_pair key_pair = { priv_key, pub_key }; - auto sig = crypto::ecdsa::construct_signature( + auto sig = bb::crypto::ecdsa::construct_signature( std::string((char*)message, msg_len), key_pair); write(output_sig_r, sig.r); write(output_sig_s, sig.s); @@ -39,9 +39,9 @@ WASM_EXPORT void ecdsa__recover_public_key_from_signature(uint8_t const* message std::copy(sig_s, sig_s + 32, s.begin()); const uint8_t v = *sig_v; - crypto::ecdsa::signature sig = { r, s, v }; + bb::crypto::ecdsa::signature sig = { r, s, v }; auto recovered_pub_key = - crypto::ecdsa::recover_public_key( + bb::crypto::ecdsa::recover_public_key( std::string((char*)message, msg_len), sig); serialize::write(output_pub_key, recovered_pub_key); } @@ -59,7 +59,7 @@ WASM_EXPORT bool ecdsa__verify_signature(uint8_t const* message, 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( + bb::crypto::ecdsa::signature sig = { r, s, v }; + return bb::crypto::ecdsa::verify_signature( std::string((char*)message, msg_len), pubk, sig); } diff --git a/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp b/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp index 16106a5868a..ad1bd516adb 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa.hpp @@ -8,8 +8,7 @@ #include #include -namespace crypto { -namespace ecdsa { +namespace bb::crypto::ecdsa { template struct key_pair { Fr private_key; typename G1::affine_element public_key; @@ -47,7 +46,6 @@ inline std::ostream& operator<<(std::ostream& os, signature const& sig) return os; } -} // namespace ecdsa -} // namespace crypto +} // namespace bb::crypto::ecdsa #include "./ecdsa_impl.hpp" diff --git a/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp b/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp index 085ca712835..1a60dc98c2b 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp @@ -4,8 +4,7 @@ #include "barretenberg/common/serialize.hpp" #include "barretenberg/numeric/uint256/uint256.hpp" -namespace crypto { -namespace ecdsa { +namespace bb::crypto::ecdsa { template signature construct_signature(const std::string& message, const key_pair& account) @@ -169,5 +168,4 @@ bool verify_signature(const std::string& message, const typename G1::affine_elem Fr result(Rx); return result == r; } -} // namespace ecdsa -} // namespace crypto +} // namespace bb::crypto::ecdsa diff --git a/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp b/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp index acbe76ef3cd..0e695abb02d 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp @@ -7,7 +7,7 @@ #include #include -namespace crypto { +namespace bb::crypto { /** * @brief class that stores precomputed generators used for Pedersen commitments and Pedersen hashes * @@ -143,4 +143,4 @@ template struct GeneratorContext { , domain_separator(_domain_separator) {} }; -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.hpp b/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.hpp index f2f0edfafdf..655e8251374 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.hpp @@ -8,7 +8,7 @@ #include #include -namespace crypto { +namespace bb::crypto { /** * @brief Compute an HMAC given a secret key and a message * @@ -126,4 +126,4 @@ Fr get_unbiased_field_from_hmac(const MessageContainer& message, const KeyContai Fr result((field_as_u512 % Fr::modulus).lo); return result; } -} // namespace crypto +} // namespace bb::crypto diff --git a/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.test.cpp index 5e66bc8389e..50695466e62 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/hmac/hmac.test.cpp @@ -106,7 +106,7 @@ TEST(hmac, ValidateHMAC) }; for (const auto& [key_string, message, expected] : test_vectors) { - std::array result = crypto::hmac(message, key_string); + std::array result = bb::crypto::hmac(message, key_string); EXPECT_EQ(result, hex_to_bytes(expected)); } diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.cpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.cpp index 691a64b998b..3880bd7ffbe 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.cpp @@ -6,7 +6,7 @@ #include #endif -namespace crypto { +namespace bb::crypto { /** * @brief Given a vector of fields, generate a pedersen commitment using the indexed generators. @@ -30,4 +30,4 @@ typename Curve::AffineElement pedersen_commitment_base::commit_native(con return result.normalize(); } template class pedersen_commitment_base; -} // namespace crypto +} // namespace bb::crypto diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.hpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.hpp index fc750591eff..517ede529d9 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.hpp @@ -6,7 +6,7 @@ #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include -namespace crypto { +namespace bb::crypto { /** * @brief Performs pedersen commitments! @@ -31,4 +31,4 @@ template class pedersen_commitment_base { }; using pedersen_commitment = pedersen_commitment_base; -} // namespace crypto +} // namespace bb::crypto diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.test.cpp index f25ac05f0f2..6d0d4db89ab 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/crypto/generators/generator_data.hpp" #include -namespace crypto { +namespace bb::crypto { using bb::fr; @@ -51,4 +51,4 @@ TEST(Pedersen, GeneratorPrinter) } } -}; // namespace crypto \ No newline at end of file +}; // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.cpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.cpp index 9e702eccb2f..38c6f2421b1 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.cpp @@ -1,7 +1,7 @@ #include "./pedersen.hpp" #include "../pedersen_commitment/pedersen.hpp" -namespace crypto { +namespace bb::crypto { /** * @brief Converts input uint8_t buffers into vector of field elements. Used to hash the Transcript in a @@ -80,4 +80,4 @@ typename Curve::BaseField pedersen_hash_base::hash_buffer(const std::vect } template class pedersen_hash_base; -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.hpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.hpp index 8bd5bf82b05..9e9cd638a7c 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.hpp @@ -2,7 +2,7 @@ #include "../generators/generator_data.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace crypto { +namespace bb::crypto { /** * @brief Performs pedersen hashes! * @@ -37,4 +37,4 @@ template class pedersen_hash_base { }; using pedersen_hash = pedersen_hash_base; -} // namespace crypto +} // namespace bb::crypto diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.test.cpp index 47c96cba9c7..0e4ade6fca1 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.test.cpp @@ -3,7 +3,7 @@ #include "barretenberg/numeric/uint256/uint256.hpp" #include -namespace crypto { +namespace bb::crypto { using bb::fr; @@ -21,4 +21,4 @@ TEST(Pedersen, HashWithIndex) EXPECT_EQ(r, fr(uint256_t("1c446df60816b897cda124524e6b03f36df0cec333fad87617aab70d7861daa6"))); } -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.bench.cpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.bench.cpp index 6b1b1457997..6673734acdc 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.bench.cpp @@ -11,7 +11,7 @@ grumpkin::fq poseidon_function(const size_t count) inputs[i] = grumpkin::fq::random_element(); } // hash count many field elements - inputs[0] = crypto::Poseidon2::hash(inputs); + inputs[0] = bb::crypto::Poseidon2::hash(inputs); return inputs[0]; } @@ -24,5 +24,4 @@ void native_poseidon2_commitment_bench(State& state) noexcept } BENCHMARK(native_poseidon2_commitment_bench)->Arg(10)->Arg(1000)->Arg(10000); -BENCHMARK_MAIN(); -// } // namespace crypto \ No newline at end of file +BENCHMARK_MAIN(); \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.cpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.cpp index ad96dc31271..1fce753975b 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.cpp @@ -1,6 +1,6 @@ #include "poseidon2.hpp" -namespace crypto { +namespace bb::crypto { /** * @brief Hashes a vector of field elements */ @@ -45,4 +45,4 @@ typename Poseidon2::FF Poseidon2::hash_buffer(const std::vector< } template class Poseidon2; -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.hpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.hpp index 6969c680e17..446361696c2 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.hpp @@ -4,7 +4,7 @@ #include "poseidon2_permutation.hpp" #include "sponge/sponge.hpp" -namespace crypto { +namespace bb::crypto { template class Poseidon2 { public: @@ -25,4 +25,4 @@ template class Poseidon2 { }; extern template class Poseidon2; -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_cpp_params.sage b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_cpp_params.sage index 4250e98e8a9..685acd21e35 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_cpp_params.sage +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_cpp_params.sage @@ -661,7 +661,7 @@ print("#pragma once\n") print("#include \"barretenberg/ecc/curves/bn254/fr.hpp\"\n") -print("namespace crypto {\n") +print("namespace bb::crypto {\n") print("struct Poseidon2Bn254ScalarFieldParams{\n") print(" using FF = bb::fr;") @@ -723,4 +723,4 @@ for (i,val) in enumerate(state_out): print("};") print("};") -print("} // namespace crypto") \ No newline at end of file +print("} // namespace bb::crypto") \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_params.hpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_params.hpp index 7a4a3ab0619..9aeaadc7bf3 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_params.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_params.hpp @@ -5,7 +5,7 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" -namespace crypto { +namespace bb::crypto { struct Poseidon2Bn254ScalarFieldParams { @@ -449,4 +449,4 @@ struct Poseidon2Bn254ScalarFieldParams { FF(std::string("0x2e11c5cff2a22c64d01304b778d78f6998eff1ab73163a35603f54794c30847a")), }; }; -} // namespace crypto +} // namespace bb::crypto diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_permutation.hpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_permutation.hpp index 4f0794b893c..15a3a8bd555 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_permutation.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2_permutation.hpp @@ -8,7 +8,7 @@ #include #include -namespace crypto { +namespace bb::crypto { /** * @brief Applies the Poseidon2 permutation function from https://eprint.iacr.org/2023/323 . @@ -162,4 +162,4 @@ template class Poseidon2Permutation { return current_state; } }; -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/sponge/sponge.hpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/sponge/sponge.hpp index bc4a2c5c1dc..2a99b88609f 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/sponge/sponge.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/sponge/sponge.hpp @@ -7,7 +7,7 @@ #include "barretenberg/numeric/uint256/uint256.hpp" -namespace crypto { +namespace bb::crypto { /** * @brief Implements a cryptographic sponge over prime fields. @@ -165,4 +165,4 @@ template input) { return hash_variable_length<1>(input)[0]; } }; -} // namespace crypto \ No newline at end of file +} // namespace bb::crypto \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/schnorr/multisig.hpp b/barretenberg/cpp/src/barretenberg/crypto/schnorr/multisig.hpp index 7cafe9de2b3..525ec577a6e 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/schnorr/multisig.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/schnorr/multisig.hpp @@ -12,7 +12,7 @@ #include "proof_of_possession.hpp" #include "schnorr.hpp" -namespace crypto::schnorr { +namespace bb::crypto::schnorr { /** * @brief Implements the SpeedyMuSig protocol; a secure 2-round interactive multisignature scheme @@ -444,4 +444,4 @@ template cl return sig; } }; -} // namespace crypto::schnorr +} // namespace bb::crypto::schnorr diff --git a/barretenberg/cpp/src/barretenberg/crypto/schnorr/proof_of_possession.hpp b/barretenberg/cpp/src/barretenberg/crypto/schnorr/proof_of_possession.hpp index eea7cc202dc..b54d6ff3c8d 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/schnorr/proof_of_possession.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/schnorr/proof_of_possession.hpp @@ -5,7 +5,7 @@ #include "barretenberg/common/serialize.hpp" #include "schnorr.hpp" -namespace crypto::schnorr { +namespace bb::crypto::schnorr { /** * @brief A proof of possession is a Schnorr proof of knowledge of a secret key corresponding to a given public key. @@ -134,4 +134,4 @@ inline void write(B& buf, ProofOfPossession const& proof_of_possession write(buf, proof_of_possession.response); } -} // namespace crypto::schnorr +} // namespace bb::crypto::schnorr diff --git a/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp b/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp index 516e50038c1..d9e60eba499 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.hpp @@ -12,8 +12,7 @@ #include "barretenberg/common/streams.hpp" #include "barretenberg/serialize/msgpack.hpp" -namespace crypto { -namespace schnorr { +namespace bb::crypto::schnorr { template struct key_pair { Fr private_key; typename G1::affine_element public_key; @@ -63,6 +62,5 @@ template inline void write(B& buf, key_pair(message, public_key, R); return std::equal(sig.e.begin(), sig.e.end(), target_e.begin(), target_e.end()); } -} // namespace schnorr -} // namespace crypto +} // namespace bb::crypto::schnorr diff --git a/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.test.cpp index 8890d4a5454..63bde7814aa 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/schnorr/schnorr.test.cpp @@ -3,7 +3,7 @@ #include using namespace bb; -using namespace crypto::schnorr; +using namespace bb::crypto::schnorr; crypto::schnorr::key_pair generate_signature() { diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp index eb2bdfbbffa..4dd06af4c38 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element.test.cpp @@ -7,7 +7,6 @@ #include "barretenberg/serialize/test_helper.hpp" #include -namespace TestAffineElement { template class TestAffineElement : public testing::Test { using element = typename G1::element; using affine_element = typename G1::affine_element; @@ -130,4 +129,3 @@ TEST(AffineElement, Msgpack) auto [actual, expected] = msgpack_roundtrip(secp256k1::g1::affine_element{ 1, 1 }); EXPECT_EQ(actual, expected); } -} // namespace TestAffineElement diff --git a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp b/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp index 6af3285b00c..2bf24f727f6 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp @@ -26,8 +26,7 @@ // NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members) -namespace bb::honk { -namespace flavor { +namespace bb::honk::flavor { template class ECCVMBase { public: @@ -929,5 +928,4 @@ class ECCVM : public ECCVMBase #include -namespace join_split_example { +namespace bb::join_split_example { constexpr size_t DATA_TREE_DEPTH = 32; @@ -19,8 +19,8 @@ constexpr size_t MAX_NUM_ASSETS_BIT_LENGTH = 30; constexpr size_t MAX_NUM_ASSETS = 1 << MAX_NUM_ASSETS_BIT_LENGTH; constexpr size_t ALIAS_HASH_BIT_LENGTH = 224; -namespace ProofIds { +namespace proof_ids { enum { PADDING = 0, DEPOSIT = 1, WITHDRAW = 2, SEND = 3, ACCOUNT = 4, DEFI_DEPOSIT = 5, DEFI_CLAIM = 6 }; }; -} // namespace join_split_example +} // namespace bb::join_split_example diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/fixtures/user_context.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/fixtures/user_context.hpp index 5a9db57c059..63e880b6e6d 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/fixtures/user_context.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/fixtures/user_context.hpp @@ -3,10 +3,9 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example { -namespace fixtures { +namespace bb::join_split_example::fixtures { -typedef crypto::schnorr::key_pair grumpkin_key_pair; +using grumpkin_key_pair = bb::crypto::schnorr::key_pair; struct user_context { bb::fr note_secret; @@ -38,5 +37,4 @@ inline user_context create_user_context(numeric::random::Engine* engine = nullpt return { note_secret, create_key_pair(engine), { create_key_pair(engine), create_key_pair(engine) }, alias_hash }; } -} // namespace fixtures -} // namespace join_split_example +} // namespace bb::join_split_example::fixtures diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp index 2a1f4b42343..d3c9d30ab3e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/compute_circuit_data.hpp @@ -13,8 +13,7 @@ #include #endif -namespace join_split_example { -namespace proofs { +namespace bb::join_split_example::proofs { struct circuit_data { circuit_data() @@ -83,7 +82,7 @@ circuit_data get_circuit_data(std::string const& name, info(name, ": Circuit size: ", builder.get_num_gates()); if (mock) { auto public_inputs = builder.get_public_inputs(); - ::join_split_example::proofs::mock::mock_circuit(mock_builder, public_inputs); + ::bb::join_split_example::proofs::mock::mock_circuit(mock_builder, public_inputs); info(name, ": Mock circuit size: ", mock_builder.get_num_gates()); benchmark_collator.benchmark_info_deferred(Composer::NAME_STRING, "Core", @@ -259,5 +258,4 @@ circuit_data get_circuit_data(std::string const& name, return data; } -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.cpp index f9f339d723e..5224f662eac 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.cpp @@ -1,29 +1,27 @@ #include "inner_proof_data.hpp" -namespace join_split_example { -namespace proofs { +namespace bb::join_split_example::proofs { using namespace bb; inner_proof_data::inner_proof_data(std::vector const& proof_data) { - proof_id = from_buffer(proof_data, InnerProofOffsets::PROOF_ID); - note_commitment1 = from_buffer(proof_data, InnerProofOffsets::NOTE_COMMITMENT1); - note_commitment2 = from_buffer(proof_data, InnerProofOffsets::NOTE_COMMITMENT2); - nullifier1 = from_buffer(proof_data, InnerProofOffsets::NULLIFIER1); - nullifier2 = from_buffer(proof_data, InnerProofOffsets::NULLIFIER2); - public_value = from_buffer(proof_data, InnerProofOffsets::PUBLIC_VALUE); - public_owner = from_buffer(proof_data, InnerProofOffsets::PUBLIC_OWNER); - asset_id = from_buffer(proof_data, InnerProofOffsets::PUBLIC_ASSET_ID); - merkle_root = from_buffer(proof_data, InnerProofOffsets::MERKLE_ROOT); - tx_fee = from_buffer(proof_data, InnerProofOffsets::TX_FEE); - tx_fee_asset_id = from_buffer(proof_data, InnerProofOffsets::TX_FEE_ASSET_ID); - bridge_call_data = from_buffer(proof_data, InnerProofOffsets::BRIDGE_CALL_DATA); - defi_deposit_value = from_buffer(proof_data, InnerProofOffsets::DEFI_DEPOSIT_VALUE); - defi_root = from_buffer(proof_data, InnerProofOffsets::DEFI_ROOT); - backward_link = from_buffer(proof_data, InnerProofOffsets::BACKWARD_LINK); - allow_chain = from_buffer(proof_data, InnerProofOffsets::ALLOW_CHAIN); + proof_id = from_buffer(proof_data, inner_proof_offsets::PROOF_ID); + note_commitment1 = from_buffer(proof_data, inner_proof_offsets::NOTE_COMMITMENT1); + note_commitment2 = from_buffer(proof_data, inner_proof_offsets::NOTE_COMMITMENT2); + nullifier1 = from_buffer(proof_data, inner_proof_offsets::NULLIFIER1); + nullifier2 = from_buffer(proof_data, inner_proof_offsets::NULLIFIER2); + public_value = from_buffer(proof_data, inner_proof_offsets::PUBLIC_VALUE); + public_owner = from_buffer(proof_data, inner_proof_offsets::PUBLIC_OWNER); + asset_id = from_buffer(proof_data, inner_proof_offsets::PUBLIC_ASSET_ID); + merkle_root = from_buffer(proof_data, inner_proof_offsets::MERKLE_ROOT); + tx_fee = from_buffer(proof_data, inner_proof_offsets::TX_FEE); + tx_fee_asset_id = from_buffer(proof_data, inner_proof_offsets::TX_FEE_ASSET_ID); + bridge_call_data = from_buffer(proof_data, inner_proof_offsets::BRIDGE_CALL_DATA); + defi_deposit_value = from_buffer(proof_data, inner_proof_offsets::DEFI_DEPOSIT_VALUE); + defi_root = from_buffer(proof_data, inner_proof_offsets::DEFI_ROOT); + backward_link = from_buffer(proof_data, inner_proof_offsets::BACKWARD_LINK); + allow_chain = from_buffer(proof_data, inner_proof_offsets::ALLOW_CHAIN); } -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.hpp index 7bc81c657b1..4778ed1eed4 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.hpp @@ -5,10 +5,9 @@ #include "barretenberg/numeric/uint256/uint256.hpp" #include -namespace join_split_example { -namespace proofs { +namespace bb::join_split_example::proofs { -namespace InnerProofFields { +namespace inner_proof_fields { enum { PROOF_ID, NOTE_COMMITMENT1, @@ -28,26 +27,26 @@ enum { ALLOW_CHAIN, NUM_FIELDS }; -} // namespace InnerProofFields +} // namespace inner_proof_fields -namespace InnerProofOffsets { +namespace inner_proof_offsets { enum { - PROOF_ID = InnerProofFields::PROOF_ID * 32, - NOTE_COMMITMENT1 = InnerProofFields::NOTE_COMMITMENT1 * 32, - NOTE_COMMITMENT2 = InnerProofFields::NOTE_COMMITMENT2 * 32, - NULLIFIER1 = InnerProofFields::NULLIFIER1 * 32, - NULLIFIER2 = InnerProofFields::NULLIFIER2 * 32, - PUBLIC_VALUE = InnerProofFields::PUBLIC_VALUE * 32, - PUBLIC_OWNER = InnerProofFields::PUBLIC_OWNER * 32, - PUBLIC_ASSET_ID = InnerProofFields::PUBLIC_ASSET_ID * 32, - MERKLE_ROOT = InnerProofFields::MERKLE_ROOT * 32, - TX_FEE = InnerProofFields::TX_FEE * 32, - TX_FEE_ASSET_ID = InnerProofFields::TX_FEE_ASSET_ID * 32, - BRIDGE_CALL_DATA = InnerProofFields::BRIDGE_CALL_DATA * 32, - DEFI_DEPOSIT_VALUE = InnerProofFields::DEFI_DEPOSIT_VALUE * 32, - DEFI_ROOT = InnerProofFields::DEFI_ROOT * 32, - BACKWARD_LINK = InnerProofFields::BACKWARD_LINK * 32, - ALLOW_CHAIN = InnerProofFields::ALLOW_CHAIN * 32, + PROOF_ID = inner_proof_fields::PROOF_ID * 32, + NOTE_COMMITMENT1 = inner_proof_fields::NOTE_COMMITMENT1 * 32, + NOTE_COMMITMENT2 = inner_proof_fields::NOTE_COMMITMENT2 * 32, + NULLIFIER1 = inner_proof_fields::NULLIFIER1 * 32, + NULLIFIER2 = inner_proof_fields::NULLIFIER2 * 32, + PUBLIC_VALUE = inner_proof_fields::PUBLIC_VALUE * 32, + PUBLIC_OWNER = inner_proof_fields::PUBLIC_OWNER * 32, + PUBLIC_ASSET_ID = inner_proof_fields::PUBLIC_ASSET_ID * 32, + MERKLE_ROOT = inner_proof_fields::MERKLE_ROOT * 32, + TX_FEE = inner_proof_fields::TX_FEE * 32, + TX_FEE_ASSET_ID = inner_proof_fields::TX_FEE_ASSET_ID * 32, + BRIDGE_CALL_DATA = inner_proof_fields::BRIDGE_CALL_DATA * 32, + DEFI_DEPOSIT_VALUE = inner_proof_fields::DEFI_DEPOSIT_VALUE * 32, + DEFI_ROOT = inner_proof_fields::DEFI_ROOT * 32, + BACKWARD_LINK = inner_proof_fields::BACKWARD_LINK * 32, + ALLOW_CHAIN = inner_proof_fields::ALLOW_CHAIN * 32, }; } @@ -98,5 +97,4 @@ inline std::ostream& operator<<(std::ostream& os, inner_proof_data const& data) // clang-format on } -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.test.cpp index f01df175b29..daa08dd823f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/inner_proof_data/inner_proof_data.test.cpp @@ -2,7 +2,7 @@ #include using namespace bb; -using namespace join_split_example::proofs; +using namespace bb::join_split_example::proofs; namespace { auto& rand_engine = numeric::random::get_debug_engine(); diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp index c0bc5e6a6c3..da7f5037d00 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_circuit_data.cpp @@ -5,13 +5,11 @@ #include "join_split_circuit.hpp" #include "sign_join_split_tx.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { -using namespace join_split_example::proofs::join_split; +using namespace bb::join_split_example::proofs::join_split; using namespace bb::stdlib; -using namespace join_split_example::proofs::notes::native; +using namespace bb::join_split_example::proofs::notes::native; using namespace bb::stdlib::merkle_tree; join_split_tx noop_tx() @@ -29,7 +27,7 @@ join_split_tx noop_tx() auto gibberish_path = fr_hash_path(DATA_TREE_DEPTH, std::make_pair(fr::random_element(), fr::random_element())); join_split_tx tx; - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 1; tx.public_owner = fr::one(); tx.asset_id = 0; @@ -72,6 +70,4 @@ circuit_data get_circuit_data(std::shared_ptr> const& srs, bool mock = false); -} // namespace join_split -} // namespace proofs -} // namespace join_split_example \ No newline at end of file +} // namespace bb::join_split_example::proofs::join_split \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.cpp index 4efcd5323dc..4e8d063ba52 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.cpp @@ -2,18 +2,16 @@ #include "../notes/native/index.hpp" #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { using namespace notes::native; bb::fr compute_signing_data(join_split_tx const& tx) { auto proof_id = tx.proof_id; - auto is_deposit = proof_id == ProofIds::DEPOSIT; - auto is_withdraw = proof_id == ProofIds::WITHDRAW; - auto is_defi = proof_id == ProofIds::DEFI_DEPOSIT; + auto is_deposit = proof_id == proof_ids::DEPOSIT; + auto is_withdraw = proof_id == proof_ids::WITHDRAW; + auto is_defi = proof_id == proof_ids::DEFI_DEPOSIT; auto public_value = tx.public_value; auto public_asset_id = tx.asset_id * (is_deposit || is_withdraw); @@ -36,6 +34,4 @@ bb::fr compute_signing_data(join_split_tx const& tx) return crypto::pedersen_hash::hash(to_hash); } -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.hpp index 6a6836220dd..badab3da9fa 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/compute_signing_data.hpp @@ -1,12 +1,8 @@ #pragma once #include "join_split_tx.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { bb::fr compute_signing_data(join_split_tx const& tx); -} // namespace join_split -} // namespace proofs -} // namespace join_split_example \ No newline at end of file +} \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/create_proof.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/create_proof.hpp index 2c3c3aa3ba1..b0f1ddd6c8f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/create_proof.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/create_proof.hpp @@ -4,9 +4,7 @@ #include "join_split_circuit.hpp" #include "sign_join_split_tx.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { inline std::vector create_proof(join_split_tx const& tx, circuit_data const& cd) { @@ -24,6 +22,4 @@ inline std::vector create_proof(join_split_tx const& tx, circuit_data c return proof.proof_data; } -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp index 60b693723b4..5eae28bf8de 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.cpp @@ -4,9 +4,7 @@ #include "compute_circuit_data.hpp" #include "join_split_circuit.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { using namespace bb::plonk; using namespace bb::stdlib::merkle_tree; @@ -32,7 +30,7 @@ void init_proving_key(bool mock) Builder builder; join_split_circuit(builder, tx); Composer composer; - join_split_example::proofs::mock::mock_circuit(builder, builder.get_public_inputs()); + bb::join_split_example::proofs::mock::mock_circuit(builder, builder.get_public_inputs()); proving_key = composer.compute_proving_key(builder); } } @@ -70,7 +68,7 @@ Prover new_join_split_prover(join_split_tx const& tx, bool mock) return composer.create_prover(builder); } else { Composer mock_proof_composer(proving_key, nullptr); - join_split_example::proofs::mock::mock_circuit(builder, builder.get_public_inputs()); + bb::join_split_example::proofs::mock::mock_circuit(builder, builder.get_public_inputs()); info("mock composer gates: ", builder.get_num_gates()); return mock_proof_composer.create_prover(builder); } @@ -97,6 +95,4 @@ std::shared_ptr get_verification_key() return verification_key; } -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp index a436d99f884..42419078aba 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.hpp @@ -3,9 +3,7 @@ #include "barretenberg/srs/factories/crs_factory.hpp" #include "join_split_tx.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { void init_proving_key(bool mock); @@ -21,6 +19,4 @@ std::shared_ptr get_proving_key(); std::shared_ptr get_verification_key(); -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp index 2ae8253681a..99db6944df5 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split.test.cpp @@ -11,7 +11,7 @@ #include "index.hpp" #include "join_split_circuit.hpp" -namespace join_split_example::proofs::join_split { +namespace bb::join_split_example::proofs::join_split { using namespace bb::stdlib::merkle_tree; @@ -28,8 +28,8 @@ constexpr bool CIRCUIT_CHANGE_EXPECTED = false; using namespace bb; using namespace bb::stdlib; using namespace bb::stdlib::merkle_tree; -using namespace join_split_example::proofs::notes::native; -using key_pair = join_split_example::fixtures::grumpkin_key_pair; +using namespace bb::join_split_example::proofs::notes::native; +using key_pair = bb::join_split_example::fixtures::grumpkin_key_pair; auto create_account_leaf_data(fr const& account_alias_hash, grumpkin::g1::affine_element const& owner_key, @@ -54,7 +54,7 @@ class join_split_tests : public ::testing::Test { { store = std::make_unique(); tree = std::make_unique>(*store, 32); - user = join_split_example::fixtures::create_user_context(); + user = bb::join_split_example::fixtures::create_user_context(); default_value_note = { .value = 100, .asset_id = asset_id, @@ -73,7 +73,7 @@ class join_split_tests : public ::testing::Test { value_notes[0].creator_pubkey = user.owner.public_key.x; value_notes[1].value = 50; - value_notes[1].creator_pubkey = join_split_example::fixtures::create_key_pair(nullptr).public_key.x; + value_notes[1].creator_pubkey = bb::join_split_example::fixtures::create_key_pair(nullptr).public_key.x; value_notes[2].value = 90; value_notes[2].account_required = true, @@ -179,7 +179,7 @@ class join_split_tests : public ::testing::Test { .input_nullifier = input_nullifier2 }; join_split_tx tx; - tx.proof_id = ProofIds::SEND; + tx.proof_id = proof_ids::SEND; tx.public_value = 0; tx.num_input_notes = 2; tx.input_index = input_indices; @@ -195,7 +195,7 @@ class join_split_tests : public ::testing::Test { tx.account_private_key = user.owner.private_key; tx.partial_claim_note.input_nullifier = 0; tx.alias_hash = - !account_required ? join_split_example::fixtures::generate_alias_hash("penguin") : user.alias_hash; + !account_required ? bb::join_split_example::fixtures::generate_alias_hash("penguin") : user.alias_hash; tx.account_required = account_required; // default to no chaining: tx.backward_link = 0; @@ -242,7 +242,7 @@ class join_split_tests : public ::testing::Test { value::value_note output_note2 = { 0, 0, 0, user.owner.public_key, user.note_secret, 0, input_nullifier2 }; join_split_tx tx; - tx.proof_id = ProofIds::SEND; + tx.proof_id = proof_ids::SEND; tx.public_value = 0; tx.public_owner = 0; tx.asset_id = 0; @@ -254,7 +254,7 @@ class join_split_tests : public ::testing::Test { tx.output_note = { output_note1, output_note2 }; tx.partial_claim_note.input_nullifier = 0; tx.account_private_key = user.owner.private_key; - tx.alias_hash = join_split_example::fixtures::generate_alias_hash("penguin"); + tx.alias_hash = bb::join_split_example::fixtures::generate_alias_hash("penguin"); tx.account_required = false; tx.account_note_index = 0; tx.account_note_path = tree->get_hash_path(0); @@ -300,7 +300,7 @@ class join_split_tests : public ::testing::Test { return verify_logic(tx); } - join_split_example::fixtures::user_context user; + bb::join_split_example::fixtures::user_context user; std::unique_ptr store; std::unique_ptr> tree; bridge_call_data empty_bridge_call_data = { .bridge_address_id = 0, @@ -458,7 +458,7 @@ TEST_F(join_split_tests, test_invalid_num_input_notes_fails) TEST_F(join_split_tests, test_deposit_public_value_invalid_fails) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 0; // <-- invalid, should be nonzero tx.public_owner = fr::random_element(); @@ -481,7 +481,7 @@ TEST_F(join_split_tests, test_send_public_value_invalid_fails) TEST_F(join_split_tests, test_withdraw_public_value_invalid_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::WITHDRAW; + tx.proof_id = proof_ids::WITHDRAW; tx.public_value = 0; // <-- invalid - should be nonzero tx.public_owner = fr::random_element(); @@ -493,7 +493,7 @@ TEST_F(join_split_tests, test_withdraw_public_value_invalid_fails) TEST_F(join_split_tests, test_defi_deposit_public_value_invalid_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.output_note[0].value = 0; tx.output_note[1].value = 99; tx.partial_claim_note.deposit_value = 50; @@ -512,7 +512,7 @@ TEST_F(join_split_tests, test_defi_deposit_public_value_invalid_fails) TEST_F(join_split_tests, test_deposit_public_owner_invalid_fails) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 10; tx.public_owner = 0; // <-- invalid - should be nonzero @@ -535,7 +535,7 @@ TEST_F(join_split_tests, test_send_public_owner_invalid_fails) TEST_F(join_split_tests, test_withdraw_public_owner_invalid_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::WITHDRAW; + tx.proof_id = proof_ids::WITHDRAW; tx.public_value = 10; tx.public_owner = 0; // <-- invalid - should be nonzero @@ -547,7 +547,7 @@ TEST_F(join_split_tests, test_withdraw_public_owner_invalid_fails) TEST_F(join_split_tests, test_defi_deposit_public_owner_invalid_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.output_note[0].value = 0; tx.output_note[1].value = 99; tx.partial_claim_note.deposit_value = 50; @@ -566,7 +566,7 @@ TEST_F(join_split_tests, test_defi_deposit_public_owner_invalid_fails) TEST_F(join_split_tests, test_wrong_proof_id) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEFI_CLAIM; + tx.proof_id = proof_ids::DEFI_CLAIM; auto result = sign_and_verify_logic(tx, user.owner); EXPECT_FALSE(result.valid); @@ -593,7 +593,7 @@ TEST_F(join_split_tests, test_send_with_0_input_notes_fails) TEST_F(join_split_tests, test_withdraw_with_0_input_notes_fails) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::WITHDRAW; + tx.proof_id = proof_ids::WITHDRAW; tx.public_value = 10; tx.public_owner = fr::random_element(); @@ -605,7 +605,7 @@ TEST_F(join_split_tests, test_withdraw_with_0_input_notes_fails) TEST_F(join_split_tests, test_defi_deposit_with_0_input_notes_fails) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; auto result = sign_and_verify_logic(tx, user.owner); EXPECT_FALSE(result.valid); @@ -655,7 +655,7 @@ TEST_F(join_split_tests, test_different_output_note_2_asset_id_fails) TEST_F(join_split_tests, test_deposit_but_different_input_note_2_asset_id_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 10; tx.public_owner = fr::random_element(); tx.input_note[1].asset_id = 3; @@ -678,7 +678,7 @@ TEST_F(join_split_tests, test_send_but_different_input_note_2_asset_id_fails) TEST_F(join_split_tests, test_withdraw_but_different_input_note_2_asset_id_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::WITHDRAW; + tx.proof_id = proof_ids::WITHDRAW; tx.public_value = 10; tx.public_owner = fr::random_element(); tx.input_note[1].asset_id = 3; @@ -695,7 +695,7 @@ TEST_F(join_split_tests, test_withdraw_but_different_input_note_2_asset_id_fails TEST_F(join_split_tests, test_0_input_notes_and_detect_circuit_change) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 30; tx.public_owner = fr::random_element(); tx.output_note[0].value = 30; @@ -731,7 +731,7 @@ TEST_F(join_split_tests, test_0_input_notes_create_dupicate_output_notes_fails) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 30; tx.public_owner = fr::random_element(); tx.output_note[0].value = 15; @@ -748,7 +748,7 @@ TEST_F(join_split_tests, test_0_input_notes_create_dupicate_output_notes_fails_2 { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 30; tx.public_owner = fr::random_element(); tx.output_note[0].value = 15; @@ -767,7 +767,7 @@ TEST_F(join_split_tests, test_dummy_input_note_1_non_0_value_fails) { // Note: `tx.num_input_notes = 0` implies both inputs are 'dummy' join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 10; tx.public_owner = fr::random_element(); tx.input_note[0].value = 10; @@ -782,7 +782,7 @@ TEST_F(join_split_tests, test_dummy_input_note_2_non_0_value_fails) { // Note: `tx.num_input_notes = 0` implies both inputs are 'dummy' join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 10; tx.public_owner = fr::random_element(); tx.input_note[1].value = 10; @@ -826,13 +826,13 @@ TEST_F(join_split_tests, test_2_input_notes) join_split_tx tx = simple_setup(); auto result = sign_and_verify_logic(tx, user.owner); EXPECT_TRUE(result.valid); - EXPECT_EQ(result.public_inputs.size(), InnerProofFields::NUM_FIELDS); + EXPECT_EQ(result.public_inputs.size(), inner_proof_fields::NUM_FIELDS); } TEST_F(join_split_tests, test_0_output_notes) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::WITHDRAW; + tx.proof_id = proof_ids::WITHDRAW; tx.output_note[0].value = 0; tx.output_note[1].value = 0; tx.public_value = tx.input_note[0].value + tx.input_note[1].value; @@ -853,7 +853,7 @@ TEST_P(test_valid_allow_chain_permutations, ) tx.allow_chain = GetParam(); auto result = sign_and_verify_logic(tx, user.owner); EXPECT_TRUE(result.valid); - EXPECT_EQ(result.public_inputs[InnerProofFields::ALLOW_CHAIN], GetParam()); + EXPECT_EQ(result.public_inputs[inner_proof_fields::ALLOW_CHAIN], GetParam()); } INSTANTIATE_TEST_SUITE_P(join_split_tests, test_valid_allow_chain_permutations, ::testing::Values(0, 1, 2, 3)); @@ -950,7 +950,7 @@ TEST_F(join_split_tests, test_propagated_input_note1_no_double_spend) TEST_F(join_split_tests, test_max_public_input) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = max_value; tx.output_note[0].value = max_value; tx.public_owner = fr::random_element(); @@ -961,7 +961,7 @@ TEST_F(join_split_tests, test_max_public_input) TEST_F(join_split_tests, test_overflow_public_value_fails) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = max_value + 1; tx.public_owner = fr::random_element(); @@ -977,13 +977,13 @@ TEST_F(join_split_tests, test_overflow_public_value_fails) TEST_F(join_split_tests, test_non_zero_tx_fee) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value += 10; tx.public_owner = fr::random_element(); auto result = sign_and_verify_logic(tx, user.owner); EXPECT_TRUE(result.valid); - EXPECT_EQ(result.public_inputs[InnerProofFields::TX_FEE], 10); + EXPECT_EQ(result.public_inputs[inner_proof_fields::TX_FEE], 10); } TEST_F(join_split_tests, test_non_zero_tx_fee_zero_public_values) @@ -993,27 +993,27 @@ TEST_F(join_split_tests, test_non_zero_tx_fee_zero_public_values) auto result = sign_and_verify_logic(tx, user.owner); EXPECT_TRUE(result.valid); - EXPECT_EQ(result.public_inputs[InnerProofFields::TX_FEE], 10); + EXPECT_EQ(result.public_inputs[inner_proof_fields::TX_FEE], 10); } TEST_F(join_split_tests, test_max_tx_fee) { join_split_tx tx = zero_input_setup(); - auto tx_fee = (uint256_t(1) << join_split_example::TX_FEE_BIT_LENGTH) - 1; - tx.proof_id = ProofIds::DEPOSIT; + auto tx_fee = (uint256_t(1) << bb::join_split_example::TX_FEE_BIT_LENGTH) - 1; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value += tx_fee; tx.public_owner = fr::random_element(); auto result = sign_and_verify_logic(tx, user.owner); EXPECT_TRUE(result.valid); - EXPECT_EQ(result.public_inputs[InnerProofFields::TX_FEE], fr(tx_fee)); + EXPECT_EQ(result.public_inputs[inner_proof_fields::TX_FEE], fr(tx_fee)); } TEST_F(join_split_tests, test_overflow_tx_fee_fails) { join_split_tx tx = simple_setup(); - auto tx_fee = uint256_t(1) << join_split_example::TX_FEE_BIT_LENGTH; - tx.proof_id = ProofIds::DEPOSIT; + auto tx_fee = uint256_t(1) << bb::join_split_example::TX_FEE_BIT_LENGTH; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value += tx_fee; tx.public_owner = fr::random_element(); @@ -1104,7 +1104,7 @@ TEST_F(join_split_tests, test_random_output_note_owners) TEST_F(join_split_tests, test_tainted_output_owner_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 1; tx.signing_pub_key = user.owner.public_key; uint8_t public_owner[32] = { 0x01, 0xaa, 0x42, 0xd4, 0x72, 0x88, 0x8e, 0xae, 0xa5, 0x56, 0x39, @@ -1116,8 +1116,8 @@ TEST_F(join_split_tests, test_tainted_output_owner_fails) auto prover = new_join_split_prover(tx, false); auto proof = prover.construct_proof(); - EXPECT_EQ(proof.proof_data[InnerProofOffsets::PUBLIC_OWNER], 0x01); - proof.proof_data[InnerProofFields::PUBLIC_OWNER] = 0x02; + EXPECT_EQ(proof.proof_data[inner_proof_offsets::PUBLIC_OWNER], 0x01); + proof.proof_data[inner_proof_fields::PUBLIC_OWNER] = 0x02; EXPECT_FALSE(verify_proof(proof)); } @@ -1139,7 +1139,7 @@ TEST_F(join_split_tests, test_wrong_account_private_key_fails) TEST_F(join_split_tests, test_wrong_public_owner_sig_fail) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 1; tx.public_owner = fr::random_element(); @@ -1176,7 +1176,7 @@ TEST_F(join_split_tests, test_spend_registered_notes_with_owner_key_fails) TEST_F(join_split_tests, test_wrong_alias_hash_fails) { join_split_tx tx = simple_setup({ 2, 3 }, ACCOUNT_INDEX, 1); - tx.alias_hash = join_split_example::fixtures::generate_alias_hash("derive_generators"); + tx.alias_hash = bb::join_split_example::fixtures::generate_alias_hash("derive_generators"); auto result = sign_and_verify_logic(tx, user.owner); EXPECT_FALSE(result.valid); @@ -1186,7 +1186,7 @@ TEST_F(join_split_tests, test_wrong_alias_hash_fails) TEST_F(join_split_tests, test_nonregistered_signing_key_fails) { join_split_tx tx = simple_setup({ 2, 3 }, ACCOUNT_INDEX, 1); - auto keys = join_split_example::fixtures::create_key_pair(nullptr); + auto keys = bb::join_split_example::fixtures::create_key_pair(nullptr); tx.signing_pub_key = keys.public_key; auto result = sign_and_verify_logic(tx, user.owner); @@ -1265,7 +1265,7 @@ TEST_F(join_split_tests, test_defi_deposit_one_virtual_input) tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1289,7 +1289,7 @@ TEST_F(join_split_tests, test_defi_deposit_one_real_one_virtual_inputs) { join_split_tx tx = simple_setup({ 0, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1316,7 +1316,7 @@ TEST_F(join_split_tests, test_defi_deposit_one_virtual_one_real_inputs) { join_split_tx tx = simple_setup({ 10, 7 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 110; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1342,7 +1342,7 @@ TEST_F(join_split_tests, test_defi_deposit_one_real_one_virtual_inputs_same_asse { join_split_tx tx = simple_setup({ 0, 12 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1369,7 +1369,7 @@ TEST_F(join_split_tests, test_defi_deposit_two_real_inputs_different_asset_ids) { join_split_tx tx = simple_setup({ 0, 6 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1396,7 +1396,7 @@ TEST_F(join_split_tests, test_defi_deposit_two_virtual_inputs_different_asset_id { join_split_tx tx = simple_setup({ 4, 9 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1424,7 +1424,7 @@ TEST_F(join_split_tests, { join_split_tx tx = simple_setup({ 4, 10 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1453,7 +1453,7 @@ TEST_F(join_split_tests, test_defi_deposit_two_real_inputs_different_asset_ids_a { join_split_tx tx = simple_setup({ 0, 7 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1482,7 +1482,7 @@ TEST_F(join_split_tests, test_defi_deposit_two_real_inputs_different_asset_ids_a { join_split_tx tx = simple_setup({ 0, 6 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 95; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1511,7 +1511,7 @@ TEST_F(join_split_tests, test_defi_invalid_tx_fee_asset_id_fails) { join_split_tx tx = simple_setup({ 0, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1541,7 +1541,7 @@ TEST_F(join_split_tests, test_defi_deposit_of_zero_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.output_note[0].value = 0; tx.output_note[1].value = 0; tx.partial_claim_note.deposit_value = 0; // <-- should be > 0 @@ -1558,7 +1558,7 @@ TEST_F(join_split_tests, test_defi_deposit_of_zero_fails) TEST_F(join_split_tests, test_defi_non_zero_output_note_1_ignored) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.output_note[0].value = 10; // This should be ignored in fee calculation. tx.output_note[1].value = 100; tx.partial_claim_note.deposit_value = 50; @@ -1584,7 +1584,7 @@ TEST_F(join_split_tests, test_defi_non_zero_output_note_1_ignored) TEST_F(join_split_tests, test_defi_allow_chain_1_fails) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.output_note[1].value = 100; tx.partial_claim_note.deposit_value = 50; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1618,7 +1618,7 @@ TEST_F(join_split_tests, test_defi_deposit_incorrect_input_nullifier_in_partial_ tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = 1; // incorrect nullifier @@ -1647,7 +1647,7 @@ TEST_F(join_split_tests, test_defi_deposit_bridge_call_data_second_bridge_input_ { join_split_tx tx = simple_setup({ 0, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1679,7 +1679,7 @@ TEST_F(join_split_tests, test_defi_deposit_bridge_call_data_second_bridge_output tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1707,7 +1707,7 @@ TEST_F(join_split_tests, test_defi_deposit_second_bridge_input_in_use_but_same_b { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 50; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; tx.output_note[1].value = 90; @@ -1742,7 +1742,7 @@ TEST_F(join_split_tests, test_defi_deposit_second_bridge_output_in_use_and_same_ tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1775,7 +1775,7 @@ TEST_F(join_split_tests, test_defi_deposit_second_bridge_output_in_use_but_same_ tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1809,7 +1809,7 @@ TEST_F(join_split_tests, test_defi_deposit_first_bridge_output_asset_id_virtual_ tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1840,7 +1840,7 @@ TEST_F(join_split_tests, test_defi_deposit_second_bridge_output_asset_id_virtual tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1877,7 +1877,7 @@ TEST_F(join_split_tests, test_defi_wrong_first_asset_id_in_bridge_call_data_fail tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1907,7 +1907,7 @@ TEST_F(join_split_tests, test_defi_bridge_call_data_config_second_input_in_use_b tx.output_note[1].input_nullifier = compute_nullifier(tx.input_note[1].commit(), user.owner.private_key, false); // input note 2 is a dummy note - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1934,7 +1934,7 @@ TEST_F(join_split_tests, test_defi_missing_second_asset_in_bridge_call_data_fail { join_split_tx tx = simple_setup({ 0, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1962,7 +1962,7 @@ TEST_F(join_split_tests, test_defi_wrong_second_asset_id_in_bridge_call_data_fai { join_split_tx tx = simple_setup({ 4, 9 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -1996,7 +1996,7 @@ TEST_F(join_split_tests, test_repayment_logic) { join_split_tx tx = simple_setup({ 0, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; tx.output_note[1].value = 10; // <-- repaying some value back to the defi-depositor @@ -2023,7 +2023,7 @@ TEST_F(join_split_tests, test_virtual_note_repay_different_asset_id_fail) { join_split_tx tx = simple_setup({ 0, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; tx.output_note[1].asset_id = 3; // <-- different from any of the input notes' asset_ids @@ -2051,7 +2051,7 @@ TEST_F(join_split_tests, test_virtual_note_repay_different_asset_id_fail) TEST_F(join_split_tests, test_real_input_value_lt_virtual_input_value_fails) { join_split_tx tx = simple_setup({ 1, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; @@ -2197,7 +2197,7 @@ TEST_F(join_split_tests, test_incorrect_output_note_creator_pubkey_x) { join_split_tx tx = simple_setup(); tx.output_note[0].creator_pubkey = - join_split_example::fixtures::create_key_pair(nullptr) + bb::join_split_example::fixtures::create_key_pair(nullptr) .public_key.x; // setting creator to be different from sender (the owner of the input notes). auto result = sign_and_verify_logic(tx, user.owner); EXPECT_FALSE(result.valid); @@ -2206,7 +2206,7 @@ TEST_F(join_split_tests, test_incorrect_output_note_creator_pubkey_x) { join_split_tx tx = simple_setup(); tx.output_note[1].creator_pubkey = - join_split_example::fixtures::create_key_pair(nullptr) + bb::join_split_example::fixtures::create_key_pair(nullptr) .public_key.x; // setting creator to be different from sender (the owner of the input notes). auto result = sign_and_verify_logic(tx, user.owner); EXPECT_FALSE(result.valid); @@ -2222,7 +2222,7 @@ TEST_F(join_split_tests, test_incorrect_output_note_creator_pubkey_x) TEST_F(join_split_tests, test_deposit_construct_proof) { join_split_tx tx = zero_input_setup(); - tx.proof_id = ProofIds::DEPOSIT; + tx.proof_id = proof_ids::DEPOSIT; tx.public_value = 10; tx.public_owner = fr::random_element(); tx.output_note[0].value = 7; @@ -2244,7 +2244,7 @@ TEST_F(join_split_tests, test_deposit_construct_proof) auto output_note1_commitment = tx.output_note[0].commit(); auto output_note2_commitment = tx.output_note[1].commit(); - EXPECT_EQ(proof_data.proof_id, ProofIds::DEPOSIT); + EXPECT_EQ(proof_data.proof_id, proof_ids::DEPOSIT); EXPECT_EQ(proof_data.note_commitment1, output_note1_commitment); EXPECT_EQ(proof_data.note_commitment2, output_note2_commitment); EXPECT_EQ(proof_data.nullifier1, nullifier1); @@ -2265,7 +2265,7 @@ TEST_F(join_split_tests, test_deposit_construct_proof) TEST_F(join_split_tests, test_withdraw_full_proof) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::WITHDRAW; + tx.proof_id = proof_ids::WITHDRAW; tx.public_value = 10; tx.public_owner = fr::random_element(); tx.output_note[0].value -= 13; @@ -2289,7 +2289,7 @@ TEST_F(join_split_tests, test_withdraw_full_proof) auto output_note1_commitment = tx.output_note[0].commit(); auto output_note2_commitment = tx.output_note[1].commit(); - EXPECT_EQ(proof_data.proof_id, ProofIds::WITHDRAW); + EXPECT_EQ(proof_data.proof_id, proof_ids::WITHDRAW); EXPECT_EQ(proof_data.note_commitment1, output_note1_commitment); EXPECT_EQ(proof_data.note_commitment2, output_note2_commitment); EXPECT_EQ(proof_data.nullifier1, nullifier1); @@ -2330,7 +2330,7 @@ TEST_F(join_split_tests, test_private_send_full_proof) uint256_t nullifier1 = compute_nullifier(input_note1_commitment, user.owner.private_key, true); uint256_t nullifier2 = compute_nullifier(input_note2_commitment, user.owner.private_key, true); - EXPECT_EQ(proof_data.proof_id, ProofIds::SEND); + EXPECT_EQ(proof_data.proof_id, proof_ids::SEND); EXPECT_EQ(proof_data.note_commitment1, output_note1_commitment); EXPECT_EQ(proof_data.note_commitment2, output_note2_commitment); EXPECT_EQ(proof_data.nullifier1, nullifier1); @@ -2354,7 +2354,7 @@ TEST_F(join_split_tests, test_defi_deposit_full_proof) { join_split_tx tx = simple_setup(); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 50; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; tx.output_note[1].value = 90; @@ -2394,7 +2394,7 @@ TEST_F(join_split_tests, test_defi_deposit_full_proof) uint256_t nullifier1 = compute_nullifier(input_note1_commitment, user.owner.private_key, true); uint256_t nullifier2 = compute_nullifier(input_note2_commitment, user.owner.private_key, true); - EXPECT_EQ(proof_data.proof_id, ProofIds::DEFI_DEPOSIT); + EXPECT_EQ(proof_data.proof_id, proof_ids::DEFI_DEPOSIT); EXPECT_EQ(proof_data.note_commitment1, output_note1_commitment); EXPECT_EQ(proof_data.note_commitment2, output_note2_commitment); EXPECT_EQ(proof_data.nullifier1, nullifier1); @@ -2416,7 +2416,7 @@ TEST_F(join_split_tests, test_repayment_full_proof) { join_split_tx tx = simple_setup({ 0, 11 }); - tx.proof_id = ProofIds::DEFI_DEPOSIT; + tx.proof_id = proof_ids::DEFI_DEPOSIT; tx.partial_claim_note.deposit_value = 90; tx.partial_claim_note.input_nullifier = tx.output_note[0].input_nullifier; tx.output_note[1].value = 10; // <-- repaying some value back to the defi-depositor @@ -2456,7 +2456,7 @@ TEST_F(join_split_tests, test_repayment_full_proof) uint256_t nullifier1 = compute_nullifier(input_note1_commitment, user.owner.private_key, true); uint256_t nullifier2 = compute_nullifier(input_note2_commitment, user.owner.private_key, true); - EXPECT_EQ(proof_data.proof_id, ProofIds::DEFI_DEPOSIT); + EXPECT_EQ(proof_data.proof_id, proof_ids::DEFI_DEPOSIT); EXPECT_EQ(proof_data.note_commitment1, output_note1_commitment); EXPECT_EQ(proof_data.note_commitment2, output_note2_commitment); EXPECT_EQ(proof_data.nullifier1, nullifier1); @@ -2497,7 +2497,7 @@ TEST_F(join_split_tests, test_send_two_virtual_notes_full_proof) uint256_t nullifier1 = compute_nullifier(input_note1_commitment, user.owner.private_key, true); uint256_t nullifier2 = compute_nullifier(input_note2_commitment, user.owner.private_key, true); - EXPECT_EQ(proof_data.proof_id, ProofIds::SEND); + EXPECT_EQ(proof_data.proof_id, proof_ids::SEND); EXPECT_EQ(proof_data.note_commitment1, output_note1_commitment); EXPECT_EQ(proof_data.note_commitment2, output_note2_commitment); EXPECT_EQ(proof_data.nullifier1, nullifier1); @@ -2514,4 +2514,4 @@ TEST_F(join_split_tests, test_send_two_virtual_notes_full_proof) EXPECT_TRUE(verify_proof(proof)); } -} // namespace join_split_example::proofs::join_split +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp index 8a4523432b3..4d3fbdd110d 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.cpp @@ -8,14 +8,12 @@ #include "barretenberg/stdlib/merkle_tree/membership.hpp" #include "verify_signature.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { using namespace bb::plonk; using namespace notes::circuit; using namespace bb::stdlib::merkle_tree; -using namespace crypto::schnorr; +using namespace bb::crypto::schnorr; /** * Check that the input note data, follows the given hash paths, to the publically given merkle root. @@ -43,10 +41,10 @@ field_ct process_input_note(field_ct const& account_private_key, join_split_outputs join_split_circuit_component(join_split_inputs const& inputs) { - const bool_ct is_deposit = inputs.proof_id == field_ct(ProofIds::DEPOSIT); - const bool_ct is_withdraw = inputs.proof_id == field_ct(ProofIds::WITHDRAW); - const bool_ct is_send = inputs.proof_id == field_ct(ProofIds::SEND); - const bool_ct is_defi_deposit = inputs.proof_id == field_ct(ProofIds::DEFI_DEPOSIT); + const bool_ct is_deposit = inputs.proof_id == field_ct(proof_ids::DEPOSIT); + const bool_ct is_withdraw = inputs.proof_id == field_ct(proof_ids::WITHDRAW); + const bool_ct is_send = inputs.proof_id == field_ct(proof_ids::SEND); + const bool_ct is_defi_deposit = inputs.proof_id == field_ct(proof_ids::DEFI_DEPOSIT); const bool_ct not_defi_deposit = !is_defi_deposit; const bool_ct is_public_tx = is_deposit || is_withdraw; @@ -88,10 +86,10 @@ join_split_outputs join_split_circuit_component(join_split_inputs const& inputs) (is_public_tx == inputs.public_owner.is_zero()).assert_equal(false, "public owner invalid"); // Constrain the proof id. - inputs.proof_id.assert_is_in_set({ field_ct(ProofIds::DEPOSIT), - field_ct(ProofIds::WITHDRAW), - field_ct(ProofIds::SEND), - field_ct(ProofIds::DEFI_DEPOSIT) }, + inputs.proof_id.assert_is_in_set({ field_ct(proof_ids::DEPOSIT), + field_ct(proof_ids::WITHDRAW), + field_ct(proof_ids::SEND), + field_ct(proof_ids::DEFI_DEPOSIT) }, "invalid proof id"); // Check we're not joining the same input note. @@ -327,6 +325,4 @@ void join_split_circuit(Builder& builder, join_split_tx const& tx) inputs.allow_chain.set_public(); } // namespace join_split -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp index 82e338fb3c0..6d076829d68 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_circuit.hpp @@ -5,9 +5,7 @@ #include "barretenberg/join_split_example/types.hpp" #include "join_split_tx.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { struct join_split_inputs { @@ -52,6 +50,4 @@ join_split_outputs join_split_circuit_component(join_split_inputs const& inputs) void join_split_circuit(Builder& builder, join_split_tx const& tx); -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp index 9891530b991..e7cec1763d0 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_js_parity.test.cpp @@ -8,15 +8,13 @@ #include "barretenberg/stdlib/merkle_tree/index.hpp" #include "index.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { using namespace bb; // using namespace bb::stdlib::types; using namespace bb::stdlib::merkle_tree; -using namespace join_split_example::proofs::notes::native; -using key_pair = join_split_example::fixtures::grumpkin_key_pair; +using namespace bb::join_split_example::proofs::notes::native; +using key_pair = bb::join_split_example::fixtures::grumpkin_key_pair; /** * This test mirrors the test in join_split_prover.test.ts @@ -104,7 +102,7 @@ TEST_F(join_split_js_parity_tests, test_full_proof) value::value_note output_note2 = { 50, 0, 0, public_key, note_secret, 0, input_note2_nullifier }; join_split_tx tx; - tx.proof_id = ProofIds::SEND; + tx.proof_id = proof_ids::SEND; tx.public_value = 0; tx.public_owner = 0; tx.asset_id = 0; @@ -119,7 +117,7 @@ TEST_F(join_split_js_parity_tests, test_full_proof) tx.partial_claim_note.note_secret = 0; tx.partial_claim_note.input_nullifier = 0; tx.account_private_key = private_key; - tx.alias_hash = join_split_example::fixtures::generate_alias_hash("penguin"); + tx.alias_hash = bb::join_split_example::fixtures::generate_alias_hash("penguin"); tx.account_required = false; tx.account_note_index = 0; tx.account_note_path = tree->get_hash_path(0); @@ -138,7 +136,7 @@ TEST_F(join_split_js_parity_tests, test_full_proof) auto output_note1_commitment = tx.output_note[0].commit(); auto output_note2_commitment = tx.output_note[1].commit(); - EXPECT_EQ(proof_data.proof_id, ProofIds::SEND); + EXPECT_EQ(proof_data.proof_id, proof_ids::SEND); EXPECT_EQ(proof_data.note_commitment1, output_note1_commitment); EXPECT_EQ(proof_data.note_commitment2, output_note2_commitment); EXPECT_EQ(proof_data.nullifier1, uint256_t(input_note1_nullifier)); @@ -161,6 +159,4 @@ TEST_F(join_split_js_parity_tests, test_full_proof) // } } -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.cpp index d1543e0123f..9f7adae976d 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.cpp @@ -1,9 +1,7 @@ #include "join_split_tx.hpp" #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { using namespace bb; @@ -91,6 +89,4 @@ std::ostream& operator<<(std::ostream& os, join_split_tx const& tx) << "signature: " << tx.signature << "\n"; } -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp index 3a530778e9b..71bf39d81ab 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.hpp @@ -5,9 +5,7 @@ #include "barretenberg/join_split_example/types.hpp" #include "barretenberg/stdlib/merkle_tree/hash_path.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { struct join_split_tx { uint32_t proof_id; @@ -43,6 +41,4 @@ void write(std::vector& buf, join_split_tx const& tx); std::ostream& operator<<(std::ostream& os, join_split_tx const& tx); -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.test.cpp index 0c3c90bd9fd..38f7aa70280 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/join_split_tx.test.cpp @@ -11,7 +11,7 @@ #include using namespace bb; -using namespace join_split_example::proofs::join_split; +using namespace bb::join_split_example::proofs::join_split; namespace { auto& engine = numeric::random::get_debug_engine(); diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/sign_join_split_tx.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/sign_join_split_tx.cpp index cf379621bf7..e6b4ad0575e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/sign_join_split_tx.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/sign_join_split_tx.cpp @@ -2,11 +2,9 @@ #include "barretenberg/crypto/schnorr/schnorr.hpp" #include "compute_signing_data.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { -using namespace crypto::schnorr; +using namespace bb::crypto::schnorr; signature sign_join_split_tx(join_split_tx const& tx, key_pair const& keys) { @@ -25,6 +23,4 @@ signature sign_join_split_tx(join_split_tx const& tx, key_pair const& keys); -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/verify_signature.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/verify_signature.hpp index 2836c1cfbba..6fb148f3ae6 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/verify_signature.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/join_split/verify_signature.hpp @@ -1,9 +1,7 @@ #include "barretenberg/stdlib/encryption/schnorr/schnorr.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" -namespace join_split_example { -namespace proofs { -namespace join_split { +namespace bb::join_split_example::proofs::join_split { using namespace notes; @@ -27,6 +25,4 @@ inline void verify_signature(field_ct const& public_value, verify_signature(message, owner_pub_key, signature); } -} // namespace join_split -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::join_split diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp index 3cfe9bbf57e..0bd3b9bb724 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/mock/mock_circuit.hpp @@ -2,9 +2,7 @@ #include "barretenberg/common/map.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" #include "barretenberg/stdlib/primitives/field/field.hpp" -namespace join_split_example { -namespace proofs { -namespace mock { +namespace bb::join_split_example::proofs::mock { using namespace bb::plonk; @@ -19,6 +17,4 @@ template void mock_circuit(Builder& builder, std::vector deflag_asset_id(suint_ct const& asset_id); bool_ct get_asset_id_flag(suint_ct const& asset_id); -} // namespace join_split_example::proofs::notes::circuit +} // namespace bb::join_split_example::proofs::notes::circuit diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp index 2ed9f244f55..d0d3015d974 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/bridge_call_data.hpp @@ -4,10 +4,7 @@ #include "./asset_id.hpp" #include "barretenberg/join_split_example/types.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace circuit { +namespace bb::join_split_example::proofs::notes::circuit { using namespace bb::stdlib; @@ -216,7 +213,4 @@ inline std::ostream& operator<<(std::ostream& os, bridge_call_data const& bridge return os; } -} // namespace circuit -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::circuit diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp index 832b47d1ccd..385c99ae630 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/claim_note.hpp @@ -7,11 +7,7 @@ #include "create_partial_commitment.hpp" #include "witness_data.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace circuit { -namespace claim { +namespace bb::join_split_example::proofs::notes::circuit::claim { using namespace bb::stdlib; @@ -62,8 +58,4 @@ struct claim_note { operator byte_array_ct() const { return byte_array_ct(commitment); } }; -} // namespace claim -} // namespace circuit -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::circuit::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp index 9272b17abec..a9ec8b99920 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/complete_partial_commitment.hpp @@ -3,11 +3,7 @@ #include "barretenberg/join_split_example/types.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace circuit { -namespace claim { +namespace bb::join_split_example::proofs::notes::circuit::claim { using namespace bb::stdlib; @@ -19,8 +15,4 @@ inline auto complete_partial_commitment(field_ct const& partial_commitment, GeneratorIndex::CLAIM_NOTE_COMMITMENT); } -} // namespace claim -} // namespace circuit -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::circuit::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp index f7bb3851143..cc07f1f4e16 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/compute_nullifier.hpp @@ -4,11 +4,7 @@ #include "barretenberg/join_split_example/types.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace circuit { -namespace claim { +namespace bb::join_split_example::proofs::notes::circuit::claim { inline field_ct compute_nullifier(field_ct const& note_commitment) { @@ -23,8 +19,4 @@ inline field_ct compute_nullifier(field_ct const& note_commitment) // later spent, the value note nullifiers will not reveal that it is those notes being spent. } -} // namespace claim -} // namespace circuit -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::circuit::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp index ce45e40600c..5217deb70e1 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/create_partial_commitment.hpp @@ -3,11 +3,7 @@ #include "barretenberg/join_split_example/types.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace circuit { -namespace claim { +namespace bb::join_split_example::proofs::notes::circuit::claim { inline auto create_partial_commitment(field_ct const& deposit_value, field_ct const& bridge_call_data, @@ -18,8 +14,4 @@ inline auto create_partial_commitment(field_ct const& deposit_value, GeneratorIndex::CLAIM_NOTE_PARTIAL_COMMITMENT); } -} // namespace claim -} // namespace circuit -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::circuit::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp index f84ccdd5132..32cb510348e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/claim/witness_data.hpp @@ -6,7 +6,7 @@ #include "../bridge_call_data.hpp" #include "barretenberg/join_split_example/types.hpp" -namespace join_split_example::proofs::notes::circuit::claim { +namespace bb::join_split_example::proofs::notes::circuit::claim { using namespace bb::stdlib; @@ -62,4 +62,4 @@ inline std::ostream& operator<<(std::ostream& os, partial_claim_note_witness_dat return os << "{ deposit_value: " << tx.deposit_value << ", bridge_call_data: " << tx.bridge_call_data_local.to_safe_uint() << " }"; } -} // namespace join_split_example::proofs::notes::circuit::claim +} // namespace bb::join_split_example::proofs::notes::circuit::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/commit.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/commit.hpp index 07864e8fc9c..b02dea089d2 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/commit.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/commit.hpp @@ -3,7 +3,7 @@ #include "create_partial_commitment.hpp" #include "witness_data.hpp" -namespace join_split_example::proofs::notes::circuit::value { +namespace bb::join_split_example::proofs::notes::circuit::value { inline auto commit(const witness_data& plaintext) { @@ -13,4 +13,4 @@ inline auto commit(const witness_data& plaintext) partial_commitment, plaintext.value, plaintext.asset_id, plaintext.input_nullifier); } -} // namespace join_split_example::proofs::notes::circuit::value \ No newline at end of file +} // namespace bb::join_split_example::proofs::notes::circuit::value \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp index 73ad51bc7c6..4ba7092534d 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/complete_partial_commitment.hpp @@ -3,7 +3,7 @@ #include "../../constants.hpp" #include "barretenberg/join_split_example/types.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" -namespace join_split_example::proofs::notes::circuit::value { +namespace bb::join_split_example::proofs::notes::circuit::value { inline auto complete_partial_commitment(field_ct const& value_note_partial_commitment, suint_ct const& value, @@ -14,4 +14,4 @@ inline auto complete_partial_commitment(field_ct const& value_note_partial_commi GeneratorIndex::VALUE_NOTE_COMMITMENT); } -} // namespace join_split_example::proofs::notes::circuit::value +} // namespace bb::join_split_example::proofs::notes::circuit::value diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp index 29a8567aefd..6a17318dfb1 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.cpp @@ -2,7 +2,7 @@ #include "../../constants.hpp" #include "barretenberg/join_split_example/types.hpp" -namespace join_split_example::proofs::notes::circuit { +namespace bb::join_split_example::proofs::notes::circuit { using namespace bb; using namespace bb::stdlib; @@ -44,4 +44,4 @@ field_ct compute_nullifier(field_ct const& note_commitment, return field_ct(blake_result); } -} // namespace join_split_example::proofs::notes::circuit +} // namespace bb::join_split_example::proofs::notes::circuit diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp index 6d20fd5ada9..d2c26d6b2f8 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.hpp @@ -1,10 +1,10 @@ #pragma once #include "barretenberg/join_split_example/types.hpp" -namespace join_split_example::proofs::notes::circuit { +namespace bb::join_split_example::proofs::notes::circuit { field_ct compute_nullifier(field_ct const& note_commitment, field_ct const& account_private_key, bool_ct const& is_note_in_use); -} // namespace join_split_example::proofs::notes::circuit +} // namespace bb::join_split_example::proofs::notes::circuit diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp index 406fe7b7ed0..26738fc018e 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/compute_nullifier.test.cpp @@ -6,12 +6,12 @@ #include "barretenberg/join_split_example/types.hpp" #include -namespace join_split_example { -using namespace join_split_example::proofs::notes; +namespace bb::join_split_example { +using namespace bb::join_split_example::proofs::notes; TEST(compute_nullifier_circuit, native_consistency) { - auto user = join_split_example::fixtures::create_user_context(); + auto user = bb::join_split_example::fixtures::create_user_context(); auto priv_key = uint256_t(user.owner.private_key); auto native_input_note = @@ -26,4 +26,4 @@ TEST(compute_nullifier_circuit, native_consistency) EXPECT_EQ(circuit_nullifier.get_value(), native_nullifier); } -} // namespace join_split_example \ No newline at end of file +} // namespace bb::join_split_example \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp index 00ab2a189bf..76247b194bc 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/create_partial_commitment.hpp @@ -3,7 +3,7 @@ #include "barretenberg/join_split_example/types.hpp" #include "barretenberg/stdlib/hash/pedersen/pedersen.hpp" -namespace join_split_example::proofs::notes::circuit::value { +namespace bb::join_split_example::proofs::notes::circuit::value { inline auto create_partial_commitment(field_ct const& secret, group_ct const& owner, @@ -14,4 +14,4 @@ inline auto create_partial_commitment(field_ct const& secret, GeneratorIndex::VALUE_NOTE_PARTIAL_COMMITMENT); } -} // namespace join_split_example::proofs::notes::circuit::value +} // namespace bb::join_split_example::proofs::notes::circuit::value diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp index fbd70519be5..64af0f9cb41 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.hpp @@ -3,7 +3,7 @@ #include "commit.hpp" #include "witness_data.hpp" -namespace join_split_example::proofs::notes::circuit::value { +namespace bb::join_split_example::proofs::notes::circuit::value { using namespace bb::stdlib; @@ -31,4 +31,4 @@ struct value_note { operator byte_array_ct() const { return byte_array_ct(commitment); } }; -} // namespace join_split_example::proofs::notes::circuit::value +} // namespace bb::join_split_example::proofs::notes::circuit::value diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp index 5e4acc727f1..4dfd44cfab0 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/value_note.test.cpp @@ -5,11 +5,11 @@ #include "value_note.hpp" #include -namespace join_split_example { +namespace bb::join_split_example { using namespace bb; using namespace bb::stdlib; -using namespace join_split_example::proofs::notes; -using namespace join_split_example::proofs::notes::circuit::value; +using namespace bb::join_split_example::proofs::notes; +using namespace bb::join_split_example::proofs::notes::circuit::value; class ValueNote : public ::testing::Test { protected: @@ -18,7 +18,7 @@ class ValueNote : public ::testing::Test { TEST_F(ValueNote, Commits) { - auto user = join_split_example::fixtures::create_user_context(); + auto user = bb::join_split_example::fixtures::create_user_context(); auto builder = Builder(); fr note_value = fr::random_element(); @@ -54,7 +54,7 @@ TEST_F(ValueNote, CommitsWith0Value) { auto builder = Builder(); - auto user = join_split_example::fixtures::create_user_context(); + auto user = bb::join_split_example::fixtures::create_user_context(); uint32_t asset_id_value = 0x2abbccddULL; // needs to be less than 30 bits @@ -91,7 +91,7 @@ TEST_F(ValueNote, CommitWithOversizedAssetIdFails) { auto builder = Builder(); - auto user = join_split_example::fixtures::create_user_context(); + auto user = bb::join_split_example::fixtures::create_user_context(); native::value::value_note note = { .value = 0, @@ -120,4 +120,4 @@ TEST_F(ValueNote, CommitWithOversizedAssetIdFails) bool proof_result = verifier.verify_proof(proof); EXPECT_EQ(proof_result, false); } -} // namespace join_split_example \ No newline at end of file +} // namespace bb::join_split_example \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp index dba13cf1624..91cbb512896 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/circuit/value/witness_data.hpp @@ -2,7 +2,7 @@ #include "../../native/value/value_note.hpp" #include "barretenberg/join_split_example/types.hpp" -namespace join_split_example::proofs::notes::circuit::value { +namespace bb::join_split_example::proofs::notes::circuit::value { using namespace bb::stdlib; @@ -29,4 +29,4 @@ struct witness_data { } }; -} // namespace join_split_example::proofs::notes::circuit::value +} // namespace bb::join_split_example::proofs::notes::circuit::value diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/constants.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/constants.hpp index 02dd07b98fc..9a081fd3249 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/constants.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/constants.hpp @@ -3,9 +3,7 @@ #include "barretenberg/numeric/uint256/uint256.hpp" #include -namespace join_split_example { -namespace proofs { -namespace notes { +namespace bb::join_split_example::proofs::notes { constexpr size_t ASSET_ID_BIT_LENGTH = 30; constexpr size_t NONCE_BIT_LENGTH = 32; @@ -40,6 +38,4 @@ constexpr uint32_t DEFI_BRIDGE_OUTPUT_B_ASSET_ID_LEN = MAX_NUM_ASSETS_BIT_LENGTH constexpr uint32_t DEFI_BRIDGE_BITCONFIG_LEN = 32; constexpr uint32_t DEFI_BRIDGE_AUX_DATA = 64; -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.cpp index 24f19552897..893602921a0 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.cpp @@ -2,11 +2,11 @@ #include "../../constants.hpp" #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" -namespace join_split_example::proofs::notes::native::account { +namespace bb::join_split_example::proofs::notes::native::account { grumpkin::fq generate_account_commitment(const bb::fr& alias_hash, const bb::fr& owner_x, const bb::fr& signing_x) { - return crypto::pedersen_hash::hash({ alias_hash, owner_x, signing_x }, GeneratorIndex::ACCOUNT_NOTE_COMMITMENT); + return bb::crypto::pedersen_hash::hash({ alias_hash, owner_x, signing_x }, GeneratorIndex::ACCOUNT_NOTE_COMMITMENT); } grumpkin::fq account_note::commit() const @@ -14,4 +14,4 @@ grumpkin::fq account_note::commit() const return generate_account_commitment(alias_hash, owner_key.x, signing_key.x); } -} // namespace join_split_example::proofs::notes::native::account +} // namespace bb::join_split_example::proofs::notes::native::account diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.hpp index 25674ca4876..b7970ab8841 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/account_note.hpp @@ -3,11 +3,7 @@ #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace native { -namespace account { +namespace bb::join_split_example::proofs::notes::native::account { grumpkin::fq generate_account_commitment(const bb::fr& alias_hash, const bb::fr& owner_x, const bb::fr& signing_x); @@ -19,8 +15,4 @@ struct account_note { grumpkin::fq commit() const; }; -} // namespace account -} // namespace native -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::native::account diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_alias_hash_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_alias_hash_nullifier.hpp index 0dbcdcfac8f..a5b6c805f6f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_alias_hash_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_alias_hash_nullifier.hpp @@ -3,7 +3,7 @@ #include "account_note.hpp" #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" -namespace join_split_example::proofs::notes::native::account { +namespace bb::join_split_example::proofs::notes::native::account { using fr = bb::fr; @@ -14,4 +14,4 @@ inline fr compute_account_alias_hash_nullifier(fr const& alias_hash) crypto::GeneratorContext(notes::GeneratorIndex::ACCOUNT_ALIAS_HASH_NULLIFIER)); } -} // namespace join_split_example::proofs::notes::native::account +} // namespace bb::join_split_example::proofs::notes::native::account diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_public_key_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_public_key_nullifier.hpp index d2bdc842f84..83ee8a6d1e3 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_public_key_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/account/compute_account_public_key_nullifier.hpp @@ -3,7 +3,7 @@ #include "account_note.hpp" #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" -namespace join_split_example::proofs::notes::native::account { +namespace bb::join_split_example::proofs::notes::native::account { using namespace bb; @@ -13,4 +13,4 @@ inline fr compute_account_public_key_nullifier(grumpkin::g1::affine_element cons notes::GeneratorIndex::ACCOUNT_PUBLIC_KEY_NULLIFIER); } -} // namespace join_split_example::proofs::notes::native::account +} // namespace bb::join_split_example::proofs::notes::native::account diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.cpp index 9749ad14cff..06b1387e793 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.cpp @@ -1,6 +1,6 @@ #include "../constants.hpp" -namespace join_split_example::proofs::notes::native { +namespace bb::join_split_example::proofs::notes::native { std::pair deflag_asset_id(uint32_t const& asset_id) { @@ -18,4 +18,4 @@ bool get_asset_id_flag(uint32_t const& asset_id) return is_virtual; } -} // namespace join_split_example::proofs::notes::native \ No newline at end of file +} // namespace bb::join_split_example::proofs::notes::native \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.hpp index dd1b21d59cd..64046424d46 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/asset_id.hpp @@ -2,10 +2,10 @@ #include #include -namespace join_split_example::proofs::notes::native { +namespace bb::join_split_example::proofs::notes::native { std::pair deflag_asset_id(uint32_t const& asset_id); bool get_asset_id_flag(uint32_t const& asset_id); -} // namespace join_split_example::proofs::notes::native \ No newline at end of file +} // namespace bb::join_split_example::proofs::notes::native \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/bridge_call_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/bridge_call_data.hpp index bfd852ba30d..b27953722b1 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/bridge_call_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/bridge_call_data.hpp @@ -5,10 +5,7 @@ #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace native { +namespace bb::join_split_example::proofs::notes::native { /** * The bridge_call_data structure (with bit-lengths) is defined as follows: @@ -179,7 +176,4 @@ inline std::ostream& operator<<(std::ostream& os, bridge_call_data const& bridge return os; } -} // namespace native -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::native diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note.hpp index e023e426262..b0574cad662 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note.hpp @@ -6,7 +6,7 @@ #include "complete_partial_commitment.hpp" #include "create_partial_commitment.hpp" -namespace join_split_example::proofs::notes::native::claim { +namespace bb::join_split_example::proofs::notes::native::claim { struct claim_note { uint256_t deposit_value; @@ -64,4 +64,4 @@ inline std::ostream& operator<<(std::ostream& os, claim_note const& note) " }"); } -} // namespace join_split_example::proofs::notes::native::claim +} // namespace bb::join_split_example::proofs::notes::native::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note_tx_data.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note_tx_data.hpp index f15bc431e20..ed3e72e5898 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note_tx_data.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/claim_note_tx_data.hpp @@ -4,11 +4,7 @@ #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace native { -namespace claim { +namespace bb::join_split_example::proofs::notes::native::claim { struct partial_claim_note_data { uint256_t deposit_value; @@ -43,8 +39,4 @@ inline void write(std::vector& buf, partial_claim_note_data const& note write(buf, note.input_nullifier); } -} // namespace claim -} // namespace native -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::native::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/complete_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/complete_partial_commitment.hpp index 99dfa52da16..28a85963468 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/complete_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/complete_partial_commitment.hpp @@ -4,7 +4,7 @@ #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example::proofs::notes::native::claim { +namespace bb::join_split_example::proofs::notes::native::claim { inline auto complete_partial_commitment(grumpkin::fq const& claim_note_partial_commitment, uint32_t interaction_nonce, @@ -14,4 +14,4 @@ inline auto complete_partial_commitment(grumpkin::fq const& claim_note_partial_c GeneratorIndex::CLAIM_NOTE_COMMITMENT); } -} // namespace join_split_example::proofs::notes::native::claim +} // namespace bb::join_split_example::proofs::notes::native::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/compute_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/compute_nullifier.hpp index 86fa9a76dfa..5273720b6d9 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/compute_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/compute_nullifier.hpp @@ -4,11 +4,11 @@ #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example::proofs::notes::native::claim { +namespace bb::join_split_example::proofs::notes::native::claim { inline auto compute_nullifier(grumpkin::fq const& note_commitment) { return crypto::pedersen_hash::hash({ note_commitment }, GeneratorIndex::CLAIM_NOTE_NULLIFIER); } -} // namespace join_split_example::proofs::notes::native::claim +} // namespace bb::join_split_example::proofs::notes::native::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/create_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/create_partial_commitment.hpp index ca0a5a54970..ef969a32805 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/create_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/claim/create_partial_commitment.hpp @@ -3,7 +3,7 @@ #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" #include "claim_note.hpp" -namespace join_split_example::proofs::notes::native::claim { +namespace bb::join_split_example::proofs::notes::native::claim { inline auto create_partial_commitment(uint256_t const& deposit_value, uint256_t const& bridge_call_data, @@ -15,4 +15,4 @@ inline auto create_partial_commitment(uint256_t const& deposit_value, GeneratorIndex::CLAIM_NOTE_PARTIAL_COMMITMENT); } -} // namespace join_split_example::proofs::notes::native::claim +} // namespace bb::join_split_example::proofs::notes::native::claim diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/complete_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/complete_partial_commitment.hpp index 3efd99219e6..570ac1d2183 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/complete_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/complete_partial_commitment.hpp @@ -2,15 +2,15 @@ #include "../../constants.hpp" #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" -namespace join_split_example::proofs::notes::native::value { +namespace bb::join_split_example::proofs::notes::native::value { inline auto complete_partial_commitment(grumpkin::fq const& partial_commitment, uint256_t const& value, uint32_t asset_id, grumpkin::fq input_nullifier) { - return crypto::pedersen_hash::hash({ partial_commitment, value, asset_id, input_nullifier }, - GeneratorIndex::VALUE_NOTE_COMMITMENT); + return bb::crypto::pedersen_hash::hash({ partial_commitment, value, asset_id, input_nullifier }, + GeneratorIndex::VALUE_NOTE_COMMITMENT); }; -} // namespace join_split_example::proofs::notes::native::value +} // namespace bb::join_split_example::proofs::notes::native::value diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.cpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.cpp index 827690d6f6d..0a8365a2f42 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.cpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.cpp @@ -4,7 +4,7 @@ #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" -namespace join_split_example::proofs::notes::native { +namespace bb::join_split_example::proofs::notes::native { using namespace bb; @@ -31,4 +31,4 @@ fr compute_nullifier(grumpkin::fq const& note_commitment, return from_buffer(blake_result); } -} // namespace join_split_example::proofs::notes::native +} // namespace bb::join_split_example::proofs::notes::native diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.hpp index 66f913d263d..2f5c36eea5f 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/compute_nullifier.hpp @@ -1,16 +1,10 @@ #pragma once #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace native { +namespace bb::join_split_example::proofs::notes::native { bb::fr compute_nullifier(grumpkin::fq const& note_commitment, grumpkin::fr const& account_private_key, const bool is_note_in_use); -} // namespace native -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::native diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/create_partial_commitment.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/create_partial_commitment.hpp index 56829f92006..3ffdeca198b 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/create_partial_commitment.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/create_partial_commitment.hpp @@ -4,15 +4,15 @@ #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace join_split_example::proofs::notes::native::value { +namespace bb::join_split_example::proofs::notes::native::value { inline auto create_partial_commitment(bb::fr const& secret, grumpkin::g1::affine_element const& owner, bool account_required, bb::fr const& creator_pubkey) { - return crypto::pedersen_hash::hash({ secret, owner.x, owner.y, account_required, creator_pubkey }, - GeneratorIndex::VALUE_NOTE_PARTIAL_COMMITMENT); + return bb::crypto::pedersen_hash::hash({ secret, owner.x, owner.y, account_required, creator_pubkey }, + GeneratorIndex::VALUE_NOTE_PARTIAL_COMMITMENT); } -} // namespace join_split_example::proofs::notes::native::value +} // namespace bb::join_split_example::proofs::notes::native::value diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/value_note.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/value_note.hpp index 4010f060f84..4912fa22cab 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/value_note.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/notes/native/value/value_note.hpp @@ -5,11 +5,7 @@ #include "complete_partial_commitment.hpp" #include "create_partial_commitment.hpp" -namespace join_split_example { -namespace proofs { -namespace notes { -namespace native { -namespace value { +namespace bb::join_split_example::proofs::notes::native::value { using namespace bb; @@ -63,8 +59,4 @@ inline void write(std::vector& buf, value_note const& note) write(buf, note.input_nullifier); } -} // namespace value -} // namespace native -} // namespace notes -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs::notes::native::value diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp index 9d48d13f06b..ba78fba3a5b 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/proofs/verify.hpp @@ -5,8 +5,7 @@ #include "barretenberg/stdlib/recursion/aggregation_state/aggregation_state.hpp" #include "barretenberg/stdlib/recursion/verifier/verifier.hpp" -namespace join_split_example { -namespace proofs { +namespace bb::join_split_example::proofs { template struct verify_result { verify_result() @@ -70,5 +69,4 @@ auto verify_logic_internal(Builder& builder, Tx& tx, CircuitData const& cd, char return result; } -} // namespace proofs -} // namespace join_split_example +} // namespace bb::join_split_example::proofs diff --git a/barretenberg/cpp/src/barretenberg/join_split_example/types.hpp b/barretenberg/cpp/src/barretenberg/join_split_example/types.hpp index 7d419cef5d0..8b6bedca204 100644 --- a/barretenberg/cpp/src/barretenberg/join_split_example/types.hpp +++ b/barretenberg/cpp/src/barretenberg/join_split_example/types.hpp @@ -15,7 +15,7 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include "barretenberg/stdlib/primitives/witness/witness.hpp" -namespace join_split_example { +namespace bb::join_split_example { using Builder = bb::UltraCircuitBuilder; using Composer = plonk::UltraComposer; @@ -43,4 +43,4 @@ namespace schnorr { using signature_bits = bb::stdlib::schnorr::signature_bits; } // namespace schnorr -} // namespace join_split_example \ No newline at end of file +} // namespace bb::join_split_example \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp index e99f9a2144c..6a201015921 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/standard_composer.test.cpp @@ -5,7 +5,6 @@ #include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" #include -using namespace bb; using namespace bb; using namespace bb::plonk; diff --git a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp index 0a5dea87edc..47305d32389 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/composer/ultra_composer.test.cpp @@ -9,7 +9,6 @@ #include "barretenberg/proof_system/plookup_tables/sha256.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" -using namespace bb; using namespace bb; using namespace bb::plonk; diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp index 9353566f712..70a71190761 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/proving_key/proving_key.test.cpp @@ -11,7 +11,6 @@ #include #endif -using namespace bb; using namespace bb; using namespace bb::plonk; diff --git a/barretenberg/cpp/src/barretenberg/plonk/transcript/transcript.cpp b/barretenberg/cpp/src/barretenberg/plonk/transcript/transcript.cpp index 5447a0480a6..168ad725aff 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/transcript/transcript.cpp +++ b/barretenberg/cpp/src/barretenberg/plonk/transcript/transcript.cpp @@ -46,7 +46,7 @@ std::array Keccak256Hasher::hash(std std::array Blake3sHasher::hash(std::vector const& buffer) { grumpkin::fq input = grumpkin::fq::serialize_from_buffer(&buffer[0]); - grumpkin::fq hashed = crypto::pedersen_hash::hash({ input }); + grumpkin::fq hashed = bb::crypto::pedersen_hash::hash({ input }); std::vector res = to_buffer(hashed); std::array result; for (size_t i = 0; i < PRNG_OUTPUT_SIZE; ++i) { @@ -217,7 +217,7 @@ void Transcript::apply_fiat_shamir(const std::string& challenge_name /*, const b break; } case HashType::PedersenBlake3s: { - std::vector hashed_buffer = to_buffer(crypto::pedersen_hash::hash_buffer(buffer)); + std::vector hashed_buffer = to_buffer(bb::crypto::pedersen_hash::hash_buffer(buffer)); base_hash = Blake3sHasher::hash(hashed_buffer); break; } diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp index 84a6b0b5105..428409bf73f 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp @@ -6,7 +6,7 @@ #include using namespace bb; -using namespace crypto; +using namespace bb::crypto; namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.test.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.test.cpp index 9a05d8fea16..7b3ab977ae4 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.test.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/standard_circuit_builder.test.cpp @@ -3,7 +3,6 @@ #include "barretenberg/crypto/pedersen_commitment/pedersen.hpp" #include -using namespace bb; using namespace bb; namespace { diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/aes128.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/aes128.hpp index 3306338e9b9..f3102bbfd18 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/aes128.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/aes128.hpp @@ -8,8 +8,7 @@ #include "sparse.hpp" #include "types.hpp" -namespace plookup { -namespace aes128_tables { +namespace bb::plookup::aes128_tables { static constexpr uint64_t AES_BASE = 9; static constexpr uint64_t aes_normalization_table[AES_BASE]{ 1, 0, 0, 0, 0, 0, 0, 0, 0, @@ -127,7 +126,7 @@ inline MultiTable get_aes_input_table(const MultiTableId id = AES_INPUT) inline std::array get_aes_sbox_values_from_key(const std::array key) { const auto byte = numeric::map_from_sparse_form(key[0]); - uint8_t sbox_value = crypto::aes128::sbox[(uint8_t)byte]; + uint8_t sbox_value = crypto::aes128_sbox[(uint8_t)byte]; uint8_t swizzled = ((uint8_t)(sbox_value << 1) ^ (uint8_t)(((sbox_value >> 7) & 1) * 0x1b)); return { bb::fr(numeric::map_into_sparse_form(sbox_value)), bb::fr(numeric::map_into_sparse_form((uint8_t)(sbox_value ^ swizzled))) }; @@ -142,7 +141,7 @@ inline BasicTable generate_aes_sbox_table(BasicTableId id, const size_t table_in table.use_twin_keys = false; for (uint64_t i = 0; i < table.size; ++i) { const auto first = numeric::map_into_sparse_form((uint8_t)i); - uint8_t sbox_value = crypto::aes128::sbox[(uint8_t)i]; + uint8_t sbox_value = crypto::aes128_sbox[(uint8_t)i]; uint8_t swizzled = ((uint8_t)(sbox_value << 1) ^ (uint8_t)(((sbox_value >> 7) & 1) * 0x1b)); const auto second = numeric::map_into_sparse_form(sbox_value); const auto third = numeric::map_into_sparse_form((uint8_t)(sbox_value ^ swizzled)); @@ -173,5 +172,4 @@ inline MultiTable get_aes_sbox_table(const MultiTableId id = AES_SBOX) } return table; } -} // namespace aes128_tables -} // namespace plookup +} // namespace bb::plookup::aes128_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/blake2s.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/blake2s.hpp index 4cea760b45e..10a56396e6b 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/blake2s.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/blake2s.hpp @@ -5,8 +5,7 @@ #include "sparse.hpp" #include "types.hpp" -namespace plookup { -namespace blake2s_tables { +namespace bb::plookup::blake2s_tables { static constexpr size_t BITS_IN_LAST_SLICE = 5UL; static constexpr size_t SIZE_OF_LAST_SLICE = (1UL << BITS_IN_LAST_SLICE); @@ -212,5 +211,4 @@ inline MultiTable get_blake2s_xor_rotate_7_table(const MultiTableId id = BLAKE_X return table; } -} // namespace blake2s_tables -} // namespace plookup +} // namespace bb::plookup::blake2s_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/dummy.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/dummy.hpp index 50ba5fa83f8..f49409c9bbc 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/dummy.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/dummy.hpp @@ -9,8 +9,7 @@ #include "types.hpp" -namespace plookup { -namespace dummy_tables { +namespace bb::plookup::dummy_tables { /** * @brief Lookup the value corresponding to a specific key @@ -93,5 +92,4 @@ inline MultiTable get_honk_dummy_multitable() table.get_table_values.emplace_back(&get_value_from_key); return table; } -} // namespace dummy_tables -} // namespace plookup \ No newline at end of file +} // namespace bb::plookup::dummy_tables \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.cpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.cpp index 1309aafb5d5..6a470eb835c 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.cpp @@ -6,7 +6,7 @@ #include "barretenberg/numeric/bitop/pow.hpp" #include "barretenberg/numeric/bitop/rotate.hpp" #include "barretenberg/numeric/bitop/sparse_form.hpp" -namespace plookup::fixed_base { +namespace bb::plookup::fixed_base { /** * @brief Given a base_point [P] and an offset_generator [G], compute a lookup table of MAX_TABLE_SIZE that contains the @@ -287,4 +287,4 @@ const std::array table::generate_generator_offset(rhs_base_point_hi), }; -} // namespace plookup::fixed_base \ No newline at end of file +} // namespace bb::plookup::fixed_base \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp index d147b3e9074..11922a0433d 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp @@ -6,7 +6,7 @@ #include "barretenberg/crypto/pedersen_hash/pedersen.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" -namespace plookup::fixed_base { +namespace bb::plookup::fixed_base { /** * @brief Generates plookup tables required to perform fixed-base scalar multiplication over a fixed number of points. @@ -84,4 +84,4 @@ class table : public FixedBaseParams { } }; -} // namespace plookup::fixed_base +} // namespace bb::plookup::fixed_base diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base_params.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base_params.hpp index 45570b50f23..94f7a7d9414 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base_params.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/fixed_base/fixed_base_params.hpp @@ -6,7 +6,7 @@ #include #include -namespace plookup { +namespace bb::plookup { /** * @brief Parameters definitions for our fixed-base-scalar-multiplication lookup tables * @@ -73,4 +73,4 @@ struct FixedBaseParams { return MULTI_TABLE_BIT_LENGTHS[multitable_index]; } }; -} // namespace plookup \ No newline at end of file +} // namespace bb::plookup \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_chi.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_chi.hpp index f1a75bd3150..0e5b4a8a5c3 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_chi.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_chi.hpp @@ -4,8 +4,7 @@ #include "barretenberg/common/constexpr_utils.hpp" #include "barretenberg/numeric/bitop/pow.hpp" -namespace plookup { -namespace keccak_tables { +namespace bb::plookup::keccak_tables { /** * @brief Generates plookup tables required for CHI round of Keccak hash function @@ -249,5 +248,4 @@ class Chi { return table; } }; -} // namespace keccak_tables -} // namespace plookup +} // namespace bb::plookup::keccak_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_input.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_input.hpp index 8fdc116f99f..c3b6d20ae98 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_input.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_input.hpp @@ -5,8 +5,7 @@ #include "barretenberg/numeric/bitop/pow.hpp" #include "barretenberg/numeric/bitop/sparse_form.hpp" -namespace plookup { -namespace keccak_tables { +namespace bb::plookup::keccak_tables { /** * @brief Generates plookup tables used convert 64-bit integers into a sparse representation used for Keccak hash @@ -140,5 +139,4 @@ class KeccakInput { } }; -} // namespace keccak_tables -} // namespace plookup +} // namespace bb::plookup::keccak_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_output.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_output.hpp index 6c5d57429b8..53f2fc9a53f 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_output.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_output.hpp @@ -7,8 +7,7 @@ #include "../sparse.hpp" #include "../types.hpp" -namespace plookup { -namespace keccak_tables { +namespace bb::plookup::keccak_tables { /** * @brief Converts a base-11 sparse integer representation into a regular base-2 binary integer. @@ -171,5 +170,4 @@ class KeccakOutput { } }; -} // namespace keccak_tables -} // namespace plookup +} // namespace bb::plookup::keccak_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_rho.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_rho.hpp index 96dd0f99ff6..c16085aca8a 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_rho.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_rho.hpp @@ -4,8 +4,7 @@ #include "barretenberg/common/constexpr_utils.hpp" #include "barretenberg/numeric/bitop/pow.hpp" -namespace plookup { -namespace keccak_tables { +namespace bb::plookup::keccak_tables { /** * @brief Generate the plookup tables used for the RHO round of the Keccak hash algorithm @@ -292,5 +291,4 @@ template class Rho { } }; -} // namespace keccak_tables -} // namespace plookup +} // namespace bb::plookup::keccak_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_theta.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_theta.hpp index c9137f0b3dc..9f05cf94267 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_theta.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/keccak/keccak_theta.hpp @@ -4,8 +4,7 @@ #include "barretenberg/common/constexpr_utils.hpp" #include "barretenberg/numeric/bitop/pow.hpp" -namespace plookup { -namespace keccak_tables { +namespace bb::plookup::keccak_tables { /** * @brief Generates plookup tables required for THETA round of Keccak hash function @@ -251,5 +250,4 @@ class Theta { return table; } }; -} // namespace keccak_tables -} // namespace plookup +} // namespace bb::plookup::keccak_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.cpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.cpp index 3e12005d314..ed172573e24 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.cpp @@ -1,7 +1,6 @@ #include "non_native_group_generator.hpp" -namespace plookup { -namespace ecc_generator_tables { +namespace bb::plookup::ecc_generator_tables { /** * Init 8-bit generator lookup tables @@ -488,5 +487,4 @@ MultiTable ecc_generator_table::get_xyprime_endo_table(const MultiTableId id template class ecc_generator_table; template class ecc_generator_table; -} // namespace ecc_generator_tables -} // namespace plookup \ No newline at end of file +} // namespace bb::plookup::ecc_generator_tables \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.hpp index 16fd12a8686..b57e9247e65 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/non_native_group_generator.hpp @@ -6,8 +6,7 @@ #include "barretenberg/ecc/curves/secp256k1/secp256k1.hpp" #include -namespace plookup { -namespace ecc_generator_tables { +namespace bb::plookup::ecc_generator_tables { template class ecc_generator_table { public: @@ -56,5 +55,4 @@ template class ecc_generator_table { static MultiTable get_xyprime_endo_table(const MultiTableId id, const BasicTableId basic_id); }; -} // namespace ecc_generator_tables -} // namespace plookup +} // namespace bb::plookup::ecc_generator_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.cpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.cpp index c8f1f83de00..6a2257bf102 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.cpp @@ -1,7 +1,7 @@ #include "plookup_tables.hpp" #include "barretenberg/common/constexpr_utils.hpp" -namespace plookup { +namespace bb::plookup { using namespace bb; @@ -201,4 +201,4 @@ ReadData get_lookup_accumulators(const MultiTableId id, return lookup; } -} // namespace plookup +} // namespace bb::plookup diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.hpp index b4fcaeac1a1..492793150d3 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/plookup_tables.hpp @@ -16,7 +16,7 @@ #include "types.hpp" #include "uint.hpp" -namespace plookup { +namespace bb::plookup { const MultiTable& create_table(MultiTableId id); @@ -213,4 +213,4 @@ inline BasicTable create_basic_table(const BasicTableId id, const size_t index) } } } -} // namespace plookup +} // namespace bb::plookup diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sha256.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sha256.hpp index 31316ae56d7..02465bc15d8 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sha256.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sha256.hpp @@ -8,8 +8,7 @@ #include "sparse.hpp" #include "types.hpp" -namespace plookup { -namespace sha256_tables { +namespace bb::plookup::sha256_tables { static constexpr uint64_t choose_normalization_table[28]{ /* xor result = 0 */ @@ -390,5 +389,4 @@ inline MultiTable get_majority_input_table(const MultiTableId id = SHA256_MAJ_IN return table; } -} // namespace sha256_tables -} // namespace plookup +} // namespace bb::plookup::sha256_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sparse.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sparse.hpp index 5664c8cb4fa..35c858e30a3 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sparse.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/sparse.hpp @@ -7,8 +7,7 @@ #include "barretenberg/numeric/bitop/rotate.hpp" #include "barretenberg/numeric/bitop/sparse_form.hpp" -namespace plookup { -namespace sparse_tables { +namespace bb::plookup::sparse_tables { template inline std::array get_sparse_table_with_rotation_values(const std::array key) @@ -115,5 +114,4 @@ inline BasicTable generate_sparse_normalization_table(BasicTableId id, const siz table.column_3_step_size = bb::fr(0); return table; } -} // namespace sparse_tables -} // namespace plookup +} // namespace bb::plookup::sparse_tables diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/types.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/types.hpp index 181844ea163..489d9e60071 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/types.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/types.hpp @@ -6,7 +6,7 @@ #include "./fixed_base/fixed_base_params.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" -namespace plookup { +namespace bb::plookup { enum BasicTableId { XOR, @@ -325,4 +325,4 @@ template class ReadData { std::array, 3> columns; }; -} // namespace plookup +} // namespace bb::plookup diff --git a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/uint.hpp b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/uint.hpp index dcf02fe79f7..1ccfecdd2a5 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/uint.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/plookup_tables/uint.hpp @@ -4,8 +4,7 @@ #include "barretenberg/numeric/bitop/rotate.hpp" -namespace plookup { -namespace uint_tables { +namespace bb::plookup::uint_tables { template inline std::array get_xor_rotate_values_from_key(const std::array key) @@ -103,5 +102,4 @@ inline MultiTable get_uint32_and_table(const MultiTableId id = UINT32_AND) return table; } -} // namespace uint_tables -} // namespace plookup +} // namespace bb::plookup::uint_tables diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp b/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp index fd3b98ddd15..60babafb2d6 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp +++ b/barretenberg/cpp/src/barretenberg/smt_verification/smt_examples.test.cpp @@ -8,7 +8,6 @@ #include "barretenberg/smt_verification/circuit/circuit.hpp" -using namespace bb; using namespace bb; namespace { diff --git a/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp b/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp index 61048a44469..e24e469afcd 100644 --- a/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp +++ b/barretenberg/cpp/src/barretenberg/smt_verification/smt_polynomials.test.cpp @@ -13,7 +13,6 @@ #include "barretenberg/serialize/cbind.hpp" #include "barretenberg/smt_verification/circuit/circuit.hpp" -using namespace bb; using namespace bb; using namespace smt_circuit; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp index 003ab78e3b2..232e21c1cc3 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/encryption/aes128/aes128.cpp @@ -7,11 +7,11 @@ #include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp" #include "barretenberg/stdlib/primitives/plookup/plookup.hpp" -using namespace crypto::aes128; +using namespace bb::crypto; namespace bb::stdlib::aes128 { template using byte_pair = std::pair, field_t>; -using namespace plookup; +using namespace bb::plookup; constexpr uint32_t AES128_BASE = 9; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp index 418f601e146..25a65a5abbc 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/blake2s/blake_util.hpp @@ -6,7 +6,7 @@ namespace bb::stdlib::blake_util { -using namespace plookup; +using namespace bb::plookup; // constants enum blake_constant { BLAKE3_STATE_SIZE = 16 }; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp index 3f10f28b9c3..2392853e335 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/keccak/keccak.cpp @@ -5,7 +5,7 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" namespace bb::stdlib { -using namespace plookup; +using namespace bb::plookup; /** * @brief Normalize a base-11 limb and left-rotate by keccak::ROTATIONS[lane_index] bits. diff --git a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp index cb16d9f89cc..bffa757acd7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/hash/sha256/sha256_plookup.cpp @@ -11,7 +11,7 @@ using namespace bb; namespace bb::stdlib::sha256_plookup { -using namespace plookup; +using namespace bb::plookup; namespace internal { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp index 6561525428f..aaaa1a07506 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp @@ -9,7 +9,6 @@ #include "barretenberg/stdlib/primitives/curves/secp256k1.hpp" #include "barretenberg/stdlib/primitives/curves/secp256r1.hpp" -namespace test_stdlib_biggroup { namespace { auto& engine = numeric::random::get_debug_engine(); } @@ -1028,4 +1027,3 @@ HEAVY_TYPED_TEST(stdlib_biggroup, ecdsa_mul_secp256k1) GTEST_SKIP(); } } -} // namespace test_stdlib_biggroup diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.test.cpp index 2d6a147ea9d..a88c0b5c82c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_goblin.test.cpp @@ -9,7 +9,6 @@ #include "barretenberg/numeric/random/engine.hpp" #include -namespace test_stdlib_biggroup_goblin { namespace { auto& engine = numeric::random::get_debug_engine(); } @@ -85,4 +84,3 @@ HEAVY_TYPED_TEST(stdlib_biggroup_goblin, batch_mul) { TestFixture::test_goblin_style_batch_mul(); } -} // namespace test_stdlib_biggroup_goblin diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp index b1427d77276..ca1e082d04d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp @@ -9,12 +9,10 @@ construction in stdlib and contains macros for explicit instantiation. #pragma once #include -namespace bb::honk { -namespace flavor { +namespace bb::honk::flavor { class Standard; class Ultra; -} // namespace flavor -} // namespace bb::honk +} // namespace bb::honk::flavor namespace bb { class Bn254FrParams; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp index 2620e827c47..f09630c53c7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/plookup/plookup.test.cpp @@ -9,9 +9,8 @@ #include "barretenberg/stdlib/primitives/uint/uint.hpp" #include -namespace test_stdlib_plookups { using namespace bb; -using namespace plookup; +using namespace bb::plookup; // Defining ultra-specific types for local testing. using Builder = bb::UltraCircuitBuilder; @@ -605,5 +604,3 @@ TEST(stdlib_plookup, secp256k1_generator) bool proof_result = builder.check_circuit(); EXPECT_EQ(proof_result, true); } - -} // namespace test_stdlib_plookups diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp index bd42fd7b40b..e9e2960b775 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/plookup/logic.cpp @@ -5,7 +5,7 @@ using namespace bb; namespace bb::stdlib { -using namespace plookup; +using namespace bb::plookup; template uint_plookup uint_plookup::operator&(const uint_plookup& other) const diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp index a075df2e662..4e89a42c0cb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/uint/uint.test.cpp @@ -3,7 +3,6 @@ #include #include -using namespace bb; using namespace bb; namespace { diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp index 87ece52bb3f..4651a5b7e6a 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/protogalaxy.test.cpp @@ -23,7 +23,6 @@ using PowPolynomial = bb::PowPolynomial; const size_t NUM_POLYNOMIALS = Flavor::NUM_ALL_ENTITIES; -namespace bb::protogalaxy_tests { namespace { auto& engine = numeric::random::get_debug_engine(); } @@ -163,7 +162,7 @@ TEST_F(ProtoGalaxyTests, PerturbatorPolynomial) } // Construct pow(\vec{betas}) as in the paper - auto pow_beta = PowPolynomial(betas); + auto pow_beta = bb::PowPolynomial(betas); pow_beta.compute_values(); // Compute the corresponding target sum and create a dummy accumulator @@ -230,7 +229,7 @@ TEST_F(ProtoGalaxyTests, CombineRelationParameters) Instances instances{ { instance1, instance2 } }; ProtoGalaxyProver::combine_relation_parameters(instances); - Univariate expected_eta{ { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 } }; + bb::Univariate expected_eta{ { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 } }; EXPECT_EQ(instances.relation_parameters.eta, expected_eta); } @@ -251,7 +250,7 @@ TEST_F(ProtoGalaxyTests, CombineAlpha) Instances instances{ { instance1, instance2 } }; ProtoGalaxyProver::combine_alpha(instances); - Univariate expected_alpha{ { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26 } }; + bb::Univariate expected_alpha{ { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26 } }; for (const auto& alpha : instances.alphas) { EXPECT_EQ(alpha, expected_alpha); } @@ -346,6 +345,4 @@ TEST_F(ProtoGalaxyTests, TamperedAccumulatorPolynomial) auto second_accumulator = fold_and_verify(instances, composer, false); decide_and_verify(second_accumulator, composer, false); -} - -} // namespace bb::protogalaxy_tests \ No newline at end of file +} \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp index 7b86527e588..28e780ca913 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp @@ -14,8 +14,6 @@ using namespace bb::honk; -namespace test_honk_relations { - void ensure_non_zero(auto& polynomial) { bool has_non_zero_coefficient = false; @@ -127,21 +125,23 @@ template void create_some_lookup_gates(auto& circuit_builder) using FF = typename Flavor::FF; // Add some lookup gates (related to pedersen hashing) auto pedersen_input_value = FF::random_element(); - const auto input_hi = - uint256_t(pedersen_input_value) - .slice(plookup::fixed_base::table::BITS_PER_LO_SCALAR, - plookup::fixed_base::table::BITS_PER_LO_SCALAR + plookup::fixed_base::table::BITS_PER_HI_SCALAR); - const auto input_lo = uint256_t(pedersen_input_value).slice(0, plookup::fixed_base::table::BITS_PER_LO_SCALAR); + const auto input_hi = uint256_t(pedersen_input_value) + .slice(bb::plookup::fixed_base::table::BITS_PER_LO_SCALAR, + bb::plookup::fixed_base::table::BITS_PER_LO_SCALAR + + bb::plookup::fixed_base::table::BITS_PER_HI_SCALAR); + const auto input_lo = uint256_t(pedersen_input_value).slice(0, bb::plookup::fixed_base::table::BITS_PER_LO_SCALAR); const auto input_hi_index = circuit_builder.add_variable(input_hi); const auto input_lo_index = circuit_builder.add_variable(input_lo); - const auto sequence_data_hi = plookup::get_lookup_accumulators(plookup::MultiTableId::FIXED_BASE_LEFT_HI, input_hi); - const auto sequence_data_lo = plookup::get_lookup_accumulators(plookup::MultiTableId::FIXED_BASE_LEFT_LO, input_lo); + const auto sequence_data_hi = + bb::plookup::get_lookup_accumulators(bb::plookup::MultiTableId::FIXED_BASE_LEFT_HI, input_hi); + const auto sequence_data_lo = + bb::plookup::get_lookup_accumulators(bb::plookup::MultiTableId::FIXED_BASE_LEFT_LO, input_lo); circuit_builder.create_gates_from_plookup_accumulators( - plookup::MultiTableId::FIXED_BASE_LEFT_HI, sequence_data_hi, input_hi_index); + bb::plookup::MultiTableId::FIXED_BASE_LEFT_HI, sequence_data_hi, input_hi_index); circuit_builder.create_gates_from_plookup_accumulators( - plookup::MultiTableId::FIXED_BASE_LEFT_LO, sequence_data_lo, input_lo_index); + bb::plookup::MultiTableId::FIXED_BASE_LEFT_LO, sequence_data_lo, input_lo_index); } template void create_some_genperm_sort_gates(auto& circuit_builder) @@ -1180,5 +1180,3 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorNonNativeRelationCorrectness) // Check that Non-Native Field relation is satisfied across each row of the prover polynomials check_relation>(circuit_size, prover_polynomials, params); } - -} // namespace test_honk_relations diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp index ab2cb1141cb..5036322b497 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp @@ -20,8 +20,6 @@ using namespace bb::honk::sumcheck; using Flavor = bb::honk::flavor::Ultra; using FF = typename Flavor::FF; -namespace test_sumcheck_round { - class SumcheckTestsRealCircuit : public ::testing::Test { protected: static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); } @@ -65,21 +63,23 @@ TEST_F(SumcheckTestsRealCircuit, Ultra) // Add some lookup gates (related to pedersen hashing) auto pedersen_input_value = FF::random_element(); - const FF input_hi = - uint256_t(pedersen_input_value) - .slice(plookup::fixed_base::table::BITS_PER_LO_SCALAR, - plookup::fixed_base::table::BITS_PER_LO_SCALAR + plookup::fixed_base::table::BITS_PER_HI_SCALAR); - const FF input_lo = uint256_t(pedersen_input_value).slice(0, plookup::fixed_base::table::BITS_PER_LO_SCALAR); + const FF input_hi = uint256_t(pedersen_input_value) + .slice(bb::plookup::fixed_base::table::BITS_PER_LO_SCALAR, + bb::plookup::fixed_base::table::BITS_PER_LO_SCALAR + + bb::plookup::fixed_base::table::BITS_PER_HI_SCALAR); + const FF input_lo = uint256_t(pedersen_input_value).slice(0, bb::plookup::fixed_base::table::BITS_PER_LO_SCALAR); const auto input_hi_index = builder.add_variable(input_hi); const auto input_lo_index = builder.add_variable(input_lo); - const auto sequence_data_hi = plookup::get_lookup_accumulators(plookup::MultiTableId::FIXED_BASE_LEFT_HI, input_hi); - const auto sequence_data_lo = plookup::get_lookup_accumulators(plookup::MultiTableId::FIXED_BASE_LEFT_LO, input_lo); + const auto sequence_data_hi = + bb::plookup::get_lookup_accumulators(bb::plookup::MultiTableId::FIXED_BASE_LEFT_HI, input_hi); + const auto sequence_data_lo = + bb::plookup::get_lookup_accumulators(bb::plookup::MultiTableId::FIXED_BASE_LEFT_LO, input_lo); builder.create_gates_from_plookup_accumulators( - plookup::MultiTableId::FIXED_BASE_LEFT_HI, sequence_data_hi, input_hi_index); + bb::plookup::MultiTableId::FIXED_BASE_LEFT_HI, sequence_data_hi, input_hi_index); builder.create_gates_from_plookup_accumulators( - plookup::MultiTableId::FIXED_BASE_LEFT_LO, sequence_data_lo, input_lo_index); + bb::plookup::MultiTableId::FIXED_BASE_LEFT_LO, sequence_data_lo, input_lo_index); // Add a sort gate (simply checks that consecutive inputs have a difference of < 4) a_idx = builder.add_variable(FF(0)); @@ -200,5 +200,3 @@ TEST_F(SumcheckTestsRealCircuit, Ultra) ASSERT_TRUE(verified); } - -} // namespace test_sumcheck_round diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp index 3ab5595dcdd..fed8e874026 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.test.cpp @@ -16,10 +16,9 @@ #include #include +using namespace bb; using namespace bb::honk; -namespace test_ultra_honk_composer { - namespace { auto& engine = numeric::random::get_debug_engine(); } @@ -890,6 +889,4 @@ TEST_F(UltraHonkComposerTests, range_constraint_small_variable) auto composer = UltraComposer(); prove_and_verify(circuit_builder, composer, /*expected_result=*/true); -} - -} // namespace test_ultra_honk_composer \ No newline at end of file +} \ No newline at end of file