-
-
Notifications
You must be signed in to change notification settings - Fork 793
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
Fix/disallow nonreentrant decorator on constructor #2426
Fix/disallow nonreentrant decorator on constructor #2426
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2426 +/- ##
=======================================
Coverage 85.47% 85.48%
=======================================
Files 91 91
Lines 9027 9030 +3
Branches 2151 2152 +1
=======================================
+ Hits 7716 7719 +3
Misses 806 806
Partials 505 505
Continue to review full report at Codecov.
|
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.
hmmm ... so I could see the case of highlighting either or, but I think for new users in particular, highlighting the decorator will be more clear (even though the message on the exception states it's not allowed on the constructor) In any case, tl;dr -> I'll switch it to highlight the decorator instead |
I looked briefly at how one would do this and I'm not sure it's worth the refactoring work. Can you take a look and try to make a judgment call on whether it's worth it? |
Otherwise -- if we highlight the function signature line, not really the end of the world |
Simply catch usage of the nonreentrant decorator on __init__ when the ContractFunction object is being generated during module validation. Specifically just add an additional if clause checking if node.name == __init__, during the nonreentrant decorator checks. Now correctly highlights the decorator instead of the __init__ function.
84001e3
to
3a89723
Compare
oh lol, I just moved the logic over to the contract function generation, when we do the nonreentrant usage validation |
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.
that was easy. thanks!
What I did
Simple fix in module level validation. When visiting all the functions, just check if the constructor has the nonreentrant attribute set to a value other than
None
.Fix: #1755
How I did it
Added a check in the module validation stage.
How to verify it
Description for the changelog
Cute Animal Picture