js-libp2p-gossipsub icon indicating copy to clipboard operation
js-libp2p-gossipsub copied to clipboard

Gossipsub sends duplicate messages to lodestar

Open twoeths opened this issue 1 month ago • 0 comments

As debugged in lodestar https://github.com/ChainSafe/lodestar/issues/8629, lodestar has to uncompress ~180 DataColumnSidecars per slot while there should only be 128

this is because the validateReceivedMessage() function being async https://github.com/ChainSafe/js-libp2p-gossipsub/blob/afc85eeaaa401fe74de694b43ef79ac96936e672/src/index.ts#L1295 and gossipsub sends some duplicate messages to lodestar in race condition

for lodestar, it could/should be synced function because:

  • signature policy is StrictNoSign
  • msgIdFn is synced https://github.com/ChainSafe/lodestar/blob/2d3601648b05c2365bbed3427434118d7e688e2b/packages/beacon-node/src/network/gossip/encoding.ts#L42
  • there is no topicValidator

if we can do that, then we can detect duplicate messages more efficiently in order to send exactly 128 messages per slot and lodestar doesn't have to uncompress unnecessary messages

twoeths avatar Nov 27 '25 13:11 twoeths