Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WIP: Demonstrate staking bug #2188

Closed
wants to merge 2 commits into from
Closed

Conversation

ValarDragon
Copy link
Contributor

@ValarDragon ValarDragon commented Aug 30, 2018

This PR basically just demonstrates that there is a problem, and this causes simulation to fail.
Something is happening that is causing a non-existent validator to get deleted.


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@ValarDragon
Copy link
Contributor Author

ValarDragon commented Aug 30, 2018

@codecov
Copy link

codecov bot commented Aug 30, 2018

Codecov Report

❗ No coverage uploaded for pull request base (dev/benchmark_simulation@b3d08bc). Click here to learn what that means.
The diff coverage is n/a.

@@                     Coverage Diff                     @@
##             dev/benchmark_simulation    #2188   +/-   ##
===========================================================
  Coverage                            ?   63.62%           
===========================================================
  Files                               ?      136           
  Lines                               ?     8270           
  Branches                            ?        0           
===========================================================
  Hits                                ?     5262           
  Misses                              ?     2652           
  Partials                            ?      356

@ValarDragon ValarDragon force-pushed the dev/demonstrate_staking_bug branch from 9128415 to 4f4647e Compare August 30, 2018 07:35
@cwgoes
Copy link
Contributor

cwgoes commented Aug 30, 2018

I don't think this is necessarily caused by a particular issue in staking, this is always how we've handled validator updates, but if the TM side has changed (for the better!) we might need to update our end too.

If a validator goes from zero power to nonzero power and back to zero power in the same block (through a few transactions), the validator will be passed back to Tendermint with zero power. In this case Tendermint used to do nothing (delete a key that wasn't there), but it looks like that behavior may have changed - https://github.com/tendermint/tendermint/blob/master/state/execution.go#L290 - which could be a problem here.

@rigelrozanski
Copy link
Contributor

@ValarDragon / @cwgoes . nice catch/Interesting- well we could always attempt to keep track of things on the state machine side too... we would just need to store/check the power at the previous height for each validator which is being sent as a tendermint update with 0 power - if the validator wasn't bonded at the previous height then we just don't send the update to Tendermint... seems simple enough - I'd propose we handle it this way - thoughts?

@ValarDragon
Copy link
Contributor Author

ValarDragon commented Aug 30, 2018

That seems like a good fix to me

@cwgoes
Copy link
Contributor

cwgoes commented Aug 30, 2018

If the validator wasn't bonded at the previous height then we just don't send the update to Tendermint.

I think this is fine. How do we track whether a validator was bonded at the start of the block, though? We can't use ABCIRequestBeginBlock.SigningValidators, because that will be offset. I guess we'll have to use another transient substore to track this?

@rigelrozanski
Copy link
Contributor

@cwgoes we can tease out whether the validator was bonded or not at the previous height using on validator.BondHeight and validator.UnbondingHeight (new in unbonding validator PR)

@cwgoes
Copy link
Contributor

cwgoes commented Sep 1, 2018

@cwgoes we can tease out whether the validator was bonded or not at the previous height using on validator.BondHeight and validator.UnbondingHeight (new in unbonding validator PR)

Great, let's definitely get a fix for this in the next release.

@rigelrozanski rigelrozanski changed the title Demonstrate staking bug WIP: Demonstrate staking bug Sep 2, 2018
@rigelrozanski
Copy link
Contributor

rigelrozanski commented Sep 2, 2018

it'd be good to just work from this PR and change the merge base to develop

@cwgoes
Copy link
Contributor

cwgoes commented Sep 3, 2018

cc @alexanderbez

@cwgoes cwgoes mentioned this pull request Sep 3, 2018
23 tasks
@rigelrozanski rigelrozanski changed the base branch from dev/benchmark_simulation to develop September 3, 2018 19:04
@alexanderbez
Copy link
Contributor

Closing this in favor of #2238.

@cwgoes cwgoes deleted the dev/demonstrate_staking_bug branch September 6, 2018 09:17
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants