-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: resolve compiler warnings, suppress errors on -Warray-bounds and -Wdangling-reference, re-enable -Werror for GCC
#6639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
903b44b to
aa4134a
Compare
-Warray-bounds and -Wdangling-reference, re-enable -Werror-enabled builds for GCC-Warray-bounds and -Wdangling-reference, re-enable -Werror for GCC
|
This pull request has conflicts, please rebase. |
…bitcoin#29486, bitcoin#25972 (ensure `WARN_CXXFLAGS` are populated to ensure expected `--enable-werror` behavior) af14f23 ci: don't build using `-Werror` when using Clang (Kittywhiskers Van Gogh) 3b837c8 ci: don't build using `-Werror` when using GCC (Kittywhiskers Van Gogh) 04e036e revert: make fuzzing builds stricter by enabling -Werror by default (Kittywhiskers Van Gogh) 29090a0 merge bitcoin#25972: no-longer disable WARN_CXXFLAGS when CXXFLAGS is set (Kittywhiskers Van Gogh) d0548f8 merge bitcoin#29486: remove -Wdocumentation conditional (Kittywhiskers Van Gogh) 0f4812f merge bitcoin#27872: suppress external warnings by default (Kittywhiskers Van Gogh) 7100780 merge bitcoin#28999: Enable -Wunreachable-code (Kittywhiskers Van Gogh) 5471c58 merge bitcoin#28092: document that -Wreturn-type has been fixed upstream (mingw-w64) (Kittywhiskers Van Gogh) 9098c9c build: always enable -Wsuggest-override (Kittywhiskers Van Gogh) Pull request description: ## Motivation While working on [dash#6633](#6633), I had built `develop` (5e4a892) but the build _failed_ locally due to a `-Wthread-safety` warning (see below) that was introduced by [bitcoin#25337](bitcoin#25337) ([commit](a7d4127)). It was caught because I use additional `CXXFLAGS` on my local system but it _should_ have been caught by CI, especially since [bitcoin#20182](bitcoin#20182) ([commit](14a67ee)) made `--enable-werror` the default for CI and the sole exception (the Windows build) was remedied with [bitcoin#20586](bitcoin#20586) ([commit](750447e)), so every build variant should've run with `-Werror`. <details> <summary>Compile error:</summary> ``` CXX wallet/libbitcoin_wallet_a-sqlite.o wallet/rpcwallet.cpp:1038:36: error: calling function 'IsMine' requires holding mutex 'wallet.cs_wallet' exclusively [-Werror,-Wthread-safety-analysis] 1038 | isminefilter mine = wallet.IsMine(address); | ^ ``` </details> But that didn't happen. Till [bitcoin#23149](70ed6b4), there were a separate set of warnings (overridable by `CXXFLAGS`) and errors (overridable by `CXXFLAG_WERROR`). _Before_ the backport, coverage was as expected ([build](https://gitlab.com/dashpay/dash/-/jobs/9221165750#L786), search for `-Werror=thread-safety`) but _after_ the backport, `thread-safety` (and other expected warnings) were no longer being evaluated ([build](https://gitlab.com/dashpay/dash/-/jobs/9238308844#L740), search for `-Werror` and `-Wthread-safety`, only the former is present). Expected `CXXFLAGS`: ``` CXXFLAGS = -O0 -g3 -ftrapv -fdebug-prefix-map=$(abs_top_srcdir)=. -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wreorder -Wvla -Wshadow-field -Wthread-safety -Wloop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Werror -pipe -std=c++20 -O2 -O0 -g0 ``` Actual `CXXFLAGS`: ``` CXXFLAGS = -O0 -g3 -ftrapv -fdebug-prefix-map=$(abs_top_srcdir)=. -Werror -pipe -std=c++20 -O2 -O0 -g0 ``` This happened because `CXXFLAGS` are overridden by default which results in none of the warnings making it to the final `CXXFLAGS`, which reduced the effectiveness of `-Werror` substantially (while `CXXFLAG_WERROR` was left undisturbed, which allowed pre-backport builds to include coverage). This is remedied by backporting [bitcoin#25972](bitcoin#25972) (done by this PR), which will ensure that `WARN_CXXFLAGS` are included _even if `CXXFLAGS` are overridden_ and is possible because [bitcoin#24391](bitcoin#24391) ([commit](11323c3)) is already in `develop`. ## Additional Information * Dependency for #6638 * Dependency for #6639 * Because the warnings (converted to errors with `-Werror`) cast a wider net than the older set of error flags, `develop` in its current state does not compile. To allow CI to bless this PR, `-Werror` for both Clang and GCC-based builds have been **tentatively** disabled and will be re-enabled by the dependent PRs listed above. It is recommended to read the pull request description for both dependents while reviewing this PR. * `-Wsuggest-override` was made unconditional in [bitcoin#28348](bitcoin#28348) ([commit](c71e3df)) **but** there were two such conditional checks, they were deduplicated in [bitcoin#23149](bitcoin#23149) but the former was merged before the latter (i.e. out-of-order) and one conditional check lingered around. This lingering check has been removed as we don't support GCC 9.2. * `CXXFLAGS` set for the fuzz build ([commit](184bd60)) that enabled `-Werror` are made redundant with [bitcoin#20182](bitcoin#20182) and therefore, have been removed. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK af14f23 Tree-SHA512: ccdaf71cf79eb3aec2468c4c1eaa696cd120c03e9665a3c4b56da6ef17cca9585ef8c66ac1625f2ba243c7f80f15e92a336c0bd90b5f11969fabb3adde3c8125
…n#27872, bitcoin#29486, bitcoin#25972 (ensure `WARN_CXXFLAGS` are populated to ensure expected `--enable-werror` behavior) af14f23 ci: don't build using `-Werror` when using Clang (Kittywhiskers Van Gogh) 3b837c8 ci: don't build using `-Werror` when using GCC (Kittywhiskers Van Gogh) 04e036e revert: make fuzzing builds stricter by enabling -Werror by default (Kittywhiskers Van Gogh) 29090a0 merge bitcoin#25972: no-longer disable WARN_CXXFLAGS when CXXFLAGS is set (Kittywhiskers Van Gogh) d0548f8 merge bitcoin#29486: remove -Wdocumentation conditional (Kittywhiskers Van Gogh) 0f4812f merge bitcoin#27872: suppress external warnings by default (Kittywhiskers Van Gogh) 7100780 merge bitcoin#28999: Enable -Wunreachable-code (Kittywhiskers Van Gogh) 5471c58 merge bitcoin#28092: document that -Wreturn-type has been fixed upstream (mingw-w64) (Kittywhiskers Van Gogh) 9098c9c build: always enable -Wsuggest-override (Kittywhiskers Van Gogh) Pull request description: ## Motivation While working on [dash#6633](dashpay#6633), I had built `develop` (5e4a892) but the build _failed_ locally due to a `-Wthread-safety` warning (see below) that was introduced by [bitcoin#25337](bitcoin#25337) ([commit](dashpay@a7d4127)). It was caught because I use additional `CXXFLAGS` on my local system but it _should_ have been caught by CI, especially since [bitcoin#20182](bitcoin#20182) ([commit](dashpay@14a67ee)) made `--enable-werror` the default for CI and the sole exception (the Windows build) was remedied with [bitcoin#20586](bitcoin#20586) ([commit](dashpay@750447e)), so every build variant should've run with `-Werror`. <details> <summary>Compile error:</summary> ``` CXX wallet/libbitcoin_wallet_a-sqlite.o wallet/rpcwallet.cpp:1038:36: error: calling function 'IsMine' requires holding mutex 'wallet.cs_wallet' exclusively [-Werror,-Wthread-safety-analysis] 1038 | isminefilter mine = wallet.IsMine(address); | ^ ``` </details> But that didn't happen. Till [bitcoin#23149](dashpay@70ed6b4), there were a separate set of warnings (overridable by `CXXFLAGS`) and errors (overridable by `CXXFLAG_WERROR`). _Before_ the backport, coverage was as expected ([build](https://gitlab.com/dashpay/dash/-/jobs/9221165750#L786), search for `-Werror=thread-safety`) but _after_ the backport, `thread-safety` (and other expected warnings) were no longer being evaluated ([build](https://gitlab.com/dashpay/dash/-/jobs/9238308844#L740), search for `-Werror` and `-Wthread-safety`, only the former is present). Expected `CXXFLAGS`: ``` CXXFLAGS = -O0 -g3 -ftrapv -fdebug-prefix-map=$(abs_top_srcdir)=. -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wreorder -Wvla -Wshadow-field -Wthread-safety -Wloop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wunreachable-code-loop-increment -Wimplicit-fallthrough -Wno-unused-parameter -Wno-self-assign -Werror -pipe -std=c++20 -O2 -O0 -g0 ``` Actual `CXXFLAGS`: ``` CXXFLAGS = -O0 -g3 -ftrapv -fdebug-prefix-map=$(abs_top_srcdir)=. -Werror -pipe -std=c++20 -O2 -O0 -g0 ``` This happened because `CXXFLAGS` are overridden by default which results in none of the warnings making it to the final `CXXFLAGS`, which reduced the effectiveness of `-Werror` substantially (while `CXXFLAG_WERROR` was left undisturbed, which allowed pre-backport builds to include coverage). This is remedied by backporting [bitcoin#25972](bitcoin#25972) (done by this PR), which will ensure that `WARN_CXXFLAGS` are included _even if `CXXFLAGS` are overridden_ and is possible because [bitcoin#24391](bitcoin#24391) ([commit](dashpay@11323c3)) is already in `develop`. ## Additional Information * Dependency for dashpay#6638 * Dependency for dashpay#6639 * Because the warnings (converted to errors with `-Werror`) cast a wider net than the older set of error flags, `develop` in its current state does not compile. To allow CI to bless this PR, `-Werror` for both Clang and GCC-based builds have been **tentatively** disabled and will be re-enabled by the dependent PRs listed above. It is recommended to read the pull request description for both dependents while reviewing this PR. * `-Wsuggest-override` was made unconditional in [bitcoin#28348](bitcoin#28348) ([commit](dashpay@c71e3df)) **but** there were two such conditional checks, they were deduplicated in [bitcoin#23149](bitcoin#23149) but the former was merged before the latter (i.e. out-of-order) and one conditional check lingered around. This lingering check has been removed as we don't support GCC 9.2. * `CXXFLAGS` set for the fuzz build ([commit](dashpay@184bd60)) that enabled `-Werror` are made redundant with [bitcoin#20182](bitcoin#20182) and therefore, have been removed. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK af14f23 Tree-SHA512: ccdaf71cf79eb3aec2468c4c1eaa696cd120c03e9665a3c4b56da6ef17cca9585ef8c66ac1625f2ba243c7f80f15e92a336c0bd90b5f11969fabb3adde3c8125
…Werror` for Clang, merge bitcoin#13633 c7748cd revert: don't build using `-Werror` when using Clang (Kittywhiskers Van Gogh) 1015f9b fix: resolve `-Wunreachable-code` warnings, add comment for explanation (Kittywhiskers Van Gogh) 10cb3e4 fix: resolve `-Wlogical-op-parentheses` warnings (Kittywhiskers Van Gogh) 7459b1e fix: resolve `-Wunused-private-field` warnings (Kittywhiskers Van Gogh) 7a52083 fix: resolve `-Wmissing-field-initializers` warnings (Kittywhiskers Van Gogh) 184b463 fix: resolve `-Wdelete-non-abstract-non-virtual-dtor` warnings (Kittywhiskers Van Gogh) 53d29e9 fix: sidestep `-Wunused-function` warnings with `[[maybe_unused]]` (Kittywhiskers Van Gogh) 9315e69 move-only: keep functions used in wallet-enabled segments within macro (Kittywhiskers Van Gogh) 6729d69 fix: add missing lock annotation in lambda expression (Kittywhiskers Van Gogh) f6d1eb9 chore: drop extraneous unused `ApplyStats()` definition (Kittywhiskers Van Gogh) df9c926 chore: drop unused `EraseOldDBData()` (Kittywhiskers Van Gogh) c9cb9a6 merge bitcoin#13633: Drop dead code from Stacks (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Depends on #6637 * Dependency for #6639 * While [bitcoin#13633](bitcoin#13633) was originally marked as DNM in the backports spreadsheet for being SegWit-related, it's not SegWit-_dependent_ and is for dead code removal, which is necessary due to the enforcement of `-Wunused-function`. It has therefore been included. * `EraseOldDBData()` fell into disuse after [dash#6579](#6579) but wasn't removed then. It has been removed now due to `-Wunused-function` enforcement. * An extraneous `ApplyStats()` definition was left over when backporting [bitcoin#19145](bitcoin#19145). It has been removed now due to `-Wunused-function` enforcement. * [bitcoin#25337](bitcoin#25337) ([commit](a7d4127)) did not include a lock annotation for the lambda expression in `ListReceived()`. It has been added alongside `AssertLockHeld`s for both the lambda expression and the function. This was done to pass `-Wthread-safety` enforcement. * `ParsePubKeyIDFromAddress()`, `ParseBLSPubKey()` and `ValidatePlatformPort()` have been moved inside the `ENABLE_WALLET` macro conditional to avoid `-Wunused-function` warnings if building with wallets disabled. * Some dead code cannot be removed because they are either part of partial backports that may be completed in the future or complicate backports in the future that may expect their presence. To keep `-Wunused-function` happy, they have been marked with `[[maybe_unused]]` and this annotation should be removed when they are used. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK c7748cd PastaPastaPasta: utACK c7748cd Tree-SHA512: 5d746773a1f49c33f373250ba459a5da4301fea0cb5202d26717808d8a4985920cbdfec0903ed884f20561f8d40082b4ea796e78912bacff00e0645d355ec9f2
WalkthroughThis set of changes introduces several notable updates across the codebase. A new source file, A new utility function, Several scripts for setting up CI test environments are updated to remove the export of the Additional minor changes include header inclusion adjustments, buffer initialization improvements, a new overload for the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
💤 Files with no reviewable changes (5)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (10)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/util/irange.h (1)
43-43: Changed operator-> to return a non-const pointerThe modification of
Range::iterator::operator->()to return a non-const pointer instead of a const pointer allows for mutable access through the iterator's arrow operator. This change addresses compiler warnings but could potentially lead to unintended modification of values during iteration if not used carefully.Consider adding a brief comment explaining why this change was made, particularly since it changes behavior by allowing mutable access where it may have been const before.
ci/test/00_setup_env_native_sqlite.sh (1)
13-13: Consider adding dangling‑reference suppression for SQLite build
Other CI jobs suppress-Wno-error=dangling-referencedue to known UniValue-related warnings. If the SQLite variant pulls in the same serialization code, you may encounter dangling‑reference errors here too.-export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --with-sqlite --without-bdb CC=gcc-11 CXX=g++-11 CXXFLAGS='-Wno-error=array-bounds -Wno-error=attributes'" +export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --with-sqlite --without-bdb CC=gcc-11 CXX=g++-11 CXXFLAGS='-Wno-error=array-bounds -Wno-error=attributes -Wno-error=dangling-reference'"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between db5d000 and 31becc4c2bc153892ca07ab2dbe19fcc1accc822.
📒 Files selected for processing (40)
ci/test/00_setup_env_arm.sh(1 hunks)ci/test/00_setup_env_native_nowallet.sh(1 hunks)ci/test/00_setup_env_native_qt5.sh(1 hunks)ci/test/00_setup_env_native_sqlite.sh(1 hunks)ci/test/00_setup_env_win64.sh(1 hunks)src/Makefile.am(1 hunks)src/coinjoin/client.cpp(1 hunks)src/coinjoin/util.cpp(0 hunks)src/core_io.h(2 hunks)src/core_write.cpp(1 hunks)src/evo/assetlocktx.cpp(1 hunks)src/evo/assetlocktx.h(2 hunks)src/evo/cbtx.cpp(0 hunks)src/evo/cbtx.h(0 hunks)src/evo/chainhelper.cpp(2 hunks)src/evo/chainhelper.h(3 hunks)src/evo/core_write.cpp(1 hunks)src/evo/deterministicmns.cpp(3 hunks)src/evo/mnhftx.h(0 hunks)src/evo/providertx.h(0 hunks)src/governance/object.cpp(2 hunks)src/governance/vote.cpp(0 hunks)src/llmq/chainlocks.cpp(2 hunks)src/llmq/commitment.h(0 hunks)src/llmq/dkgsession.cpp(0 hunks)src/llmq/instantsend.cpp(4 hunks)src/llmq/utils.cpp(0 hunks)src/rpc/blockchain.cpp(1 hunks)src/rpc/blockchain.h(1 hunks)src/rpc/mempool.cpp(1 hunks)src/stacktraces.cpp(2 hunks)src/test/block_reward_reallocation_tests.cpp(1 hunks)src/test/evo_deterministicmns_tests.cpp(1 hunks)src/util/irange.h(1 hunks)src/util/wpipe.cpp(2 hunks)src/validation.cpp(1 hunks)src/validation.h(0 hunks)src/wallet/scriptpubkeyman.cpp(1 hunks)src/wallet/scriptpubkeyman.h(1 hunks)test/lint/lint-circular-dependencies.py(1 hunks)
💤 Files with no reviewable changes (10)
- src/coinjoin/util.cpp
- src/evo/mnhftx.h
- src/llmq/utils.cpp
- src/governance/vote.cpp
- src/llmq/dkgsession.cpp
- src/evo/cbtx.cpp
- src/llmq/commitment.h
- src/evo/cbtx.h
- src/validation.h
- src/evo/providertx.h
🧰 Additional context used
🧬 Code Graph Analysis (8)
src/core_write.cpp (3)
src/core_io.h (9)
ToJson(73-73)ToJson(74-74)ToJson(75-75)ToJson(76-76)ToJson(77-77)ToJson(78-78)ToJson(79-79)ToJson(80-80)ToJson(81-81)src/evo/assetlocktx.h (2)
ToJson(52-52)ToJson(109-109)src/evo/core_write.cpp (5)
ToJson(14-14)ToJson(33-33)ToJson(45-45)ToJson(62-62)ToJson(86-86)
src/rpc/blockchain.cpp (2)
src/core_io.h (9)
ToJson(73-73)ToJson(74-74)ToJson(75-75)ToJson(76-76)ToJson(77-77)ToJson(78-78)ToJson(79-79)ToJson(80-80)ToJson(81-81)src/evo/core_write.cpp (5)
ToJson(14-14)ToJson(33-33)ToJson(45-45)ToJson(62-62)ToJson(86-86)
src/evo/deterministicmns.cpp (2)
src/evo/chainhelper.cpp (2)
GetTransactionBlock(65-70)GetTransactionBlock(65-65)src/evo/chainhelper.h (1)
GetTransactionBlock(70-71)
src/governance/object.cpp (2)
src/evo/chainhelper.cpp (2)
GetTransactionBlock(65-70)GetTransactionBlock(65-65)src/evo/chainhelper.h (1)
GetTransactionBlock(70-71)
src/llmq/chainlocks.cpp (2)
src/evo/chainhelper.h (3)
tx(59-59)tx(61-61)GetTransactionBlock(70-71)src/evo/chainhelper.cpp (2)
GetTransactionBlock(65-70)GetTransactionBlock(65-65)
src/wallet/scriptpubkeyman.cpp (2)
src/wallet/wallet.cpp (8)
IsMine(1526-1530)IsMine(1526-1526)IsMine(1532-1536)IsMine(1532-1532)IsMine(1538-1546)IsMine(1538-1538)IsMine(1548-1555)IsMine(1548-1548)src/wallet/scriptpubkeyman.h (29)
dest(164-164)dest(164-164)dest(166-166)dest(166-166)dest(202-202)dest(202-202)dest(272-272)dest(274-274)dest(319-319)dest(321-321)dest(350-350)dest(406-406)dest(408-408)dest(412-412)dest(414-414)dest(545-545)script(165-165)script(165-165)script(204-204)script(204-204)script(209-209)script(209-209)script(320-320)script(354-354)script(356-356)script(528-528)script(546-546)script(579-579)script(581-581)
src/wallet/scriptpubkeyman.h (2)
src/wallet/rpcwallet.cpp (2)
dest(3786-3786)dest(3786-3786)src/wallet/wallet.h (4)
dest(608-608)dest(826-826)dest(828-828)dest(859-859)
src/core_io.h (3)
src/evo/mnhftx.h (1)
nodiscard(50-59)src/evo/core_write.cpp (9)
nodiscard(14-31)nodiscard(33-43)nodiscard(45-60)nodiscard(62-84)nodiscard(86-98)nodiscard(100-108)nodiscard(110-127)nodiscard(129-135)nodiscard(137-144)src/llmq/commitment.h (2)
nodiscard(74-80)nodiscard(122-139)
🔇 Additional comments (46)
src/stacktraces.cpp (1)
149-165:Details
✅ Verification successful
Guard Windows-specific
ConvertAddressbehindENABLE_STACKTRACES
WrappingConvertAddress(and its explanatory comments) in#ifdef ENABLE_STACKTRACESensures the function is only compiled when stacktraces are enabled, avoiding undefined-symbol errors whenENABLE_STACKTRACESis off.
🏁 Script executed:
#!/bin/bash # Verify there are no stray references to ConvertAddress outside ENABLE_STACKTRACES rg -n "ConvertAddress" -g '*.cpp' -g '*.h'Length of output: 396
🏁 Script executed:
#!/bin/bash # Display lines around the ConvertAddress call to check if it's within ENABLE_STACKTRACES sed -n '200,260p' src/stacktraces.cppLength of output: 1591
🏁 Script executed:
#!/bin/bash # Inspect lines around other ConvertAddress references to confirm they are inside ENABLE_STACKTRACES sed -n '350,500p' src/stacktraces.cppLength of output: 3868
All
ConvertAddressusage is properly guarded
TheConvertAddressfunction and its sole call are enclosed in#ifdef ENABLE_STACKTRACES. No unguarded references remain.src/rpc/mempool.cpp (1)
17-17: Added validation.h headerThis include addition aligns with the PR's goal of reorganizing header dependencies to resolve circular dependencies related to transaction retrieval. It ensures the RPC mempool code has access to the necessary validation functionality.
src/test/block_reward_reallocation_tests.cpp (1)
14-14: Added node/transaction.h headerThis include addition is consistent with similar changes in other test files, properly adjusting dependencies for transaction handling. It reflects the PR's refactoring work to improve modularity by separating transaction functionality from validation.
src/coinjoin/client.cpp (1)
7-7: Replaced validation.h with chain.hThis change replaces a direct dependency on validation.h with chain.h, which is a positive step toward reducing coupling and improving modularity. This aligns with the PR's goal of removing direct inclusion of validation.h across multiple files to reduce circular dependencies.
ci/test/00_setup_env_win64.sh (1)
19-19: Adopt fine‑grained warning suppression
Removing the globalNO_WERROR=1and instead appending targeted-Wno-errorflags toCXXFLAGSis a solid improvement. The quoting is correctly balanced and aligns with other CI environments.ci/test/00_setup_env_native_nowallet.sh (1)
14-14: Consistent targeted warning suppression for no‑wallet build
RemovingNO_WERROR=1and injecting only the specific-Wno-errorflags (array-bounds,dangling-reference) keeps the build strict while silencing only known problematic warnings.ci/test/00_setup_env_arm.sh (1)
28-28: Maintain ABI‑warning suppression in ARM cross‑compile
The consolidatedCXXFLAGScorrectly disablesarray-bounds,dangling-reference, andpsabierrors—which is necessary for stable ARM builds given GCC’s ABI change warnings.ci/test/00_setup_env_native_qt5.sh (1)
18-18:Details
❓ Verification inconclusive
Verify that linker flags are picked up in Qt5 build
MovingLDFLAGS=-static-libstdc++to the end still looks valid, but flag ordering can sometimes affect configure scripts. Please confirm that this flag is correctly honored.
🏁 Script executed:
#!/bin/bash # Check that -static-libstdc++ appears in the Qt5 configure link flags grep -R "LDFLAGS" build/config.log | grep static-libstdc++Length of output: 108
I’ll locate where the Qt5 configure log actually lives and inspect the setup script to verify how LDFLAGS is passed.
🏁 Script executed:
#!/bin/bash set -euxo pipefail # Show the Qt5 environment setup steps to see where config.log should appear sed -n '1,200p' ci/test/00_setup_env_native_qt5.sh # Search the repo for any configure logs find . -type f -name config.logLength of output: 1114
I’ll locate where the Qt5 configure script is actually invoked to confirm that
$BITCOIN_CONFIG(and thusLDFLAGS=-static-libstdc++) is passed through.
🏁 Script executed:
#!/bin/bash set -euxo pipefail # Find all configure invocations in the Qt5 CI scripts grep -R -n './configure' ci/testLength of output: 53
I’ll locate where
BITCOIN_CONFIGis consumed and whereconfigureis invoked in the Qt5 CI flow.
🏁 Script executed:
#!/bin/bash set -euxo pipefail # List all CI test scripts find ci/test -maxdepth 1 -type f -name '*.sh' -print # Find where BITCOIN_CONFIG is referenced grep -R -n 'BITCOIN_CONFIG' ci/test # Find actual configure invocations in the CI scripts grep -R -n '[[:space:]]configure' ci/testLength of output: 4031
Verify that
-static-libstdc++is applied in the Qt5 buildAutomatic grepping of
build/config.logdidn’t locate any logs, so please manually confirm that the linker flag is honored:• After running the Qt5 configure step, inspect the generated logs or
config.statusin the build directory (e.g.build/qt*/config.log) to ensure-static-libstdc++appears in the final link‑flags.
• Alternatively, examine the actual link commands or resulting binaries underbuild/qt*/lib(for example, runlddon a Qt5 shared object to verify it does not listlibstdc++.so).If you cannot find the logs in
build/, adjust the build invocation or search paths accordingly and reconfirm thatLDFLAGS=-static-libstdc++fromBITCOIN_CONFIGis passed through.src/test/evo_deterministicmns_tests.cpp (1)
13-13: Include<node/transaction.h>to resolveGetTransaction.
The new include ensures the declaration forGetTransaction()is visible in this test file, fixing the missing header issue.src/Makefile.am (1)
776-776: Addevo/core_write.cppto build.
The new serialization implementation inevo/core_write.cppis now correctly compiled intolibbitcoin_common.a.src/evo/assetlocktx.cpp (1)
17-17: Include<node/blockstorage.h>for block lookup.
This header providesBlockManagerandLookupBlockIndex, which are used inCheckAssetUnlockTx.src/rpc/blockchain.cpp (1)
192-192: Switch to freeToJsonforCCbTx.
Replaces the removed memberToJson()with the new centralized::ToJson(*opt_cbTx), leveraging the free function declared incore_io.h.src/wallet/scriptpubkeyman.cpp (1)
1828-1832: Good addition of theIsMinemethod for CTxDestination.This method properly implements the virtual function declared in the base class, providing consistency with the
LegacyScriptPubKeyManimplementation. It correctly converts the destination to a script and reuses the existing script-basedIsMinemethod.src/rpc/blockchain.h (1)
19-19: Good use of forward declaration.Adding a forward declaration for
BlockManagerinstead of including the fullvalidation.hheader reduces compilation dependencies, which can improve build times.src/util/wpipe.cpp (2)
67-67: Good practice: initializing buffer with zeros.Explicitly initializing the buffer with
{}ensures it starts with all zeros, which is a safer approach than leaving it uninitialized. This helps prevent potential undefined behavior and addresses compiler warnings about uninitialized variables.
81-81: Good practice: initializing buffer with zeros.Same as above - proper initialization of the buffer ensures a known state before writing to the pipe, which is a good defensive programming practice.
src/evo/deterministicmns.cpp (2)
5-5: Include changes align with refactoring approachThe addition of
#include <evo/chainhelper.h>and#include <coins.h>reflects the dependency change from usingvalidation.hdirectly to using the new helper function instead. This reduces circular dependencies.Also applies to: 17-17
55-55: LGTM! Using structured bindings improves code clarityThe change to use
GetTransactionBlockwith structured bindings is a good refactoring that simplifies the transaction and block hash retrieval pattern. The function properly returns a pair of transaction reference and block hash, and the code correctly uses structured bindings to extract just the transaction reference (ignoring the block hash with_).src/core_write.cpp (1)
287-287: LGTM! Function calls correctly refactored to use global ToJson functionsThese changes are part of a broader refactoring that moves JSON serialization logic from member methods to free-standing functions. Consistently replacing member
ToJson()methods with global::ToJson()functions while dereferencing the optional payload objects is the correct approach.This refactoring provides several benefits:
- Separates data structures from serialization logic
- Centralizes JSON formatting code in one place
- Reduces dependencies in class implementations
- Improves maintainability of the serialization code
The scope operator
::ensures the global function is called rather than any member function.Also applies to: 291-291, 295-295, 299-299, 303-303, 307-307, 311-311, 315-315, 319-319
src/validation.cpp (1)
729-730: Good refactoring to reduce circular dependenciesThe code now uses the new
GetTransactionBlock()function with structured binding to retrieve the conflicting transaction, replacing what was likely a call toGetTransaction()with more parameters. This implements the PR objective of introducing a proxy function to reduce circular dependencies.src/governance/object.cpp (2)
10-10: Added include for chainhelper.h to support GetTransactionBlock usage.This inclusion is necessary to access the new
GetTransactionBlockfunction now being used in this file.
471-471: Improved transaction retrieval with structured binding.The change replaces the previous call to
GetTransactionwith the newGetTransactionBlockfunction that returns both the transaction and block hash in a single call, improving code readability by eliminating the need for an output parameter.-CTransactionRef txCollateral = GetTransaction(/* block_index */ nullptr, /* mempool */ nullptr, - m_obj.collateralHash, Params().GetConsensus(), nBlockHash); +auto [txCollateral, nBlockHash] = GetTransactionBlock(m_obj.collateralHash);src/llmq/instantsend.cpp (4)
16-16: Added include for chainhelper.h to support GetTransactionBlock usage.This inclusion is necessary to access the new
GetTransactionBlockfunction used in this file.
578-578: Improved transaction retrieval in CheckCanLock with structured binding.Replaces the previous call to
GetTransactionwith the newGetTransactionBlockfunction that returns both the transaction and block hash in a single call. This change improves code readability by eliminating the need for an output parameter.
635-635: Improved transaction retrieval in HandleNewInputLockRecoveredSig using structured binding.Replaces the previous call to
GetTransactionwith the newGetTransactionBlockfunction. This continues the pattern of refactoring transaction retrieval throughout the codebase for better readability.
1014-1014: Improved transaction retrieval in ProcessInstantSendLock using structured binding.Replaces the previous call to
GetTransactionwith the newGetTransactionBlockfunction, providing a cleaner and more modern API for transaction retrieval.src/llmq/chainlocks.cpp (2)
13-13: Added include for chainhelper.h to support GetTransactionBlock usage.This inclusion is necessary to access the new
GetTransactionBlockfunction used in the Cleanup method.
639-639: Improved transaction retrieval in Cleanup method with structured binding.Replaces the previous call to
GetTransactionwith the newGetTransactionBlockfunction, which returns both the transaction and block hash in a single call. This improves code readability by eliminating the need for an output parameter.src/evo/chainhelper.h (3)
21-21: Added forward declaration for CTxMemPool class.This declaration is necessary because
CTxMemPoolis used as a parameter type in the newGetTransactionBlockfunction.
33-34: Added CTransactionRef type alias.Good addition that defines
CTransactionRefas a shared pointer to a constant transaction, making the code more readable and consistent where transaction references are used.
69-71: Added GetTransactionBlock function declaration with clear documentation.This well-documented function provides a cleaner API for retrieving transactions and their block hashes, returning them as a pair rather than using an output parameter. The comments with named components (
/*tx=*/and/*hash_block=*/) help clarify what each part of the returned pair represents.test/lint/lint-circular-dependencies.py (2)
39-40: Updated circular dependency paths for improved code organizationThese changes to the expected circular dependencies reflect the refactoring done in this PR, particularly the changes to transaction-related code paths and the introduction of centralized ToJson functions.
43-53: Circular dependencies properly updated to match code reorganizationThe updated circular dependency paths correctly reflect the new code organization where transaction retrieval logic has been centralized in the new
GetTransactionBlock()function inevo/chainhelper.cpp. This helps maintain accurate linting expectations.src/evo/chainhelper.cpp (2)
9-14: New includes support the transaction retrieval functionalityThese additional includes are necessary for the new
GetTransactionBlock()function, providing access to transaction indexing and mempool functionality.
65-70: Well-designed transaction retrieval functionThe new
GetTransactionBlock()function effectively consolidates transaction retrieval logic, returning both the transaction and its block hash as a pair. This helps reduce circular dependencies by providing a central location for this functionality.The early fast-fail path is a good optimization when neither the transaction index nor mempool is available.
src/evo/assetlocktx.h (2)
52-52: Removed ToJson member function in favor of friend declarationThis change is part of the effort to centralize JSON serialization logic and reduce circular dependencies by moving the
ToJsonimplementation tosrc/evo/core_write.cpp.
109-109: Removed ToJson member function in favor of friend declarationSimilar to the change in
CAssetLockPayload, this change moves the JSON serialization logic to the new centralized implementation insrc/evo/core_write.cpp.src/evo/core_write.cpp (6)
5-11: Appropriate includes for serialization functionsAll necessary includes are present for the various types that need serialization to JSON.
14-31: Well-implemented JSON serialization for CAssetLockPayloadThis implementation correctly serializes all fields of the
CAssetLockPayloadclass, including proper handling of script public keys and credit outputs.
33-43: Correct implementation of CAssetUnlockPayload serializationAll fields are properly serialized, with appropriate type conversions where needed.
45-60: CCbTx serialization with proper version checkingThe implementation correctly handles different versions of
CCbTxby conditionally including fields based on the version number.
62-84: CProRegTx serialization with proper type handlingGood implementation that handles conditional serialization based on the node type and properly extracts destination information from script payout.
86-144: Remaining ToJson implementations consistently follow patternAll remaining implementations follow a consistent pattern of creating a UniValue object, populating it with properly formatted fields, and handling conditional serialization based on version or type.
src/core_io.h (2)
14-30: Forward declarations improve code organizationAdding these forward declarations for EVO and LLMQ transaction payload classes supports the architectural improvements mentioned in the PR objectives. This helps resolve circular dependencies by allowing these types to be referenced without including their full declarations.
The organization into a clear section with consistent layout is clean and follows the file's existing style.
72-82: Good refactoring of ToJson functionsMoving the
ToJson()member methods from their respective class implementations to standalone functions is a good architectural decision that:
- Resolves the linking errors mentioned in the PR objectives
- Improves separation of concerns by moving serialization logic out of data classes
- Ensures these functions are available in
libbitcoin_commoninstead of being scattered across different librariesThe consistent use of
[[nodiscard]]is appropriate for these functions that return values. The comment correctly indicates their implementation location inevo/core_write.cpp.src/wallet/scriptpubkeyman.h (1)
547-547: Good addition of theIsMineoverride for CTxDestination.This properly completes the implementation of the
DescriptorScriptPubKeyManclass by adding the override for the base class's virtual method, maintaining consistency with the existingIsMine(const CScript&)method. This change aligns with the PR's goal to address compiler warnings.
UdjinM6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, utACK c449d68b5c08bb29d0306a312110925e8f2ad285
knst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NACK I still have compilation errors
$ make
Making all in src
make[1]: Entering directory '/home/knst/projects/dash-reviews/src'
make[2]: Entering directory '/home/knst/projects/dash-reviews/src'
make[3]: Entering directory '/home/knst/projects/dash-reviews'
make[3]: Leaving directory '/home/knst/projects/dash-reviews'
CXX dashd-bitcoind.o
CXX init/dashd-bitcoind.o
CXX libbitcoin_node_a-addrdb.o
CXX evo/libbitcoin_node_a-assetlocktx.o
In file included from /usr/include/c++/14/bits/char_traits.h:57,
from /usr/include/c++/14/string:42,
from ./crypto/sha256.h:10,
from ./hash.h:13,
from ./bls/bls.h:8,
from ./evo/assetlocktx.h:8,
from evo/assetlocktx.cpp:5:
In function ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = byte; _Args = {const byte&}]’,
inlined from ‘static constexpr std::_Require<std::__and_<std::__not_<typename std::allocator_traits< <template-parameter-1-1> >::__construct_helper<_Tp, _Args>::type>, std::is_constructible<_Tp, _Args ...> > > std::allocator_traits< <template-parameter-1-1> >::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::byte; _Args = {const std::byte&}; _Alloc = zero_after_free_allocator<std::byte>]’ at /usr/include/c++/14/bits/alloc_traits.h:279:21,
inlined from ‘static constexpr decltype (std::allocator_traits< <template-parameter-1-1> >::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits< <template-parameter-1-1> >::construct::__args)...)) std::allocator_traits< <template-parameter-1-1> >::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::byte; _Args = {const std::byte&}; _Alloc = zero_after_free_allocator<std::byte>]’ at /usr/include/c++/14/bits/alloc_traits.h:380:16,
inlined from ‘constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = const byte*; _ForwardIterator = byte*; _Allocator = zero_after_free_allocator<byte>]’ at /usr/include/c++/14/bits/stl_uninitialized.h:352:25,
inlined from ‘constexpr void std::vector<_Tp, _Alloc>::_M_range_insert(iterator, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = const std::byte*; _Tp = std::byte; _Alloc = zero_after_free_allocator<std::byte>]’ at /usr/include/c++/14/bits/vector.tcc:984:34,
inlined from ‘constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with _InputIterator = const std::byte*; <template-parameter-2-2> = void; _Tp = std::byte; _Alloc = zero_after_free_allocator<std::byte>]’ at /usr/include/c++/14/bits/stl_vector.h:1488:19,
inlined from ‘void DataStream::write(Span<const std::byte>)’ at ./streams.h:297:19,
inlined from ‘void ser_writedata32(Stream&, uint32_t) [with Stream = CDataStream]’ at ./serialize.h:74:12,
inlined from ‘void Serialize(Stream&, uint32_t) [with Stream = CDataStream]’ at ./serialize.h:205:89,
inlined from ‘void SerializeMany(Stream&, const Args& ...) [with Stream = CDataStream; Args = {unsigned char, long unsigned int, unsigned int, unsigned int, uint256, CBLSSignature}]’ at ./serialize.h:1379:17,
inlined from ‘void SerReadWriteMany(Stream&, CSerActionSerialize, const Args& ...) [with Stream = CDataStream; Args = {unsigned char, long unsigned int, unsigned int, unsigned int, uint256, CBLSSignature}]’ at ./serialize.h:1391:20,
inlined from ‘static void CAssetUnlockPayload::SerializationOps(Type&, Stream&, Operation) [with Stream = CDataStream; Type = const CAssetUnlockPayload; Operation = CSerActionSerialize]’ at ./evo/assetlocktx.h:97:9,
inlined from ‘static void CAssetUnlockPayload::Ser(Stream&, const CAssetUnlockPayload&) [with Stream = CDataStream]’ at ./evo/assetlocktx.h:95:5,
inlined from ‘void CAssetUnlockPayload::Serialize(Stream&) const [with Stream = CDataStream]’ at ./evo/assetlocktx.h:95:5,
inlined from ‘void Serialize(Stream&, const T&) [with Stream = CDataStream; T = CAssetUnlockPayload; typename std::enable_if<std::is_class<T>::value>::type* <anonymous> = 0]’ at ./serialize.h:890:16,
inlined from ‘CDataStream& CDataStream::operator<<(const T&) [with T = CAssetUnlockPayload]’ at ./streams.h:381:20,
inlined from ‘void SetTxPayload(CMutableTransaction&, const T&) [with T = CAssetUnlockPayload]’ at ./evo/specialtx.h:41:8:
/usr/include/c++/14/bits/stl_construct.h:97:14: error: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ offset [9, 12] is out of the bounds [0, 9] [-Werror=array-bounds=]
97 | { return ::new((void*)__location) _Tp(std::forward<_Args>(__args)...); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:11180: evo/libbitcoin_node_a-assetlocktx.o] Error 1
make[2]: Leaving directory '/home/knst/projects/dash-reviews/src'
make[1]: *** [Makefile:20667: all-recursive] Error 1
make[1]: Leaving directory '/home/knst/projects/dash-reviews/src'
make: *** [Makefile:797: all-recursive] Error 1
n static member function ‘static void* immer::cpp_heap::allocate(std::size_t, Tags ...) [with Tags = {}]’,
inlined from ‘static void* immer::debug_size_heap<Base>::allocate(std::size_t, Tags ...) [with Tags = {}; Base = immer::cpp_heap]’ at ./immer/immer/heap/debug_size_heap.hpp:48:47,
inlined from ‘static immer::detail::hamts::node<T, Hash, Equal, MemoryPolicy, B>::node_t* immer::detail::hamts::node<T, Hash, Equal, MemoryPolicy, B>::make_inner_n(immer::detail::hamts::count_t) [with T = std::pair<long unsigned int, uint256>; Hash = immer::map<long unsigned int, uint256>::hash_key; Equal = immer::map<long unsigned int, uint256>::equal_key; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5]’ at ./immer/immer/detail/hamts/node.hpp:228:32,
inlined from ‘static immer::detail::hamts::champ<T, Hash, Equal, MemoryPolicy, B>::node_t* immer::detail::hamts::champ<T, Hash, Equal, MemoryPolicy, B>::empty() [with T = std::pair<long unsigned int, uint256>; Hash = immer::map<long unsigned int, uint256>::hash_key; Equal = immer::map<long unsigned int, uint256>::equal_key; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5]’ at ./immer/immer/detail/hamts/champ.hpp:142:54,
inlined from ‘constexpr immer::map<K, T, Hash, Equal, MemoryPolicy, B>::map() [with K = long unsigned int; T = uint256; Hash = std::hash<long unsigned int>; Equal = std::equal_to<long unsigned int>; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5]’ at ./immer/immer/map.hpp:198:5,
inlined from ‘constexpr CDeterministicMNList::CDeterministicMNList()’ at ./evo/deterministicmns.h:176:5,
inlined from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = CDeterministicMNList; _Args = {}]’ at /usr/include/c++/14/bits/stl_construct.h:119:7,
inlined from ‘static constexpr void std::allocator_traits<std::allocator<void> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = CDeterministicMNList; _Args = {}]’ at /usr/include/c++/14/bits/alloc_traits.h:657:19,
inlined from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {}; _Tp = CDeterministicMNList; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/14/bits/shared_ptr_base.h:607:39,
inlined from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = CDeterministicMNList; _Alloc = std::allocator<void>; _Args = {}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/14/bits/shared_ptr_base.h:969:16,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {}; _Tp = CDeterministicMNList; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/14/bits/shared_ptr_base.h:1713:14,
inlined from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {}; _Tp = CDeterministicMNList]’ at /usr/include/c++/14/bits/shared_ptr.h:463:59,
inlined from ‘std::shared_ptr<std::_NonArray<_Tp> > std::make_shared(_Args&& ...) [with _Tp = CDeterministicMNList; _Args = {}]’ at /usr/include/c++/14/bits/shared_ptr.h:1008:39,
inlined from ‘GovernanceStore::GovernanceStore()’ at governance/governance.cpp:64:5:
./immer/immer/heap/cpp_heap.hpp:28:30: note: at offset 16 into object of size 48 allocated by ‘operator new’
28 | return ::operator new(size);
| ~~~~~~~~~~~~~~^~~~~~
In static member function ‘static immer::detail::hamts::node<T, Hash, Equal, MemoryPolicy, B>::node_t* immer::detail::hamts::node<T, Hash, Equal, MemoryPolicy, B>::make_inner_n(immer::detail::hamts::count_t) [with T = std::pair<long unsigned int, uint256>; Hash = immer::map<long unsigned int, uint256>::hash_key; Equal = immer::map<long unsigned int, uint256>::equal_key; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5]’,
inlined from ‘static immer::detail::hamts::champ<T, Hash, Equal, MemoryPolicy, B>::node_t* immer::detail::hamts::champ<T, Hash, Equal, MemoryPolicy, B>::empty() [with T = std::pair<long unsigned int, uint256>; Hash = immer::map<long unsigned int, uint256>::hash_key; Equal = immer::map<long unsigned int, uint256>::equal_key; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5]’ at ./immer/immer/detail/hamts/champ.hpp:142:54,
inlined from ‘constexpr immer::map<K, T, Hash, Equal, MemoryPolicy, B>::map() [with K = long unsigned int; T = uint256; Hash = std::hash<long unsigned int>; Equal = std::equal_to<long unsigned int>; MemoryPolicy = immer::memory_policy<immer::free_list_heap_policy<immer::cpp_heap>, immer::refcount_policy, immer::spinlock_policy>; unsigned int B = 5]’ at ./immer/immer/map.hpp:198:5,
inlined from ‘constexpr CDeterministicMNList::CDeterministicMNList()’ at ./evo/deterministicmns.h:176:5,
inlined from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = CDeterministicMNList; _Args = {}]’ at /usr/include/c++/14/bits/stl_construct.h:119:7,
inlined from ‘static constexpr void std::allocator_traits<std::allocator<void> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = CDeterministicMNList; _Args = {}]’ at /usr/include/c++/14/bits/alloc_traits.h:657:19,
inlined from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {}; _Tp = CDeterministicMNList; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/14/bits/shared_ptr_base.h:607:39,
inlined from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = CDeterministicMNList; _Alloc = std::allocator<void>; _Args = {}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/14/bits/shared_ptr_base.h:969:16,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {}; _Tp = CDeterministicMNList; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/14/bits/shared_ptr_base.h:1713:14,
inlined from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {}; _Tp = CDeterministicMNList]’ at /usr/include/c++/14/bits/shared_ptr.h:463:59,
inlined from ‘std::shared_ptr<std::_NonArray<_Tp> > std::make_shared(_Args&& ...) [with _Tp = CDeterministicMNList; _Args = {}]’ at /usr/include/c++/14/bits/shared_ptr.h:1008:39,
inlined from ‘GovernanceStore::GovernanceStore()’ at governance/governance.cpp:64:5:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
configure.ac (1)
455-467: Improved handling of GCC warnings by downgrading to warnings instead of errorsThese changes correctly handle GCC-specific warnings for array bounds and dangling references by preventing them from being treated as errors while still allowing them to be reported as warnings.
This is a good approach for handling compiler warnings that might be problematic in third-party code. It keeps the warning visible for potential review while preventing CI builds from failing due to issues in code you don't control.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between c449d68b5c08bb29d0306a312110925e8f2ad285 and 6c81a093d034c6c226a96f0bde38b6190486bffa.
📒 Files selected for processing (6)
ci/test/00_setup_env_arm.sh(0 hunks)ci/test/00_setup_env_native_nowallet.sh(0 hunks)ci/test/00_setup_env_native_qt5.sh(0 hunks)ci/test/00_setup_env_native_sqlite.sh(0 hunks)ci/test/00_setup_env_win64.sh(0 hunks)configure.ac(1 hunks)
💤 Files with no reviewable changes (5)
- ci/test/00_setup_env_arm.sh
- ci/test/00_setup_env_native_qt5.sh
- ci/test/00_setup_env_native_nowallet.sh
- ci/test/00_setup_env_win64.sh
- ci/test/00_setup_env_native_sqlite.sh
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: x86_64-w64-mingw32 / Build depends
- GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
- GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
- GitHub Check: x86_64-apple-darwin / Build depends
- GitHub Check: arm-linux-gnueabihf / Build depends
- GitHub Check: x86_64-pc-linux-gnu / Build depends
🔇 Additional comments (2)
configure.ac (2)
469-477: Properly handling-Wattributeswarnings based on GCC versionThe implementation correctly handles the GCC-specific
-Wattributeswarnings with additional version-specific filtering to exclude GCC 14 and above.This is good future-proofing by conditionally applying this handling only for affected GCC versions.
479-491: Structured handling of string operation warnings in GCCThe implementation for handling
-Wstringop-overreadand-Wstringop-overflowwarnings follows the same pattern as the other warning flags, maintaining consistency in the codebase.This completes the set of warning suppressions mentioned in the PR objectives, which allows re-enabling
-Werrorfor GCC builds by handling all the problematic warning cases.
This helps us get rid of the redefinitions responsible for `-Wredundant-decls` unhappiness.
Currently, we rely on redefinition to avoid an explosion in reported circular dependencies but that is verboten with `-Wredundant-decls`. To trim down the amount of circular dependencies that would happen once we remove the circular definition, we have to proxy `GetTransaction()` through another function located elsewhere. Since all Dash-specific invocations either rely on the txindex or the mempool, we can safely trim down the number of arguments and add a fast-fail. Since we do (sometimes) care about the block the transaction is in, we return that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
test/lint/lint-circular-dependencies.py (1)
45-48: Consider tackling theevo/chainhelperring instead of whitelisting itThere is already a historic concern (“knst: let’s think how to avoid this new circular dependencies”).
Before the whitelist grows permanently, could theGetTransactionBlockindirection be moved again (e.g. into a thin interface innode/), breaking the five new cycles?
🧹 Nitpick comments (4)
src/evo/core_write.cpp (3)
14-31: Possible micro-efficiency: reserveoutputscapacity
creditOutputsis already known in advance, yet theUniValue outputs(VARR)container starts with zero capacity and reallocates as it grows.
A small improvement is to pre-allocate:- UniValue outputs(UniValue::VARR); + UniValue outputs(UniValue::VARR); + outputs.reserve(creditOutputs.size());This avoids repeated internal copies when a payload contains many outputs (e.g. shielded credits).
62-84: Clarify units foroperatorReward
nOperatorRewardis stored in basis points (0–10 000). Dividing by 100 returns a percentage (0–100) with at most two decimals.
For JSON consumers it’s often helpful to expose both the raw value and the human-readable percent, or at least document the precision.- ret.pushKV("operatorReward", (double)nOperatorReward / 100); + ret.pushKV("operatorRewardBp", nOperatorReward); // raw bips + ret.pushKV("operatorRewardPct", static_cast<double>(nOperatorReward) / 100);This avoids loss of information and mirrors what is already done for amounts (
valuevsvalueSat).
110-127: Conditional block duplicates: consider helper for Evo node fields
platformNodeID,platformP2PPort,platformHTTPPortare emitted in bothCProRegTxandCProUpServTxunder the samenType == MnType::Evoguard.
A tiny helper (e.g.PushPlatformFields(ret)) would cut duplication and keep future field additions consistent.test/lint/lint-circular-dependencies.py (1)
39-54: Keep EXPECTED_CIRCULAR_DEPENDENCIES sorted to reduce merge conflictsThe newly added Dash-specific cycles are appended in arbitrary order. Alphabetically (or topologically) sorting the tuple makes future insertions easier to review and avoids noisy diffs when two branches touch the same area.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 6c81a093d034c6c226a96f0bde38b6190486bffa and cb7156c.
📒 Files selected for processing (38)
ci/test/00_setup_env_arm.sh(0 hunks)ci/test/00_setup_env_native_nowallet.sh(0 hunks)ci/test/00_setup_env_native_qt5.sh(0 hunks)ci/test/00_setup_env_native_sqlite.sh(0 hunks)ci/test/00_setup_env_win64.sh(0 hunks)configure.ac(1 hunks)src/Makefile.am(1 hunks)src/coinjoin/client.cpp(1 hunks)src/coinjoin/util.cpp(0 hunks)src/evo/assetlocktx.cpp(1 hunks)src/evo/assetlocktx.h(2 hunks)src/evo/cbtx.cpp(0 hunks)src/evo/cbtx.h(1 hunks)src/evo/chainhelper.cpp(2 hunks)src/evo/chainhelper.h(3 hunks)src/evo/core_write.cpp(1 hunks)src/evo/deterministicmns.cpp(3 hunks)src/evo/mnhftx.h(1 hunks)src/evo/providertx.h(4 hunks)src/governance/object.cpp(2 hunks)src/governance/vote.cpp(0 hunks)src/llmq/chainlocks.cpp(2 hunks)src/llmq/commitment.h(1 hunks)src/llmq/dkgsession.cpp(0 hunks)src/llmq/instantsend.cpp(4 hunks)src/llmq/utils.cpp(0 hunks)src/rpc/blockchain.h(1 hunks)src/rpc/mempool.cpp(1 hunks)src/stacktraces.cpp(2 hunks)src/test/block_reward_reallocation_tests.cpp(1 hunks)src/test/evo_deterministicmns_tests.cpp(1 hunks)src/util/irange.h(1 hunks)src/util/wpipe.cpp(2 hunks)src/validation.cpp(1 hunks)src/validation.h(0 hunks)src/wallet/scriptpubkeyman.cpp(1 hunks)src/wallet/scriptpubkeyman.h(1 hunks)test/lint/lint-circular-dependencies.py(1 hunks)
💤 Files with no reviewable changes (11)
- src/governance/vote.cpp
- src/evo/cbtx.cpp
- src/llmq/utils.cpp
- ci/test/00_setup_env_native_nowallet.sh
- ci/test/00_setup_env_native_qt5.sh
- src/llmq/dkgsession.cpp
- ci/test/00_setup_env_win64.sh
- src/coinjoin/util.cpp
- src/validation.h
- ci/test/00_setup_env_native_sqlite.sh
- ci/test/00_setup_env_arm.sh
✅ Files skipped from review due to trivial changes (6)
- src/test/block_reward_reallocation_tests.cpp
- src/evo/assetlocktx.cpp
- src/rpc/mempool.cpp
- src/test/evo_deterministicmns_tests.cpp
- src/coinjoin/client.cpp
- src/evo/providertx.h
🚧 Files skipped from review as they are similar to previous changes (19)
- src/evo/mnhftx.h
- src/Makefile.am
- src/util/wpipe.cpp
- src/util/irange.h
- src/stacktraces.cpp
- src/llmq/commitment.h
- src/wallet/scriptpubkeyman.cpp
- src/rpc/blockchain.h
- src/evo/chainhelper.h
- src/evo/assetlocktx.h
- src/evo/chainhelper.cpp
- src/governance/object.cpp
- src/llmq/chainlocks.cpp
- src/evo/cbtx.h
- src/evo/deterministicmns.cpp
- src/wallet/scriptpubkeyman.h
- src/llmq/instantsend.cpp
- configure.ac
- src/validation.cpp
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/evo/core_write.cpp (4)
src/evo/mnhftx.h (1)
nodiscard(50-59)src/evo/providertx.h (4)
nodiscard(34-37)nodiscard(104-107)nodiscard(164-167)nodiscard(214-217)src/llmq/commitment.h (2)
nodiscard(74-80)nodiscard(122-139)src/evo/assetlocktx.h (9)
creditOutputs(60-63)nVersion(55-58)nVersion(114-117)index(119-122)fee(124-127)requestedHeight(129-132)requestedHeight(146-149)quorumHash(134-137)quorumSig(139-142)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
- GitHub Check: x86_64-apple-darwin / Build depends
- GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
- GitHub Check: arm-linux-gnueabihf / Build depends
knst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider adding 3 extra commits from my branch https://github.com/knst/dash/commits/werror_gcc/
-Wstringop-over{read,write} and -Warray-bounds are too noisy currently
…h GCC Currently, `-Warray-bounds` is triggered by `immer` code and `-Wdangling-reference` is triggered by UniValue-adjacent code. Co-authored-by: Konstantin Akimov <[email protected]>
We need to annotate `CHDPubKey::nVersion` with `[[maybe_unused]]` to avoid upsetting Clang due to `-Wunused-private-field`. GCC 11 doesn't seem to emit a warning for that variable and therefore, finds the annotation unnecessary, triggering an error due to `-Wattributes`. Since both Clang 18 and GCC 14 agree with the `-Wunused-private-field` assessment, we are better off suppressing `-Wattributes` error-like treatment on lower compiler versions.
Also, move it to `NOWARN_CXXFLAGS`, which is placed *after* `WARN_CXXFLAGS`.
reverts: - ba4270519560469afee30c142fd02eebd9d5a09c
knst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 40caa7d
UdjinM6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 40caa7d
, bitcoin#25369, bitcoin#25617, bitcoin#25611, bitcoin#25736, bitcoin#25714, bitcoin#26612, bitcoin#27605, bitcoin#30464, partial bitcoin#25551 (univalue backports) 05e2091 merge bitcoin#30464: Fix MSVC warning C4101 "unreferenced local variable" (Kittywhiskers Van Gogh) f00dc78 build: drop `-Wdangling-reference` GCC suppression (Kittywhiskers Van Gogh) 6d81d06 merge bitcoin#27605: Replace global find_value function with UniValue::find_value method (Kittywhiskers Van Gogh) 203a1c1 merge bitcoin#26612: pass named argument value as string_view (Kittywhiskers Van Gogh) 41eb3b0 merge bitcoin#25714: Avoid std::string copies (Kittywhiskers Van Gogh) 6f03a13 merge bitcoin#25736: Remove unused and confusing set*() return value (Kittywhiskers Van Gogh) 27cffb1 refactor: shed avoidable casts in Dash-specific UniValue-ret functions (Kittywhiskers Van Gogh) 32958da merge bitcoin#25611: Avoid brittle, narrowing and verbose integral type confusions (Kittywhiskers Van Gogh) 7802752 merge bitcoin#25617: univalue test cleanups (Kittywhiskers Van Gogh) 94bbbf1 partial bitcoin#25551: Throw exception on invalid Univalue pushes over silent ignore (Kittywhiskers Van Gogh) d980870 revert: revert bitcoin#25464 (Reduce Univalue push_backV peak memory usage in listtransactions) (Kittywhiskers Van Gogh) 1e023e5 merge bitcoin#25369: Unsubtree Univalue (Kittywhiskers Van Gogh) 6b9e682 merge bitcoin#25249: Bump univalue subtree (Kittywhiskers Van Gogh) b3443ee Squashed 'src/univalue/' changes from 6c19d050a9..de4f73ddca (Kittywhiskers Van Gogh) 9db7b12 merge bitcoin#25113: Bump univalue subtree (Kittywhiskers Van Gogh) 88f794f Squashed 'src/univalue/' changes from a44caf65fe..6c19d050a9 (Kittywhiskers Van Gogh) b07e550 merge bitcoin#25153: Use getInt<T> over get_int/get_int64 (Kittywhiskers Van Gogh) b1ae6f5 Squashed 'src/univalue/' changes from 2740c4f712..a44caf65fe (Kittywhiskers Van Gogh) 1780961 revert: bitcoin#25464 (Reduce Univalue push_backV peak memory usage in listtransactions) (Kittywhiskers Van Gogh) Pull request description: ## Motivation To get rid of the `-Wdangling-reference` suppression ([source](https://github.com/dashpay/dash/blob/f648039258d2192ec5e505721e34edaa0bda568c/configure.ac#L461-L467)) for GCC introduced in [dash#6639](#6639) by backporting the set of changes needed to backport [bitcoin#27605](bitcoin#27605). ## Additional Information * At some point, the contents on `univalue/` diverged from official repository ([bitcoin-core/univalue-subtree](https://github.com/bitcoin-core/univalue-subtree)), which makes updating the subtree a more difficult prospect. We realign the subtree by updating it to [`a44caf65`](bitcoin-core/univalue-subtree@a44caf65) (last sane commit, taken from [bitcoin#22646](bitcoin#22646), which was backported as [dash#4823](#4823)) and marking all merge conflicts in favour of the incoming update. This lets us do the final few subtree updates before it's no longer treated as a subtree. * To allow for subtree updates, [bitcoin#25464](bitcoin#25464) (backported as 001d7ba in [dash#6698](#6698)) was temporarily reverted and then reapplied _after_ the directory was unsubtree'd. * [bitcoin#30464](bitcoin#30464) needed to be backported to keep the whitespace linter happy (failed [build](https://github.com/dashpay/dash/actions/runs/16463979981/job/46536933377#step:5:119)). ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 05e2091 Tree-SHA512: fdd35699defcc24a396fc9746a8eca26a5866666e9ae049f7d9e38fe84021aa49169e48b9408d3c47c6cd41aa9523f0f94a8b91ecc874a962bf5e6005d7eff21
Additional Information
Depends on build: merge bitcoin#28092, #28999, #27872, #29486, #25972 (ensure
WARN_CXXFLAGSare populated to ensure expected--enable-werrorbehavior) #6637Depends on fix: resolve or sidestep compiler warnings, re-enable
-Werrorfor Clang, merge bitcoin#13633 #6638TxToUniv()is a function defined incore_write.cpp, which is a part oflibbitcoin_commonthat relies onToJson()definitions in various classes (CCbTx,CProRegTxand others) to print out of contents of transaction payload. The problem is, those various classes have their source files a part oflibbitcoin_server, so when binaries likedash-tx(which do not uselibbitcoin_server) need to be linked, the necessaryToJson()implementations, were they defined in source files, wouldn't be found and this would result in a linking error.This is worked around by defining them in the header instead but this creates a new problem where these headers are included by
core_writebut constructing the UniValue objects returned byToJson()needs something fromcore_write(i.e. there is a circular dependency).This was worked around in dash#6229 (commit) with redefinition, which was fine but is now verboten with
-Wredundant-declsenforcement.ToJson()definitions from those headers relied on byTxToUniv()have been moved to their own source file (evo/core_write.cpp) and included inlibbitcoin_common. This takes care of the linking issue and avoids circular dependencies.GetTransaction()is extensively used in Dash-specific code and a redefinition invalidation.cppis used to reduce the amount of reported circular dependencies, removing that circular dependency in order to satisfy-Wredundant-declsresults in the following (see below).Circular dependencies:
Removed:
Added:
Diff: +18
To avoid this, alongside some header adjustments, a proxy to
GetTransaction()has been introduced inevo/chainhelper.cpp,GetTransactionBlock(). This reduces the number of circular dependencies (see below).Circular dependencies:
Removed:
Added:
Diff: +5
To differentiate it from
GetTransaction(), since all Dash-specific invocations either rely on the transaction index or the mempool, we can safely trim down the number of arguments and add a fast-fail.Even with
-Werrorenabled, we have to downgrade-Warray-boundsto warnings (i.e. use-Wno-error=array-bounds) as there are two sources of the warning,immer(see arximboldi/immer#223) and serialization code (fixed with bitcoin#30765). As due to the former, we need to suppress it anyways, the latter has not been backported in the interest of brevity.Similar to the above, we have to downgrade
-Wdangling-referenceas it is caused by UniValue-adjacent code that is fixed by bitcoin#27605 but would require an out-of-order backport that pulls in multiple dependent PRs in order to be complete (or alternatively, backport it as-is and then make future backporting annoying). The simpler solution to downgrade the warning was opted for instead.We need to annotate
CHDPubKey::nVersionwith[[maybe_unused]]to avoid upsetting Clang due to-Wunused-private-field. GCC 11 doesn't emit a warning for that variable and therefore, finds the annotation unnecessary, triggering an error due to-Wattributes(build).Since both Clang 18 and GCC 14 agree with the
-Wunused-private-fieldassessment, we are better off downgrading-Wattributesto a warning for GCC 11.Breaking Changes
None expected.
Checklist