Skip to content

Commit

Permalink
Update check condition with sdk.Int (#548)
Browse files Browse the repository at this point in the history
## Context and purpose of the change

Go through code and I see this line 
https://github.com/Stride-Labs/stride/blob/main/x/stakeibc/keeper/validator_selection.go#L38
We should use `Equal`


## Brief Changelog




## Author's Checklist

I have...

- [ ] Run and PASSED locally all GAIA integration tests
- [ ] If the change is contentful, I either:
    - [ ] Added a new unit test OR 
    - [ ] Added test cases to existing unit tests
- [ ] OR this change is a trivial rework / code cleanup without any test coverage

If skipped any of the tests above, explain.


## 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...

- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] manually tested (if applicable)
- [ ] confirmed the author wrote unit tests for new logic
- [ ] reviewed documentation exists and is accurate


## Documentation and Release Note

  - [ ] Does this pull request introduce a new feature or user-facing behavior changes? 
  - [ ] Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?
  - [ ] This pull request updates existing proto field values (and require a backend and frontend migration)? 
  - [ ] Does this pull request change existing proto field names (and require a frontend migration)?
  How is the feature or change documented? 
      - [ ] not applicable
      - [ ] jira ticket `XXX` 
      - [ ] specification (`x/<module>/spec/`) 
      - [ ] README.md 
      - [ ] not documented
  • Loading branch information
hieuvubk authored Jan 13, 2023
1 parent cd96f99 commit 3c3c54b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x/stakeibc/keeper/validator_selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (k Keeper) GetValidatorDelegationAmtDifferences(ctx sdk.Context, hostZone t
// output key is ADDRESS not NAME
func (k Keeper) GetTargetValAmtsForHostZone(ctx sdk.Context, hostZone types.HostZone, finalDelegation sdkmath.Int) (map[string]sdkmath.Int, error) {
// Confirm the expected delegation amount is greater than 0
if finalDelegation == sdkmath.ZeroInt() {
if finalDelegation.Equal(sdkmath.ZeroInt()) {
k.Logger(ctx).Error(fmt.Sprintf("Cannot calculate target delegation if final amount is 0 %s", hostZone.ChainId))
return nil, types.ErrNoValidatorWeights
}
Expand Down

0 comments on commit 3c3c54b

Please sign in to comment.