From a3060483fa2ecc4696d1214dfe6030195c572df0 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Sat, 15 Mar 2025 16:07:07 +0100 Subject: [PATCH 1/7] test: avoid disk space warning for non-regtest feature_config_args.py incorrectly assumed that its testnet4 node would not log a disk space warning. 0683b8ebf33386d5c05140df89df10b1853d7c7e increased m_assumed_blockchain_size on testnet4 from 1 to 11 GiB which triggers this bug on more systems, e.g. a RAM disk. Prevent the warning by setting -prune for these nodes. Fix the same issue in feature_signet.py Github-Pull: #32057 Rebased-From: 20fe41e9e83d510fd467f5a999d55a614b16ef89 --- test/functional/feature_config_args.py | 20 ++++++-------------- test/functional/feature_signet.py | 6 ++++-- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py index e8fc1aca46..c5e3c33b14 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -24,6 +24,9 @@ class ConfArgsTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 1 + # Prune to prevent disk space warning on CI systems with limited space, + # when using networks other than regtest. + self.extra_args = [["-prune=550"]] self.supports_cli = False self.wallet_names = [] self.disable_autoconnect = False @@ -471,32 +474,21 @@ class ConfArgsTest(BitcoinTestFramework): self.log.info("Test testnet3 deprecation warning") t3_warning_log = "Warning: Support for testnet3 is deprecated and will be removed in an upcoming release. Consider switching to testnet4." - def warning_msg(node, approx_size): - return f'Warning: Disk space for "{node.datadir_path / node.chain / "blocks" }" may not accommodate the block files. Approximately {approx_size} GB of data will be stored in this directory.' - - # Testnet3 node will log the warning + self.log.debug("Testnet3 node will log the deprecation warning") self.nodes[0].chain = 'testnet3' self.nodes[0].replace_in_config([('regtest=', 'testnet='), ('[regtest]', '[test]')]) with self.nodes[0].assert_debug_log([t3_warning_log]): self.start_node(0) - # Some CI environments will have limited space and some others won't - # so we need to handle both cases as a valid result. - self.nodes[0].stderr.seek(0) - err = self.nodes[0].stdout.read() - self.nodes[0].stderr.seek(0) - self.nodes[0].stderr.truncate() - if err != b'' and err != warning_msg(self.nodes[0], 42): - raise AssertionError("Unexpected stderr after shutdown of Testnet3 node") self.stop_node(0) - # Testnet4 node will not log the warning + self.log.debug("Testnet4 node will not log the deprecation warning") self.nodes[0].chain = 'testnet4' self.nodes[0].replace_in_config([('testnet=', 'testnet4='), ('[test]', '[testnet4]')]) with self.nodes[0].assert_debug_log([], unexpected_msgs=[t3_warning_log]): self.start_node(0) self.stop_node(0) - # Reset to regtest + self.log.debug("Reset to regtest") self.nodes[0].chain = 'regtest' self.nodes[0].replace_in_config([('testnet4=', 'regtest='), ('[testnet4]', '[regtest]')]) diff --git a/test/functional/feature_signet.py b/test/functional/feature_signet.py index 63091b3ee8..02e37f0fdd 100755 --- a/test/functional/feature_signet.py +++ b/test/functional/feature_signet.py @@ -26,12 +26,14 @@ signet_blocks = [ class SignetParams: def __init__(self, challenge=None): + # Prune to prevent disk space warning on CI systems with limited space, + # when using networks other than regtest. if challenge is None: self.challenge = SIGNET_DEFAULT_CHALLENGE - self.shared_args = [] + self.shared_args = ["-prune=550"] else: self.challenge = challenge - self.shared_args = [f"-signetchallenge={challenge}"] + self.shared_args = ["-prune=550", f"-signetchallenge={challenge}"] class SignetBasicTest(BitcoinTestFramework): def set_test_params(self): From 288163ea0fe1a69d8dabbc5b3d2877cc8f9b1c43 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Sat, 22 Mar 2025 07:36:41 +0100 Subject: [PATCH 2/7] fuzz: Fix off-by-one in package_rbf target Github-Pull: #32122 Rebased-From: fa5674c264d91eb3a99fa74ace8a1b6be113c0a8 --- src/test/fuzz/rbf.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/test/fuzz/rbf.cpp b/src/test/fuzz/rbf.cpp index 3e5b361186..db8682e27c 100644 --- a/src/test/fuzz/rbf.cpp +++ b/src/test/fuzz/rbf.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022 The Bitcoin Core developers +// Copyright (c) 2020-present The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -108,7 +108,7 @@ FUZZ_TARGET(package_rbf, .init = initialize_package_rbf) // Add a bunch of parent-child pairs to the mempool, and remember them. std::vector mempool_txs; - size_t iter{0}; + uint32_t iter{0}; // Keep track of the total vsize of CTxMemPoolEntry's being added to the mempool to avoid overflow // Add replacement_vsize since this is added to new diagram during RBF check @@ -116,9 +116,8 @@ FUZZ_TARGET(package_rbf, .init = initialize_package_rbf) if (!replacement_tx) { return; } - assert(iter <= g_outpoints.size()); replacement_tx->vin.resize(1); - replacement_tx->vin[0].prevout = g_outpoints[iter++]; + replacement_tx->vin[0].prevout = g_outpoints.at(iter++); CTransaction replacement_tx_final{*replacement_tx}; auto replacement_entry = ConsumeTxMemPoolEntry(fuzzed_data_provider, replacement_tx_final); int32_t replacement_vsize = replacement_entry.GetTxSize(); @@ -126,13 +125,13 @@ FUZZ_TARGET(package_rbf, .init = initialize_package_rbf) LOCK2(cs_main, pool.cs); - LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), NUM_ITERS) - { + while (fuzzed_data_provider.ConsumeBool()) { + if (iter >= NUM_ITERS) break; + // Make sure txns only have one input, and that a unique input is given to avoid circular references CMutableTransaction parent; - assert(iter <= g_outpoints.size()); parent.vin.resize(1); - parent.vin[0].prevout = g_outpoints[iter++]; + parent.vin[0].prevout = g_outpoints.at(iter++); parent.vout.emplace_back(0, CScript()); mempool_txs.emplace_back(parent); From 7bc7af995102c6b360f61a389060e712de79f4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Tue, 25 Mar 2025 19:22:23 +0100 Subject: [PATCH 3/7] fuzz: extract unsequenced operations with side-effects https://github.com/bitcoin/bitcoin/pull/30746#discussion_r1817851827 introduced an unsequenced operations with side-effects - which is undefined behavior, i.e. the right hand side can be evaluated before the left hand side, which happens to mutate it. Tried: ``` clang++ --analyze -std=c++20 -I./src -I./src/test -I./src/test/fuzz src/test/fuzz/base_encode_decode.cpp src/psbt.cpp ``` but it didn't warn about UB. Grepped for similar ones, but could find any other one in the codebase: > grep -rnE --include='*.cpp' --include='*.h' '\b(\w+)\(([^)]*\b(\w+)\b[^)]*)\)\s*==\s*\3\.' . ``` ./src/test/arith_uint256_tests.cpp:373: BOOST_CHECK(R1L.GetHex() == R1L.ToString()); ./src/test/arith_uint256_tests.cpp:374: BOOST_CHECK(R2L.GetHex() == R2L.ToString()); ./src/test/arith_uint256_tests.cpp:375: BOOST_CHECK(OneL.GetHex() == OneL.ToString()); ./src/test/arith_uint256_tests.cpp:376: BOOST_CHECK(MaxL.GetHex() == MaxL.ToString()); ./src/test/fuzz/cluster_linearize.cpp:565: assert(depgraph.FeeRate(best_anc.transactions) == best_anc.feerate); ./src/test/fuzz/cluster_linearize.cpp:646: assert(depgraph.FeeRate(found.transactions) == found.feerate); ./src/test/fuzz/cluster_linearize.cpp:765: assert(depgraph.FeeRate(chunk_info.transactions) == chunk_info.feerate); ./src/test/fuzz/base_encode_decode.cpp:95: assert(DecodeBase64PSBT(psbt, random_string, error) == error.empty()); ./src/test/fuzz/key.cpp:102: assert(pubkey.data() == pubkey.begin()); ./src/test/skiplist_tests.cpp:42: BOOST_CHECK(vIndex[from].GetAncestor(0) == vIndex.data()); ./src/script/signingprovider.cpp:535: ComputeTapbranchHash(node.sub[1]->hash, node.sub[1]->hash) == node.hash) { ./src/pubkey.h:78: return vch.size() > 0 && GetLen(vch[0]) == vch.size(); ./src/cluster_linearize.h:881: Assume(elem.inc.feerate.IsEmpty() == elem.pot_feerate.IsEmpty()); ``` Hodlinator deduced the UB on Windows in https://github.com/bitcoin/bitcoin/issues/32135#issuecomment-2751723855 Github-Pull: #32141 Rebased-From: b1de59e8965354fff5a149bc0fe61ed0704aea7a Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com> --- src/test/fuzz/base_encode_decode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/fuzz/base_encode_decode.cpp b/src/test/fuzz/base_encode_decode.cpp index 2ffcbdf720..4508818717 100644 --- a/src/test/fuzz/base_encode_decode.cpp +++ b/src/test/fuzz/base_encode_decode.cpp @@ -92,5 +92,6 @@ FUZZ_TARGET(psbt_base64_decode) PartiallySignedTransaction psbt; std::string error; - assert(DecodeBase64PSBT(psbt, random_string, error) == error.empty()); + const bool ok{DecodeBase64PSBT(psbt, random_string, error)}; + assert(ok == error.empty()); } From 477345207b895038a07d8ecb472d3c95b033dcc1 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 10 Mar 2025 16:55:48 +0000 Subject: [PATCH 4/7] cmake: Add `NO_CACHE_IF_FAILED` option for checking linker flags Use it for checking `-fsanitize`. This change improves the user experience when the configuration step fails due to a missing library. Now, there is no need to manually clean the CMake cache after installing the required library. Github-Pull: #32027 Rebased-From: 52ac17757eed5056d03a6861bcc24ee864c17385 --- CMakeLists.txt | 1 + cmake/module/TryAppendLinkerFlag.cmake | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b7e663134..06f88975ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -376,6 +376,7 @@ if(SANITIZERS) int main() { return 0; } " RESULT_VAR linker_supports_sanitizers + NO_CACHE_IF_FAILED ) if(NOT linker_supports_sanitizers) message(FATAL_ERROR "Linker did not accept requested flags, you are missing required libraries.") diff --git a/cmake/module/TryAppendLinkerFlag.cmake b/cmake/module/TryAppendLinkerFlag.cmake index be41a2e1cc..fe7c2bce51 100644 --- a/cmake/module/TryAppendLinkerFlag.cmake +++ b/cmake/module/TryAppendLinkerFlag.cmake @@ -20,7 +20,7 @@ In configuration output, this function prints a string by the following pattern: function(try_append_linker_flag flag) cmake_parse_arguments(PARSE_ARGV 1 TALF # prefix - "" # options + "NO_CACHE_IF_FAILED" # options "TARGET;VAR;SOURCE;RESULT_VAR" # one_value_keywords "IF_CHECK_PASSED" # multi_value_keywords ) @@ -68,6 +68,10 @@ function(try_append_linker_flag flag) if(DEFINED TALF_RESULT_VAR) set(${TALF_RESULT_VAR} "${${result}}" PARENT_SCOPE) endif() + + if(NOT ${result} AND TALF_NO_CACHE_IF_FAILED) + unset(${result} CACHE) + endif() endfunction() if(MSVC) From c0756b758fc1a458f18ccfb01127769ed39d744e Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 3 Feb 2025 12:20:31 +0000 Subject: [PATCH 5/7] depends: set CMAKE_*_COMPILER_TARGET in toolchain According to the CMake docs, this is the correct way to setup a toolchain file for cross-compilation using Clang. See https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-using-clang Internally it looks like CMake will only take this variable into account if it detects the compiler to be Clang, so this shouldn't effect other builds, but in the case of our Apple cross builds, we'd end up with a duplicated `--target=arm64-apple-darwin` on the compiler line, given we are already setting `--target` for Darwin builds. Would fix #31748. Github-Pull: #31849 Rebased-From: 963355037fe78eb4fbdda8631ac05a7b07fcec8c --- depends/Makefile | 1 + depends/toolchain.cmake.in | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/depends/Makefile b/depends/Makefile index 25c8646739..3dbd69221a 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -206,6 +206,7 @@ endif $(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id) @mkdir -p $(@D) sed -e 's|@depends_crosscompiling@|$(crosscompiling)|' \ + -e 's|@host@|$(host)|' \ -e 's|@host_system_name@|$($(host_os)_cmake_system_name)|' \ -e 's|@host_system_version@|$($(host_os)_cmake_system_version)|' \ -e 's|@host_arch@|$(host_arch)|' \ diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index 89a6e36969..65036d07a9 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -13,6 +13,10 @@ if(@depends_crosscompiling@) set(CMAKE_SYSTEM_NAME @host_system_name@) set(CMAKE_SYSTEM_VERSION @host_system_version@) set(CMAKE_SYSTEM_PROCESSOR @host_arch@) + + set(CMAKE_C_COMPILER_TARGET @host@) + set(CMAKE_CXX_COMPILER_TARGET @host@) + set(CMAKE_OBJCXX_COMPILER_TARGET @host@) endif() if(NOT DEFINED CMAKE_C_FLAGS_INIT) From 7c05ef567328031641b7197b30508d0989bd15a7 Mon Sep 17 00:00:00 2001 From: glozow Date: Fri, 28 Mar 2025 14:37:09 -0400 Subject: [PATCH 6/7] [build] bump to 29.0rc3 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06f88975ee..a5e3670ba4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ set(CLIENT_NAME "Bitcoin Core") set(CLIENT_VERSION_MAJOR 29) set(CLIENT_VERSION_MINOR 0) set(CLIENT_VERSION_BUILD 0) -set(CLIENT_VERSION_RC 2) +set(CLIENT_VERSION_RC 3) set(CLIENT_VERSION_IS_RELEASE "true") set(COPYRIGHT_YEAR "2025") From f80ab9a5d8cd5418655fe1a6f01c77926e2cc2e5 Mon Sep 17 00:00:00 2001 From: glozow Date: Fri, 28 Mar 2025 14:56:29 -0400 Subject: [PATCH 7/7] [doc] update man pages for 29.0rc3 --- doc/man/bitcoin-cli.1 | 6 +++--- doc/man/bitcoin-qt.1 | 6 +++--- doc/man/bitcoin-tx.1 | 6 +++--- doc/man/bitcoin-util.1 | 6 +++--- doc/man/bitcoin-wallet.1 | 6 +++--- doc/man/bitcoind.1 | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/man/bitcoin-cli.1 b/doc/man/bitcoin-cli.1 index 94d06025c3..d4095c8478 100644 --- a/doc/man/bitcoin-cli.1 +++ b/doc/man/bitcoin-cli.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-CLI "1" "March 2025" "bitcoin-cli v29.0.0rc2" "User Commands" +.TH BITCOIN-CLI "1" "March 2025" "bitcoin-cli v29.0.0rc3" "User Commands" .SH NAME -bitcoin-cli \- manual page for bitcoin-cli v29.0.0rc2 +bitcoin-cli \- manual page for bitcoin-cli v29.0.0rc3 .SH SYNOPSIS .B bitcoin-cli [\fI\,options\/\fR] \fI\, \/\fR[\fI\,params\/\fR] @@ -15,7 +15,7 @@ bitcoin-cli \- manual page for bitcoin-cli v29.0.0rc2 .B bitcoin-cli [\fI\,options\/\fR] \fI\,help \/\fR .SH DESCRIPTION -Bitcoin Core RPC client version v29.0.0rc2 +Bitcoin Core RPC client version v29.0.0rc3 .PP The bitcoin\-cli utility provides a command line interface to interact with a Bitcoin Core RPC server. .PP diff --git a/doc/man/bitcoin-qt.1 b/doc/man/bitcoin-qt.1 index 58640975b8..1e49f6925d 100644 --- a/doc/man/bitcoin-qt.1 +++ b/doc/man/bitcoin-qt.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-QT "1" "March 2025" "bitcoin-qt v29.0.0rc2" "User Commands" +.TH BITCOIN-QT "1" "March 2025" "bitcoin-qt v29.0.0rc3" "User Commands" .SH NAME -bitcoin-qt \- manual page for bitcoin-qt v29.0.0rc2 +bitcoin-qt \- manual page for bitcoin-qt v29.0.0rc3 .SH SYNOPSIS .B bitcoin-qt [\fI\,options\/\fR] [\fI\,URI\/\fR] .SH DESCRIPTION -Bitcoin Core version v29.0.0rc2 +Bitcoin Core version v29.0.0rc3 .PP The bitcoin\-qt application provides a graphical interface for interacting with Bitcoin Core. .PP diff --git a/doc/man/bitcoin-tx.1 b/doc/man/bitcoin-tx.1 index 7d4f7de5a3..0f5b79854f 100644 --- a/doc/man/bitcoin-tx.1 +++ b/doc/man/bitcoin-tx.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-TX "1" "March 2025" "bitcoin-tx v29.0.0rc2" "User Commands" +.TH BITCOIN-TX "1" "March 2025" "bitcoin-tx v29.0.0rc3" "User Commands" .SH NAME -bitcoin-tx \- manual page for bitcoin-tx v29.0.0rc2 +bitcoin-tx \- manual page for bitcoin-tx v29.0.0rc3 .SH SYNOPSIS .B bitcoin-tx [\fI\,options\/\fR] \fI\, \/\fR[\fI\,commands\/\fR] @@ -9,7 +9,7 @@ bitcoin-tx \- manual page for bitcoin-tx v29.0.0rc2 .B bitcoin-tx [\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] .SH DESCRIPTION -Bitcoin Core bitcoin\-tx utility version v29.0.0rc2 +Bitcoin Core bitcoin\-tx utility version v29.0.0rc3 .PP The bitcoin\-tx tool is used for creating and modifying bitcoin transactions. .PP diff --git a/doc/man/bitcoin-util.1 b/doc/man/bitcoin-util.1 index 44ff8e860a..9c7585c89b 100644 --- a/doc/man/bitcoin-util.1 +++ b/doc/man/bitcoin-util.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-UTIL "1" "March 2025" "bitcoin-util v29.0.0rc2" "User Commands" +.TH BITCOIN-UTIL "1" "March 2025" "bitcoin-util v29.0.0rc3" "User Commands" .SH NAME -bitcoin-util \- manual page for bitcoin-util v29.0.0rc2 +bitcoin-util \- manual page for bitcoin-util v29.0.0rc3 .SH SYNOPSIS .B bitcoin-util [\fI\,options\/\fR] [\fI\,command\/\fR] @@ -9,7 +9,7 @@ bitcoin-util \- manual page for bitcoin-util v29.0.0rc2 .B bitcoin-util [\fI\,options\/\fR] \fI\,grind \/\fR .SH DESCRIPTION -Bitcoin Core bitcoin\-util utility version v29.0.0rc2 +Bitcoin Core bitcoin\-util utility version v29.0.0rc3 .PP The bitcoin\-util tool provides bitcoin related functionality that does not rely on the ability to access a running node. Available [commands] are listed below. .SH OPTIONS diff --git a/doc/man/bitcoin-wallet.1 b/doc/man/bitcoin-wallet.1 index b41d5e965e..f01c058282 100644 --- a/doc/man/bitcoin-wallet.1 +++ b/doc/man/bitcoin-wallet.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-WALLET "1" "March 2025" "bitcoin-wallet v29.0.0rc2" "User Commands" +.TH BITCOIN-WALLET "1" "March 2025" "bitcoin-wallet v29.0.0rc3" "User Commands" .SH NAME -bitcoin-wallet \- manual page for bitcoin-wallet v29.0.0rc2 +bitcoin-wallet \- manual page for bitcoin-wallet v29.0.0rc3 .SH SYNOPSIS .B bitcoin-wallet [\fI\,options\/\fR] \fI\,\/\fR .SH DESCRIPTION -Bitcoin Core bitcoin\-wallet utility version v29.0.0rc2 +Bitcoin Core bitcoin\-wallet utility version v29.0.0rc3 .PP bitcoin\-wallet is an offline tool for creating and interacting with Bitcoin Core wallet files. .PP diff --git a/doc/man/bitcoind.1 b/doc/man/bitcoind.1 index b5993a052a..92ef813d95 100644 --- a/doc/man/bitcoind.1 +++ b/doc/man/bitcoind.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIND "1" "March 2025" "bitcoind v29.0.0rc2" "User Commands" +.TH BITCOIND "1" "March 2025" "bitcoind v29.0.0rc3" "User Commands" .SH NAME -bitcoind \- manual page for bitcoind v29.0.0rc2 +bitcoind \- manual page for bitcoind v29.0.0rc3 .SH SYNOPSIS .B bitcoind [\fI\,options\/\fR] .SH DESCRIPTION -Bitcoin Core daemon version v29.0.0rc2 +Bitcoin Core daemon version v29.0.0rc3 .PP The Bitcoin Core daemon (bitcoind) is a headless program that connects to the Bitcoin network to validate and relay transactions and blocks, as well as relaying addresses. .PP