Use decode_all for decoding cross contract call result#1810
Merged
Use decode_all for decoding cross contract call result#1810
decode_all for decoding cross contract call result#1810Conversation
SkymanOne
reviewed
Jun 15, 2023
Contributor
SkymanOne
left a comment
There was a problem hiding this comment.
Looks good, but why can't we have the same generic integration test for the delegate call?
Codecov Report
@@ Coverage Diff @@
## master #1810 +/- ##
==========================================
+ Coverage 52.11% 52.16% +0.04%
==========================================
Files 206 206
Lines 6656 6656
==========================================
+ Hits 3469 3472 +3
+ Misses 3187 3184 -3 see 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to GHSA-853p-5678-hv8f.
decodecan still succeed if there are bytes remaining. In the above security advisory the issue was that the bytes forResult<T>were successfully decoded into aTbut with the incorrect value, becauseResultencoding has an extra byte prefix.If we had been using
decode_allinstead, which fails if there are any bytes remaining in the input, this would have been discovered earlier.This provides an extra level of safety since it avoids e.g. truncation of values: preventing e.g. an
i32returned by the callee being decoded into ani8(seeintegration-testas part of this PR).Note there are other uses of
decodewhich could be replaced bydecode_all(see #1804), but we can tackle those separately.