common_runtime/
constants.rs1use crate::prod_or_testnet_or_local;
2use common_primitives::node::{Balance, BlockNumber};
3use parity_scale_codec::{Encode, MaxEncodedLen};
4
5use frame_support::{
6 parameter_types,
7 sp_runtime::{Perbill, Permill},
8 traits::{ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Get},
9 weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
10 PalletId,
11};
12
13pub const FREQUENCY_TESTNET_TOKEN: &str = "XRQCY";
15pub const FREQUENCY_LOCAL_TOKEN: &str = "UNIT";
16pub const FREQUENCY_TOKEN: &str = "FRQCY";
17pub const TOKEN_DECIMALS: u8 = 8;
18
19pub const CHAIN_ID: u32 = prod_or_testnet_or_local!(2091u32, 420420420u32, 420420420u32);
21
22pub type MaxSchemaGrants = ConstU32<30>;
24
25pub const MILLISECS_PER_BLOCK: u64 = 6_000;
32
33pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
36
37pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
39pub const HOURS: BlockNumber = MINUTES * 60;
40pub const DAYS: BlockNumber = HOURS * 24;
41
42pub mod currency {
44 use common_primitives::node::Balance;
45
46 pub const EXISTENTIAL_DEPOSIT: Balance = CENTS;
48
49 pub const UNITS: Balance = 10u128.saturating_pow(super::TOKEN_DECIMALS as u32);
50 pub const DOLLARS: Balance = UNITS; pub const CENTS: Balance = DOLLARS / 100; pub const MILLICENTS: Balance = CENTS / 1_000; pub const fn deposit(items: u32, bytes: u32) -> Balance {
58 items as Balance * 20 * DOLLARS + (bytes as Balance) * 100 * MILLICENTS
59 }
60}
61
62pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
65
66pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
69
70pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
72 WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
73 cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
74);
75
76pub type ZERO = ConstU32<0>;
77pub type TWO = ConstU32<2>;
78pub type FIFTY = ConstU32<50>;
79pub type HUNDRED = ConstU32<100>;
80
81pub type FrameSystemMaxConsumers = ConstU32<16>;
83pub type MsaMaxPublicKeysPerMsa = ConstU8<25>;
88pub type MSAMortalityWindowSize = ConstU32<{ 20 * MINUTES }>;
90pub type MSAMaxSignaturesStored = ConstU32<50_000>;
93#[derive(Clone, Copy, Debug, Eq, PartialEq)]
95pub struct MsaMaxProviderNameSize;
96impl Get<u32> for MsaMaxProviderNameSize {
97 fn get() -> u32 {
98 256
99 }
100}
101#[derive(Clone, Copy, Debug, Eq, PartialEq)]
103pub struct MsaMaxLanguageCodeSize;
104impl Get<u32> for MsaMaxLanguageCodeSize {
105 fn get() -> u32 {
106 8
107 }
108}
109#[derive(Clone, Copy, Debug, Eq, PartialEq)]
111pub struct MsaMaxLogoCidSize;
112impl Get<u32> for MsaMaxLogoCidSize {
113 fn get() -> u32 {
114 64
115 }
116}
117#[derive(Clone, Copy, Debug, Eq, PartialEq)]
119pub struct MsaMaxLocaleCount;
120impl Get<u32> for MsaMaxLocaleCount {
121 fn get() -> u32 {
122 10
123 }
124}
125#[derive(Clone, Copy, Debug, Eq, PartialEq)]
127pub struct MsaMaxLogoSize;
128impl Get<u32> for MsaMaxLogoSize {
129 fn get() -> u32 {
130 1024 * 128
131 }
132}
133parameter_types! {
137 pub const SchemasMaxBytesBoundedVecLimit :u32 = 65_500;
139}
140pub type IntentsMaxRegistrations = ConstU16<65_000>;
142pub type IntentGroupMaxIntents = ConstU32<10>;
144pub type SchemasMaxRegistrations = ConstU16<65_000>;
146pub type SchemasMinModelSizeBytes = ConstU32<8>;
148pub type MaxSchemaSettingsPerSchema = ConstU32<2>;
150
151impl Encode for SchemasMaxBytesBoundedVecLimit {}
152
153impl MaxEncodedLen for SchemasMaxBytesBoundedVecLimit {
154 fn max_encoded_len() -> usize {
155 u32::max_encoded_len()
156 }
157}
158pub type HandleSuffixMin = ConstU16<10>;
164pub type HandleSuffixMax = ConstU16<99>;
166pub type MinReleaseTransfer = ConstU128<{ currency::EXISTENTIAL_DEPOSIT }>;
170
171pub const MAX_RELEASE_SCHEDULES: u32 = 50;
173pub type MinimumPeriod = ConstU64<0>;
177pub type AuthorshipUncleGenerations = ZERO;
181pub type BalancesMaxLocks = FIFTY;
185pub type BalancesMaxReserves = FIFTY;
186pub type BalancesMaxFreezes = TWO; pub type SchedulerMaxScheduledPerBlock = FIFTY;
191pub type PreimageMaxSize = ConstU32<{ 4096 * 1024 }>;
197
198pub type PreimageBaseDeposit = ConstU128<{ currency::deposit(10, 64) }>;
199pub type PreimageByteDeposit = ConstU128<{ currency::deposit(0, 1) }>;
200pub type CouncilMaxProposals = ConstU32<25>;
205pub type CouncilMaxMembers = ConstU32<10>;
207
208pub type CouncilMotionDuration = ConstU32<{ 5 * DAYS }>;
209pub type TCMaxProposals = ConstU32<25>;
214pub type TCMaxMembers = ConstU32<10>;
216
217pub type TCMotionDuration = ConstU32<{ 5 * DAYS }>;
218pub type LaunchPeriod = ConstU32<{ prod_or_testnet_or_local!(7 * DAYS, 1 * DAYS, 5 * MINUTES) }>;
224pub type VotingPeriod = ConstU32<{ prod_or_testnet_or_local!(7 * DAYS, 1 * DAYS, 5 * MINUTES) }>;
225pub type FastTrackVotingPeriod =
226 ConstU32<{ prod_or_testnet_or_local!(3 * HOURS, 30 * MINUTES, 5 * MINUTES) }>;
227pub type EnactmentPeriod =
228 ConstU32<{ prod_or_testnet_or_local!(8 * DAYS, 30 * HOURS, 10 * MINUTES) }>;
229pub type CooloffPeriod = ConstU32<{ prod_or_testnet_or_local!(7 * DAYS, 1 * DAYS, 5 * MINUTES) }>;
230pub type MinimumDeposit = ConstU128<
231 {
232 prod_or_testnet_or_local!(
233 currency::deposit(5, 0),
234 100 * currency::deposit(5, 0),
235 100 * currency::deposit(5, 0)
236 )
237 },
238>;
239pub type SpendPeriod =
240 ConstU32<{ prod_or_testnet_or_local!(7 * DAYS, 10 * MINUTES, 10 * MINUTES) }>;
241pub type DemocracyMaxVotes = ConstU32<100>;
242pub type DemocracyMaxProposals = HUNDRED;
243pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry");
249
250parameter_types! {
254
255 pub const TreasuryPalletId: PalletId = TREASURY_PALLET_ID;
257
258 pub const ProposalBondPercent: Permill = Permill::from_percent(5);
261
262 pub const Burn: Permill = Permill::zero();
265}
266
267pub type MaxApprovals = ConstU32<64>;
270
271pub type ProposalBondMinimum = ConstU128<{ 100 * currency::DOLLARS }>;
273
274pub type ProposalBondMaximum = ConstU128<{ 1_000 * currency::DOLLARS }>;
276
277pub type TransactionPaymentOperationalFeeMultiplier = ConstU8<5>;
282
283pub type TransactionByteFee = ConstU128<{ 10 * currency::MILLICENTS }>;
285pub type MaximumCapacityBatchLength = ConstU8<10>;
289pub type SessionPeriod = ConstU32<{ 6 * HOURS }>;
293pub type SessionOffset = ZERO;
294pub type AuraMaxAuthorities = ConstU32<100_000>;
299pub type CollatorMaxCandidates = ConstU32<50>;
307pub type CollatorMinCandidates = ConstU32<{ prod_or_testnet_or_local!(1, 0, 0) }>;
308pub type CollatorMaxInvulnerables = ConstU32<{ prod_or_testnet_or_local!(16, 5, 5) }>;
309pub type CollatorKickThreshold =
310 ConstU32<{ prod_or_testnet_or_local!(6 * HOURS, 6 * HOURS, 6 * HOURS) }>;
311
312parameter_types! {
314 pub const NeverDepositIntoId: PalletId = PalletId(*b"NeverDep");
315}
316parameter_types! {
321 pub const ProxyDepositBase: Balance = currency::deposit(1, 8);
323 pub const ProxyDepositFactor: Balance = currency::deposit(0, 33);
325 pub const MaxProxies: u16 = 32;
326 pub const AnnouncementDepositBase: Balance = currency::deposit(1, 8);
327 pub const AnnouncementDepositFactor: Balance = currency::deposit(0, 66);
328 pub const MaxPending: u16 = 32;
329}
330parameter_types! {
334 pub const MessagesMaxPayloadSizeBytes: u32 = 1024 * 3; }
336pub type MessagesMigrateEmitEvery = ConstU32<10_000>; impl Clone for MessagesMaxPayloadSizeBytes {
340 fn clone(&self) -> Self {
341 MessagesMaxPayloadSizeBytes {}
342 }
343}
344
345impl core::fmt::Debug for MessagesMaxPayloadSizeBytes {
346 #[cfg(feature = "std")]
347 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
348 write!(f, "MessagesMaxPayloadSizeBytes<{:?}>", Self::get())
349 }
350
351 #[cfg(not(feature = "std"))]
352 fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result {
353 Ok(())
354 }
355}
356
357impl Encode for MessagesMaxPayloadSizeBytes {}
358
359impl MaxEncodedLen for MessagesMaxPayloadSizeBytes {
360 fn max_encoded_len() -> usize {
361 u32::max_encoded_len()
362 }
363}
364parameter_types! {
368 pub const Ss58Prefix: u16 = prod_or_testnet_or_local!(90, 42, 42);
372}
373
374parameter_types! {
377 pub const MaxItemizedBlobSizeBytes: u32 = 1024;
379 pub const MaxItemizedPageSizeBytes: u32 = 10 * (1024 + 5);
382 pub const MaxPaginatedPageSizeBytes: u32 = 1 * 1024;
384}
385pub type MaxPaginatedPageId = ConstU16<32>;
387pub type MaxItemizedActionsCount = ConstU32<5>;
389pub type StatefulMortalityWindowSize = ConstU32<{ 2 * DAYS }>;
391pub type StatefulMigrateEmitEvery = ConstU32<10_000>;
393impl Default for MaxItemizedPageSizeBytes {
396 fn default() -> Self {
397 Self
398 }
399}
400
401impl Default for MaxPaginatedPageSizeBytes {
402 fn default() -> Self {
403 Self
404 }
405}
406
407impl Clone for MaxItemizedBlobSizeBytes {
408 fn clone(&self) -> Self {
409 MaxItemizedBlobSizeBytes {}
410 }
411}
412
413impl PartialEq for MaxItemizedBlobSizeBytes {
414 fn eq(&self, _other: &Self) -> bool {
415 true
417 }
418}
419
420impl core::fmt::Debug for MaxItemizedBlobSizeBytes {
421 #[cfg(feature = "std")]
422 fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result {
423 Ok(())
424 }
425
426 #[cfg(not(feature = "std"))]
427 fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result {
428 Ok(())
429 }
430}
431
432pub type CapacityMinimumStakingAmount = ConstU128<{ currency::EXISTENTIAL_DEPOSIT }>;
434pub type CapacityMinimumTokenBalance = ConstU128<{ currency::DOLLARS }>;
435pub type CapacityMaxUnlockingChunks = ConstU32<4>;
436pub type CapacityMaxEpochLength = ConstU32<{ 2 * DAYS }>; #[cfg(not(any(feature = "frequency-local", feature = "frequency-no-relay")))]
439pub type CapacityUnstakingThawPeriod = ConstU16<30>; #[cfg(any(feature = "frequency-local", feature = "frequency-no-relay"))]
442pub type CapacityUnstakingThawPeriod = ConstU16<2>; parameter_types! {
446 pub const CapacityPerToken: Perbill = Perbill::from_percent(2);
449 pub const CapacityRewardCap: Permill = Permill::from_parts(5_750); }
451pub type CapacityRewardEraLength =
452 ConstU32<{ prod_or_testnet_or_local!(14 * DAYS, 1 * HOURS, 50) }>;
453
454#[cfg(feature = "frequency-bridging")]
458pub mod xcm_version {
459 pub const SAFE_XCM_VERSION: u32 = 4;
463}