fix: interpret 0x as hex in bytes encodeField#354
Merged
legobeat merged 4 commits intoMetaMask:mainfrom Nov 20, 2023
Merged
Conversation
be9e21f to
2174b6a
Compare
OGPoyraz
previously approved these changes
Nov 20, 2023
Gudahtt
reviewed
Nov 20, 2023
| '0xa22cb465000000000000000000000000a9079d872d10185b54c5db2c36cc978cbd3f72b70000000000000000000000000000000000000000000000000000000000000001', // even number of characters hex string with value greater than MAX_SAFE_INTEGER | ||
| MAX_SAFE_INTEGER_AS_HEX, | ||
| MAX_SAFE_INTEGER_PLUS_ONE_CHAR_AS_HEX, | ||
| '0x', |
Member
There was a problem hiding this comment.
Nit: Might also be a good idea to test an empty string. The fact that the encoding was the same as for '0x' helped me understand what was happening here.
0x0 might be a nice test case as well 🤔
Contributor
Author
There was a problem hiding this comment.
Empty string is supposed to be breaking as of #315 (but we could add that too according to current)
Added test for and verified consistency of results of 0x0, though.
2174b6a to
2984288
Compare
the snapshot matches pre-v6 behavior, which was changed in MetaMask#319.
2984288 to
51e131d
Compare
mcmire
approved these changes
Nov 20, 2023
There was a problem hiding this comment.
Reviewed differences between ethjs-util (previous package) and @metamask/utils (new package):
- https://github.com/ethjs/ethjs-util/blob/e9aede668177b6d1ea62d741ba1c19402bc337b3/src/index.js#L180
- https://github.com/MetaMask/utils/blob/031c81462c67ea52b675492ed4c6cbc906e94e53/src/hex.ts#L11
This fix makes sense.
Merged
14 tasks
This was referenced Nov 22, 2023
Merged
3 tasks
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.
ethereumjs-abifor@metamask/abi-utils#319v5.1.0.Related