Skip to content

Echidna 2.0.0

Compare
Choose a tag to compare
@ggrieco-tob ggrieco-tob released this 11 Feb 17:39
· 352 commits to master since this release
31034fb

Echidna 2.0.0 is a new major release of our fuzzing tool for smart contracts. All users of Echidna should move to version 2.0.0. We will not provide support for older releases.

Major new features

  • Detection of assertion failures in Solidity 0.8.x or greater, including automatic detection of integer overflows, zero division, invalid casts, and more

  • Automatic discovery of maximum values for functions that compute a value (e.g., int256) with --test-mode optimization

  • Automatic integer over- and underflow detection in Solidity 0.8.x or greater with --test-mode overflow. This mode detects integer issues across all functions of the tested contract. It shows inputs that cause under- or overflows without any additional configuration. For instance, it will detect an overflow in this code snippet without outside assistance:

    function f(uint x, uint y) public {
      uint z = x + y;
      ... 
    }
  • Automatic detection of contract destruction using testDestruction (which usually should trigger failures in other tests)

  • Assertion tests using events (e.g., AssertionFailure(...)) are improved to work even if the execution reverts

Enhanced user experience

Echidna now shares why a test failed and what state the contract was in when it failed. Echidna now displays:

  • The cause that triggers a failure in a property or assertion (e.g., a revert in a property test) to help quickly detect unexpected failures in properties
  • A list of events or custom errors collected during the transaction that triggers a failure, which lets users print any state variable or computation using only events

Simplified test configuration

Echidna 2.0.0 features a simplified interface, using a "test mode" to specify the type of tests performed. These are configured via --test-mode (CLI) or testMode (config file):

  • (Default for no arguments) Run user-defined property tests: echidna-test contract.sol --test-mode property
  • Detect integer overflows (Solidity 0.8.x+): echidna-test contract.sol --test-mode overflow
  • Find the maximum value for a function: echidna-test contract.sol --test-mode optimization
  • Execute every line of code without any testing target ("unconstrained execution"): echidna-test contract.sol --test-mode exploration
  • Detect assertion failures (previously checkAsserts): echidna-test contract.sol --test-mode assertion

checkAsserts and benchmarkMode options have been removed.

Changelog

Added

  • Complete support for assertion detection in Solidity 0.8 and greater
  • New testing modes: function optimization
  • New testing mode: Integer under and overflow detection in solc 0.8 and greater
  • Events and cause of failure are now displayed
  • Added a new self-destruction test to check if any contract was destroyed
  • Added a new config option to enable or disabled all self-destruction tests using testDestruction

Removed

  • checkAsserts and benchmarkMode were removed in favor of testMode [BREAKING CHANGE]

Fixed

  • Revert cleans all the events
  • Incorrect handling of negative constants (#636)
  • Incorrect filtering of functions when using assertion mode (#690)
  • Value generation can fail in multi-abi mode (#579)
  • psender and deployer address are changed to be 0x10000 and 0x30000 for readability [BREAKING CHANGE]
  • Upgraded to hevm 0.49

Refactored

  • Refactored campaign and test internal data structures and code
  • Refactored unit test code and moved the related files to the tests directory
  • Refactored UI code