mesh-security
mesh-security copied to clipboard
virtual-staking: Unbonding from tombstoned validators
When unbonding from a tombstoned validator, we need to make sure if there's the need to unbond funds from the blockchain staking module or not. This is because some blockchain implementations may decide to unbond automatically when tombstoning, and after slashing, a validator.
This would require:
- Knowing that a validator is tombstoned. Currently we have a
inactive
list in virtual-staking, which doesn't differentiate between jailed, unbonded or tombstoned validators. Let's add a state to the list, so that we can check this. Alternatively, we can simply do the bonded check below for all inactive validators. - Checking the bonded amount a tombstoned / inactive validator has. This has to be done against the blockchain, using the
StakingQuery::Delegation
message (or thequery_delegation
helper), in order to send anUnbond
message only if / when needed.