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

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

A trait for managing creation of new validator set.

Required Methods§

source

fn new_session(new_index: SessionIndex) -> Option<Vec<ValidatorId>>

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.

source

fn end_session(end_index: SessionIndex)

End the session.

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

source

fn start_session(start_index: SessionIndex)

Start an already planned session.

The session start to be used for validation.

Provided Methods§

source

fn new_session_genesis(new_index: SessionIndex) -> Option<Vec<ValidatorId>>

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<A> SessionManager<A> for ()

source§

fn new_session(_: SessionIndex) -> Option<Vec<A>>

source§

fn start_session(_: SessionIndex)

source§

fn end_session(_: SessionIndex)

Implementors§