From 853821b18fd7b924c8887c7ef41d7eb2f9cb5cf4 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 29 May 2023 16:48:11 +0100 Subject: [PATCH 1/3] Merge bitcoin/bitcoin#27724: build: disable boost multi index safe mode in debug mode 59c89447499bd9d6202269879555b8bc37373aa2 build: disable boost multi index safe mode (willcl-ark) Pull request description: Fixes #27586 Disable boost multi index safe mode by default when configuring with --enable-debug. This option can cause transactions to take a long time to be accepted into the mempool under certain conditions; iterator destruction takes O(n) time vs O(1) as they are stored in a singly linked list. See 27586 and the [boost docs](https://www.boost.org/doc/libs/1_58_0/boost/multi_index/detail/safe_mode.hpp) for more information. Re-enable it on the CI builds which previously had it enabled. Re-enable it on the msan fuzz task so that we have fuzz tasks testing with it enabled and disabled in this repo. ACKs for top commit: hebasto: ~ACK 59c89447499bd9d6202269879555b8bc37373aa2~ fanquake: ACK 59c89447499bd9d6202269879555b8bc37373aa2 Tree-SHA512: ed654f63dbebdd02e4414d1f81147d92a4d490dbb5a2e0376858e3129097645f3a2df45191d6b40c410a76e803b0d28796d1a01c1d2fd995b94e8b7eb3949027 --- ci/test/00_setup_env_native_qt5.sh | 2 +- configure.ac | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ci/test/00_setup_env_native_qt5.sh b/ci/test/00_setup_env_native_qt5.sh index 5eea2c07f7cd..0d68bbd8863a 100755 --- a/ci/test/00_setup_env_native_qt5.sh +++ b/ci/test/00_setup_env_native_qt5.sh @@ -15,4 +15,4 @@ export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS="false" export GOAL="install" export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.12.1.5 v0.15.0.0 v0.16.1.1 v0.17.0.3 v18.2.2 v19.3.0 v20.0.1" -export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++ --with-boost-process" +export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++ --with-boost-process CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'" diff --git a/configure.ac b/configure.ac index ac4bd086422d..cf4407920939 100644 --- a/configure.ac +++ b/configure.ac @@ -1482,10 +1482,6 @@ fi dnl we don't use multi_index serialization BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION" - if test "$enable_debug" = "yes" || test "$enable_fuzz" = "yes"; then - BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE" - fi - dnl Prevent use of std::unary_function, which was removed in C++17, dnl and will generate warnings with newer compilers for Boost dnl older than 1.80. From 9ab5da6714e17ff7134a459000755e7c4d0652b0 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 5 Dec 2025 23:50:15 -0600 Subject: [PATCH 2/3] validation: Apply fixes for Bitcoin backport compliance - Add BOOST_MULTI_INDEX_ENABLE_SAFE_MODE to native_fuzz CI config - Add BOOST_MULTI_INDEX_ENABLE_SAFE_MODE to native_fuzz_with_valgrind CI config - Add BOOST_MULTI_INDEX_ENABLE_SAFE_MODE to native_multiprocess CI config These changes ensure that all CI jobs using --enable-debug or --enable-fuzz explicitly enable boost multi index safe mode, matching Bitcoin's intent in PR bitcoin#27724 which removed automatic enabling in configure.ac and re-enabled it in specific CI jobs. --- ci/test/00_setup_env_native_fuzz.sh | 2 +- ci/test/00_setup_env_native_fuzz_with_valgrind.sh | 2 +- ci/test/00_setup_env_native_multiprocess.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh index 18929cc2b2f0..7ee4a50eb967 100755 --- a/ci/test/00_setup_env_native_fuzz.sh +++ b/ci/test/00_setup_env_native_fuzz.sh @@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_fuzz export PACKAGES="clang llvm python3 libevent-dev bsdmainutils libboost-dev" export DEP_OPTS="NO_UPNP=1 DEBUG=1" -export CPPFLAGS="-DDEBUG_LOCKORDER -DARENA_DEBUG" +export CPPFLAGS="-DDEBUG_LOCKORDER -DARENA_DEBUG -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE" export PYZMQ=true export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false diff --git a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh index 1b5728feb84c..45ad14f545ad 100755 --- a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh +++ b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh @@ -15,5 +15,5 @@ export RUN_FUZZ_TESTS=true export FUZZ_TESTS_CONFIG="--valgrind" export GOAL="install" # Temporarily pin dwarf 4, until valgrind can understand clang's dwarf 5 -export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer CC=clang-18 CXX=clang++-18 CFLAGS='-gdwarf-4' CXXFLAGS='-gdwarf-4'" +export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer CC=clang-18 CXX=clang++-18 CFLAGS='-gdwarf-4' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' CXXFLAGS='-gdwarf-4'" export CCACHE_SIZE=200M diff --git a/ci/test/00_setup_env_native_multiprocess.sh b/ci/test/00_setup_env_native_multiprocess.sh index 7ab95903d131..855f672550fc 100755 --- a/ci/test/00_setup_env_native_multiprocess.sh +++ b/ci/test/00_setup_env_native_multiprocess.sh @@ -13,7 +13,7 @@ export DEP_OPTS="MULTIPROCESS=1 CC=clang-18 CXX=clang++-18" export RUN_TIDY=true export GOAL="install" export TEST_RUNNER_EXTRA="--v2transport" -export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang-18 CXX=clang++-18" # Use clang to avoid OOM +export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang-18 CXX=clang++-18 CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'" # Use clang to avoid OOM # Additional flags for RUN_TIDY export BITCOIN_CONFIG="${BITCOIN_CONFIG} --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0 -Wno-error=documentation'" export BITCOIND=dash-node # Used in functional tests From 65aa83d6c47d8f13dd902536f0debe15eb40fa5a Mon Sep 17 00:00:00 2001 From: Claude Code Date: Tue, 9 Dec 2025 12:12:45 -0600 Subject: [PATCH 3/3] validation: Remove incorrect safe mode addition to native_qt5 The merge commit incorrectly added BOOST_MULTI_INDEX_ENABLE_SAFE_MODE to native_qt5.sh. This is not faithful to the Bitcoin backport because: - Bitcoin's native_qt5.sh has --enable-debug, so it previously had safe mode enabled - Dash's native_qt5.sh does NOT have --enable-debug, so it never had safe mode enabled - The Bitcoin PR only re-enabled safe mode on builds that previously had it The previous validation fixes (9ab5da6714) correctly added safe mode to the 3 Dash CI files that use --enable-debug or --enable-fuzz. This fix removes the incorrect addition to native_qt5, making the backport faithful to Bitcoin's intent. --- ci/test/00_setup_env_native_qt5.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test/00_setup_env_native_qt5.sh b/ci/test/00_setup_env_native_qt5.sh index 0d68bbd8863a..5eea2c07f7cd 100755 --- a/ci/test/00_setup_env_native_qt5.sh +++ b/ci/test/00_setup_env_native_qt5.sh @@ -15,4 +15,4 @@ export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS="false" export GOAL="install" export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.12.1.5 v0.15.0.0 v0.16.1.1 v0.17.0.3 v18.2.2 v19.3.0 v20.0.1" -export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++ --with-boost-process CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'" +export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++ --with-boost-process"