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

feat(rpc): Connect Peer RPC Method#2037

Merged
refcell merged 2 commits intomainfrom
rf/connect-peers
Jun 9, 2025
Merged

feat(rpc): Connect Peer RPC Method#2037
refcell merged 2 commits intomainfrom
rf/connect-peers

Conversation

@refcell
Copy link
Contributor

@refcell refcell commented Jun 6, 2025

Description

Implements handling for the opp2p_connectPeer method using the Multiaddr string.

This follows how the monorepo parses the addr string.

Closes #1575

Copilot AI review requested due to automatic review settings June 6, 2025 18:14
@refcell refcell added the A-rpc Area: rpc label Jun 6, 2025
@refcell refcell self-assigned this Jun 6, 2025
@refcell
Copy link
Contributor Author

refcell commented Jun 6, 2025

📚 $\text{Stack Overview}$

Pulls submitted in this stack:

This comment was automatically generated by st.

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

This PR implements the handling for the opp2p_connectPeer RPC method, enabling connection via a Multiaddr string.

  • Implements opp2p_connectPeer by parsing the Multiaddr string and routing the connection request.
  • Adds unit tests for Multiaddr parsing and updates the RPC request enums and Cargo.toml to support the new functionality.

Reviewed Changes

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

File Description
crates/node/rpc/src/p2p.rs Implements the RPC method opp2p_connectPeer using Multiaddr parsing.
crates/node/rpc/Cargo.toml Adds a workspace marker for libp2p.
crates/node/p2p/src/rpc/request.rs Adds the ConnectPeer variant and implements connect_peer handling.
Comments suppressed due to low confidence (1)

crates/node/rpc/src/p2p.rs:145

  • The parameter name '_peer' suggests that it is unused, but it is actually used. Consider renaming it to 'peer' to avoid confusion.
async fn opp2p_connect_peer(&self, _peer: String) -> RpcResult<()> {

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 10 lines in your changes missing coverage. Please review.

Project coverage is 82.9%. Comparing base (9110f2f) to head (96cd72e).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/node/rpc/src/p2p.rs 62.5% 6 Missing ⚠️
crates/node/p2p/src/rpc/request.rs 0.0% 4 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 force-pushed the rf/connect-peers branch from 5e11a26 to 96cd72e Compare June 9, 2025 13:11
@refcell refcell enabled auto-merge June 9, 2025 13:12
@refcell refcell added this pull request to the merge queue Jun 9, 2025
Merged via the queue into main with commit a79b1e4 Jun 9, 2025
21 of 23 checks passed
@refcell refcell deleted the rf/connect-peers branch June 9, 2025 13:34
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
### Description

Implements handling for the `opp2p_connectPeer` method using the
Multiaddr string.

This follows how [the monorepo parses the addr
string](https://github.com/ethereum-optimism/optimism/blob/51cb1a7523ac45e3c3703a1a2c6794b378f27cba/op-node/p2p/rpc_server.go#L353).

Closes op-rs/kona#1575
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
### Description

Implements handling for the `opp2p_connectPeer` method using the
Multiaddr string.

This follows how [the monorepo parses the addr
string](https://github.com/ethereum-optimism/optimism/blob/51cb1a7523ac45e3c3703a1a2c6794b378f27cba/op-node/p2p/rpc_server.go#L353).

Closes #1575
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-rpc Area: rpc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(node/p2p): opp2p_connectPeer RPC Method Support

3 participants