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

Call nodes should include full function signature and return type #3581

Open
0xalpharush opened this issue Aug 30, 2023 · 2 comments
Open

Call nodes should include full function signature and return type #3581

0xalpharush opened this issue Aug 30, 2023 · 2 comments

Comments

@0xalpharush
Copy link

Version Information

  • vyper Version (output of vyper --version): 0.3.7
  • OS: osx
  • Python Version (output of python --version):

What's your issue about?

Call nodes only have an identifier name as opposed to a function signature and return type. Vyper should enrich the AST during semantic analysis with this info as it will allow tools to accurately represent Vyper without reimplementing any internal details of the compiler.

Case 1:
Some builtins are essentially generic functions such as empty and convert. Maybe these can be "monomorphized" and included in the AST similar to #3576

Case 2:

@external
@payable
def foo(_target: address) -> Bytes[32]:
    success: bool = False
    response: Bytes[32] = b""
    response = raw_call(_target, method_id("someMethodName()"), max_outsize=32)
    success, response = raw_call(_target, method_id("someMethodName()"), max_outsize=32, revert_on_failure=False)
    success = raw_call(_target, method_id("someMethodName()"), max_outsize=0, revert_on_failure=False)
    return response

Here, one has to track the value of max_outsize and revert_on_failure to infer the return value. In this case, adding the resolved function signature and return type like raw_call(..) returns (bool), raw_call(..) returns (bool,bytes32), or raw_call(..) returns (bytes32) would help.

Case 3:
Referring to the example in #3580, the return type of Test(x).foo() should be (int128, uint256) and not (int128, int128) but the AST only indicates that foo was called. Instead of tools reimplementing Vyper's semantic analysis to correctly resolve this ambiguity, the info should be included in the final AST.

How can it be fixed?

Fill this in if you know how to fix it.

@0xalpharush
Copy link
Author

I would add to this that the default args of calls (builtins and others, too) should also be included so that those don't have to be recovered

@charles-cooper
Copy link
Member

@0xalpharush is this fixed by #3829?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants