crytic/echidna

[Bug-Candidate]: Error when saving corpus for basic truffle project

samalws-tob opened this issue · 5 comments

Describe the issue:

Tried setting up a basic truffle project according to the truffle guides, then placing a basic echidna contract into the contracts folder:
mkdir metacoin; cd metacoin; truffle unbox metacoin; echo "contract Echidna { function echidna_false() public view returns (bool) { return false; } }" >> contracts/Echidna.sol; echidna . --contract Echidna --corpus-dir corpus
Echidna has the following error while saving the corpus:

[2023-05-12 15:30:09.92] Saving test reproducers... Done! (0.000003s)
[2023-05-12 15:30:09.92] Saving corpus... Done! (0.059305s)
echidna: invalid character at offset: 436
CallStack (from HasCallStack):
  error, called at src/EVM/Solidity.hs:524:18 in hevm-0.50.4-6J9JBf5E1KD3EQaWY274vQ:EVM.Solidity

This error message doesn't occur if --corpus-dir corpus is left out.
The corpus dir is created, but the covered. ... .txt file is empty, and no covered. ... .html file is made.
Judging by this issue on crytic-compile, truffle support doesn't seem particularly important and may be dropped anyway.

Code example to reproduce the issue:

mkdir metacoin; cd metacoin; truffle unbox metacoin; echo "contract Echidna { function echidna_false() public view returns (bool) { return false; } }" >> contracts/Echidna.sol; echidna . --contract Echidna --corpus-dir corpus

Version:

$ echidna --version
Echidna 2.1.1
$ slither --version
0.9.2

Relevant log output:

[2023-05-12 15:30:09.92] Saving test reproducers... Done! (0.000003s)
[2023-05-12 15:30:09.92] Saving corpus... Done! (0.059305s)
echidna: invalid character at offset: 436
CallStack (from HasCallStack):
  error, called at src/EVM/Solidity.hs:524:18 in hevm-0.50.4-6J9JBf5E1KD3EQaWY274vQ:EVM.Solidity

The metacoin example requires library linking, that will explain why it fails. It will be nice if you can reproduce this issue with hardhat or foundry so we can take a better look.

  • Since hevm is already updated into 0.51.3, this issue can be closed now #1090