mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
The original CrawlIterator on the discv4 path generated FINDNODE targets
by grinding random pubkeys until their Keccak256 had a specific top-N-bit
prefix matching a per-call rotation index, then sending them. The aim was
to anchor each peer's response to a different /16 region of the global
keyspace.
Empirically (3 x 5-minute runs against mainnet bootnodes):
mode total mean ± std mainnet mean ± std
fast (grind) 5714 ± 117 549 ± 33
fast-random 5306 ± 366 521 ± 124
Means are within 1σ of each other. The grind's only measurable benefit
is reduced run-to-run variance, not higher yield. For long-running
curated crawls (the production use case for cmd/devp2p) the variance
amortises away, so the simplification is worth taking.
Replace the grind with a plain crand.Read on the v4 target, drop the
randomTargetWithPrefix helper, log2Pow2 helper, and the v4-side
prefix-bit math from withDefaults. Drange becomes a v5-only knob and
its doc is updated to say so; the power-of-two requirement is gone.
discv5 is unchanged: it uses native distance rotation, not target
hashes, and was never affected by the grind.
|
||
|---|---|---|
| .. | ||
| v4wire | ||
| v5wire | ||
| common.go | ||
| crawliter.go | ||
| crawliter_test.go | ||
| lookup.go | ||
| metrics.go | ||
| node.go | ||
| ntp.go | ||
| table.go | ||
| table_reval.go | ||
| table_reval_test.go | ||
| table_test.go | ||
| table_util_test.go | ||
| v4_lookup_test.go | ||
| v4_udp.go | ||
| v4_udp_test.go | ||
| v5_talk.go | ||
| v5_udp.go | ||
| v5_udp_test.go | ||