You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pubsub/gossipsub/partial-messages.md
+23-48Lines changed: 23 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,52 +80,28 @@ then partial messages would be the same as smaller messages.
80
80
81
81
The following section specifies the semantics of each new protocol message.
82
82
83
-
### PartialIWANT
83
+
### partialMessage
84
84
85
-
A `PartialIWANT` signal to a receiver that the sending peer only wants a part of
86
-
some message.
85
+
The `partialMessage` field encodes one or more parts of the full message. The
86
+
encoding is application defined.
87
87
88
-
The message to which the peer is requesting a part of is identified by the
89
-
`groupID` identifier. This is similar to a complete message's `MessageID`, but,
90
-
in contrast to a content-based message id, does not require the full message to
91
-
compute. For example, in the Ethereum use case, this could simply be the hash of
92
-
the signed block header.
88
+
### partsMetadata
93
89
94
-
The `topicID` references the Gossipsub topic a message, and thus its parts,
95
-
belong to.
90
+
The `partsMetadata` field encodes the parts a peer has and wants. The encoding
91
+
is application defined. An unset value carries no information besides that the
92
+
peer did not send a value.
96
93
97
-
The `metadata` field is opaque application defined metadata associated with this
98
-
request. This can be a bitmap, a list of ranges, or a bloom filter. The
99
-
application generates this and consumes this.
94
+
Upon receiving a `partsMetadata` a node SHOULD respond with only parts the peer
95
+
wants.
100
96
101
-
A later `PartialIWANT` serve to refine the request of prior a prior `PartialIWANT`.
97
+
A later `partsMetadata` replaces a prior one.
102
98
103
-
Nodes SHOULD assume a `PartialIWANT` implies a `IDONTWANT` for the full message.
104
-
105
-
### PartialIHAVE
106
-
107
-
A `PartialIHAVE` allows nodes to signal HAVE information before receiving all
108
-
segments, unlocking the use of `PartialIWANT` in more contexts.
109
-
110
-
In the context of partial messages, it is more useful than IHAVE as it includes
111
-
the group ID. In contrast, an IHAVE does not. A receiving peer has no way to
112
-
link an IHAVE's message ID with a group ID, without having the full message.
113
-
114
-
A `PartialIHAVE` message can be used both in the context of lazy push, notifying
115
-
peers about available parts, and in the context of heartbeats as a replacement
116
-
to IHAVEs.
117
-
118
-
The structure of `PartialIHAVE` is analogous to that of `PartialIWANT`.
119
-
120
-
The metadata, as in a `PartialIWANT`, is application defined. It is some encoding
121
-
that represents the parts the sender has.
99
+
`partsMetadata` can be used during heartbeat gossip to inform non-mesh topic
100
+
peers about parts this node has.
122
101
123
102
Implementations are free to select when to send an update to their peers based
124
103
on signaling bandwidth tradeoff considerations.
125
104
126
-
Receivers MUST treat a `PartialIHAVE` as a signal that the peer does not want
127
-
the indicated part.
128
-
129
105
### Changes to `SubOpts` and interaction with the existing Gossipsub mesh.
130
106
131
107
Partial Messages uses the same mesh as normal Gossipsub messages. It is a
@@ -144,25 +120,24 @@ The partial field value MUST be ignored when a peer sends an unsubscribe message
144
120
145
121
## Application Interface
146
122
147
-
Message contents are application defined. Thus splitting a message must be
123
+
This specific interface is not intended to be normative to implementations, it
124
+
is only an example of one possible API.
125
+
126
+
Message contents are application defined, thus splitting a message must be
148
127
application defined. Applications should provide a Partial Message type that
149
128
supports the following operations:
150
129
151
130
1.`.GroupID() -> GroupID: bytes`
152
-
2.`.PartialMessageBytesFromMetadata(metadata: bytes) -> Result<(EncodedPartialMessage: bytes, metadata: bytes), Error>` (When responding to a `PartialIWANT` or eagerly pushing a partial message)
153
-
a. The returned metadata represents the still missing parts. For example, if a
154
-
peer is only able to fulfill a part of the the request, the returned
155
-
metadata represents the parts it couldn't fulfill.
156
-
3.`.ExtendFromEncodedPartialMessage(data: bytes) -> Result<(), Error>` (When receiving a `PartialMessage`)
0 commit comments