Skip to content

fix: handle nested array values in ENR field display#49

Merged
nflaig merged 1 commit intoChainSafe:masterfrom
lodekeeper:fix/nested-array-eth-field
Mar 31, 2026
Merged

fix: handle nested array values in ENR field display#49
nflaig merged 1 commit intoChainSafe:masterfrom
lodekeeper:fix/nested-array-eth-field

Conversation

@lodekeeper
Copy link
Copy Markdown
Contributor

Problem

ENRs containing an eth key (EIP-2124 fork ID) crash the viewer. The eth value is stored as a nested array [[Uint8Array, Uint8Array]] in the kvs map, but getDisplayValue calls uToString(v) on each element — when v is 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_______________-CaWSCdjSCaXCEW2vq6olzZWNwMjU2azGhAxke8OqBg9N0xPjmgTE3TAJxF514uMfW1pqUxqOwFc7pg3RjcIIjMoN1ZHCCIzI

Fix

Replace the flat value.map(v => uToString(v)) with a recursive formatNestedArray helper that:

  • Renders Uint8Array leaves as hex strings (0x...)
  • Recurses into nested arrays
  • Falls back to String() for other types

Result

The eth field now renders as: [["0xc70bfe18","0x69cbbec0"]] instead of crashing.

Reported by @barnabasbusa

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 nflaig merged commit dafd412 into ChainSafe:master Mar 31, 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.

2 participants