-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
R4R: Reconcile DecCoin/s API with Coin/s API #3607
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3607 +/- ##
==========================================
- Coverage 60.92% 60.73% -0.2%
==========================================
Files 188 188
Lines 14084 14143 +59
==========================================
+ Hits 8581 8590 +9
- Misses 4959 5008 +49
- Partials 544 545 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks solid, a few requests & notes on API choices (up for discussion)
types/dec_coin.go
Outdated
// IsLT returns true if they are the same type and the receiver is | ||
// a smaller value. | ||
func (coin DecCoin) IsLT(other DecCoin) bool { | ||
return coin.SameDenomAs(other) && coin.Amount.LT(other.Amount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto on panicking with a different denom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function is also never used, maybe we should just delete it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same as above)
Updated @cwgoes |
Responded to comment responses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧀
@@ -485,6 +487,15 @@ var ( | |||
reDecCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reDecAmt, reSpc, reDnm)) | |||
) | |||
|
|||
func validateDenom(denom string) { | |||
if len(denom) < 3 || len(denom) > 16 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look like magic numbers to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm how so? This is just for validation, we can pick any consistent length range.
At the moment, this does not reconcile the DecCoin/s API via an interface as that cause a larger headache. I believe starting to simply reconcile the APIs piecewise is a great first approach.
closes: #3311
closes: #3614
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorerFor Admin Use: