Skip to content

[backport] feat(bootnode): Active Bootnode Scanning#2377

Open
refcell wants to merge 3 commits intoreleases/v0.8.0from
rf/backport/bootnode-updates-to-releases-v0.8.0
Open

[backport] feat(bootnode): Active Bootnode Scanning#2377
refcell wants to merge 3 commits intoreleases/v0.8.0from
rf/backport/bootnode-updates-to-releases-v0.8.0

Conversation

@refcell
Copy link
Copy Markdown
Contributor

@refcell refcell commented Apr 24, 2026

Note

This is a backport of #2376 into releases/v0.8.0.

Updates the base-reth-node p2p bootnode --v5 command to actively crawl the discv5 universe and build its routing table. Previously the bootnode was purely reactive, only logging incoming SessionEstablished events and never issuing outbound discovery queries, leaving its routing table nearly empty. Now reth_discv5::Discv5::start calls spawn_populate_kbuckets_bg internally, 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-interval CLI arg (default: 20s) tunes the steady-state lookup rate.

@refcell refcell self-assigned this Apr 24, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
base Ignored Ignored Preview Apr 24, 2026 7:20pm

Request Review


/// Interval in seconds between discv5 FINDNODE crawl queries. Only active with --v5.
#[arg(long, default_value = "5")]
pub find_node_interval: u64,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Validating at parse time with a value_parser that rejects 0, or
  2. Clamping to a minimum (e.g. 1 second) at the usage site.
Suggested change
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>
@github-actions
Copy link
Copy Markdown
Contributor

Review Summary

PR: [backport] feat(bootnode): Active Bootnode Scanning

Small, focused change (8 additions, 1 deletion in a single file). Adds a --find-node-interval CLI arg and passes it to Config::builder.lookup_interval() so the discv5 bootnode actively crawls rather than passively waiting.

Findings

1 issue (previously raised): The find_node_interval field accepts 0, which would create a Duration::ZERO interval and cause a tight-loop self-DoS. This was flagged in a prior inline comment — a value_parser range constraint or a minimum clamp should be added before merging.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant