Unverified Commit 0c4fe833 authored by Ashley's avatar Ashley
Browse files

Tidy up validation

parent 73563253
......@@ -427,6 +427,11 @@ dependencies = [
"iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bytes"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "c2-chacha"
version = "0.2.3"
......@@ -941,6 +946,15 @@ dependencies = [
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "exit-future"
version = "0.2.0"
source = "git+https://github.com/expenses/exit-future?branch=modernize#e56d51d0ea98d07bc0c8e724fbe164f5da2faeab"
dependencies = [
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "faerie"
version = "0.13.0"
......@@ -3539,8 +3553,7 @@ name = "polkadot-network"
version = "0.7.0"
dependencies = [
"arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"exit-future 0.2.0 (git+https://github.com/expenses/exit-future?branch=modernize)",
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -3734,11 +3747,9 @@ dependencies = [
name = "polkadot-validation"
version = "0.7.0"
dependencies = [
"async-std 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"exit-future 0.2.0 (git+https://github.com/expenses/exit-future?branch=modernize)",
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -3765,8 +3776,7 @@ dependencies = [
"substrate-keystore 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"substrate-primitives 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"substrate-trie 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -5959,6 +5969,15 @@ dependencies = [
"tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-buf"
version = "0.1.1"
......@@ -6026,8 +6045,6 @@ version = "0.2.0-alpha.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -6894,6 +6911,7 @@ dependencies = [
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
"checksum bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c85319f157e4e26c703678e68e26ab71a46c0199286fa670b21cc9fec13d895"
"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
"checksum c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b"
"checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
......@@ -6952,6 +6970,7 @@ dependencies = [
"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e"
"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
"checksum exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d8013f441e38e31c670e7f34ec8f1d5d3a2bd9d303c1ff83976ca886005e8f48"
"checksum exit-future 0.2.0 (git+https://github.com/expenses/exit-future?branch=modernize)" = "<none>"
"checksum faerie 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f902f2af041f6c7177a2a04f805687cdc71e69c7cbef059a2755d8923f4cd7a8"
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
......@@ -7369,6 +7388,7 @@ dependencies = [
"checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2"
"checksum tiny-keccak 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2953ca5148619bc99695c1274cb54c5275bbb913c6adad87e72eaf8db9787f69"
"checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6"
"checksum tokio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2e765bf9f550bd9b8a970633ca3b56b8120c4b6c5dcbe26a93744cb02fee4b17"
"checksum tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46"
"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f"
"checksum tokio-codec 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9f5d22fd1e84bd4045d28813491cb7d7caae34d45c80517c2213f09a85e8787a"
......
......@@ -30,7 +30,8 @@ use sp_blockchain::{HeaderBackend, Result as ClientResult};
use block_builder::BlockBuilderApi;
use consensus::SelectChain;
use availability_store::Store as AvailabilityStore;
use futures::{StreamExt, FutureExt, Future, future::{ready, select}, task::{Spawn, SpawnExt}};
use futures::prelude::*;
use futures::{future::{ready, select}, task::{Spawn, SpawnExt}};
use polkadot_primitives::{Block, BlockId};
use polkadot_primitives::parachain::{CandidateReceipt, ParachainHost};
use runtime_primitives::traits::{ProvideRuntimeApi};
......@@ -186,7 +187,7 @@ pub(crate) fn start<C, N, P, SC>(
error!("Failed to spawn old sessions pruning task");
}
let prune_available = futures::future::select(
let prune_available = select(
prune_unneeded_availability(client, availability_store),
exit.clone()
)
......
......@@ -28,6 +28,7 @@ use polkadot_primitives::{Block, Hash, BlockId, Balance, parachain::{
use runtime_primitives::traits::ProvideRuntimeApi;
use parachain::{wasm_executor::{self, ExternalitiesError, ExecutionMode}, MessageRef, UpwardMessageRef};
use trie::TrieConfiguration;
use futures::prelude::*;
use log::debug;
use std::task::{Poll, Context};
use std::pin::Pin;
......@@ -38,9 +39,8 @@ use std::pin::Pin;
pub trait Collators: Clone {
/// Errors when producing collations.
type Error: std::fmt::Debug;
/// A full collation.
type Collation: futures::Future<Output=Result<Collation,Self::Error>>;
type Collation: Future<Output=Result<Collation,Self::Error>>;
/// Collate on a specific parachain, building on a given relay chain parent hash.
///
......@@ -99,7 +99,7 @@ impl<C: Collators, P> CollationFetch<C, P> {
}
}
impl<C, P> futures::Future for CollationFetch<C, P>
impl<C, P> Future for CollationFetch<C, P>
where
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
C: Collators + Unpin,
......
......@@ -58,10 +58,8 @@ use futures_timer::Delay;
use txpool_api::{TransactionPool, InPoolTransaction};
use attestation_service::ServiceHandle;
use futures::{
future::{self, Either, select}, FutureExt, StreamExt, Stream, TryFutureExt, stream::unfold,
task::{Spawn, SpawnExt},
};
use futures::prelude::*;
use futures::{future::{self, Either, select, ready}, stream::unfold, task::{Spawn, SpawnExt}};
use collation::CollationFetch;
use dynamic_inclusion::DynamicInclusion;
use inherents::InherentData;
......@@ -110,7 +108,7 @@ pub trait TableRouter: Clone {
/// Errors when fetching data from the network.
type Error: std::fmt::Debug;
/// Future that resolves when candidate data is fetched.
type FetchValidationProof: futures::Future<Output=Result<PoVBlock, Self::Error>>;
type FetchValidationProof: Future<Output=Result<PoVBlock, Self::Error>>;
/// Call with local candidate data. This will make the data available on the network,
/// and sign, import, and broadcast a statement about the candidate.
......@@ -131,7 +129,7 @@ pub trait Network {
/// The future used for asynchronously building the table router.
/// This should not fail.
type BuildTableRouter: futures::Future<Output=Result<Self::TableRouter,Self::Error>>;
type BuildTableRouter: Future<Output=Result<Self::TableRouter,Self::Error>>;
/// Instantiate a table router using the given shared table.
/// Also pass through any outgoing messages to be broadcast to peers.
......@@ -400,11 +398,11 @@ impl<C, N, P> ParachainValidation<C, N, P> where
e,
),
}
futures::future::ready(())
ready(())
}
Err(e) => {
warn!(target: "validation", "Failed to collate candidate: {:?}", e);
futures::future::ready(())
ready(())
}
})
};
......@@ -644,7 +642,7 @@ fn current_timestamp() -> u64 {
struct ProposalTiming {
minimum: Option<Delay>,
attempt_propose: Box<dyn futures::Stream<Item=()> + Send + Unpin>,
attempt_propose: Box<dyn Stream<Item=()> + Send + Unpin>,
dynamic_inclusion: DynamicInclusion,
enough_candidates: Delay,
last_included: usize,
......@@ -812,7 +810,7 @@ impl<C, TxPool> CreateProposalData<C, TxPool> where
}
}
impl<C, TxPool> futures::Future for CreateProposal<C, TxPool> where
impl<C, TxPool> Future for CreateProposal<C, TxPool> where
TxPool: TransactionPool<Block=Block> + 'static,
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
......
......@@ -17,10 +17,11 @@
//! Implements a future which resolves when all of the candidates referenced are includable.
use std::collections::HashMap;
use std::pin::Pin;
use std::task::{Poll, Context};
use futures::prelude::*;
use futures::channel::oneshot;
use std::pin::Pin;
use std::task::{Poll, Context};
use polkadot_primitives::Hash;
......@@ -95,7 +96,7 @@ impl IncludabilitySender {
/// Future that resolves when all the candidates within are includable.
pub struct Includable(oneshot::Receiver<()>);
impl futures::Future for Includable {
impl Future for Includable {
type Output = Result<(), oneshot::Canceled>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
......
......@@ -31,6 +31,7 @@ use polkadot_primitives::parachain::{
};
use parking_lot::Mutex;
use futures::prelude::*;
use log::{warn, debug};
use bitvec::bitvec;
......@@ -267,7 +268,7 @@ pub struct ParachainWork<Fetch> {
max_block_data_size: Option<u64>,
}
impl<Fetch: futures::Future + Unpin> ParachainWork<Fetch> {
impl<Fetch: Future + Unpin> ParachainWork<Fetch> {
/// Prime the parachain work with an API reference for extracting
/// chain information.
pub fn prime<P: ProvideRuntimeApi>(self, api: Arc<P>)
......@@ -319,9 +320,9 @@ pub struct PrimedParachainWork<Fetch, F> {
validate: F,
}
impl<Fetch, F, Err> futures::Future for PrimedParachainWork<Fetch, F>
impl<Fetch, F, Err> Future for PrimedParachainWork<Fetch, F>
where
Fetch: futures::Future<Output=Result<PoVBlock,Err>> + Unpin,
Fetch: Future<Output=Result<PoVBlock,Err>> + Unpin,
F: FnMut(&BlockId, &Collation) -> Result<OutgoingMessages, ()> + Unpin,
Err: From<::std::io::Error>,
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment