From b716d641847e6540c26ec24507f614869463cebb Mon Sep 17 00:00:00 2001 From: Paul Robinson <5199899+pacrob@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:13:16 -0600 Subject: [PATCH 1/3] fix formatting and some naming in newsfragments (#754) --- newsfragments/621.feature.rst | 2 +- newsfragments/639.feature.rst | 6 +++--- newsfragments/678.misc.rst | 2 +- newsfragments/{679.feature.rst => 679.internal.rst} | 0 newsfragments/681.breaking.rst | 2 +- newsfragments/684.misc.rst | 2 +- newsfragments/690.feature.rst | 2 +- newsfragments/696.bugfix.rst | 4 ++-- newsfragments/701.bugfix.rst | 2 +- newsfragments/702.bugfix.rst | 2 +- newsfragments/{707.feature.rst => 707.internal.rst} | 0 newsfragments/{708.performance.rst => 708.internal.rst} | 0 12 files changed, 12 insertions(+), 12 deletions(-) rename newsfragments/{679.feature.rst => 679.internal.rst} (100%) rename newsfragments/{707.feature.rst => 707.internal.rst} (100%) rename newsfragments/{708.performance.rst => 708.internal.rst} (100%) diff --git a/newsfragments/621.feature.rst b/newsfragments/621.feature.rst index 7ed27fac..f55894f8 100644 --- a/newsfragments/621.feature.rst +++ b/newsfragments/621.feature.rst @@ -1 +1 @@ -Limit concurrency in `push_identify_to_peers` to prevent resource congestion under high peer counts. +Limit concurrency in ``push_identify_to_peers`` to prevent resource congestion under high peer counts. diff --git a/newsfragments/639.feature.rst b/newsfragments/639.feature.rst index 93476b68..f6aa54a6 100644 --- a/newsfragments/639.feature.rst +++ b/newsfragments/639.feature.rst @@ -1,6 +1,6 @@ -Fixed several flow-control and concurrency issues in the `YamuxStream` class. Previously, stress-testing revealed that transferring data over `DEFAULT_WINDOW_SIZE` would break the stream due to inconsistent window update handling and lock management. The fixes include: +Fixed several flow-control and concurrency issues in the ``YamuxStream`` class. Previously, stress-testing revealed that transferring data over ``DEFAULT_WINDOW_SIZE`` would break the stream due to inconsistent window update handling and lock management. The fixes include: - Removed sending of window updates during writes to maintain correct flow-control. - Added proper timeout handling when releasing and acquiring locks to prevent concurrency errors. -- Corrected the `read` function to properly handle window updates for both `read_until_EOF` and `read_n_bytes`. -- Added event logging at `send_window_updates` and `waiting_for_window_updates` for better observability. +- Corrected the ``read`` function to properly handle window updates for both ``read_until_EOF`` and ``read_n_bytes``. +- Added event logging at ``send_window_updates`` and ``waiting_for_window_updates`` for better observability. diff --git a/newsfragments/678.misc.rst b/newsfragments/678.misc.rst index e63e2b95..2d45d482 100644 --- a/newsfragments/678.misc.rst +++ b/newsfragments/678.misc.rst @@ -1 +1 @@ -Refactored gossipsub heartbeat logic to use a single helper method `_handle_topic_heartbeat` that handles both fanout and gossip heartbeats. +Refactored gossipsub heartbeat logic to use a single helper method ``_handle_topic_heartbeat`` that handles both fanout and gossip heartbeats. diff --git a/newsfragments/679.feature.rst b/newsfragments/679.internal.rst similarity index 100% rename from newsfragments/679.feature.rst rename to newsfragments/679.internal.rst diff --git a/newsfragments/681.breaking.rst b/newsfragments/681.breaking.rst index 55050d65..7d5b8f6b 100644 --- a/newsfragments/681.breaking.rst +++ b/newsfragments/681.breaking.rst @@ -1,2 +1,2 @@ -Reordered the arguments to `upgrade_security` to place `is_initiator` before `peer_id`, and made `peer_id` optional. +Reordered the arguments to ``upgrade_security`` to place ``is_initiator`` before ``peer_id``, and made ``peer_id`` optional. This allows the method to reflect the fact that peer identity is not required for inbound connections. diff --git a/newsfragments/684.misc.rst b/newsfragments/684.misc.rst index 0f16fb8f..9957deb7 100644 --- a/newsfragments/684.misc.rst +++ b/newsfragments/684.misc.rst @@ -1 +1 @@ -Uses the `decapsulate` method of the `Multiaddr` class to clean up the observed address. +Uses the ``decapsulate`` method of the ``Multiaddr`` class to clean up the observed address. diff --git a/newsfragments/690.feature.rst b/newsfragments/690.feature.rst index 450ffdfd..f3bcaced 100644 --- a/newsfragments/690.feature.rst +++ b/newsfragments/690.feature.rst @@ -1 +1 @@ -added peer exchange and backoff logic as part of Gossipsub v1.1 upgrade +Added peer exchange and backoff logic as part of Gossipsub v1.1 upgrade diff --git a/newsfragments/696.bugfix.rst b/newsfragments/696.bugfix.rst index d5686418..ba27cc54 100644 --- a/newsfragments/696.bugfix.rst +++ b/newsfragments/696.bugfix.rst @@ -1,4 +1,4 @@ Add timeout wrappers in: -1. multiselect.py: `negotiate` function -2. multiselect_client.py: `select_one_of` , `query_multistream_command` functions +1. ``multiselect.py``: ``negotiate`` function +2. ``multiselect_client.py``: ``select_one_of`` , ``query_multistream_command`` functions to prevent indefinite hangs when a remote peer does not respond. diff --git a/newsfragments/701.bugfix.rst b/newsfragments/701.bugfix.rst index 2bb1be5d..1ef33f0a 100644 --- a/newsfragments/701.bugfix.rst +++ b/newsfragments/701.bugfix.rst @@ -1 +1 @@ -align stream creation logic with yamux specification +Align stream creation logic with yamux specification diff --git a/newsfragments/702.bugfix.rst b/newsfragments/702.bugfix.rst index 90f91f88..f73b45fd 100644 --- a/newsfragments/702.bugfix.rst +++ b/newsfragments/702.bugfix.rst @@ -1 +1 @@ -Fixed an issue in `Pubsub` where async validators were not handled reliably under concurrency. Now uses a safe aggregator list for consistent behavior. +Fixed an issue in ``Pubsub`` where async validators were not handled reliably under concurrency. Now uses a safe aggregator list for consistent behavior. diff --git a/newsfragments/707.feature.rst b/newsfragments/707.internal.rst similarity index 100% rename from newsfragments/707.feature.rst rename to newsfragments/707.internal.rst diff --git a/newsfragments/708.performance.rst b/newsfragments/708.internal.rst similarity index 100% rename from newsfragments/708.performance.rst rename to newsfragments/708.internal.rst From f4eb0158fec39aedd8850c1a8cb31ffd0288d8e6 Mon Sep 17 00:00:00 2001 From: pacrob <5199899+pacrob@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:18:41 -0600 Subject: [PATCH 2/3] Compile release notes for v0.2.9 --- docs/release_notes.rst | 59 ++++++++++++++++++++++++++++++++++ newsfragments/579.feature.rst | 1 - newsfragments/621.feature.rst | 1 - newsfragments/631.feature.rst | 7 ---- newsfragments/639.feature.rst | 6 ---- newsfragments/649.feature.rst | 1 - newsfragments/678.misc.rst | 1 - newsfragments/679.internal.rst | 1 - newsfragments/681.breaking.rst | 2 -- newsfragments/684.misc.rst | 1 - newsfragments/685.feature.rst | 1 - newsfragments/687.feature.rst | 1 - newsfragments/690.feature.rst | 1 - newsfragments/696.bugfix.rst | 4 --- newsfragments/701.bugfix.rst | 1 - newsfragments/702.bugfix.rst | 1 - newsfragments/707.internal.rst | 1 - newsfragments/708.internal.rst | 1 - 18 files changed, 59 insertions(+), 32 deletions(-) delete mode 100644 newsfragments/579.feature.rst delete mode 100644 newsfragments/621.feature.rst delete mode 100644 newsfragments/631.feature.rst delete mode 100644 newsfragments/639.feature.rst delete mode 100644 newsfragments/649.feature.rst delete mode 100644 newsfragments/678.misc.rst delete mode 100644 newsfragments/679.internal.rst delete mode 100644 newsfragments/681.breaking.rst delete mode 100644 newsfragments/684.misc.rst delete mode 100644 newsfragments/685.feature.rst delete mode 100644 newsfragments/687.feature.rst delete mode 100644 newsfragments/690.feature.rst delete mode 100644 newsfragments/696.bugfix.rst delete mode 100644 newsfragments/701.bugfix.rst delete mode 100644 newsfragments/702.bugfix.rst delete mode 100644 newsfragments/707.internal.rst delete mode 100644 newsfragments/708.internal.rst diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 03e1c469..804f3a1f 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -3,6 +3,65 @@ Release Notes .. towncrier release notes start +py-libp2p v0.2.9 (2025-07-09) +----------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Reordered the arguments to ``upgrade_security`` to place ``is_initiator`` before ``peer_id``, and made ``peer_id`` optional. + This allows the method to reflect the fact that peer identity is not required for inbound connections. (`#681 `__) + + +Bugfixes +~~~~~~~~ + +- Add timeout wrappers in: + 1. ``multiselect.py``: ``negotiate`` function + 2. ``multiselect_client.py``: ``select_one_of`` , ``query_multistream_command`` functions + to prevent indefinite hangs when a remote peer does not respond. (`#696 `__) +- Align stream creation logic with yamux specification (`#701 `__) +- Fixed an issue in ``Pubsub`` where async validators were not handled reliably under concurrency. Now uses a safe aggregator list for consistent behavior. (`#702 `__) + + +Features +~~~~~~~~ + +- Added support for ``Kademlia DHT`` in py-libp2p. (`#579 `__) +- Limit concurrency in ``push_identify_to_peers`` to prevent resource congestion under high peer counts. (`#621 `__) +- Store public key and peer ID in peerstore during handshake + + Modified the InsecureTransport class to accept an optional peerstore parameter and updated the handshake process to store the received public key and peer ID in the peerstore when available. + + Added test cases to verify: + 1. The peerstore remains unchanged when handshake fails due to peer ID mismatch + 2. The handshake correctly adds a public key to a peer ID that already exists in the peerstore but doesn't have a public key yet (`#631 `__) +- Fixed several flow-control and concurrency issues in the ``YamuxStream`` class. Previously, stress-testing revealed that transferring data over ``DEFAULT_WINDOW_SIZE`` would break the stream due to inconsistent window update handling and lock management. The fixes include: + + - Removed sending of window updates during writes to maintain correct flow-control. + - Added proper timeout handling when releasing and acquiring locks to prevent concurrency errors. + - Corrected the ``read`` function to properly handle window updates for both ``read_until_EOF`` and ``read_n_bytes``. + - Added event logging at ``send_window_updates`` and ``waiting_for_window_updates`` for better observability. (`#639 `__) +- Added support for ``Multicast DNS`` in py-libp2p (`#649 `__) +- Optimized pubsub publishing to send multiple topics in a single message instead of separate messages per topic. (`#685 `__) +- Optimized pubsub message writing by implementing a write_msg() method that uses pre-allocated buffers and single write operations, improving performance by eliminating separate varint prefix encoding and write operations in FloodSub and GossipSub. (`#687 `__) +- Added peer exchange and backoff logic as part of Gossipsub v1.1 upgrade (`#690 `__) + + +Internal Changes - for py-libp2p Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Added sparse connect utility function to pubsub test utilities for creating test networks with configurable connectivity. (`#679 `__) +- Added comprehensive tests for pubsub connection utility functions to verify degree limits are enforced, excess peers are handled correctly, and edge cases (degree=0, negative values, empty lists) are managed gracefully. (`#707 `__) +- Added extra tests for identify push concurrency cap under high peer load (`#708 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#678 `__, `#684 `__ + + py-libp2p v0.2.8 (2025-06-10) ----------------------------- diff --git a/newsfragments/579.feature.rst b/newsfragments/579.feature.rst deleted file mode 100644 index 9da91328..00000000 --- a/newsfragments/579.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for ``Kademlia DHT`` in py-libp2p. diff --git a/newsfragments/621.feature.rst b/newsfragments/621.feature.rst deleted file mode 100644 index f55894f8..00000000 --- a/newsfragments/621.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Limit concurrency in ``push_identify_to_peers`` to prevent resource congestion under high peer counts. diff --git a/newsfragments/631.feature.rst b/newsfragments/631.feature.rst deleted file mode 100644 index 1d88c779..00000000 --- a/newsfragments/631.feature.rst +++ /dev/null @@ -1,7 +0,0 @@ -Store public key and peer ID in peerstore during handshake - -Modified the InsecureTransport class to accept an optional peerstore parameter and updated the handshake process to store the received public key and peer ID in the peerstore when available. - -Added test cases to verify: -1. The peerstore remains unchanged when handshake fails due to peer ID mismatch -2. The handshake correctly adds a public key to a peer ID that already exists in the peerstore but doesn't have a public key yet diff --git a/newsfragments/639.feature.rst b/newsfragments/639.feature.rst deleted file mode 100644 index f6aa54a6..00000000 --- a/newsfragments/639.feature.rst +++ /dev/null @@ -1,6 +0,0 @@ -Fixed several flow-control and concurrency issues in the ``YamuxStream`` class. Previously, stress-testing revealed that transferring data over ``DEFAULT_WINDOW_SIZE`` would break the stream due to inconsistent window update handling and lock management. The fixes include: - -- Removed sending of window updates during writes to maintain correct flow-control. -- Added proper timeout handling when releasing and acquiring locks to prevent concurrency errors. -- Corrected the ``read`` function to properly handle window updates for both ``read_until_EOF`` and ``read_n_bytes``. -- Added event logging at ``send_window_updates`` and ``waiting_for_window_updates`` for better observability. diff --git a/newsfragments/649.feature.rst b/newsfragments/649.feature.rst deleted file mode 100644 index 82ba5cd7..00000000 --- a/newsfragments/649.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for ``Multicast DNS`` in py-libp2p diff --git a/newsfragments/678.misc.rst b/newsfragments/678.misc.rst deleted file mode 100644 index 2d45d482..00000000 --- a/newsfragments/678.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Refactored gossipsub heartbeat logic to use a single helper method ``_handle_topic_heartbeat`` that handles both fanout and gossip heartbeats. diff --git a/newsfragments/679.internal.rst b/newsfragments/679.internal.rst deleted file mode 100644 index 372053dd..00000000 --- a/newsfragments/679.internal.rst +++ /dev/null @@ -1 +0,0 @@ -Added sparse connect utility function to pubsub test utilities for creating test networks with configurable connectivity. diff --git a/newsfragments/681.breaking.rst b/newsfragments/681.breaking.rst deleted file mode 100644 index 7d5b8f6b..00000000 --- a/newsfragments/681.breaking.rst +++ /dev/null @@ -1,2 +0,0 @@ -Reordered the arguments to ``upgrade_security`` to place ``is_initiator`` before ``peer_id``, and made ``peer_id`` optional. -This allows the method to reflect the fact that peer identity is not required for inbound connections. diff --git a/newsfragments/684.misc.rst b/newsfragments/684.misc.rst deleted file mode 100644 index 9957deb7..00000000 --- a/newsfragments/684.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Uses the ``decapsulate`` method of the ``Multiaddr`` class to clean up the observed address. diff --git a/newsfragments/685.feature.rst b/newsfragments/685.feature.rst deleted file mode 100644 index 1ea15c49..00000000 --- a/newsfragments/685.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Optimized pubsub publishing to send multiple topics in a single message instead of separate messages per topic. diff --git a/newsfragments/687.feature.rst b/newsfragments/687.feature.rst deleted file mode 100644 index d7985cd6..00000000 --- a/newsfragments/687.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Optimized pubsub message writing by implementing a write_msg() method that uses pre-allocated buffers and single write operations, improving performance by eliminating separate varint prefix encoding and write operations in FloodSub and GossipSub. diff --git a/newsfragments/690.feature.rst b/newsfragments/690.feature.rst deleted file mode 100644 index f3bcaced..00000000 --- a/newsfragments/690.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added peer exchange and backoff logic as part of Gossipsub v1.1 upgrade diff --git a/newsfragments/696.bugfix.rst b/newsfragments/696.bugfix.rst deleted file mode 100644 index ba27cc54..00000000 --- a/newsfragments/696.bugfix.rst +++ /dev/null @@ -1,4 +0,0 @@ -Add timeout wrappers in: -1. ``multiselect.py``: ``negotiate`` function -2. ``multiselect_client.py``: ``select_one_of`` , ``query_multistream_command`` functions -to prevent indefinite hangs when a remote peer does not respond. diff --git a/newsfragments/701.bugfix.rst b/newsfragments/701.bugfix.rst deleted file mode 100644 index 1ef33f0a..00000000 --- a/newsfragments/701.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Align stream creation logic with yamux specification diff --git a/newsfragments/702.bugfix.rst b/newsfragments/702.bugfix.rst deleted file mode 100644 index f73b45fd..00000000 --- a/newsfragments/702.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed an issue in ``Pubsub`` where async validators were not handled reliably under concurrency. Now uses a safe aggregator list for consistent behavior. diff --git a/newsfragments/707.internal.rst b/newsfragments/707.internal.rst deleted file mode 100644 index 7c521d29..00000000 --- a/newsfragments/707.internal.rst +++ /dev/null @@ -1 +0,0 @@ -Added comprehensive tests for pubsub connection utility functions to verify degree limits are enforced, excess peers are handled correctly, and edge cases (degree=0, negative values, empty lists) are managed gracefully. diff --git a/newsfragments/708.internal.rst b/newsfragments/708.internal.rst deleted file mode 100644 index 286615e9..00000000 --- a/newsfragments/708.internal.rst +++ /dev/null @@ -1 +0,0 @@ -Added extra tests for identify push concurrency cap under high peer load From 505d3b2a8f4a7e043a1404dda62b02c8e78e02f7 Mon Sep 17 00:00:00 2001 From: pacrob <5199899+pacrob@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:19:54 -0600 Subject: [PATCH 3/3] =?UTF-8?q?Bump=20version:=200.2.8=20=E2=86=92=200.2.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 604949fb..259c6c17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "libp2p" -version = "0.2.8" +version = "0.2.9" description = "libp2p: The Python implementation of the libp2p networking stack" readme = "README.md" requires-python = ">=3.10, <4.0" @@ -188,7 +188,7 @@ name = "Removals" showcontent = true [tool.bumpversion] -current_version = "0.2.8" +current_version = "0.2.9" parse = """ (?P\\d+) \\.(?P\\d+)