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