Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Branch:
ironjam/issue-395(https://github.com/seetadev/lean-py-libp2p/tree/ironjam/issue-395)Related: Issue #395, Discussion #1204
Status: Draft for maintainer review
Summary
Phase 1 removes direct QUIC type checks from upgrade decision paths and replaces them with capability properties on connection interfaces. The upgrade pipeline now asks what a connection provides (security, muxing) rather than what concrete transport class it is.
This keeps host/network/upgrader logic transport-agnostic and allows future built-in-secure/built-in-muxed transports to work without adding transport-specific branching.
Problem Statement
Before this refactor, parts of the stack relied on direct references to QUIC-specific classes to decide whether to skip upgrade stages. That pattern introduced tight coupling between generic connection management code and a specific transport implementation.
The practical issue is abstraction leakage: the upgrader and swarm layers should reason in terms of capabilities, not concrete transport identity.
Phase 1 Scope (Commit-Accurate)
Phase 1 corresponds to the following commit chain on the feature branch:
bf0763f2— addprovides_securityandprovides_muxingcapability surface to shared interfaces inlibp2p/abc.py.1b060744— shift logical handling intolibp2p/transport/upgrader.py; continue interface wiring inlibp2p/abc.py.8db609a9— remove direct QUIC transport references from upgrade paths in:libp2p/network/swarm.pylibp2p/transport/upgrader.pylibp2p/transport/exceptions.pylibp2p/transport/quic/connection.pylibp2p/transport/quic/transport.py570befcb— complete replacement of direct QUIC connection checks with connection properties inlibp2p/host/basic_host.py.Technical Approach
Two capability properties drive behavior:
provides_security: connection already guarantees transport-level security.provides_muxing: connection already provides stream multiplexing.Upgrade flow behavior:
provides_securityisTrue, skip security negotiation.provides_muxingisTrue, skip muxer negotiation.For QUIC-backed connections, these properties evaluate to
True, preserving existing behavior while removing explicit transport identity checks from generic layers.Why This Is the Right Boundary
Transport isolation
Core host/network/upgrader logic no longer depends on QUIC class identity.
Extensibility
New transports with built-in security/muxing can integrate by declaring capabilities, without touching shared upgrade logic.
Testability
Capability-driven tests can validate skip paths using interface-compatible test doubles, without coupling tests to specific transport classes.
Behavior and Compatibility
Out of Scope for Phase 1
Validation Checklist
libp2p/abc.py).Discussion Prompts
References
libp2p/abc.pylibp2p/transport/upgrader.pylibp2p/network/swarm.pylibp2p/host/basic_host.pybf0763f2,1b060744,8db609a9,570befcbBeta Was this translation helpful? Give feedback.
All reactions