From a343680fd41f74556e5381aca63412d7eaa0dad9 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 8 Jun 2021 14:29:08 -0500 Subject: [PATCH] Add implementation note on message id fn --- specs/altair/p2p-interface.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/specs/altair/p2p-interface.md b/specs/altair/p2p-interface.md index ccc31a280..8de85188d 100644 --- a/specs/altair/p2p-interface.md +++ b/specs/altair/p2p-interface.md @@ -85,6 +85,12 @@ The `message-id` MUST be the following 20 byte value computed from the message: the topic byte string, and the raw message data: i.e. `SHA256(MESSAGE_DOMAIN_INVALID_SNAPPY + uint_to_bytes(uint64(len(message.topic))) + message.topic + message.data)[:20]`. +Implementations may need to carefully handle the function that computes the `message-id`. In particular, messages on topics with the Phase 0 +fork digest should use the `message-id` procedure specified in the Phase 0 document. +Messages on topics with the Altair fork digest should use the `message-id` procedure defined here. +If an implementation only supports a single `message-id` function, it can define a switch inline; +for example, `if topic in phase0_topics: return phase0_msg_id_fn(message) else return altair_msg_id_fn(message)`. + The new topics along with the type of the `data` field of a gossipsub message are given in this table: | Name | Message Type |