git.delta.rocks / unique-network / refs/commits / 2df619c5c26c

difftreelog

fix lookahead leftovers

Yaroslav Bolyukin2023-11-17parent: #25775a5.patch.diff
in: master

6 files changed

modifiedprimitives/common/src/constants.rsdiffbeforeafterboth
26#[cfg(not(feature = "lookahead"))]26#[cfg(not(feature = "lookahead"))]
27pub const MILLISECS_PER_BLOCK: u64 = 12000;27pub const MILLISECS_PER_BLOCK: u64 = 12000;
28#[cfg(feature = "lookahead")]28#[cfg(feature = "lookahead")]
29pub const MILLISECS_PER_BLOCK: u64 = 3000;29pub const MILLISECS_PER_BLOCK: u64 = 6000;
30pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;30pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;
3131
32pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;32pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
modifiedruntime/common/config/parachain.rsdiffbeforeafterboth
43 #[cfg(feature = "lookahead")]43 #[cfg(feature = "lookahead")]
44 type CheckAssociatedRelayNumber =44 type CheckAssociatedRelayNumber =
45 cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;45 cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
46 #[cfg(feature = "lookahead")]
47 type ConsensusHook = ConsensusHook;
46}48}
4749
48impl parachain_info::Config for Runtime {}50impl parachain_info::Config for Runtime {}
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
17use frame_support::{17use frame_support::{
18 dispatch::DispatchClass,18 dispatch::DispatchClass,
19 ord_parameter_types, parameter_types,19 ord_parameter_types, parameter_types,
20 traits::{ConstBool, ConstU32, Everything, NeverEnsureOrigin},20 traits::{ConstBool, ConstU32, ConstU64, Everything, NeverEnsureOrigin},
21 weights::{21 weights::{
22 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},22 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
23 ConstantMultiplier,23 ConstantMultiplier,
134 type MaxKeyLen = MigrationMaxKeyLen;134 type MaxKeyLen = MigrationMaxKeyLen;
135}135}
136
137parameter_types! {
138 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
139}
140136
141impl pallet_timestamp::Config for Runtime {137impl pallet_timestamp::Config for Runtime {
142 /// A timestamp: milliseconds since the unix epoch.138 /// A timestamp: milliseconds since the unix epoch.
143 type Moment = u64;139 type Moment = u64;
144 type OnTimestampSet = ();140 type OnTimestampSet = ();
141 #[cfg(not(feature = "lookahead"))]
145 type MinimumPeriod = MinimumPeriod;142 type MinimumPeriod = ConstU64<{SLOT_DURATION / 2}>;
143 #[cfg(feature = "lookahead")]
144 type MinimumPeriod = ConstU64<0>;
146 type WeightInfo = ();145 type WeightInfo = ();
147}146}
148147
247 type DisabledValidators = ();246 type DisabledValidators = ();
248 type MaxAuthorities = MaxAuthorities;247 type MaxAuthorities = MaxAuthorities;
249 type AllowMultipleBlocksPerSlot = ConstBool<true>;248 type AllowMultipleBlocksPerSlot = ConstBool<true>;
249 #[cfg(feature = "lookahead")]
250 type SlotDuration = ConstU64<SLOT_DURATION>;
250}251}
251252
252impl pallet_utility::Config for Runtime {253impl pallet_utility::Config for Runtime {
modifiedruntime/common/mod.rsdiffbeforeafterboth
44use up_common::types::{AccountId, BlockNumber};44use up_common::types::{AccountId, BlockNumber};
4545
46use crate::{46use crate::{
47 AllPalletsWithSystem, Aura, Balances, InherentDataExt, Runtime, RuntimeCall, Signature,47 AllPalletsWithSystem, Aura, Balances, Runtime, RuntimeCall, Signature,
48 Treasury,48 Treasury,
49};49};
5050
146 }146 }
147}147}
148148
149#[cfg(not(feature = "lookahead"))]
149pub(crate) struct CheckInherents;150pub(crate) struct CheckInherents;
150151
152#[cfg(not(feature = "lookahead"))]
151impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {153impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
152 fn check_inherents(154 fn check_inherents(
153 block: &Block,155 block: &Block,
154 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,156 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
155 ) -> sp_inherents::CheckInherentsResult {157 ) -> sp_inherents::CheckInherentsResult {
158 use crate::InherentDataExt;
159
156 let relay_chain_slot = relay_state_proof160 let relay_chain_slot = relay_state_proof
157 .read_slot()161 .read_slot()
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
485485
486 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {486 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
487 fn slot_duration() -> sp_consensus_aura::SlotDuration {487 fn slot_duration() -> sp_consensus_aura::SlotDuration {
488 #[cfg(not(feature = "lookahead"))]
489 {
488 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())490 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
489 }491 }
492 #[cfg(feature = "lookahead")]
493 {
494 sp_consensus_aura::SlotDuration::from_millis(up_common::constants::SLOT_DURATION)
495 }
496 }
490497
491 fn authorities() -> Vec<AuraId> {498 fn authorities() -> Vec<AuraId> {
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
6767
68impl_common_runtime_apis!();68impl_common_runtime_apis!();
6969
70// CheckInherents is included in consensus hook
71#[cfg(not(feature = "lookahead"))]
70cumulus_pallet_parachain_system::register_validate_block!(72cumulus_pallet_parachain_system::register_validate_block!(
71 Runtime = Runtime,73 Runtime = Runtime,
72 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,74 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
73 CheckInherents = CheckInherents,75 CheckInherents = CheckInherents,
74);76);
77#[cfg(feature = "lookahead")]
78cumulus_pallet_parachain_system::register_validate_block!(
79 Runtime = Runtime,
80 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
81);
7582