-
Notifications
You must be signed in to change notification settings - Fork 275
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
Gossipsub: message hash field in a message #116
Comments
On second thought, like libp2p/rust-libp2p#473, it may be better to just use a message hash, and not use a message ID, although if the latter is already implemented then it can be used in gossipsub 1.0, and the former in 2.0. Of course, it can be done independently of the protobuf file, but if this feature is included in one implementation, it should probably be included in all implementations, and thus in the protobuf file for over the wire interoperability. |
The message ID should be in the pubsub spec; if it's missing, it's a bug there. |
There are |
The message ID field already exists in the RPC envelope, this duplicates. |
It's called |
Note that the type is already bytes, so there shouldn't be a compatibility issue. |
OK I found in the spec that it says "(Notably the 'timecache' in use by the floodsub implementation uses the concatenation of the seqno and the from field.)" Still, the link between this and the message ID in the spec could be clearer. |
Yes, that might be worth improving (and explicitly saying what is the message id and how it is derived in a more prominent place). A potential caveat with using hashes instead of seqnos: the peer won't be able to send identical messages (eg keepalives) within the timecache interval, as they will get rejected as duplicates. |
However, I think a For more details, see libp2p/rust-libp2p#767. |
However, I think a For more details, see libp2p/rust-libp2p#767. |
On further analysis, it seems that a // Unlike a `MsgHash`, we can't rebuild a `GMessage` from a `MsgId`(or
// at least it isn't as easy).
// We have to fetch it from somewhere it is stored. In this context,
// this would be the `MCache`, although messages are only stored for a
// few seconds / heartbeat intervals, hence implementing `From` won't work.
// Using `TryFrom` also adds complications.
// An alternative is to reconstruct a `GMessage` from a `MsgId` by searching
// for a message that has the same seq_no and peer ID in all the state, but
// this is resource-intensive. Why do that when it seems simpler to just use
// a `MsgHash`? It is therefore recommended to do that: just use a MsgHash,
// and not use and probably remove a `MsgId` and `MsgRep`, which will also
// simplify implementation. |
This seems to be fixed with #117, thus I am closing here. Feel free to comment in case you would like to continue the discussion. |
The gossipsub spec refers to message IDs, but doesn't actually include a message ID field in the protobuf file (and neither does the pubsub spec). Having such a field would be useful for implementing a conversion (using a
From
trait with Rust) between a message ID and a message, e.g. like so:For more details see message.rs (as part of libp2p/rust-libp2p#767).
cc @vyzo, @mgoelzer, @whyrusleeping
The text was updated successfully, but these errors were encountered: