difftreelog
fix lookahead collator build
in: master
6 files changed
Cargo.lockdiffbeforeafterboth6450 "cumulus-pallet-parachain-system",6450 "cumulus-pallet-parachain-system",6451 "cumulus-pallet-xcm",6451 "cumulus-pallet-xcm",6452 "cumulus-pallet-xcmp-queue",6452 "cumulus-pallet-xcmp-queue",6453 "cumulus-primitives-aura",6453 "cumulus-primitives-core",6454 "cumulus-primitives-core",6454 "cumulus-primitives-timestamp",6455 "cumulus-primitives-timestamp",6455 "cumulus-primitives-utility",6456 "cumulus-primitives-utility",8109 "pallet-evm-coder-substrate",8110 "pallet-evm-coder-substrate",8110 "pallet-nonfungible",8111 "pallet-nonfungible",8111 "pallet-refungible",8112 "pallet-refungible",8113 "pallet-structure",8112 "parity-scale-codec",8114 "parity-scale-codec",8113 "scale-info",8115 "scale-info",8114 "sp-core",8116 "sp-core",8115 "sp-io",8117 "sp-io",8116 "sp-runtime",8118 "sp-runtime",8117 "sp-std",8119 "sp-std",8120 "up-common",8118 "up-data-structs",8121 "up-data-structs",8119]8122]8120812314732 "cumulus-client-consensus-proposer",14735 "cumulus-client-consensus-proposer",14733 "cumulus-client-network",14736 "cumulus-client-network",14734 "cumulus-client-service",14737 "cumulus-client-service",14738 "cumulus-primitives-aura",14735 "cumulus-primitives-core",14739 "cumulus-primitives-core",14736 "cumulus-primitives-parachain-inherent",14740 "cumulus-primitives-parachain-inherent",14737 "cumulus-relay-chain-inprocess-interface",14741 "cumulus-relay-chain-inprocess-interface",Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -100,6 +100,7 @@
cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
+cumulus-primitives-aura = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
cumulus-primitives-parachain-inherent = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
node/cli/Cargo.tomldiffbeforeafterboth--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -36,6 +36,7 @@
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-network = { workspace = true }
cumulus-client-service = { workspace = true }
+cumulus-primitives-aura = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { features = ["std"], workspace = true }
cumulus-relay-chain-inprocess-interface = { workspace = true }
@@ -113,7 +114,9 @@
'quartz-runtime?/gov-test-timings',
'unique-runtime?/gov-test-timings',
]
-lookahead = []
+lookahead = [
+ 'opal-runtime/lookahead'
+]
pov-estimate = [
'opal-runtime/pov-estimate',
'quartz-runtime?/pov-estimate',
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -221,6 +221,14 @@
{
}
);
+#[cfg(not(feature = "lookahead"))]
+ez_bounds!(
+ pub trait LookaheadApiDep {}
+);
+#[cfg(feature = "lookahead")]
+ez_bounds!(
+ pub trait LookaheadApiDep: cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> {}
+);
/// Starts a `ServiceBuilder` for a full service.
///
@@ -358,6 +366,7 @@
+ Sync
+ 'static,
RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+ RuntimeApi::RuntimeApi: LookaheadApiDep,
Runtime: RuntimeInstance,
ExecutorDispatch: NativeExecutionDispatch + 'static,
{
@@ -687,6 +696,8 @@
announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
}
+// Clones ignored for optional lookahead collator
+#[allow(clippy::redundant_clone)]
pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
transaction_pool: Arc<
@@ -701,6 +712,7 @@
+ Sync
+ 'static,
RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
+ RuntimeApi::RuntimeApi: LookaheadApiDep,
Runtime: RuntimeInstance,
{
let StartConsensusParameters {
@@ -735,12 +747,12 @@
client.clone(),
);
- let block_import = ParachainBlockImport::new(client.clone(), backend);
+ let block_import = ParachainBlockImport::new(client.clone(), backend.clone());
let params = BuildAuraConsensusParams {
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
block_import,
- para_client: client,
+ para_client: client.clone(),
#[cfg(feature = "lookahead")]
para_backend: backend,
para_id,
@@ -751,10 +763,19 @@
proposer,
collator_service,
// With async-baking, we allowed to be both slower (longer authoring) and faster (multiple para blocks per relay block)
+ #[cfg(not(feature = "lookahead"))]
authoring_duration: Duration::from_millis(500),
+ #[cfg(feature = "lookahead")]
+ authoring_duration: Duration::from_millis(1500),
overseer_handle,
#[cfg(feature = "lookahead")]
- code_hash_provider: || {},
+ code_hash_provider: move |block_hash| {
+ client
+ .code_at(block_hash)
+ .ok()
+ .map(cumulus_primitives_core::relay_chain::ValidationCode)
+ .map(|c| c.hash())
+ },
collator_key,
relay_chain_slot_duration,
};
@@ -762,7 +783,10 @@
task_manager.spawn_essential_handle().spawn(
"aura",
None,
+ #[cfg(not(feature = "lookahead"))]
run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _>(params),
+ #[cfg(feature = "lookahead")]
+ run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _, _, _>(params),
);
Ok(())
}
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -679,6 +679,17 @@
}
}
+ #[cfg(feature = "lookahead")]
+ impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
+ fn can_build_upon(
+ _included_hash: <Block as BlockT>::Hash,
+ _slot: cumulus_primitives_aura::Slot,
+ ) -> bool {
+ // FIXME: Limit velocity
+ true
+ }
+ }
+
/// Should never be used, yet still required because of https://github.com/paritytech/polkadot-sdk/issues/27
/// Not allowed to panic, because rpc may be called using native runtime, thus causing thread panic.
impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -69,6 +69,7 @@
'cumulus-pallet-parachain-system/std',
'cumulus-pallet-xcm/std',
'cumulus-pallet-xcmp-queue/std',
+ 'cumulus-primitives-aura/std',
'cumulus-primitives-core/std',
'cumulus-primitives-utility/std',
'frame-executive/std',
@@ -230,6 +231,7 @@
preimage = []
refungible = []
session-test-timings = []
+lookahead = []
################################################################################
# local dependencies
@@ -240,6 +242,7 @@
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
+cumulus-primitives-aura = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-timestamp = { workspace = true }
cumulus-primitives-utility = { workspace = true }