diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 6c496b6a221..ebcc8ebd19e 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -62,7 +62,7 @@ use frame_support::{ construct_runtime, pallet_prelude::*, parameter_types, - traits::{ConstU32, EitherOfDiverse, InstanceFilter}, + traits::{ConstU16, ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter}, weights::{ConstantMultiplier, DispatchClass, Weight}, PalletId, RuntimeDebug, }; @@ -136,7 +136,6 @@ parameter_types! { }) .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) .build_or_panic(); - pub const SS58Prefix: u8 = 0; } // Configure FRAME pallets to include in runtime. @@ -162,42 +161,34 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type AccountData = pallet_balances::AccountData; type SystemWeightInfo = weights::frame_system::WeightInfo; - type SS58Prefix = SS58Prefix; + type SS58Prefix = ConstU16<0>; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; } -parameter_types! { - pub const MinimumPeriod: u64 = SLOT_DURATION / 2; -} +pub const MINIMUM_PERIOD: u64 = SLOT_DURATION / 2; impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = (); - type MinimumPeriod = MinimumPeriod; + type MinimumPeriod = ConstU64; type WeightInfo = weights::pallet_timestamp::WeightInfo; } -parameter_types! { - pub const UncleGenerations: u32 = 0; -} - impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = UncleGenerations; + type UncleGenerations = ConstU32<0>; type FilterUncle = (); type EventHandler = (CollatorSelection,); } parameter_types! { pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; - pub const MaxLocks: u32 = 50; - pub const MaxReserves: u32 = 50; } impl pallet_balances::Config for Runtime { - type MaxLocks = MaxLocks; + type MaxLocks = ConstU32<50>; /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. @@ -206,14 +197,13 @@ impl pallet_balances::Config for Runtime { type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = weights::pallet_balances::WeightInfo; - type MaxReserves = MaxReserves; + type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; } parameter_types! { /// Relay Chain `TransactionByteFee` / 10 pub const TransactionByteFee: Balance = 1 * MILLICENTS; - pub const OperationalFeeMultiplier: u8 = 5; } impl pallet_transaction_payment::Config for Runtime { @@ -223,7 +213,7 @@ impl pallet_transaction_payment::Config for Runtime { type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; - type OperationalFeeMultiplier = OperationalFeeMultiplier; + type OperationalFeeMultiplier = ConstU8<5>; } parameter_types! { @@ -231,7 +221,6 @@ parameter_types! { pub const DepositBase: Balance = deposit(1, 88); // Additional storage item size of 32 bytes. pub const DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; } impl pallet_multisig::Config for Runtime { @@ -240,7 +229,7 @@ impl pallet_multisig::Config for Runtime { type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; - type MaxSignatories = MaxSignatories; + type MaxSignatories = ConstU16<100>; type WeightInfo = weights::pallet_multisig::WeightInfo; } @@ -256,11 +245,9 @@ parameter_types! { pub const ProxyDepositBase: Balance = deposit(1, 40); // Additional storage item size of 33 bytes. pub const ProxyDepositFactor: Balance = deposit(0, 33); - pub const MaxProxies: u16 = 32; // One storage item; key size 32, value size 16 pub const AnnouncementDepositBase: Balance = deposit(1, 48); pub const AnnouncementDepositFactor: Balance = deposit(0, 66); - pub const MaxPending: u16 = 32; } /// The type used to represent the kinds of proxying allowed. @@ -334,9 +321,9 @@ impl pallet_proxy::Config for Runtime { type ProxyType = ProxyType; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = MaxProxies; + type MaxProxies = ConstU32<32>; type WeightInfo = weights::pallet_proxy::WeightInfo; - type MaxPending = MaxPending; + type MaxPending = ConstU32<32>; type CallHasher = BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; @@ -383,19 +370,16 @@ impl cumulus_pallet_dmp_queue::Config for Runtime { type ExecuteOverweightOrigin = EnsureRoot; } -parameter_types! { - pub const Period: u32 = 6 * HOURS; - pub const Offset: u32 = 0; - pub const MaxAuthorities: u32 = 100_000; -} +pub const PERIOD: u32 = 6 * HOURS; +pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { type Event = Event; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ShouldEndSession = pallet_session::PeriodicSessions; - type NextSessionRotation = pallet_session::PeriodicSessions; + type ShouldEndSession = pallet_session::PeriodicSessions, ConstU32>; + type NextSessionRotation = pallet_session::PeriodicSessions, ConstU32>; type SessionManager = CollatorSelection; // Essentially just Aura, but lets be pedantic. type SessionHandler = ::KeyTypeIdProviders; @@ -406,15 +390,12 @@ impl pallet_session::Config for Runtime { impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; type DisabledValidators = (); - type MaxAuthorities = MaxAuthorities; + type MaxAuthorities = ConstU32<100_000>; } parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; pub const ExecutiveBody: BodyId = BodyId::Executive; } @@ -427,11 +408,11 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<1000>; + type MinCandidates = ConstU32<5>; + type MaxInvulnerables = ConstU32<100>; // should be a multiple of session or things will get inconsistent - type KickThreshold = Period; + type KickThreshold = ConstU32; type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorRegistration = Session; @@ -478,9 +459,10 @@ impl ProposalProvider for AllianceProposalProvider { parameter_types! { pub const AllianceMotionDuration: BlockNumber = 5 * DAYS; - pub const AllianceMaxProposals: u32 = 100; - pub const AllianceMaxMembers: u32 = 100; + } +pub const ALLIANCE_MAX_PROPOSALS: u32 = 100; +pub const ALLIANCE_MAX_MEMBERS: u32 = 100; type AllianceCollective = pallet_collective::Instance1; impl pallet_collective::Config for Runtime { @@ -488,16 +470,17 @@ impl pallet_collective::Config for Runtime { type Proposal = Call; type Event = Event; type MotionDuration = AllianceMotionDuration; - type MaxProposals = AllianceMaxProposals; - type MaxMembers = AllianceMaxMembers; + type MaxProposals = ConstU32; + type MaxMembers = ConstU32; type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; type WeightInfo = pallet_collective::weights::SubstrateWeight; } +pub const MAX_FOUNDERS: u32 = 10; +pub const MAX_FELLOWS: u32 = ALLIANCE_MAX_MEMBERS - MAX_FOUNDERS; +pub const MAX_ALLIES: u32 = 100; + parameter_types! { - pub const MaxFounders: u32 = 10; - pub const MaxFellows: u32 = AllianceMaxMembers::get() - MaxFounders::get(); - pub const MaxAllies: u32 = 100; pub const AllyDeposit: Balance = 1_000 * UNITS; // 1,000 DOT bond to join as an Ally } @@ -522,14 +505,14 @@ impl pallet_alliance::Config for Runtime { type MembershipChanged = AllianceMotion; type IdentityVerifier = (); // Don't block accounts on identity criteria type ProposalProvider = AllianceProposalProvider; - type MaxProposals = AllianceMaxProposals; - type MaxFounders = MaxFounders; - type MaxFellows = MaxFellows; - type MaxAllies = MaxAllies; + type MaxProposals = ConstU32; + type MaxFounders = ConstU32; + type MaxFellows = ConstU32; + type MaxAllies = ConstU32; type MaxUnscrupulousItems = ConstU32<100>; type MaxWebsiteUrlLength = ConstU32<255>; type MaxAnnouncementsCount = ConstU32<100>; - type MaxMembersCount = AllianceMaxMembers; + type MaxMembersCount = ConstU32; type AllyDeposit = AllyDeposit; type WeightInfo = pallet_alliance::weights::SubstrateWeight; }