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

Un-precise Interface Body Check #4122

Closed
ritzdorf opened this issue Apr 1, 2024 · 0 comments · Fixed by #4177
Closed

Un-precise Interface Body Check #4122

ritzdorf opened this issue Apr 1, 2024 · 0 comments · Fixed by #4177

Comments

@ritzdorf
Copy link
Contributor

ritzdorf commented Apr 1, 2024

Version Information

  • vyper Version (output of vyper --version): commit 4b4e188ba83d28b5dd6ff66479e7448e5b925030

Issue description

In interface files (.vyi), function bodies should only contain the AST
Ellipsis node (...). However given how the corresponding check is
done, any statement node with a value field containing an Ellipsis
node can be used in place of the Expr AST node.

if len(funcdef.body) != 1 or not isinstance(funcdef.body[0].get("value"), vy_ast.Ellipsis):
    raise FunctionDeclarationException(
        "function body in an interface can only be `...`!", funcdef
    )

POC

For example, compiling a contract importing the following interface does
not raise any exception:

@external
def foo():
    log ...
@cyberthirst cyberthirst transferred this issue from another repository Jun 10, 2024
@cyberthirst cyberthirst transferred this issue from another repository Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant