Skip to content

Commit 4b750f2

Browse files
authored
fix: set gossip validation mode to StrictNoSign (Anonymous) (leanEthereum#72)
* fix: set gossip validation mode to StrictNoSign (Anonymous) * fix: make linter happy
1 parent f869a79 commit 4b750f2

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

docs/client/networking.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ data being sent on the topic and how the data field of the message is encoded.
9999
bytes that will be transmitted over the wire. See the [Encodings](#Encodings)
100100
section for further details.
101101

102-
The optional `from` (1), `seqno` (3), `signature` (5) and `key` (6) protobuf
102+
The `from` (1), `seqno` (3), `signature` (5) and `key` (6) protobuf
103103
fields are omitted from the message, since messages are identified by content,
104-
anonymous, and signed where necessary in the application layer.
104+
anonymous, and signed where necessary in the application layer. Clients MUST
105+
enforce this by applying the `StrictNoSign` signature policy (aka `Anonymous`
106+
in some implementations).
105107

106108
The `message-id` MUST be the following 20 byte value computed from the message:
107109

src/lean_spec/subspecs/networking/gossipsub.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ class GossipsubParameters(StrictBaseModel):
6363
This is calculated as SECONDS_PER_SLOT * JUSTIFICATION_LOOKBACK_SLOTS * 2.
6464
"""
6565

66+
validation_mode: str = "strict_no_sign"
67+
"""The message validation mode. `strict_no_sign` requires the author,
68+
sequence number and signature fields of a message to be empty. Any message
69+
that contains these fields is considered invalid. In some libp2p
70+
implementations, this mode is also known as Anonymous mode.
71+
"""
72+
6673

6774
MessageId = Annotated[bytes, Field(min_length=20, max_length=20)]
6875
"""A 20-byte ID for gossipsub messages."""

0 commit comments

Comments
 (0)