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: imported contracts are not fully semantically validated #3512

Closed
tserg opened this issue Jul 19, 2023 · 1 comment
Closed

bug: imported contracts are not fully semantically validated #3512

tserg opened this issue Jul 19, 2023 · 1 comment

Comments

@tserg
Copy link
Collaborator

tserg commented Jul 19, 2023

Version Information

  • vyper Version (output of vyper --version): 9e3b9a2
  • OS: linux
  • Python Version (output of python --version): 3.10.4

What's your issue about?

When a contract is imported, only the function signatures are semantically checked to produce the InterfaceT. Contract A can therefore import another contract B that does not compile, but Contract A would compile as long as the signatures of the imported functions of Contract B are semantically correct.

# Contract A
# a.vy
import b as B

@external
def foo(addr: address):
    x: B = B(addr)
    x.foo() 
# Contract B
# b.vy
@external
def foo():
    x: uint256 = "foo"

h/t @trocher

How can it be fixed?

Fill this in if you know how to fix it.

@charles-cooper
Copy link
Member

charles-cooper commented Dec 31, 2023

this was fixed in #3663. compiling a.vy now raises an exception:

Error compiling: a.vy
vyper.exceptions.InvalidType: Expected uint256 but literal can only be cast as String[3].
  contract "b.vy:5", function "foo", line 5:17 
       4 def foo():
  ---> 5     x: uint256 = "foo"
  ------------------------^
       6

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