Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Cannot self-delegate after being removed from val set #1888

Closed
4 tasks
gamarin2 opened this issue Jul 30, 2018 · 10 comments
Closed
4 tasks

Cannot self-delegate after being removed from val set #1888

gamarin2 opened this issue Jul 30, 2018 · 10 comments

Comments

@gamarin2
Copy link
Contributor

gamarin2 commented Jul 30, 2018

Summary of Bug

When you are ejected from active validator set because another validator got more voting power, it is not possible to increase voting power by increasing self-delegation (via a delegate tx). The delegate tx from validator to validator commits, associated steak disappears, but voting power remains unchanged.
Also, being ejected does not make the validator transition to revoked state (should it?).

The transactions:

There were two transactions. I'm posting them below @cwgoes.

First tx:

gaiacli stake delegate --address-delegator cosmosaccaddr18thamkhnj9wz8pa4nhnp9rldprgant57ryzag7 --address-validator cosmosaccaddr18thamkhnj9wz8pa4nhnp9rldprgant57ryzag7 --chain-id=gaia-7003 --from=delegate-now --amount 40steak
Defaulting to account number: 212
Defaulting to next sequence number: 3
Password to sign with 'delegate-now':
Committed at block 27480. Hash: C9D19EC5B2188BDDAB06B09C6FC038EA022A8C1F

Second tx:

gaiacli stake delegate --address-delegator cosmosaccaddr18thamkhnj9wz8pa4nhnp9rldprgant57ryzag7 --address-validator cosmosaccaddr18thamkhnj9wz8pa4nhnp9rldprgant57ryzag7 --chain-id=gaia-7003 --from=delegate-now --amount 100steak
Defaulting to account number: 212
Defaulting to next sequence number: 2
Password to sign with 'delegate-now':
Committed at block 27438. Hash: 5D1175FC2078513CDFA129C94900B9EF541B10EF

Steps to Reproduce

Get kicked out of active val set because of insufficient voting power. Then try to pass a delegate tx with --addr-delegator = val_address and --addr-validator = val_address


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@cwgoes
Copy link
Contributor

cwgoes commented Jul 30, 2018

Also, being ejected does not make the validator transition to revoked state (should it?).

No, it should not - revoked is a separate state, entered when a validator is slashed for double-signing or for downtime.

The delegate tx from validator to validator commits, associated steak disappears, but voting power remains unchanged.

This is a bug, although I don't think it's true in the general case (we test that) but rather a symptom of a lower-level issue - probably #1857.

@gamarin2 Are the transactions referenced in #1872 (comment) the ones you're referring to with this report?

@gamarin2
Copy link
Contributor Author

@gamarin2 Are the transactions referenced in #1872 (comment) the ones you're referring to with this report?

Yes, sorry. Adding them to the post.

No, it should not - revoked is a separate state, entered when a validator is slashed for double-signing or for downtime.

How is this state different from unbonding?

@cwgoes
Copy link
Contributor

cwgoes commented Jul 30, 2018

How is this state different from unbonding?

It has nothing to do with voting power - just whether or not a validator is "in jail" for having recently committed a protocol fault (downtime or double-signing). See #1466 (comment).

@gamarin2
Copy link
Contributor Author

It has nothing to do with voting power - just whether or not a validator is "in jail" for having recently committed a protocol fault (downtime or double-signing). See #1466 (comment).

Do you become unbonded after 3 weeks in jail? Also, it seemed like you still take a spot in the top 100 validators if you're in jail. Like if there are 100 vals and you get jailed, there are 99 vals and 1 jailed. The 101 val does not enter validator set. At least that's behaviour I observed in testnet, not sure it's desired.

No, it should not - revoked is a separate state, entered when a validator is slashed for double-signing or for downtime.

Ok so what state do you enter when you get kicked out? Unbonding? Bec. you should still be slashable for 3 weeks after you get kicked out.

@rigelrozanski rigelrozanski changed the title Cannot self-delegate after being ejected from val set Cannot self-delegate after being removed from val set Jul 31, 2018
@cwgoes
Copy link
Contributor

cwgoes commented Aug 1, 2018

Do you become unbonded after 3 weeks in jail? Also, it seemed like you still take a spot in the top 100 validators if you're in jail. Like if there are 100 vals and you get jailed, there are 99 vals and 1 jailed. The 101 val does not enter validator set. At least that's behaviour I observed in testnet, not sure it's desired.

While in jail, you're always unbonded (you cannot sign blocks) regardless of voting power. When you leave jail, you may or may not be rebonded depending on whether or not you have enough stake to be in the top hundred validators. The duration of the unbonding period doesn't have anything to do with jail; we can choose independently how long validators are jailed for double-signing and for downtime.

I'm not entirely sure what you mean by "take a spot in the top 100 validators" - being "in jail" has nothing to do with how much stake you have, it's just a state a validator forcibly enters after committing a protocol fault and can leave only by submitting an "unrevoke" transaction after a period of time.

Ok so what state do you enter when you get kicked out? Unbonding? Bec. you should still be slashable for 3 weeks after you get kicked out.

Yes, unbonding - ref #1676.

@gamarin2
Copy link
Contributor Author

gamarin2 commented Aug 1, 2018

While in jail, you're always unbonded (you cannot sign blocks) regardless of voting power.

So being slashed seems like a way to become unbonded without going through the unbonding period. Being in jail should make you in unbonding, not unbonded mode. Otherwise you can double sign and then try to get slashed for downtime to avoid being slashed for double signing.

I'm not entirely sure what you mean by "take a spot in the top 100 validators"

I'm asking that because when my Friend got kicked out because of insufficient voting power, there were 102 active validators and 38 jailed validators. So he got kicked out of the val set when total number of val was 140 (the limit?). I'm just saying that the 38 should not take a "spot" in the top X of vals.

@cwgoes
Copy link
Contributor

cwgoes commented Aug 1, 2018

So being slashed seems like a way to become unbonded without going through the unbonding period. Being in jail should make you in unbonding, not unbonded mode. Otherwise you can double sign and then try to get slashed for downtime to avoid being slashed for double signing.

Indeed - you're exactly correct - unfortunately "unbonded" is an overloaded term, I just meant "not bonded".

I'm asking that because when my Friend got kicked out because of insufficient voting power, there were 102 active validators and 38 jailed validators. So he got kicked out of the val set when total number of val was 140 (the limit?). I'm just saying that the 38 should not take a "spot" in the top X of vals.

The 38 should not take a spot; if they did that's a bug.

@gamarin2
Copy link
Contributor Author

gamarin2 commented Aug 1, 2018

The 38 should not take a spot; if they did that's a bug.

Ok, let's see if it happens again in current testnet or if I imagined it.

Indeed - you're exactly correct - unfortunately "unbonded" is an overloaded term, I just meant "not bonded".

Wait, so when you get slashed you enter "unbonding" state right? Because i don't see a difference between unbonded and not bonded.

@cwgoes
Copy link
Contributor

cwgoes commented Aug 2, 2018

Wait, so when you get slashed you enter "unbonding" state right? Because i don't see a difference between unbonded and not bonded.

There are three distinct states: "Bonded", "Unbonding", "Unbonded" - https://github.com/cosmos/cosmos-sdk/blob/develop/types/stake.go#L13. When slashed, you should enter the unbonding state - stakeKeeper.Slash() just updates validator power and calls UpdateValidators(), so no additional logic is necessary - but the unbonding state hasn't been fully implemented yet - #1676.

@cwgoes
Copy link
Contributor

cwgoes commented Sep 26, 2018

I don't think we've managed to replicate this, closing for now. If anyone does replicate, please reopen.

@cwgoes cwgoes closed this as completed Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants