Closed thedevbirb closed 8 months ago
This seems like a useful feature to have. One thing to note however is that connecting to an explicit peer cannot be guaranteed since the peer we are connecting to might not have sufficient incoming peer slots to spare.
An explicit peering is always reciprocal and established out of band, so they are exempt from this as well. If you guys agree, we can open a PR to implement this.
We have the concept of explicit peers in gossipsub already, we just haven't tied it to the CLI trusted peers.
This should be easy to add though. If you guys already have a PR, feel free to send it through, otherwise we can put one up pretty quickly.
@AgeManning opened a PR! Sorry about the first one, I accidentally set stable
as the base branch.
Implemented in #5333 and will be included in v5.1.0
.
Context
Lighthouse implements the concept of a “trusted”/”static” peer, which guarantees the ability to always remain connected to a peer ignoring defensive measures such as peer scoring, however it provides no guarantees of being part of their mesh or to send/receive full messages from them unconditionally.
Why explicit peering agreement
Gossipsub v1.1 introduces the concept of "Explicit Peering Agreement", which is an agreement that must be reached from a pair of nodes in order to “remain connected to and unconditionally forward messages to each other outside of the vagaries of the peer scoring system and other defensive measures”.
This feature if enabled in Lighthouse could allow nodes to explicitly connect to some relays networks such as Fiber or Bloxroute to boost the propagation of their blocks.
Possible implementation
In order to do that, we could simply mimic what has been done for trusted/static peers. In particular:
Lastly this list of nodes needs to be passed to the libp2p implementation.
If there is interest, we can open a PR that implements this functionality.