Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into ao-overseer-all-messages-integration
Browse files Browse the repository at this point in the history
* master:
  Implement PoV Distribution Subsystem (#1344)
  Bump Substrate (#1382)
  Update the Kusama bootnode IDs (#1377)
  Companion for #6575 (Add `WeightInfo`) (#1352)
  Companion for #6599 (#1371)
  Use `SpawnNamed` to give tasks names (#1379)
  Update to substrate#59ee76a0 (#1380)
  Companion PR for #6564 (#1350)
  Companion for #6584 (#1373)
  Companion for #6500 (decl_module: frame_system as default ident) (#1314)
  • Loading branch information
ordian committed Jul 9, 2020
2 parents 91cdecb + b651e4a commit b5e49b0
Show file tree
Hide file tree
Showing 42 changed files with 2,123 additions and 399 deletions.
561 changes: 324 additions & 237 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ members = [

"node/core/proposer",
"node/network/bridge",
"node/network/pov-distribution",
"node/network/statement-distribution",
"node/overseer",
"node/primitives",
Expand Down
6 changes: 3 additions & 3 deletions availability-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "mas
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
kvdb = "0.6.0"
kvdb-memorydb = "0.6.0"
kvdb = "0.7.0"
kvdb-memorydb = "0.7.0"

[target.'cfg(not(target_os = "unknown"))'.dependencies]
kvdb-rocksdb = "0.8.0"
kvdb-rocksdb = "0.9.0"
5 changes: 3 additions & 2 deletions availability-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#![warn(missing_docs)]

use futures::prelude::*;
use futures::{channel::{mpsc, oneshot}, task::Spawn};
use futures::channel::{mpsc, oneshot};
use keystore::KeyStorePtr;
use polkadot_primitives::{
Hash, Block,
Expand All @@ -39,6 +39,7 @@ use client::{
};
use sp_api::{ApiExt, ProvideRuntimeApi};
use codec::{Encode, Decode};
use sp_core::traits::SpawnNamed;

use log::warn;

Expand Down Expand Up @@ -174,7 +175,7 @@ impl Store {
&self,
wrapped_block_import: I,
client: Arc<P>,
spawner: impl Spawn,
spawner: impl SpawnNamed,
keystore: KeyStorePtr,
) -> ClientResult<AvailabilityBlockImport<I, P>>
where
Expand Down
11 changes: 5 additions & 6 deletions availability-store/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::sync::Arc;
use std::thread;

use log::{error, info, trace, warn};
use sp_blockchain::{Result as ClientResult};
use sp_blockchain::Result as ClientResult;
use sp_runtime::traits::{Header as HeaderT, Block as BlockT, HashFor, BlakeTwo256};
use sp_api::{ApiExt, ProvideRuntimeApi};
use client::{
Expand All @@ -32,12 +32,13 @@ use consensus_common::{
ImportResult,
import_queue::CacheKeyId,
};
use sp_core::traits::SpawnNamed;
use polkadot_primitives::{Block, BlockId, Hash};
use polkadot_primitives::parachain::{
ParachainHost, ValidatorId, AbridgedCandidateReceipt, AvailableData,
ValidatorPair, ErasureChunk,
};
use futures::{prelude::*, future::select, channel::{mpsc, oneshot}, task::{Spawn, SpawnExt}};
use futures::{prelude::*, future::select, channel::{mpsc, oneshot}};
use futures::future::AbortHandle;
use keystore::KeyStorePtr;

Expand Down Expand Up @@ -641,7 +642,7 @@ impl<I, P> AvailabilityBlockImport<I, P> {
pub(crate) fn new(
client: Arc<P>,
block_import: I,
spawner: impl Spawn,
spawner: impl SpawnNamed,
keystore: KeyStorePtr,
to_worker: mpsc::UnboundedSender<WorkerMsg>,
) -> Self
Expand All @@ -662,9 +663,7 @@ impl<I, P> AvailabilityBlockImport<I, P> {
to_worker.clone(),
));

if let Err(_) = spawner.spawn(prune_available.map(drop)) {
error!(target: LOG_TARGET, "Failed to spawn availability pruning task");
}
spawner.spawn("polkadot-prune-availibility", prune_available.map(drop).boxed());

AvailabilityBlockImport {
client,
Expand Down
2 changes: 0 additions & 2 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ pub struct RunCmd {
#[allow(missing_docs)]
#[derive(Debug, StructOpt)]
pub struct Cli {
#[allow(missing_docs)]
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,

#[allow(missing_docs)]
#[structopt(flatten)]
pub run: RunCmd,
}
4 changes: 2 additions & 2 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use log::info;
use service::{IdentifyVariant, self};
#[cfg(feature = "service-rewr")]
use service_new::{IdentifyVariant, self as service};
use sc_cli::{SubstrateCli, Result, RuntimeVersion, Role};
use sc_cli::{CliConfiguration, SubstrateCli, Result, RuntimeVersion, Role};
use crate::cli::{Cli, Subcommand};

fn get_exec_name() -> Option<String> {
Expand Down Expand Up @@ -198,7 +198,7 @@ pub fn run() -> Result<()> {
}
},
Some(Subcommand::ValidationWorker(cmd)) => {
sc_cli::init_logger("");
sc_cli::init_logger("", cli.run.base.log_rotation_opt()?)?;

if cfg!(feature = "browser") {
Err(sc_cli::Error::Input("Cannot run validation worker in browser".into()))
Expand Down
7 changes: 4 additions & 3 deletions collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use std::sync::Arc;
use std::time::Duration;
use std::pin::Pin;

use futures::{future, Future, Stream, FutureExt, StreamExt, task::Spawn};
use futures::{future, Future, Stream, FutureExt, StreamExt};
use log::warn;
use sc_client_api::{StateBackend, BlockchainEvents};
use sp_blockchain::HeaderBackend;
Expand Down Expand Up @@ -82,6 +82,7 @@ use polkadot_service_new::{
Error as ServiceError, FullNodeHandles, PolkadotClient,
};
use sc_service::SpawnTaskHandle;
use sp_core::traits::SpawnNamed;

const COLLATION_TIMEOUT: Duration = Duration::from_secs(30);

Expand Down Expand Up @@ -133,7 +134,7 @@ pub trait BuildParachainContext {
Client::Api: RuntimeApiCollection<Extrinsic>,
<Client::Api as ApiExt<Block>>::StateBackend: StateBackend<HashFor<Block>>,
Extrinsic: codec::Codec + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync + 'static;
SP: SpawnNamed + Clone + Send + Sync + 'static;
}

/// Parachain context needed for collation.
Expand Down Expand Up @@ -233,7 +234,7 @@ fn build_collator_service<SP, P, C, R, Extrinsic>(
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
Extrinsic: service::Codec + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync + 'static,
SP: SpawnNamed + Clone + Send + Sync + 'static,
{
Err("Collator is not functional with the new service yet".into())
}
Expand Down
9 changes: 2 additions & 7 deletions network/src/legacy/gossip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ pub(crate) fn pov_block_topic(parent_hash: Hash) -> Hash {
pub fn register_validator<C: ChainContext + 'static>(
service: Arc<NetworkService<Block, Hash>>,
chain: C,
executor: &impl futures::task::Spawn,
executor: &impl sp_core::traits::SpawnNamed,
) -> RegisteredMessageValidator
{
let s = service.clone();
Expand Down Expand Up @@ -331,12 +331,7 @@ pub fn register_validator<C: ChainContext + 'static>(
let fut = futures::future::poll_fn(move |cx| {
gossip_engine.lock().poll_unpin(cx)
});
let spawn_res = executor.spawn_obj(futures::task::FutureObj::from(Box::new(fut)));

// Note: we consider the chances of an error to spawn a background task almost null.
if spawn_res.is_err() {
log::error!(target: "polkadot-gossip", "Failed to spawn background task");
}
executor.spawn("polkadot-legacy-gossip-engine", fut.boxed());
}

RegisteredMessageValidator {
Expand Down
Loading

0 comments on commit b5e49b0

Please sign in to comment.