Skip to content

Validator manager pallet fails to unapprove validators. #116

@PopcornPaws

Description

@PopcornPaws

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 run do_remove_validator which removes the account from Validators and then run unapprove_validator which removes the account from the ApprovedValidators storage.

However, the pallet doesn't remove accounts from the ApprovedValidators set, only from the Validators set. Therefore, when you attempt to add the validator again, you get a Duplicate error, because the validator is already included in ApprovedValidators even though it was removed from Validators.

Solution

There's a missing line in unapprove_validator that actually overwrites the storage with the removed entry:

let mut approved_set = <ApprovedValidators<T>>::get();
approved_set.retain(|v| *v != validator_id);
<ApprovedValidators<T>>::put(approved_set); // MISSING

Metadata

Metadata

Assignees

Labels

bugsomething isn't working as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions