vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
242 stars 52 forks source link

GossipSub messages relayed back to source on 3 node network #1081

Open cskiraly opened 2 months ago

cskiraly commented 2 months ago

Setting up a 3 node network (nodes A,B,C) and a single GS topic. When A is sending a message to B and C, these are then relayed between them, finally sent back to A. That last step is not supposed to happen, since on that link the same message already travelled and was received.

Message sequence A->B , A->C B->C, C->B C->A, B->A

cskiraly commented 2 months ago

was identified by @ufarooqstatus as potentially caused by https://github.com/vacp2p/nim-libp2p/blob/unstable/libp2p/protocols/pubsub/gossipsub.nim#L327

diegomrsantos commented 2 months ago

Could you please point out what part of the spec does it violate?

cskiraly commented 2 months ago

Ok, so the correct permanent link to the offending line is https://github.com/vacp2p/nim-libp2p/blob/467b5b4f0cbfca31ececce9dfd1e649df87067e8/libp2p/protocols/pubsub/gossipsub.nim#L327

Regarding what it violates:

diegomrsantos commented 2 months ago

Thank you for the clarification. I believe the seen cache is checked here https://github.com/vacp2p/nim-libp2p/blob/unstable/libp2p/protocols/pubsub/gossipsub.nim#L517.

diegomrsantos commented 2 months ago

It'd be great if you could reproduce it with a failing test similar to the ones in tests/pubsub folder.