-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: Merge bitcoin#28523, 27822, 28671, 29114, 28037 #7358
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
base: develop
Are you sure you want to change the base?
Changes from all commits
34a9f9e
54a0489
b9a082c
68a5dee
0e8f70d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| #include <rpc/server.h> | ||
|
|
||
| #include <addrman.h> | ||
| #include <addrman_impl.h> | ||
| #include <banman.h> | ||
| #include <chainparams.h> | ||
| #include <clientversion.h> | ||
|
|
@@ -1174,6 +1175,74 @@ static RPCHelpMan getaddrmaninfo() | |
| }; | ||
| } | ||
|
|
||
| UniValue AddrmanEntryToJSON(const AddrInfo& info) | ||
| { | ||
| UniValue ret(UniValue::VOBJ); | ||
| ret.pushKV("address", info.ToStringAddr()); | ||
| ret.pushKV("port", info.GetPort()); | ||
| ret.pushKV("services", (uint64_t)info.nServices); | ||
| ret.pushKV("time", int64_t{TicksSinceEpoch<std::chrono::seconds>(info.nTime)}); | ||
| ret.pushKV("network", GetNetworkName(info.GetNetClass())); | ||
| ret.pushKV("source", info.source.ToStringAddr()); | ||
| ret.pushKV("source_network", GetNetworkName(info.source.GetNetClass())); | ||
| return ret; | ||
| } | ||
|
|
||
| UniValue AddrmanTableToJSON(const std::vector<std::pair<AddrInfo, AddressPosition>>& tableInfos) | ||
| { | ||
| UniValue table(UniValue::VOBJ); | ||
| for (const auto& e : tableInfos) { | ||
| AddrInfo info = e.first; | ||
| AddressPosition location = e.second; | ||
| std::ostringstream key; | ||
| key << location.bucket << "/" << location.position; | ||
| // Address manager tables have unique entries so there is no advantage | ||
| // in using UniValue::pushKV, which checks if the key already exists | ||
| // in O(N). UniValue::pushKVEnd is used instead which currently is O(1). | ||
| table.pushKVEnd(key.str(), AddrmanEntryToJSON(info)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Commit ordering: 28523 uses pushKVEnd before 27822 introduces it (bisect hazard) Within this PR the commits are ordered a5264f9 (Merge bitcoin#28523) → c34e457 (Merge bitcoin#27822) → 3c47eb7 (Merge bitcoin#28671). bitcoin#28523's new Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g. source: ['claude-backport-reviewer'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in this update — Commit ordering: 28523 uses pushKVEnd before 27822 introduces it (bisect hazard) no longer present. Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Missing prerequisite before cherry-pick: bitcoin#27822 Dash commit a5264f9, the bitcoin#28523 backport, adds a call to table.pushKVEnd(...). In upstream, bitcoin#28523's parent already had UniValue::pushKVEnd because bitcoin#27822 was merged earlier. In Dash, a5264f9^ still declares only UniValue::__pushKV, and pushKVEnd is introduced later by c34e457. This means the dependency chain is present only in the final head, not at the cherry-pick point; the 28523 commit itself is unbuildable. The same commit also adds a test using time.time() before Dash adds the import in the later 28671 adaptation. Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g. source: ['codex-backport-reviewer'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in this update — Missing prerequisite before cherry-pick: bitcoin#27822 no longer present. Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: Commit ordering breaks intermediate-state build: 28523 lands before 27822 (pushKVEnd) and 28671 (import time) The series orders the 28523 backport (a5264f9) before the 27822 UniValue rename (83c56b9) and the 28671 rpc_net fix (af08749), but the 28523 commit already depends on both of those:
The final HEAD (42c08e1) is self-consistent, so this only affects bisectability and commit-by-commit builds, not the merged result. Upstream had no such issue because bitcoin#27822 (Jun 2023) merged before bitcoin#28523 (Oct 2023). Easiest fix: reorder the backport commits so 27822 lands before 28523 (and pull the source: ['claude', 'codex'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in this update — Commit ordering breaks intermediate-state build: 28523 lands before 27822 (pushKVEnd) and 28671 (import time) no longer present. Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Commit ordering breaks build at intermediate revision: 28523 uses pushKVEnd before 27822 renames it Commit a5264f9 (Merge bitcoin#28523) adds
Not blocking — once all 5 commits are applied, the final tree is self-consistent (univalue.h declares Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g. source: ['claude-backport-reviewer'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in this update — Commit ordering breaks build at intermediate revision: 28523 uses pushKVEnd before 27822 renames it no longer present. Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Commit 34a9f9e (bitcoin#28523) calls UniValue::pushKVEnd before bitcoin#27822 renames __pushKV Verified at commit 34a9f9e: Fix: reorder so the scripted-diff rename (27822) lands before 28523, or in the 28523 cherry-pick call source: ['claude', 'codex'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Intermediate-state build break: bitcoin#28523 lands before bitcoin#27822 renames __pushKV -> pushKVEnd Carried forward from prior review. The five backport commits were re-applied on the new develop base but ordering is unchanged: 34a9f9e (28523) precedes 54a0489 (27822). At 34a9f9e, src/rpc/net.cpp:1202 calls Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g. source: ['claude-backport-reviewer'] |
||
| } | ||
| return table; | ||
| } | ||
|
|
||
| static RPCHelpMan getrawaddrman() | ||
| { | ||
| return RPCHelpMan{"getrawaddrman", | ||
| "EXPERIMENTAL warning: this call may be changed in future releases.\n" | ||
| "\nReturns information on all address manager entries for the new and tried tables.\n", | ||
| {}, | ||
| RPCResult{ | ||
| RPCResult::Type::OBJ_DYN, "", "", { | ||
| {RPCResult::Type::OBJ_DYN, "table", "buckets with addresses in the address manager table ( new, tried )", { | ||
| {RPCResult::Type::OBJ, "bucket/position", "the location in the address manager table (<bucket>/<position>)", { | ||
| {RPCResult::Type::STR, "address", "The address of the node"}, | ||
| {RPCResult::Type::NUM, "port", "The port number of the node"}, | ||
| {RPCResult::Type::STR, "network", "The network (" + Join(GetNetworkNames(), ", ") + ") of the address"}, | ||
| {RPCResult::Type::NUM, "services", "The services offered by the node"}, | ||
| {RPCResult::Type::NUM_TIME, "time", "The " + UNIX_EPOCH_TIME + " when the node was last seen"}, | ||
| {RPCResult::Type::STR, "source", "The address that relayed the address to us"}, | ||
| {RPCResult::Type::STR, "source_network", "The network (" + Join(GetNetworkNames(), ", ") + ") of the source address"}, | ||
| }} | ||
| }} | ||
| } | ||
| }, | ||
| RPCExamples{ | ||
| HelpExampleCli("getrawaddrman", "") | ||
| + HelpExampleRpc("getrawaddrman", "") | ||
| }, | ||
| [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { | ||
| NodeContext& node = EnsureAnyNodeContext(request.context); | ||
| if (!node.addrman) { | ||
| throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Address manager functionality missing or disabled"); | ||
| } | ||
|
|
||
| UniValue ret(UniValue::VOBJ); | ||
| ret.pushKV("new", AddrmanTableToJSON(node.addrman->GetEntries(false))); | ||
| ret.pushKV("tried", AddrmanTableToJSON(node.addrman->GetEntries(true))); | ||
| return ret; | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| void RegisterNetRPCCommands(CRPCTable &t) | ||
| { | ||
| static const CRPCCommand commands[]{ | ||
|
|
@@ -1196,6 +1265,7 @@ void RegisterNetRPCCommands(CRPCTable &t) | |
| {"hidden", &sendmsgtopeer}, | ||
| {"hidden", &setmnthreadactive}, | ||
| {"hidden", &getaddrmaninfo}, | ||
| {"hidden", &getrawaddrman}, | ||
| }; | ||
| for (const auto& c : commands) { | ||
| t.appendCommand(c.name, &c); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,7 +104,7 @@ class TxOrphanage { | |
| size_t m_orphan_tx_size GUARDED_BY(m_mutex){0}; | ||
|
|
||
| /** Erase an orphan by txid */ | ||
| int _EraseTx(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex); | ||
| int EraseTxNoLock(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 Nitpick: scripted-diff titled "Merge bitcoin#27822" also performs renames from bitcoin#27931 Verified: commit This means a separate upstream PR is being backported under another PR's name without acknowledgment in the title or description. Split the scripted-diff into one commit per upstream PR (so authorship and provenance are clear), or expand the commit message and PR title to acknowledge bitcoin#27931. source: ['claude'] |
||
| }; | ||
|
|
||
| #endif // BITCOIN_TXORPHANAGE_H | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,7 @@ class UniValue { | |
| template <class It> | ||
| void push_backV(It first, It last); | ||
|
|
||
| void __pushKV(std::string key, UniValue val); | ||
| void pushKVEnd(std::string key, UniValue val); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not modify vendored UniValue sources without an explicit exception. Line 90 introduces an API rename inside As per coding guidelines: 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| void pushKV(std::string key, UniValue val); | ||
| void pushKVs(UniValue obj); | ||
|
|
||
|
|
||
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.
🟡 Suggestion: Reorder cherry-picks: bitcoin#28523 uses pushKVEnd before bitcoin#27822 introduces it (bisect hazard)
The series orders the merges as a5264f9 (bitcoin#28523) → c34e457 (bitcoin#27822) → 3c47eb7 (bitcoin#28671). bitcoin#28523's new
AddrmanTableToJSONcallstable.pushKVEnd(...)(src/rpc/net.cpp:1202), butUniValue::pushKVEndis introduced only by bitcoin#27822, which is the next commit in this PR.Verified:
git show a5264f984a:src/univalue/include/univalue.hstill declares only__pushKV, notpushKVEnd. Commit a5264f9 therefore does not compile in isolation, breakinggit bisectacross these two commits. The final HEAD is fine because 27822 is applied.Upstream chronological order is bitcoin#27822 (2023-06-21) → bitcoin#28523 (2023-10-03). Please reorder the cherry-picks to match upstream so every intermediate commit builds. (If you also restore bitcoin#26638/bitcoin#28976 per the other finding, this is a good opportunity to fix the order while re-pushing.)
source: ['claude', 'codex']
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.
Resolved in this update — Reorder cherry-picks: bitcoin#28523 uses pushKVEnd before bitcoin#27822 introduces it (bisect hazard) no longer present.
Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.