backport: Merge bitcoin/bitcoin#25977, 27357, 28583#7200
backport: Merge bitcoin/bitcoin#25977, 27357, 28583#7200vijaydasmp wants to merge 3 commits intodashpay:developfrom
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
bb07fb9 to
cf657ae
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (36)
✅ Files skipped from review due to trivial changes (27)
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughThis PR converts the addrman loading API to return util::Result<std::unique_ptr> (removing the out-parameter), updates call sites (e.g., AppInitMain) to handle the new result, adjusts util::Result to correctly support void via an internal alias and adds a default success constructor, moves the versionbits warning cache into ChainstateManager (removing the file-scope global), enables clang-tidy's modernize-use-emplace check, and applies widespread push_back → emplace_back updates across many files. Bear-tidy output exclusions were extended for two benchmark files. Sequence Diagram(s)sequenceDiagram
participant AppInitMain
participant LoadAddrman
participant DiskDB
participant AddrMan
AppInitMain->>LoadAddrman: LoadAddrman(netgroupman, args)
LoadAddrman->>DiskDB: Read addrman DB
alt DB OK
DiskDB-->>LoadAddrman: addrman data
LoadAddrman->>AddrMan: construct AddrMan
AddrMan-->>LoadAddrman: unique_ptr<AddrMan>
LoadAddrman-->>AppInitMain: util::Result<std::unique_ptr<AddrMan>> (success)
AppInitMain->>AppInitMain: node.addrman = std::move(*result)
else DB error
DiskDB-->>LoadAddrman: error
LoadAddrman-->>AppInitMain: util::Error (via util::Result)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/util/result.h (1)
46-46: Constrain the default constructor toResult<void>using a requires clause.Line 46 is intended only for
void, but it is currently available for all specializations. This default constructor initializes the variant withstd::monostate, which is semantically incorrect forResult<non-void>types. Constraining it improves API clarity and prevents accidental misuse.♻️ Proposed fix
- Result() : m_variant{std::in_place_index_t<1>{}, std::monostate{}} {} // constructor for void + Result() requires std::is_same_v<M, void> + : m_variant{std::in_place_index_t<1>{}, std::monostate{}} {} // constructor for void🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/util/result.h` at line 46, The default constructor currently available for all Result<T> specializations should be constrained to only Result<void>; update the constructor declaration for Result() to add a requires clause (e.g., requires std::is_void_v<T>) so it only participates when T is void, leaving other specializations without this monostate constructor; modify the Result() definition that initializes m_variant{std::in_place_index_t<1>{}, std::monostate{}} to use that requires constraint (or equivalent SFINAE) so non-void Result<T> cannot be default-constructed into monostate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/util/result.h`:
- Line 46: The default constructor currently available for all Result<T>
specializations should be constrained to only Result<void>; update the
constructor declaration for Result() to add a requires clause (e.g., requires
std::is_void_v<T>) so it only participates when T is void, leaving other
specializations without this monostate constructor; modify the Result()
definition that initializes m_variant{std::in_place_index_t<1>{},
std::monostate{}} to use that requires constraint (or equivalent SFINAE) so
non-void Result<T> cannot be default-constructed into monostate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6bf73ca4-aba1-482f-9bb9-90fadee4257f
📒 Files selected for processing (38)
src/.bear-tidy-configsrc/.clang-tidysrc/addrdb.cppsrc/addrdb.hsrc/bench/block_assemble.cppsrc/bench/wallet_loading.cppsrc/external_signer.cppsrc/httpserver.cppsrc/init.cppsrc/net_permissions.cppsrc/net_processing.cppsrc/node/blockstorage.cppsrc/qt/rpcconsole.cppsrc/rest.cppsrc/rpc/blockchain.cppsrc/rpc/net.cppsrc/rpc/rawtransaction.cppsrc/rpc/server.cppsrc/script/sign.cppsrc/test/addrman_tests.cppsrc/test/bip32_tests.cppsrc/test/net_tests.cppsrc/test/rpc_tests.cppsrc/test/settings_tests.cppsrc/test/sighash_tests.cppsrc/test/txpackage_tests.cppsrc/test/util/setup_common.cppsrc/test/util/txmempool.cppsrc/test/util_tests.cppsrc/test/util_threadnames_tests.cppsrc/test/validation_block_tests.cppsrc/util/result.hsrc/validation.cppsrc/validation.hsrc/wallet/rpc/backup.cppsrc/wallet/salvage.cppsrc/wallet/spend.cppsrc/wallet/test/wallet_tests.cpp
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
Clean backport of 5 Bitcoin Core PRs. No blocking issues found. Backport prerequisite analysis confirms no missing dependencies. Minor emplace optimization nitpicks only.
Reviewed commit: 0c2eedd
Review GateCommit:
|
0c2eedd to
dc1f423
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/addrdb.cpp`:
- Line 221: Restore the explicit std::move on the return of the local variable
addrman so the move-only std::unique_ptr<AddrMan> is moved into the util::Result
wrapper; update the return statement that currently reads "return addrman;" to
use "return std::move(addrman);" to ensure the unique_ptr is moved (this affects
the return of util::Result<std::unique_ptr<AddrMan>> from the function that
constructs addrman).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 42397778-3079-4c2c-85e2-06653cf5cd34
📒 Files selected for processing (36)
src/.bear-tidy-configsrc/.clang-tidysrc/addrdb.cppsrc/addrdb.hsrc/bench/wallet_loading.cppsrc/external_signer.cppsrc/httpserver.cppsrc/init.cppsrc/net_permissions.cppsrc/net_processing.cppsrc/node/blockstorage.cppsrc/qt/rpcconsole.cppsrc/rest.cppsrc/rpc/blockchain.cppsrc/rpc/rawtransaction.cppsrc/rpc/server.cppsrc/script/sign.cppsrc/test/addrman_tests.cppsrc/test/bip32_tests.cppsrc/test/net_tests.cppsrc/test/rpc_tests.cppsrc/test/settings_tests.cppsrc/test/sighash_tests.cppsrc/test/txpackage_tests.cppsrc/test/util/setup_common.cppsrc/test/util/txmempool.cppsrc/test/util_tests.cppsrc/test/util_threadnames_tests.cppsrc/test/validation_block_tests.cppsrc/util/result.hsrc/validation.cppsrc/validation.hsrc/wallet/rpc/backup.cppsrc/wallet/salvage.cppsrc/wallet/spend.cppsrc/wallet/test/wallet_tests.cpp
✅ Files skipped from review due to trivial changes (27)
- src/.clang-tidy
- src/.bear-tidy-config
- src/test/util_threadnames_tests.cpp
- src/external_signer.cpp
- src/bench/wallet_loading.cpp
- src/test/addrman_tests.cpp
- src/rest.cpp
- src/test/bip32_tests.cpp
- src/rpc/server.cpp
- src/wallet/salvage.cpp
- src/test/sighash_tests.cpp
- src/wallet/spend.cpp
- src/test/rpc_tests.cpp
- src/test/validation_block_tests.cpp
- src/rpc/rawtransaction.cpp
- src/node/blockstorage.cpp
- src/wallet/rpc/backup.cpp
- src/validation.h
- src/test/settings_tests.cpp
- src/qt/rpcconsole.cpp
- src/rpc/blockchain.cpp
- src/test/net_tests.cpp
- src/wallet/test/wallet_tests.cpp
- src/script/sign.cpp
- src/test/util/setup_common.cpp
- src/net_processing.cpp
- src/test/util_tests.cpp
🚧 Files skipped from review as they are similar to previous changes (5)
- src/test/txpackage_tests.cpp
- src/httpserver.cpp
- src/util/result.h
- src/addrdb.h
- src/init.cpp
|
Quick review pass on the current head (
I wasn't able to push directly to
If you want to pull/cherry-pick it, that branch contains the clean amended history for this PR. Also, current CI is otherwise green apart from |
|
Rechecked this today: the live PR head is still The only real upstream delta I found remains the missing
I also re-tested whether I can update @vijaydasmp if you want to pick up the cleaned-up history as-is, the rescue branch above is ready to use. |
checking |
dc1f423 to
ce58231
Compare
… with `util::Result` 8aa8f73 refactor: Replace std::optional<bilingual_str> with util::Result (Ryan Ofsky) 5f49cb1 util: Add void support to util::Result (MarcoFalke) Pull request description: Replace uses of `std::optional<bilingual_str>` with `util::Result` as suggested bitcoin#25648 (comment), bitcoin#27632 (comment), bitcoin#27632 (comment), bitcoin#24313 (comment) ACKs for top commit: MarcoFalke: very nice ACK 8aa8f73 🏏 TheCharlatan: ACK 8aa8f73 hebasto: ACK 8aa8f73, I have reviewed the code and it looks OK. Tree-SHA512: 6c2f218bc445184ce93ec2b907e61666a05f26f2c9447f69fcb504aa8291b0c693d913f659dfd19813a9e24615546c72cbe2ca419218fd867ff0694c4a1b6a30 Redundant std::move
…er and rename to m_warningcache 5526849 validation: Move warningcache to ChainstateManager (dimitaracev) Pull request description: Removes `warningcache` and moves it to `ChainstateManager`. Also removes the respective `TODO` completely. ACKs for top commit: ajtowns: ACK 5526849 dimitaracev: > ACK [5526849](bitcoin@5526849) TheCharlatan: ACK 5526849 ryanofsky: Code review ACK 5526849 Tree-SHA512: 6869bd7aa4f0b59324e12eb8e3df47f2c9a3f3b0d9b7d45857426ec9e8b71c5573bdcf71db822f8c10aff7d8679a00a4bedc7a256c28f325e744e5d7267b41e9
fa05a72 tidy: modernize-use-emplace (MarcoFalke) Pull request description: Constructing a temporary unnamed object only to copy or move it into a container seems both verbose in code and a strict performance penalty. Fix both issues via the `modernize-use-emplace` tidy check. ACKs for top commit: Sjors: re-utACK fa05a72 hebasto: ACK fa05a72. TheCharlatan: ACK fa05a72 Tree-SHA512: 4408a094f406e7bf6c1468c2b0798f68f4d952a1253cf5b20bdc648ad7eea4a2c070051fed46d66fd37bce2ce6f85962484a1d32826b7ab8c9baba431eaa2765
ce58231 to
496defa
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
Backport of three upstream Bitcoin Core refactors (bitcoin#25977 util::Result, bitcoin#27357 m_warningcache, bitcoin#28583 modernize-use-emplace). The Dash-specific merge resolutions around LoadAddrman and m_warningcache are wired up correctly at every remaining call site, no Dash subsystem (LLMQ, evo, masternode, governance, CoinJoin) is touched, and no consensus behavior changes. All agent findings were examined; none rise to a real correctness problem in this SHA.
Reviewed commit: dc1f423
What was done?
Backports from Bitcoin Core v26,
How Has This Been Tested?
Run unit & functional tests