-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore!: merge bitcoin#28753, partial bitcoin#28195 (bump MIN_PEER_PROTO_VERSION
to 70221
)
#6877
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
|
0fee8f8
to
89a99e9
Compare
Walkthrough
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/evo/mnauth.cpp (1)
35-41
: Fix clang-format issues.The CI pipeline detected clang-format differences at line 38. Please run clang-format on this section to ensure consistent code formatting.
#!/bin/bash # Verify the clang-format issue echo "Clang-format check detected formatting differences at line 38" echo "Please run: git-clang-format HEAD~1 -- src/evo/mnauth.cpp"
🧹 Nitpick comments (3)
src/net_processing.cpp (3)
652-660
: New RelayInvFiltered overloads look correct and align with MIN_PEER_PROTO bumpDropping version gating and relying on CanRelay + bloom checks is consistent and simplifies call sites. No functional concerns.
- Small ergonomics: add brief docstrings noting relatedTx vs relatedTxHash semantics to prevent misuse.
2405-2427
: Minor efficiency: early return on non-relay peers before locking/PeerRefYou call GetPeerRef (locks m_peer_mutex) before checking pnode->CanRelay(). Inverting the order avoids locking for block‑relay‑only or non‑relay peers.
m_connman.ForEachNode([&](CNode* pnode) { - PeerRef peer = GetPeerRef(pnode->GetId()); - if (peer == nullptr) return; - - auto tx_relay = peer->GetTxRelay(); - if (!pnode->CanRelay() || tx_relay == nullptr) { + if (!pnode->CanRelay()) { + return; + } + PeerRef peer = GetPeerRef(pnode->GetId()); + if (peer == nullptr) return; + auto tx_relay = peer->GetTxRelay(); + if (tx_relay == nullptr) { return; }
2430-2453
: Apply same early-return pattern here for consistencyMirror the CanRelay pre-check to avoid unnecessary locking on non‑relay peers.
m_connman.ForEachNode([&](CNode* pnode) { - PeerRef peer = GetPeerRef(pnode->GetId()); - if (peer == nullptr) return; - - auto tx_relay = peer->GetTxRelay(); - if (!pnode->CanRelay() || tx_relay == nullptr) { + if (!pnode->CanRelay()) { + return; + } + PeerRef peer = GetPeerRef(pnode->GetId()); + if (peer == nullptr) return; + auto tx_relay = peer->GetTxRelay(); + if (tx_relay == nullptr) { return; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
doc/release-notes-6877.md
(1 hunks)src/evo/mnauth.cpp
(2 hunks)src/governance/governance.cpp
(0 hunks)src/governance/object.cpp
(1 hunks)src/llmq/quorums.cpp
(0 hunks)src/net_processing.cpp
(4 hunks)src/version.h
(1 hunks)test/functional/feature_llmq_simplepose.py
(2 hunks)
💤 Files with no reviewable changes (2)
- src/llmq/quorums.cpp
- src/governance/governance.cpp
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{cpp,h,cc,cxx,hpp}
: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction
Files:
src/evo/mnauth.cpp
src/governance/object.cpp
src/version.h
src/net_processing.cpp
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Masternode lists must use immutable data structures (Immer library) for thread safety
Files:
src/evo/mnauth.cpp
doc/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the doc directory (documentation)
Files:
doc/release-notes-6877.md
test/functional/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Functional tests should be written in Python and placed in test/functional/
Files:
test/functional/feature_llmq_simplepose.py
🧬 Code graph analysis (2)
test/functional/feature_llmq_simplepose.py (1)
test/functional/test_framework/test_framework.py (1)
start_masternode
(1775-1780)
src/net_processing.cpp (4)
src/coinjoin/server.cpp (1)
inv
(354-354)src/llmq/dkgsession.cpp (4)
inv
(301-301)inv
(609-609)inv
(820-820)inv
(1175-1175)src/instantsend/instantsend.cpp (1)
inv
(416-416)src/spork.cpp (1)
inv
(461-461)
🪛 GitHub Actions: Clang Diff Format Check
src/evo/mnauth.cpp
[error] 38-38: Clang-format differences detected (before formatting vs after formatting). Process exited with code 1.
[error] 93-94: Clang-format differences detected (second formatting chunk). Process exited with code 1.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: linux64_tsan-test / Test source
- GitHub Check: linux64_ubsan-test / Test source
- GitHub Check: linux64-test / Test source
- GitHub Check: linux64_multiprocess-build / Build source
🔇 Additional comments (8)
doc/release-notes-6877.md (1)
1-4
: LGTM!The release notes entry is clear and concise, accurately documenting the MIN_PEER_PROTO_VERSION bump to 70221.
src/governance/object.cpp (1)
597-607
: LGTM!The simplification correctly removes version-gating logic for governance object relay. Since MIN_PEER_PROTO_VERSION is now 70221 (GOVSCRIPT_PROTO_VERSION), all connected peers meet the minimum requirements, making the conditional relay logic unnecessary.
test/functional/feature_llmq_simplepose.py (2)
22-23
: LGTM!Good practice to define MIN_PEER_PROTO_VERSION as a module-level constant with a reference to version.h, improving maintainability and alignment with the C++ codebase.
93-93
: LGTM!The update correctly uses the MIN_PEER_PROTO_VERSION constant instead of the hard-coded value, improving maintainability.
src/version.h (1)
20-20
: LGTM!The MIN_PEER_PROTO_VERSION bump to 70221 (GOVSCRIPT_PROTO_VERSION) is correct and aligns with the PR objective to simplify version-gating logic. Note that this is a breaking change: clients using protocol versions below 70221 will no longer be able to connect to Dash Core.
src/evo/mnauth.cpp (2)
41-41
: LGTM!The standardized signHash construction is correct. With MIN_PEER_PROTO_VERSION bumped to 70221, all connected peers meet the minimum requirements, making the previous conditional logic unnecessary.
96-96
: LGTM!The signHash construction correctly uses
peer.nVersion.load()
and aligns with the simplified version-gating approach.src/net_processing.cpp (1)
3526-3534
: All RelayInvFiltered calls use two-argument overloads
No three-argument usages remain.
Maybe we should defer this to after we branch off v23 |
from test_framework.util import assert_equal, force_finish_mnsync | ||
|
||
# See version.h | ||
MIN_PEER_PROTO_VERSION = 70221 |
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.
We should probably use MIN_MASTERNODE_PROTO_VERSION
in this test
diff --git a/test/functional/feature_llmq_simplepose.py b/test/functional/feature_llmq_simplepose.py
index a73f154ef3..0b3cfcb395 100755
--- a/test/functional/feature_llmq_simplepose.py
+++ b/test/functional/feature_llmq_simplepose.py
@@ -20,7 +20,7 @@ from test_framework.test_framework import (
from test_framework.util import assert_equal, force_finish_mnsync
# See version.h
-MIN_PEER_PROTO_VERSION = 70221
+MIN_MASTERNODE_PROTO_VERSION = 70238
class LLMQSimplePoSeTest(DashTestFramework):
def set_test_params(self):
@@ -90,7 +90,7 @@ class LLMQSimplePoSeTest(DashTestFramework):
def force_old_mn_proto(self, mn: MasternodeInfo):
self.stop_node(mn.nodeIdx)
- self.start_masternode(mn, [f"-pushversion={MIN_PEER_PROTO_VERSION}"])
+ self.start_masternode(mn, [f"-pushversion={MIN_MASTERNODE_PROTO_VERSION - 1}"])
self.connect_nodes(mn.nodeIdx, 0)
self.reset_probe_timeouts()
return False, True
MIN_PEER_PROTO_VERSION
to 70221
MIN_PEER_PROTO_VERSION
to 70221
Okay; I think it makes sense for us to do this for v23. The other thing, if you can do it here, let's bump the master node minimum protocol version to the latest so that we have all master nodes upgrading to v23. |
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 89a99e9
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 89a99e9
We broke feature_txindex_compatibility.py
... The test uses v0.17.0.3 (CLIENT_VERSION=170003) which has PROTOCOL_VERSION = 70219
.
What are we going to do about this PR? We need to get this merged in to release v23 soon. |
@PastaPastaPasta @kwvg Consider alternate solution: #6882 NOTE: I'd prefer to keep compatibility as long |
Co-Authored-By: UdjinM6 <[email protected]>
MIN_PEER_PROTO_VERSION
to 70221
MIN_PEER_PROTO_VERSION
to 70221
)
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
🧹 Nitpick comments (3)
src/txdb.cpp (1)
38-40
: Consider clarifying the legacy key documentation.The comments document legacy DB keys that may still exist in old databases. While this is helpful, the format could be clearer.
Consider this refactor for better clarity:
// Keys used in previous version that might still be found in the DB: static constexpr uint8_t DB_COINS{'c'}; -// CBlockTreeDB::DB_TXINDEX_BLOCK{'T'}; -// CBlockTreeDB::DB_TXINDEX{'t'} -// CBlockTreeDB::ReadFlag("txindex") +// Legacy txindex keys (removed in protocol version 70221): +// CBlockTreeDB::DB_TXINDEX_BLOCK{'T'} +// CBlockTreeDB::DB_TXINDEX{'t'} +// CBlockTreeDB::ReadFlag("txindex")src/net_processing.cpp (2)
2405-2428
: LGTM; consider tiny early-return micro-optimization.Logic and locks are correct. Optionally, check CanRelay() before fetching tx_relay to save work.
- auto tx_relay = peer->GetTxRelay(); - if (!pnode->CanRelay() || tx_relay == nullptr) { + if (!pnode->CanRelay()) { + return; + } + auto tx_relay = peer->GetTxRelay(); + if (tx_relay == nullptr) { return; }
2430-2453
: Hash-path filter check is OK; confirm semantics.Using bloom.contains(txid) only works if peers insert txids (not just scripts). Ensure callers only use this overload where filters are pre-populated accordingly, else relevant tx invs might be skipped.
Apply the same early-return micro-optimization as above:
- auto tx_relay = peer->GetTxRelay(); - if (!pnode->CanRelay() || tx_relay == nullptr) { + if (!pnode->CanRelay()) { + return; + } + auto tx_relay = peer->GetTxRelay(); + if (tx_relay == nullptr) { return; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
doc/release-notes-6877.md
(1 hunks)src/evo/mnauth.cpp
(2 hunks)src/governance/governance.cpp
(0 hunks)src/governance/object.cpp
(1 hunks)src/init.cpp
(0 hunks)src/llmq/quorums.cpp
(0 hunks)src/net_processing.cpp
(4 hunks)src/txdb.cpp
(2 hunks)src/txdb.h
(0 hunks)src/version.h
(1 hunks)test/functional/feature_llmq_simplepose.py
(2 hunks)test/functional/feature_txindex_compatibility.py
(0 hunks)test/functional/test_runner.py
(0 hunks)
💤 Files with no reviewable changes (6)
- src/governance/governance.cpp
- src/init.cpp
- test/functional/test_runner.py
- src/txdb.h
- test/functional/feature_txindex_compatibility.py
- src/llmq/quorums.cpp
✅ Files skipped from review due to trivial changes (1)
- doc/release-notes-6877.md
🚧 Files skipped from review as they are similar to previous changes (3)
- test/functional/feature_llmq_simplepose.py
- src/version.h
- src/evo/mnauth.cpp
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{cpp,h,cc,cxx,hpp}
: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction
Files:
src/txdb.cpp
src/governance/object.cpp
src/net_processing.cpp
🔇 Additional comments (4)
src/governance/object.cpp (1)
597-607
: LGTM! Protocol version gating correctly removed.The simplified relay logic is appropriate after bumping MIN_PEER_PROTO_VERSION to 70221. All connected peers now support the governance script protocol, eliminating the need for per-object version checks or special handling of PROPOSAL objects.
src/txdb.cpp (2)
18-20
: LGTM! Proper C++20 header usage.The replacement of
<stdint.h>
with C++ standard headers (<cassert>
,<cstdlib>
,<iterator>
) is correct:
<cassert>
is used forassert()
(line 110)<cstdlib>
is used for_Exit()
(line 148)<iterator>
is used forstd::next()
(line 139)This aligns with C++20 best practices.
10-10
: Verify if this include is still necessary.The addition of
primitives/transaction.h
may have been required for the now-removedCheckLegacyTxindex
function. Scanning the current code, there's no apparent usage ofCTransaction
or other transaction primitive types. Consider verifying whether this include is still needed.Run the following script to check for usage of types typically defined in primitives/transaction.h:
src/net_processing.cpp (1)
652-660
: API change: RelayInvFiltered overloads (no minProto gating). Verify call sites.Dropping per-call minProtoVersion is fine given MIN_PEER_PROTO_VERSION enforcement. Please confirm no lingering 3‑arg usages and no remaining ISDLOCK_PROTO_VERSION gating elsewhere.
RelayInvFiltered(inv, *std::get<CTransactionRef>(filter)); | ||
} else if (std::holds_alternative<uint256>(filter)) { | ||
RelayInvFiltered(inv, std::get<uint256>(filter), ISDLOCK_PROTO_VERSION); | ||
RelayInvFiltered(inv, std::get<uint256>(filter)); | ||
} else { |
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.
🛠️ Refactor suggestion | 🟠 Major
Avoid potential null dereference of CTransactionRef.
std::get(filter) can be empty; dereferencing would crash. Guard it.
- RelayInvFiltered(inv, *std::get<CTransactionRef>(filter));
+ const auto& txref = std::get<CTransactionRef>(filter);
+ if (txref) {
+ RelayInvFiltered(inv, *txref);
+ }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
RelayInvFiltered(inv, *std::get<CTransactionRef>(filter)); | |
} else if (std::holds_alternative<uint256>(filter)) { | |
RelayInvFiltered(inv, std::get<uint256>(filter), ISDLOCK_PROTO_VERSION); | |
RelayInvFiltered(inv, std::get<uint256>(filter)); | |
} else { | |
const auto& txref = std::get<CTransactionRef>(filter); | |
if (txref) { | |
RelayInvFiltered(inv, *txref); | |
} | |
} else if (std::holds_alternative<uint256>(filter)) { | |
RelayInvFiltered(inv, std::get<uint256>(filter)); | |
} else { |
🤖 Prompt for AI Agents
In src/net_processing.cpp around lines 3528-3531, the code directly dereferences
std::get<CTransactionRef>(filter) which can be a null CTransactionRef and crash;
retrieve the CTransactionRef into a local variable, check it for non-null (e.g.
if (tx) ...) before dereferencing and calling RelayInvFiltered, and handle the
null case (skip relay or log/return) instead of dereferencing unconditionally.
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 3562045
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 3562045
Additional Information
Dependency for refactor: split off governance masternode-only logic to
GovernanceSigner
, dropRelay()
s and use periodic relay instead, minor cleanup #6838feature_txindex_compatibility.py
uses Dash Core v0.17.0.3, which hasPROTOCOL_VERSION
70219
(source). Due to the minimum protocol version bump, this test will no longer pass (spotted by UdjinM6!)Legacy txindex checks were introduced in bitcoin#22626 (see dash#6296, part of Dash Core v22) and the test was introduced in bitcoin#23046 (see dash#6327, part of Dash Core v22).
The migration logic itself was added in bitcoin#13033 (see dash#4178, part of Dash Core v18).
This means that it should be safe to drop the failing test altogether as we migrated databases 5 major versions ago, the databases are not funds-sensitive and we dropped support for migration a major version ago.
Breaking Changes
Clients below
70221
(GOVSCRIPT_PROTO_VERSION
) will not be able to connect to Dash CoreChecklist