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.
What I did
Address two issues reported in #963
0xEAA081a9fad4607CdF046fEA7D4BF3DfEf533282
)0x0b8f12b1788BFdE65Aa1ca52E3e9F3Ba401be16D
)Closes #963
How I did it
The compilation issue stems from an incorrect-length
sourceMap
output from the Solidity compiler. I'm not sure when/why this happens but sometimes the source map extends beyond the length of the actual bytecode. These final instructions appear to always have no related contact (the 3rd value within the source map). As such, to fix I trim all source map data from the right side, so long as it maps to contract id-1
(no contract). It's hacky and probably some edge case will appear, but.. such is the reality when working with Solidity.The implementation issue is due to a regression in Ganache
v6.12.2
where calls toeth_getStorageAt
do not return leading zero bytes. To fix it, I do[-20:]
instead of[12:]
which has the same effect on a 32 byte hex string while correctly handling the 20 byte hex returned in that specific ganache version.Thanks to @poolpitako for helping me find all this.
How to verify it
Hope and pray nothing else breaks.