-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
add sorted check for the coins sub/add fun parameter #9240
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9240 +/- ##
==========================================
+ Coverage 60.13% 60.14% +0.01%
==========================================
Files 595 595
Lines 37185 37201 +16
==========================================
+ Hits 22360 22376 +16
Misses 12846 12846
Partials 1979 1979
|
types/coin.go
Outdated
if len(coins) < 2 { | ||
return true | ||
} |
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 extra check is not necessary.
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.
right, the loop condition will handle 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.
This is early return. A very good practice AFAICT
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.
utACK
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.
utACK
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.
LGTM
Description
When looking at #9159 and the
Coins
structure usage in the SDK, I noticed that we don't assure if theCoins.Sub
andCoins.Add
is not checked if the coins are sorted. We haveIsValidate
function, but it's not always used.NOTE: I was thinking about adding a check for the object receiver (self), but it seams we construct it correctly with a constructor (
NewCoins
).Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes