Skip to content

format: state the sort of pointer variables - #404

Merged
gnidan merged 3 commits into
mainfrom
format-variable-sorts
Nov 10, 2026
Merged

gnidan merged 3 commits into
mainfrom
format-variable-sorts

Conversation

@gnidan

@gnidan gnidan commented Nov 9, 2026

Copy link
Copy Markdown
Member

The pointer expression schema never said what sort a variable has. Its list of sorts put variables under integers only when they "denote an index or count", and the Variable definition said only that a variable evaluates to its value. The pointers package already keeps the sort of a variable's defining expression (and tests it), so a variable defined by a bytes expression keeps its width.

This states that in the schemas:

  • ethdebug/format/pointer/expression: a list's each variable is an integer, and a variable from a scope's define has the sort of the expression that defines it.
  • ethdebug/format/pointer/collection/scope: the same, plus an example that hashes a bytes variable directly (the storage slot of m["abc"] for a mapping(string => uint256)).
  • ethdebug/format/pointer/collection/list: each is an integer.
  • ethdebug/format/pointer/template: an expected variable takes its value, and so its sort, from the variable in scope where the template is referenced.

This matters for mapping entries keyed by string or bytes, whose raw key bytes have no fixed width and can't round-trip through an integer.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2
Preview removed because the pull request was closed.
2026-11-10 06:13 UTC

@gnidan
gnidan merged commit 36115cf into main Nov 10, 2026
8 of 9 checks passed
@gnidan
gnidan deleted the format-variable-sorts branch November 10, 2026 17:09
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.

1 participant