vyper icon indicating copy to clipboard operation
vyper copied to clipboard

Un-precise Interface Body Check

Open ritzdorf opened this issue 2 years ago • 0 comments

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 ...

ritzdorf avatar Apr 01 '24 09:04 ritzdorf