mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-03 12:17:24 +00:00
15c253117d
* guide: merge backing and approval keys * bump substrate master & update primitives * use new SessionInfo struct in session_info * session keys upgrade for Polkadot * kusama & westend runtimes * bump westend, kusama, and polkadot versions * add session key to rococo & test-runtime * update prepare-test-net to latest subkey * update chain specs to support new para_assignment session key * get cargo.lock from master * formatting * update kill_storage based on substrate master * fix test-service * assgn -> asgn * use session info module for assignment session key
2.3 KiB
2.3 KiB
Session Info
For disputes and approvals, we need access to information about validator sets from prior sessions. We also often want easy access to the same information about the current session's validator set. This module aggregates and stores this information in a rolling window while providing easy APIs for access.
Storage
Helper structs:
struct SessionInfo {
// validators in canonical ordering. These are the public keys used for backing,
// dispute participation, and approvals.
validators: Vec<ValidatorId>,
// validators' authority discovery keys for the session in canonical ordering.
discovery_keys: Vec<DiscoveryId>,
// The assignment keys for validators.
assignment_keys: Vec<AssignmentId>,
// validators in shuffled ordering - these are the validator groups as produced
// by the `Scheduler` module for the session and are typically referred to by
// `GroupIndex`.
validator_groups: Vec<Vec<ValidatorIndex>>,
// The number of availability cores used by the protocol during this session.
n_cores: u32,
// the zeroth delay tranche width.
zeroth_delay_tranche_width: u32,
// The number of samples we do of relay_vrf_modulo.
relay_vrf_modulo_samples: u32,
// The number of delay tranches in total.
n_delay_tranches: u32,
// How many slots (BABE / SASSAFRAS) must pass before an assignment is considered a
// no-show.
no_show_slots: u32,
/// The number of validators needed to approve a block.
needed_approvals: u32,
}
Storage Layout:
/// The earliest session for which previous session info is stored.
EarliestStoredSession: SessionIndex,
/// Session information. Should have an entry from `EarliestStoredSession..=CurrentSessionIndex`
Sessions: map SessionIndex => Option<SessionInfo>,
Session Change
- Update
EarliestStoredSessionbased onconfig.dispute_periodand remove all entries fromSessionsfrom the previous value up to the new value. - Create a new entry in
Sessionswith information about the current session.
Routines
earliest_stored_session() -> SessionIndex: Yields the earliest session for which we have information stored.session_info(session: SessionIndex) -> Option<SessionInfo>: Yields the session info for the given session, if stored.