Basic p2 p peer client#789
Draft
ChrisPaprocki wants to merge 6 commits into780-Basic-P2P-Peer-Client-Specfrom
Draft
Basic p2 p peer client#789ChrisPaprocki wants to merge 6 commits into780-Basic-P2P-Peer-Client-Specfrom
ChrisPaprocki wants to merge 6 commits into780-Basic-P2P-Peer-Client-Specfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a basic P2P peer client to the Peer Network Interface (PNI) module, introducing peer-sharing based discovery plus cold/hot peer set management to improve resilience and decentralisation.
Changes:
- Implement peer-sharing mini-protocol client (
peer_sharing) and cold peer set management with cooldown/churn logic (peer_manager). - Extend
NetworkManagerto seed cold peers from config, maintainmin_hot_peers, run periodic discovery + churn tickers, and add connect timeouts. - Add configuration keys + defaults, and introduce unit/integration tests for peer management and address validation.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| specs/780-Basic-P2P-Peer-Client/spec.md | Adds new functional requirements and traceability for multi-peer connection lifecycle. |
| modules/peer_network_interface/src/peer_sharing.rs | Implements peer-sharing client, CBOR encoding/decoding, handshake gating, and address validation. |
| modules/peer_network_interface/src/peer_manager.rs | Adds cold/failed peer sets, cooldown tracking, and cap/eviction mechanics. |
| modules/peer_network_interface/src/network.rs | Integrates peer_manager/peer_sharing into NetworkManager with discovery + churn tickers and disconnect handling. |
| modules/peer_network_interface/src/connection.rs | Adds TCP connect timeout to peer connections. |
| modules/peer_network_interface/src/configuration.rs | Adds new config fields and defaults for peer discovery/churn/timeouts. |
| modules/peer_network_interface/config.default.toml | Documents and provides defaults for new peer discovery settings. |
| modules/peer_network_interface/src/peer_network_interface.rs | Exposes new modules and threads config through NetworkManager construction. |
| modules/peer_network_interface/src/chain_state.rs | Extracts intersect-point selection into a shared helper for reuse. |
| modules/peer_network_interface/src/block_flow.rs | Uses chain-state intersect-point sampling in consensus mode; keeps recent published points capped. |
| modules/peer_network_interface/src/block_flow_consensus_scenarios_tests.rs | Updates test harness config to include new fields. |
| modules/peer_network_interface/tests/peer_sharing_tests.rs | Adds tests for address validation and peer-sharing timeout behaviour. |
| modules/peer_network_interface/tests/peer_manager_tests.rs | Adds tests for cold set, cap/eviction, cooldown, demotion behaviour, and churn gating. |
| modules/peer_network_interface/tests/configuration_tests.rs | Verifies PeerManagerConfig defaults. |
| modules/peer_network_interface/Cargo.toml | Adds dependencies required for new peer-sharing/peer-manager code. |
| modules/consensus/src/consensus.rs | Lowers parent-missing log level from info to debug. |
| Cargo.toml / Cargo.lock | Adds workspace dependency on rand and locks new crate versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
12bf793 to
67141f6
Compare
4d57a75 to
478eae0
Compare
7 tasks
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.
Description
Describe what this PR does and why. Keep it concise but include enough context
for reviewers who are not familiar with the area.
Related Issue(s)
Link any related issues, e.g.
Fixes #123orRelates to #456.How was this tested?
Describe the tests that you ran to verify your changes. Include instructions
so reviewers can reproduce. Examples:
Checklist
Impact / Side effects
Describe any potential side effects, e.g. performance, compatibility, or security concerns.
If the PR introduces a breaking change, explain migration steps for users.
Reviewer notes / Areas to focus
If you want specific feedback, list files/functions to review or aspects you are unsure about.