-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Handle return data larger than a word #112
Conversation
When the returned data from a contract call is larger than a word, it isn't stored in `Return.val`, but in `ReturnData.data`. Before the changes in here, we were pulling the data only from `Return.val`, which fortunately handled most cases. Until now, with some methods returning, for instance, a `b256`, which would cause the data to _not_ be in `Return.val` as we expected, leading to errors. This PR introduces some changes to fix this by looking whether the expected return type is larger than a word, if it is, we fetch the returned data from `ReturnData.data` instead of `Return.val`.
@nfurfaro tagging you in this PR because it fixes the issue you found and includes the test cases you used to find the problem. These test cases are now part of the test suite for the SDK. |
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.
LGTM!
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.
Nitpicks
When the returned data from a contract call is larger than a word,
it isn't stored in
Return.val
, but inReturnData.data
.Before the changes in here, we were pulling the data only from
Return.val
, which fortunately handled most cases. Until now,with some methods returning, for instance, a
b256
, which would causethe data to not be in
Return.val
as we expected, leading to errors.This PR introduces some changes to fix this by looking whether the
expected return type is larger than a word, if it is, we fetch the
returned data from
ReturnData.data
instead ofReturn.val
.