All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- The
--storage-model
parameter has been replaced with--initial-storage
- The
--smttimeout
argument now expects a value in seconds not milliseconds - The default smt timeout has been set to 5 minutes
hevm symbolic
now searches only for user defined assertions by default
- The
prank
cheatcode now transfers value from the correct address
- The
--solvers
cli option is now respected (previously we always used Z3) - The
equivalence
command now fails with the correct status code when counterexamples are found - The
equivalence
command now respects the given--sig
argument - Correct symbolic execution for the
SGT
opcode
- The
equivalence
command now pretty prints discovered counterexamples
- Implemented a shrinking algorithm for counterexamples
- A new differential fuzzing test harness that compares the concrete semantics, as well as parts of the symbolic semantics against the geth evm implementation
- The
hevm
library can now be built on Windows systems. equivalence
can now be checked for fully or partially concrete calldata- Support for function pointers in ABI
hevm symbolic
exits with status code1
if counterexamples or timeouts are found- Calldata reads beyond calldata size are provably equal to zero.
- New cheatcode
prank(address)
that setsmsg.sender
to the specified address for the next call. - Improved equivalence checker that avoids checking similar branches more than once.
- Improved simplification for arithmetic expressions
- Construction of storage counterexamples based on the model returned by the SMT solver.
- Static binaries for macos
- SMT encoding of buffer length without using uninterpreted functions.
- Arithmetic overflow in concrete
SAR
edge case (#163) - Unexpected abstract term application during fully concrete execution (#163)
hevm exec
no longer fails withhevm: No match in record selector smttimeout
- the
gas
,gaslimit
,priorityfee
, andgasprice
cli options are now respected - cleaner formatting for the gas value in the visual debugger
- we now build with ghc 9.2.4 by default
- various perf improvements for concrete execution (#157, #152)
The symbolic execution engine has been rewritten. We have removed our dependency on sbv, and now symbolic execution decompiles bytecode into a custom IR, and smt queries are constructed based on the structure of the term in this IR.
This gives us much deeper control over the encoding, and makes custom static analysis and simplification passes much easier to implement.
The symbolic execution engine is now parallel by default, and will distribute granular SMT queries across a pool of solvers, allowing analysis to be scaled out horizontally across many CPUs.
more details can be found in the architecuture docs.
The following cli commands have been removed:
abiencode
rlp
flatten
strip-metadata
- Support for solc 0.8.10
- Support for solc 0.8.11
- Clearer display for the invalid opcode (
0xfe
) in debug view - Better error messages when trying to deploy unlinked bytecode
bytesX
arguments tohevm abiencode
are automatically padded
- 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
- Support for 0.8.4 custom error types in stack traces
- Contract feching happens synchronously again.
- Invariants checked before calling methods from targetContracts.
- The block gas limit and basefee are now correctly fetched when running tests via rpc
- Updated to London hard fork!
- The configuration variable
DAPP_TEST_BALANCE_CREATE
has been renamed toDAPP_TEST_BALANCE
- Default
smttimeout
has been increased to 1 minute. - A new flag has been added to hevm (
--ask-smt-iterations
) that controls the number of iterations at which the symbolic execution engine will stop eager evaluation and begin to query the smt solver whether a given branch is reachable or not. - Contract fetching now happens asynchronously.
- Fixed no contract definition crashes
- Removed NoSuchContract failures
- A new test runner for checking invariants against random reachable contract states.
hevm symbolic
can search for solc 0.8 style assertion violations, and a new--assertions
flag has been added allowing users to customize which assertions should be reported- A new cheatcode
ffi(string[])
that executes an arbitrary command in the system shell
- Z3 is once again the default smt solver
- Updated nixpkgs to the
21.05
channel
- Sourcemaps for contracts containing
immutable
are now shown in the debug view.
- Updated to Berlin! Conformant with GeneralStateTests at commit hash
644967e345bbc6642fab613e1b1737abbe131f78
.
- ADDMOD and MULMOD by zero yields zero.
- Address calculation for newly created contracts.
- Accomodated for the notorious "anomolies on the main network" (see yellow paper Appendix K for trivia)
- A hevm crash when debugging a SELFDESTRUCT contract.
- Two new cheatcodes were added:
sign(uint sk, bytes message)
andaddr(uint sk)
. Taken together these should allow for much more ergonomic testing of code that handles signed messages. - Symbolic execution can deal with partially symbolic bytecode, allowing for symbolic constructor arguments to be given in tests.
- Fixed a bug in the abiencoding.
- Fixed the range being generated by ints.
hevm flatten
combines the SPDX license identifiers of all source files.
- updated
nixpkgs
to the20.09
channel - Arbitrary instance of AbiType can no longer generate a tuple
- hevm cheatcodes now accept symbolic arguments, allowing e.g. symbolic jumps in time in unit tests
- More efficient arithmetic overflow checks by translating queries to a more intelligent form.
hevm
now accepts solidity json output built via--standard-json
as well as--combined-json
.- addresses in the trace output are prefixed with
ContractName@0x...
if there is a corresponding contract and@0x...
otherwise.
- Symbolic execution now generates calldata arguments restricted to the proper ranges, following the semantics of fuzzing.
- If the
--address
flag is present inhevm exec
orhevm symbolic
, it overrides the contract address at which a contract will be created. - Address pretty printing
- Updated sbv to
8.9.5
to fix "non-const in array declaration" cvc4 issue with ds-test.
- Use cvc4 as default smt solver
- The default smttimeout has been increased from 20s to 30s
- Counterexamples from symbolic tests now show clearer failure reasons
- Symbolic tests now work with RPC
- Branch selection is working again in the interactive debugger
- A
--show-tree
option tohevm symbolic
which prints the execution tree explored. - Some symbolic terms are displayed with richer semantic information, instead of the black box
<symbolic>
. hevm dapp-test
now supports symbolic execution of test methods that are prefixed withprove
orproveFail
- The
hevm interactive
alias has been removed, as it is equivalent tohevm dapp-test --debug
hevm dapp-test --match
now matches on contract name and file path, as well as test name- Step through the callstack in debug mode using the arrow keys
dapp-test
trace output now detects ds-note events and showsLogNote
- create addresses are shown with
@<address>
in the trace DSTest.setUp()
is only run if it exists, rather than failing- support new ds-test
log_named_x(string, x)
(previously bytes32 keys) - return arguments are fully displayed in the trace (previously only a single word)
- return/revert trace will now show the correct source position
- z3 updated to 4.8.8
- optimize SMT queries
- More useful trace output for unknown calls
- Default to on chain values for
coinbase
,timestamp
,difficulty
,blocknumber
when rpc is provided - Perform tx initialization (gas payment, value transfer) in
hevm exec
,hevm symbolic
andhevm dapp-test
.
- TTY commands
P
andc-p
for taking larger steps backwards in the debuger. --cache
flag fordapp-test
,exec
,symbolic
,interactive
, enabling caching of contracts received by rpc.load(address,bytes32)
cheat code allowing storage reads from arbitrary contracts.
- Switched to PVP for version control, starting now at
0.41.0
(MAJOR.MAJOR.MINOR). - z3 updated to 4.8.7
- Generate more interesting values in property based testing, and implement proper shrinking for all abi values.
- Fixed soundness bug when using KECCAK or SHA256 opcode/precompile
- Fixed an issue in debug mode where backstepping could cause path information to be forgotten
- Ensure that pathconditions are consistent when branching, and end the execution with VMFailure: DeadPath if this is not the case
- Fixed a soundness bug where nonzero jumpconditions were assumed to equal one.
- default
--smttimeout
changed from unlimited to 20 seconds hevm symbolic --debug
now respects--max-iterations
hevm exec --trace
flag to dump a trace- Faster backstepping in interactive mode by saving multiple snapshot states.
- Support for symbolic storage for multiple contracts
- hevm is now capable of symbolic execution!
As a result, the types of several registers of the EVM have changed to admit symbolic values as well as concrete ones.
-
state.stack:
Word
->SymWord
. -
state.memory:
ByteString
->[SWord 8]
. -
state.callvalue:
W256
->SymWord
. -
state.caller:
Addr
->SAddr
. -
state.returndata:
ByteString
->[SWord 8]
. -
state.calldata:
ByteString
->([SWord 8], (SWord 32))
. The first element is a list of symbolic bytes, the second is the length of calldata. We havefst calldata !! i .== 0
for allsnd calldata < i
. -
tx.value:
W256
->SymWord
. -
contract.storage:
Map Word Word
->Storage
, defined as:
data Storage
= Concrete (Map Word SymWord)
| Symbolic (SArray (WordN 256) (WordN 256))
deriving (Show)
New cli commands:
hevm symbolic
: search for assertion violations, or step through a symbolic execution in debug mode.hevm equivalence
: compare two programs for equivalence.
See the README for details on usage.
The new module EVM.SymExec
exposes several library functions dealing with symbolic execution.
In particular,
SymExec.interpret
: implements an operational monad script similar toTTY.interpret
andStepper.interpret
, but returns a list of final VM states rather than a single VM.SymExec.verify
: takes a prestate and a postcondition, symbolically executes the prestate and checks that all final states matches the postcondition.
The concrete versions of a lot of arithmetic operations, replaced with their more general symbolic counterpart.
- Exposes abi encoding to cli
- Added cheat code
hevm.store(address a, bytes32 location, bytes32 value)
- Removes
ExecMode
, always running asExecuteAsBlockchainTest
. This means thathevm exec
now finalizes transactions as well. --code
is now entirely optional. Not supplying it returns an empty contract, or whatever is stored in--state
.
- Exposes metadata stripping of bytecode to the cli:
hevm strip-metadata --code X
. 357. - Fixes a bug in the srcmap parsing introduced in 0.37 356.
- Fixes a bug in the abi-encoding of
bytes
with size > 32358.
- Sourcemap parser now admits
solc-0.6.0
compiled.sol.json
files.
- Implement Istanbul support 318
- Fix a bug introduced in 280 of rlp encoding of transactions and sender address 320.
- Make InvalidTx a fatal error for vm tests and ci.
- Suport property based testing in unit tests. 313 Arguments to test functions are randomly generated based on the function abi. Fuzz tests are not present in the graphical debugger.
- Added flags
--replay
and--fuzz-run
tohevm dapp-test
, allowing for particular fuzz run cases to be rerun, or for configuration of how many fuzz tests are run. - Correct gas readouts for unit tests
- Prevent crash when trying to jump to next source code point if source code is missing
- Merkle Patricia trie support 280
- RLP encoding and decoding functions 280
- Extended support for Solidity ABI encoding 259
- Bug fixes surrounding unit tests and gas accounting (https://github.com/dapphub/dapptools/commit/574ef401d3e744f2dcf994da056810cf69ef84fe, https://github.com/dapphub/dapptools/commit/5257574dd9df14edc29410786b75e9fb9c59069f)
- handle new solc bzzr metadata in codehash for source map
- show VM hex outputs as hexadecimal
- rpc defaults to latest block
hevm interactive
:- fix rpc fetch
- scrollable memory pane
- Fix regression in VMTest compliance.
hevm exec
ergonomics:- Allow code/calldata prefixed with 0x
- create transactions with specific caller nonce
- interactive help pane
- memory pane scrolling
- Full compliance with the General State Tests (with the BlockchainTest format), using the Yellow and Jello papers as reference, for Constantinople Fix (aka Petersburg). Including:
- full precompile support
- correct substate accounting, including touched accounts, selfdestructs and refunds
- memory read/write semantics
- many gas cost corrections
- Show more information for non solc bytecode in interactive view (trace and storage)
- Help text for all cli options
- Enable
--debug
flag inhevm dapp-test
- Fix dapp-test nonce initialisation bug
- Precompiles: SHA256, RIPEMD, IDENTITY, MODEXP, ECADD, ECMUL, ECPAIRING, MODEXP
- Show the hevm version with
hevm version
- Interactive mode:
- no longer exits on reaching halt
- new shortcuts: 'a' / 'e' for start / end
- allow returning to test picker screen
- Exact integer formatting in dapp-test and tty
- Adjustable verbosity level for
dapp-test
with--verbose={0,1,2}
- Working stack build
- Significant jump in compliance with client tests
- Add support for running GeneralStateTests
- Fix delegatecall gas metering, as reported in dapphub/dapptools#34
- Fix hevm flatten issue related to SemVer ranges in Solidity version pragmas
- Format Solidity Error(string) messages in trace
- Add SHL, SHR and SAR opcodes
- Fix STATICCALL for precompiled contracts
- Assume Solidity 0.5.2 in tests
- Show passing test traces with --verbose flag
- Simple memory view in TTY
- Fix Hackage package by including C header files for ethjet
- Parse constructor inputs from Solidity AST
- Enable experimental 'cheat' address, allowing for modification of the EVM environment from within the tests. Currently just the block timestamp can be adjusted.
- Semigroup/Monoid fix
- Move ethjet into hevm
- Fix SDIV/SMOD definitions for extreme case
- Improve PC display in TTY
- Implement STATICCALL
- Require specific block number for RPC debugging
- Implement RETURNDATACOPY and RETURNDATASIZE
- Fix bug where created contracts didn't get their balance
- More useful RPC debugging because we strip the entire BZZR metadata
- Experimental new ecrecover implementation via libethjet
- Correct error checking for setUp() invocations
- Test name regex matching via --match
- Fixed source map parsing bug when used with solc --optimize
- TTY: fix a padding-related display glitch
0.12 - 2017-11-14
-
Use 13 different environment variables to control block parameters for unit testing, e.g. block number, timestamp, initial balance, etc.
Full list:
DAPP_TEST_ADDRESS
DAPP_TEST_CALLER
DAPP_TEST_ORIGIN
DAPP_TEST_GAS_CREATE
DAPP_TEST_GAS_CALL
DAPP_TEST_BALANCE_CREATE
DAPP_TEST_BALANCE_CALL
DAPP_TEST_COINBASE
DAPP_TEST_NUMBER
DAPP_TEST_TIMESTAMP
DAPP_TEST_GAS_LIMIT
DAPP_TEST_GAS_PRICE
DAPP_TEST_DIFFICULTY
0.11.5 - 2017-11-14
- Use --state with --exec --debug
0.11.4 - 2017-11-12
- Fix bug when unit test contract has creations in constructor
0.11.3 - 2017-11-08
- Fix array support in ABI module
0.11.2 - 2017-11-04
- TTY: show a help bar with key bindings at the bottom
0.11.1 - 2017-11-02
- TTY: fix a display glitch
- TTY: improve display of ABI hashes on the stack
0.11 - 2017-10-31
- Add "hevm flatten" for Etherscan-ish source code concatenation
- Simplify code by removing concrete/symbolic machine abstraction
0.10.9 - 2017-10-23
- Fix bugs in ABI formatting
0.10.7 - 2017-10-19
- Fix library linking bug
- Fix gas consumption of DELEGATECALL
- Better error tracing
- Experimental "contract browser" (stupid list of addresses)
0.10.6 - 2017-10-19
- Enable library linking for unit tests and debugger
- Use the same default gas/balance values as
ethrun
0.10.5 - 2017-10-17
- Better trace output including arguments and return values
- Proof of concept coverage analysis via
dapp-test --coverage
0.10 - 2017-10-10
- Enable new trace output by default for failing tests
- Exit with failure code from test runner when tests fail
- More fixes to improve Ethereum test suite compliance
0.9.5 - 2017-10-06
- Prototype of new trace output with
hevm dapp-test --verbose
- Nicer trace tree in the TTY debugger
- Many fixes to improve Ethereum test suite compliance
0.9 - 2017-09-29
- Integrates with live chains via RPC (read-only)
- Exposes a special contract address with test-related functionality (time warp)
0.8.5 - 2017-09-22
- Renames
hevm
from its maiden namehsevm
✨
0.8 - 2017-09-21
- Implements gas metering (Metropolis rules by default)
- Shows gas counter in the terminal interface
- Enables debugger for consensus test executions
- Consensus test runner script with HTML reporting
- Passes 564 of the
VMTests
; fails 115 (see 0.8 test report) - Command line options for specifying initial gas amounts and balances
- Improved TTY UI layout
0.7 - 2017-09-07
- Can save and load contract states to disk using a Git-backed store (only
--exec
) - Can debug raw EVM bytecode using
exec --debug
- Fixes
exec --value
- Has smarter defaults for command line when running tests or debugging
- Fixes bug with
MSIZE
inCALL
context
0.6.5 - 2017-09-01
- Fixes
exec
with regards to exit codes and error messages
0.6.1 - 2017-08-03
- TTY: Adds command
C-n
in TTY for "stepping over"
0.6 - 2017-08-03
- TTY: Adds second line to stack entries with humanized formatting
- TTY: Gets rid of the separate log pane in favor of a unified trace pane
0.5 - 2017-08-02
- TTY: Adds
p
command for stepping backwards - Adds ability to track origins of stack and heap words
- Tracks Keccak preimage for words that come from the
SHA3
instruction
0.4 - 2017-07-31
- Parallelizes unit test runner
- Improves speed by changing representation of memory
- Internal refactoring for future support of symbolic execution
- Adds logs to the trace pane
0.3.2 - 2017-06-17
- Adds
REVERT
opcode - Sets
TIMESTAMP
value to1
in unit tests
0.3.0 - 2017-06-14
- Reverts contract state after
CALL
fails - Improves test runner console output
0.2.0 - 2017-06-13
- Fixes bug in
CALL
0.1.0.1 - 2017-03-31
- Highlights Solidity exactly on character level
- Adds
N
command for stepping by Solidity source position instead of by opcode
- First release