Repository navigation
format: add virtual regions for computed values - #411
Merged
Merged
Conversation
gnidan
added a commit
that referenced
this pull request
Nov 11, 2026
Contributor
|
Member
Author
|
@djolertrk @cameel would be curious what you think of this approach to solving #291 |
gnidan
force-pushed
the
format-define-order
branch
from
November 16, 2026 20:38
b90abe5 to
3e90f37
Compare
gnidan
added a commit
that referenced
this pull request
Nov 16, 2026
gnidan
force-pushed
the
format-virtual-regions
branch
from
November 16, 2026 20:59
4c4db3c to
be853c0
Compare
gnidan
force-pushed
the
format-virtual-regions
branch
from
November 16, 2026 21:58
be853c0 to
5aa8a7b
Compare
A pink badge with a dashed border, and a dashed left border in the region output, since a virtual region's bytes are computed, not stored.
A lookup of either one threw, though the spec gives both a default.
It checked the move to templates (#399) against the compiler from before it. That move is long done, and the test that templates read as the inline pointers do still runs on every example.
# Conflicts: # CHANGELOG.md # packages/format/CHANGELOG.md
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.
Implements #291.
This adds a region with
"location": "virtual"for values that no EVM data location stores, e.g. a variable the optimizer removed. The pointer schema's dispatch does not change: a virtual region is just another region, and dereferencing still yields regions only.Every region is base fields plus one addressing scheme. Virtual regions use a new third scheme, ethdebug/format/pointer/scheme/fragment: a width-bearing
expressionsupplies the byte space (the expression's value), and optionaloffset(default0) andlength(default: to the end of the value) address into it. A fragment outside the value's bytes is invalid. The expression is evaluated against the same machine state as the pointer's other regions and may refer only to regions before it. Lookups follow the region's fields, so.offsetand.lengthwork and.slotdoes not;~readgives the fragment's bytes.The reference implementation evaluates the expression while it makes the region concrete, keeps the bytes on the concrete region, and fills in the default
offsetandlength;readreturns the fragment. A new integration case readsa + 1and the first 4 bytes ofkeccak256(a)from a storage variable over a solc trace.