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

[Bug]: Custom errors with interfaces are not supported #1173

Closed
Tracked by #1252
axic opened this issue Apr 16, 2022 · 4 comments
Closed
Tracked by #1252

[Bug]: Custom errors with interfaces are not supported #1173

axic opened this issue Apr 16, 2022 · 4 comments
Labels
bug Something isn't working High Priority

Comments

@axic
Copy link

axic commented Apr 16, 2022

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 axic added the bug-candidate Bugs reports that are not yet confirmed label Apr 16, 2022
@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels Apr 16, 2022
@0xalpharush
Copy link
Contributor

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

@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Custom errors with interfaces are not supported [Bug]: Custom errors with interfaces are not supported Apr 16, 2022
@montyly
Copy link
Member

montyly commented Apr 27, 2022

Tested with 0.8.3 - this is still present

@0xalpharush
Copy link
Contributor

0xalpharush commented Jul 6, 2022

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.

if t:
found = re.findall("[struct|enum|function|modifier] \(([\[\] ()a-zA-Z0-9\.,_]*)\)", t)
assert len(found) <= 1
if found:
value = value + "(" + found[0] + ")"
value = filter_name(value)

@montyly
Copy link
Member

montyly commented Aug 17, 2022

Hi @axic , we fixed it with #1349, and the fix will be available in the upcoming release (same for #1173)

@montyly montyly closed this as completed Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working High Priority
Projects
None yet
Development

No branches or pull requests

3 participants