echidna icon indicating copy to clipboard operation
echidna copied to clipboard

Helpful error message when using wrong function signature for echidna property

Open snd opened this issue 4 years ago • 2 comments

pragma solidity ^0.6.12;

contract Test {
    function echidna_a() public view {
    }

    function echidna_b() public view returns (bool) {
        return false;
    }
}

will output:

echidna_a: failed with no transactions made ⁉️  
echidna_b: failed with no transactions made ⁉️  

echidna_b fails because it returns false. echidna_a fails because it doesn't return a bool.

It would be nice to check the signature of echidna_ properties and display a helpful error message for echidna_a that distinguishes its failure from echidna_b. This will reduce confusion for beginners.

On a similar note internal and private echidna_ properties obviously get ignored. It would be nice to get a warning instead of ignoring user mistakes like that.

snd avatar Feb 09 '21 17:02 snd

echidna_b fails because it returns false.

We have a #564 to show more information on why every tested failed.

echidna_a fails because it doesn't return a bool.

This is another issue. Echidna should not allow functions that do not declare any return value as properties.

gustavo-grieco avatar Feb 09 '21 17:02 gustavo-grieco

We have a #564 to show more information on why every tested failed.

When writing echidna_b fails because it returns false it wasn't my intent to criticize the error reporting for echidna_b.

This is another issue. Echidna should not allow functions that do not declare any return value as properties.

That's what I mean with this issue. Currently it's allowed and a beginner might accidentally write such a property. Better to fail with a helpful error message when a user declares properties that don't return bool.

snd avatar Feb 09 '21 19:02 snd