go-ethereum/p2p/dnsdisc
Chase Wright 8d84e5001a
p2p/dnsdisc, cmd/devp2p: keep invalid and unreachable nodes out of DNS trees (#35312)
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`.
2026-07-14 09:05:02 -05:00
..
client.go eth: report error from setupDiscovery at startup (#31233) 2025-02-23 17:38:32 +01:00
client_test.go p2p/dnsdisc: using clear builtin func (#29418) 2024-04-04 12:19:48 +02:00
doc.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
error.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
sync.go p2p/dnsdisc: fix hot-spin when all trees are empty (#22313) 2021-02-19 09:54:46 +01:00
sync_test.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
tree.go p2p/dnsdisc, cmd/devp2p: keep invalid and unreachable nodes out of DNS trees (#35312) 2026-07-14 09:05:02 -05:00
tree_test.go p2p/dnsdisc, cmd/devp2p: keep invalid and unreachable nodes out of DNS trees (#35312) 2026-07-14 09:05:02 -05:00