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

Allow __default__ function in interfaces #4399

Open
pcaversaccio opened this issue Dec 16, 2024 · 0 comments
Open

Allow __default__ function in interfaces #4399

pcaversaccio opened this issue Dec 16, 2024 · 0 comments
Labels
needs triage needs triage

Comments

@pcaversaccio
Copy link
Collaborator

pcaversaccio commented Dec 16, 2024

Summary

The Vyper compiler currently disallows defining the fallback function __default__() as part of an interface definition. E.g. the following contract will raise with:

# pragma version ~=0.4.0
interface FooBar:
    def __default__() -> uint256: payable

implements: FooBar

@external
@payable
def __default__() -> uint256:
    return msg.value
contracts/Precompile.vy
FunctionDeclarationException:Default functions cannot appear in interfaces

  contract "contracts/Precompile.vy line 3:4 
       2 interface FooBar:
  ---> 3     def __default__() -> uint256: payable
  -----------^
       4

This can become problematic, if you want to enforce custom interface definitions (e.g. my snekmate timelock_controller could be transformed into an interface, which would require __default__() to be complete). There might also be some EIPs or future EIPs that require this. We should discuss here if we should lift this restriction or not.

@pcaversaccio pcaversaccio added the needs triage needs triage label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage needs triage
Projects
None yet
Development

No branches or pull requests

1 participant