pallet_partner_chains_session/
pallet_session_compat.rs1use sp_staking::SessionIndex;
4use sp_std::prelude::*;
5
6pub struct PalletSessionStubImpls;
8
9impl<T> pallet_session::ShouldEndSession<T> for PalletSessionStubImpls {
10 fn should_end_session(_: T) -> bool {
11 false
12 }
13}
14
15impl<T> pallet_session::SessionManager<T> for PalletSessionStubImpls {
16 fn new_session(_: SessionIndex) -> Option<Vec<T>> {
17 None
18 }
19
20 fn end_session(_: SessionIndex) {}
21
22 fn start_session(_: SessionIndex) {}
23}
24
25impl<T> sp_runtime::traits::Convert<T, Option<T>> for PalletSessionStubImpls {
26 fn convert(t: T) -> Option<T> {
27 Some(t)
28 }
29}
30
31#[macro_export]
34macro_rules! impl_pallet_session_config {
35 ($type:ty) => {
36 impl pallet_session::Config for $type
37 where
38 $type: pallet_partner_chains_session::Config,
39 {
40 type RuntimeEvent = <$type as pallet_partner_chains_session::Config>::RuntimeEvent;
41 type ValidatorId = <$type as pallet_partner_chains_session::Config>::ValidatorId;
42 type ValidatorIdOf =
43 pallet_partner_chains_session::pallet_session_compat::PalletSessionStubImpls;
44 type ShouldEndSession =
45 pallet_partner_chains_session::pallet_session_compat::PalletSessionStubImpls;
46 type NextSessionRotation = ();
47 type SessionManager =
48 pallet_partner_chains_session::pallet_session_compat::PalletSessionStubImpls;
49 type SessionHandler = <$type as pallet_partner_chains_session::Config>::SessionHandler;
50 type Keys = <$type as pallet_partner_chains_session::Config>::Keys;
51 type DisablingStrategy = ();
52 type WeightInfo = ();
53 }
54 };
55}