Uh oh!
There was an error while loading. Please reload this page.
docs: clarify isHexChecksumAddress checks shape, not the checksum - #301
Open
gomesalexandre wants to merge 1 commit into
Open
docs: clarify isHexChecksumAddress checks shape, not the checksum#301gomesalexandre wants to merge 1 commit into
gomesalexandre wants to merge 1 commit into
Conversation
isHexChecksumAddress's doc said it checks for a "valid hex checksum address", but it only tests the shape - 0x followed by 40 hex characters, upper- or lower-case (HEX_CHECKSUM_ADDRESS_REGEX). It never verifies the ERC-55 checksum, so a non-checksummed (e.g. all-lowercase) address passes. Correct the JSDoc to describe what it actually validates and point to getChecksumAddress for computing the checksum. No behavior or name change. closesMetaMask#250
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 freeto 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.
closes#250
what
isHexChecksumAddress's doc claims it checks for a "valid hex checksum address", but it only tests the shape -0xfollowed by 40 hex characters, upper- or lower-case (HEX_CHECKSUM_ADDRESS_REGEX = /^0x[0-9a-fA-F]{40}$/u). It never keccak-hashes to verify the ERC-55 checksum, so a non-checksummed (for example all-lowercase) address passes:This matches how the function is actually used - in
getChecksumAddress, to assert the input address has a valid (mixed-case-allowing) shape before computing the checksum.how
Corrects the JSDoc to describe what the function actually validates (shape, allowing the mixed case of a checksummed address) and notes it does not verify the ERC-55 checksum, pointing to
getChecksumAddressfor that. No behavior or name change - a rename/behavior change would be breaking and per the issue thread wants a broader look at how the function is used, so this is scoped to the documentation accuracy the issue calls out.references
Addresses the "and documented" half of #250.
Note
Cursor Bugbot is generating a summary for commit c96211b. Configure here.