timechain_runtime/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
//! This is the official timechain runtime.
//!
//! # Timechain Runtime and Environments
//!
//! New code is first tested on development (develop), then integrated with all other projects on integration.
//!
//! Once ready for release, new features start long term testing on testnet (testnet). Once everybody is happy, including the community and external partners, features are brought to timechain (mainnet).
//!
//! The staging can be optionally used to test any mainnet specific migrations, features or other oddities.
//!
//! | Name    | Features         | Profile |
//! |---------|------------------|---------|
//! | mainnet | default          | mainnet |
//! | staging | develop          | testnet |
//! | testnet | testnet          | testnet |
//! | develop | testnet,develop  | testnet |
//!
//! Until we can extract individual package config a bit better,
//! please check [`Runtime`] and the individual pallets.
//!
//! ## Frame Configuration
//!
//! |Section       |Pallet                |Config Implementation                               |
//! |--------------|----------------------|----------------------------------------------------|
//! |__Core__      |[`System`]            |[`Config`](struct@Runtime#config.System)            |
//! |              |[`Timestamp`]         |[`Config`](struct@Runtime#config.Timestamp)         |
//! |__Consensus__ |[`Authorship`]        |[`Config`](struct@Runtime#config.Authorship)        |
//! |              |[`Session`]           |[`Config`](struct@Runtime#config.Session)           |
//! |              |[`Historical`]        |[`Config`](struct@Runtime#config.Historical)        |
//! |              |[`Babe`]              |[`Config`](struct@Runtime#config.Babe)              |
//! |              |[`Grandpa`]           |[`Config`](struct@Runtime#config.Grandpa)           |
//! |              |[`ImOnline`]          |[`Config`](struct@Runtime#config.ImOnline)          |
//! |              |[`AuthorityDiscovery`]|[`Config`](struct@Runtime#config.AuthorityDiscovery)|
//! |__Tokenomics__|[`Balances`]          |[`Config`](struct@Runtime#config.Balances)          |
//! |              |[`TransactionPayment`]|[`Config`](struct@Runtime#config.TransactionPayment)|
//! |              |[`Vesting`]           |[`Config`](struct@Runtime#config.Vesting)           |
//! |__Utilities__ |[`Utility`]           |[`Config`](struct@Runtime#config.Utility)           |
//! |              |[`Proxy`]             |[`Config`](struct@Runtime#config.Proxy)             |
//! |              |[`Multisig`]          |[`Config`](struct@Runtime#config.Multisig)          |
//!
//! ### Nominated Proof of Stake
//! - [`ElectionProviderMultiPhase`]
//! - [`Staking`]
//! - [`VoterList`]
//! - [`Offences`]
//!
//! ### On-chain services
//!  - [`Identity`]
//!  - [`Preimage`]
//!  - [`Scheduler`]
//!
//! ### On-chain governance
//!  - [`TechnicalCommittee`]
//!  - [`TechnicalMembership`]
//!
//! ### Custom pallets
//!  - [`Governance`]
//!  - [`Members`]
//!  - [`Shards`]
//!  - [`Elections`]
//!  - [`Tasks`]
//!  - [`Timegraph`]
//!  - [`Networks`]
//!  - [`Dmail`]
//!
//! ## Weights and Fees
//!
//! ## Governance
//!
//! The main body of governance is responsible for maintaining the chain and
//! keeping it operational.
//!
//! ### Technical Committee
//!
//! The technical committee is managed using the [`pallet_collective`], [`pallet_membership`] and our own custom [`pallet_governance`].
//!
//! While the first two pallets tally the votes and manage the membership of the committee, our custom pallet it used to elevate committee origin to more privileged level for selected calls.
//!
//! Can be compiled with `#[no_std]`, ready for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limits.
#![recursion_limit = "1024"]
// Allow more readable constants
#![allow(clippy::identity_op)]
#![allow(non_local_definitions)]

// The runtime is split into its components
pub mod apis;
pub mod configs;
pub mod offchain;
pub mod version;

/// Helpers to handle variant flags
pub mod variants;

// Important global exports
pub use apis::RuntimeApi;
pub use version::VERSION;

// The runtime configs and its sections
pub use configs::consensus::SessionKeys;
pub use configs::core::{
	BlockHashCount, RuntimeBlockLength, RuntimeBlockWeights, AVERAGE_ON_INITIALIZE_RATIO,
};
#[cfg(feature = "testnet")]
pub use configs::custom::PrevalidateFeeless;
pub use configs::governance::DefaultAdminOrigin;
pub use configs::tokenomics::{ExistentialDeposit, LengthToFee, WeightToFee};

/// Import variant constants and macros
pub use variants::*;

/// Runtime benchmark list
#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
mod benches;

/// Runtime test suite
#[cfg(test)]
mod tests;

/// Benchmarked pallet weights
mod weights;
pub use weights::{BlockExecutionWeight, ExtrinsicBaseWeight};

/// Automatically generated nomination bag boundaries
mod staking_bags;

// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

// Import all substrate dependencies
use polkadot_sdk::*;

use frame_support::{
	parameter_types,
	traits::fungible::{Credit, Debt},
	traits::Currency,
	weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
};
use pallet_session::historical as pallet_session_historical;
use sp_runtime::generic;
use sp_std::prelude::*;

// Base timechain base primitives
pub use time_primitives::{
	AccountId, Balance, BlockHash, BlockNumber, Header, Moment, Nonce, Signature, ANLOG,
	MICROANLOG, MILLIANLOG,
};

// A few exports that help ease life for downstream crates.
#[cfg(any(feature = "std", test))]
pub use frame_system::Call as SystemCall;
#[cfg(any(feature = "std", test))]
pub use pallet_balances::Call as BalancesCall;
#[cfg(any(feature = "std", test))]
pub use pallet_staking::StakerStatus;
#[cfg(any(feature = "std", test))]
pub use pallet_timestamp::Call as TimestampCall;
#[cfg(any(feature = "std", test))]
pub use pallet_utility::Call as UtilityCall;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;

/// We allow for 2 seconds of compute with a 6 second average block time, with maximum proof size.
pub const MAXIMUM_BLOCK_WEIGHT: Weight =
	Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), u64::MAX);

/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;

/// Shared signing extensions
#[cfg(not(feature = "testnet"))]
pub type SignedExtra<Runtime> = (
	frame_system::CheckNonZeroSender<Runtime>,
	frame_system::CheckSpecVersion<Runtime>,
	frame_system::CheckTxVersion<Runtime>,
	frame_system::CheckGenesis<Runtime>,
	frame_system::CheckEra<Runtime>,
	frame_system::CheckNonce<Runtime>,
	frame_system::CheckWeight<Runtime>,
	pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
	frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

/// Shared signing extensions
#[cfg(feature = "testnet")]
pub type SignedExtra<Runtime> = (
	frame_system::CheckNonZeroSender<Runtime>,
	frame_system::CheckSpecVersion<Runtime>,
	frame_system::CheckTxVersion<Runtime>,
	frame_system::CheckGenesis<Runtime>,
	frame_system::CheckEra<Runtime>,
	frame_system::CheckNonce<Runtime>,
	frame_system::CheckWeight<Runtime>,
	pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
	frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
	PrevalidateFeeless<Runtime>,
);

/// Type shorthand for the balance type used to charge transaction fees
pub type PaymentBalanceOf<T> = <<T as pallet_transaction_payment::Config>::OnChargeTransaction as pallet_transaction_payment::OnChargeTransaction<T>>::Balance;

/// Block type as expected by this runtime.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// A Block signed with a Justification
pub type SignedBlock = generic::SignedBlock<Block>;
/// BlockId type as expected by this runtime.
pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic.
pub type RuntimeSignedExtra = SignedExtra<Runtime>;

#[cfg(feature = "testnet")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct EthExtraImpl;

#[cfg(feature = "testnet")]
impl pallet_revive::evm::runtime::EthExtra for EthExtraImpl {
	type Config = Runtime;
	type Extension = RuntimeSignedExtra;

	fn get_eth_extension(nonce: u32, tip: Balance) -> Self::Extension {
		(
			frame_system::CheckNonZeroSender::<Runtime>::new(),
			frame_system::CheckSpecVersion::<Runtime>::new(),
			frame_system::CheckTxVersion::<Runtime>::new(),
			frame_system::CheckGenesis::<Runtime>::new(),
			frame_system::CheckEra::from(generic::Era::Immortal),
			frame_system::CheckNonce::<Runtime>::from(nonce),
			frame_system::CheckWeight::<Runtime>::new(),
			pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
			frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(false),
			PrevalidateFeeless::<Runtime>::new(),
		)
	}
}

#[cfg(feature = "testnet")]
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
	pallet_revive::evm::runtime::UncheckedExtrinsic<Address, Signature, EthExtraImpl>;
#[cfg(not(feature = "testnet"))]
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
	generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, RuntimeSignedExtra>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<RuntimeCall, RuntimeSignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, RuntimeSignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
	Runtime,
	Block,
	frame_system::ChainContext<Runtime>,
	Runtime,
	AllPalletsWithSystem,
	Migrations,
>;

// Useful types when handling currency
pub type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
pub type PositiveImbalance = <Balances as Currency<AccountId>>::PositiveImbalance;

pub type RuntimeCredit =
	Credit<<Runtime as frame_system::Config>::AccountId, pallet_balances::Pallet<Runtime>>;
pub type RuntimeDebt =
	Debt<<Runtime as frame_system::Config>::AccountId, pallet_balances::Pallet<Runtime>>;

/// Max size for serialized extrinsic params for this testing runtime.
/// This is a quite arbitrary but empirically battle tested value.
#[cfg(test)]
pub const CALL_PARAMS_MAX_SIZE: usize = 448;

/// Maximum block size
pub const MAX_BLOCK_LENGTH: u32 = 5 * 1024 * 1024;

/// Average expected block time that we are targeting.
pub const MILLISECS_PER_BLOCK: Moment = 6000;

/// Minimum duration at which blocks will be produced.
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;

// These time units are defined in number of blocks.
pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;
pub const MINUTES: BlockNumber = 60 / (SECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;

pub const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100;

/// TODO: 1 in 4 blocks (on average, not counting collisions) will be primary BABE blocks.
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);

/// Shared default babe genesis config
pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
	sp_consensus_babe::BabeEpochConfiguration {
		c: PRIMARY_PROBABILITY,
		allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryVRFSlots,
	};

/// Shared per-byte storage fee
pub const STORAGE_BYTE_FEE: Balance = MILLIANLOG;

/// Shared fee structure for items put in storage
pub const fn deposit(items: u32, bytes: u32) -> Balance {
	items as Balance * 10 * ANLOG + (bytes as Balance) * STORAGE_BYTE_FEE
}

parameter_types! {
	/// An epoch is a unit of time used for key operations in the consensus mechanism, such as validator
	/// rotations and randomness generation. Once set at genesis, this value cannot be changed without
	/// breaking block production.
	pub const EpochDuration: u64 = main_test_or_dev!(3 * HOURS, 30 * MINUTES, 5 * MINUTES) as u64;

	/// This defines the interval at which new blocks are produced in the blockchain. It impacts
	/// the speed of transaction processing and finality, as well as the load on the network
	/// and validators. The value is defined in milliseconds.
	pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;

	/// The number of sessions that constitute an era. An era is the time period over which staking rewards
	/// are distributed, and validator set changes can occur. The era duration is a function of the number of
	/// sessions and the length of each session.
	pub const SessionsPerEra: sp_staking::SessionIndex = 4;

	/// The number of eras that a bonded stake must remain locked after the owner has requested to unbond.
	/// This value represents 21 days, assuming each era is 12 hours long. This delay is intended to increase
	/// network security by preventing stakers from immediately withdrawing funds after participating in staking.
	pub const BondingDuration: sp_staking::EraIndex = 2 * 21;

	/// The maximum number of validators a nominator can nominate. This sets an upper limit on how many validators
	/// can be supported by a single nominator. A higher number allows more decentralization but increases the
	/// complexity of the staking system.
	pub const MaxNominators: u32 = main_or_test!(0, 16);

	/// Maximum numbers of authorities
	pub const MaxAuthorities: u32 = 100;
}

pub type TechnicalCollective = pallet_collective::Instance1;

/// Mainnet runtime assembly
#[cfg(not(feature = "testnet"))]
#[frame_support::runtime]
mod runtime {
	use super::*;

	#[runtime::runtime]
	#[runtime::derive(
		RuntimeCall,
		RuntimeEvent,
		RuntimeError,
		RuntimeOrigin,
		RuntimeFreezeReason,
		RuntimeHoldReason,
		RuntimeSlashReason,
		RuntimeLockId,
		RuntimeTask
	)]
	pub struct Runtime;

	// = SDK pallets =

	// Core pallets

	/// Base pallet mandatory for all frame runtimes.
	/// Current configuration can be found here [here](struct@Runtime#config.System).
	#[runtime::pallet_index(0)]
	pub type System = frame_system;

	/// Simple timestamp extension.
	/// Current configuration can be found here [here](struct@Runtime#config.Timestamp).
	#[runtime::pallet_index(1)]
	pub type Timestamp = pallet_timestamp;

	// Block production, finality, heartbeat and discovery

	/// Blind Assignment for Blockchain Extension block production.
	/// Current configuration can be found here [here](struct@Runtime#config.Babe).
	#[runtime::pallet_index(2)]
	pub type Babe = pallet_babe;

	/// GHOST-based Recursive Ancestor Deriving Prefix Agreement finality gadget.
	/// Current configuration can be found here [here](struct@Runtime#config.Grandpa).
	#[runtime::pallet_index(3)]
	pub type Grandpa = pallet_grandpa;

	/// Validator heartbeat protocol.
	/// Current configuration can be found here [here](struct@Runtime#config.ImOnline).
	#[runtime::pallet_index(4)]
	pub type ImOnline = pallet_im_online;

	/// Validator peer-to-peer discovery.
	/// Current configuration can be found here [here](struct@Runtime#config.AuthorityDiscovery).
	#[runtime::pallet_index(5)]
	pub type AuthorityDiscovery = pallet_authority_discovery;

	/// Authorship tracking extension.
	/// Current configuration can be found here [here](struct@Runtime#config.Authorship).
	#[runtime::pallet_index(6)]
	pub type Authorship = pallet_authorship;

	#[runtime::pallet_index(7)]
	pub type Session = pallet_session;

	#[runtime::pallet_index(8)]
	pub type Historical = pallet_session_historical;

	// Tokens, fees and vesting

	/// Current configuration can be found here [here](struct@Runtime#config.Balances).
	#[runtime::pallet_index(9)]
	pub type Balances = pallet_balances;

	/// Current configuration can be found here [here](struct@Runtime#config.TransactionPayment).
	#[runtime::pallet_index(10)]
	pub type TransactionPayment = pallet_transaction_payment;

	/// Current configuration can be found here [here](struct@Runtime#config.Vesting).
	#[runtime::pallet_index(11)]
	pub type Vesting = pallet_vesting;

	// Batch, proxy and multisig support

	/// Current configuration can be found here [here](struct@Runtime#config.Utility).
	#[runtime::pallet_index(12)]
	pub type Utility = pallet_utility;

	/// Current configuration can be found here [here](struct@Runtime#config.Proxy).
	#[runtime::pallet_index(13)]
	pub type Proxy = pallet_proxy;

	/// Current configuration can be found here [here](struct@Runtime#config.Multisig).
	#[runtime::pallet_index(14)]
	pub type Multisig = pallet_multisig;

	// Nominated proof of stake

	#[runtime::pallet_index(15)]
	pub type ElectionProviderMultiPhase = pallet_election_provider_multi_phase;

	#[runtime::pallet_index(16)]
	pub type Staking = pallet_staking;

	#[runtime::pallet_index(17)]
	pub type VoterList = pallet_bags_list<Instance1>;

	#[runtime::pallet_index(18)]
	pub type Offences = pallet_offences;

	#[runtime::pallet_index(28)]
	pub type NominationPools = pallet_nomination_pools;

	#[runtime::pallet_index(29)]
	pub type DelegatedStaking = pallet_delegated_staking;

	// On-chain governance

	#[runtime::pallet_index(22)]
	pub type TechnicalCommittee = pallet_collective<Instance1>;

	#[runtime::pallet_index(23)]
	pub type TechnicalMembership = pallet_membership;

	// Custom governance

	#[runtime::pallet_index(32)]
	pub type Governance = pallet_governance;

	// Custom funding pallets

	#[runtime::pallet_index(42)]
	pub type Airdrop = pallet_airdrop;

	#[runtime::pallet_index(43)]
	pub type Launch = pallet_launch;

	#[runtime::pallet_index(44)]
	pub type Bridge = pallet_bridge;
}

/// Testnet and develop runtime assembly
#[cfg(feature = "testnet")]
#[frame_support::runtime]
mod runtime {
	use super::*;

	#[runtime::runtime]
	#[runtime::derive(
		RuntimeCall,
		RuntimeEvent,
		RuntimeError,
		RuntimeOrigin,
		RuntimeFreezeReason,
		RuntimeHoldReason,
		RuntimeSlashReason,
		RuntimeLockId,
		RuntimeTask
	)]
	pub struct Runtime;

	// = SDK pallets =

	// Core pallets

	/// Base pallet mandatory for all frame runtimes.
	/// Current configuration can be found here [here](struct@Runtime#config.System).
	#[runtime::pallet_index(0)]
	pub type System = frame_system;

	/// Simple timestamp extension.
	/// Current configuration can be found here [here](struct@Runtime#config.Timestamp).
	#[runtime::pallet_index(1)]
	pub type Timestamp = pallet_timestamp;

	// Block production, finality, heartbeat and discovery

	/// Blind Assignment for Blockchain Extension block production.
	/// Current configuration can be found here [here](struct@Runtime#config.Babe).
	#[runtime::pallet_index(2)]
	pub type Babe = pallet_babe;

	/// GHOST-based Recursive Ancestor Deriving Prefix Agreement finality gadget.
	/// Current configuration can be found here [here](struct@Runtime#config.Grandpa).
	#[runtime::pallet_index(3)]
	pub type Grandpa = pallet_grandpa;

	/// Validator heartbeat protocol.
	/// Current configuration can be found here [here](struct@Runtime#config.ImOnline).
	#[runtime::pallet_index(4)]
	pub type ImOnline = pallet_im_online;

	/// Validator peer-to-peer discovery.
	/// Current configuration can be found here [here](struct@Runtime#config.AuthorityDiscovery).
	#[runtime::pallet_index(5)]
	pub type AuthorityDiscovery = pallet_authority_discovery;

	#[runtime::pallet_index(6)]
	pub type Authorship = pallet_authorship;

	#[runtime::pallet_index(7)]
	pub type Session = pallet_session;

	#[runtime::pallet_index(8)]
	pub type Historical = pallet_session_historical;

	// Tokens, fees and vesting

	/// Current configuration can be found here [here](struct@Runtime#config.AuthorityDiscovery).
	#[runtime::pallet_index(9)]
	pub type Balances = pallet_balances;

	/// Current configuration can be found here [here](struct@Runtime#config.AuthorityDiscovery).
	#[runtime::pallet_index(10)]
	pub type TransactionPayment = pallet_transaction_payment;

	/// Current configuration can be found here [here](struct@Runtime#config.AuthorityDiscovery).
	#[runtime::pallet_index(11)]
	pub type Vesting = pallet_vesting;

	// Batch, proxy and multisig support

	/// Current configuration can be found here [here](struct@Runtime#config.Utility).
	#[runtime::pallet_index(12)]
	pub type Utility = pallet_utility;

	/// Current configuration can be found here [here](struct@Runtime#config.Proxy).
	#[runtime::pallet_index(13)]
	pub type Proxy = pallet_proxy;

	/// Current configuration can be found here [here](struct@Runtime#config.Multisig).
	#[runtime::pallet_index(14)]
	pub type Multisig = pallet_multisig;

	// Nominated proof of stake

	#[runtime::pallet_index(15)]
	pub type ElectionProviderMultiPhase = pallet_election_provider_multi_phase;

	#[runtime::pallet_index(16)]
	pub type Staking = pallet_staking;

	#[runtime::pallet_index(17)]
	pub type VoterList = pallet_bags_list<Instance1>;

	#[runtime::pallet_index(18)]
	pub type Offences = pallet_offences;

	#[runtime::pallet_index(28)]
	pub type NominationPools = pallet_nomination_pools;

	#[runtime::pallet_index(29)]
	pub type DelegatedStaking = pallet_delegated_staking;

	// On-chain identity,storage and scheduler

	#[runtime::pallet_index(19)]
	pub type Identity = pallet_identity;

	#[runtime::pallet_index(20)]
	pub type Preimage = pallet_preimage;

	#[runtime::pallet_index(21)]
	pub type Scheduler = pallet_scheduler;

	// On-chain governance

	#[runtime::pallet_index(22)]
	pub type TechnicalCommittee = pallet_collective<Instance1>;

	#[runtime::pallet_index(23)]
	pub type TechnicalMembership = pallet_membership;

	// = Custom pallets =

	// Custom governance

	#[runtime::pallet_index(32)]
	pub type Governance = pallet_governance;

	// general message passing pallets

	#[runtime::pallet_index(33)]
	pub type Members = pallet_members;

	#[runtime::pallet_index(34)]
	pub type Shards = pallet_shards;

	#[runtime::pallet_index(35)]
	pub type Elections = pallet_elections;

	#[runtime::pallet_index(36)]
	pub type Tasks = pallet_tasks;

	#[runtime::pallet_index(37)]
	pub type Timegraph = pallet_timegraph;

	#[runtime::pallet_index(38)]
	pub type Networks = pallet_networks;

	// token bridging

	#[runtime::pallet_index(44)]
	pub type Bridge = pallet_bridge;

	// Smart Contracts

	#[runtime::pallet_index(50)]
	pub type Revive = pallet_revive;
}

// All migrations executed on runtime upgrade.
type Migrations = ();

#[cfg(test)]
mod core_tests {
	use super::*;

	use frame_system::offchain::CreateSignedTransaction;

	#[test]
	fn validate_transaction_submitter_bounds() {
		fn is_submit_signed_transaction<T>()
		where
			T: CreateSignedTransaction<RuntimeCall>,
		{
		}

		is_submit_signed_transaction::<Runtime>();
	}

	#[test]
	fn call_size() {
		let size = core::mem::size_of::<RuntimeCall>();
		assert!(
			size <= CALL_PARAMS_MAX_SIZE,
			"size of RuntimeCall {} is more than {CALL_PARAMS_MAX_SIZE} bytes.
			 Some calls have too big arguments, use Box to reduce the size of RuntimeCall.
			 If the limit is too strong, maybe consider increase the limit.",
			size,
		);
	}
}