-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
bank: do not remove trailing 0 bytes from return data #33639
Conversation
Codecov Report
@@ Coverage Diff @@
## master #33639 +/- ##
=======================================
Coverage 81.8% 81.8%
=======================================
Files 806 806
Lines 217477 217473 -4
=======================================
+ Hits 177999 178006 +7
+ Misses 39478 39467 -11 |
This is creating havoc for Solang, as the return data is borsh encoded and therefore `u64` values like 0x100 get truncated.
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.
This change looks good to me. Since it only affects nodes that record return data, it shouldn't have any impact on consensus, which makes it safe as is.
I honestly can't remember why I thought this was a good idea. Maybe I thought everything was just arrays, so it's impossible to tell how much has been written. But when I look at the originating PR #23688, everything is Vec
there too. So the truncation behavior is only destructive.
I also requested a review from @CriesofCarrots to double-check that this makes sense.
Thank for the review @joncinque! How do you feel about merging it to |
I would prefer to keep it out of 1.16, since that's running mainnet. With 1.17, we give it some time to soak and let people adapt to the upcoming change. |
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 honestly can't remember why I thought this was a good idea.
Maybe concern with space over the wire for RPC calls? 🤷♀️
Anyway, I'm fine with this.
Makes sense. |
This is creating havoc for Solang, as the return data is borsh encoded and therefore `u64` values like 0x100 get truncated. (cherry picked from commit 4751199)
…t of #33639) (#33685) bank: do not remove trailing 0 bytes from return data (#33639) This is creating havoc for Solang, as the return data is borsh encoded and therefore `u64` values like 0x100 get truncated. (cherry picked from commit 4751199) Co-authored-by: Sean Young <[email protected]>
Very happy to see this change, thank you @seanyoung :) |
This is creating havoc for Solang, as the return data is borsh encoded and therefore
u64
values like 0x100 get truncated.Problem
When Solidity returns a borsh encoded return values which end in trailing zeros, then this gets mangled. For example,
a single
bool
valuefalse
should be a single 0 byte but this get removed.0x100u64
has its last byte removed.Summary of Changes
Do not remove trailing 0 bytes. There is no need for this.
Fixes #31391