Skip to content

format: rewrite the type schemas - #424

Draft
gnidan wants to merge 19 commits into
mainfrom
format-type-rewrite
Draft

gnidan wants to merge 19 commits into
mainfrom
format-type-rewrite

Conversation

@gnidan

@gnidan gnidan commented Nov 20, 2026

Copy link
Copy Markdown
Member

This rewrites the ethdebug/format/type schemas for #282. A type now says what a value is. The pointer says where the value's bytes are, so widths, sizes and counts leave the types. Interpretations (decoders) turn a type and a pointer into a value, and a language that needs more can add its own kinds.

The old kinds go away in this release. Nothing is deprecated.

Kinds

Elementary:

  • ethdebug/format/type/elementary/number replaces uint, int, ufixed and fixed: optional signed (default false) and places (default 0). No bits.
  • ethdebug/format/type/elementary/address absorbs contract: optional payable; an optional definition makes the address a contract reference, and the definition carries the library / interface hints.
  • ethdebug/format/type/elementary/flags is new: a set of named members (Vyper flag).
  • bytes loses size. enum requires one or more unique string values. bool and string are unchanged apart from label.

Complex:

  • ethdebug/format/type/complex/struct absorbs tuple (members without names). An empty struct is legal.
  • ethdebug/format/type/complex/variant is new: cases of {name, discriminant, payload?}.
  • array loses count. function takes top-level parameters and returns lists (returns: [] means no values) in place of contains; an external function may name its contract as an address with a definition. alias and mapping keep their shape.

Every type may carry label, the type as the language spells it (uint256, bytes32, address[10]). It is for display only.

Each kind's description states its standard interpretation (function is the exception for now). Realizations, which describe which regions of a pointer hold which parts of a type, come in a later PR.

Unknown kinds

The base rule still applies to kinds this format does not define: they give class, and a complex one puts its child types under contains. A complex type may now omit contains when it gives class: complex, so an unknown kind can hold a known variant or function.

Producers and consumers

This is breaking for both. Data with the old kinds no longer validates. bits, size, count and function contains still pass validation as extra fields, but they no longer mean anything.

  • @ethdebug/format: the TS types and guards follow the new kinds; the old ones are removed.
  • bugc emits the new kinds with a label (for example {kind: "number", signed: true, label: "int8"}). It also stops emitting length on arrays, a field the old schema did not define.
  • The tracer shows a type's label, or else its kind.
  • solc still emits the old kinds in its resources types table. Conformance now validates solc's resources with an empty types table, and a tripwire test fails once solc's table validates (conformance: solc emits the old type kinds #423).
  • The spec pages and docs describe the new kinds.

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://ethdebug.github.io/format/pr-preview/pr-424/

Built to branch gh-pages at 2026-11-20 21:00 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

This branch has not been deployed

No deployments
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