Cosmos-sdk: x/staking: A sequence of transactions causes one to delete a non-existent validator

Created on 30 Aug 2018  路  3Comments  路  Source: cosmos/cosmos-sdk

Our previous detection algorithm for this was incorrect. This was fixed in #2188, and as shown there it causes errors. That PR has one such sequence of purely staking events that causes this to happen. https://github.com/cosmos/cosmos-sdk/pull/2188. See https://circleci.com/gh/cosmos/cosmos-sdk/25616?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

/cc @cwgoes @rigelrozanski
@zmanian had asked if we could merge into a patch release as gaia v0.24.3

bug staking

Most helpful comment

Update from #2238:

In terms of not sending TM a validator (that was not previously bonded) that goes from zero power, to non-zero power, back to zero power, #2238 addresses and fixes that.

However, during testing of gaia sim slow (thanks @ValarDragon ), the same failure triggered, but it seems it's for a different reason -- perhaps related to #2241.

Summary as follows (based on logs I added):

Given validatorA:

  • height 16: bonded (bondedHeight: 6, unbondingHeight: 0)
  • height 18: unbonded (bondedHeight: 6, unbondingHeight: 18)
  • height 56: bonded (bondedHeight: 56, unbondingHeight: 18)
  • height 68: unbonded (bondedHeight: 56, unbondingHeight: 68)
  • height 75: ??? (validatorA not sent in GetTendermintUpdates -- should be since next line indicates it's unbonded)
  • height 88: unbonded (bondedHeight: 75, unbondingHeight: 88) -> simulation fails because TM does not have validatorA.

So validatorA does not go from zero, to non-zero, back to zero it seems, but something else seems to be happening. Correct me if I'm wrong.

All 3 comments

Update from #2238:

In terms of not sending TM a validator (that was not previously bonded) that goes from zero power, to non-zero power, back to zero power, #2238 addresses and fixes that.

However, during testing of gaia sim slow (thanks @ValarDragon ), the same failure triggered, but it seems it's for a different reason -- perhaps related to #2241.

Summary as follows (based on logs I added):

Given validatorA:

  • height 16: bonded (bondedHeight: 6, unbondingHeight: 0)
  • height 18: unbonded (bondedHeight: 6, unbondingHeight: 18)
  • height 56: bonded (bondedHeight: 56, unbondingHeight: 18)
  • height 68: unbonded (bondedHeight: 56, unbondingHeight: 68)
  • height 75: ??? (validatorA not sent in GetTendermintUpdates -- should be since next line indicates it's unbonded)
  • height 88: unbonded (bondedHeight: 75, unbondingHeight: 88) -> simulation fails because TM does not have validatorA.

So validatorA does not go from zero, to non-zero, back to zero it seems, but something else seems to be happening. Correct me if I'm wrong.

@alexanderbez Do you have a commit revision and a simulation seed to reproduce that exact event sequence?

@cwgoes yes.

Manually set the seed to: 1536164987760853304 (I also think I set the number of blocks to 500 but I dont think that matters)
Run:

GOCACHE=off go test github.com/cosmos/cosmos-sdk/x/stake/simulation -run ^TestStakeWithRandomMessages$
Was this page helpful?
0 / 5 - 0 ratings