Echidna Versions Save

Ethereum smart contract fuzzer

v2.0.1

2 years ago

This release adds support for dapp/foundry properties, improves the input generation and fixes multiple minor bugs.

Echidna supports writing properties/invariants using three different APIs:

function echidna_property() public returns (bool) { // A specially named function with no arguments is required
    // The following statement can trigger a failure depending on the returned value. Reverts will force a failure
    return ..;
} // side effects are *not* preserved

function checkInvariant(..) public { // A function with any number of arguments is supported using "--testMode assertion"
    assert(..); 
    // The following statement will always trigger a failure
    emits AssertionFailure(..);    
} // side effects are preserved

function checkDappTest(..) public { // A function with one or more arguments are required using "--testMode dapptest"
    // Any revert will cause a failure, otherwise it passes
    ...
} // side effects are preserved (but usually this runs in stateless mode)

Every testing mode can be stateful (by default) or stateless (using --seqLen 1). Review our documentation for more details on how to use these APIs and the difference between stateful and stateless fuzzing.

Added

  • New testing mode: "dapptest" to run foundry and dapptool fuzz tests (#733, #745) (see an example here)
  • Generate more values closer to the maximum (#736)

Fixed

  • Expanded and improved command-line help (#741)
  • Fixed TERMINFO path for Nix release builds (#731)
  • Mitigated large memory consumption when replaying corpus (#725)
  • Fixed --shrink-limit to change shrink limit instead of test limit (#728)
  • Correctly show lines with multiple types of coverage
  • Restored nix support (#717, #743)

Removed

  • Optimized stateless fuzzing removing some specific mutators (#747)

v2.0.0

2 years ago

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

v1.7.3

2 years ago

This is a small release with some minor bugfixes and quality of life improvements. User facing changes include:

  • removal of old compilation artifacts before starting another campaign
  • fixed incorrect function filtering in assertion mode
  • improved handling of negative constants
  • fixed source line printing within coverage

Some less important changes are a version bump to hevm 0.48.0 and some nix improvements regarding slither.

v2.0.0-b2

2 years ago

Echidna 2.0.0 (beta 2) is the second beta release of the new version of our fuzzing tool for smart contracts, which continues with the new features, fixes and breaking changes. This release brings the following new major features:

  • Automatic integer overflow or underflow detection for solc 0.8.x or greater using --test-mode overflow. This mode detects integer issues across all the functions of the tested contract to show inputs cause under or overflows without modifying or adding anything in your code. For instance, it will detect an overflow here:
    function f(uint x, uint y) public {
      uint z = x + y;
      ... 
    }
    
  • Self destruction tests include any contract destruction (and not just the testing one). Additionally, they are disabled by default, making the UI easier to read.

Additionally, the psender and deployer addresses were changed to 0x10000 and 0x30000 respectively to be more readable. Please double check your properties to see if they work as expected.

Added

  • New testing mode: Integer under and overflow detection in solc 0.8 and greater [UNSTABLE FEATURE]
  • Added a new self-destruction test to check if any contract was destroyed.
  • Added new config options to enable or disabled all self-destruction tests using testDestruction [BREAKING CHANGE]

Removed

  • Self-destruction tests are disabled by default. [BREAKING CHANGE]

Fixed

  • psender and deployer address are changed to be 0x10000 and 0x30000, to be more readable [BREAKING CHANGE]
  • Upgraded to hevm 0.48.

v2.0.0-b1

2 years ago

Echidna 2.0.0 (beta 1) is the first beta release of the new version of our fuzzing tool for smart contracts, which brings a number of new features and breaking changes. If you need a stable release right now, please use v1.7.2, otherwise, we encourage everyone to test this new beta.

Echidna 2.0 has the following new major features:

  • Full support for solc 0.8.x or greater to detect assertion failures, including automatic detection of integer overflows, zero division, invalid casts, and others.
  • Assertion tests using events (e.g. AssertionFailure(...)) are improved to work even if the execution reverts.
  • Value optimization tests, where there is a function that computes a value (int256) and Echidna tries to find a maximum.
  • Automatic detection of contract destruction (which usually should trigger failures in other tests).

On top of that, Echidna will show us valuable information regarding why the test is failing and what is the state of the contract when it failed:

  • The cause that triggers a failure in a property or assertion (e.g. a revert in a property test). This allows auditors to quickly detect unexpected failures in properties.
  • The list of events collected during the transaction that trigger a test failure (or that provides the maximum value of a certain function if optimization is used). This allows users to print any state variable or computation just using events.

This new release also features a simplified interface, using a "test mode" to specify what type of tests you want. This can be used directly in the command-line:

  • To test assertions and enable the automatic detection of integer overflows (if solc 0.8.x is used):
echidna-test contract.sol --test-mode assertion 
  • To run a value optimization and find the maximum value in some function:
echidna-test contract.sol --test-mode optimization
  • To run unconstrained exploration mode, where echidna will try to execute every line of code without any testing target:
echidna-test contract.sol --test-mode exploration

Finally, by default, --test-mode is assumed to be property. This new version also removes checkAssertion and benchmarkMode config options. Instead, users should specify testMode in the yaml file which can be one the values previously detailed.

Added

  • Complete support for assertion detection and other in solc 0.8 and greater
  • New testing modes: function optimization [UNSTABLE FEATURE]
  • Events and cause of failure is now displayed [UNSTABLE FEATURE]
  • Automatic detection of destructed contracts

Removed

  • checkAssertion 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)

Refactored

  • Refactored campaign and execution code (#615)
  • Refactored integration test code
  • Refactored UI code [UNSTABLE FEATURE]

v1.7.2

2 years ago

Echidna 1.7.2 is a minor release that brings a variety of fixes and small improvements, including improved command-line options and fixes when using hardhat/brownie to test contracts. It relies on hevm 0.46 for the EVM emulation. This release requires to use crytic-compile 0.2.0 or later but otherwise contains no breaking changes.

Fixed

  • Fixed check-asserts and multi-abi cli switches (#665)
  • Support for loading multiple files with compiled contracts from hardhat/brownie (#659)

Refactored

  • Updated to hevm 0.4.6 (#660)

v1.7.1

3 years ago

Echidna 1.7.1 is a minor release that brings a variety of fixes and small improvements, including better mutations, two new command-line options, --corpus-dir and --check-asserts, correct initialization of new addresses and extended notion of coverage to include EVM frames. This release contains no breaking changes.

Added

  • Documented known issues and limitations (#655)
  • Improved coverage to count number of EVM frames (#624)
  • Added two CLI options: --corpus-dir and --check-asserts (#640)

Fixed

  • Tweaked mutators and improved test stability (#628)
  • Automatically initialize addresses when used (#657)
  • Avoid mutations to generate inputs outside their expected ABI range (#650)
  • Various small fixes to run Vyper contracts (#645)
  • Fixed link to macOS binary in binaries.soliditylang.org (#629)
  • Fixed UI to fit long function calls (#635)
  • Fixed default.nix to use 1.7.0 as version (#623)

Refactored

  • Refactored shrinkSeq to improve readability (#639)
  • Refactored Test type (#622)
  • Refactored coverage types and added corpus size in UI (#627)

v1.7.0

3 years ago

Echidna 1.7.0 is a major release that brings a few major features:

This release also includes several internal refactorings, fixes in our CI tests and improved Nix support. The Echidna team would also like to thank @elopez for their fixes submitted as PRs.

Added

  • Enabled use of coverage by default (#605) [BREAKING CHANGE]
  • More corpus and array mutations implemented (#372)
  • Source coverage is printed after fuzzing campaign (#516)

Fixed

  • Coverage filenames are not overwritten (#620)
  • Nix improvements and fixes (#603, #604, #608, #612)

Refactored

  • Refactored and improved etheno support to be more useful (#615)
  • Refactored the mutator code (#618)
  • Run echidna tests in parallel (#571)
  • Simplified slither information parsing (#543)

v1.6.1

3 years ago

Echidna 1.6.1 is a minor release that, most importantly, allows using compiler metadata to detect which contracts are deployed, avoiding any issues when the bytecode modifies its own code (e.g., when they use the immutable keyword). This release also contains performance optimizations when executing properties, speeding up the testing when the EVM reverts, and lets users be more precise when whitelisting or blacklisting functions by specifying the full contract name and ABI.

The Echidna team would also like to thank @elopez and @KurogeWashu for their fixes submitted as PRs.

Fixed

  • Use a sensible default value for block.gaslimit (#596)
  • Use metadata to detect deployed contracts (#593)
  • Fixed wait bug when shrinking (#584)
  • Small fixes in the macOS CI (#597), the README (#590) and Nix scripts (#581)

Added

  • Semver integration for improving testing with different solc versions (#594)
  • Added some performance improvement in property execution (#576)
  • Added funwithnumbers example from Sabre (#565)
  • Improved function filtering to be more precise (#570) [BREAKING CHANGE]

v1.6.0

3 years ago

Echidna 1.6.0 introduces integration with Slither, now a required dependency for Echidna to function properly. Slither can help Echidna understand the structure of Solidity contracts which we use to explore more interesting code paths. This release also updates hevm to version 0.42, improves shrinking and pretty-printing of results, and includes a variety of bugfixes and refactoring. Finally, the Echidna team would also like to thank @elopez, @erivas, and @bingen for their work on squashing some annoying issues.

Added

  • Remove code size restriction (disable EIP-170) by default. Users can restore it using the codeSize config (#544)
  • Improved shrinking and pretty printing (#518)
  • Integrate slither results (#451) [BREAKING CHANGE]
  • HEVM updated to 150dddc67b6cbad75fd4ae5a689452892f55ea26 (#511)
  • Make stack limit exceeded a revert (#517)
  • Various Github Actions improvements (#527, #554)

Fixed

  • Made sure that gets mapped correctly, fixing #474 (#503)
  • Fix library timestamp/block delay issue (#510)
  • Make large constants work better with dictionaries (#523)
  • Fix "flanky" corpus tests (#537)
  • Fix negative address bug (#552)

Refactored

  • Reorganized MonadState and MonadReader (#545, #513)
  • Multiple code simplification (#548, #549, #513)
  • Add some default transaction constants (#532)