diff --git a/src/hevm/CHANGELOG.md b/src/hevm/CHANGELOG.md index 157af16c0..37be51df7 100644 --- a/src/hevm/CHANGELOG.md +++ b/src/hevm/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Correctly handle concrete returndata when checking the result of a symbolic test +- Correctly handle reverting branches when checking the result of a symbolic test ## [0.49.0] - 2021-11-12 diff --git a/src/hevm/src/EVM/UnitTest.hs b/src/hevm/src/EVM/UnitTest.hs index a60626f70..7a1cc6fc2 100644 --- a/src/hevm/src/EVM/UnitTest.hs +++ b/src/hevm/src/EVM/UnitTest.hs @@ -770,10 +770,14 @@ execSymTest opts@UnitTestOptions{ .. } method cd = do Stepper.runFully >>= \vm' -> case view result vm' of Just (VMFailure err) -> -- If we failed, put the error in the trace. - Stepper.evm (pushTrace (ErrorTrace err)) >> (pure (True, vm')) + Stepper.evm (pushTrace (ErrorTrace err)) >> pure (True, vm') Just (VMSuccess _) -> do postVm <- checkSymFailures opts - pure (False, postVm) + -- calls to failed() contain reverting branches since https://github.com/dapphub/ds-test/pull/30 + case view result postVm of + Just (VMSuccess _) -> pure (False, postVm) + Just (VMFailure _) -> pure (True, postVm) + r -> error $ "unexpected return value after call to failed(): " ++ show r Nothing -> error "Internal Error: execSymTest: vm has not completed execution!" checkSymFailures :: UnitTestOptions -> Stepper VM