git.delta.rocks / unique-network / refs/commits / 750f6e16db9b

difftreelog

fix lookahead collator build

Yaroslav Bolyukin2023-10-13parent: #71be677.patch.diff
in: master

6 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6450,6 +6450,7 @@
  "cumulus-pallet-parachain-system",
  "cumulus-pallet-xcm",
  "cumulus-pallet-xcmp-queue",
+ "cumulus-primitives-aura",
  "cumulus-primitives-core",
  "cumulus-primitives-timestamp",
  "cumulus-primitives-utility",
@@ -8109,12 +8110,14 @@
  "pallet-evm-coder-substrate",
  "pallet-nonfungible",
  "pallet-refungible",
+ "pallet-structure",
  "parity-scale-codec",
  "scale-info",
  "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "up-common",
  "up-data-structs",
 ]
 
@@ -14732,6 +14735,7 @@
  "cumulus-client-consensus-proposer",
  "cumulus-client-network",
  "cumulus-client-service",
+ "cumulus-primitives-aura",
  "cumulus-primitives-core",
  "cumulus-primitives-parachain-inherent",
  "cumulus-relay-chain-inprocess-interface",
modifiedCargo.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" }
modifiednode/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',
modifiednode/cli/src/service.rsdiffbeforeafterboth
221 {221 {
222 }222 }
223);223);
224#[cfg(not(feature = "lookahead"))]
225ez_bounds!(
226 pub trait LookaheadApiDep {}
227);
228#[cfg(feature = "lookahead")]
229ez_bounds!(
230 pub trait LookaheadApiDep: cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> {}
231);
224232
225/// Starts a `ServiceBuilder` for a full service.233/// Starts a `ServiceBuilder` for a full service.
226///234///
358 + Sync366 + Sync
359 + 'static,367 + 'static,
360 RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,368 RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
369 RuntimeApi::RuntimeApi: LookaheadApiDep,
361 Runtime: RuntimeInstance,370 Runtime: RuntimeInstance,
362 ExecutorDispatch: NativeExecutionDispatch + 'static,371 ExecutorDispatch: NativeExecutionDispatch + 'static,
363{372{
687 announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,696 announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
688}697}
689698
699// Clones ignored for optional lookahead collator
700#[allow(clippy::redundant_clone)]
690pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(701pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
691 client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,702 client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
692 transaction_pool: Arc<703 transaction_pool: Arc<
701 + Sync712 + Sync
702 + 'static,713 + 'static,
703 RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,714 RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
715 RuntimeApi::RuntimeApi: LookaheadApiDep,
704 Runtime: RuntimeInstance,716 Runtime: RuntimeInstance,
705{717{
706 let StartConsensusParameters {718 let StartConsensusParameters {
735 client.clone(),747 client.clone(),
736 );748 );
737749
738 let block_import = ParachainBlockImport::new(client.clone(), backend);750 let block_import = ParachainBlockImport::new(client.clone(), backend.clone());
739751
740 let params = BuildAuraConsensusParams {752 let params = BuildAuraConsensusParams {
741 create_inherent_data_providers: move |_, ()| async move { Ok(()) },753 create_inherent_data_providers: move |_, ()| async move { Ok(()) },
742 block_import,754 block_import,
743 para_client: client,755 para_client: client.clone(),
744 #[cfg(feature = "lookahead")]756 #[cfg(feature = "lookahead")]
745 para_backend: backend,757 para_backend: backend,
746 para_id,758 para_id,
751 proposer,763 proposer,
752 collator_service,764 collator_service,
753 // With async-baking, we allowed to be both slower (longer authoring) and faster (multiple para blocks per relay block)765 // With async-baking, we allowed to be both slower (longer authoring) and faster (multiple para blocks per relay block)
766 #[cfg(not(feature = "lookahead"))]
754 authoring_duration: Duration::from_millis(500),767 authoring_duration: Duration::from_millis(500),
768 #[cfg(feature = "lookahead")]
769 authoring_duration: Duration::from_millis(1500),
755 overseer_handle,770 overseer_handle,
756 #[cfg(feature = "lookahead")]771 #[cfg(feature = "lookahead")]
757 code_hash_provider: || {},772 code_hash_provider: move |block_hash| {
773 client
774 .code_at(block_hash)
775 .ok()
776 .map(cumulus_primitives_core::relay_chain::ValidationCode)
777 .map(|c| c.hash())
778 },
758 collator_key,779 collator_key,
759 relay_chain_slot_duration,780 relay_chain_slot_duration,
762 task_manager.spawn_essential_handle().spawn(783 task_manager.spawn_essential_handle().spawn(
763 "aura",784 "aura",
764 None,785 None,
786 #[cfg(not(feature = "lookahead"))]
765 run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _>(params),787 run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _>(params),
788 #[cfg(feature = "lookahead")]
789 run_aura::<_, AuraAuthorityPair, _, _, _, _, _, _, _, _, _>(params),
766 );790 );
767 Ok(())791 Ok(())
768}792}
modifiedruntime/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 {
modifiedruntime/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 }