pointers: add a scalar value decoder#269
Merged
Merged
Conversation
Adds decodeValue(data, type): a pure, framework-agnostic function that
turns a resolved value region's bytes + the variable's static type into a
readable string (uint256 -> "2", not 0x00..02) — the scalar-first slice of
the value-rendering reduce layer.
Handles uint (decimal), int (two's-complement over the region width), bool,
address (EIP-55 checksummed), and static bytesN (left-aligned). Dynamic
bytes/string, aggregates, fixed/ufixed, enum, unresolved {id} type refs, and
missing types fall back to raw hex so callers never break.
Contributor
|
This was referenced Jul 16, 2026
gnidan
added a commit
that referenced
this pull request
Jul 16, 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.
Adds
decodeValue(data, type)to@ethdebug/pointers: a pure function thatturns a resolved value region's bytes plus a variable's static type into a
readable string, so a
uint256local reads as2rather than0x0000…0002.This is the scalar-first slice of the value-rendering layer. Decoding is
location-blind: it operates on already-resolved bytes and the type, with no
machine state or pointer logic.
Handled types:
uint<N>— decimalint<N>— signed decimal (two's complement over the region's byte width)bool—true/falseaddress— EIP-55 checksummed0x…bytes<N>—0x…(left-aligned)Anything else — dynamic
bytes/string, arrays, structs, mappings,fixed/ufixed,enum, an unresolved{ id }type reference, or a missingtype — falls back to the raw hex of the region bytes, so callers never break
on an unhandled shape. Aggregate and dynamic decoding are left for later.
Tests cover each scalar kind — including tightly-stored vs. sign-extended
integers and the EIP-55 vector — and the hex fallbacks.