Skip to content

Fix ipv6 discovery#10516

Open
gfukushima wants to merge 5 commits intoConsensys:masterfrom
gfukushima:ipv6-autodiscover
Open

Fix ipv6 discovery#10516
gfukushima wants to merge 5 commits intoConsensys:masterfrom
gfukushima:ipv6-autodiscover

Conversation

@gfukushima
Copy link
Copy Markdown
Contributor

@gfukushima gfukushima commented Mar 20, 2026

PR Description

Populate the initial ENR with the resolved listen addresses, auto-discovery can still override them later. requires Consensys/discovery#202

Fixed Issue(s)

Fixes #10305

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

Note

Medium Risk
Changes peer discovery ENR address initialization and IPv6 local-address selection, which can affect node reachability and dual-stack behavior. Scope is limited to networking config/discovery but impacts connectivity if incorrect addresses are chosen.

Overview
Fixes IPv6 discovery by broadening automatic IPv6 local-address selection to prefer any non-loopback, non-link-local address (including global unicast), and removing the previous unique-local-only heuristic.

Updates discv5 startup to always seed the initial ENR with the resolved advertised IP(s) (single- or dual-stack), instead of only doing so when the user explicitly configured advertised IPs; changelog entry added for the IPv6 detection fix.

Written by Cursor Bugbot for commit a44451f. This will update automatically on new commits. Configure here.

…uto-discovery can still override them later.

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
CHANGELOG.md Outdated

### Bug Fixes No newline at end of file
### Bug Fixes
- Fixed ipv6 discovery No newline at end of file
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.

Maybe explain it more, smth like "Fixed automatic detection of local node IPv6 address"

"The configured advertised IPs must be either 1 or 2");
if (advertisedIps.size() == 1) {
nodeRecordBuilder.address(
advertisedIps.get(0), discoConfig.getAdvertisedUdpPort(), p2pConfig.getAdvertisedPort());
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.

will it work if only ipv6 is configured?

Copy link
Copy Markdown
Contributor Author

@gfukushima gfukushima Apr 1, 2026

Choose a reason for hiding this comment

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

tested and it does work when only the ipv6 interface is configured I haven't tried advertising the IPs since the purpose of this is for the client to discover the ips by themselves when we only specify the interface in this case either --p2p-interface="::" or --p2p-interface="0.0.0.0" --p2p-interface="::" would work

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.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.

Feat: Add IPv6 auto-ENR

2 participants