Is mesh a map from (topic --> at most D peers, all of whom are subscribed to topic)?
Is fanout a map from (topic --> at most D peers, all of whom are not subscribed to topic)?
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?
Tentative answers (wait for @vyzo to confirm):
- mesh contains at most D peers (per topic) that are subscribed to topics we are subscribed to as well.
- fanout contains at most D peers (per topic) that are subscribed to topics we are not subscribed to.
- 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.
meshis our current mesh peers; they are in the same topic as us and we are actively forwarding messages to them.
fanoutare topic peers for topics we don’t currently subscribe but we have published messages to.
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.