-
-
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: storage slot allocation bug #2391
fix: storage slot allocation bug #2391
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2391 +/- ##
==========================================
- Coverage 85.84% 85.75% -0.10%
==========================================
Files 91 91
Lines 9022 9028 +6
Branches 2152 2155 +3
==========================================
- Hits 7745 7742 -3
- Misses 785 790 +5
- Partials 492 496 +4
Continue to review full report at Codecov.
|
Reentrancy key was in the wrong location This also refactors the nonreentrant key allocation so the functionality happens in the same place as global variable allocation.
debf544
to
a09cddd
Compare
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.
Would be nice to see a test or two for this behavior failing
vyper/old_codegen/global_context.py
Outdated
@@ -224,6 +224,7 @@ def add_globals_and_events(self, item): | |||
def parse_type(self, ast_node, location): | |||
return parse_type(ast_node, location, sigs=self._contracts, custom_structs=self._structs,) | |||
|
|||
# TODO this is dead code | |||
def get_nonrentrant_counter(self, key): |
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.
Can we remove this dead code?
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.
I don't want to now just in case it's a larger project
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.
just remove it and push, if it causes CI failures then take it out.
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.
just remove it and push, if it causes CI failures then take it out.
done, see latest commit
The last storage variable was not being tested which is why this slipped by. The reason there was a collision in the last storage variable is because there are holes in the storage allocator left by HashMaps (which is why the slots in global_context and set_data_positions were not matching up).
8c7f7e8
to
a894a33
Compare
Added, rather I fixed the existing test |
ed19124
to
5bcadcf
Compare
This also refactors the nonreentrant key allocation so the functionality
happens in the same place as global variable allocation.
How to verify it
Apply a894a33 to master, see that tests don't pass but they do on this branch
Description for the changelog
Cute Animal Picture