From 5b3878386c8834d3b2dd0b62018387db9ee9fd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 16 Sep 2024 13:57:48 +0200 Subject: [PATCH] Upgrade `hevm` to upstream `fix_prank` Commit 1dc2e9e96e741b25581c07b7580146afdf1b8676 --- flake.nix | 4 ++-- lib/Echidna/SymExec.hs | 6 ++++-- lib/Echidna/Types/Tx.hs | 2 +- stack.yaml | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 9225a5dfc..ef9f8c51a 100644 --- a/flake.nix +++ b/flake.nix @@ -52,8 +52,8 @@ hevm = pkgs: pkgs.lib.pipe ((hsPkgs pkgs).callCabal2nix "hevm" (pkgs.fetchFromGitHub { owner = "ethereum"; repo = "hevm"; - rev = "f1f45d3c0d9767a38df04f398d1eab8b66dbe7fc"; - sha256 = "sha256-3zEUwcZm4uZZLecvFTgVTV5CAm4qMfKPbLdwO88LnrY="; + rev = "1dc2e9e96e741b25581c07b7580146afdf1b8676"; + sha256 = "sha256-yjOvNxjkb0vBVIaUQII56r4mvo59YqA9kqXKmhlbnFQ="; }) { secp256k1 = pkgs.secp256k1; }) ([ pkgs.haskell.lib.compose.dontCheck diff --git a/lib/Echidna/SymExec.hs b/lib/Echidna/SymExec.hs index 9aa5b6bc7..3fd67f9c4 100644 --- a/lib/Echidna/SymExec.hs +++ b/lib/Echidna/SymExec.hs @@ -77,7 +77,7 @@ exploreContract conf contract tx vm = do doneChan <- newEmptyMVar resultChan <- newEmptyMVar - flip runReaderT defaultEnv $ withSolvers Z3 (fromIntegral conf.campaignConf.symExecNSolvers) timeout $ \solvers -> do + flip runReaderT defaultEnv $ withSolvers Z3 (fromIntegral conf.campaignConf.symExecNSolvers) 1 timeout $ \solvers -> do threadId <- liftIO $ forkIO $ flip runReaderT defaultEnv $ do res <- forM methods $ \method -> do let @@ -108,7 +108,7 @@ exploreContract conf contract tx vm = do pure (threadId, resultChan) -- | Turn the expression returned by `interpret` into into SMT2 values to feed into the solver -manipulateExprInter :: Bool -> Expr End -> [SMT2] +manipulateExprInter :: Bool -> Expr End -> [Either String SMT2] manipulateExprInter isConc = map (assertProps defaultConfig) . middleStep . map (extractProps . simplify) . flattenExpr . simplify where middleStep = if isConc then middleStepConc else id middleStepConc = map singleton . concatMap (go (PBool True)) @@ -155,6 +155,8 @@ frameStateMakeSymbolic fs , gas = () , returndata = fs.returndata , static = fs.static + , overrideCaller = fs.overrideCaller + , resetCaller = fs.resetCaller } frameMakeSymbolic :: Frame Concrete s -> Frame Symbolic s diff --git a/lib/Echidna/Types/Tx.hs b/lib/Echidna/Types/Tx.hs index ea844eec0..7ff01d192 100644 --- a/lib/Echidna/Types/Tx.hs +++ b/lib/Echidna/Types/Tx.hs @@ -234,7 +234,7 @@ getResult = \case VMFailure BadJumpDestination -> ErrorBadJumpDestination VMFailure (Revert _) -> ErrorRevert VMFailure (OutOfGas _ _) -> ErrorOutOfGas - VMFailure (BadCheatCode _) -> ErrorBadCheatCode + VMFailure (BadCheatCode _ _) -> ErrorBadCheatCode VMFailure StackLimitExceeded -> ErrorStackLimitExceeded VMFailure IllegalOverflow -> ErrorIllegalOverflow VMFailure StateChangeWhileStatic -> ErrorStateChangeWhileStatic diff --git a/stack.yaml b/stack.yaml index 12c0d0699..09e21309d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -5,7 +5,7 @@ packages: extra-deps: - git: https://github.com/ethereum/hevm.git - commit: f1f45d3c0d9767a38df04f398d1eab8b66dbe7fc + commit: 1dc2e9e96e741b25581c07b7580146afdf1b8676 - smt2-parser-0.1.0.1@sha256:1e1a4565915ed851c13d1e6b8bb5185cf5d454da3b43170825d53e221f753d77,1421 - spawn-0.3@sha256:b91e01d8f2b076841410ae284b32046f91471943dc799c1af77d666c72101f02,1162