Draft
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.
Summary
litep2pfrom crates.iov0.13.0to a git revision (27b110d1) that includes WebRTC transport support, and enables the newwebrtcfeature flag/ip4/.../udp/.../webrtclisten addresses are recognized and routed to the WebRTC transportWebRTCandCerthashmultiaddr protocols when appending/p2p/<peer_id>to addressesDetails
Dependency change (
Cargo.toml)The
litep2pdependency is switched from a crates.io release to a pinned git commit from the chainsafe/litep2p repository, with thewebrtcfeature added alongside the existingrsaandwebsocketfeatures. This also pulls instr0m(a WebRTC media/data library) as a new transitive dependency.Listen address parsing (
substrate/client/network/src/litep2p/mod.rs)The previous implementation used an iterator-based
filter_map+unzippattern to split listen addresses into TCP and WebSocket buckets. This is refactored into an explicitforloop that classifies addresses into three categories:/ip{4,6}/.../tcp/.../wsor/wss/ip{4,6}/.../tcp/.../ip{4,6}/.../udp/.../webrtcThe WebRTC transport is conditionally configured — it is only added to the litep2p config when at least one WebRTC listen address is provided.
Known-address protocol matching
The address-matching logic in
NetworkBackend::newis updated to also recognizeProtocol::WebRTCandProtocol::Certhash(_)as valid terminal protocols before appending/p2p/<peer_id>, ensuring WebRTC addresses from the DHT or other discovery mechanisms are correctly handled.Test plan
/ip4/0.0.0.0/udp/30333/webrtc) and confirm it starts listening on WebRTC/p2psuffixcargo build -p polkadot --releaseto confirm successful compilationcargo test -p sc-network