diff --git a/benchmark/modexp.cpp b/benchmark/modexp.cpp index 627a719a50..14d8443331 100644 --- a/benchmark/modexp.cpp +++ b/benchmark/modexp.cpp @@ -1,4 +1,5 @@ #include +#include #include @@ -24,15 +25,14 @@ void modexp_benchmarking() { return result; }; - static constexpr unsigned int start_num_bytes = 128; // 64 - static constexpr unsigned int end_num_bytes = 256; // 512 - static constexpr unsigned int delta_num_bytes = 128; // 64 + static constexpr unsigned int start_num_bytes = 8; + static constexpr unsigned int end_num_bytes = 256; static_assert(start_num_bytes <= end_num_bytes); - static_assert(delta_num_bytes > 0); - static_assert((end_num_bytes - start_num_bytes) % delta_num_bytes == 0); + static_assert((start_num_bytes & (start_num_bytes - 1)) == 0); + static_assert((end_num_bytes & (end_num_bytes - 1)) == 0); - for (unsigned int n = start_num_bytes, slot = 0; n <= end_num_bytes; n += delta_num_bytes, ++slot) { + for (unsigned int n = start_num_bytes; n <= end_num_bytes; n *= 2) { auto base = generate_random_bytes(r, n); auto exponent = generate_random_bytes(r, n); auto modulus = generate_random_bytes(r, n); @@ -41,7 +41,21 @@ void modexp_benchmarking() { fc::modexp(base, exponent, modulus); }; - benchmarking(std::to_string(n*8) + " bit width", f); + auto even_and_odd = [&](const std::string& bm) { + //some modexp implementations have drastically different performance characteristics depending on whether the modulus is + // even or odd (this can determine whether Montgomery multiplication is used). So test both cases. + modulus.back() &= ~1; + benchmarking(std::to_string(n*8) + " bit even M, " + bm, f); + modulus.back() |= 1; + benchmarking(std::to_string(n*8) + " bit odd M, " + bm, f); + }; + + //some modexp implementations need to take a minor different path if base is greater than modulus, try both + FC_ASSERT(modulus[0] != '\xff' && modulus[0] != 0); + base.front() = 0; + even_and_odd("BM"); } // Running the above benchmark (using commented values for num_trials and *_num_bytes) with a release build on an AMD 3.4 GHz CPU diff --git a/libraries/chain/webassembly/runtimes/eos-vm.cpp b/libraries/chain/webassembly/runtimes/eos-vm.cpp index 345e8cd94b..813affc045 100644 --- a/libraries/chain/webassembly/runtimes/eos-vm.cpp +++ b/libraries/chain/webassembly/runtimes/eos-vm.cpp @@ -287,7 +287,7 @@ std::unique_ptr eos_vm_profile_runtime::inst #endif template -thread_local eos_vm_runtime::context_t eos_vm_runtime::_exec_ctx; +thread_local typename eos_vm_runtime::context_t eos_vm_runtime::_exec_ctx; template thread_local eos_vm_backend_t eos_vm_runtime::_bkend; } diff --git a/libraries/libfc/CMakeLists.txt b/libraries/libfc/CMakeLists.txt index 859f4162df..27c1aa4ba0 100644 --- a/libraries/libfc/CMakeLists.txt +++ b/libraries/libfc/CMakeLists.txt @@ -66,19 +66,6 @@ file( GLOB_RECURSE fc_headers ${CMAKE_CURRENT_SOURCE_DIR} *.hpp *.h ) add_library(fc ${fc_sources} ${fc_headers}) -# Yuck: newer CMake files from boost iostreams will effectively target_link_libraries(Boost::iostreams z;bz2;lzma;zstd) -# without first "finding" those libraries. This resolves to simple -lz -lbz2 etc: it'll look for those libraries in the linker's -# library search path. This is most problematic on macOS where something like libzstd isn't in the standard search path. Historically -# fc would just "-L/usr/local/lib" as a heavy handed way to make sure something like -lzstd can be found in brew's library path. But -# that isn't sufficient for something like ARM homebrew. Let's just "null" these libraries out since we're already linking to zlib -# explicitly anyways via a proper find_package(ZLIB) below. -if(APPLE) - add_library(z INTERFACE) - add_library(bz2 INTERFACE) - add_library(lzma INTERFACE) - add_library(zstd INTERFACE) -endif() - find_path(GMP_INCLUDE_DIR NAMES gmp.h) find_library(GMP_LIBRARY gmp) if(NOT GMP_LIBRARY MATCHES ${CMAKE_SHARED_LIBRARY_SUFFIX}) diff --git a/plugins/wallet_plugin/se_wallet.cpp b/plugins/wallet_plugin/se_wallet.cpp index 8f461401ac..18f745ddb7 100644 --- a/plugins/wallet_plugin/se_wallet.cpp +++ b/plugins/wallet_plugin/se_wallet.cpp @@ -371,7 +371,7 @@ bool se_wallet::import_key(string wif_key) { string se_wallet::create_key(string key_type) { EOS_ASSERT(key_type.empty() || key_type == "R1", chain::unsupported_key_type_exception, "Secure Enclave wallet only supports R1 keys"); - return my->create().to_string(); + return my->create().to_string({}); } bool se_wallet::remove_key(string key) { diff --git a/tests/abieos b/tests/abieos index 08145090b6..7e77b20a39 160000 --- a/tests/abieos +++ b/tests/abieos @@ -1 +1 @@ -Subproject commit 08145090b6407b91fbab5721b624d2b3001ef84f +Subproject commit 7e77b20a3927a41695f7ae969b736bdb4a8e0a74 diff --git a/tests/trx_generator/CMakeLists.txt b/tests/trx_generator/CMakeLists.txt index fab2a72eeb..d1946a156b 100644 --- a/tests/trx_generator/CMakeLists.txt +++ b/tests/trx_generator/CMakeLists.txt @@ -2,9 +2,9 @@ add_executable(trx_generator main.cpp trx_generator.cpp trx_provider.cpp) target_include_directories(trx_generator PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(trx_generator PRIVATE eosio_chain fc chain_plugin ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) +target_link_libraries(trx_generator PRIVATE eosio_chain fc Boost::program_options ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) add_executable(trx_generator_tests trx_generator_tests.cpp trx_provider.cpp trx_generator.cpp) -target_link_libraries(trx_generator_tests PRIVATE eosio_chain fc chain_plugin ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) +target_link_libraries(trx_generator_tests PRIVATE eosio_chain fc Boost::program_options ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) target_include_directories(trx_generator_tests PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) add_test(trx_generator_tests trx_generator_tests) diff --git a/tests/trx_generator/main.cpp b/tests/trx_generator/main.cpp index 60c20e3f7e..fab8fba31c 100644 --- a/tests/trx_generator/main.cpp +++ b/tests/trx_generator/main.cpp @@ -1,7 +1,7 @@ -#include #include #include #include +#include #include #include #include diff --git a/tests/trx_generator/trx_generator.cpp b/tests/trx_generator/trx_generator.cpp index dda297422f..f3c57082ca 100644 --- a/tests/trx_generator/trx_generator.cpp +++ b/tests/trx_generator/trx_generator.cpp @@ -1,9 +1,9 @@ #include -#include #include #include #include #include +#include #include #include #include @@ -235,7 +235,7 @@ namespace eosio::testing { stop_generation(); ilog("Create Initial Transaction with action data."); - _abi = abi_serializer(fc::json::from_file(_usr_trx_config._abi_data_file_path).as(), abi_serializer::create_yield_function( abi_serializer_max_time )); + _abi = chain::abi_serializer(fc::json::from_file(_usr_trx_config._abi_data_file_path).as(), chain::abi_serializer::create_yield_function( abi_serializer_max_time )); fc::variant unpacked_actions_data_json = json_from_file_or_string(_usr_trx_config._actions_data_json_file_or_str); fc::variant unpacked_actions_auths_data_json = json_from_file_or_string(_usr_trx_config._actions_auths_json_file_or_str); ilog("Loaded actions data: ${data}", ("data", fc::json::to_pretty_string(unpacked_actions_data_json))); diff --git a/tests/trx_generator/trx_generator.hpp b/tests/trx_generator/trx_generator.hpp index 1112444777..83736cd83b 100644 --- a/tests/trx_generator/trx_generator.hpp +++ b/tests/trx_generator/trx_generator.hpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include