[backport] feat(bootnode): Active Bootnode Scanning#2377
[backport] feat(bootnode): Active Bootnode Scanning#2377refcell wants to merge 3 commits intoreleases/v0.8.0from
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
|
||
| /// Interval in seconds between discv5 FINDNODE crawl queries. Only active with --v5. | ||
| #[arg(long, default_value = "5")] | ||
| pub find_node_interval: u64, |
There was a problem hiding this comment.
A --find-node-interval 0 will create a tokio::time::interval(Duration::ZERO), which ticks as fast as the runtime can poll it. Combined with the tokio::spawn below that fires on every tick, this becomes an unbounded tight loop spawning tasks continuously—effectively a self-DoS.
Consider either:
- Validating at parse time with a
value_parserthat rejects 0, or - Clamping to a minimum (e.g. 1 second) at the usage site.
| pub find_node_interval: u64, | |
| #[arg(long, default_value = "5", value_parser = clap::value_parser!(u64).range(1..))] | |
| pub find_node_interval: u64, |
… crawling Replace manual random find_node interval with reth's built-in spawn_populate_kbuckets_bg, called automatically by Discv5::start. This walks buckets 255→0 systematically rather than randomly, ensuring even coverage across all Kademlia buckets. Wire --find-node-interval into Config::builder lookup_interval so the steady-state lookup cadence is tunable. Bootstrap phase (200 lookups at 5s intervals) uses reth defaults automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Review SummaryPR: [backport] feat(bootnode): Active Bootnode Scanning Small, focused change (8 additions, 1 deletion in a single file). Adds a Findings1 issue (previously raised): The No additional issues found. The change is straightforward, the new arg has a sensible default, and it doesn't introduce any concurrency, safety, or API design concerns. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Note
This is a backport of #2376 into
releases/v0.8.0.Updates the
base-reth-node p2p bootnode --v5command to actively crawl the discv5 universe and build its routing table. Previously the bootnode was purely reactive, only logging incomingSessionEstablishedevents and never issuing outbound discovery queries, leaving its routing table nearly empty. Nowreth_discv5::Discv5::startcallsspawn_populate_kbuckets_bginternally, which fires 200 rapid FINDNODE lookups at 5-second intervals on startup to seed the table, then walks Kademlia buckets 255 → 0 in steady state to ensure full keyspace coverage. A new--find-node-intervalCLI arg (default: 20s) tunes the steady-state lookup rate.