Skip to content

Fix ipv6 discovery#10516

Merged
gfukushima merged 16 commits intoConsensys:masterfrom
gfukushima:ipv6-autodiscover
Apr 20, 2026
Merged

Fix ipv6 discovery#10516
gfukushima merged 16 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
Touches discovery/ENR initialization and local address selection logic, which can impact peer connectivity (especially dual-stack) and is backed by a discovery library upgrade.

Overview
Fixes IPv6 discovery by broadening local IPv6 auto-detection to select any non-loopback, non-link-local address, and by always seeding the initial discv5 ENR with the resolved advertised IP(s)/ports (including dual-stack) so discovery starts with correct addresses.

Upgrades the discovery dependency from tech.pegasys.discovery to io.consensys.protocols:discovery (newer version) across modules, updates bootnode acceptance tests to assert only the deterministic ENR public-key portion, and records the IPv6 detection fix in CHANGELOG.md.

Reviewed by Cursor Bugbot for commit f76e35f. Bugbot is set up for automated code reviews on this repo. 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>
Comment thread 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>
lucassaldanha
lucassaldanha previously approved these changes Apr 17, 2026
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 186ee81. Configure here.

…namically

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
@gfukushima gfukushima enabled auto-merge (squash) April 20, 2026 04:28
@gfukushima gfukushima disabled auto-merge April 20, 2026 04:28
@gfukushima gfukushima enabled auto-merge (squash) April 20, 2026 04:28
@gfukushima gfukushima merged commit bf348b7 into Consensys:master Apr 20, 2026
68 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Add IPv6 auto-ENR

3 participants