solochain_template_runtime/configs/
mod.rs1use frame_support::{
28 derive_impl,
29 dispatch::DispatchClass,
30 parameter_types,
31 traits::{ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, VariantCountOf},
32 weights::{
33 constants::{RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND},
34 IdentityFee, Weight,
35 },
36};
37use frame_system::limits::{BlockLength, BlockWeights};
38use pallet_transaction_payment::{ConstFeeMultiplier, FungibleAdapter, Multiplier};
39use sp_consensus_aura::sr25519::AuthorityId as AuraId;
40use sp_runtime::{traits::One, Perbill};
41use sp_version::RuntimeVersion;
42
43use super::{
45 AccountId, Aura, Balance, Balances, Block, BlockNumber, Hash, Nonce, PalletInfo, Runtime,
46 RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask,
47 System, EXISTENTIAL_DEPOSIT, SLOT_DURATION, VERSION,
48};
49
50const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
51
52parameter_types! {
53 pub const BlockHashCount: BlockNumber = 2400;
54 pub const Version: RuntimeVersion = VERSION;
55
56 pub RuntimeBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(
58 Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX),
59 NORMAL_DISPATCH_RATIO,
60 );
61 pub RuntimeBlockLength: BlockLength = BlockLength::builder()
62 .max_length(5 * 1024 * 1024)
63 .modify_max_length_for_class(DispatchClass::Normal, |m| *m = NORMAL_DISPATCH_RATIO * *m)
64 .build();
65 pub const SS58Prefix: u8 = 42;
66}
67
68#[allow(unused_parens)]
72type SingleBlockMigrations = ();
73
74#[derive_impl(frame_system::config_preludes::SolochainDefaultConfig)]
78impl frame_system::Config for Runtime {
79 type Block = Block;
81 type BlockWeights = RuntimeBlockWeights;
83 type BlockLength = RuntimeBlockLength;
85 type AccountId = AccountId;
87 type Nonce = Nonce;
89 type Hash = Hash;
91 type BlockHashCount = BlockHashCount;
93 type DbWeight = RocksDbWeight;
95 type Version = Version;
97 type AccountData = pallet_balances::AccountData<Balance>;
99 type SS58Prefix = SS58Prefix;
101 type MaxConsumers = frame_support::traits::ConstU32<16>;
102 type SingleBlockMigrations = SingleBlockMigrations;
103}
104
105impl pallet_aura::Config for Runtime {
106 type AuthorityId = AuraId;
107 type DisabledValidators = ();
108 type MaxAuthorities = ConstU32<32>;
109 type AllowMultipleBlocksPerSlot = ConstBool<false>;
110 type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Runtime>;
111}
112
113impl pallet_grandpa::Config for Runtime {
114 type RuntimeEvent = RuntimeEvent;
115
116 type WeightInfo = ();
117 type MaxAuthorities = ConstU32<32>;
118 type MaxNominators = ConstU32<0>;
119 type MaxSetIdSessionEntries = ConstU64<0>;
120
121 type KeyOwnerProof = sp_core::Void;
122 type EquivocationReportSystem = ();
123}
124
125impl pallet_timestamp::Config for Runtime {
126 type Moment = u64;
128 type OnTimestampSet = Aura;
129 type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
130 type WeightInfo = ();
131}
132
133impl pallet_balances::Config for Runtime {
134 type MaxLocks = ConstU32<50>;
135 type MaxReserves = ();
136 type ReserveIdentifier = [u8; 8];
137 type Balance = Balance;
139 type RuntimeEvent = RuntimeEvent;
141 type DustRemoval = ();
142 type ExistentialDeposit = ConstU128<EXISTENTIAL_DEPOSIT>;
143 type AccountStore = System;
144 type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
145 type FreezeIdentifier = RuntimeFreezeReason;
146 type MaxFreezes = VariantCountOf<RuntimeFreezeReason>;
147 type RuntimeHoldReason = RuntimeHoldReason;
148 type RuntimeFreezeReason = RuntimeFreezeReason;
149 type DoneSlashHandler = ();
150}
151
152parameter_types! {
153 pub FeeMultiplier: Multiplier = Multiplier::one();
154}
155
156impl pallet_transaction_payment::Config for Runtime {
157 type RuntimeEvent = RuntimeEvent;
158 type OnChargeTransaction = FungibleAdapter<Balances, ()>;
159 type OperationalFeeMultiplier = ConstU8<5>;
160 type WeightToFee = IdentityFee<Balance>;
161 type LengthToFee = IdentityFee<Balance>;
162 type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;
163 type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight<Runtime>;
164}
165
166impl pallet_sudo::Config for Runtime {
167 type RuntimeEvent = RuntimeEvent;
168 type RuntimeCall = RuntimeCall;
169 type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
170}
171
172impl pallet_template::Config for Runtime {
174 type RuntimeEvent = RuntimeEvent;
175 type WeightInfo = pallet_template::weights::SubstrateWeight<Runtime>;
176}