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