Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9a3f328
feat: implement GossipSub v1.3 support with extensions and improved p…
Winter-Soren Feb 21, 2026
6b1984b
resolved merge conflict in imports
Winter-Soren Feb 21, 2026
ea87db3
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Feb 21, 2026
0da32a1
fixed pre commit hook and removed unused imports
Winter-Soren Feb 21, 2026
f978b38
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Feb 21, 2026
8af34e4
feat: add start and stop observing topics with topic observation stat…
IronJam11 Feb 22, 2026
9b1dc78
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Feb 22, 2026
66fb991
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
seetadev Feb 26, 2026
6067dec
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Mar 1, 2026
b30aad3
added test suite for gossipsub 1.3 extended
Winter-Soren Mar 2, 2026
ccfde1d
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Mar 2, 2026
01b6abf
fix: resolve GossipSub v1.3 merge conflicts with main, keep v1.3 prot…
Winter-Soren Mar 7, 2026
7917e64
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Mar 7, 2026
bf13bc6
resolved pre commit hook issues
Winter-Soren Mar 7, 2026
92d973b
tests: align v14 extension tests with no-op emit_extension (v1.3 wire…
Winter-Soren Mar 7, 2026
dc3ba5d
docs: fix GossipSub.handle_observe docstring list formatting to satis…
Winter-Soren Mar 9, 2026
c21bd87
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
seetadev Mar 9, 2026
02ced46
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Mar 12, 2026
cdcb4f7
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Mar 12, 2026
e979652
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
acul71 Mar 13, 2026
f5ea137
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
acul71 Mar 15, 2026
03f1b10
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Mar 16, 2026
d4cc6e7
added newsfragement, replaced string with hex method and protocol ver…
Winter-Soren Mar 16, 2026
2663ad7
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
seetadev Mar 16, 2026
e497f88
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
seetadev Mar 16, 2026
ff28e8e
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
acul71 Mar 17, 2026
bd573e8
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
acul71 Mar 20, 2026
80faa1c
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
acul71 Mar 24, 2026
50d8596
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
seetadev Mar 24, 2026
ba224a8
Fix rpc_queue extensions splitting for optional ControlExtensions and…
Winter-Soren Mar 26, 2026
d2be9ee
formatted gossipsub 1.3 docs
Winter-Soren Mar 26, 2026
3e41aca
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
acul71 Mar 26, 2026
4ea3b21
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
acul71 Mar 28, 2026
cdebdc9
refactor(pubsub): type ExtensionsState misbehaviour callback as Calla…
Winter-Soren Mar 29, 2026
c71c735
Update docs/gossipsub-1.3.rst
Winter-Soren Mar 31, 2026
a7cfff7
Merge branch 'main' into enh/1231-add-gossipsub-1.3-support
Winter-Soren Mar 31, 2026
1ebcba9
docs: fix gossipsub-1.3 topic observation snippet and clarify it as A…
Winter-Soren Mar 31, 2026
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
1 change: 1 addition & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Examples
examples.multiple_connections
tls-support
gossipsub-1.2
gossipsub-1.3
examples.websocket
examples.tls
examples.tcp
Expand Down
84 changes: 84 additions & 0 deletions docs/gossipsub-1.3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
GossipSub 1.3 Extensions and Topic Observation
==============================================

Overview
--------

Py-libp2p supports the GossipSub v1.3 Extensions Control Message mechanism and the
Topic Observation extension. These features require negotiating the
``/meshsub/1.3.0`` protocol (or later) with peers.

Topic Observation
-----------------

The Topic Observation extension allows a peer to receive IHAVE notifications for
a topic without being a full subscriber. This is useful for presence awareness:
knowing when messages are published on a topic without actually receiving the
message payloads.

Lifecycle
~~~~~~~~~

1. **Start observing**: Call ``start_observing_topic(topic)`` to send OBSERVE
control messages to in-topic peers that support the extension. The router
will then send IHAVE notifications to you when new messages arrive on that
topic.

2. **Receive IHAVE**: As an observer, you receive IHAVE control messages
containing message IDs. These are presence notifications only; observers do
not typically reply with IWANT to fetch the actual messages.

3. **Stop observing**: Call ``stop_observing_topic(topic)`` to send UNOBSERVE
control messages and stop receiving IHAVE notifications for that topic.

API Usage Snippet
~~~~~~~~~~~~~~~~~

The snippet below demonstrates the Topic Observation API calls. It is not a
complete runnable program (host setup, service lifecycle, and peer wiring are
omitted for brevity). For a runnable end-to-end example, see
:doc:`examples.pubsub`.

.. code-block:: python

from libp2p import new_host
from libp2p.pubsub.gossipsub import PROTOCOL_ID_V13, GossipSub
from libp2p.pubsub.pubsub import Pubsub

# Create host and Pubsub with a v1.3-capable GossipSub router.
host = new_host()
gossipsub = GossipSub(
protocols=[PROTOCOL_ID_V13],
degree=6,
degree_low=4,
degree_high=12,
)
pubsub = Pubsub(host, gossipsub)

# Start observing a topic (IHAVE-only presence notifications).
# In practice, call this once Pubsub/GossipSub services are running.
await gossipsub.start_observing_topic("my-topic")

# ... later, when done ...
await gossipsub.stop_observing_topic("my-topic")

Protocol Requirements
~~~~~~~~~~~~~~~~~~~~~

* Topic Observation requires both peers to negotiate ``/meshsub/1.3.0`` (or
later) and to advertise support via the Extensions Control Message.
* Extensions are only sent when the negotiated protocol is v1.3+; peers on
v1.1/v1.2 do not receive extension fields.

Specification References
------------------------

* `GossipSub v1.3 Extensions <https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.3.md>`_
* `Topic Observation proposal <https://ethresear.ch/t/gossipsub-topic-observation-proposed-gossipsub-1-3/20907>`_

Related Documentation
---------------------

* :doc:`gossipsub-1.2` - GossipSub 1.2 features (IDONTWANT, etc.)
* :doc:`examples.pubsub` - PubSub chat example
* :doc:`libp2p.pubsub` - Complete PubSub API documentation
4 changes: 3 additions & 1 deletion docs/libp2p.pubsub.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ libp2p.pubsub package

Py-libp2p provides a comprehensive PubSub implementation with support for both FloodSub and GossipSub protocols, including the latest GossipSub 1.2 specification with IDONTWANT control messages for improved bandwidth efficiency.

For detailed information about GossipSub 1.2 features and configuration, see :doc:`gossipsub-1.2`.
For detailed information about GossipSub features and configuration, see
:doc:`gossipsub-1.2` (IDONTWANT, etc.) and :doc:`gossipsub-1.3` (v1.3 extensions,
Topic Observation).

Subpackages
-----------
Expand Down
Loading
Loading