Closed PopcornPaws closed 1 year ago
Not a high priority right now, we can circumvent this problem. Although, this functionality might be intended at some level, because the im-online pallet only removes active validators (when they go offline) and not approved validators. Thus, when a validator comes back online, they can re-join the network as validators because they are still approved.
Description
The validator manager pallet has three functions exposed:
add_validator
remove_validator
add_validator_again
And two main storage items:
Validators
(active validator set)ApprovedValidators
(validators who were once added by a sudo entity, however they might not be active at the moment)When running
remove_validator
the pallet is supposed to rundo_remove_validator
which removes the account fromValidators
and then rununapprove_validator
which removes the account from theApprovedValidators
storage.However, the pallet doesn't remove accounts from the
ApprovedValidators
set, only from theValidators
set. Therefore, when you attempt to add the validator again, you get aDuplicate
error, because the validator is already included inApprovedValidators
even though it was removed fromValidators
.Solution
There's a missing line in
unapprove_validator
that actually overwrites the storage with the removed entry: