referrerpolicy=no-referrer-when-downgrade
pallet_session

Trait SessionManager

Source
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§

Source§

impl<T: Config, I> SessionManager<<T as Config>::ValidatorId> for NoteHistoricalRoot<T, I>

impl<T: Config> SessionManager<<T as Config>::AccountId> for Pallet<T>

impl<T: Config> SessionManager<<T as Config>::AccountId> for Pallet<T>

impl<T: Config> SessionManager<<T as Config>::AccountId> for Pallet<T>