slither icon indicating copy to clipboard operation
slither copied to clipboard

[Bug]: Custom errors with interfaces are not supported

Open axic opened this issue 3 years ago • 3 comments

Describe the issue:

Custom errors which have contracts/interface types as arguments are not support properly.

Code example to reproduce the issue:

interface K {
}

interface I {
  error SomethingSomething(K k);
}

abstract contract A is I {
}

contract B is A {
  function f() external {
    revert SomethingSomething(K(address(0)));
  }
}

Also note that Solidity accepts:

interface I {
  error SomethingSomething(I i);
}

And that will also result in the same issue in slither.

Version:

0.8.2

Relevant log output:

Missing function Variable not found: SomethingSomething(K) (context B)

axic avatar Apr 16 '22 20:04 axic

Thanks for reporting this. I get the same error on dev, too.

0xalpharush avatar Apr 16 '22 20:04 0xalpharush

Tested with 0.8.3 - this is still present

montyly avatar Apr 27 '22 08:04 montyly

This works fine for address types but not for contract types. The AST produced for error SomethingSomething(this) is different than if it was an address type. https://github.com/crytic/slither/blob/db703d82f4876e30f1ca10fb78d85b4dd4c31ec1/slither/solc_parsing/expressions/expression_parsing.py#L447-L453

0xalpharush avatar Jul 06 '22 01:07 0xalpharush

Hi @axic , we fixed it with #1349, and the fix will be available in the upcoming release (same for https://github.com/crytic/slither/issues/1173)

montyly avatar Aug 17 '22 12:08 montyly