Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug information can be insufficient #656

Open
ggrieco-tob opened this issue May 1, 2021 · 5 comments
Open

Debug information can be insufficient #656

ggrieco-tob opened this issue May 1, 2021 · 5 comments

Comments

@ggrieco-tob
Copy link
Member

When echidna generates inputs or finds a property failure, it will be nice to have additional information on what Echidna is doing or the state of the contract. Some ideas for this:

  • Show generated function calls (too slow)
  • Show events emitted by generated function calls.
  • Show events emitted by the property failure.
  • Show how and why the property failed (returned false, reverted, self-destruction)
  • Show the state of the contract after a failure (it can be large)
@alexon1234
Copy link

I would be really interested in the last point Show the state of the contract after a failure
Because there are contracts that have methods like function XXX() public returns (uint) { where all the calculation is done using state variables.

If we run echidna to test this method, we won't get much information about the state of the contract when it failed. This information would improve the debugging.

@alexon1234
Copy link

alexon1234 commented May 21, 2021

Hi,
I would like to propose to add the intermediate results of the operations in the coverage file that is generated.
So for example instead of having:

    uint256 internal x;

*   |    function setX(uint256 _x) public {
*   |        x = _x;
    }

    function echidna_check_normalization() public returns (bool) {
        bytes16 z = _denormalize(x);
        unit result = _normalize(z);
        return result == x;
    }

Have something like:

    uint256 internal x;

*   |    function setX(uint256 _x) public {
*   |        x = _x;
    }

    function echidna_check_normalization() public returns (bool) {
        // x = XXXX
        bytes16 z = _denormalize(x);
        // z = XXXXXXXXXXXX
        unit result = _normalize(z);
       // result = XXXXXXXXX
        return result  == x;
    }

@ggrieco-tob
Copy link
Member Author

You mean, when a property fails, right?

@alexon1234
Copy link

alexon1234 commented May 21, 2021

Yes, when the echidna_ function fails.

@rappie
Copy link

rappie commented Dec 8, 2022

Showing events for all calls in the sequence would really help me out.

It is especially useful when using helper functions that modify the value, for example using modulo to get values in a small range. Currently I work around this by storing the modified value by the helper function and logging it in the final call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants