Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7fb4228
Fix QUIC interop: Track Connection IDs for proper packet routing
acul71 Nov 15, 2025
651f54c
Enhance QUIC Connection ID tracking with proactive notification and i…
acul71 Nov 15, 2025
5090047
Remove emoji from debug log for connection ID retirement
sumanjeet0012 Nov 15, 2025
799eb7d
Added newsfragments
sumanjeet0012 Nov 15, 2025
3991140
Add tests for QUIC connection ID issuance and listener fallback routing
sumanjeet0012 Nov 15, 2025
9d52bba
fix lint issues
sumanjeet0012 Nov 15, 2025
d3c5b05
Refactor timeout test to improve client connection handling and ensur…
sumanjeet0012 Nov 16, 2025
9c3d477
Merge pull request #1047 from sumanjeet0012/fix/interop-issues
seetadev Nov 16, 2025
20a07b9
Refactor QUIC Connection ID management into ConnectionIDRegistry
acul71 Nov 16, 2025
38ca6bf
Fix test_yamux_stress_ping: add retry logic and semaphore for reliabi…
acul71 Nov 16, 2025
e9e7fde
Make test_yamux_stress_ping more resilient for CI environments
acul71 Nov 16, 2025
f55a902
Refactor test_yamux_stress_ping to use event-driven waiting
acul71 Nov 17, 2025
049cbd4
Fix ConnectionIDRegistry duplicate connection registration bug
acul71 Nov 17, 2025
008de68
Fix multiselect contention and optimize QUIC event processing
acul71 Nov 17, 2025
9c0e17b
Reduce stream opening semaphore to better match negotiation semaphore
acul71 Nov 17, 2025
5bdba9e
Fix false positive warnings and improve test documentation
acul71 Nov 17, 2025
29b7d67
Merge branch 'main' into fix/interop-issues
seetadev Nov 17, 2025
a80a812
feat(quic): enhance Connection ID management with quinn-inspired impr…
acul71 Nov 19, 2025
47de78c
chore: fix linting and type checking issues
acul71 Nov 19, 2025
dba72f6
Merge branch 'main' into fix/interop-issues
acul71 Nov 19, 2025
575fa14
fix(quic): ensure event_started is set only after connection establis…
acul71 Nov 20, 2025
81de59e
test(quic): remove semaphore limit from stress ping test
acul71 Nov 22, 2025
4e9704b
fix(quic): increase STREAM_OPEN_TIMEOUT from 5s to 30s for high concu…
acul71 Nov 22, 2025
26a48bd
test(quic): add CI/CD-specific debug logging for test_yamux_stress_ping
acul71 Nov 22, 2025
c246b63
test(quic): reduce stress test stream count from 100 to 50
acul71 Nov 22, 2025
31de24b
fix(quic): increase DEFAULT_NEGOTIATE_TIMEOUT from 5s to 15s and regi…
acul71 Nov 22, 2025
9a0ca34
fix(quic): increase negotiation timeout to 30s and enable stress-test…
acul71 Nov 22, 2025
cc13b33
feat(host): implement protocol caching to skip multiselect negotiation
acul71 Nov 22, 2025
c513a9d
feat: add automatic identify caching for quic
acul71 Nov 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
"tests.factories",
# Mocked ONLY for Sphinx/autodoc: this module does not exist in the codebase
# but some doc tools may try to import it. No real code references this import.
"libp2p.relay.circuit_v2.lib"
"libp2p.relay.circuit_v2.lib",
]

# Documents to append as an appendix to all manuals.
Expand Down
47 changes: 47 additions & 0 deletions docs/examples.interop.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Interoperability Testing
========================

This example provides a standalone console script for testing libp2p ping functionality
without Docker or Redis dependencies. It supports both listener and dialer roles and
measures ping RTT and handshake times.

Usage
-----

Run as listener (waits for connection):

.. code-block:: console

$ python -m examples.interop.local_ping_test --listener --port 8000
Listener ready, listening on:
/ip4/127.0.0.1/tcp/8000/p2p/Qm...
Waiting for dialer to connect...

Run as dialer (connects to listener):

.. code-block:: console

$ python -m examples.interop.local_ping_test --dialer --destination /ip4/127.0.0.1/tcp/8000/p2p/Qm...
Connecting to listener at: /ip4/127.0.0.1/tcp/8000/p2p/Qm...
Connected successfully
Performing ping test
{"handshakePlusOneRTTMillis": 15.2, "pingRTTMilllis": 2.1}

Options
-------

- ``--listener``: Run as listener (wait for connection)
- ``--dialer``: Run as dialer (connect to listener)
- ``--destination ADDR``: Destination multiaddr (required for dialer)
- ``--port PORT``: Port number (0 = auto-select)
- ``--transport {tcp,ws,quic-v1}``: Transport protocol (default: tcp)
- ``--muxer {mplex,yamux}``: Stream muxer (default: mplex)
- ``--security {noise,plaintext}``: Security protocol (default: noise)
- ``--test-timeout SECONDS``: Test timeout in seconds (default: 180)
- ``--debug``: Enable debug logging

The full source code for this example is below:

.. literalinclude:: ../examples/interop/local_ping_test.py
:language: python
:linenos:
1 change: 1 addition & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Examples
examples.echo
examples.echo_quic
examples.ping
examples.interop
examples.pubsub
examples.bitswap
examples.circuit_relay
Expand Down
49 changes: 49 additions & 0 deletions docs/libp2p.transport.quic.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,55 @@
libp2p.transport.quic package
=============================

Connection ID Management
------------------------

The QUIC transport implementation uses a sophisticated Connection ID (CID) management system
inspired by the `quinn` Rust QUIC library. This system ensures proper packet routing and
handles connection migration scenarios.

Key Features
~~~~~~~~~~~~

**Sequence Number Tracking**
Each Connection ID is assigned a sequence number, starting at 0 for the initial CID.
Sequence numbers are used to ensure proper retirement ordering per the QUIC specification.

**Initial vs. Established CIDs**
Initial CIDs (used during handshake) are tracked separately from established connection CIDs.
This separation allows for efficient packet routing and proper handling of handshake packets.

**Fallback Routing**
When packets arrive with new Connection IDs before ``ConnectionIdIssued`` events are processed,
the system uses O(1) fallback routing based on address mappings. This handles race conditions
gracefully and ensures packets are routed correctly.

**Retirement Ordering**
Connection IDs are retired in sequence order, ensuring compliance with the QUIC specification.
The ``ConnectionIDRegistry`` maintains sequence number mappings to enable proper retirement.

Architecture
~~~~~~~~~~~~

The ``ConnectionIDRegistry`` class manages all Connection ID routing state:

- **Established connections**: Maps Connection IDs to ``QUICConnection`` instances
- **Pending connections**: Maps Connection IDs to ``QuicConnection`` (aioquic) instances during handshake
- **Initial CIDs**: Separate tracking for handshake packet routing
- **Sequence tracking**: Maps Connection IDs to sequence numbers and connections to sequence ranges
- **Address mappings**: Bidirectional mappings between Connection IDs and addresses for O(1) fallback routing

Performance Monitoring
~~~~~~~~~~~~~~~~~~~~~~

The registry tracks performance metrics including:

- Fallback routing usage count
- Sequence number distribution
- Operation timings (when debug mode is enabled)

These metrics can be accessed via the ``get_stats()`` method and reset using ``reset_stats()``.

Submodules
----------

Expand Down
1 change: 1 addition & 0 deletions examples/interop/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Interoperability examples for py-libp2p."""
Loading
Loading