Skip to content

Conversation

kwvg
Copy link
Collaborator

@kwvg kwvg commented Oct 7, 2025

Additional Information

Breaking Changes

Clients below 70221 (GOVSCRIPT_PROTO_VERSION) will not be able to connect to Dash Core

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas (note: N/A)
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

Copy link

github-actions bot commented Oct 7, 2025

@kwvg kwvg force-pushed the proto_bump branch 2 times, most recently from 0fee8f8 to 89a99e9 Compare October 7, 2025 16:38
@kwvg kwvg marked this pull request as ready for review October 7, 2025 17:22
Copy link

coderabbitai bot commented Oct 7, 2025

Walkthrough

  • Bumped MIN_PEER_PROTO_VERSION to 70221 and removed several protocol-gating constants from src/version.h.
  • Normalized masternode auth signHash construction in src/evo/mnauth.cpp to a single branch.
  • Removed per-peer/version gating and validation checks for governance objects in src/governance/{governance.cpp,object.cpp}.
  • Removed a peer-version check in src/llmq/quorums.cpp that previously blocked quorum data requests from older peers.
  • Removed minProtoVersion parameters from PeerManagerImpl::RelayInvFiltered and updated call sites in src/net_processing.cpp.
  • Removed legacy txindex upgrade/check logic (src/init.cpp, src/txdb.cpp, src/txdb.h) and deleted the txindex compatibility functional test and its registration in the test runner.
  • Added release notes entry for P2P/network changes and updated a functional test constant for masternode proto version.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly indicates merging upstream Bitcoin changes and bumping the MIN_PEER_PROTO_VERSION to 70221, which directly reflects the core intent of the pull request.
Description Check ✅ Passed The description elaborates on the protocol version bump, its impact on downstream tests, the rationale for dropping legacy migration support, and lists breaking changes and checklist items, all of which are directly relevant to the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 bump

Dropping 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/PeerRef

You 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 consistency

Mirror 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2148106 and 89a99e9.

📒 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.

@PastaPastaPasta
Copy link
Member

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
Copy link

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

@PastaPastaPasta PastaPastaPasta changed the title chore: bump MIN_PEER_PROTO_VERSION to 70221 chore!: bump MIN_PEER_PROTO_VERSION to 70221 Oct 8, 2025
@PastaPastaPasta
Copy link
Member

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.

@UdjinM6
Copy link

UdjinM6 commented Oct 8, 2025

let's bump the master node minimum protocol version to the latest

70238 is the latest, master is on 70235. No need to bump it any further imo.

PastaPastaPasta
PastaPastaPasta previously approved these changes Oct 9, 2025
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 89a99e9

UdjinM6
UdjinM6 previously approved these changes Oct 9, 2025
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 89a99e9

@UdjinM6 UdjinM6 dismissed their stale review October 9, 2025 17:40

We broke feature_txindex_compatibility.py... The test uses v0.17.0.3 (CLIENT_VERSION=170003) which has PROTOCOL_VERSION = 70219.

@kwvg kwvg marked this pull request as draft October 9, 2025 18:41
@PastaPastaPasta
Copy link
Member

What are we going to do about this PR? We need to get this merged in to release v23 soon.

@knst
Copy link
Collaborator

knst commented Oct 13, 2025

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
as possible and break it only when it's really necessary

@kwvg kwvg changed the title chore!: bump MIN_PEER_PROTO_VERSION to 70221 chore!: merge bitcoin#28753, partial bitcoin#28195 (bump MIN_PEER_PROTO_VERSION to 70221) Oct 13, 2025
@kwvg kwvg marked this pull request as ready for review October 13, 2025 14:16
@kwvg kwvg requested review from PastaPastaPasta, UdjinM6 and knst and removed request for knst October 13, 2025 14:16
Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 89a99e9 and 3562045.

📒 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 for assert() (line 110)
  • <cstdlib> is used for _Exit() (line 148)
  • <iterator> is used for std::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-removed CheckLegacyTxindex function. Scanning the current code, there's no apparent usage of CTransaction 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.

Comment on lines +3528 to 3531
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 {
Copy link

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.

Suggested change
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.

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 3562045

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 3562045

@PastaPastaPasta PastaPastaPasta merged commit ee484d6 into dashpay:develop Oct 13, 2025
34 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants