Incorrect split between dialed and incoming peers when running a light server #1669
Labels
theme: client-reliability
Whatever makes client unstable (leaks, others)
theme: protocol-correctness
Does the protocol adhere to the spec, and behave as it should
type:bug
Something isn't working
Expected Behavior
Connection slots for eth/istanbul peers should be divided between dialed and incoming connections according to the
DialRatio
value (which defaults to 3, meaning 1/3 of slots for dialed connections and 2/3 for incoming).The p2p server does not explicitly divide up slots between eth peers and LES clients. However, since LES servers don't dial LES clients (only the clients dial the servers), connection slots for LES clients should all be incoming. Therefore the correct logic is:
where
max_peers = max_eth_peers + max_les_clients
Current Behavior
If running an LES server, the calculation which splits up slots between dialed and incoming uses the max total number of peers (both eth/istanbul peers and LES clients) rather than the max eth peers number:
celo-blockchain/p2p/server.go
Lines 735 to 739 in f82aa14
This behavior is inherited from upstream, so this is also a bug in go-ethereum.
For example, with the values recommended in our docs (
--light.maxpeers 1000 --maxpeers 1100
), the resulting split is 366 dialed and 734 incoming. However, the eth protocol manager has a limit of 100 peers, so the correct split would be 33 dialed and 1067 incoming. The resulting behavior is the following:celo-blockchain/eth/handler.go
Lines 380 to 382 in f82aa14
This behavior is undesirable for two reasons:
Steps to Reproduce Behavior
Notes for fixing
celo-blockchain/cmd/utils/flags.go
Lines 1183 to 1209 in f82aa14
System information
The text was updated successfully, but these errors were encountered: