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

remove resulting value return from AddCoins and SubtractCoins #7327

Merged
merged 4 commits into from
Sep 16, 2020

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Sep 16, 2020

Description

While testing ibc-transfer I noticed function like minting and sending in bank allow for successful execution with empty coin sets as a parameter. While this shouldn't cause any issues from what I can tell, AddCoins and SubtractCoins will act semantically different then intended when receiving empty coin sets as parameters.

The resultingValue returned in these functions will be an empty coin set, when the provided argument is also an empty coin set. If any implementation relies on these functions to return a resulting value that is the value at the address after being added or subtracted to then they will likely have a bug in their code.

I have removed this value for now which forces code to do a separate query to GetBalance instead of relying on the returned value. We should come to consensus on if empty coin sets should be disallowed as valid parameters to bank functions. I have written up some more thoughts on #7046

closes: #XXXX


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.

  • 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.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@codecov
Copy link

codecov bot commented Sep 16, 2020

Codecov Report

Merging #7327 into master will decrease coverage by 0.00%.
The diff coverage is 78.94%.

@@            Coverage Diff             @@
##           master    #7327      +/-   ##
==========================================
- Coverage   56.76%   56.76%   -0.01%     
==========================================
  Files         585      585              
  Lines       40678    40674       -4     
==========================================
- Hits        23092    23088       -4     
  Misses      15645    15645              
  Partials     1941     1941              

@cwgoes
Copy link
Contributor

cwgoes commented Sep 16, 2020

Any idea what's with the codecov on this PR?

It seems to have warnings on dozens of files that weren't actually changed, hard to review.

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.

utACK

@cwgoes
Copy link
Contributor

cwgoes commented Sep 16, 2020

Any idea what's with the codecov on this PR?

It seems to have warnings on dozens of files that weren't actually changed, hard to review.

Seems like a new Github feature; at least the files are separated, ignoring the warnings for now.

@alexanderbez alexanderbez merged commit b2d48a9 into master Sep 16, 2020
@alexanderbez alexanderbez deleted the colin/fix-add-subtract-coins branch September 16, 2020 12:40
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants