1234567891011121314151617use frame_support::{parameter_types, PalletId};18use frame_system::EnsureRoot;19use crate::{20 AccountId, BlockNumber, Runtime, RuntimeEvent, Balances, Aura, Session, SessionKeys,21 CollatorSelection,22};23use up_common::constants::*;2425parameter_types! {26 pub const SessionPeriod: BlockNumber = HOURS;27 pub const SessionOffset: BlockNumber = 0;28}2930impl pallet_session::Config for Runtime {31 type RuntimeEvent = RuntimeEvent;32 type ValidatorId = <Self as frame_system::Config>::AccountId;33 34 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;35 type ShouldEndSession = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;36 type NextSessionRotation = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;37 type SessionManager = CollatorSelection;38 39 type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;40 type Keys = SessionKeys;41 type WeightInfo = pallet_session::weights::SubstrateWeight<Self>; 42}4344parameter_types! {45 pub const UncleGenerations: u32 = 0;46}4748impl pallet_authorship::Config for Runtime {49 type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;50 type UncleGenerations = UncleGenerations;51 type FilterUncle = ();52 type EventHandler = CollatorSelection;53}5455parameter_types! {56 pub const PotId: PalletId = PalletId(*b"PotStake");57 pub const MaxCandidates: u32 = 1000;58 pub const MinCandidates: u32 = 5;59 pub const MaxInvulnerables: u32 = 100;60}6162impl pallet_collator_selection::Config for Runtime {63 type RuntimeEvent = RuntimeEvent;64 type Currency = Balances;65 66 type UpdateOrigin = EnsureRoot<AccountId>;67 type PotId = PotId;68 type MaxCandidates = MaxCandidates;69 type MinCandidates = MinCandidates;70 type MaxInvulnerables = MaxInvulnerables;71 72 73 type KickThreshold = SessionPeriod;74 type ValidatorId = <Self as frame_system::Config>::AccountId;75 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;76 type ValidatorRegistration = Session;77 type WeightInfo = ();78}