Skip to content

Add fork version to topic#1624

Closed
arnetheduck wants to merge 3 commits into
ethereum:devfrom
status-im:gossip-topic
Closed

Add fork version to topic#1624
arnetheduck wants to merge 3 commits into
ethereum:devfrom
status-im:gossip-topic

Conversation

@arnetheduck

Copy link
Copy Markdown
Contributor

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.

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.

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.

@djrtwo djrtwo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Minor suggestion and a request for a FAQ.

I'll dig back into #1614

Comment thread specs/phase0/p2p-interface.md Outdated
Comment thread specs/phase0/p2p-interface.md
arnetheduck and others added 2 commits February 20, 2020 08:23
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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like:

Suggested change
- `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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ForkVersion = ''.join('{:02x}'.format(x) for x in state.fork.current_version)
ForkVersion = ''.join('{:02x}'.format(x) for x in fork_version)

@djrtwo djrtwo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we are still using TopicName to describe the field in the following. (Section Global topics and Attestation subnets)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated this in #1652

@djrtwo

djrtwo commented Mar 10, 2020

Copy link
Copy Markdown
Contributor

closing in favor of #1652

@djrtwo djrtwo closed this Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants