Skip to content

p2p/dnsdisc, cmd/devp2p: keep invalid and unreachable nodes out of DNS trees - #35312

Merged
jrhea merged 1 commit into
ethereum:masterfrom
MysticRyuujin:dnsdisc-validate-ports
Jul 14, 2026
Merged

p2p/dnsdisc, cmd/devp2p: keep invalid and unreachable nodes out of DNS trees#35312
jrhea merged 1 commit into
ethereum:masterfrom
MysticRyuujin:dnsdisc-validate-ports

Conversation

@MysticRyuujin

Copy link
Copy Markdown
Contributor

The DNS discovery crawler (ethereum/discv4-crawl) builds signed enrtree lists by crawling the network and running the collected records through devp2p nodeset filter and devp2p dns sign. Those records come from external nodes, and enr.Record keeps entries it can't decode as raw RLP, so a self-signed record with an out-of-range port (EIP-778 defines ports only as "big endian integer", not uint16) can round-trip verbatim into a signed tree. Consumers that decode ports strictly then fail to decode that record.

Two publish-side checks:

  • MakeTree rejects a record if a present port entry (tcp/tcp6/udp/udp6/quic/quic6) does not decode as a uint16. This is an invariant at the signing boundary: geth won't sign a tree containing a record with an undecodable port, regardless of how the node list was produced. Absent and zero ports are unaffected.

  • devp2p nodeset filter -dialable keeps only nodes advertising a usable RLPx port (non-zero tcp/tcp6/quic/quic6), letting the crawler drop discovery-only and unreachable nodes so consumers aren't handed peers they can't connect to.

The two are deliberately separate: the MakeTree check is a correctness guard that always applies, while -dialable is an opt-in selection filter for the crawler pipeline. A follow-up will add -dialable to discv4-crawl's filter_list.

…S trees

MakeTree rejects records whose port entries do not decode as uint16, so geth
never signs a tree containing a record with an out-of-range port (enr.Record
keeps such pairs as raw RLP, letting a crawled foreign record round-trip into a
signed tree). Adds a nodeset filter -dialable that keeps only nodes advertising
a usable RLPx port.
@MysticRyuujin
MysticRyuujin requested a review from fjl as a code owner July 6, 2026 20:19
@fjl fjl added this to the 1.17.5 milestone Jul 6, 2026
@jrhea
jrhea merged commit 8d84e50 into ethereum:master Jul 14, 2026
9 checks passed
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.

3 participants