Skip to content

fix: interpret 0x as hex in bytes encodeField#354

Merged
legobeat merged 4 commits intoMetaMask:mainfrom
legobeat:test-bytes-0x
Nov 20, 2023
Merged

fix: interpret 0x as hex in bytes encodeField#354
legobeat merged 4 commits intoMetaMask:mainfrom
legobeat:test-bytes-0x

Conversation

@legobeat
Copy link
Copy Markdown
Contributor

@legobeat legobeat commented Nov 20, 2023

Related

OGPoyraz
OGPoyraz previously approved these changes 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',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

Copy link
Copy Markdown
Contributor Author

@legobeat legobeat Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Gudahtt
Gudahtt previously approved these changes Nov 20, 2023
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@legobeat legobeat dismissed stale reviews from Gudahtt and OGPoyraz via 2984288 November 20, 2023 19:09
@legobeat legobeat requested review from Gudahtt and OGPoyraz November 20, 2023 19:10
@legobeat legobeat requested a review from a team November 20, 2023 23:12
Copy link
Copy Markdown

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legobeat legobeat merged commit 3f13571 into MetaMask:main Nov 20, 2023
@legobeat legobeat mentioned this pull request Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different signTypedData results between 5.1.0 and 6.0.1

4 participants