difftreelog
fix lookahead leftovers
in: master
6 files changed
primitives/common/src/constants.rsdiffbeforeafterboth--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -26,7 +26,7 @@
#[cfg(not(feature = "lookahead"))]
pub const MILLISECS_PER_BLOCK: u64 = 12000;
#[cfg(feature = "lookahead")]
-pub const MILLISECS_PER_BLOCK: u64 = 3000;
+pub const MILLISECS_PER_BLOCK: u64 = 6000;
pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
runtime/common/config/parachain.rsdiffbeforeafterboth--- a/runtime/common/config/parachain.rs
+++ b/runtime/common/config/parachain.rs
@@ -43,6 +43,8 @@
#[cfg(feature = "lookahead")]
type CheckAssociatedRelayNumber =
cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
+ #[cfg(feature = "lookahead")]
+ type ConsensusHook = ConsensusHook;
}
impl parachain_info::Config for Runtime {}
runtime/common/config/substrate.rsdiffbeforeafterboth17use 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}136137parameter_types! {138 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;139}140136141impl 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}148147247 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}251252252impl pallet_utility::Config for Runtime {253impl pallet_utility::Config for Runtime {runtime/common/mod.rsdiffbeforeafterboth--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -44,7 +44,7 @@
use up_common::types::{AccountId, BlockNumber};
use crate::{
- AllPalletsWithSystem, Aura, Balances, InherentDataExt, Runtime, RuntimeCall, Signature,
+ AllPalletsWithSystem, Aura, Balances, Runtime, RuntimeCall, Signature,
Treasury,
};
@@ -146,13 +146,17 @@
}
}
+#[cfg(not(feature = "lookahead"))]
pub(crate) struct CheckInherents;
+#[cfg(not(feature = "lookahead"))]
impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
fn check_inherents(
block: &Block,
relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
) -> sp_inherents::CheckInherentsResult {
+ use crate::InherentDataExt;
+
let relay_chain_slot = relay_state_proof
.read_slot()
.expect("Could not read the relay chain slot from the proof");
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -485,7 +485,14 @@
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> sp_consensus_aura::SlotDuration {
- sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
+ #[cfg(not(feature = "lookahead"))]
+ {
+ sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
+ }
+ #[cfg(feature = "lookahead")]
+ {
+ sp_consensus_aura::SlotDuration::from_millis(up_common::constants::SLOT_DURATION)
+ }
}
fn authorities() -> Vec<AuraId> {
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -67,8 +67,15 @@
impl_common_runtime_apis!();
+// CheckInherents is included in consensus hook
+#[cfg(not(feature = "lookahead"))]
cumulus_pallet_parachain_system::register_validate_block!(
Runtime = Runtime,
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
CheckInherents = CheckInherents,
);
+#[cfg(feature = "lookahead")]
+cumulus_pallet_parachain_system::register_validate_block!(
+ Runtime = Runtime,
+ BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
+);