Validation service refactoring (#773)

* add some more docs about statement import

* instantiate environment async

* move attestation service into subfolder

* refactor validation service architecture somewhat

* remove dependence on validation service in proposer

* fix a bunch of warnings

* improve docs

* introduce a builder for the validation service

* extract block production to its own file

* integrate new API into service

* address review grumbles
This commit is contained in:
Robert Habermeier
2020-01-17 10:28:19 +01:00
committed by GitHub
parent fb30862d23
commit 3e17fcfb3d
9 changed files with 860 additions and 790 deletions
+15 -8
View File
@@ -404,21 +404,28 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(config: Configuration)
service.client(),
WrappedExecutor(service.spawn_task_handle()),
);
let (validation_service_handle, validation_service) = consensus::ServiceBuilder {
client: client.clone(),
network: validation_network.clone(),
collators: validation_network,
task_executor: Arc::new(WrappedExecutor(service.spawn_task_handle())),
availability_store: availability_store.clone(),
select_chain: select_chain.clone(),
keystore: service.keystore(),
max_block_data_size,
}.build();
service.spawn_essential_task(Box::pin(validation_service));
let proposer = consensus::ProposerFactory::new(
client.clone(),
select_chain.clone(),
validation_network.clone(),
validation_network,
service.transaction_pool(),
Arc::new(WrappedExecutor(service.spawn_task_handle())),
service.keystore(),
availability_store.clone(),
validation_service_handle,
slot_duration,
max_block_data_size,
backend,
);
let client = service.client();
let select_chain = service.select_chain().ok_or(ServiceError::SelectChainRequired)?;
let can_author_with =
consensus_common::CanAuthorWithNativeVersion::new(client.executor().clone());