argotorg / argotorg/hevm

Allow to make storage memory symbolic, even on test mode

Open
#862 5 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
358
Forks
79
Avg merge
1d 1h
Merged PRs (30d)
6

Description

Take a look to the following example. An auditor wants to use symbolic execution in order to understand when an invariant can fail:

```solidity
pragma solidity ^0.8.13;

import "forge-std/Test.sol";

contract Counter {
uint256 public number;

function increment() public {
number++;
}
}

contract CounterSymTest is Test {
Counter public counter;

function setUp () public {
counter = new Counter();
}

function prove_isIncrementFeasible() public {
vm.assume(counter.number() != 2);
counter.increment();
assertTrue(!(counter.number() == 2), "number is 2");
}
}
```

However, hevm allows to run either in `symbolic` mode or `test` mode but none of them is useful here. Test mode will verify the property, since the concrete state of the `Counter` program is preserved and it is impossible to force some storage to be symbolic.
Purely symbolic mode will make everything symbolic, even during contract deployment, but here we only want to make the `Counter` storage symbolic after `setUp` deployed the contract.

One possible solution is add a cheatcode that allows to make the complete storage (or even specific slots) for a given address symbolic. I'm usually not pushing to add specific cheatcodes, but in this perhaps it makes sense. What do you think?

h/t @GalloDaSballo

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin with the supplied CounterSymTest example and compare hevm's test and symbolic modes. Done means a concrete setup can be followed by symbolic storage for the deployed address while deployment remains concrete; the issue does not name implementation files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell, solidity
Domain
compilers, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.