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: sdk.Coins.Add #14715

Merged
merged 11 commits into from
Jan 26, 2023
Merged

fix: sdk.Coins.Add #14715

merged 11 commits into from
Jan 26, 2023

Conversation

robert-zaremba
Copy link
Collaborator

Description

  1. Fixes sdk.Coins.Add , today the function returns nil, if the result will end up with an empty set of coins. I've added few test to confirm that and a fix.
    • Function doc says: If both coin sets are empty, then an empty set is returned . Empty set != nil.
    • Moreover, returning nil is a bad practice, because using that object will lead to panics.
  2. Added more tests to sdk.Coins.Sub to confirm that everything works. well.

Technically the PR is API changing , because we change the return value for given parameters. However, I think it goes into the bug fixes so we should backport it to 0.47 and 0.46. So tentatively adding the backport labels.


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)

@robert-zaremba robert-zaremba requested a review from a team as a code owner January 20, 2023 16:01
@robert-zaremba robert-zaremba changed the title Robert/fix coins Fix: skd.Coins.Add Jan 20, 2023
@robert-zaremba robert-zaremba changed the title Fix: skd.Coins.Add Fix: sdk.Coins.Add Jan 20, 2023
@robert-zaremba robert-zaremba changed the title Fix: sdk.Coins.Add fix: sdk.Coins.Add Jan 20, 2023
@julienrbrt
Copy link
Member

Could you add a changelog and fix the remaining tests?

@julienrbrt julienrbrt added the backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release label Jan 20, 2023
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm, pending #14715 (comment).

Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

few nits, pending failing tests

types/coin_test.go Outdated Show resolved Hide resolved
types/coin_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

lgtm, need to fix non-determinism test

@robert-zaremba robert-zaremba added the A:automerge Automatically merge PR once all prerequisites pass. label Jan 26, 2023
@julienrbrt julienrbrt removed the A:automerge Automatically merge PR once all prerequisites pass. label Jan 26, 2023
@julienrbrt
Copy link
Member

@robert-zaremba could you still add a changelog?

@julienrbrt julienrbrt enabled auto-merge (squash) January 26, 2023 11:26
@julienrbrt julienrbrt merged commit 32bb7f6 into main Jan 26, 2023
@julienrbrt julienrbrt deleted the robert/fix-coins branch January 26, 2023 11:41
mergify bot pushed a commit that referenced this pull request Jan 26, 2023
Co-authored-by: Julien Robert <[email protected]>
(cherry picked from commit 32bb7f6)

# Conflicts:
#	CHANGELOG.md
@robert-zaremba
Copy link
Collaborator Author

I was just about to add that changelog. Thanks @julienrbrt

julienrbrt added a commit that referenced this pull request Jan 26, 2023
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
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.

4 participants