1234567891011121314151617use frame_support::{parameter_types, PalletId};18#[cfg(not(feature = "governance"))]19use frame_system::EnsureRoot;20use pallet_configuration::{21 CollatorSelectionDesiredCollatorsOverride, CollatorSelectionKickThresholdOverride,22 CollatorSelectionLicenseBondOverride,23};24use sp_runtime::Perbill;25use up_common::constants::{MILLIUNIQUE, UNIQUE};2627#[cfg(feature = "governance")]28use crate::config::governance;29use crate::{30 config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},31 Aura, Balance, Balances, BlockNumber, CollatorSelection, Runtime, RuntimeEvent,32 RuntimeHoldReason, Session, SessionKeys, Treasury,33};34parameter_types! {35 pub const SessionOffset: BlockNumber = 0;36}3738impl pallet_session::Config for Runtime {39 type RuntimeEvent = RuntimeEvent;40 type ValidatorId = <Self as frame_system::Config>::AccountId;41 42 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;43 type ShouldEndSession = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;44 type NextSessionRotation = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;45 type SessionManager = CollatorSelection;46 47 type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;48 type Keys = SessionKeys;49 type WeightInfo = pallet_session::weights::SubstrateWeight<Self>; 50}5152parameter_types! {53 pub const UncleGenerations: u32 = 0;54}5556impl pallet_authorship::Config for Runtime {57 type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;58 type EventHandler = CollatorSelection;59}6061parameter_types! {62 63 pub const BasicDeposit: Balance = 10 * UNIQUE;64 pub const FieldDeposit: Balance = 25 * MILLIUNIQUE;65 pub const SubAccountDeposit: Balance = 2 * UNIQUE;66 pub const MaxSubAccounts: u32 = 100;67 pub const MaxAdditionalFields: u32 = 100;68 pub const MaxRegistrars: u32 = 20;69 pub const LicenceBondIdentifier: [u8; 16] = *b"licenceidentifie";70 pub LicenseBond: Balance = CollatorSelectionLicenseBondOverride::<Runtime>::get();71 pub DesiredCollators: u32 = CollatorSelectionDesiredCollatorsOverride::<Runtime>::get();72 pub KickThreshold: BlockNumber = CollatorSelectionKickThresholdOverride::<Runtime>::get();73}7475impl pallet_identity::Config for Runtime {76 type RuntimeEvent = RuntimeEvent;77 type Currency = Balances;78 type BasicDeposit = BasicDeposit;79 type FieldDeposit = FieldDeposit;80 type MaxAdditionalFields = MaxAdditionalFields;81 type MaxRegistrars = MaxRegistrars;82 type MaxSubAccounts = MaxSubAccounts;83 type SubAccountDeposit = SubAccountDeposit;8485 #[cfg(feature = "governance")]86 type RegistrarOrigin = governance::RootOrTechnicalCommitteeMember;8788 #[cfg(feature = "governance")]89 type ForceOrigin = governance::RootOrTechnicalCommitteeMember;9091 #[cfg(not(feature = "governance"))]92 type RegistrarOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;9394 #[cfg(not(feature = "governance"))]95 type ForceOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;9697 type Slashed = Treasury;98 type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;99}100101parameter_types! {102 pub const PotId: PalletId = PalletId(*b"PotStake");103 pub const SlashRatio: Perbill = Perbill::from_percent(100);104}105106impl pallet_collator_selection::Config for Runtime {107 type RuntimeEvent = RuntimeEvent;108 type RuntimeHoldReason = RuntimeHoldReason;109 type Currency = Balances;110 111112 113 114 #[cfg(feature = "governance")]115 type UpdateOrigin = governance::RootOrAllTechnicalCommittee;116117 118 119 #[cfg(not(feature = "governance"))]120 type UpdateOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;121122 type TreasuryAccountId = TreasuryAccountId;123 type PotId = PotId;124 type MaxCollators = MaxCollators;125 type SlashRatio = SlashRatio;126 type ValidatorId = <Self as frame_system::Config>::AccountId;127 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;128 type ValidatorRegistration = Session;129 type WeightInfo = pallet_collator_selection::weights::SubstrateWeight<Runtime>;130 type DesiredCollators = DesiredCollators;131 type LicenseBond = LicenseBond;132 type KickThreshold = KickThreshold;133}