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

Gossip mesh includes all peers in the network #543

Closed sarvalabs-rahul closed 9 months ago

sarvalabs-rahul commented 9 months ago

Hi,

I'm utilizing a gossip-based pubsub for broadcasting blocks. We currently have a testnet consisting of 400 nodes, with each node subscribed to this specific topic. When I check the list of peers for this topic on a specific node, it returns 400 . How can I restrict the number of peers for each topic?

Here are the gossipParams: Dlo = 6 D = 8 Dhi = 16

vyzo commented 9 months ago

these are not your mesh peers, but all you peers who support the protocol.

sarvalabs-rahul commented 9 months ago

@vyzo But i could see active mesh connections among all the peers, I have used host.Network().Conns() to retrieve the active connections.

Total no.of mesh connections for a peer is very close to the no.of peers in the entire network.

vyzo commented 9 months ago

This are not mesh connections.

vyzo commented 9 months ago

that's an issue of your peer discovery and bootstrap mechanism; nothing to do with gossipsub.

sarvalabs-rahul commented 9 months ago

@vyzo, I could see that each peer has at least one active stream with "/meshsub/1.1.0" protocol.ID with all other peers.

Am i missing anything ?

vyzo commented 9 months ago

the protocol automatically hanshakes; it doesn't mean they are in the mesh.

In short, this is neither a bug not a problem at all.

sarvalabs-rahul commented 9 months ago

@vyzo Here are my last set of questions:

Context: I am currently developing a context-aware blockchain protocol. In this protocol, we create temporary dynamic clusters in runtime to handle transactions based on the contextual information of participants and their interactions.

Within our protocol, each node can participate in multiple clusters concurrently and process transactions in parallel. This places significant strain on the network, prompting us to explore optimisation possibilities.

Thank you for taking the time to address my questions.

vyzo commented 9 months ago

no, there is one inbound and one outbound stream total.