-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
chore: improve error message for non-checksummed address literal #3065
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3065 +/- ##
=======================================
Coverage 88.35% 88.36%
=======================================
Files 97 97
Lines 10968 10974 +6
Branches 2593 2594 +1
=======================================
+ Hits 9691 9697 +6
Misses 827 827
Partials 450 450
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks nice, will take a double check of the functionality later and merge if it looks good
vyper/semantics/validation/utils.py
Outdated
len(expected_type) == 1 | ||
and isinstance(expected_type[0], AddressDefinition) | ||
and len(given_types) == 1 | ||
and isinstance(given_types[0], Bytes20Definition) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit -- because of preconditions earlier in this function, we know that both lists are nonzero. i think it's worth it to slightly generalize this check and remove the len() == 1
checks, because it's easier from a maintenance standpoint to constrain the check if it turns out to be wrong than to relax the constraint.
What I did
QOL improvement for #3062.
When declaring an address literal, the compiler throws an
InvalidType
exception if it is not checksummed. This PR improves the error message by checking if the user meant the checksummed value.How I did it
Add an error message if expected type is address and the only possible type is bytes20.
How to verify it
NA
Commit message
Description for the changelog
Improve error message for non-checksummed address literal
Cute Animal Picture