Skip to content

chore(relay)!: make v1 hop opt-in#2785

Open
richard-ramos wants to merge 2 commits into
masterfrom
relay-optin
Open

chore(relay)!: make v1 hop opt-in#2785
richard-ramos wants to merge 2 commits into
masterfrom
relay-optin

Conversation

@richard-ramos

@richard-ramos richard-ramos commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

This PR changes the default relay service codec set so Relay.new() advertises only circuit relay v2 HOP.

Legacy relay v1 HOP remains available, but only when explicitly constructing the relay with circuitRelayV1 = true.

This is needed because relay v1 HOP currently bridges raw streams and does not apply the relay v2 data/duration limits. Previously, enabling the default relay service exposed that legacy path implicitly, even when users intended to run the bounded v2 relay.

Affected Areas

  • Protocol Logic
    Circuit relay service protocol advertisement.

Impact on Library Users

This is a breaking behavior change for users relying on default Relay.new() to serve relay v1 HOP. Those users must opt in with Relay.new(circuitRelayV1 = true).

Users relying on the default v2 relay behavior continue to get v2 HOP.

Risk Assessment

The main compatibility risk is for peers or deployments that still expect a default relay service to support v1 HOP. The change reduces accidental exposure of legacy v1 circuits when users intended to run the default v2 relay service.

@richard-ramos richard-ramos marked this pull request as ready for review July 8, 2026 15:10
@richard-ramos richard-ramos requested a review from a team July 8, 2026 15:10
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.29%. Comparing base (af9651a) to head (969e74e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2785      +/-   ##
==========================================
- Coverage   81.30%   81.29%   -0.02%     
==========================================
  Files         171      171              
  Lines       31013    31013              
  Branches       12       12              
==========================================
- Hits        25216    25212       -4     
- Misses       5797     5801       +4     
Files with missing lines Coverage Δ
libp2p/protocols/connectivity/relay/relay.nim 91.22% <100.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-project-automation github-project-automation Bot moved this from new to In Progress in nim-libp2p Jul 8, 2026
@richard-ramos richard-ramos added this pull request to the merge queue Jul 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants