fix: handle nested array values in ENR field display#49
Merged
nflaig merged 1 commit intoChainSafe:masterfrom Mar 31, 2026
Merged
fix: handle nested array values in ENR field display#49nflaig merged 1 commit intoChainSafe:masterfrom
nflaig merged 1 commit intoChainSafe:masterfrom
Conversation
The `eth` key (EIP-2124 fork ID) is stored as a nested array `[[Uint8Array, Uint8Array]]` in the ENR kvs map. The previous code called `uToString(v)` on each array element, but when `v` is itself an array (not a Uint8Array), TextDecoder throws, crashing the entire decoded view. Replace the flat `value.map(uToString)` with a recursive `formatNestedArray` helper that handles Uint8Array leaves as hex strings and recurses into nested arrays.
nflaig
approved these changes
Mar 31, 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.
Problem
ENRs containing an
ethkey (EIP-2124 fork ID) crash the viewer. Theethvalue is stored as a nested array[[Uint8Array, Uint8Array]]in the kvs map, butgetDisplayValuecallsuToString(v)on each element — whenvis itself an array (not a Uint8Array),TextDecoder.decode()throws, crashing the React render.Any ENR from a node advertising EL fork ID triggers this (e.g. combined EL+CL ENRs).
Repro ENR:
enr:-LG4QHtI4PhJcbPXNf297xFrq1yjnDoqg4MgGfAKihV60Tusa5J8b5JRCe9gKdRgKiHrK9vO1YFVpykV1razMRtCY6gCg2V0aMvKhMcL_hiEacu-wIRldGgykA9gtO7_______________-CaWSCdjSCaXCEW2vq6olzZWNwMjU2azGhAxke8OqBg9N0xPjmgTE3TAJxF514uMfW1pqUxqOwFc7pg3RjcIIjMoN1ZHCCIzIFix
Replace the flat
value.map(v => uToString(v))with a recursiveformatNestedArrayhelper that:Uint8Arrayleaves as hex strings (0x...)String()for other typesResult
The
ethfield now renders as:[["0xc70bfe18","0x69cbbec0"]]instead of crashing.Reported by @barnabasbusa