2

I need to interact with pallet_session, in particular to read validator set for the next session. As far as I understand, this data is stored in two places:

  • QueuedKeys, which is just Vec<(T::ValidatorId, T::Keys)>
  • NextKeys, which is a mapping from T::ValidatorId to T::Keys

After scrolling pallet code, it seems to me that these two containers are kinda equivalent and it is not clear for me why there is a need for both of them. Hence, I do not know whether I'm guaranteed that they always contain the same data and I can use any of them or I'm missing something.

So the question is: is there any difference between QueuedKeys and NextKeys, of course apart from the lookup/access interface (vector vs map).

1 Answer 1

3

The main point that you are missing is that NextKeys can only be set via the set_keys transaction.

Once a new session is being enacted, if the validator set has changed, QueuedKeys is formed from the list of new authorities (coming from SessionManager), amalgamated with keys that have already been provided by potential validators via set_keys.

1
  • if i need to add pallet_session in a running chain how can i set authorities from AURA to session ? Jan 16 at 17:25

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.