Skip to content

Complete Echidna refactor to remove the use of Hedgehog properties, simplify code and add missing features#133

Closed
gustavo-grieco wants to merge 45 commits intomasterfrom
dev-no-hedgehog
Closed

Complete Echidna refactor to remove the use of Hedgehog properties, simplify code and add missing features#133
gustavo-grieco wants to merge 45 commits intomasterfrom
dev-no-hedgehog

Conversation

@gustavo-grieco
Copy link
Copy Markdown
Collaborator

@gustavo-grieco gustavo-grieco commented Sep 9, 2018

This PR contains a complete refactoring of the Echidna code to remove the use of Hedgehog properties, simplify code and include some missing features. It was started during the EthBerlin . This PR is not ready to be merged, it should be carefully reviewed before merging it. The main features of this refactoring are:

  • Testing in parallel several properties, once we generated and executed transactions. If it founds a counter-example for a property, it removes that property from the list of properties to test and continue with the others. This allows a massive speed-up if we test a large amount of properties.
  • Easy generation and usage of complete sequences of Ethereum transactions to fuzz, instead of individual calls. This allows to simplify and improve coverage guided testing.

Some interesting side effects of this refactoring:

  • Removed internal Hedgehog modules. We also no longer need MVars to update the coverage tracking.
  • Should be easier to understand and modify by other Haskell programmers (since it no longer requires to understand how Hedgehog executes the unit tests).
  • More control on the allocated memory, since we can easily call the garbage collection at any point of the generation, execution or shrinking.
  • More control on the shrinking: we only implemented a simple global approach to minimize values, but we should be able to remake the code from Hedgehog to restore delta debugging (I believe it's using that).
  • More control on the output of echida: we can easily add or remove stuff since the hedgehog UI is no longer interfering.

We also implemented some missing features:

  • Events emitted by the contracts are printed if Echidna founds a counter-example for a property.
  • Detection of killed and looping contracts. It implements a different type of property fail, a fatal failure. When something really bad happen with the the contract (e.g. it self-destructed), we can say that the checking of all properties will fail. So we stop the execution and show the sequences of transactions that produce the fatal failure.
  • Support for sending transactions with random senders (specified in the config file).
  • Support for sending ether to the constructor of a contract (specified in the config)
  • Support for sending random amounts of ether to payable functions (specified in the config file).
  • Support for avoiding using certain functions (specified in the config file).
  • Automatic collection of distinctive traces for manual inspection (specified in the config file).

Please not that Hedgehog is not removed because the value generation and resizing is certainly useful, but we should be able to delete the internal runner module.

@gustavo-grieco gustavo-grieco changed the title WIP: Remove the use of Hedgehog properties and simplify code Complete Echidna refactor to temove the use of Hedgehog properties, simplify code and add missing features Oct 9, 2018
@gustavo-grieco gustavo-grieco changed the title Complete Echidna refactor to temove the use of Hedgehog properties, simplify code and add missing features Complete Echidna refactor to remove the use of Hedgehog properties, simplify code and add missing features Oct 9, 2018
@japesinator
Copy link
Copy Markdown
Contributor

Superseded by #157

@japesinator japesinator closed this Feb 8, 2019
@dguido dguido deleted the dev-no-hedgehog branch August 22, 2019 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants