libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
309 stars 178 forks source link

Default validator support #525

Closed vyzo closed 1 year ago

vyzo commented 1 year ago

Adds support for default validators and provides an implementation that validates the message seqno as a per peer nocne to prevent infinite propagation when the network diameter exceeds the seen cache span. See #524 Implements the logic described in https://github.com/ipfs/kubo/issues/9665

TBD:

stbrody commented 1 year ago

Is there a risk here if messages are delivered out of order? Like if a node receives message 5 before message 4 from the same peer, will that node then never forward message 4 on to its other peers? Does that risk some messages not being well propagated to the whole network?

vyzo commented 1 year ago

This can only happen if one message from the peer is dropped (because of a full queue) and the next message propagates before the dropped message arrives from other paths.

So in theory there is some risk, but this would be quite difficult to trigger. Maybe with an extremely high sending rate from some peer.

Worth noting, but i am not convinced it is a problem.

vyzo commented 1 year ago

There is a simple way to alleviate concerns here: keep a bitvector (say 32 or 64 bits, as an integer) that encodes whether the last few messages have been delivered.

How does that sound?

stbrody commented 1 year ago

@vyzo I don't think I fully understand how the bitvector would work, but I think keeping a small cache of the last few seqnos and whether they've been delivered once before does make sense and would address the issue I brought up!

vyzo commented 1 year ago

Ok, i will implement something along these lines.