Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add message.topic to gossipsub message-id in Altair #2475

Merged
merged 4 commits into from
Jun 8, 2021
Merged
Changes from 1 commit
Commits
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
9 changes: 9 additions & 0 deletions specs/altair/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ New topics are added in Altair to support the sync committees and the beacon blo

The specification around the creation, validation, and dissemination of messages has not changed from the Phase 0 document.

The derivation of the `message-id` has changed starting with Altair to incorporate the message topic along with the message data.
ralexstokes marked this conversation as resolved.
Show resolved Hide resolved
ralexstokes marked this conversation as resolved.
Show resolved Hide resolved
The `message-id` MUST be the following 20 byte value computed from the message:
* If `message.data` has a valid snappy decompression, set `message-id` to the first 20 bytes of the `SHA256` hash of
the concatenation of `MESSAGE_DOMAIN_VALID_SNAPPY` with the snappy decompressed message data and the topic name,
i.e. `SHA256(MESSAGE_DOMAIN_VALID_SNAPPY + snappy_decompress(message.data) + message.topic)[:20]`.
ralexstokes marked this conversation as resolved.
Show resolved Hide resolved
* Otherwise, set `message-id` to the first 20 bytes of the `SHA256` hash of
the concatenation of `MESSAGE_DOMAIN_INVALID_SNAPPY` with the raw message data and the topic name,
i.e. `SHA256(MESSAGE_DOMAIN_INVALID_SNAPPY + message.data + message.topic)[:20]`.

The new topics along with the type of the `data` field of a gossipsub message are given in this table:

| Name | Message Type |
Expand Down