diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index f15a0b1..85bc992 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -24,7 +24,7 @@ use serde::{Deserialize, Serialize}; pub use crate::chain_spec_helpers::{EncointerKeys, GenesisKeys, RelayChain, WellKnownKeys}; /// Specialized `ChainSpec` for the normal parachain runtime. -pub type ChainSpec = sc_service::GenericChainSpec<(), Extensions>; +pub type ChainSpec = sc_service::GenericChainSpec; pub const ENDOWED_FUNDING: u128 = 1 << 60; pub const ENCOINTER_KUSAMA_ED: Balance = parachain_runtime::ExistentialDeposit::get(); diff --git a/node/src/service.rs b/node/src/service.rs index fd2ea20..a9ac22d 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -10,6 +10,7 @@ use parachains_common::opaque::Block; // Cumulus Imports use cumulus_client_collator::service::CollatorService; +use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams}; use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport; use cumulus_client_consensus_proposer::Proposer; use cumulus_client_service::{ @@ -17,7 +18,10 @@ use cumulus_client_service::{ BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions, StartRelayChainTasksParams, }; -use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId}; +use cumulus_primitives_core::{ + relay_chain::{CollatorPair, ValidationCode}, + ParaId, +}; use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; // Substrate Imports @@ -152,8 +156,10 @@ fn build_import_queue( ) } +#[allow(clippy::too_many_arguments)] fn start_consensus( client: Arc, + backend: Arc, block_import: ParachainBlockImport, prometheus_registry: Option<&Registry>, telemetry: Option, @@ -168,10 +174,6 @@ fn start_consensus( overseer_handle: OverseerHandle, announce_block: Arc>) + Send + Sync>, ) -> Result<(), sc_service::Error> { - use cumulus_client_consensus_aura::collators::basic::{ - self as basic_aura, Params as BasicAuraParams, - }; - let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( task_manager.spawn_handle(), client.clone(), @@ -189,11 +191,15 @@ fn start_consensus( client.clone(), ); - let params = BasicAuraParams { + let params = AuraParams { create_inherent_data_providers: move |_, ()| async move { Ok(()) }, block_import, - para_client: client, + para_client: client.clone(), + para_backend: backend, relay_client: relay_chain_interface, + code_hash_provider: move |block_hash| { + client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash()) + }, sync_oracle, keystore, collator_key, @@ -202,13 +208,12 @@ fn start_consensus( relay_chain_slot_duration, proposer, collator_service, - // Very limited proposal time. - authoring_duration: Duration::from_millis(500), - collation_request_receiver: None, + authoring_duration: Duration::from_millis(2000), + reinitialize: false, }; let fut = - basic_aura::run::( + aura::run::( params, ); task_manager.spawn_essential_handle().spawn("aura", None, fut); @@ -321,8 +326,8 @@ pub async fn start_parachain_node( task_manager: &mut task_manager, config: parachain_config, keystore: params.keystore_container.keystore(), - backend, - network: network.clone(), + backend: backend.clone(), + network, sync_service: sync_service.clone(), system_rpc_tx, tx_handler_controller, @@ -385,13 +390,14 @@ pub async fn start_parachain_node( if validator { start_consensus( client.clone(), + backend, block_import, prometheus_registry.as_ref(), telemetry.as_ref().map(|t| t.handle()), &task_manager, - relay_chain_interface.clone(), + relay_chain_interface, transaction_pool, - sync_service.clone(), + sync_service, params.keystore_container.keystore(), relay_chain_slot_duration, para_id,