echidna icon indicating copy to clipboard operation
echidna copied to clipboard

feat: more visibility for unsupported cheatcodes (BadCheatCode)

Open 0xPhaze opened this issue 2 years ago • 3 comments

Using unrecognized cheatcodes results in a failure.

import "forge-std/Test.sol";

contract TestContract is Test {
    function test123(uint256 x) public {
        vm.assume(false);
        vm.expectRevert();
    }
}
echidna-test . --contract TestContract --test-mode dapptest --format text --test-limit 100
Analyzing contract: /Users/lain/git/eth/template/test/TestContract.sol:TestContract
echidna-test: VM failed for unhandled reason, BadCheatCode (Just 1281615202). This shouldn't happen. Please file a ticket with this error message and steps to reproduce!

It would be great to know what cheatcode was executed (and perhaps where), as these can be difficult to find in larger codebases. Additionally, maybe unsupported cheatcodes could just be ignored (after printing an error message).

0xPhaze avatar Feb 15 '23 15:02 0xPhaze

Yeah, we should handle it better, thanks for reporting.

arcz avatar Feb 15 '23 15:02 arcz

Cheatcodes can only be hanlded using hevm because they generate a special type of error.

ggrieco-tob avatar Feb 15 '23 16:02 ggrieco-tob

We should print a trace for any VM error, this will show which cheat code was called.

arcz avatar Jun 21 '24 11:06 arcz