Skip to content

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

Open
refcell wants to merge 6 commits intomainfrom
rf/fix/bootnode-discv5-port-binding
Open

chore(p2p): Refactor & Test Bootnode Discovery Configs#2472
refcell wants to merge 6 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 🟡 0/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 Apr 30, 2026 8:17pm

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
@github-actions
Copy link
Copy Markdown
Contributor

Review Summary

This PR extracts inline discv4/discv5 config-building logic into dedicated methods on Command and adds unit tests. The refactoring itself is clean, but there are correctness issues that should be addressed before merging.

Critical

  • discv5 still uses DEFAULT_DISCOVERY_V5_LISTEN_CONFIG — The PR description mentions fixing discv5 port binding, but discv5_config() still passes the hardcoded default listen config to Discv5ConfigBuilder::new() instead of constructing a ListenConfig from self.v5_addr. The actual UDP socket binding is controlled by this inner config, not by the outer Config::builder(self.v5_addr) call. Compare with the full node in node.rs which uses ListenConfig::from_two_sockets(...).

  • Test codifies the bugassert_eq!(config.discovery_socket().port(), DEFAULT_DISCOVERY_V5_PORT) asserts the current broken behavior. Once the listen config is properly wired, this assertion will fail. It should assert command.v5_addr.port() instead.

Minor

  • discv4 test is tautological — It constructs the expected value using the same code path as the method under test, then compares 16 individual fields. This can never fail for a logic reason and will break if upstream adds fields. A focused assertion on external_ip_resolver would provide the same signal with less maintenance cost.

@refcell refcell requested a review from 0x00101010 May 1, 2026 00:34
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.

2 participants