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
+8 -5
View File
@@ -32,10 +32,11 @@ use polkadot_primitives::parachain::{
Id as ParaId, BlockData, CollatorId, CandidateReceipt, Collation, PoVBlock,
StructuredUnroutedIngress,
};
use substrate_network::{PeerId, RequestId, Context};
use substrate_network::{message, generic_message};
use substrate_network::specialization::NetworkSpecialization as Specialization;
use substrate_network::StatusMessage as GenericFullStatus;
use substrate_network::{
PeerId, RequestId, Context, Event, message, generic_message,
specialization::NetworkSpecialization as Specialization,
StatusMessage as GenericFullStatus
};
use self::validation::{LiveValidationSessions, RecentValidatorIds, InsertedRecentKey};
use self::collator_pool::{CollatorPool, Role, Action};
use self::local_collations::LocalCollations;
@@ -69,7 +70,7 @@ mod benefit {
type FullStatus = GenericFullStatus<Block>;
/// Specialization of the network service for the polkadot protocol.
pub type NetworkService = substrate_network::NetworkService<Block, PolkadotProtocol>;
pub type NetworkService = substrate_network::NetworkService<Block, PolkadotProtocol, Hash>;
/// Status of a Polkadot node.
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)]
@@ -593,6 +594,8 @@ impl Specialization<Block> for PolkadotProtocol {
}
}
fn on_event(&mut self, _event: Event) { }
fn on_abort(&mut self) { }
fn maintain_peers(&mut self, ctx: &mut dyn Context<Block>) {
+3 -1
View File
@@ -41,11 +41,13 @@ use sr_primitives::traits::{ApiRef, ProvideRuntimeApi};
use std::collections::HashMap;
use std::sync::Arc;
use futures::{prelude::*, sync::mpsc};
use tokio::runtime::{Runtime, TaskExecutor};
use tokio::runtime::Runtime;
use parity_codec::Encode;
use super::TestContext;
type TaskExecutor = Arc<dyn futures::future::Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync>;
#[derive(Clone, Copy)]
struct NeverExit;
+5 -3
View File
@@ -44,7 +44,6 @@ use std::io;
use std::sync::Arc;
use arrayvec::ArrayVec;
use tokio::runtime::TaskExecutor;
use parking_lot::Mutex;
use log::{debug, warn};
@@ -63,6 +62,7 @@ pub trait Executor {
}
/// A wrapped futures::future::Executor.
#[derive(Clone)]
pub struct WrappedExecutor<T>(pub T);
impl<T> Executor for WrappedExecutor<T>
@@ -75,9 +75,11 @@ impl<T> Executor for WrappedExecutor<T>
}
}
impl Executor for TaskExecutor {
impl Executor for Arc<
dyn futures::future::Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync
> {
fn spawn<F: Future<Item=(),Error=()> + Send + 'static>(&self, f: F) {
TaskExecutor::spawn(self, f)
let _ = FutureExecutor::execute(&**self, Box::new(f));
}
}