go-ethereum/cmd
Felix Lange 1351a54287
p2p/discover: improved node revalidation (#29572)
Node discovery periodically revalidates the nodes in its table by sending PING, checking
if they are still alive. I recently noticed some issues with the implementation of this
process, which can cause strange results such as nodes dropping unexpectedly, certain
nodes not getting revalidated often enough, and bad results being returned to incoming
FINDNODE queries.

In this change, the revalidation process is improved with the following logic:

- We maintain two 'revalidation lists' containing the table nodes, named 'fast' and 'slow'.
- The process chooses random nodes from each list on a randomized interval, the interval being
  faster for the 'fast' list, and performs revalidation for the chosen node.
- Whenever a node is newly inserted into the table, it goes into the 'fast' list.
  Once validation passes, it transfers to the 'slow' list. If a request fails, or the
  node changes endpoint, it transfers back into 'fast'.
- livenessChecks is incremented by one for successful checks. Unlike the old implementation,
  we will not drop the node on the first failing check. We instead quickly decay the
  livenessChecks give it another chance.
- Order of nodes in bucket doesn't matter anymore.

I am also adding a debug API endpoint to dump the node table content.

Co-authored-by: Martin HS <martin@swende.se>
2024-06-11 13:53:35 +05:30
..
abidump dev: fix: most of wsl lint issues 2023-06-15 15:48:26 +02:00
abigen Revert "Merge upstream_merge branch to develop (#1229)" 2024-05-28 14:10:49 +05:30
bootnode Revert "Merge upstream_merge branch to develop (#1229)" 2024-05-28 14:10:49 +05:30
clef Revert "Merge upstream_merge branch to develop (#1229)" 2024-05-28 14:10:49 +05:30
cli migrate cli to internal package (#301) 2022-01-19 12:10:20 +01:00
clidoc Prepare Bor package for testing (#416) 2022-06-08 16:39:30 +03:00
devp2p p2p/discover: improved node revalidation (#29572) 2024-06-11 13:53:35 +05:30
ethkey Revert "Merge upstream_merge branch to develop (#1229)" 2024-05-28 14:10:49 +05:30
evm Revert "Merge upstream_merge branch to develop (#1229)" 2024-05-28 14:10:49 +05:30
geth Merge branch 'develop' of https://github.com/maticnetwork/bor into upstream_merge 2024-05-28 17:20:23 +05:30
p2psim Revert "Merge upstream_merge branch to develop (#1229)" 2024-05-28 14:10:49 +05:30
rlpdump Revert "Merge upstream_merge branch to develop (#1229)" 2024-05-28 14:10:49 +05:30
utils Merge branch 'develop' of https://github.com/maticnetwork/bor into upstream_merge 2024-05-28 17:20:23 +05:30