From 3a3d4f8e2a5ee0cb0aa27fce52f334295271df8a Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 Mar 2024 15:33:04 -0500 Subject: [PATCH 1/3] Comments. --- include/bitcoin/network/protocols/protocol.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/bitcoin/network/protocols/protocol.hpp b/include/bitcoin/network/protocols/protocol.hpp index 706b7d0b3..c4febf249 100644 --- a/include/bitcoin/network/protocols/protocol.hpp +++ b/include/bitcoin/network/protocols/protocol.hpp @@ -49,6 +49,7 @@ class BCT_API protocol DELETE_COPY_MOVE(protocol); /// The channel is stopping (called on strand by stop subscription). + /// The stopped flag is set before this is invoked by subscriber stop. /// This must be called only from the channel strand (not thread safe). virtual void stopping(const code& ec) NOEXCEPT; From 7d9880ef24b204554601b7f58d2c3ea8b4d15ed6 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 Mar 2024 15:33:34 -0500 Subject: [PATCH 2/3] Use chain::max_block_weight for deserialization fail dump limit. --- src/net/proxy.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/proxy.cpp b/src/net/proxy.cpp index 2a4c55400..1090cc9a5 100644 --- a/src/net/proxy.cpp +++ b/src/net/proxy.cpp @@ -40,7 +40,7 @@ using namespace messages; using namespace std::placeholders; // Dump up to this size of payload as hex in order to diagnose failure. -static constexpr size_t invalid_payload_dump_size = chain::max_block_size; +static constexpr size_t invalid_payload_dump_size = chain::max_block_weight; static constexpr uint32_t http_magic = 0x20544547; static constexpr uint32_t https_magic = 0x02010316; @@ -292,6 +292,7 @@ void proxy::handle_read_payload(const code& ec, size_t LOG_ONLY(payload_size), if (code) { + // TODO: specialize for header/block/tx messages and provide hash. LOGR("Invalid " << head->command << " payload from [" << authority() << "] (" << encode_base16({ payload_buffer_.begin(), std::next(payload_buffer_.begin(), std::min(payload_size, From b0c2f2d632f5f1e726a495a1a26b9d714f604ab0 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 Mar 2024 16:33:18 -0500 Subject: [PATCH 3/3] Regenerate artifacts. --- .github/workflows/ci.yml | 2 +- builds/cmake/CMakeLists.txt | 17 +++++----- builds/cmake/CMakePresets.json | 4 +-- .../libbitcoin-network-test.props | 2 +- install-cmake.sh | 34 ------------------- install-cmakepresets.sh | 34 ------------------- install.sh | 34 ------------------- libbitcoin-network-test_runner.sh | 1 - 8 files changed, 12 insertions(+), 116 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58259aeba..4a47c01a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -749,7 +749,7 @@ jobs: $BC_TEST_SINGLETON = $BC_TEST_EXES.FullName; Write-Host "Executing $BC_TEST_SINGLETON $env:BOOST_UNIT_TEST_OPTIONS" -ForegroundColor Yellow; try { - Invoke-Expression "$BC_TEST_SINGLETON --log_level=warning --run_test=${{ matrix.tests }} $env:BOOST_UNIT_TEST_OPTIONS" + Invoke-Expression "$BC_TEST_SINGLETON --run_test=${{ matrix.tests }} $env:BOOST_UNIT_TEST_OPTIONS" } catch { $ERR = $_; diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt index da003fb90..1ba30616c 100644 --- a/builds/cmake/CMakeLists.txt +++ b/builds/cmake/CMakeLists.txt @@ -45,7 +45,7 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON ) # Warn on all stuff. check_cxx_compiler_flag( "-Wall" HAS_FLAG_WALL ) if ( HAS_FLAG_WALL ) - add_compile_options( $<$:-Wall> ) + add_compile_options( "-Wall" ) else() message( FATAL_ERROR "Compiler does not support -Wall" ) endif() @@ -53,7 +53,7 @@ endif() # Warn on extra stuff. check_cxx_compiler_flag( "-Wextra" HAS_FLAG_WEXTRA ) if ( HAS_FLAG_WEXTRA ) - add_compile_options( $<$:-Wextra> ) + add_compile_options( "-Wextra" ) else() message( FATAL_ERROR "Compiler does not support -Wextra" ) endif() @@ -61,7 +61,7 @@ endif() # Disallow warning on style order of declarations. check_cxx_compiler_flag( "-Wno-reorder" HAS_FLAG_WNO-REORDER ) if ( HAS_FLAG_WNO-REORDER ) - add_compile_options( $<$:-Wno-reorder> ) + add_compile_options( "-Wno-reorder" ) else() message( FATAL_ERROR "Compiler does not support -Wno-reorder" ) endif() @@ -69,7 +69,7 @@ endif() # Suppress warning for incomplete field initialization. check_cxx_compiler_flag( "-Wno-missing-field-initializers" HAS_FLAG_WNO-MISSING-FIELD-INITIALIZERS ) if ( HAS_FLAG_WNO-MISSING-FIELD-INITIALIZERS ) - add_compile_options( $<$:-Wno-missing-field-initializers> ) + add_compile_options( "-Wno-missing-field-initializers" ) else() message( FATAL_ERROR "Compiler does not support -Wno-missing-field-initializers" ) endif() @@ -77,7 +77,7 @@ endif() # Conform to style. check_cxx_compiler_flag( "-Wno-missing-braces" HAS_FLAG_WNO-MISSING-BRACES ) if ( HAS_FLAG_WNO-MISSING-BRACES ) - add_compile_options( $<$:-Wno-missing-braces> ) + add_compile_options( "-Wno-missing-braces" ) else() message( FATAL_ERROR "Compiler does not support -Wno-missing-braces" ) endif() @@ -85,7 +85,7 @@ endif() # Ignore comments within comments or commenting of backslash extended lines. check_cxx_compiler_flag( "-Wno-comment" HAS_FLAG_WNO-COMMENT ) if ( HAS_FLAG_WNO-COMMENT ) - add_compile_options( $<$:-Wno-comment> ) + add_compile_options( "-Wno-comment" ) else() message( FATAL_ERROR "Compiler does not support -Wno-comment" ) endif() @@ -93,7 +93,7 @@ endif() # Suppress warning for copy of implicitly generated copy constructor. check_cxx_compiler_flag( "-Wno-deprecated-copy" HAS_FLAG_WNO-DEPRECATED-COPY ) if ( HAS_FLAG_WNO-DEPRECATED-COPY ) - add_compile_options( $<$:-Wno-deprecated-copy> ) + add_compile_options( "-Wno-deprecated-copy" ) else() message( FATAL_ERROR "Compiler does not support -Wno-deprecated-copy" ) endif() @@ -102,7 +102,7 @@ endif() if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") check_cxx_compiler_flag( "-Wno-mismatched-tags" HAS_FLAG_WNO-MISMATCHED-TAGS ) if ( HAS_FLAG_WNO-MISMATCHED-TAGS ) - add_compile_options( $<$:-Wno-mismatched-tags> ) + add_compile_options( "-Wno-mismatched-tags" ) else() message( FATAL_ERROR "Compiler does not support -Wno-mismatched-tags" ) endif() @@ -419,7 +419,6 @@ if (with-tests) add_test( NAME libbitcoin-network-test COMMAND libbitcoin-network-test --run_test=* - --log_level=warning --show_progress=no --detect_memory_leak=0 --report_level=no diff --git a/builds/cmake/CMakePresets.json b/builds/cmake/CMakePresets.json index 5dacb0f59..50f473a06 100644 --- a/builds/cmake/CMakePresets.json +++ b/builds/cmake/CMakePresets.json @@ -79,8 +79,8 @@ "description": "Factored size optimization settings.", "hidden": true, "cacheVariables": { - "CMAKE_C_FLAGS": "$env{CMAKE_C_FLAGS} -Os", - "CMAKE_CXX_FLAGS": "$env{CMAKE_CXX_FLAGS} -Os" + "CMAKE_C_FLAGS": "$env{CMAKE_C_FLAGS} -Os -s", + "CMAKE_CXX_FLAGS": "$env{CMAKE_CXX_FLAGS} -Os -s" } }, { diff --git a/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.props b/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.props index 4efe97d8f..d82e3a955 100644 --- a/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.props +++ b/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.props @@ -15,7 +15,7 @@ BOOST_TEST_DYN_LINK;%(PreprocessorDefinitions) - "$(TargetPath)" --log_level=warning --run_test=* --show_progress=no --build_info=yes + "$(TargetPath)" --run_test=* --show_progress=no --build_info=yes diff --git a/install-cmake.sh b/install-cmake.sh index 70874d649..ee070ad6b 100755 --- a/install-cmake.sh +++ b/install-cmake.sh @@ -854,12 +854,7 @@ build_from_tarball_boost() display_message "BOOST_OPTIONS : $*" display_message "--------------------------------------------------------------------" - guessed_toolset=`./tools/build/src/engine/build.sh --guess-toolset` - CXXFLAGS="-w" ./tools/build/src/engine/build.sh ${guessed_toolset} --cxxflags="-w" - cp tools/build/src/engine/b2 . - ./bootstrap.sh \ - "--with-bjam=./b2" \ "--prefix=$PREFIX" \ "--with-icu=$ICU_PREFIX" @@ -877,7 +872,6 @@ build_from_tarball_boost() "$BOOST_CXXFLAGS" \ "$BOOST_LINKFLAGS" \ "link=$BOOST_LINK" \ - "warnings=off" \ "boost.locale.iconv=$BOOST_ICU_ICONV" \ "boost.locale.posix=$BOOST_ICU_POSIX" \ "-sNO_BZIP2=1" \ @@ -901,27 +895,13 @@ build_from_tarball_boost() build_all() { unpack_from_tarball "$ICU_ARCHIVE" "$ICU_URL" gzip "$BUILD_ICU" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${ICU_FLAGS[@]}" build_from_tarball "$ICU_ARCHIVE" source "$PARALLEL" "$BUILD_ICU" "${ICU_OPTIONS[@]}" $CUMULATIVE_FILTERED_ARGS - export CPPFLAGS=$SAVE_CPPFLAGS unpack_from_tarball "$BOOST_ARCHIVE" "$BOOST_URL" bzip2 "$BUILD_BOOST" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BOOST_FLAGS[@]}" build_from_tarball_boost "$BOOST_ARCHIVE" "$PARALLEL" "$BUILD_BOOST" "${BOOST_OPTIONS[@]}" - export CPPFLAGS=$SAVE_CPPFLAGS create_from_github libbitcoin secp256k1 version8 "yes" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${SECP256K1_FLAGS[@]}" build_from_github secp256k1 "$PARALLEL" false "yes" "${SECP256K1_OPTIONS[@]}" $CUMULATIVE_FILTERED_ARGS - export CPPFLAGS=$SAVE_CPPFLAGS create_from_github libbitcoin libbitcoin-system master "yes" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BITCOIN_SYSTEM_FLAGS[@]}" build_from_github_cmake libbitcoin-system "$PARALLEL" false "yes" "${BITCOIN_SYSTEM_OPTIONS[@]}" $CUMULATIVE_FILTERED_ARGS_CMAKE "$@" - export CPPFLAGS=$SAVE_CPPFLAGS - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BITCOIN_NETWORK_FLAGS[@]}" if [[ ! ($CI == true) ]]; then create_from_github libbitcoin libbitcoin-network master "yes" build_from_github_cmake libbitcoin-network "$PARALLEL" true "yes" "${BITCOIN_NETWORK_OPTIONS[@]}" $CUMULATIVE_FILTERED_ARGS_CMAKE "$@" @@ -932,7 +912,6 @@ build_all() pop_directory pop_directory fi - export CPPFLAGS=$SAVE_CPPFLAGS } @@ -954,19 +933,6 @@ set_with_boost_prefix remove_install_options -# Define build flags. -#============================================================================== -# Define icu flags. -#------------------------------------------------------------------------------ -ICU_FLAGS=( -"-w") - -# Define secp256k1 flags. -#------------------------------------------------------------------------------ -SECP256K1_FLAGS=( -"-w") - - # Define build options. #============================================================================== # Define icu options. diff --git a/install-cmakepresets.sh b/install-cmakepresets.sh index b2fd99ac1..8c7976d4d 100755 --- a/install-cmakepresets.sh +++ b/install-cmakepresets.sh @@ -914,12 +914,7 @@ build_from_tarball_boost() display_message "BOOST_OPTIONS : $*" display_message "--------------------------------------------------------------------" - guessed_toolset=`./tools/build/src/engine/build.sh --guess-toolset` - CXXFLAGS="-w" ./tools/build/src/engine/build.sh ${guessed_toolset} --cxxflags="-w" - cp tools/build/src/engine/b2 . - ./bootstrap.sh \ - "--with-bjam=./b2" \ "--prefix=$PREFIX" \ "--with-icu=$ICU_PREFIX" @@ -937,7 +932,6 @@ build_from_tarball_boost() "$BOOST_CXXFLAGS" \ "$BOOST_LINKFLAGS" \ "link=$BOOST_LINK" \ - "warnings=off" \ "boost.locale.iconv=$BOOST_ICU_ICONV" \ "boost.locale.posix=$BOOST_ICU_POSIX" \ "-sNO_BZIP2=1" \ @@ -961,28 +955,14 @@ build_from_tarball_boost() build_all() { unpack_from_tarball "$ICU_ARCHIVE" "$ICU_URL" gzip "$BUILD_ICU" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${ICU_FLAGS[@]}" build_from_tarball "$ICU_ARCHIVE" source "$PARALLEL" "$BUILD_ICU" "${ICU_OPTIONS[@]}" $CUMULATIVE_FILTERED_ARGS - export CPPFLAGS=$SAVE_CPPFLAGS unpack_from_tarball "$BOOST_ARCHIVE" "$BOOST_URL" bzip2 "$BUILD_BOOST" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BOOST_FLAGS[@]}" build_from_tarball_boost "$BOOST_ARCHIVE" "$PARALLEL" "$BUILD_BOOST" "${BOOST_OPTIONS[@]}" - export CPPFLAGS=$SAVE_CPPFLAGS create_from_github libbitcoin secp256k1 version8 "yes" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${SECP256K1_FLAGS[@]}" build_from_github secp256k1 "$PARALLEL" false "yes" "${SECP256K1_OPTIONS[@]}" $CUMULATIVE_FILTERED_ARGS - export CPPFLAGS=$SAVE_CPPFLAGS create_from_github libbitcoin libbitcoin-system master "yes" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BITCOIN_SYSTEM_FLAGS[@]}" display_message "libbitcoin-system PRESET ${REPO_PRESET[libbitcoin-system]}" build_from_github_cmake libbitcoin-system ${REPO_PRESET[libbitcoin-system]} "$PARALLEL" false "yes" "${BITCOIN_SYSTEM_OPTIONS[@]}" $CUMULATIVE_FILTERED_ARGS_CMAKE "$@" - export CPPFLAGS=$SAVE_CPPFLAGS - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BITCOIN_NETWORK_FLAGS[@]}" if [[ ! ($CI == true) ]]; then create_from_github libbitcoin libbitcoin-network master "yes" display_message "libbitcoin-network PRESET ${REPO_PRESET[libbitcoin-network]}" @@ -995,7 +975,6 @@ build_all() pop_directory pop_directory fi - export CPPFLAGS=$SAVE_CPPFLAGS } @@ -1017,19 +996,6 @@ set_with_boost_prefix remove_install_options -# Define build flags. -#============================================================================== -# Define icu flags. -#------------------------------------------------------------------------------ -ICU_FLAGS=( -"-w") - -# Define secp256k1 flags. -#------------------------------------------------------------------------------ -SECP256K1_FLAGS=( -"-w") - - # Define build options. #============================================================================== # Define icu options. diff --git a/install.sh b/install.sh index 641a61de4..91817617d 100755 --- a/install.sh +++ b/install.sh @@ -729,12 +729,7 @@ build_from_tarball_boost() display_message "BOOST_OPTIONS : $*" display_message "--------------------------------------------------------------------" - guessed_toolset=`./tools/build/src/engine/build.sh --guess-toolset` - CXXFLAGS="-w" ./tools/build/src/engine/build.sh ${guessed_toolset} --cxxflags="-w" - cp tools/build/src/engine/b2 . - ./bootstrap.sh \ - "--with-bjam=./b2" \ "--prefix=$PREFIX" \ "--with-icu=$ICU_PREFIX" @@ -752,7 +747,6 @@ build_from_tarball_boost() "$BOOST_CXXFLAGS" \ "$BOOST_LINKFLAGS" \ "link=$BOOST_LINK" \ - "warnings=off" \ "boost.locale.iconv=$BOOST_ICU_ICONV" \ "boost.locale.posix=$BOOST_ICU_POSIX" \ "-sNO_BZIP2=1" \ @@ -776,27 +770,13 @@ build_from_tarball_boost() build_all() { unpack_from_tarball "$ICU_ARCHIVE" "$ICU_URL" gzip "$BUILD_ICU" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${ICU_FLAGS[@]}" build_from_tarball "$ICU_ARCHIVE" source "$PARALLEL" "$BUILD_ICU" "${ICU_OPTIONS[@]}" "$@" - export CPPFLAGS=$SAVE_CPPFLAGS unpack_from_tarball "$BOOST_ARCHIVE" "$BOOST_URL" bzip2 "$BUILD_BOOST" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BOOST_FLAGS[@]}" build_from_tarball_boost "$BOOST_ARCHIVE" "$PARALLEL" "$BUILD_BOOST" "${BOOST_OPTIONS[@]}" - export CPPFLAGS=$SAVE_CPPFLAGS create_from_github libbitcoin secp256k1 version8 "yes" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${SECP256K1_FLAGS[@]}" build_from_github secp256k1 "$PARALLEL" false "yes" "${SECP256K1_OPTIONS[@]}" "$@" - export CPPFLAGS=$SAVE_CPPFLAGS create_from_github libbitcoin libbitcoin-system master "yes" - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BITCOIN_SYSTEM_FLAGS[@]}" build_from_github libbitcoin-system "$PARALLEL" false "yes" "${BITCOIN_SYSTEM_OPTIONS[@]}" "$@" - export CPPFLAGS=$SAVE_CPPFLAGS - local SAVE_CPPFLAGS="$CPPFLAGS" - export CPPFLAGS="$CPPFLAGS ${BITCOIN_NETWORK_FLAGS[@]}" if [[ ! ($CI == true) ]]; then create_from_github libbitcoin libbitcoin-network master "yes" build_from_github libbitcoin-network "$PARALLEL" true "yes" "${BITCOIN_NETWORK_OPTIONS[@]}" "$@" @@ -807,7 +787,6 @@ build_all() pop_directory pop_directory fi - export CPPFLAGS=$SAVE_CPPFLAGS } @@ -828,19 +807,6 @@ set_pkgconfigdir set_with_boost_prefix -# Define build flags. -#============================================================================== -# Define icu flags. -#------------------------------------------------------------------------------ -ICU_FLAGS=( -"-w") - -# Define secp256k1 flags. -#------------------------------------------------------------------------------ -SECP256K1_FLAGS=( -"-w") - - # Define build options. #============================================================================== # Define icu options. diff --git a/libbitcoin-network-test_runner.sh b/libbitcoin-network-test_runner.sh index 8ec03182b..6d02c3e68 100755 --- a/libbitcoin-network-test_runner.sh +++ b/libbitcoin-network-test_runner.sh @@ -10,7 +10,6 @@ #============================================================================== BOOST_UNIT_TEST_OPTIONS=\ "--run_test=* "\ -"--log_level=warning "\ "--show_progress=no "\ "--detect_memory_leak=0 "\ "--report_level=no "\