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

enforce that the trailing bits of an address string are standard #28

Merged
merged 1 commit into from Jun 8, 2022

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Jun 7, 2022

Fixes #22

address.go Outdated
@@ -323,6 +323,11 @@ func decode(a string) (Address, error) {
return Undef, err
}

reencodedRaw := AddressEncoding.WithPadding(-1).EncodeToString(payloadcksm)
if reencodedRaw != raw {
return Undef, ErrInvalidChecksum
Copy link
Member

Choose a reason for hiding this comment

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

We should make a new error. The checksum isn't invalid, it's just not a "standard" encoding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was too lazy to do that. Done.

@arajasek arajasek force-pushed the asr/decode-encode branch 2 times, most recently from 9511633 to 75e7600 Compare June 8, 2022 14:23
@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2022

Codecov Report

Merging #28 (58f4b3e) into master (c51d918) will increase coverage by 0.61%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   47.63%   48.24%   +0.61%     
==========================================
  Files           4        4              
  Lines         338      342       +4     
==========================================
+ Hits          161      165       +4     
  Misses        151      151              
  Partials       26       26              
Impacted Files Coverage Δ
constants.go 60.00% <ø> (ø)
address.go 59.10% <100.00%> (+0.61%) ⬆️

@arajasek arajasek merged commit 5fe66c9 into master Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enforce a padding scheme
3 participants