Update to Substrate master (#311)

* Best effort to bring up to date.

* Fix the executor stuff

* Update verisons.

* Finish fixing

* Final fixes and warnings.

* add some docs and bump Wasm versions

* Fix tests

* Fix final test
This commit is contained in:
Gavin Wood
2019-07-04 17:15:59 +02:00
committed by GitHub
parent 6377974ed7
commit 29ee4e8f3a
24 changed files with 808 additions and 625 deletions
+10 -3
View File
@@ -31,17 +31,20 @@ use client::blockchain::HeaderBackend;
use consensus::SelectChain;
use extrinsic_store::Store as ExtrinsicStore;
use futures::prelude::*;
use log::error;
use primitives::ed25519;
use polkadot_primitives::{Block, BlockId, AuraId};
use polkadot_primitives::parachain::{CandidateReceipt, ParachainHost};
use runtime_primitives::traits::{ProvideRuntimeApi, Header as HeaderT};
use aura::AuraApi;
use tokio::{timer::Interval, runtime::{TaskExecutor, current_thread::Runtime as LocalRuntime}};
use tokio::{timer::Interval, runtime::current_thread::Runtime as LocalRuntime};
use log::{warn, debug};
use super::{Network, Collators};
type TaskExecutor = Arc<dyn futures::future::Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync>;
/// Gets a list of the candidates in a block.
pub(crate) fn fetch_candidates<P: BlockBody<Block>>(client: &P, block: &BlockId)
-> ClientResult<Option<impl Iterator<Item=CandidateReceipt>>>
@@ -179,14 +182,18 @@ pub(crate) fn start<C, N, P, SC>(
};
runtime.spawn(notifications);
thread_pool.spawn(prune_old_sessions);
if let Err(_) = thread_pool.execute(Box::new(prune_old_sessions)) {
error!("Failed to spawn old sessions pruning task");
}
let prune_available = prune_unneeded_availability(client, extrinsic_store)
.select(exit.clone())
.then(|_| Ok(()));
// spawn this on the tokio executor since it's fine on a thread pool.
thread_pool.spawn(prune_available);
if let Err(_) = thread_pool.execute(Box::new(prune_available)) {
error!("Failed to spawn available pruning task");
}
if let Err(e) = runtime.block_on(exit) {
debug!("BFT event loop error {:?}", e);
+6 -3
View File
@@ -51,7 +51,6 @@ use primitives::{Pair, ed25519};
use runtime_primitives::{
traits::{ProvideRuntimeApi, Header as HeaderT, DigestFor}, ApplyError
};
use tokio::runtime::TaskExecutor;
use tokio::timer::{Delay, Interval};
use transaction_pool::txpool::{Pool, ChainApi as PoolChainApi};
@@ -62,10 +61,12 @@ use collation::CollationFetch;
use dynamic_inclusion::DynamicInclusion;
use inherents::InherentData;
use runtime_aura::timestamp::TimestampInherentData;
use log::{info, debug, warn, trace};
use log::{info, debug, warn, trace, error};
use ed25519::Public as AuthorityId;
type TaskExecutor = Arc<dyn futures::future::Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync>;
pub use self::collation::{
validate_collation, validate_incoming, message_queue_root, egress_roots, Collators,
};
@@ -427,7 +428,9 @@ impl<C, N, P> ParachainValidation<C, N, P> where
.then(|_| Ok(()));
// spawn onto thread pool.
self.handle.spawn(cancellable_work);
if let Err(_) = self.handle.execute(Box::new(cancellable_work)) {
error!("Failed to spawn cancellable work task");
}
signal
}
}