Skip to content

Commit 78672d4

Browse files
authored
Merge pull request #50 from ethereum/fix-cvc5-good
2 parents c7c05c8 + f81f5a0 commit 78672d4

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Available options:
104104
60000)
105105
--max-iterations INTEGER Number of times we may revisit a particular branching
106106
point
107-
--solver TEXT Used SMT solver: z3 (default) or cvc4
107+
--solver TEXT Used SMT solver: z3 (default) or cvc5
108108
--smtdebug Print smt queries sent to the solver
109109
--assertions [WORD256] Comma seperated list of solc panic codes to check for
110110
(default: everything except arithmetic overflow)

flake.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
inherit secp256k1;
2626
})
2727
[
28-
(haskell.lib.compose.addTestToolDepends [ solc z3 cvc4 ])
28+
(haskell.lib.compose.addTestToolDepends [ solc z3 cvc5 ])
2929
(haskell.lib.compose.appendConfigureFlags (
3030
[ "--ghc-option=-O2" ]
3131
++ lib.optionals stdenv.isLinux [
@@ -75,7 +75,7 @@
7575
packages = _: [ hevm ];
7676
buildInputs = [
7777
z3
78-
cvc4
78+
cvc5
7979
solc
8080
haskellPackages.cabal-install
8181
haskellPackages.haskell-language-server

nix/hevm-tests/default.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ let
1111
in
1212
pkgs.recurseIntoAttrs {
1313
yulEquivalence-z3 = runWithSolver ./yul-equivalence.nix "z3";
14-
yulEquivalence-cvc4 = runWithSolver ./yul-equivalence.nix "cvc4";
14+
yulEquivalence-cvc5 = runWithSolver ./yul-equivalence.nix "cvc5";
1515

1616
# z3 takes 3hrs to run these tests on a fast machine, and even then ~180 timeout
1717
#smtChecker-z3 = runWithSolver ./smt-checker.nix "z3";
18-
smtChecker-cvc4 = runWithSolver ./smt-checker.nix "cvc4";
18+
smtChecker-cvc5 = runWithSolver ./smt-checker.nix "cvc5";
1919
}

src/hevm/hevm-cli/hevm-cli.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ data Command w
121121
, showTree :: w ::: Bool <?> "Print branches explored in tree view"
122122
, smttimeout :: w ::: Maybe Integer <?> "Timeout given to SMT solver in milliseconds (default: 60000)"
123123
, maxIterations :: w ::: Maybe Integer <?> "Number of times we may revisit a particular branching point"
124-
, solver :: w ::: Maybe Text <?> "Used SMT solver: z3 (default) or cvc4"
124+
, solver :: w ::: Maybe Text <?> "Used SMT solver: z3 (default) or cvc5"
125125
, smtdebug :: w ::: Bool <?> "Print smt queries sent to the solver"
126126
, assertions :: w ::: Maybe [Word256] <?> "Comma seperated list of solc panic codes to check for (default: everything except arithmetic overflow)"
127127
, askSmtIterations :: w ::: Maybe Integer <?> "Number of times we may revisit a particular branching point before we consult the smt solver to check reachability (default: 5)"
@@ -132,7 +132,7 @@ data Command w
132132
, sig :: w ::: Maybe Text <?> "Signature of types to decode / encode"
133133
, smttimeout :: w ::: Maybe Integer <?> "Timeout given to SMT solver in milliseconds (default: 60000)"
134134
, maxIterations :: w ::: Maybe Integer <?> "Number of times we may revisit a particular branching point"
135-
, solver :: w ::: Maybe Text <?> "Used SMT solver: z3 (default) or cvc4"
135+
, solver :: w ::: Maybe Text <?> "Used SMT solver: z3 (default) or cvc5"
136136
, smtoutput :: w ::: Bool <?> "Print verbose smt output"
137137
, smtdebug :: w ::: Bool <?> "Print smt queries sent to the solver"
138138
, askSmtIterations :: w ::: Maybe Integer <?> "Number of times we may revisit a particular branching point before we consult the smt solver to check reachability (default: 5)"
@@ -182,7 +182,7 @@ data Command w
182182
, cache :: w ::: Maybe String <?> "Path to rpc cache repository"
183183
, match :: w ::: Maybe String <?> "Test case filter - only run methods matching regex"
184184
, covMatch :: w ::: Maybe String <?> "Coverage filter - only print coverage for files matching regex"
185-
, solver :: w ::: Maybe Text <?> "Used SMT solver: z3 (default) or cvc4"
185+
, solver :: w ::: Maybe Text <?> "Used SMT solver: z3 (default) or cvc5"
186186
, smtdebug :: w ::: Bool <?> "Print smt queries sent to the solver"
187187
, ffi :: w ::: Bool <?> "Allow the usage of the hevm.ffi() cheatcode (WARNING: this allows test authors to execute arbitrary code on your machine)"
188188
, smttimeout :: w ::: Maybe Integer <?> "Timeout given to SMT solver in milliseconds (default: 60000)"
@@ -439,7 +439,7 @@ getSrcInfo cmd =
439439

440440
-- Although it is tempting to fully abstract calldata and give any hints about
441441
-- the nature of the signature doing so results in significant time spent in
442-
-- consulting z3 about rather trivial matters. But with cvc4 it is quite
442+
-- consulting z3 about rather trivial matters. But with cvc5 it is quite
443443
-- pleasant!
444444

445445
-- If function signatures are known, they should always be given for best results.

src/hevm/src/EVM/SMT.hs

+3-6
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,9 @@ prelude = SMT2 . fmap (T.drop 2) . T.lines $ [i|
242242
(declare-const abstractStore Storage)
243243
(define-const emptyStore Storage ((as const Storage) ((as const (Array (_ BitVec 256) (_ BitVec 256))) #x0000000000000000000000000000000000000000000000000000000000000000)))
244244

245-
(define-fun sstore ((addr Word) (key Word) (val Word) (storage Storage)) Storage (
246-
store storage addr (store (select storage addr) key val)))
245+
(define-fun sstore ((addr Word) (key Word) (val Word) (storage Storage)) Storage (store storage addr (store (select storage addr) key val)))
247246

248-
(define-fun sload ((addr Word) (key Word) (storage Storage)) Word (
249-
select (select storage addr) key))
247+
(define-fun sload ((addr Word) (key Word) (storage Storage)) Word (select (select storage addr) key))
250248
|]
251249

252250
declareBufs :: [Text] -> SMT2
@@ -704,8 +702,7 @@ solverArgs = \case
704702
[ "-in" ]
705703
CVC5 ->
706704
[ "--lang=smt"
707-
, "--interactive"
708-
, "--no-interactive-prompt"
705+
, "--no-interactive"
709706
, "--produce-models"
710707
]
711708
Custom _ -> []

0 commit comments

Comments
 (0)