Axiomatisation of Solidity Memory and Storage
摘要
Solidity, the most popular smart contract language, has two different kinds of data areas, called storage and memory. Storage is persistent across transactions and stored in the blockchain, while memory is volatile and does not survive a transaction. In storage, data structures are of value kind, with deep copy and no aliasing. In memory, data structures are of reference kind, with shallow copy and potential aliasing. We are concerned with deductive verification of smart contracts written in Solidity. Hence, we provide a logic formalisation of both data areas supporting efficient representation of the data areas, striking a balance between term size and on-demand case distinctions. We present a formalisation of the Solidity data types in both storage and memory, meeting the stated objectives. Specifically, we detail our representation of these data areas, discussing their differences and the challenges we encountered, such as value vs. reference semantics, object identity creation, and eager vs. lazy evaluation to delay proof effort until necessary.