feat(hole-punch): add py-libp2p v0.5#813
Open
parth-soni07 wants to merge 1 commit intolibp2p:masterfrom
Open
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.
py-libp2p Hole-Punch Interop Testing
Overview
Added py-libp2p v0.5 implementation for DCUtR (Direct Connection Upgrade through Relay) hole-punch interoperability testing.
Changes
1. New Files (
images/python/v0.5/)peer.pyrelay.pyDockerfile.peerDockerfile.relayrun-peer.sh/run-relay.shrequirements.txtKey implementation details:
A. Dialer: circuit-dial + DCUtR initiation
py-libp2p’s default swarm dial path doesn’t reliably handle
/p2p-circuitaddresses, so the dialer usesCircuitV2Transport.dial()directly, then triggers DCUtR:B. Test coordination via Redis
The containers coordinate using two Redis keys derived from
TEST_KEY:2. Configuration (
images.yaml)Added py-v0.5 under both
relaysandimplementations:3. Bug Fixes (
lib/generate-tests.sh)Fixed two issues in test matrix generation:
A. Null string handling -
yqreturns literal"null"for missing values:B. Wrong output file - Snapshots were written to
worker_selectedinstead ofworker_ignoredin the ignored tests section:Approach
Peer implementation: Bring up a libp2p host with the selected transport/security/muxer, then connect to the relay and dial the listener via a
/p2p-circuitaddress usingCircuitV2Transport.dial(). Once the relay connection is established, initiate DCUtR to upgrade to a direct connection.Test coordination: Use Redis as the rendezvous plane:
{TEST_KEY}_relay_multiaddr{TEST_KEY}_listener_peer_idAsync runtime: Implemented with Trio (py-libp2p runtime), using
background_trio_service(...)for long-running protocol services.Test Command
Conventions
These changes follow the same patterns as the Performance Tests README:
id,source(type,path,dockerfile),transports,secureChannels,muxers. Hole-punch addsrelaysandrouters; py-v0.5 uses local source (nosource.commit).--impl-select,--impl-ignore,--relay-select, etc.) with the same semantics.TEST_KEYfromcompute_test_key) for namespace isolation; relay/listener publish, dialer waits (same publish/wait pattern as perf’s listener/dialer)."null"(local images), and writes ignored-test blocks (including snapshot lines) toworker_ignored— consistent with cached matrix and snapshot behaviour described in perf.