Update Substrate & Polkadot (#557)

* Update Substrate & Polkadot

* Format

* Update again
This commit is contained in:
Bastian Köcher
2021-08-03 11:59:37 +02:00
committed by GitHub
parent eda565a052
commit 6c0abc6f7d
19 changed files with 560 additions and 539 deletions
+381 -351
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -21,6 +21,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot dependencies
@@ -18,15 +18,14 @@
use codec::Codec;
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
use sc_consensus::{import_queue::DefaultImportQueue, BlockImport};
use sc_consensus_aura::AuraVerifier;
use sc_consensus_slots::InherentDataProviderExt;
use sc_telemetry::TelemetryHandle;
use sp_api::{ApiExt, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder as BlockBuilderApi;
use sp_blockchain::{HeaderBackend, ProvideCache};
use sp_consensus::{
import_queue::DefaultImportQueue, BlockImport, CanAuthorWith, Error as ConsensusError,
};
use sp_consensus::{CanAuthorWith, Error as ConsensusError};
use sp_consensus_aura::{digests::CompatibleDigestItem, AuraApi};
use sp_core::crypto::Pair;
use sp_inherents::CreateInherentDataProviders;
+7 -6
View File
@@ -33,13 +33,14 @@ use cumulus_primitives_core::{
use futures::lock::Mutex;
use polkadot_client::ClientHandle;
use sc_client_api::{backend::AuxStore, Backend, BlockOf};
use sc_consensus::BlockImport;
use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SlotInfo};
use sc_telemetry::TelemetryHandle;
use sp_api::ProvideRuntimeApi;
use sp_application_crypto::AppPublic;
use sp_blockchain::{HeaderBackend, ProvideCache};
use sp_consensus::{
BlockImport, EnableProofRecording, Environment, ProofRecording, Proposer, SlotData, SyncOracle,
EnableProofRecording, Environment, ProofRecording, Proposer, SlotData, SyncOracle,
};
use sp_consensus_aura::AuraApi;
use sp_core::crypto::Pair;
@@ -52,8 +53,7 @@ mod import_queue;
pub use import_queue::{build_verifier, import_queue, BuildVerifierParams, ImportQueueParams};
pub use sc_consensus_aura::{
slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotDuration,
SlotProportion,
slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotDuration, SlotProportion,
};
pub use sc_consensus_slots::InherentDataProviderExt;
@@ -138,8 +138,8 @@ where
P::Public: AppPublic + Hash + Member + Encode + Decode,
P::Signature: TryFrom<Vec<u8>> + Hash + Member + Encode + Decode,
{
let worker =
sc_consensus_aura::build_aura_worker::<P, _, _, _, _, _, _, _, _>(BuildAuraWorkerParams {
let worker = sc_consensus_aura::build_aura_worker::<P, _, _, _, _, _, _, _, _>(
BuildAuraWorkerParams {
client: para_client,
block_import: ParachainBlockImport::new(block_import),
justification_sync_link: (),
@@ -151,7 +151,8 @@ where
telemetry,
block_proposal_slot_portion,
max_block_proposal_slot_portion,
});
},
);
Self {
create_inherent_data_providers: Arc::new(create_inherent_data_providers),
@@ -7,6 +7,7 @@ edition = "2018"
[dependencies]
# Substrate deps
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
+7 -7
View File
@@ -15,7 +15,7 @@
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use polkadot_primitives::v1::{Hash as PHash, PersistedValidationData};
use sp_consensus::BlockImport;
use sc_consensus::BlockImport;
use sp_runtime::traits::Block as BlockT;
mod parachain_consensus;
@@ -96,19 +96,19 @@ where
async fn check_block(
&mut self,
block: sp_consensus::BlockCheckParams<Block>,
) -> Result<sp_consensus::ImportResult, Self::Error> {
block: sc_consensus::BlockCheckParams<Block>,
) -> Result<sc_consensus::ImportResult, Self::Error> {
self.0.check_block(block).await
}
async fn import_block(
&mut self,
mut block_import_params: sp_consensus::BlockImportParams<Block, Self::Transaction>,
cache: std::collections::HashMap<sp_consensus::import_queue::CacheKeyId, Vec<u8>>,
) -> Result<sp_consensus::ImportResult, Self::Error> {
mut block_import_params: sc_consensus::BlockImportParams<Block, Self::Transaction>,
cache: std::collections::HashMap<sp_consensus::CacheKeyId, Vec<u8>>,
) -> Result<sc_consensus::ImportResult, Self::Error> {
// Best block is determined by the relay chain, or if we are doing the intial sync
// we import all blocks as new best.
block_import_params.fork_choice = Some(sp_consensus::ForkChoiceStrategy::Custom(
block_import_params.fork_choice = Some(sc_consensus::ForkChoiceStrategy::Custom(
block_import_params.origin == sp_consensus::BlockOrigin::NetworkInitialSync,
));
self.0.import_block(block_import_params, cache).await
@@ -17,9 +17,10 @@
use sc_client_api::{
Backend, BlockBackend, BlockImportNotification, BlockchainEvents, Finalizer, UsageProvider,
};
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
use sp_api::ProvideRuntimeApi;
use sp_blockchain::{Error as ClientError, Result as ClientResult};
use sp_consensus::{BlockImport, BlockImportParams, BlockOrigin, BlockStatus, ForkChoiceStrategy};
use sp_consensus::{BlockOrigin, BlockStatus};
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, Header as HeaderT},
+2 -1
View File
@@ -25,8 +25,9 @@ use futures::{channel::mpsc, executor::block_on, select, FutureExt, Stream, Stre
use futures_timer::Delay;
use polkadot_primitives::v1::{Block as PBlock, Id as ParaId};
use sc_client_api::UsageProvider;
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
use sp_blockchain::{Error as ClientError, Result as ClientResult};
use sp_consensus::{BlockImport, BlockImportParams, BlockOrigin, ForkChoiceStrategy};
use sp_consensus::BlockOrigin;
use sp_runtime::generic::BlockId;
use std::{
sync::{Arc, Mutex},
@@ -15,6 +15,7 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "mas
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot dependencies
@@ -16,19 +16,18 @@
use std::{marker::PhantomData, sync::Arc};
use sc_consensus::{
import_queue::{BasicQueue, Verifier as VerifierT},
BlockImport, BlockImportParams,
};
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder as BlockBuilderApi;
use sp_blockchain::Result as ClientResult;
use sp_consensus::{
error::Error as ConsensusError,
import_queue::{BasicQueue, CacheKeyId, Verifier as VerifierT},
BlockImport, BlockImportParams, BlockOrigin,
};
use sp_consensus::{error::Error as ConsensusError, CacheKeyId};
use sp_inherents::{CreateInherentDataProviders, InherentDataProvider};
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, Header as HeaderT},
Justifications,
};
/// A verifier that just checks the inherents.
@@ -59,10 +58,7 @@ where
{
async fn verify(
&mut self,
origin: BlockOrigin,
header: Block::Header,
justifications: Option<Justifications>,
mut body: Option<Vec<Block::Extrinsic>>,
mut block_params: BlockImportParams<Block, ()>,
) -> Result<
(
BlockImportParams<Block, ()>,
@@ -70,10 +66,10 @@ where
),
String,
> {
if let Some(inner_body) = body.take() {
if let Some(inner_body) = block_params.body.take() {
let inherent_data_providers = self
.create_inherent_data_providers
.create_inherent_data_providers(*header.parent_hash(), ())
.create_inherent_data_providers(*block_params.header.parent_hash(), ())
.await
.map_err(|e| e.to_string())?;
@@ -81,13 +77,13 @@ where
.create_inherent_data()
.map_err(|e| format!("{:?}", e))?;
let block = Block::new(header.clone(), inner_body);
let block = Block::new(block_params.header.clone(), inner_body);
let inherent_res = self
.client
.runtime_api()
.check_inherents(
&BlockId::Hash(*header.parent_hash()),
&BlockId::Hash(*block.header().parent_hash()),
block.clone(),
inherent_data,
)
@@ -106,17 +102,12 @@ where
}
let (_, inner_body) = block.deconstruct();
body = Some(inner_body);
block_params.body = Some(inner_body);
}
let post_hash = Some(header.hash());
let mut block_import_params = BlockImportParams::new(origin, header);
block_import_params.body = body;
block_import_params.justifications = justifications;
block_params.post_hash = Some(block_params.header.hash());
block_import_params.post_hash = post_hash;
Ok((block_import_params, None))
Ok((block_params, None))
}
}
@@ -43,10 +43,10 @@ use cumulus_primitives_core::{
use parking_lot::Mutex;
use polkadot_client::ClientHandle;
use sc_client_api::Backend;
use sc_consensus::{BlockImport, BlockImportParams};
use sp_api::ProvideRuntimeApi;
use sp_consensus::{
BlockImport, BlockImportParams, BlockOrigin, EnableProofRecording, Environment, ProofRecording,
Proposal, Proposer,
BlockOrigin, EnableProofRecording, Environment, ProofRecording, Proposal, Proposer,
};
use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider};
use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT};
@@ -208,8 +208,8 @@ where
let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header);
block_import_params.body = Some(extrinsics);
block_import_params.state_action = sp_consensus::StateAction::ApplyChanges(
sp_consensus::StorageChanges::Changes(storage_changes)
block_import_params.state_action = sc_consensus::StateAction::ApplyChanges(
sc_consensus::StorageChanges::Changes(storage_changes),
);
if let Err(err) = self
+1 -1
View File
@@ -13,6 +13,7 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot deps
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
@@ -44,7 +45,6 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
+2 -4
View File
@@ -43,11 +43,9 @@
//! make sure that the blocks are imported in the correct order.
use sc_client_api::{BlockBackend, BlockchainEvents, UsageProvider};
use sc_consensus::import_queue::{ImportQueue, IncomingBlock};
use sp_api::ProvideRuntimeApi;
use sp_consensus::{
import_queue::{ImportQueue, IncomingBlock},
BlockOrigin, BlockStatus,
};
use sp_consensus::{BlockOrigin, BlockStatus};
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, Header as HeaderT, NumberFor},
+1
View File
@@ -18,6 +18,7 @@ sc-service = { git = "https://github.com/paritytech/substrate", branch = "master
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
+15 -14
View File
@@ -26,14 +26,15 @@ use polkadot_service::{AbstractClient, Client as PClient, ClientHandle, RuntimeA
use sc_client_api::{
Backend as BackendT, BlockBackend, BlockchainEvents, Finalizer, UsageProvider,
};
use sc_consensus::{
import_queue::{ImportQueue, IncomingBlock, Link, Origin},
BlockImport,
};
use sc_service::{Configuration, Role, TaskManager};
use sc_telemetry::TelemetryWorkerHandle;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_consensus::{
import_queue::{ImportQueue, IncomingBlock, Link, Origin},
BlockImport, BlockOrigin,
};
use sp_consensus::BlockOrigin;
use sp_core::{traits::SpawnNamed, Pair};
use sp_runtime::{
traits::{BlakeTwo256, Block as BlockT, NumberFor},
@@ -118,18 +119,18 @@ where
});
relay_chain_full_node
.client
.execute_with(StartPoVRecovery {
para_id,
client: client.clone(),
import_queue,
task_manager,
overseer_handle: relay_chain_full_node
.overseer_handle
.client
.execute_with(StartPoVRecovery {
para_id,
client: client.clone(),
import_queue,
task_manager,
overseer_handle: relay_chain_full_node
.overseer_handle
.clone()
.ok_or_else(|| "Polkadot full node did not provide an `OverseerHandle`!")?,
_phantom: PhantomData,
})?;
_phantom: PhantomData,
})?;
cumulus_client_collator::start_collator(cumulus_client_collator::StartCollatorParams {
runtime_api: client.clone(),
+111 -120
View File
@@ -18,33 +18,38 @@ use cumulus_client_consensus_aura::{
build_aura_consensus, BuildAuraConsensusParams, SlotProportion,
};
use cumulus_client_consensus_common::{
ParachainConsensus, ParachainCandidate, ParachainBlockImport,
ParachainBlockImport, ParachainCandidate, ParachainConsensus,
};
use cumulus_client_network::build_block_announce_validator;
use cumulus_client_service::{
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
};
use cumulus_primitives_core::{
ParaId, relay_chain::v1::{Hash as PHash, PersistedValidationData},
relay_chain::v1::{Hash as PHash, PersistedValidationData},
ParaId,
};
use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier;
use futures::lock::Mutex;
use sc_client_api::ExecutorProvider;
use sc_consensus::{
import_queue::{BasicQueue, Verifier as VerifierT},
BlockImportParams,
};
use sc_executor::native_executor_instance;
use sc_network::NetworkService;
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::{ConstructRuntimeApi, ApiExt};
use sp_consensus::{
BlockImportParams, BlockOrigin, SlotData,
import_queue::{BasicQueue, CacheKeyId, Verifier as VerifierT},
};
use sp_api::{ApiExt, ConstructRuntimeApi};
use sp_consensus::{CacheKeyId, SlotData};
use sp_consensus_aura::{sr25519::AuthorityId as AuraId, AuraApi};
use sp_keystore::SyncCryptoStorePtr;
use sp_runtime::{traits::{BlakeTwo256, Header as HeaderT}, generic::BlockId};
use sp_runtime::{
generic::BlockId,
traits::{BlakeTwo256, Header as HeaderT},
};
use std::sync::Arc;
use substrate_prometheus_endpoint::Registry;
use futures::lock::Mutex;
use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier;
pub use sc_executor::NativeExecutor;
@@ -103,7 +108,7 @@ pub fn new_partial<RuntimeApi, Executor, BIQ>(
TFullClient<Block, RuntimeApi, Executor>,
TFullBackend<Block>,
(),
sp_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_transaction_pool::FullPool<Block, TFullClient<Block, RuntimeApi, Executor>>,
(Option<Telemetry>, Option<TelemetryWorkerHandle>),
>,
@@ -130,7 +135,7 @@ where
Option<TelemetryHandle>,
&TaskManager,
) -> Result<
sp_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_service::Error,
>,
{
@@ -227,7 +232,7 @@ where
Option<TelemetryHandle>,
&TaskManager,
) -> Result<
sp_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_service::Error,
>,
BIC: FnOnce(
@@ -251,14 +256,12 @@ where
let params = new_partial::<RuntimeApi, Executor, BIQ>(&parachain_config, build_import_queue)?;
let (mut telemetry, telemetry_worker_handle) = params.other;
let relay_chain_full_node = cumulus_client_service::build_polkadot_full_node(
polkadot_config,
telemetry_worker_handle,
)
.map_err(|e| match e {
polkadot_service::Error::Sub(x) => x,
s => format!("{}", s).into(),
})?;
let relay_chain_full_node =
cumulus_client_service::build_polkadot_full_node(polkadot_config, telemetry_worker_handle)
.map_err(|e| match e {
polkadot_service::Error::Sub(x) => x,
s => format!("{}", s).into(),
})?;
let client = params.client.clone();
let backend = params.backend.clone();
@@ -284,6 +287,7 @@ where
import_queue: import_queue.clone(),
on_demand: None,
block_announce_validator_builder: Some(Box::new(|_| block_announce_validator)),
warp_sync: None,
})?;
let rpc_client = client.clone();
@@ -363,7 +367,7 @@ pub fn rococo_parachain_build_import_queue(
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
) -> Result<
sp_consensus::DefaultImportQueue<
sc_consensus::DefaultImportQueue<
Block,
TFullClient<Block, rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>,
>,
@@ -371,29 +375,33 @@ pub fn rococo_parachain_build_import_queue(
> {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
cumulus_client_consensus_aura::import_queue::<sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _>(
cumulus_client_consensus_aura::ImportQueueParams {
block_import: client.clone(),
client: client.clone(),
create_inherent_data_providers: move |_, _| async move {
let time = sp_timestamp::InherentDataProvider::from_system_time();
cumulus_client_consensus_aura::import_queue::<
sp_consensus_aura::sr25519::AuthorityPair,
_,
_,
_,
_,
_,
_,
>(cumulus_client_consensus_aura::ImportQueueParams {
block_import: client.clone(),
client: client.clone(),
create_inherent_data_providers: move |_, _| async move {
let time = sp_timestamp::InherentDataProvider::from_system_time();
let slot =
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
*time,
slot_duration.slot_duration(),
);
let slot =
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
*time,
slot_duration.slot_duration(),
);
Ok((time, slot))
},
registry: config.prometheus_registry().clone(),
can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(
client.executor().clone(),
),
spawner: &task_manager.spawn_essential_handle(),
telemetry,
Ok((time, slot))
},
)
registry: config.prometheus_registry().clone(),
can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
spawner: &task_manager.spawn_essential_handle(),
telemetry,
})
.map_err(Into::into)
}
@@ -499,7 +507,7 @@ pub fn shell_build_import_queue(
_: Option<TelemetryHandle>,
task_manager: &TaskManager,
) -> Result<
sp_consensus::DefaultImportQueue<
sc_consensus::DefaultImportQueue<
Block,
TFullClient<Block, shell_runtime::RuntimeApi, ShellRuntimeExecutor>,
>,
@@ -671,10 +679,7 @@ where
{
async fn verify(
&mut self,
origin: BlockOrigin,
header: Header,
justifications: Option<sp_runtime::Justifications>,
body: Option<Vec<<Block as sp_runtime::traits::Block>::Extrinsic>>,
block_import: BlockImportParams<Block, ()>,
) -> Result<
(
BlockImportParams<Block, ()>,
@@ -682,7 +687,7 @@ where
),
String,
> {
let block_id = BlockId::hash(*header.parent_hash());
let block_id = BlockId::hash(*block_import.header.parent_hash());
if self
.client
@@ -690,14 +695,9 @@ where
.has_api::<dyn AuraApi<Block, AuraId>>(&block_id)
.unwrap_or(false)
{
self.aura_verifier
.get_mut()
.verify(origin, header, justifications, body)
.await
self.aura_verifier.get_mut().verify(block_import).await
} else {
self.relay_chain_verifier
.verify(origin, header, justifications, body)
.await
self.relay_chain_verifier.verify(block_import).await
}
}
}
@@ -709,7 +709,7 @@ pub fn statemint_build_import_queue<RuntimeApi, Executor>(
telemetry_handle: Option<TelemetryHandle>,
task_manager: &TaskManager,
) -> Result<
sp_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_service::Error,
>
where
@@ -786,10 +786,7 @@ pub async fn start_statemint_node<RuntimeApi, Executor>(
parachain_config: Configuration,
polkadot_config: Configuration,
id: ParaId,
) -> sc_service::error::Result<(
TaskManager,
Arc<TFullClient<Block, RuntimeApi, Executor>>,
)>
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
where
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
+ Send
@@ -831,39 +828,36 @@ where
let telemetry2 = telemetry.clone();
let prometheus_registry2 = prometheus_registry.map(|r| (*r).clone());
let aura_consensus = BuildOnAccess::Uninitialized(Some(
Box::new(move || {
let slot_duration =
cumulus_client_consensus_aura::slot_duration(&*client2).unwrap();
let aura_consensus = BuildOnAccess::Uninitialized(Some(Box::new(move || {
let slot_duration =
cumulus_client_consensus_aura::slot_duration(&*client2).unwrap();
let proposer_factory =
sc_basic_authorship::ProposerFactory::with_proof_recording(
spawn_handle,
client2.clone(),
transaction_pool2,
prometheus_registry2.as_ref(),
telemetry2.clone(),
);
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
spawn_handle,
client2.clone(),
transaction_pool2,
prometheus_registry2.as_ref(),
telemetry2.clone(),
);
let relay_chain_backend2 = relay_chain_backend.clone();
let relay_chain_client2 = relay_chain_client.clone();
let relay_chain_backend2 = relay_chain_backend.clone();
let relay_chain_client2 = relay_chain_client.clone();
build_aura_consensus::<
sp_consensus_aura::sr25519::AuthorityPair,
_,
_,
_,
_,
_,
_,
_,
_,
_,
>(BuildAuraConsensusParams {
proposer_factory,
create_inherent_data_providers:
move |_, (relay_parent, validation_data)| {
let parachain_inherent =
build_aura_consensus::<
sp_consensus_aura::sr25519::AuthorityPair,
_,
_,
_,
_,
_,
_,
_,
_,
_,
>(BuildAuraConsensusParams {
proposer_factory,
create_inherent_data_providers: move |_, (relay_parent, validation_data)| {
let parachain_inherent =
cumulus_primitives_parachain_inherent::ParachainInherentData::create_at_with_client(
relay_parent,
&relay_chain_client,
@@ -871,42 +865,39 @@ where
&validation_data,
id,
);
async move {
let time =
sp_timestamp::InherentDataProvider::from_system_time();
async move {
let time = sp_timestamp::InherentDataProvider::from_system_time();
let slot =
let slot =
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
*time,
slot_duration.slot_duration(),
);
let parachain_inherent =
parachain_inherent.ok_or_else(|| {
Box::<dyn std::error::Error + Send + Sync>::from(
"Failed to create parachain inherent",
)
})?;
Ok((time, slot, parachain_inherent))
}
},
block_import: client2.clone(),
relay_chain_client: relay_chain_client2,
relay_chain_backend: relay_chain_backend2,
para_client: client2.clone(),
backoff_authoring_blocks: Option::<()>::None,
sync_oracle,
keystore,
force_authoring,
slot_duration,
// We got around 500ms for proposing
block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32),
// And a maximum of 750ms if slots are skipped
max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)),
telemetry: telemetry2,
})
}),
));
let parachain_inherent = parachain_inherent.ok_or_else(|| {
Box::<dyn std::error::Error + Send + Sync>::from(
"Failed to create parachain inherent",
)
})?;
Ok((time, slot, parachain_inherent))
}
},
block_import: client2.clone(),
relay_chain_client: relay_chain_client2,
relay_chain_backend: relay_chain_backend2,
para_client: client2.clone(),
backoff_authoring_blocks: Option::<()>::None,
sync_oracle,
keystore,
force_authoring,
slot_duration,
// We got around 500ms for proposing
block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32),
// And a maximum of 750ms if slots are skipped
max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)),
telemetry: telemetry2,
})
})));
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
@@ -26,7 +26,8 @@ const PROJECT_NAME: &str = "validation-worker";
const SKIP_ENV: &str = "SKIP_BUILD";
fn main() {
if env::var(SKIP_ENV).is_ok() { return
if env::var(SKIP_ENV).is_ok() {
return;
}
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("`OUT_DIR` is set by cargo"));
@@ -42,11 +43,13 @@ fn main() {
}
fn find_cargo_lock() -> PathBuf {
let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is set by cargo"));
let mut path = PathBuf::from(
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is set by cargo"),
);
loop {
if path.join("Cargo.lock").exists() {
return path.join("Cargo.lock")
return path.join("Cargo.lock");
}
if !path.pop() {
+1 -1
View File
@@ -17,6 +17,7 @@ sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -28,7 +29,6 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
+2 -1
View File
@@ -99,7 +99,7 @@ pub fn new_partial(
Client,
TFullBackend<Block>,
(),
sp_consensus::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
sc_consensus::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
sc_transaction_pool::FullPool<Block, Client>,
(),
>,
@@ -213,6 +213,7 @@ where
import_queue: import_queue.clone(),
on_demand: None,
block_announce_validator_builder: Some(Box::new(block_announce_validator_builder)),
warp_sync: None,
})?;
let rpc_extensions_builder = {