This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Fix a regression in decoding of dynamic structs! #2131
Merged
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.
It seems I accidentally broke decoding of dynamic structs in calldata a while back. Probably when I factored out struct decoding; in combining the static and dynamic cases, I left out the
startPosition
argument in the call todecodeAbi
, which is fine in the static case but is very wrong in the dynamic case. Oops.(In the static case, you're always reading the member directly, not a pointer to it, so you don't need to know what base that pointer should be considered relative to, because it's not a pointer at all. In the dynamic case, you may be reading a relative pointer, so you need to know what it's relative to.)
As a check against this happening again, I added an additional (very simple) calldata decoding test to catch this.
Note that in order to make this work I ended up updating the Solidity version used in our debugger tests to 0.5.10. (It was on 0.5.4; dynamic structs in calldata weren't allowed yet in 0.5.4.)