Crates.io | noble-session |
lib.rs | noble-session |
version | 2.0.0 |
source | src |
created_at | 2021-04-04 05:06:01.443065 |
updated_at | 2021-04-04 05:06:01.443065 |
description | FABRIC sessions noble |
homepage | https://core.tetcoin.org |
repository | https://github.com/tetcoin/tetcore |
max_upload_size | |
id | 378629 |
size | 88,409 |
The Session module allows validators to manage their session keys, provides a function for changing the session length, and handles session rotation.
ShouldEndSession
trait. When the session is ending, a new validator set
can be chosen by OnSessionEnding
implementations.set_keys
for use not in
the next session, but the session after next. They are stored in NextKeys
, a mapping between
the caller's ValidatorId
and the session keys provided. set_keys
allows users to set their
session key prior to being selected as validator.
It is a public call since it uses ensure_signed
, which checks that the origin is a signed account.
As such, the account ID of the origin stored in NextKeys
may not necessarily be associated with
a block author or a validator. The session keys of accounts are removed once their account balance is zero.ShouldEndSession
to dictate a new session's start.
This noble provides the PeriodicSessions
struct for simple periodic sessions.on_initialize
function
queries the provided implementation of ShouldEndSession
. If the session is to end the newly
activated validator IDs and session keys are taken from storage and passed to the
SessionHandler
. The validator set supplied by SessionManager::new_session
and the corresponding session
keys, which may have been registered via set_keys
during the previous session, are written
to storage where they will wait one session before being passed to the SessionHandler
themselves.The Session noble is designed to make the following possible:
set_keys
- Set a validator's session keys for upcoming sessions.rotate_session
- Change to the next session. Register the new authority set. Queue changes
for next session rotation.disable_index
- Disable a validator by index.disable
- Disable a validator by Validator IDThe Staking noble uses the Session noble to get the validator set.
use noble_session as session;
fn validators<T: noble_session::Config>() -> Vec<<T as noble_session::Config>::ValidatorId> {
<noble_session::Module<T>>::validators()
}
License: Apache-2.0