runtimeverification / runtimeverification/kontrol

Abstracted storage representation for Solidity smart contracts

Open
#165 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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 type Storage, which is super-sort of Map. Change #lookup to handle this as input and add a new #write which writes it (and adjust all lemmas to be over these new constructs). Was attempted:
  • In Kontrol, extnend the Storage sort with new SolidityStorage subsort, 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 (SSTORE and SLOAD), and "reverse" the keccak expressions 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 keccak expressions that are passed around a bunch? This may also simplify and speed up the backend.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.