Skip to content

Commit

Permalink
hevm: no whitespace in invariant replay data
Browse files Browse the repository at this point in the history
Fixes #722. For some obscure reason related to bash array expansion, the
whitespace in the invariant replay data ended up being passed to hevm as
`' '` (i.e. two quotes with a space).

I don't know why bash adds these extra quotes, but we can just ignore
this problem by never including whitespace in replay strings...
  • Loading branch information
d-xo committed Sep 15, 2021
1 parent 37c3d59 commit e2f4cff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/hevm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hevm changelog

## Unreleased

## Fixed

- Test contracts with no code (e.g. `abstract` contracts) are now skipped
- Replay data for invariant tests is now displayed in a form that does not cause errors when used with `dapp test --replay`

## [0.48.1] - 2021-09-08

### Added
Expand All @@ -14,7 +21,6 @@
### Fixed

- The block gas limit and basefee are now correctly fetched when running tests via rpc
- Test contracts with no code (e.g. `abstract` contracts) are now skipped

## 0.48.0 - 2021-08-03

Expand Down
2 changes: 1 addition & 1 deletion src/hevm/src/EVM/UnitTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ exploreRun opts@UnitTestOptions{..} initialVm testName replayTxs = do
then return ("\x1b[32m[PASS]\x1b[0m " <> testName <> " (runs: " <> (pack $ show fuzzRuns) <>", depth: " <> pack (show depth) <> ")",
Right (passOutput vm' opts testName), vm') -- no canonical "post vm"
else let replayText = if null replayTxs
then "\nReplay data: '(" <> pack (show testName) <> ", " <> pack (show (show (ByteStringS $ rlpencode counterex))) <> ")'"
then "\nReplay data: '(" <> pack (show testName) <> "," <> pack (show (show (ByteStringS $ rlpencode counterex))) <> ")'"
else " (replayed)"
in return ("\x1b[31m[FAIL]\x1b[0m " <> testName <> replayText, Left (failOutput vm' opts testName), vm')

Expand Down

0 comments on commit e2f4cff

Please sign in to comment.