This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
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.
I originally made this change on
type-and-value
, then realized it was worth backporting todevelop
. (I'm setting myself up for a merge conflict, but...)This PR fixes an issue in string decoding by using the
utf8
library to convert Solidity's UTF-8 to Javascript's UTF-16. Note that Solidity does allow malformed UTF-8; in this case, we simply returnnull
. (Note that we detect this case by seeing whetherutf8.decode
throws an error; it doesn't seem to have a check function separate from the decode.)Why
null
rather thanundefined
? To avoid throwing the debugger into an infinite loop in case a mapping key is a malformed string. Yes, this is a bit of a hack, but don't worry, it'll be gone in 5.1; ontype-and-value
we return an object representing the particular malformed string rather than a simple null. But here ondevelop
, without the new output format,null
will have to suffice.