transports: Improves the robustness and success rate of connection dialing#495
Merged
transports: Improves the robustness and success rate of connection dialing#495
Conversation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
dmitry-markin
approved these changes
Dec 8, 2025
Collaborator
dmitry-markin
left a comment
There was a problem hiding this comment.
Nicely done here! 🚀
| @@ -496,52 +513,12 @@ impl Transport for TcpTransport { | |||
| } | |||
|
|
|||
| fn negotiate(&mut self, connection_id: ConnectionId) -> crate::Result<()> { | |||
Collaborator
There was a problem hiding this comment.
May be we can delete negotiate fn from the trait completely, highlighting the fact that negotiation should happen as part of open()?
And likely rename self.opened_raw -> self.opened.
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
lexnv
added a commit
that referenced
this pull request
Dec 16, 2025
## [0.12.3] - 2025-12-16 This release improves the robustness of the multistream-select negotiation over WebRTC transport and fixes inbound bandwidth metering on substreams. It also enhances the dialing success rate by improving the transport dialing logic. Additionally, it re-exports CID's multihash to facilitate the construction of CID V1. ### Changed - transports: Improves the robustness and success rate of connection dialing ([#495](#495)) - types: Re-export cid's multihash to construct CID V1 ([#491](#491)) ### Fixed - fix: multistream-select negotiation on outbound substream over webrtc ([#465](#465)) - substream: Fix inbound bandwidth metering ([#499](#499)) --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
github-merge-queue Bot
pushed a commit
to paritytech/polkadot-sdk
that referenced
this pull request
Dec 17, 2025
## [0.12.3] - 2025-12-16 This release improves the robustness of the multistream-select negotiation over WebRTC transport and fixes inbound bandwidth metering on substreams. It also enhances the dialing success rate by improving the transport dialing logic. Additionally, it re-exports CID's multihash to facilitate the construction of CID V1. ### Changed - transports: Improves the robustness and success rate of connection dialing ([#495](paritytech/litep2p#495)) - types: Re-export cid's multihash to construct CID V1 ([#491](paritytech/litep2p#491)) ### Fixed - fix: multistream-select negotiation on outbound substream over webrtc ([#465](paritytech/litep2p#465)) - substream: Fix inbound bandwidth metering ([#499](paritytech/litep2p#499)) cc @paritytech/sdk-node --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
paritytech-release-backport-bot Bot
pushed a commit
to paritytech/polkadot-sdk
that referenced
this pull request
Dec 17, 2025
## [0.12.3] - 2025-12-16 This release improves the robustness of the multistream-select negotiation over WebRTC transport and fixes inbound bandwidth metering on substreams. It also enhances the dialing success rate by improving the transport dialing logic. Additionally, it re-exports CID's multihash to facilitate the construction of CID V1. ### Changed - transports: Improves the robustness and success rate of connection dialing ([#495](paritytech/litep2p#495)) - types: Re-export cid's multihash to construct CID V1 ([#491](paritytech/litep2p#491)) ### Fixed - fix: multistream-select negotiation on outbound substream over webrtc ([#465](paritytech/litep2p#465)) - substream: Fix inbound bandwidth metering ([#499](paritytech/litep2p#499)) cc @paritytech/sdk-node --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit a12ec9c)
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.
This PR improves the robustness and success rate of connection dialing by grouping peer negotiation (multistream-select) into the "open" (socket-to-socket connectivity) stages of the TCP and Websocket transports.
This avoids premature cancellation of potentially successful dials.
The litep2p establishes connection in two sequential stages:
Previously, the transport manager would cancel all pending dials immediately after the first successful completion of Step 1.
Timeline:
Because at T1 the manager cancels all other attempts, the dialing is reported as failed without trying to dial more than one address.
To improve the robustness of the dialing process, Step 2 is merged with Step 1.
Implementation Details
Any installed protocol (TCP / Websocket) must comply to the following interface:
litep2p/src/transport/mod.rs
Lines 192 to 219 in f1b4e0b
TCP/Websocket protocols now implement:
fn openintegrates step 1 and step 2 (with peer negotiation)fn negotiateforwards the already negotiated connection to the manager immediately (no-op since it was already handled)Closes: #232