Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Nov 20, 2023

Conversation

legobeat
Copy link
Contributor

@legobeat legobeat commented Nov 20, 2023

Related

OGPoyraz
OGPoyraz previously approved these changes Nov 20, 2023
@@ -253,6 +253,7 @@ const encodeDataExamples = {
'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
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
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
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!

Copy link

@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
16 checks passed
@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