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

Wrong InvalidLiteral raise for checksum issues #3611

Open
pcaversaccio opened this issue Sep 19, 2023 · 1 comment · May be fixed by #3621
Open

Wrong InvalidLiteral raise for checksum issues #3611

pcaversaccio opened this issue Sep 19, 2023 · 1 comment · May be fixed by #3621
Labels
bug - typechecker issue with typechecker bug - UX a bug related to UX

Comments

@pcaversaccio
Copy link
Collaborator

pcaversaccio commented Sep 19, 2023

Version Information

  • vyper Version (output of vyper --version): 0.3.9
  • OS: linux
  • Python Version (output of python --version): 3.11.3

What's your issue about?

The contract Foo.vy:

# @version ^0.3.9

foo: constant(address) = 0x6b175474e89094c44da98b954eedeac495271d0F

throws with

Error compiling: Foo.vy
vyper.exceptions.InvalidLiteral: Could not determine type for literal value '0x6b175474e89094c44da98b954eedeac495271d0F'
  contract "Foo.vy:3", line 3:25
       2
  ---> 3 foo: constant(address) = 0x6b175474e89094c44da98b954eedeac495271d0F
  --------------------------------^
       4

It should throw with (source):

Address checksum mismatch. If you are sure this is the right address, the correct checksummed form is: 0x6B175474E89094C44Da98b954EedeAC495271d0F

Also, talking about test coverage, the checksum test here is too broad as it doesn't catch this bug.

How can it be fixed?

Fix the error handling for checksum errors.

@charles-cooper
Copy link
Member

Also, talking about test coverage, the checksum test here is too broad as it doesn't catch this bug.

yea, we should fix the type of that exception to be more specific, like class BadChecksumAddress(Exception)

@charles-cooper charles-cooper added bug - UX a bug related to UX bug - typechecker issue with typechecker labels Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - typechecker issue with typechecker bug - UX a bug related to UX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants