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 PR adds support for static arrays in contract storage and constructor/behavior arguments. It also modifies logic related to the interaction with the SMT solver, to accommodate new SMT checks required by array semantics, and to enable new cases for testing.
AST additions and Typing for Static Arrays
Untyped.hs
:NestedList
data structure: A tree-structure of arbitrary depth with list endpoints, used to represent array literals of any level of nesting. The type aliasExprList
holds lists of expressions and positional information.AssignArray
: Represents initialization of an array storage variable, using theExprList
structure.EMapping
->EIndexed
: Entries to mappings and arrays have the same AST representation at this level, renamed to reflect that.Typed.hs
:SArray
: Constructor forRef
representing an array. Similar toSMapping
with the addition of array bounds information for each index.Type.hs
:ExprList
represents a valid array literal i.e. at each level of the tree, all arrays have the same number of sub-arrays.StorageUpdate
in the typed AST.SMT passes
Added 2 new SMT passes in
Consistency.hs
.checkArrayBounds
: Ensures that no storage state and calldata values can lead to an out-of-bounds array entry, given the corresponding conditions.checkRewriteAliasing
: Ensures that no storage state and calldata values can lead to separateStorageUpdate
s updating the same storage location, given the corresponding conditions.SMT modifications
Added the
CalldataLocation
datatype, that serves the same function asStorageLocation
but for references that start from aCVar
at their root. This allows for the creation of calldata versions of thelocFromX
family of functions inSyntax.hs
, which are used in the SMT passes to collect all accesses to arrays and mappings.In addition, modified logic affecting storage declarations and integer bounds preconditions, to avoid problems with Model acquisition from the SMT solver in cases of failure.
TODOs
Miscellaneous
.gitignore
for Rocq renaming