From 500bba0561cdae809cf550317ede867d3ffce662 Mon Sep 17 00:00:00 2001 From: Martin Zumsande Date: Tue, 30 Jul 2024 17:49:04 -0400 Subject: [PATCH 1/4] test: fix constructor of msg_tx In python, if the default value is a mutable object (here: a class) its shared over all instances, so that one instance being changed would affect others to be changed as well. This was likely the source of various intermittent bugs in the functional tests. Github-Pull: #30552 Rebased-From: ec5e294e4b830766dcc4a80add0613d3705c1794 --- test/functional/test_framework/messages.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 1780678de1e..dc5f665b6a6 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -1293,8 +1293,11 @@ class msg_tx: __slots__ = ("tx",) msgtype = b"tx" - def __init__(self, tx=CTransaction()): - self.tx = tx + def __init__(self, tx=None): + if tx is None: + self.tx = CTransaction() + else: + self.tx = tx def deserialize(self, f): self.tx.deserialize(f) From ccff378a284530d28506347db70db08eb53f6160 Mon Sep 17 00:00:00 2001 From: Matt Whitlock Date: Wed, 7 Aug 2024 22:04:40 -0400 Subject: [PATCH 2/4] add missing #include for GCC 15 Github-Pull: #30633 Rebased-From: 138f8671569f7ebb8c84e9d80c44cddeda9e3845 --- src/chainparamsbase.h | 1 + src/node/interface_ui.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index ea933d1ca83..72807501d9d 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -7,6 +7,7 @@ #include +#include #include #include diff --git a/src/node/interface_ui.h b/src/node/interface_ui.h index 22c241cb78e..85c34f58342 100644 --- a/src/node/interface_ui.h +++ b/src/node/interface_ui.h @@ -6,9 +6,10 @@ #ifndef BITCOIN_NODE_INTERFACE_UI_H #define BITCOIN_NODE_INTERFACE_UI_H +#include #include -#include #include +#include class CBlockIndex; enum class SynchronizationState; From 57de0f5e7722b2b3ed5b8f3ea4b19aa532e1dcd0 Mon Sep 17 00:00:00 2001 From: Matt Whitlock Date: Wed, 7 Aug 2024 21:14:28 -0400 Subject: [PATCH 3/4] policy/feerate.h: avoid constraint self-dependency In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/format:48, from /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/chrono_io.h:39, from /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/chrono:3362, from ./util/time.h:9, from ./primitives/block.h:12, from ./blockencodings.h:8, from blockencodings.cpp:5: /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/type_traits: In substitution of 'template requires !(is_same_v, typename std::remove_cvref<_It2>::type>) && (is_constructible_v<_Tp, const _Up&>) && (__construct_from_contained_value<_Up, typename std::remove_cv< >::type>) constexpr std::optional::optional(const std::optional<_Tp>&) [with _Up = CFeeRate]': /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/type_traits:1140:25: required by substitution of 'template using std::__is_constructible_impl = std::__bool_constant<__is_constructible(_Tp, _Args ...)> [with _Tp = CFeeRate; _Args = {std::optional&}]' 1140 | = __bool_constant<__is_constructible(_Tp, _Args...)>; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/type_traits:1145:12: required from 'struct std::is_constructible&>' 1145 | struct is_constructible | ^~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/type_traits:178:35: required by substitution of 'template std::__detail::__first_t, typename std::enable_if<(!(bool)(_Bn::value)), void>::type ...> std::__detail::__or_fn(int) [with _Bn = {std::is_constructible&>, std::is_convertible&, CFeeRate>, std::is_constructible >, std::is_convertible, CFeeRate>, std::is_constructible&>, std::is_convertible&, CFeeRate>, std::is_constructible >, std::is_convertible, CFeeRate>}]' 178 | __enable_if_t...>; | ^~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/type_traits:196:41: required from 'struct std::__or_&>, std::is_convertible&, CFeeRate>, std::is_constructible >, std::is_convertible, CFeeRate>, std::is_constructible&>, std::is_convertible&, CFeeRate>, std::is_constructible >, std::is_convertible, CFeeRate> >' 196 | : decltype(__detail::__or_fn<_Bn...>(0)) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/optional:824:45: required from 'constexpr const bool std::optional::__construct_from_contained_value' 824 | = !__converts_from_optional<_Tp, _From>::value; | ^~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/optional:884:7: required by substitution of 'template requires !(is_same_v, typename std::remove_cvref<_It2>::type>) && (is_constructible_v<_Tp, const _Up&>) && (__construct_from_contained_value<_Up, typename std::remove_cv< >::type>) constexpr std::optional::optional(const std::optional<_Tp>&) [with _Up = CFeeRate]' 884 | && __construct_from_contained_value<_Up> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./validation.h:164:41: required from here 164 | return MempoolAcceptResult(state); | ^ /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/optional:886:2: required by the constraints of 'template template requires !(is_same_v, typename std::remove_cvref<_It2>::type>) && (is_constructible_v<_Tp, const _Up&>) && (__construct_from_contained_value<_Up, typename std::remove_cv< >::type>) constexpr std::optional<_Tp>::optional(const std::optional<_From>&)' /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/optional:884:14: error: satisfaction of atomic constraint '__construct_from_contained_value<_Up, typename std::remove_cv< >::type> [with _Tp = _Tp; _Up = _Up]' depends on itself 884 | && __construct_from_contained_value<_Up> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Github-Pull: #30633 Rebased-From: 055bc05792ff5d5b084563044818ebec12bfd748 --- src/policy/feerate.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/policy/feerate.h b/src/policy/feerate.h index 2e501729148..d742a43acc7 100644 --- a/src/policy/feerate.h +++ b/src/policy/feerate.h @@ -38,10 +38,8 @@ private: public: /** Fee rate of 0 satoshis per kvB */ CFeeRate() : nSatoshisPerK(0) { } - template + template // Disallow silent float -> int conversion explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { - // We've previously had bugs creep in from silent double->int conversion... - static_assert(std::is_integral::value, "CFeeRate should be used without floats"); } /** From b06c4c6550545351610fc3278dffdd63d5954cf8 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 6 Aug 2024 11:17:36 +0100 Subject: [PATCH 4/4] [WIP] doc: update release notes for 27.x --- doc/release-notes.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/release-notes.md b/doc/release-notes.md index c5e3e6826e8..ee66d33543e 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -56,9 +56,14 @@ Notable changes - #29855 psbt: Check non witness utxo outpoint early +### Test + +- #30552 test: fix constructor of msg_tx + ### Build - #30283 upnp: fix build with miniupnpc 2.2.8 +- #30633 Fixes for GCC 15 compatibility ### CI @@ -73,6 +78,7 @@ Thanks to everyone who directly contributed to this release: - Ava Chow - Cory Fields - Martin Zumsande +- Matt Whitlock - Max Edwards - Sebastian Falbesoner - willcl-ark