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

fix: adding checks to ensure coin denoms are sorted in Balance during Validate #9829

Merged
merged 8 commits into from
Aug 6, 2021

Conversation

spoo-bar
Copy link
Contributor

@spoo-bar spoo-bar commented Aug 2, 2021

Description

Closes: #9706

  • Added check in Balance.Validate to ensure coin denoms are sorted
  • Refactored Balance.Validate to use Coins.Validate to validate its coins, which handles all the cases.
  • Added relevant test cases

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@codecov
Copy link

codecov bot commented Aug 2, 2021

Codecov Report

Merging #9829 (afde096) into master (5a47154) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9829      +/-   ##
==========================================
- Coverage   63.47%   63.46%   -0.02%     
==========================================
  Files         568      568              
  Lines       53271    53256      -15     
==========================================
- Hits        33815    33800      -15     
  Misses      17532    17532              
  Partials     1924     1924              
Impacted Files Coverage Δ
x/bank/types/balance.go 86.36% <100.00%> (-3.47%) ⬇️

x/bank/types/balance.go Outdated Show resolved Hide resolved
@orijbot
Copy link

orijbot commented Aug 3, 2021

Visit https://dashboard.github.orijtech.com?pr=9829&repo=cosmos%2Fcosmos-sdk to see benchmark details.

Copy link
Contributor

@cyberbono3 cyberbono3 left a comment

Choose a reason for hiding this comment

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

Overall, lgtm. Please fix changelog conflict.

@spoo-bar spoo-bar merged commit 87ebb3e into master Aug 6, 2021
@spoo-bar spoo-bar deleted the spoorthi/9706-refactor-validate-balance branch August 6, 2021 13:58
@fedekunze
Copy link
Collaborator

@Mergifyio backport release/v0.45.x

@mergify
Copy link
Contributor

mergify bot commented Dec 28, 2021

backport release/v0.45.x

✅ Backports have been created

@fedekunze fedekunze mentioned this pull request Dec 28, 2021
12 tasks
amaury1093 pushed a commit that referenced this pull request Jan 3, 2022
…ng `Validate` (backport #9829) (#10849)

* adding checks to ensure denoms are sorted

(cherry picked from commit ce1e650)

* updating changelog

(cherry picked from commit 2cea5e5)

# Conflicts:
#	CHANGELOG.md

* refactoring balance.coin validation

(cherry picked from commit 40d22c7)

* adding 0 value coin test case

(cherry picked from commit 2468b64)

* added valid sorted coin testcase

(cherry picked from commit 66b91ee)

* updating changelog

(cherry picked from commit 59b788a)

# Conflicts:
#	CHANGELOG.md

* conflicts

Co-authored-by: Spoorthi <9302666+spoo-bar@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
@faddat faddat mentioned this pull request Feb 28, 2022
8 tasks
zakir-code pushed a commit to FunctionX/cosmos-sdk that referenced this pull request Apr 8, 2022
…ng `Validate` (backport cosmos#9829) (cosmos#10849)

* adding checks to ensure denoms are sorted

(cherry picked from commit ce1e650)

* updating changelog

(cherry picked from commit 2cea5e5)

# Conflicts:
#	CHANGELOG.md

* refactoring balance.coin validation

(cherry picked from commit 40d22c7)

* adding 0 value coin test case

(cherry picked from commit 2468b64)

* added valid sorted coin testcase

(cherry picked from commit 66b91ee)

* updating changelog

(cherry picked from commit 59b788a)

# Conflicts:
#	CHANGELOG.md

* conflicts

Co-authored-by: Spoorthi <9302666+spoo-bar@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
JimLarson pushed a commit to agoric-labs/cosmos-sdk that referenced this pull request Jul 7, 2022
…ng `Validate` (backport cosmos#9829) (cosmos#10849)

* adding checks to ensure denoms are sorted

(cherry picked from commit ce1e650)

* updating changelog

(cherry picked from commit 2cea5e5)

# Conflicts:
#	CHANGELOG.md

* refactoring balance.coin validation

(cherry picked from commit 40d22c7)

* adding 0 value coin test case

(cherry picked from commit 2468b64)

* added valid sorted coin testcase

(cherry picked from commit 66b91ee)

* updating changelog

(cherry picked from commit 59b788a)

# Conflicts:
#	CHANGELOG.md

* conflicts

Co-authored-by: Spoorthi <9302666+spoo-bar@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
Eengineer1 pushed a commit to cheqd/cosmos-sdk that referenced this pull request Aug 26, 2022
…ng `Validate` (backport cosmos#9829) (cosmos#10849)

* adding checks to ensure denoms are sorted

(cherry picked from commit ce1e650)

* updating changelog

(cherry picked from commit 2cea5e5)

# Conflicts:
#	CHANGELOG.md

* refactoring balance.coin validation

(cherry picked from commit 40d22c7)

* adding 0 value coin test case

(cherry picked from commit 2468b64)

* added valid sorted coin testcase

(cherry picked from commit 66b91ee)

* updating changelog

(cherry picked from commit 59b788a)

# Conflicts:
#	CHANGELOG.md

* conflicts

Co-authored-by: Spoorthi <9302666+spoo-bar@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
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.

Sorting coins of the genesis balances is no effect
6 participants