echidna icon indicating copy to clipboard operation
echidna copied to clipboard

Lack of support for function pointers

Open gustavo-grieco opened this issue 3 years ago • 1 comments

Run echidna on this:

pragma solidity ^0.7.1;

contract FunctionArg {

    function echidna_test() external pure returns (bool) {
      return true;
    }

    function ptr(function()external f) public {
        f();
    }
}

will result in:

echidna-test: internal error: method type
CallStack (from HasCallStack):
  error, called at src/EVM/Solidity.hs:339:22 in hevm-0.49.0-GY0kNk5Azi3A3vL1VQ1lX4:EVM.Solidity

which is caused by hevm not parsing correctly that ABI feature.

gustavo-grieco avatar Jul 12 '22 07:07 gustavo-grieco

This will not be fixed in Echidna, instead we will wait until hevm provides supports

gustavo-grieco avatar Sep 09 '22 11:09 gustavo-grieco

Implemented this change at https://github.com/samalws/echidna/tree/fnPtr, won't do an echidna PR until the relevant hevm commit (https://github.com/ethereum/hevm/commit/24a6777d9d2849785add927d423a62b287bf1d2f) is put into an hevm release

samalws avatar Mar 08 '23 18:03 samalws

I've updated hevm here https://github.com/crytic/echidna/pull/986

arcz avatar Mar 18 '23 13:03 arcz