sigp / lighthouse

Ethereum consensus client in Rust
https://lighthouse.sigmaprime.io/
Apache License 2.0
2.92k stars 742 forks source link

Explicit Peering Agreement implementation #5268

Closed thedevbirb closed 8 months ago

thedevbirb commented 8 months ago

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.

pawanjay176 commented 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.

mempirate commented 8 months ago

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.

AgeManning commented 8 months ago

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.

mempirate commented 8 months ago

@AgeManning opened a PR! Sorry about the first one, I accidentally set stable as the base branch.

jimmygchen commented 8 months ago

Implemented in #5333 and will be included in v5.1.0.