diff --git a/src/EVM.hs b/src/EVM.hs index 609c6d3c2..5fb013ae0 100644 --- a/src/EVM.hs +++ b/src/EVM.hs @@ -2381,10 +2381,10 @@ finishFrame how = do push 0 -- Case 3: Error during a call? - FrameErrored _ -> do + FrameErrored e -> do revertContracts revertSubstate - assign (#state % #returndata) mempty + assign (#state % #returndata) (ConcreteBuf (BS8.pack $ show e)) push 0 -- Or were we creating? CreationContext _ _ reversion subState' -> do diff --git a/src/EVM/UnitTest.hs b/src/EVM/UnitTest.hs index c52ea8bc0..f66b1400b 100644 --- a/src/EVM/UnitTest.hs +++ b/src/EVM/UnitTest.hs @@ -21,7 +21,7 @@ import EVM.Transaction (initTx) import EVM.Stepper (Stepper) import EVM.Stepper qualified as Stepper -import Control.Monad (void, when, forM, forM_) +import Control.Monad (void, when, forM, forM_, unless) import Control.Monad.ST (RealWorld, ST, stToIO) import Control.Monad.State.Strict (execState, get, put, liftIO) import Optics.Core @@ -227,6 +227,12 @@ symRun opts@UnitTestOptions{..} vm (Sig testName types) = do -- check postconditions against vm (e, results) <- verify solvers (makeVeriOpts opts) (symbolify vm') (Just postcondition) let allReverts = not . (any Expr.isSuccess) . flattenExpr $ e + let fails = filter (Expr.isFailure) $ flattenExpr e + unless (null fails) $ liftIO $ do + putStrLn $ " \x1b[33mWARNING\x1b[0m: hevm was only able to partially explore the test " <> Text.unpack testName <> " due to: "; + forM_ (fails) $ \case + (Failure _ _ err) -> putStrLn $ " -> " <> show err + _ -> internalError "unexpected failure" when (any isUnknown results || any isError results) $ liftIO $ do putStrLn $ " \x1b[33mWARNING\x1b[0m: hevm was only able to partially explore the test " <> Text.unpack testName <> " due to: "; forM_ (groupIssues (filter isError results)) $ \(num, str) -> putStrLn $ " " <> show num <> "x -> " <> str