From 279be2b37bbc97b883a2022e6cabb01175eaf34a Mon Sep 17 00:00:00 2001 From: koe Date: Thu, 8 Feb 2024 15:17:39 -0600 Subject: [PATCH] rebase fixes --- external/randomx | 2 +- external/trezor-common | 2 +- external/unbound | 1 + src/crypto/generators.cpp | 37 ----------------------------- src/seraphis_crypto/sp_transcript.h | 2 +- tests/performance_tests/main.cpp | 12 ++++------ tests/unit_tests/crypto.cpp | 17 ------------- 7 files changed, 9 insertions(+), 64 deletions(-) create mode 160000 external/unbound diff --git a/external/randomx b/external/randomx index 261d58c77f..102f8acf90 160000 --- a/external/randomx +++ b/external/randomx @@ -1 +1 @@ -Subproject commit 261d58c77fc5547c0aa7fdfeb58421ba7e0e6e1c +Subproject commit 102f8acf90a7649ada410de5499a7ec62e49e1da diff --git a/external/trezor-common b/external/trezor-common index bff7fdfe43..bc28c316d0 160000 --- a/external/trezor-common +++ b/external/trezor-common @@ -1 +1 @@ -Subproject commit bff7fdfe436c727982cc553bdfb29a9021b423b0 +Subproject commit bc28c316d05bf1e9ebfe3d7df1ab25831d98d168 diff --git a/external/unbound b/external/unbound new file mode 160000 index 0000000000..0f6c0579d6 --- /dev/null +++ b/external/unbound @@ -0,0 +1 @@ +Subproject commit 0f6c0579d66b65f86066e30e7876105ba2775ef4 diff --git a/src/crypto/generators.cpp b/src/crypto/generators.cpp index 8930746edc..df4e182bb9 100644 --- a/src/crypto/generators.cpp +++ b/src/crypto/generators.cpp @@ -72,12 +72,6 @@ constexpr public_key G = bytes_to({ 0x58, 0x66, 0x66, 0x66, 0x66, 0x //pedersen commitment generator H: toPoint(cn_fast_hash(G)) constexpr public_key H = bytes_to({ 0x8b, 0x65, 0x59, 0x70, 0x15, 0x37, 0x99, 0xaf, 0x2a, 0xea, 0xdc, 0x9f, 0xf1, 0xad, 0xd0, 0xea, 0x6c, 0x72, 0x51, 0xd5, 0x41, 0x54, 0xcf, 0xa9, 0x2c, 0x17, 0x3a, 0x0d, 0xd3, 0x9c, 0x1f, 0x94 }); -<<<<<<< HEAD -static ge_p3 G_p3; -static ge_p3 H_p3; -static ge_cached G_cached; -static ge_cached H_cached; -======= //seraphis generator X: keccak_to_pt(keccak("seraphis_X")) constexpr public_key X = bytes_to({ 0xa4, 0xfb, 0x43, 0xca, 0x69, 0x5e, 0x12, 0x99, 0x88, 0x02, 0xa2, 0x0a, 0x15, 0x8f, 0x12, 0xea, 0x79, 0x47, 0x4f, 0xb9, 0x01, 0x21, 0x16, 0x95, 0x6a, 0x69, 0x76, 0x7c, 0x4d, 0x41, 0x11, 0x0f }); @@ -94,14 +88,11 @@ static ge_cached X_cached; static ge_cached U_cached; //X25519 generator: x = 9 static const x25519_pubkey x25519_G{ mx25519_pubkey{ .data = { 9 } } }; ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) // misc static std::once_flag init_gens_once_flag; //------------------------------------------------------------------------------------------------------------------- -<<<<<<< HEAD -======= // hash-to-point: H_p(x) = 8*point_from_bytes(keccak(x)) //------------------------------------------------------------------------------------------------------------------- static void hash_to_point(const hash &x, crypto::ec_point &point_out) @@ -118,7 +109,6 @@ static void hash_to_point(const hash &x, crypto::ec_point &point_out) ge_p3_tobytes(to_bytes(point_out), &temp_p3); } //------------------------------------------------------------------------------------------------------------------- ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) //------------------------------------------------------------------------------------------------------------------- static public_key reproduce_generator_G() { @@ -162,8 +152,6 @@ static public_key reproduce_generator_H() return reproduced_H; } //------------------------------------------------------------------------------------------------------------------- -<<<<<<< HEAD -======= //------------------------------------------------------------------------------------------------------------------- static public_key reproduce_generator_X() { @@ -188,7 +176,6 @@ static public_key reproduce_generator_U() return reproduced_U; } //------------------------------------------------------------------------------------------------------------------- ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) // Make generators, but only once //------------------------------------------------------------------------------------------------------------------- static void init_gens() @@ -199,20 +186,12 @@ static void init_gens() // sanity check the generators static_assert(static_cast(G.data[0]) == 0x58, "compile-time constant sanity check"); static_assert(static_cast(H.data[0]) == 0x8b, "compile-time constant sanity check"); -<<<<<<< HEAD -======= static_assert(static_cast(X.data[0]) == 0xa4, "compile-time constant sanity check"); static_assert(static_cast(U.data[0]) == 0x10, "compile-time constant sanity check"); ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) // build ge_p3 representations of generators const int G_deserialize = ge_frombytes_vartime(&G_p3, to_bytes(G)); const int H_deserialize = ge_frombytes_vartime(&H_p3, to_bytes(H)); -<<<<<<< HEAD - - (void)G_deserialize; assert(G_deserialize == 0); - (void)H_deserialize; assert(H_deserialize == 0); -======= const int X_deserialize = ge_frombytes_vartime(&X_p3, to_bytes(X)); const int U_deserialize = ge_frombytes_vartime(&U_p3, to_bytes(U)); @@ -220,25 +199,18 @@ static void init_gens() (void)H_deserialize; assert(H_deserialize == 0); (void)X_deserialize; assert(X_deserialize == 0); (void)U_deserialize; assert(U_deserialize == 0); ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) // get cached versions ge_p3_to_cached(&G_cached, &G_p3); ge_p3_to_cached(&H_cached, &H_p3); -<<<<<<< HEAD -======= ge_p3_to_cached(&X_cached, &X_p3); ge_p3_to_cached(&U_cached, &U_p3); ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) // in debug mode, check that generators are reproducible (void)reproduce_generator_G; assert(reproduce_generator_G() == G); (void)reproduce_generator_H; assert(reproduce_generator_H() == H); -<<<<<<< HEAD -======= (void)reproduce_generator_X; assert(reproduce_generator_X() == X); (void)reproduce_generator_U; assert(reproduce_generator_U() == U); ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) }); } @@ -253,8 +225,6 @@ public_key get_H() return H; } //------------------------------------------------------------------------------------------------------------------- -<<<<<<< HEAD -======= public_key get_X() { return X; @@ -265,7 +235,6 @@ public_key get_U() return U; } //------------------------------------------------------------------------------------------------------------------- ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) ge_p3 get_G_p3() { init_gens(); @@ -278,8 +247,6 @@ ge_p3 get_H_p3() return H_p3; } //------------------------------------------------------------------------------------------------------------------- -<<<<<<< HEAD -======= ge_p3 get_X_p3() { init_gens(); @@ -292,7 +259,6 @@ ge_p3 get_U_p3() return U_p3; } //------------------------------------------------------------------------------------------------------------------- ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) ge_cached get_G_cached() { init_gens(); @@ -305,8 +271,6 @@ ge_cached get_H_cached() return H_cached; } //------------------------------------------------------------------------------------------------------------------- -<<<<<<< HEAD -======= ge_cached get_X_cached() { init_gens(); @@ -324,5 +288,4 @@ x25519_pubkey get_x25519_G() return x25519_G; } //------------------------------------------------------------------------------------------------------------------- ->>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history) } //namespace crypto diff --git a/src/seraphis_crypto/sp_transcript.h b/src/seraphis_crypto/sp_transcript.h index 4ec90b0f89..17db163d64 100644 --- a/src/seraphis_crypto/sp_transcript.h +++ b/src/seraphis_crypto/sp_transcript.h @@ -275,7 +275,7 @@ class SpTranscriptBuilder final std::enable_if_t::value, bool> = true> void append_impl(const boost::string_ref label, const T signed_integer) { - using unsigned_type = std::make_unsigned::type; + using unsigned_type = typename std::make_unsigned::type; static_assert(sizeof(unsigned_type) <= sizeof(std::uint64_t), "SpTranscriptBuilder: unsupported signed integer type."); this->append_label(label); diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp index f1dfae9ef7..7cc9bef705 100644 --- a/tests/performance_tests/main.cpp +++ b/tests/performance_tests/main.cpp @@ -110,14 +110,12 @@ int main(int argc, char** argv) const std::string filter = tools::glob_to_regex(command_line::get_arg(vm, arg_filter)); const std::string timings_database = command_line::get_arg(vm, arg_timings_database); - Params core_params; + ParamsShuttle p; if (!timings_database.empty()) - core_params.td = TimingsDatabase(timings_database); - core_params.verbose = command_line::get_arg(vm, arg_verbose); - core_params.stats = command_line::get_arg(vm, arg_stats); - core_params.loop_multiplier = command_line::get_arg(vm, arg_loop_multiplier); - - ParamsShuttle p{core_params}; + p.core_params.td = std::make_shared(timings_database); + p.core_params.verbose = command_line::get_arg(vm, arg_verbose); + p.core_params.stats = command_line::get_arg(vm, arg_stats); + p.core_params.loop_multiplier = command_line::get_arg(vm, arg_loop_multiplier); performance_timer timer; timer.start(); diff --git a/tests/unit_tests/crypto.cpp b/tests/unit_tests/crypto.cpp index 7c88e94178..88ecb58530 100644 --- a/tests/unit_tests/crypto.cpp +++ b/tests/unit_tests/crypto.cpp @@ -340,20 +340,3 @@ TEST(Crypto, generator_consistency) // ringct/rctTypes.h ASSERT_TRUE(memcmp(H.data, rct::H.bytes, 32) == 0); } - -TEST(Crypto, generator_consistency) -{ - // crypto/generators.h - const crypto::public_key G{crypto::get_G()}; - const crypto::public_key H{crypto::get_H()}; - const ge_p3 H_p3 = crypto::get_H_p3(); - - // crypto/crypto-ops.h - ASSERT_TRUE(memcmp(&H_p3, &ge_p3_H, sizeof(ge_p3)) == 0); - - // ringct/rctOps.h - ASSERT_TRUE(memcmp(G.data, rct::G.bytes, 32) == 0); - - // ringct/rctTypes.h - ASSERT_TRUE(memcmp(H.data, rct::H.bytes, 32) == 0); -}