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

R4R: Reconcile DecCoin/s API with Coin/s API #3607

Merged
merged 22 commits into from
Feb 15, 2019
Merged

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Feb 11, 2019

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 explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Feb 13, 2019

Codecov Report

Merging #3607 into develop will decrease coverage by 0.19%.
The diff coverage is 36.79%.

@@            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

@alexanderbez alexanderbez changed the title WIP: Reconcile DecCoin/s API with Coin/s API R4R: Reconcile DecCoin/s API with Coin/s API Feb 13, 2019
@alexanderbez
Copy link
Contributor Author

bump @cwgoes @rigelrozanski @jackzampolin

Copy link
Contributor

@cwgoes cwgoes left a 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 Show resolved Hide resolved
types/dec_coin.go Outdated Show resolved Hide resolved
types/dec_coin.go Outdated Show resolved Hide resolved
types/dec_coin.go Outdated Show resolved Hide resolved
// 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)
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

(same as above)

types/dec_coin.go Outdated Show resolved Hide resolved
types/dec_coin.go Outdated Show resolved Hide resolved
types/dec_coin.go Outdated Show resolved Hide resolved
x/distribution/keeper/delegation_test.go Show resolved Hide resolved
@alexanderbez
Copy link
Contributor Author

Updated @cwgoes

@cwgoes
Copy link
Contributor

cwgoes commented Feb 14, 2019

Updated @cwgoes

Responded to comment responses.

Copy link
Contributor

@melekes melekes left a 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 {
Copy link
Contributor

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

Copy link
Contributor

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.

@cwgoes cwgoes merged commit 26c13b2 into develop Feb 15, 2019
@cwgoes cwgoes deleted the bez/3311-coins-api-recon branch February 15, 2019 15:33
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.

types.Coins hardening: NewCoin and NewDecCoin should fail if denom is empty Reconcile DecCoin/s with Coin/s
3 participants