Mesh, fanout, and peers.gossipsub clarification

  1. Is mesh a map from (topic --> at most D peers, all of whom are subscribed to topic)?

  2. Is fanout a map from (topic --> at most D peers, all of whom are not subscribed to topic)?

  3. Is peers.gossipsub a map from (topic --> all peers in mesh[topic] union all peers in fanout[topic])? Furthermore, if my interpretation is correct, then according to the spec, in the fanout heartbeat, we select D - |fanout[topic]| peers from peers.gossipsub[topic] - fanout[topic] but would this imply we are including mesh[topic] peers (that are included in peers.gossipsub[topic]) in fanout?

Hey Aspyn!

Tentative answers (wait for @vyzo to confirm):

  1. mesh contains at most D peers (per topic) that are subscribed to topics we are subscribed to as well.
  2. fanout contains at most D peers (per topic) that are subscribed to topics we are not subscribed to.
  3. the underlying pubsub system maintains a view of the topics each connected peer is subscribed to. For each topic we’re not subscribed to that has seen recent traffic, fanout contains a subset of peers that ARE subscribed to that topic. In the heartbeat logic you quote, if our fanout set for a topic is below D, we try to source members from the underlying pubsub state, selecting only peers that support gossipsub (peers.gossipsub[topic]).

Apologies for the lack of formatting: I’m on mobile.

1 Like
  • mesh is our current mesh peers; they are in the same topic as us and we are actively forwarding messages to them.

  • fanout are topic peers for topics we don’t currently subscribe but we have published messages to.

1 Like

Thanks that helps clarify things. I am still a bit confused on what peers.gossipsub[topic] contains. Are you saying that peers.gossipsub maps (topic --> list of all pubsub peers we have on the gossipsub protocol)?

yes, these are all gossipsub peers connected to you.

1 Like