pub trait SessionManager<ValidatorId> {
    fn new_session(new_index: SessionIndex) -> Option<Vec<ValidatorId>>;
    fn end_session(end_index: SessionIndex);
    fn start_session(start_index: SessionIndex);

    fn new_session_genesis(new_index: SessionIndex) -> Option<Vec<ValidatorId>> { ... }
Expand description

A trait for managing creation of new validator set.

Required Methods

Plan a new session, and optionally provide the new validator set.

Even if the validator-set is the same as before, if any underlying economic conditions have changed (i.e. stake-weights), the new validator set must be returned. This is necessary for consensus engines making use of the session pallet to issue a validator-set change so misbehavior can be provably associated with the new economic conditions as opposed to the old. The returned validator set, if any, will not be applied until new_index. new_index is strictly greater than from previous call.

The first session start at index 0.

new_session(session) is guaranteed to be called before end_session(session-1). In other words, a new session must always be planned before an ongoing one can be finished.

End the session.

Because the session pallet can queue validator set the ending session can be lower than the last new session index.

Start an already planned session.

The session start to be used for validation.

Provided Methods

Same as new_session, but it this should only be called at genesis.

The session manager might decide to treat this in a different way. Default impl is simply using new_session.

Implementations on Foreign Types