types: Reject non canonical addresses in DecodeAddress#595
Merged
Conversation
algochoi
commented
Aug 21, 2023
| // Checksum is good, copy address bytes into output | ||
| copy(a[:], addressBytes) | ||
|
|
||
| // Check if address is canonical |
Contributor
Author
There was a problem hiding this comment.
winder
approved these changes
Aug 22, 2023
tzaffi
approved these changes
Aug 22, 2023
Contributor
tzaffi
left a comment
There was a problem hiding this comment.
Approving as this looks very good.
Minor nit: consider modding "correct, and ..." to "correct and canonical, and ..." in the function comment.
tzaffi
reviewed
Aug 22, 2023
| // DecodeAddress turns a checksum address string into an Address object. It | ||
| // checks that the checksum is correct, and returns an error if it's not. | ||
| // checks that the checksum is correct and whether the address is canonical, | ||
| // and returns an error if it's not. |
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.
Checks that the address to decode is a canonical representation (least significant bit is 00, i.e. the ending character is one of "AEIMQUY4"). Adds a test to check that non-canonical addresses are rejected.
Note that the server (and most goal commands) will reject non-canonical addresses, but our SDK clients don't seem to check this.
Closes #274