-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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.
joncinque
left a comment
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. |
CriesofCarrots
left a comment
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
u64values 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
boolvaluefalseshould be a single 0 byte but this get removed.0x100u64has its last byte removed.Summary of Changes
Do not remove trailing 0 bytes. There is no need for this.
Fixes #31391