forbole / callisto

Callisto (formerly BDJuno) is the official Juno implementation for Big Dipper, the open-source block explorer for Cosmos
https://bigdipper.live
MIT License
90 stars 241 forks source link

Validator status and voting power not updated in some cases #666

Open max-hontar opened 11 months ago

max-hontar commented 11 months ago
## Bug description

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!