solana-labs / solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://solanalabs.com
Apache License 2.0
13.18k stars 4.3k forks source link

Cannot stake after deactivating stake #7858

Closed garious closed 4 years ago

garious commented 4 years ago

Problem

In v0.22.3, I could not stake a validator after deactivating it. Two examples of this in the SLP cluster:

Proposed Solution

Fix it.

garious commented 4 years ago

Also, after staking, deactivating, staking, the next call to deactivate-stake results in the following error:

solana deactivate-stake 2P7Xs5FNwAHN6pyzhYLAXPjxwhz8qgBA9ADUYQcLwc65
[2020-01-17T14:11:09.629630000Z ERROR solana_cli::cli] StakeError::AlreadyDeactivated
Error: AlreadyDeactivated
rob-solana commented 4 years ago

stake doesn't currently support re-activation, so I don't know how you succeeded in "staking, deactivating, staking"

I'll change stake to behave as if it were uninitialized once fully cooled down, so one can avoid withdrawal before restaking

Also, after staking, deactivating, staking, the next call to deactivate-stake results in the following error:

solana deactivate-stake 2P7Xs5FNwAHN6pyzhYLAXPjxwhz8qgBA9ADUYQcLwc65
[2020-01-17T14:11:09.629630000Z ERROR solana_cli::cli] StakeError::AlreadyDeactivated
Error: AlreadyDeactivated
garious commented 4 years ago

That sounds good to me, thanks @rob-solana . That 2nd staking step while still cooling down needs to return an error. I'm 90% certain it didn't. It'd also be helpful if show-stake-account contained a bit more information to make it clear that it's cooling down (maybe "deactivating until and including epoch X").

rob-solana commented 4 years ago

ok, I get it. You re-delegated. Re-delegation is legal during cool down...

rob-solana commented 4 years ago

That sounds good to me, thanks @rob-solana . That 2nd staking step while still cooling down needs to return an error. I'm 90% certain it didn't. It'd also be helpful if show-stake-account contained a bit more information to make it clear that it's cooling down (maybe "deactivating until and including epoch X").

It's impossible to predict when a stake will become fully deactivated, because it depends on how much stake is being activated/deactivated elsewhere. E.g. deactivation of a small stake would be quick unless some very large stake also deactivates during the small stake's cooldown period.