Fix discv5 ENR refresh installation - #41
Merged
pk910 merged 1 commit intoJul 29, 2026
Merged
Conversation
MysticRyuujin
marked this pull request as ready for review
July 23, 2026 14:52
|
I've bumped into the same issue. Fix looks good to me. |
pk910
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OnNodeUpdatecallback after installation so the node is reclassifiedRoot cause
When a peer advertised a higher ENR sequence in PING or PONG,
requestENRUpdatesent 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 ./bootnodeEnd-to-end validation used a fresh multi-client Kurtosis devnet. After the fix:
Nethermind and nimbus-eth1 bootstrapping are separate interop issues and are out of scope for this change.