referrerpolicy=no-referrer-when-downgrade

Trait frame_support::traits::EstimateNextNewSession

source ·
pub trait EstimateNextNewSession<BlockNumber> {
    // Required methods
    fn average_session_length() -> BlockNumber;
    fn estimate_next_new_session(
        _: BlockNumber,
    ) -> (Option<BlockNumber>, Weight);
}
Expand description

Something that can estimate at which block scheduling of the next session will happen (i.e when we will try to fetch new validators).

This only refers to the point when we fetch the next session details and not when we enact them (for enactment there’s EstimateNextSessionRotation). With pallet-session this should be triggered whenever SessionManager::new_session is called.

For example, if we are using a staking module this would be the block when the session module would ask staking what the next validator set will be, as such this must always be implemented by the session module.

Required Methods§

source

fn average_session_length() -> BlockNumber

Return the average length of a session.

This may or may not be accurate.

source

fn estimate_next_new_session(_: BlockNumber) -> (Option<BlockNumber>, Weight)

Return the block number at which the next new session is estimated to happen.

None should be returned if the estimation fails to come to an answer.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<BlockNumber: Zero> EstimateNextNewSession<BlockNumber> for ()

source§

fn average_session_length() -> BlockNumber

source§

fn estimate_next_new_session(_: BlockNumber) -> (Option<BlockNumber>, Weight)

Implementors§