lighthouse/beacon_node
Age Manning 8dd9249177 Enforce a timeout on peer disconnect (#3757)
On heavily crowded networks, we are seeing many attempted connections to our node every second. 

Often these connections come from peers that have just been disconnected. This can be for a number of reasons including: 
- We have deemed them to be not as useful as other peers
- They have performed poorly
- They have dropped the connection with us
- The connection was spontaneously lost
- They were randomly removed because we have too many peers

In all of these cases, if we have reached or exceeded our target peer limit, there is no desire to accept new connections immediately after the disconnect from these peers. In fact, it often costs us resources to handle the established connections and defeats some of the logic of dropping them in the first place. 

This PR adds a timeout, that prevents recently disconnected peers from reconnecting to us.

Technically we implement a ban at the swarm layer to prevent immediate re connections for at least 10 minutes. I decided to keep this light, and use a time-based LRUCache which only gets updated during the peer manager heartbeat to prevent added stress of polling a delay map for what could be a large number of peers.

This cache is bounded in time. An extra space bound could be added should people consider this a risk.

Co-authored-by: Diva M <divma@protonmail.com>
2023-02-14 03:25:42 +00:00
..
beacon_chain Fix regression in DB write atomicity (#3931) 2023-02-13 03:32:01 +00:00
builder_client Verify execution block hashes during finalized sync (#3794) 2023-01-09 03:11:59 +00:00
client Improve validator monitor experience for high validator counts (#3728) 2023-01-09 08:18:55 +00:00
eth1 Clippy lints for rust 1.66 (#3810) 2022-12-16 04:04:00 +00:00
execution_layer Reduce some EE and builder related ERRO logs to WARN (#3966) 2023-02-12 23:14:08 +00:00
genesis Super small improvement: Remove unnecessary mut (#3736) 2022-11-21 03:15:54 +00:00
http_api Reduce some EE and builder related ERRO logs to WARN (#3966) 2023-02-12 23:14:08 +00:00
http_metrics Support IPv6 in BN and VC HTTP APIs (#3104) 2022-03-24 00:04:49 +00:00
lighthouse_network Enforce a timeout on peer disconnect (#3757) 2023-02-14 03:25:42 +00:00
network Reduce some EE and builder related ERRO logs to WARN (#3966) 2023-02-12 23:14:08 +00:00
operation_pool Implement block_rewards API (per-validator reward) (#3907) 2023-02-07 08:33:23 +00:00
src Self rate limiting dev flag (#3928) 2023-02-08 02:18:53 +00:00
store Fix regression in DB write atomicity (#3931) 2023-02-13 03:32:01 +00:00
tests Altair consensus changes and refactors (#2279) 2021-07-09 06:15:32 +00:00
timer Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
Cargo.toml Release v3.4.0 (#3862) 2023-01-11 03:27:08 +00:00