Skip to content

refactor(p2p,eth): collapse pair-peer dual links into a single prioritized write path, close #2351 #2359#2360

Open
gzliudan wants to merge 1 commit into
XinFinOrg:dev-upgradefrom
gzliudan:drop-peer-dual-connection
Open

refactor(p2p,eth): collapse pair-peer dual links into a single prioritized write path, close #2351 #2359#2360
gzliudan wants to merge 1 commit into
XinFinOrg:dev-upgradefrom
gzliudan:drop-peer-dual-connection

Conversation

@gzliudan

@gzliudan gzliudan commented May 28, 2026

Copy link
Copy Markdown
Collaborator

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 apply

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Changes that don't change source code or tests
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code
  • test: Adding missing tests or correcting existing tests

Impacted Components

Which parts of the codebase does this PR touch?
Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Tested on a private network from the genesis block and monitored the chain operating correctly for multiple epochs.
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2c49b1c-05bd-48c4-87b5-cd26cbe615ab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 / SendPriority and 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.

Comment thread p2p/message.go
Comment thread p2p/peer.go Outdated
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch 2 times, most recently from 4d8709c to 3771f6b Compare May 28, 2026 06:26
@gzliudan gzliudan changed the title refactor(p2p,eth): replace pair-peer with BFT write priority refactor(p2p,eth): replace pair-peer with BFT write priority, close #2359 May 28, 2026
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch 3 times, most recently from bb807f4 to a37847c Compare May 28, 2026 07:01
@gzliudan gzliudan requested a review from Copilot May 28, 2026 07:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch 8 times, most recently from 43397e7 to 8e66ebd Compare May 29, 2026 07:18
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch from 8e66ebd to 4f92775 Compare June 2, 2026 02:47
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch from 4f92775 to 77c08ce Compare June 8, 2026 03:34
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch from 77c08ce to 4548fb3 Compare June 11, 2026 06:43
@gzliudan gzliudan changed the title refactor(p2p,eth): replace pair-peer with BFT write priority, close #2359 refactor(p2p,eth): replace pair-peer with BFT write priority, close #2351 #2359 Jun 15, 2026
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch from 4548fb3 to d75ae5c Compare June 15, 2026 03:33
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch 2 times, most recently from 3123733 to 70c967c Compare June 22, 2026 05:12
@gzliudan gzliudan changed the title refactor(p2p,eth): replace pair-peer with BFT write priority, close #2351 #2359 fix(p2p,eth): route peer writes through priority arbiter queues, close #2351 #2359 Jun 22, 2026
@gzliudan gzliudan changed the title fix(p2p,eth): route peer writes through priority arbiter queues, close #2351 #2359 refactor(p2p,eth): collapse pair-peer dual links into a single prioritized write path, close #2351 #2359 Jun 22, 2026
…tized write path, close XinFinOrg#2351 XinFinOrg#2359

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.
@gzliudan gzliudan force-pushed the drop-peer-dual-connection branch from 70c967c to e11afef Compare June 22, 2026 11:13
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