1234567891011121314151617use frame_support::{parameter_types, PalletId};18use frame_system::EnsureRoot;19use crate::{20 AccountId, BlockNumber, Runtime, RuntimeEvent, Balances, Aura, Session, SessionKeys,21 CollatorSelection, config::pallets::TreasuryAccountId,22};23use sp_runtime::Perbill;24use up_common::constants::*;2526parameter_types! {27 pub const SessionPeriod: BlockNumber = SESSION_LENGTH;28 pub const SessionOffset: BlockNumber = 0;29}3031impl pallet_session::Config for Runtime {32 type RuntimeEvent = RuntimeEvent;33 type ValidatorId = <Self as frame_system::Config>::AccountId;34 35 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;36 type ShouldEndSession = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;37 type NextSessionRotation = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;38 type SessionManager = CollatorSelection;39 40 type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;41 type Keys = SessionKeys;42 type WeightInfo = pallet_session::weights::SubstrateWeight<Self>; 43}4445parameter_types! {46 pub const UncleGenerations: u32 = 0;47}4849impl pallet_authorship::Config for Runtime {50 type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;51 type UncleGenerations = UncleGenerations;52 type FilterUncle = ();53 type EventHandler = CollatorSelection;54}5556parameter_types! {57 pub const PotId: PalletId = PalletId(*b"PotStake");58 pub const MaxCollators: u32 = 10;59 pub const SlashRatio: Perbill = Perbill::from_percent(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 TreasuryAccountId = TreasuryAccountId;68 type PotId = PotId;69 type MaxCollators = MaxCollators;70 71 type SlashRatio = SlashRatio;72 type ValidatorId = <Self as frame_system::Config>::AccountId;73 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;74 type ValidatorRegistration = Session;75 type WeightInfo = ();76}