fix(interop): handle IPv6-only multiaddrs in _get_ip_value#1372
Merged
Conversation
value_for_protocol("ip4") raises ProtocolLookupError on IPv6 addresses,
so the previous `or value_for_protocol("ip6")` fallback never ran.
This made transport interop listeners flaky when libp2p advertised
/ip6/::1/... before the Docker bridge IPv4 address.
Fixes libp2p#1371
Co-authored-by: Cursor <cursoragent@cursor.com>
Consolidate duplicated IP extraction in transport ping, local ping, and perf interop scripts onto libp2p.utils.multiaddr_utils, fixing the pyrefly failure in examples/interop/local_ping_test.py. Add regression tests for IPv6-only multiaddr handling in the transport interop harness. Fixes libp2p#1371 Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
|
I'm merging this. |
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
Fixes flaky transport interop listener failures when libp2p advertises IPv6-only multiaddrs (e.g.
/ip6/::1/tcp/.../p2p/...).Closes #1371
Problem
_get_ip_valueused:value_for_protocol("ip4")raisesProtocolLookupErroron IPv6 addresses, so the IPv6 fallback never executed. Listeners crashed in_get_publishable_addressbefore publishing a dialable address.This caused intermittent failures in unified-testing python×python transport interop (~70% fail rate in one run with 32 workers).
Fix
Probe
ip4andip6separately, catchingProtocolLookupError— aligned with the pattern already used ininterop/perf/perf_test.py.Also updated
examples/interop/local_ping_test.pyfor consistency.Test plan
Made with Cursor