Skip to content

fix(interop): handle IPv6-only multiaddrs in _get_ip_value#1372

Merged
acul71 merged 2 commits into
libp2p:mainfrom
acul71:fix/interop-transport-ipv6-multiaddr
Jul 8, 2026
Merged

fix(interop): handle IPv6-only multiaddrs in _get_ip_value#1372
acul71 merged 2 commits into
libp2p:mainfrom
acul71:fix/interop-transport-ipv6-multiaddr

Conversation

@acul71

@acul71 acul71 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes flaky transport interop listener failures when libp2p advertises IPv6-only multiaddrs (e.g. /ip6/::1/tcp/.../p2p/...).

Closes #1371

Problem

_get_ip_value used:

return addr.value_for_protocol("ip4") or addr.value_for_protocol("ip6")

value_for_protocol("ip4") raises ProtocolLookupError on IPv6 addresses, so the IPv6 fallback never executed. Listeners crashed in _get_publishable_address before 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 ip4 and ip6 separately, catching ProtocolLookupError — aligned with the pattern already used in interop/perf/perf_test.py.

Also updated examples/interop/local_ping_test.py for consistency.

Test plan

  • unified-testing transport interop: all 13 python×python combinations pass after this change (local Docker run with Python 3.13 image)

Made with Cursor

acul71 and others added 2 commits July 8, 2026 00:15
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>
@acul71

acul71 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

I'm merging this.
tests pass in perf and transport tests in unified-testing (local runs)

@acul71 acul71 merged commit fd4bf0b into libp2p:main Jul 8, 2026
38 checks passed
@acul71 acul71 deleted the fix/interop-transport-ipv6-multiaddr branch July 8, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

interop transport: _get_ip_value crashes on IPv6-only multiaddrs

1 participant