-
Couldn't load subscription status.
- Fork 1.1k
feat(Transport::Dial): PortUse policy yielded for Outbound Connections #6187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
momoshell
wants to merge
18
commits into
libp2p:master
Choose a base branch
from
momoshell:transport-port-use
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
For quite some time, I've observed that behaviors used in production were deteriorating over time. Specifically, KAD queries started failing, nodes remained stuck in
kad::Mode::Client, and Autonat repeatedly failed to confirm external addresses, often stuck with a single check perPeerID.Inspection revealed that the Identify protocol was returning addresses with ephemeral ports. As a result, all behaviors attempted to dial discovered peers on these ephemeral ports, leading to failed outbound connections.
This was happening because the Transport::Dial future lacked a way to notify NetworkBehaviour implementations about which PortUse policy was ultimately applied while creating outbound connections.
This PR aims to address this by enabling this promise to yield this data, allowing behaviors to respond appropriately based on the
PortUsepolicy in use.Fixes #5820
Should help with related paritytech/polkadot-sdk#7207
Notes & open questions
Huge thanks and shoutout to @dmitry-markin —without his insights into the problem, I wouldn't have been able to start on this.
This PR is large and contains many changes, but I've done my best to organize it. Since each commit addresses a separate crate, I suggest reviewing it commit-by-commit for the clearest path through the changes. 🙏
I'd appreciate an extra set of eyes on all changes, but I'm specifically looking for a thorough review of the modifications to
priv_clientwithin the Relay crate, as I have some unease about them.I will keep this as a draft until I add some additional tests in the following days.
Change checklist