nevillegrech / gigahorse-toolchain

A binary lifter and analysis framework for Ethereum smart contracts
Other
295 stars 61 forks source link

New Storage Model #63

Closed sifislag closed 1 year ago

sifislag commented 1 year ago

This PR merges the changes in the new storage model, which is now considered stable. It uses Souffle ADTs to support arbitrary nested data structures as produced by solc.

Main declarations to be used by downstream clients:

/**
  Maps `SSTORE` and `SLOAD` statements to the high-level information:
  - `kind` can be "ACCESS", "LENGTH", "GETDATASTART"
  - `index` can be used to get the high-level uses of the composite storage data structure accesses and writes
  - `construct` is the data structure that is being accessed/written to
*/
.decl StorageStmtToIndexAndConstruct(stmt: Statement, kind: symbol, index: StorageIndex, construct: StorageConstruct)

// Interfaces like LLVM's GEP
.decl StorageIndex_HighLevelUses(index: StorageIndex, accessVar: Variable, offset: number, i: number, nestedness: number)

Will remove the old storage model in a future PR.