slither
slither copied to clipboard
[Bug]: Custom errors with interfaces are not supported
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)
Thanks for reporting this. I get the same error on dev, too.
Tested with 0.8.3 - this is still present
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
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)