cosmos/cosmos-sdk

Cliff validator power not correctly updated when cliff validator increases in power

cwgoes opened this issue · 5 comments

Caught by fuzzer (#1783).

UpdateValidator has a special case for an already-bonded validator increasing in power where it skips the usual store iteration - but if the cliff validator has increased in power, this will fail to update the power stored at ValidatorPowerCliffKey.

Also, if the cliff validator increases in power, it might stop being the cliff validator - I don't think we handle that correctly.

I think this might be a good chance for me to get my hands dirty with staking.

I think this might be a good chance for me to get my hands dirty with staking.

Great - also pulling in @rigelrozanski, might want to discuss what we want to change quickly first.

Note that this is really two distinct bugs:

  • If the cliff validator power increases beyond the second-lowest-power validator, we need to switch cliff validators
  • If the cliff validator power increases but it's still the lowest-power validator, we need to update the ValidatorPowerCliffKey for future comparisions to the cliff validator power

#1858 has an isolating testcase for each, feel free to take over that PR.

Great. @rigelrozanski let's sync up on this.

Let's talk about this on Monday - great catch fuzzer!