helium / miner

Miner for the helium blockchain
Apache License 2.0
609 stars 265 forks source link

Validators - allow restaking a validator in cool down #692

Closed PaulVMo closed 3 years ago

PaulVMo commented 3 years ago

Per the description in HIP 25, it was intended that a stake in cool down could be re-staked. This functionality does not seem to be implemented. Attempting to stake a validator that is in cool down returns a {invalid,already_exists} failure.

unstake_validator: validator pubkey: this starts the unlock process for the stake, returning it to the owner's account after some cooldown period. the validator is immediately unable to join block production groups, but re-staking will restore the validator to eligibility.

Update: I tested this by creating a stake transaction on a wallet which has a validator in cool down. I tried this both with the same validator address that was in cool down as well as a different address that had never been staked. In the first case, the transaction failed with already_exists and in the second case it failed because of insufficient balance.

jdgemm commented 3 years ago

Any unstaked validator that has previously been staked cannot be restaked. Users would need to download a new validator node.

PaulVMo commented 3 years ago

Was there any discussion on this before closing? The HIP say that this should be allowed - just pointing that out. @evanmcc

evanmcc commented 3 years ago

there wasn't. We're currently unsure about how to negotiate this kind of flexibility. We decided it was a bad idea, esp given transfer (also it was added later in the HIP process, I think?).

PaulVMo commented 3 years ago

Yeah, makes sense. I see the complexity. The transaction would need to be able to identify which stake in cool down is intended probably by specifying the address of the validator that it was unstaked from. The owner account does not tell you enough. So, probably would need either a new, optional parameter for the stake command with the cooling stake's validator address or a new transaction type all together for restaking.

As far as whether or not it is a good idea, currently nothing can be done with a stake while it is in cooldown (no transfer, no restake). This takes away a lot of flexibility. Would be nice to have one of these options so that there is some path to dispose of a stake while it is in the long cool down period.