7

I am experimenting with the staking pallet on substrate V3.0 and I was trying to disable the functionality that allows new validators from joining.

I would like to keep the staking functionality but just disable new validators from joining if possible.

Looking at the validate extrinsic in the staking pallet, I can't see any obvious ways to disable it without changing the source code.

Thanks

2 Answers 2

4

You could apply a filter to your runtime which would block users from making a call to the validate function.

/// Use this filter to block users from calling `validate` in the Staking pallet.
pub struct DontAllowValidate;
impl Contains<Call> for DontAllowValidate {
    fn contains(c: &Call) -> bool {
        !matches!(c, Call::Staking(pallet_staking::Call::register { .. }))
    }
}

Then you configure your System pallet to use this filter:

impl frame_system::Config for Runtime {
    type BaseCallFilter = DontAllowValidate;
    // -- snip --
}

This works for any call, and is how Polkadot and other chains disabled transfers or other kinds of calls in the bootstrapping stages of the network.

2

The given answer does not work and can easily be circumvented with proxy, multi-sig, batch, or any other type of call wrapping.

The better way to do this would be to set MaxValidatorCount to 0. Then no one can call the validate transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.