Migrate to the 2018 edition (#273)

This commit is contained in:
Stanislav Tkach
2019-05-29 19:33:49 +03:00
committed by Gavin Wood
parent c699bdc10a
commit 2c85f90e0a
53 changed files with 230 additions and 421 deletions
+1
View File
@@ -16,6 +16,7 @@
//! Bridge between the network and consensus service for getting collations to it.
use parity_codec::{Encode, Decode};
use polkadot_primitives::Hash;
use polkadot_primitives::parachain::{CollatorId, Id as ParaId, Collation};
use futures::sync::oneshot;
+3 -2
View File
@@ -23,15 +23,16 @@ use substrate_network::consensus_gossip::{
};
use polkadot_validation::{GenericStatement, SignedStatement};
use polkadot_primitives::{Block, Hash, SessionKey, parachain::ValidatorIndex};
use codec::{Decode, Encode};
use parity_codec::{Decode, Encode};
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use parking_lot::RwLock;
use log::warn;
use super::NetworkService;
use router::attestation_topic;
use crate::router::attestation_topic;
/// The engine ID of the polkadot attestation system.
pub const POLKADOT_ENGINE_ID: sr_primitives::ConsensusEngineId = [b'd', b'o', b't', b'1'];
+2 -27
View File
@@ -19,39 +19,13 @@
//! This manages routing for parachain statements, parachain block and extrinsic data fetching,
//! communication between collators and validators, and more.
extern crate parity_codec as codec;
extern crate substrate_network;
extern crate substrate_primitives;
extern crate sr_primitives;
extern crate polkadot_validation;
extern crate polkadot_availability_store as av_store;
extern crate polkadot_primitives;
extern crate arrayvec;
extern crate parking_lot;
extern crate tokio;
extern crate exit_future;
extern crate futures;
#[macro_use]
extern crate log;
#[macro_use]
extern crate parity_codec_derive;
#[cfg(test)]
extern crate substrate_client;
#[cfg(test)]
extern crate substrate_keyring;
mod collator_pool;
mod local_collations;
mod router;
pub mod validation;
pub mod gossip;
use codec::{Decode, Encode};
use parity_codec::{Decode, Encode};
use futures::sync::oneshot;
use polkadot_primitives::{Block, SessionKey, Hash, Header};
use polkadot_primitives::parachain::{
@@ -65,6 +39,7 @@ use substrate_network::StatusMessage as GenericFullStatus;
use self::validation::{LiveValidationSessions, RecentValidatorIds, InsertedRecentKey};
use self::collator_pool::{CollatorPool, Role, Action};
use self::local_collations::LocalCollations;
use log::{trace, debug, warn};
use std::collections::{HashMap, HashSet};
+1 -1
View File
@@ -21,7 +21,7 @@
use polkadot_primitives::{Hash, SessionKey};
use collator_pool::Role;
use crate::collator_pool::Role;
use std::collections::{HashMap, HashSet};
use std::time::{Duration, Instant};
+4 -3
View File
@@ -31,17 +31,18 @@ use polkadot_primitives::{Block, Hash};
use polkadot_primitives::parachain::{Extrinsic, CandidateReceipt, ParachainHost,
ValidatorIndex, Collation, PoVBlock,
};
use gossip::RegisteredMessageValidator;
use crate::gossip::RegisteredMessageValidator;
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use futures::prelude::*;
use parking_lot::Mutex;
use log::{debug, trace};
use std::collections::{HashMap, HashSet};
use std::io;
use std::sync::Arc;
use validation::{self, SessionDataFetcher, NetworkService, Executor};
use crate::validation::{self, SessionDataFetcher, NetworkService, Executor};
/// Compute the gossip topic for attestations on the given parent hash.
pub(crate) fn attestation_topic(parent_hash: Hash) -> Hash {
+2 -2
View File
@@ -18,7 +18,7 @@
use std::collections::HashMap;
use super::{PolkadotProtocol, Status, Message, FullStatus};
use validation::SessionParams;
use crate::validation::SessionParams;
use polkadot_validation::GenericStatement;
use polkadot_primitives::{Block, Hash, SessionKey};
@@ -27,7 +27,7 @@ use polkadot_primitives::parachain::{
ConsolidatedIngressRoots,
};
use substrate_primitives::crypto::UncheckedInto;
use codec::Encode;
use parity_codec::Encode;
use substrate_network::{
PeerId, Context, config::Roles,
message::generic::ConsensusMessage,
+3 -3
View File
@@ -18,12 +18,12 @@
#![allow(unused)]
use validation::{NetworkService, GossipService};
use crate::validation::{NetworkService, GossipService};
use substrate_network::Context as NetContext;
use substrate_network::consensus_gossip::TopicNotification;
use substrate_primitives::{NativeOrEncoded, ExecutionContext};
use substrate_keyring::AuthorityKeyring;
use {PolkadotProtocol};
use crate::PolkadotProtocol;
use polkadot_validation::{SharedTable, MessagesFrom, Network};
use polkadot_primitives::{SessionKey, Block, Hash, Header, BlockId};
@@ -322,7 +322,7 @@ impl ParachainHost<Block> for RuntimeApi {
}
}
type TestValidationNetwork = ::validation::ValidationNetwork<
type TestValidationNetwork = crate::validation::ValidationNetwork<
TestApi,
NeverExit,
TestNetwork,
+3 -2
View File
@@ -40,9 +40,10 @@ use std::sync::Arc;
use arrayvec::ArrayVec;
use tokio::runtime::TaskExecutor;
use parking_lot::Mutex;
use log::warn;
use router::Router;
use gossip::{POLKADOT_ENGINE_ID, RegisteredMessageValidator, MessageValidationData};
use crate::router::Router;
use crate::gossip::{POLKADOT_ENGINE_ID, RegisteredMessageValidator, MessageValidationData};
use super::PolkadotProtocol;