refactor(p2p,eth): collapse pair-peer dual links into a single prioritized write path, close #2359 #2351#2360
Open
gzliudan wants to merge 2 commits into
Open
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ 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.
Pull request overview
This PR removes the XDPoS pair-peer dual-connection mechanism and replaces its BFT-latency goal with per-peer high/low priority write scheduling in the p2p message path.
Changes:
- Removes pair-peer state, duplicate-connection allowances, and eth pair writer fallback paths.
- Adds
PriorityMsgWriter/SendPriorityand routes Vote, Timeout, and SyncInfo messages through the high-priority lane. - Updates dial/server tests and adds priority scheduler tests for preemption, starvation guard, and fallback behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
p2p/server.go |
Rejects duplicate NodeID connections and removes pair-peer tracking. |
p2p/server_test.go |
Updates server peer tracking tests for single-peer semantics. |
p2p/peer.go |
Adds high/low write request queues and priority arbitration. |
p2p/peer_test.go |
Removes pair-peer disconnect behavior test. |
p2p/peer_priority_test.go |
Adds tests for priority write scheduling behavior. |
p2p/peer_error.go |
Removes ErrAddPairPeer. |
p2p/message.go |
Adds SendPriority helper with fallback to normal writes. |
p2p/dial.go |
Restores duplicate peer dial rejection. |
p2p/dial_test.go |
Updates dial state expectations for one connection per NodeID. |
eth/peer.go |
Removes pairRw and uses priority sends for BFT messages. |
eth/handler.go |
Simplifies peer registration now that pair peers are removed. |
4d8709c to
3771f6b
Compare
bb807f4 to
a37847c
Compare
43397e7 to
8e66ebd
Compare
8e66ebd to
4f92775
Compare
25 tasks
4f92775 to
77c08ce
Compare
77c08ce to
4548fb3
Compare
4548fb3 to
d75ae5c
Compare
benjamin202410
approved these changes
Jun 16, 2026
anunay-xin
approved these changes
Jun 16, 2026
d75ae5c to
3123733
Compare
3123733 to
70c967c
Compare
e11afef to
264710d
Compare
f3ef46b to
2256c22
Compare
2256c22 to
ed055c6
Compare
wanwiset25
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
This PR close issue #2359 and replace PR #2351
Replace the pair-peer dual-link write model with a single peer-owned write ingress backed by internal high/low priority queues.
Preserve BFT message priority across wrapper layers, keep synchronous write errors visible to callers, and make queued versus in-flight shutdown handling deterministic.
Update queue metrics and add regression coverage for priority preemption, starvation bounds, ping serialization, wrapper forwarding, and shutdown behavior.
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that