difftreelog
fix lookahead collator build
in: master
6 files changed
Cargo.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",
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.tomldiffbeforeafterboth1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Node'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'unique-node'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version.workspace = true1415[[bin]]16name = 'unique-collator'17path = "src/main.rs"1819[package.metadata.docs.rs]20targets = ['x86_64-unknown-linux-gnu']2122[dependencies]23clap = "4.4"24futures = '0.3.28'25serde_json = "1.0"26tokio = { version = "1.32", features = ["time"] }2728log = { workspace = true }2930parity-scale-codec = { workspace = true }3132cumulus-client-cli = { workspace = true }33cumulus-client-collator = { workspace = true }34cumulus-client-consensus-aura = { workspace = true }35cumulus-client-consensus-common = { workspace = true }36cumulus-client-consensus-proposer = { workspace = true }37cumulus-client-network = { workspace = true }38cumulus-client-service = { workspace = true }39cumulus-primitives-core = { workspace = true }40cumulus-primitives-parachain-inherent = { features = ["std"], workspace = true }41cumulus-relay-chain-inprocess-interface = { workspace = true }42cumulus-relay-chain-interface = { workspace = true }43cumulus-relay-chain-minimal-node = { workspace = true }44frame-benchmarking = { workspace = true }45frame-benchmarking-cli = { workspace = true }46opal-runtime = { workspace = true, optional = true }47pallet-transaction-payment-rpc-runtime-api = { workspace = true }48polkadot-cli = { workspace = true }49polkadot-primitives = { workspace = true }50polkadot-service = { workspace = true }51quartz-runtime = { workspace = true, optional = true }52sc-basic-authorship = { workspace = true }53sc-chain-spec = { workspace = true }54sc-cli = { workspace = true }55sc-client-api = { workspace = true }56sc-consensus = { workspace = true }57sc-consensus-manual-seal = { workspace = true }58sc-executor = { workspace = true }59sc-network = { workspace = true }60sc-network-sync = { workspace = true }61sc-service = { workspace = true }62sc-sysinfo = { workspace = true }63sc-telemetry = { workspace = true }64sc-tracing = { workspace = true }65sc-transaction-pool = { workspace = true }66serde = { workspace = true }67sp-api = { workspace = true }68sp-block-builder = { workspace = true }69sp-blockchain = { workspace = true }70sp-consensus-aura = { workspace = true }71sp-core = { workspace = true }72sp-io = { workspace = true }73sp-keystore = { workspace = true }74sp-offchain = { workspace = true }75sp-runtime = { workspace = true }76sp-session = { workspace = true }77sp-timestamp = { workspace = true }78sp-transaction-pool = { workspace = true }79substrate-frame-rpc-system = { workspace = true }80substrate-prometheus-endpoint = { workspace = true }81try-runtime-cli = { workspace = true }82unique-runtime = { workspace = true, optional = true }83up-common = { workspace = true }84up-data-structs = { workspace = true }8586fc-consensus = { workspace = true }87fc-db = { workspace = true }88fc-mapping-sync = { workspace = true }89fc-rpc-core = { workspace = true }90fc-rpc.workspace = true91fp-rpc = { workspace = true }9293app-promotion-rpc = { workspace = true }94fc-api.workspace = true95fp-storage.workspace = true96jsonrpsee.workspace = true97pallet-transaction-payment-rpc.workspace = true98sc-rpc-api.workspace = true99sc-rpc.workspace = true100sp-inherents.workspace = true101uc-rpc = { workspace = true }102up-pov-estimate-rpc = { workspace = true }103up-rpc = { workspace = true }104105[build-dependencies]106substrate-build-script-utils = { workspace = true }107108[features]109all-runtimes = ['opal-runtime', 'quartz-runtime', 'unique-runtime']110default = ["opal-runtime"]111gov-test-timings = [112 'opal-runtime/gov-test-timings',113 'quartz-runtime?/gov-test-timings',114 'unique-runtime?/gov-test-timings',115]116lookahead = []117pov-estimate = [118 'opal-runtime/pov-estimate',119 'quartz-runtime?/pov-estimate',120 'uc-rpc/pov-estimate',121 'unique-runtime?/pov-estimate',122]123runtime-benchmarks = [124 'opal-runtime/runtime-benchmarks',125 'polkadot-cli/runtime-benchmarks',126 'polkadot-service/runtime-benchmarks',127 'quartz-runtime?/runtime-benchmarks',128 'sc-service/runtime-benchmarks',129 'unique-runtime?/runtime-benchmarks',130]131sapphire-runtime = ['quartz-runtime', 'quartz-runtime/become-sapphire']132session-test-timings = [133 'opal-runtime/session-test-timings',134 'quartz-runtime?/session-test-timings',135 'unique-runtime?/session-test-timings',136]137try-runtime = [138 'opal-runtime?/try-runtime',139 'quartz-runtime?/try-runtime',140 'try-runtime-cli/try-runtime',141 'unique-runtime?/try-runtime',142]1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Node'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'unique-node'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version.workspace = true1415[[bin]]16name = 'unique-collator'17path = "src/main.rs"1819[package.metadata.docs.rs]20targets = ['x86_64-unknown-linux-gnu']2122[dependencies]23clap = "4.4"24futures = '0.3.28'25serde_json = "1.0"26tokio = { version = "1.32", features = ["time"] }2728log = { workspace = true }2930parity-scale-codec = { workspace = true }3132cumulus-client-cli = { workspace = true }33cumulus-client-collator = { workspace = true }34cumulus-client-consensus-aura = { workspace = true }35cumulus-client-consensus-common = { workspace = true }36cumulus-client-consensus-proposer = { workspace = true }37cumulus-client-network = { workspace = true }38cumulus-client-service = { workspace = true }39cumulus-primitives-aura = { workspace = true }40cumulus-primitives-core = { workspace = true }41cumulus-primitives-parachain-inherent = { features = ["std"], workspace = true }42cumulus-relay-chain-inprocess-interface = { workspace = true }43cumulus-relay-chain-interface = { workspace = true }44cumulus-relay-chain-minimal-node = { workspace = true }45frame-benchmarking = { workspace = true }46frame-benchmarking-cli = { workspace = true }47opal-runtime = { workspace = true, optional = true }48pallet-transaction-payment-rpc-runtime-api = { workspace = true }49polkadot-cli = { workspace = true }50polkadot-primitives = { workspace = true }51polkadot-service = { workspace = true }52quartz-runtime = { workspace = true, optional = true }53sc-basic-authorship = { workspace = true }54sc-chain-spec = { workspace = true }55sc-cli = { workspace = true }56sc-client-api = { workspace = true }57sc-consensus = { workspace = true }58sc-consensus-manual-seal = { workspace = true }59sc-executor = { workspace = true }60sc-network = { workspace = true }61sc-network-sync = { workspace = true }62sc-service = { workspace = true }63sc-sysinfo = { workspace = true }64sc-telemetry = { workspace = true }65sc-tracing = { workspace = true }66sc-transaction-pool = { workspace = true }67serde = { workspace = true }68sp-api = { workspace = true }69sp-block-builder = { workspace = true }70sp-blockchain = { workspace = true }71sp-consensus-aura = { workspace = true }72sp-core = { workspace = true }73sp-io = { workspace = true }74sp-keystore = { workspace = true }75sp-offchain = { workspace = true }76sp-runtime = { workspace = true }77sp-session = { workspace = true }78sp-timestamp = { workspace = true }79sp-transaction-pool = { workspace = true }80substrate-frame-rpc-system = { workspace = true }81substrate-prometheus-endpoint = { workspace = true }82try-runtime-cli = { workspace = true }83unique-runtime = { workspace = true, optional = true }84up-common = { workspace = true }85up-data-structs = { workspace = true }8687fc-consensus = { workspace = true }88fc-db = { workspace = true }89fc-mapping-sync = { workspace = true }90fc-rpc-core = { workspace = true }91fc-rpc.workspace = true92fp-rpc = { workspace = true }9394app-promotion-rpc = { workspace = true }95fc-api.workspace = true96fp-storage.workspace = true97jsonrpsee.workspace = true98pallet-transaction-payment-rpc.workspace = true99sc-rpc-api.workspace = true100sc-rpc.workspace = true101sp-inherents.workspace = true102uc-rpc = { workspace = true }103up-pov-estimate-rpc = { workspace = true }104up-rpc = { workspace = true }105106[build-dependencies]107substrate-build-script-utils = { workspace = true }108109[features]110all-runtimes = ['opal-runtime', 'quartz-runtime', 'unique-runtime']111default = ["opal-runtime"]112gov-test-timings = [113 'opal-runtime/gov-test-timings',114 'quartz-runtime?/gov-test-timings',115 'unique-runtime?/gov-test-timings',116]117lookahead = [118 'opal-runtime/lookahead'119]120pov-estimate = [121 'opal-runtime/pov-estimate',122 'quartz-runtime?/pov-estimate',123 'uc-rpc/pov-estimate',124 'unique-runtime?/pov-estimate',125]126runtime-benchmarks = [127 'opal-runtime/runtime-benchmarks',128 'polkadot-cli/runtime-benchmarks',129 'polkadot-service/runtime-benchmarks',130 'quartz-runtime?/runtime-benchmarks',131 'sc-service/runtime-benchmarks',132 'unique-runtime?/runtime-benchmarks',133]134sapphire-runtime = ['quartz-runtime', 'quartz-runtime/become-sapphire']135session-test-timings = [136 'opal-runtime/session-test-timings',137 'quartz-runtime?/session-test-timings',138 'unique-runtime?/session-test-timings',139]140try-runtime = [141 'opal-runtime?/try-runtime',142 'quartz-runtime?/try-runtime',143 'try-runtime-cli/try-runtime',144 'unique-runtime?/try-runtime',145]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 }