Repository navigation
Conversation
Contributor
|
This branch has not been deployed
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.
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:
uint,int,ufixedandfixed: optionalsigned(default false) andplaces(default 0). Nobits.contract: optionalpayable; an optionaldefinitionmakes the address a contract reference, and the definition carries thelibrary/interfacehints.flag).byteslosessize.enumrequires one or more unique stringvalues.boolandstringare unchanged apart fromlabel.Complex:
tuple(members without names). An empty struct is legal.casesof{name, discriminant, payload?}.arraylosescount.functiontakes top-levelparametersandreturnslists (returns: []means no values) in place ofcontains; an external function may name itscontractas an address with a definition.aliasandmappingkeep 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 undercontains. A complex type may now omitcontainswhen it givesclass: 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,countand functioncontainsstill 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.label(for example{kind: "number", signed: true, label: "int8"}). It also stops emittinglengthon arrays, a field the old schema did not define.label, or else its kind.typestable. Conformance now validates solc's resources with an emptytypestable, and a tripwire test fails once solc's table validates (conformance: solc emits the old type kinds #423).