Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

feat(p2p): Peers Rpc Endpoint Progress#2081

Merged
refcell merged 2 commits intomainfrom
rf/peers-progress
Jun 10, 2025
Merged

feat(p2p): Peers Rpc Endpoint Progress#2081
refcell merged 2 commits intomainfrom
rf/peers-progress

Conversation

@refcell
Copy link
Copy Markdown
Contributor

@refcell refcell commented Jun 10, 2025

Description

Makes progress on #1562.

Copilot AI review requested due to automatic review settings June 10, 2025 20:22
@refcell refcell added the A-p2p Area: p2p label Jun 10, 2025
@refcell
Copy link
Copy Markdown
Contributor Author

refcell commented Jun 10, 2025

📚 $\text{Stack Overview}$

Pulls submitted in this stack:

This comment was automatically generated by st.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds progress on exposing peer connection gate data in the P2P RPC endpoint, including banned subnets and peers.

  • Changed the banned_subnets field type in the RPC types to Vec<String>.
  • Populates and returns banned_peers, banned_ips, and banned_subnets in the PeerDump response.

Reviewed Changes

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

File Description
crates/node/p2p/src/rpc/types.rs Changed banned_subnets from Vec<IpAddr> to Vec<String>
crates/node/p2p/src/rpc/request.rs Gathered and set banned_peers, banned_ips, and banned_subnets before sending PeerDump
Comments suppressed due to low confidence (4)

crates/node/p2p/src/rpc/types.rs:140

  • Consider using a structured subnet type (e.g., an IpNet or a dedicated Subnet wrapper) instead of raw String to preserve type safety and allow subnet-specific operations.
pub banned_subnets: Vec<String>,

crates/node/p2p/src/rpc/types.rs:139

  • [nitpick] The earlier // TODO: should be IPNet comment was removed without migrating to a structured type; reintroduce a TODO or issue reference to track this intended improvement.
/// The banned subnets

crates/node/p2p/src/rpc/types.rs:140

  • Add a #[serde(rename = "bannedSubnets")] attribute to ensure the JSON key matches the naming convention used for bannedIPS and other RPC fields.
pub banned_subnets: Vec<String>,

crates/node/p2p/src/rpc/request.rs:360

  • The new banned_peers and banned_subnets fields in the RPC response aren't covered by existing tests; consider adding unit or integration tests to validate their presence and correct serialization.
banned_peers: banned_peers.into_iter().map(|p| p.to_string()).collect(),

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 82.0%. Comparing base (b7b2b8d) to head (aa9ec08).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/node/p2p/src/rpc/request.rs 0.0% 6 Missing ⚠️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@refcell refcell enabled auto-merge June 10, 2025 20:33
@refcell refcell added this pull request to the merge queue Jun 10, 2025
Merged via the queue into main with commit 4e2a464 Jun 10, 2025
21 of 23 checks passed
@refcell refcell deleted the rf/peers-progress branch June 10, 2025 21:04
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-p2p Area: p2p

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants