0

I'm running a Relay Chain with 4 validators. And trying to add a new collator to a running parachain.

Which I've changed the desiredCandidates from 0 to 2 in the Chain Specification file. And when I try to add a new collator using the collatorSelection pallet I get the error : collatorSelection.ValidatorNotRegistered Error

How can I solve this?

1 Answer 1

3

The specific error that you are seeing here is because you haven't previously registered the new node as a validator candidate. Here is the source code that generates the error.

The relevant bits are below:

/// Register this account as a collator candidate. The account must (a) already have
/// registered session keys and (b) be able to reserve the `CandidacyBond`.
///
/// This call is not available to `Invulnerable` collators.
...
pub fn register_as_candidate(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
        let who = ensure_signed(origin)?;

        ...

        let validator_key = T::ValidatorIdOf::convert(who.clone())
            .ok_or(Error::<T>::NoAssociatedValidatorId)?;
        ensure!(
            T::ValidatorRegistration::is_registered(&validator_key),
            Error::<T>::ValidatorNotRegistered
        );
        ...

You can see that it asks the config's ValidatorRegistration if the validator key has been registered. Assuming you are using the most common pallets, pallet-session is the one that implements the trait, and it has a set_keys extrinsic which can be called by the account attempting to become a validator.

You can get session keys from the (usually protected) runtime call author - rotate_keys.

So the most likely steps are:

  1. Make the runtime call rotate_keys in the author pallet.
  2. Use the keys you get to submit a set_keys extrinsic in the session pallet. This might require some SCALE-decoding, depending on how you do it.
  3. Register as a candidate the way you already do.

However, this might change depending on your chain setup.

1
  • 1
    Thanks for the answer, I`ve done something similar to that. Thanks for the answer ! Nov 7, 2022 at 13:56

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.