-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: WithdrawRewards event emit value when no rewards #9599
Conversation
*returns 0baseDenom in the case of 0 rewards so that a default value is present in event *add test for the case of 0 rewards via 100% commission
@@ -99,6 +99,14 @@ func (k Keeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddres | |||
return nil, err | |||
} | |||
|
|||
if rewards.IsZero() { |
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.
A zero coin technically isn't valid. I don't have strong feeling here though in terms of emitting the event. I'd have to defer to others.
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.
IsZero
doubles as an IsEmpty
check so 0 rewards is the same as no rewards here 🤷🏻♂️
but yeah just to clarify, without the added check, the value
simply gets axed from the event
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.
Totally. I meant in the state-machine we do not allow zero coins. However, since this is for UX/client purposes only, I suppose it's OK.
Codecov Report
@@ Coverage Diff @@
## master #9599 +/- ##
=======================================
Coverage 60.57% 60.57%
=======================================
Files 588 588
Lines 37452 37458 +6
=======================================
+ Hits 22686 22692 +6
Misses 12776 12776
Partials 1990 1990
|
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.
Can you add a changelog entry?
Description
Rewards values of 0 were omitted from the
WithdrawRewards
event. To provide consistency in event responses, this is caught in the keeper and emitted as a value of0[baseDenom]
.Closes: #8581
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change