1234567891011121314151617use frame_support::{parameter_types, PalletId};18use frame_system::EnsureRoot;19use crate::{20 AccountId, Balance, Balances, BlockNumber, Runtime, RuntimeEvent, Aura, Session, SessionKeys,21 CollatorSelection, Treasury,22 config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},23};24use sp_runtime::Perbill;25use up_common::constants::{UNIQUE, MILLIUNIQUE};2627parameter_types! {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 EventHandler = CollatorSelection;52}5354parameter_types! {55 56 pub const BasicDeposit: Balance = 10 * UNIQUE;57 pub const FieldDeposit: Balance = 25 * MILLIUNIQUE;58 pub const SubAccountDeposit: Balance = 2 * UNIQUE;59 pub const MaxSubAccounts: u32 = 100;60 pub const MaxAdditionalFields: u32 = 100;61 pub const MaxRegistrars: u32 = 20;62 pub const LicenceBondIdentifier: [u8; 16] = *b"licenceidentifie";63}6465impl pallet_identity::Config for Runtime {66 type RuntimeEvent = RuntimeEvent;67 type Currency = Balances;68 type BasicDeposit = BasicDeposit;69 type FieldDeposit = FieldDeposit;70 type MaxAdditionalFields = MaxAdditionalFields;71 type MaxRegistrars = MaxRegistrars;72 type MaxSubAccounts = MaxSubAccounts;73 type SubAccountDeposit = SubAccountDeposit;74 type RegistrarOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;75 type ForceOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;76 type Slashed = Treasury;77 type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;78}7980parameter_types! {81 pub const PotId: PalletId = PalletId(*b"PotStake");82 pub const SlashRatio: Perbill = Perbill::from_percent(100);83}8485impl pallet_collator_selection::Config for Runtime {86 type RuntimeEvent = RuntimeEvent;87 88 type UpdateOrigin = EnsureRoot<AccountId>;89 type TreasuryAccountId = TreasuryAccountId;90 type PotId = PotId;91 type MaxCollators = MaxCollators;92 type SlashRatio = SlashRatio;93 type ValidatorId = <Self as frame_system::Config>::AccountId;94 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;95 type ValidatorRegistration = Session;96 type WeightInfo = pallet_collator_selection::weights::SubstrateWeight<Runtime>;97 type LicenceBondIdentifier = LicenceBondIdentifier;98}