[hotfix]: Fix PSE division by zero in distributeToDelegator#101
Conversation
TxCorpi0x
left a comment
There was a problem hiding this comment.
@TxCorpi0x made 1 comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on masihyeganeh, metalarm10, miladz68, and ysv).
x/pse/keeper/distribute_test.go line 22 at r1 (raw file):
) func TestKeeper_Distribute_DelegationWithZeroBalanceAfterSlash(t *testing.T) {
Test is good, but can't we add a new test case to the existing TestKeeper_Distribute and define a slashAction similar to distributAction, this help more scenarios to be added for slashing, at this point we don't have extensive slashing scenarios.
Note: lint also failing
TxCorpi0x
left a comment
There was a problem hiding this comment.
@TxCorpi0x made 1 comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on masihyeganeh, metalarm10, miladz68, and ysv).
ysv
left a comment
There was a problem hiding this comment.
@ysv reviewed 3 files and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on masihyeganeh, metalarm10, and miladz68).
Description
Guard against division by zero when a delegator has score but zero delegation token balance (e.g., after validator slashing). Adds distribution test reproducing the exact testnet crash.
Reviewers checklist:
Authors checklist
This change is