-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solidity's model checker basic options #1602
Conversation
6f58980
to
ed23a3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great,
thanks for the docs!
|
||
```toml | ||
[default.model_checker] | ||
contracts = { '/path/to/project/src/Contract.sol' = [ 'Contract' ] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, will check the basepath
setting and make them relative from root
|
||
```toml | ||
[default.model_checker] | ||
contracts = { '/path/to/project/src/Contract.sol' = [ 'Contract' ] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another way to get this supported without basePath
would be updating the paths in Config::canonic_at
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the current version already works. The user just needs to add the absolute path for now, but works.
0ab1846
to
6084153
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - let's follow up on the absolute -> Relative paths separately - cc @mattsse
6084153
to
aef5e53
Compare
just fixed fmt |
Not sure if this is wanted, but I think it would be cool to have direct access to Solidity's model checker via the Foundry options. This is basically what I'm running locally.
The options are opt-in and not there by default, so it shouldn't bother the default case and Foundry users who don't explicitly add it.
Description
This PR adds the minimum required options to
foundry.toml
(as opt-in) that enable Soldity's model checker.Motivation
Solidity has a built-in model checker that can be easy to use on OSX and Linux (the latter needs z3 <=4.8.14 installed system-wide) via compiler options.
Solution
The options were added based on a subset of the tools options. For now only the essential options were added, but the rest (such as
divModNoSlack
andinvariants
) can easily be added afterwards.This PR depends on its corresponding
ethers-rs
PR (gakonst/ethers-rs#1258), and the first commit here points to that PR's branch to show how the integration works, and would be removed if/when that PR is merged.Example
The feature this PR enables is represented below.
Let
src/Contract.sol
be the following code, which you want to verify:This is added to
foundry.toml
:Result of
forge build
: