Skip to content

Commit 60fbe08

Browse files
committed
Gossipsub v1.3: Extensions control Message
1 parent f201689 commit 60fbe08

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed

pubsub/gossipsub/gossipsub-v1.3.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# gossipsub v1.3: Extensions Control Message
2+
3+
| Lifecycle Stage | Maturity | Status | Latest Revision |
4+
| --------------- | ------------- | ------ | --------------- |
5+
| 1A | Working Draft | Active | r0, 2025-06-23 |
6+
7+
Authors: [@marcopolo]
8+
9+
Interest Group: TODO
10+
11+
[@marcopolo]: https://github.com/marcopolo
12+
13+
See the [lifecycle document][lifecycle-spec] for context about the maturity level
14+
and spec status.
15+
16+
[lifecycle-spec]: https://github.com/libp2p/specs/blob/master/00-framework-01-spec-lifecycle.md
17+
18+
## Overview
19+
20+
This version specifies a way to for gossipsub peers to describe their
21+
characteristics to each other without requiring a new protocol ID per extension.
22+
23+
This spec MUST be updated upon introducing a new extension, either canonical or
24+
experimental, to the network.
25+
26+
## Motivation
27+
28+
This version makes Gossipsub easier to extend by allowing applications to
29+
selectively make use of the extensions it would benefit from. It removes the
30+
need to make Gossipsub extensions follow a strict ordering. Finally, it allows
31+
extensions to iterate independently from Gossipsub's versioning.
32+
33+
## The Extensions Control Message
34+
35+
If a peer supports any extension, the Extensions control message MUST be
36+
included in the first message on the stream. An Extensions control message MUST
37+
NOT be sent more than once. If a peer supports no extensions, it may omit
38+
sending the Extensions control message.
39+
40+
Extensions are not negotiated; they describe characteristics of the sending peer
41+
that can be used by the receiving peer. However, a negotiation can be implied:
42+
each peer uses the Extensions control message to advertise a set of supported
43+
values. The specification of an extension describes how each peer combines the
44+
two sets to define its behavior.
45+
46+
Peers MUST ignore unknown extensions.
47+
48+
Extensions that modify or replace core protocol functionality will be difficult
49+
to combine with other extensions that modify or replace the same functionality
50+
unless the behavior of the combination is explicitly defined. Such extensions
51+
SHOULD define their interaction with previously defined extensions modifying the
52+
same protocol components.
53+
54+
## Protocol ID
55+
56+
The Gossipsub version for this specification is `v1.3.0`. The protocol ID is
57+
`/meshsub/1.3.0`.
58+
59+
## Process to add a new extensions to this spec
60+
61+
### Canonical Extensions
62+
63+
A Canonical Extension is an extension that is well defined, has multiple
64+
implementations, has shown to be useful in real networks, and has rough
65+
consensus on becoming a canonical extension. The extension specification MUST be
66+
defined in the `libp2p/specs` GitHub repo. After an extension meets the stated
67+
criteria, this specification MUST be updated to include the extension in the
68+
`ControlExtensions` protobuf with a link to the extension's specification doc in
69+
a comment. The extension SHOULD use the next lowest available field number.
70+
71+
Any new messages defined by the extension MUST be added to `RPC` message
72+
definition in this spec. Extensions SHOULD minimize the number of new messages
73+
they introduce here. Try to introduce a single new message, and use that message
74+
as a container for more messages similar to the strategy used by the
75+
ControlMessage in the RPC.
76+
77+
All extension messages MUST be an `optional` field.
78+
79+
### Experimental Extensions
80+
81+
In contrast with a Canonical Extension, an Experimental Extension is still being
82+
evaluated and iterated upon. Adding an experimental extension to this spec lets
83+
others see what is being tried, and ensure there are no misinterpretations of
84+
messages on the wire. A patch to this spec is not needed if experimenting with
85+
an extension in a controlled environment. A patch to this spec is also not
86+
needed if you are not using the `/meshsub/v1.3.0` protocol ID.
87+
88+
If the extension is being tested on a live network, a PR MUST be created that
89+
adds the extension to the `ControlExtensions` protobuf with a link to the
90+
extension's specification. Experimental extensions MUST use a large field number
91+
randomly generated to be at least 4 bytes long when varint encoded. The
92+
extension author MUST ensure this field number does not conflict with any
93+
existing field.
94+
95+
New messages defined by this extension should follow the same guidelines as new
96+
messages for canonical extensions. Field numbers MUST be randomly generated and
97+
be at least 4 bytes long when varint encoded.
98+
99+
Maintainers MUST check that the extension is well specified, in the experimental
100+
range, and that the extension will be tested on a live network. If so,
101+
maintainers SHOULD merge the change.
102+
103+
## Protobuf
104+
105+
```protobuf
106+
syntax = "proto2";
107+
108+
message ControlExtensions {
109+
// Initially empty. Future extensions will be added here along with a
110+
// reference to their specification.
111+
112+
// Experimental extensions must use field numbers larger than 0x200000 to be
113+
// encoded with at least 4 bytes
114+
}
115+
116+
message ControlMessage {
117+
repeated ControlIHave ihave = 1;
118+
repeated ControlIWant iwant = 2;
119+
repeated ControlGraft graft = 3;
120+
repeated ControlPrune prune = 4;
121+
repeated ControlIDontWant idontwant = 5;
122+
ControlExtensions extensions = 6;
123+
}
124+
125+
message RPC {
126+
repeated SubOpts subscriptions = 1;
127+
repeated Message publish = 2;
128+
optional ControlMessage control = 3;
129+
130+
131+
// Canonical Extensions should register their messages here.
132+
133+
// Experimental Extensions should register their messages here. They
134+
// must use field numbers larger than 0x200000 to be encoded with at least 4
135+
// bytes
136+
}
137+
```

0 commit comments

Comments
 (0)