Cosmos-sdk: Cliff validator power not correctly updated when cliff validator increases in power

Created on 28 Jul 2018  路  5Comments  路  Source: cosmos/cosmos-sdk

Caught by fuzzer (https://github.com/cosmos/cosmos-sdk/pull/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.

bug staking

All 5 comments

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!

Was this page helpful?
0 / 5 - 0 ratings