After latest changes in PR #652 in some cases validator state updates not working. When validator leave from active validators set its state and voting power not updated in DB.
Steps to reproduce
To reproduce bug - just remove all delegation (or self-delegation) below min - so validator switch to status "unbonding". But this state not reflected in DB - voting power same as last known before change, same as status.
## Expected behavior
After switch validator status to "unbonding" state - its voting power should update to "0" and status in DB also should be "unbonding" (BondStatus = 2)
Problem source (as I got from code):
In staking module this updates handled by function UpdateValidatorStatuses(), its don't have parameters and inside call GetValidatorsWithStatus(block.Height, stakingtypes.Bonded.String()) - so it takes only "bonded" validators and update status & voting power only for them!
After latest changes in PR #652 in some cases validator state updates not working. When validator leave from active validators set its state and voting power not updated in DB.
Steps to reproduce
To reproduce bug - just remove all delegation (or self-delegation) below min - so validator switch to status "unbonding". But this state not reflected in DB - voting power same as last known before change, same as status. ## Expected behaviorAfter switch validator status to "unbonding" state - its voting power should update to "0" and status in DB also should be "unbonding" (BondStatus = 2)
Problem source (as I got from code): In staking module this updates handled by function
UpdateValidatorStatuses()
, its don't have parameters and inside callGetValidatorsWithStatus(block.Height, stakingtypes.Bonded.String())
- so it takes only "bonded" validators and update status & voting power only for them!