Skip to content

Fix discv5 ENR refresh installation - #41

Merged
pk910 merged 1 commit into
ethpandaops:masterfrom
MysticRyuujin:codex/fix-discv5-enr-refresh
Jul 29, 2026
Merged

Fix discv5 ENR refresh installation#41
pk910 merged 1 commit into
ethpandaops:masterfrom
MysticRyuujin:codex/fix-discv5-enr-refresh

Conversation

@MysticRyuujin

@MysticRyuujin MysticRyuujin commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • install newer ENRs returned by distance-zero FINDNODE requests
  • require the returned ENR to belong to the responding node
  • select the highest-sequence matching record
  • invoke the existing OnNodeUpdate callback after installation so the node is reclassified
  • add regression coverage for successful refreshes, wrong-node records, and stale records

Root cause

When a peer advertised a higher ENR sequence in PING or PONG, requestENRUpdate sent a distance-zero FINDNODE request but only logged the returned NODES record. The cached session ENR was never replaced, despite a comment claiming the NODES handler updated it automatically.

For peers whose startup ENR lacked usable fork data, bootnodoor therefore kept the node unclassified and returned empty NODES responses to it indefinitely. Erigon reproduced this behavior: it completed a discv5 session, but remained outside the EL table with zero peers.

Safety

Returned records are structurally validated and must derive the same node ID as the responder. Only a strictly newer record is installed, preventing a peer from replacing its session record with another node's ENR. If several records are returned, the newest matching record wins.

Validation

  • go test ./...
  • go vet ./...
  • gofmt -s -l .
  • go test -race ./discv5/protocol ./bootnode

End-to-end validation used a fresh multi-client Kurtosis devnet. After the fix:

  • bootnodoor admitted Erigon with its high-sequence, current-fork ENR
  • Erigon reached four peers instead of remaining isolated
  • every node discovered by the crawler was in its verified capacity class

Nethermind and nimbus-eth1 bootstrapping are separate interop issues and are out of scope for this change.

@MysticRyuujin
MysticRyuujin marked this pull request as ready for review July 23, 2026 14:52
@cskiraly

cskiraly commented Jul 29, 2026

Copy link
Copy Markdown

I've bumped into the same issue. Fix looks good to me.

@pk910
pk910 merged commit 18ed3b6 into ethpandaops:master Jul 29, 2026
1 check 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