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/msg data #2419
Fix/msg data #2419
Conversation
Since the length of msg.data is dynamic, we can't say for sure what it's maxlength is. Even inside of a function with 3 word length arguments, data can still be appended to a function's calldata. So we make length a compile time requirement when using msg.data and slice, and we allow start to be determined at runtime since we don't need it to determine the size of the byte array.
Codecov Report
@@ Coverage Diff @@
## master #2419 +/- ##
==========================================
+ Coverage 84.61% 85.51% +0.89%
==========================================
Files 91 91
Lines 9034 9027 -7
Branches 2151 2151
==========================================
+ Hits 7644 7719 +75
+ Misses 882 804 -78
+ Partials 508 504 -4
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.
Overall looks great, I suggested a couple style/defensive changes.
As an aside, it would be really nice if we could get rid of the copy altogether, and just pass around a pointer to calldata. But that requires some rethinking of how we handle bytestrings (i.e. handling the length section separately from the data section) in general, and at that point we could really revamp slice
-- including the case where the bytestring is in memory.
Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com>
Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com>
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 good. Thanks
What I did
Refactored the msg.data environment variable. Instead of handling each distinctive use case in
expr.py
, uses are handled in the respective functions which operate onmsg.data
.on the return type of the slice function instead of defaulting to the maxsize of msg.data
How I did it
Followed charles' guidance. Mainly just made
msg.data
return an empty LLLnode withlocation='calldata'
, and then handled it in the builtin functionsHow to verify it
The test suite for
msg.data
is unchanged, so passing tests verify this refactoring worked.Description for the changelog
Cute Animal Picture