Add fork version to topic#1624
Conversation
Gossipsub peers are separate from the ETH2 RPC protocol, and thus cannot rely on the application-level `Status` negotiation to establish if they're on the same network. Segregating gossipsub topics by fork version decouples RPC from gossip further and allows peers to more easily listen only to the traffic of the network they're interested in, without further negotiation.
Co-Authored-By: Danny Ryan <dannyjryan@gmail.com>
| Topics are plain UTF-8 strings and are encoded on the wire as determined by protobuf (gossipsub messages are enveloped in protobuf messages). Topic strings have form: `/eth2/TopicName/TopicEncoding`. This defines both the type of data being sent on the topic and how the data field of the message is encoded. | ||
| Topics are plain UTF-8 strings and are encoded on the wire as determined by protobuf (gossipsub messages are enveloped in protobuf messages). Topic strings have form: `/eth2/ForkVersion/Name/Encoding`. This defines both the type of data being sent on the topic and how the data field of the message is encoded. | ||
|
|
||
| - `ForkVersion` - the hex-encoded bytes from `state.fork.current_version` of the head state of the client, as also seen in `Status.head_fork_version`. |
There was a problem hiding this comment.
Might make sense to rephrase this in terms of fork version of the epoch of the relevant message, rather than that of the head state.
Because we might prep for and listen to multiple fork version topics of the same message type at once, it isn't strictly related to the head state.
| Topics are plain UTF-8 strings and are encoded on the wire as determined by protobuf (gossipsub messages are enveloped in protobuf messages). Topic strings have form: `/eth2/TopicName/TopicEncoding`. This defines both the type of data being sent on the topic and how the data field of the message is encoded. | ||
| Topics are plain UTF-8 strings and are encoded on the wire as determined by protobuf (gossipsub messages are enveloped in protobuf messages). Topic strings have form: `/eth2/ForkVersion/Name/Encoding`. This defines both the type of data being sent on the topic and how the data field of the message is encoded. | ||
|
|
||
| - `ForkVersion` - the hex-encoded bytes from `state.fork.current_version` of the head state of the client, as also seen in `Status.head_fork_version`. |
There was a problem hiding this comment.
Maybe something like:
| - `ForkVersion` - the hex-encoded bytes from `state.fork.current_version` of the head state of the client, as also seen in `Status.head_fork_version`. | |
| - `ForkVersion` - the hex-encoded bytes of the `fork_version` of the epoch of the related messages to be sent on the topic |
|
|
||
| The fork version is hex-encoded using the following scheme: | ||
| ```python | ||
| ForkVersion = ''.join('{:02x}'.format(x) for x in state.fork.current_version) |
There was a problem hiding this comment.
| ForkVersion = ''.join('{:02x}'.format(x) for x in state.fork.current_version) | |
| ForkVersion = ''.join('{:02x}'.format(x) for x in fork_version) |
djrtwo
left a comment
There was a problem hiding this comment.
Suggest making the topic fork version be specified wrt epoch of message. Otherwise, this looks good!
| The payload is carried in the `data` field of a gossipsub message, and varies depending on the topic: | ||
|
|
||
| | Topic | Message Type | | ||
| | Name | Message Type | |
There was a problem hiding this comment.
It seems we are still using TopicName to describe the field in the following. (Section Global topics and Attestation subnets)
|
closing in favor of #1652 |
Gossipsub peers are separate from the ETH2 RPC protocol, and thus cannot
rely on the application-level
Statusnegotiation to establish ifthey're on the same network.
Segregating gossipsub topics by fork version decouples RPC from gossip
further and allows peers to more easily listen only to the traffic of
the network they're interested in, without further negotiation.
this is a work-in-progress complement to #1614 - in particular, it's an open question which fork version should be used during upgrades - most natural seems to be to use the head fork version - or more accurately perhaps, the fork version as it would be when time has advanced to where the fork has taken effect.