Module session_manager

Source
Expand description

Implements pallet_partner_chains_session::SessionManager and pallet_partner_chains_session::ShouldEndSession, Partner Chain’s version of Substrate’s [pallet_session].

To wire the pallet_partner_chains_session pallet, a stub version of [pallet_session] has to be wired first. The config for this should be generated with a macro provided by this crate:

pallet_partner_chains_session::impl_pallet_session_config!(Runtime);

which expands to:

impl pallet_session::Config for Runtime where Runtime: pallet_partner_chains_session::Config { /* ... */ }

The partner chains session pallet has to be configured, for example:

impl pallet_partner_chains_session::Config for Runtime {
	type RuntimeEvent = RuntimeEvent;
	type ValidatorId = <Self as frame_system::Config>::AccountId;
	type ShouldEndSession = ValidatorManagementSessionManager<Runtime>;
	type NextSessionRotation = ();
	type SessionManager = ValidatorManagementSessionManager<Runtime>;
	type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
	type Keys = opaque::SessionKeys;
}

The order matters when wiring the pallets into the runtime! Partner Chains session_manager ValidatorManagementSessionManager writes to [pallet_session::pallet::CurrentIndex]. pallet_partner_chains_session needs to come last for correct initialization order. ValidatorManagementSessionManager is wired in by pallet_partner_chains_session.

construct_runtime!(
	pub struct Runtime {
		// ...
		SubstrateSession: pallet_session,
		PcSession: pallet_partner_chains_session,
		// ...
	}
);

Structs§

ValidatorManagementSessionManager
Session manager which takes committee from pallet_session_validator_management.