go-ethereum/internal
Felix Lange 6a9158bb1b
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-05-23 14:26:09 +02:00
..
blocktest internal/blocktest: add package for shared test code (#27270) 2023-07-11 14:57:02 +02:00
build internal, signer/core: replace path.Join with filepath.Join (#29489) 2024-04-09 08:22:53 +02:00
cmdtest all: make vendored copy of reexec (#28382) 2023-10-28 00:14:43 +02:00
debug log: default JSON log handler should log all verbosity levels (#29471) 2024-04-06 12:17:41 +02:00
era all: refactor so NewBlock, WithBody take types.Body (#29482) 2024-04-30 14:55:08 +02:00
ethapi internal/ethapi: fix typos (#29784) 2024-05-23 10:41:51 +02:00
flags cmd, core, metrics: always report expensive metrics (#29191) 2024-03-11 10:06:57 +02:00
guide rpc, internal/guide: speed up tests a bit (#26193) 2022-11-17 15:30:53 +01:00
jsre eth: Add eth_blobBaseFee RPC and blob fields to eth_feeHistory (#29140) 2024-04-22 12:17:06 +02:00
reexec all: make vendored copy of reexec (#28382) 2023-10-28 00:14:43 +02:00
shutdowncheck eth, les: update unclean shutdown markers regularly (#24077) 2021-12-17 15:18:51 +01:00
syncx core: improve shutdown synchronization in BlockChain (#22853) 2021-10-07 15:47:50 +02:00
testlog p2p/discover: improved node revalidation (#29572) 2024-05-23 14:26:09 +02:00
testrand triedb/pathdb: improve tests (#29278) 2024-03-19 10:50:08 +08:00
utesting cmd/devp2p/internal/ethtest: skip large tx test on github build (#28794) 2024-01-12 15:14:03 +01:00
version all: fix mismatched names in comments (#29348) 2024-03-26 21:01:28 +01:00
web3ext miner: refactor the miner, make the pending block on demand (#28623) 2024-03-06 14:45:03 +02:00