lighthouse/beacon_node/eth2_libp2p/src
divma 4d77784bb8 Rate limit RPC requests (#1402)
## Issue Addressed
#1056 

## Proposed Changes
- Add a rate limiter to the RPC behaviour. This also means the rate limiting occurs just before the door to the application level, so the number of connections a peer opens does not affect this (this would happen in the future if put on the handler)
- The algorithm used is the leaky bucket as a meter / token bucket implemented the GCRA way
- Each protocol has its own limit. Due to the way the algorithm works, the "small" protocols have a hard limit, while bbrange and bbroot allow [burstiness](https://www.wikiwand.com/en/Burstiness). This is so that a peer can't request hundreds of individual requests expecting only one block in a short period of time, it also allows a peer to send two half size requests instead of one with max if they want to without getting limited, and.. it also allows a peer to request a batch of the maximum size and then send _appropriately spaced_ requests of really small sizes. From what I've seen in sync this is plausible when reaching the target slot.

## Additional Info
Needs to be heavily tested
2020-07-31 05:47:09 +00:00
..
behaviour Gossipsub update (#1400) 2020-07-29 03:40:22 +00:00
discovery Discover query grouping (#1364) 2020-07-29 02:43:50 +00:00
peer_manager Rate limit RPC requests (#1402) 2020-07-31 05:47:09 +00:00
rpc Rate limit RPC requests (#1402) 2020-07-31 05:47:09 +00:00
types Activate peer scoring (#1284) 2020-07-07 10:13:16 +10:00
config.rs Gossipsub update (#1400) 2020-07-29 03:40:22 +00:00
lib.rs Activate peer scoring (#1284) 2020-07-07 10:13:16 +10:00
metrics.rs Discovery metrics (#1276) 2020-06-19 15:36:03 +10:00
service.rs Limit incoming connection requests (#1413) 2020-07-29 06:39:30 +00:00