Skip to content

chore(p2p): Refactor & Test Bootnode Discovery Configs#2472

Merged
refcell merged 7 commits intomainfrom
rf/fix/bootnode-discv5-port-binding
May 1, 2026
Merged

chore(p2p): Refactor & Test Bootnode Discovery Configs#2472
refcell merged 7 commits intomainfrom
rf/fix/bootnode-discv5-port-binding

Conversation

@refcell
Copy link
Copy Markdown
Contributor

@refcell refcell commented Apr 30, 2026

Summary

The config-building logic is extracted into dedicated discv4_config() and discv5_config() methods on Command to make each concern testable in isolation. Unit tests using rstest are added to assert the discv5 discovery socket port matches --v5-addr and differs from --v4-addr.

@refcell refcell added bug Flag: Something isn't working execution Area: execution labels Apr 30, 2026
@refcell refcell self-assigned this Apr 30, 2026
@cb-heimdall
Copy link
Copy Markdown
Collaborator

cb-heimdall commented Apr 30, 2026

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 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 May 1, 2026 7:10pm

Request Review

Comment thread crates/execution/cli/src/commands/p2p/bootnode.rs Outdated
Comment thread crates/execution/cli/src/commands/p2p/bootnode.rs Outdated
refcell and others added 2 commits April 30, 2026 15:43
Keep the bootnode runtime flow close to the existing implementation while retaining the extracted config builders and tests for discv5 port binding.

Co-authored-by: Codex <noreply@openai.com>
Keep the bootnode refactor and smoke tests without changing the existing discv5 listen config behavior.

Co-authored-by: Codex <noreply@openai.com>
Comment thread crates/execution/cli/src/commands/p2p/bootnode.rs
refcell and others added 2 commits April 30, 2026 15:49
Replace bootnode config smoke tests with assertions that the extracted config helpers preserve NAT and discovery socket behavior.

Co-authored-by: Codex <noreply@openai.com>
Make the bootnode discv4 helper test compare the extracted config against the builder expression it replaced across NAT variants.

Co-authored-by: Codex <noreply@openai.com>
Comment thread crates/execution/cli/src/commands/p2p/bootnode.rs
Comment thread crates/execution/cli/src/commands/p2p/bootnode.rs
@refcell refcell changed the title fix(p2p): Fix Bootnode Discv5 Port Binding chore(p2p): Refactor & Test Bootnode Discovery Configs Apr 30, 2026
@refcell refcell requested review from danyalprout and meyer9 April 30, 2026 20:11
Move DEFAULT_DISCOVERY_V5_PORT into the test module so non-test base-execution-cli builds do not fail unused-imports.

Co-authored-by: Codex <noreply@openai.com>
@refcell refcell marked this pull request as ready for review April 30, 2026 20:18
@refcell refcell enabled auto-merge April 30, 2026 20:18
Comment thread crates/execution/cli/src/commands/p2p/bootnode.rs
@refcell refcell requested a review from 0x00101010 May 1, 2026 00:34
@refcell refcell added this pull request to the merge queue May 1, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 1, 2026
@refcell refcell added this pull request to the merge queue May 1, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Review Summary

Critical: Discovery port binding is not actually fixed

The PR title mentions a "discv5 NAT fix" and the refactoring extracts config-building into methods, but discv5_config() still passes DEFAULT_DISCOVERY_V5_LISTEN_CONFIG to Discv5ConfigBuilder::new() (line 145). This means the inner discv5 library binds its UDP socket to the default listen config, not to the address from --v5-addr. The full node in node.rs correctly uses ListenConfig::from_two_sockets() / ListenConfig::from_ip() to bind to the configured address. The bootnode should do the same — e.g.:

let listen = ListenConfig::from_ip(self.v5_addr.ip(), self.v5_addr.port());
let mut inner_builder = Discv5ConfigBuilder::new(listen);

Test issues

  1. discv5_config_preserves_default_discovery_socket_and_sets_rlpx_socket (line 229): Asserts discovery_socket().port() == DEFAULT_DISCOVERY_V5_PORT, which codifies the current (broken) behavior. Once the fix above is applied, this test would break — making it a regression trap rather than a regression guard. The assertion should be assert_eq!(config.discovery_socket().port(), command.v5_addr.port()).

  2. discv4_config_matches_refactored_builder (lines 190-213): Tautological — expected is built with the exact same expression as the method under test. The 16-field comparison adds maintenance cost without meaningful signal. A focused assertion on the external_ip_resolver field (line 213) is sufficient and already present.

Minor

  • No runtime validation that v4_addr != v5_addr when --v5 is enabled. Users will get an opaque OS socket-binding error instead of a clear message.

All specific findings are posted as inline comments.

@refcell refcell added this pull request to the merge queue May 1, 2026
Merged via the queue into main with commit 6782e76 May 1, 2026
24 checks passed
@refcell refcell deleted the rf/fix/bootnode-discv5-port-binding branch May 1, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Flag: Something isn't working execution Area: execution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants