runtimeverification / runtimeverification/kontrol
Abstracted storage representation for Solidity smart contracts
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 122
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
An idea from @geo2a about having our storage representation change to allow for more abstract reasoning at the level of solidity data structures. Other tools (like Halmos) do this, which costs generality in terms of handling arbitrary EVM bytecode, but gains in speed/efficiency.
- Change the
<storage>cell in KEVM to be of new typeStorage, which is super-sort ofMap. Change#lookupto handle this as input and add a new#writewhich writes it (and adjust all lemmas to be over these new constructs). Was attempted: - In Kontrol, extnend the
Storagesort with newSolidityStoragesubsort, which accomodates Solidity contract fields. The field names can be the first keys in the overall map, and the second keys can be mapping indices, or struct member names, etc... - In Kontrol, where we generate storage-layout lemmas, instead generate ones that go the "other direction". Basically, they should look at storage reads/writes (
SSTOREandSLOAD), and "reverse" thekeccakexpressions being passed into them to find their high-level Solidity counterparts. These reversing rules can be generated automatically in the same way we generate the sugar rules now (which are not used), by just reversing the rules we generate.
This will provide:
- Better looking storage layouts by default, easier to map back to Solidity storage values.
- Perhaps simpler reasoning than having these massive
keccakexpressions that are passed around a bunch? This may also simplify and speed up the backend.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the attempted changes in PRs #1549, #1550, and #1598, then trace the KEVM cell, #lookup, and the proposed #write constructs. Next, inspect Kontrol's storage-layout lemma generation around SLOAD and SSTORE. Done means the KEVM storage abstraction, SolidityStorage representation, and generated reverse storage-layout rules work together and improve storage reasoning as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100