celestiaorg / celestia-core

A fork of CometBFT
Apache License 2.0
489 stars 267 forks source link

Ask peers for receive rate #1523

Open evan-forbes opened 1 week ago

evan-forbes commented 1 week ago

Currently, peers use configured send and receive rates. If the send rate of either peer is higher than the receive rate of the other, and this much bandwidth gets hit, it will disconnect from that peer.

This is problematic because we can't actively change this value safely without every node in the network changing at the same time.

Instead of coordinating around new values, peers should simply ask the peers what their receive rates are and adjust accordingly. If the peer doesn't respond, then they can be presumed to using the default of roughly 5MiB/s.

To close this issue, we need to create a backwards compatible mechanism for asking for the peer's receive limit during the handshake, then potentially adjusting the send rate.

evan-forbes commented 1 week ago

actually, upon further review with @rach-id, it doesn't look like we're disconnecting from peers that exceed the receive rate

If so this isn't needed!