Check labels in function calls on self and external contracts#518
Conversation
ef05ebb to
12e03be
Compare
Codecov Report
@@ Coverage Diff @@
## master #518 +/- ##
==========================================
- Coverage 87.93% 87.51% -0.43%
==========================================
Files 80 86 +6
Lines 5306 5550 +244
==========================================
+ Hits 4666 4857 +191
- Misses 640 693 +53
Continue to review full report at Codecov.
|
sbillig
left a comment
There was a problem hiding this comment.
Looks great! validate_arg_types and validate_arg_labels were only separate because I failed to think of a scheme like this. If you were so inclined (no pressure), you could combine the two so that we could not report a type error in the case that the label is incorrect (or maybe just when the labels are in the incorrect order).
I think I don't follow. This will only report label errors because the types are correct but mislabeled: This will report label and type error because they are mislabled and in the wrong order: Isn't that already what we want? I'm going to merge this already but happy to follow up if I understand the intention of the proposed change. Or feel free to send a PR if it's less effort to explain it with the code directly :D |
What was wrong?
As explained in #517, function calls on
selfor external contracts do not check the labels, allowing developers to apply any kind of label and in the worst case leave the user with the impression that they could use labels to call functions with the arguments ordered as they wish (which isn't the case).How was it fixed?
Added checks in the analyzer and added tests.