Commit cc0c54c9 authored by Stanislav Tkach's avatar Stanislav Tkach Committed by Gavin Wood
Browse files

Migrate to the 2018 edition (#273)

parent 620b8610
......@@ -13,7 +13,6 @@ name = "adder"
version = "0.1.0"
dependencies = [
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-parachain 0.1.0",
"tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
......@@ -995,6 +994,15 @@ dependencies = [
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hex-literal"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hex-literal-impl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hex-literal-impl"
version = "0.1.2"
......@@ -1003,6 +1011,14 @@ dependencies = [
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hex-literal-impl"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hmac"
version = "0.4.2"
......@@ -2305,7 +2321,6 @@ version = "0.1.0"
dependencies = [
"polkadot-runtime 0.1.0",
"substrate-executor 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)",
]
[[package]]
......@@ -2317,7 +2332,6 @@ dependencies = [
"futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-availability-store 0.1.0",
"polkadot-primitives 0.1.0",
......@@ -2352,7 +2366,6 @@ dependencies = [
"polkadot-parachain 0.1.0",
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-primitives 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sr-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sr-version 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
......@@ -2366,11 +2379,10 @@ name = "polkadot-runtime"
version = "0.1.0"
dependencies = [
"bitvec 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-primitives 0.1.0",
"rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -2413,7 +2425,7 @@ name = "polkadot-service"
version = "0.5.0"
dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -2444,7 +2456,6 @@ name = "polkadot-statement-table"
version = "0.1.0"
dependencies = [
"parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-primitives 0.1.0",
"substrate-primitives 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
]
......@@ -5072,7 +5083,9 @@ dependencies = [
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
"checksum hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc2928beef125e519d69ae1baa8c37ea2e0d3848545217f6db0179c5eb1d639"
"checksum hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3da68162fdd2147e66682e78e729bd77f93b4c99656db058c5782d8c6b6225a"
"checksum hex-literal-impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "520870c3213943eb8d7803e80180d12a6c7ceb4ae74602544529d1643dc4ddda"
"checksum hex-literal-impl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06095d08c7c05760f11a071b3e1d4c5b723761c01bd8d7201c30a9536668a612"
"checksum hmac 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a13f4163aa0c5ca1be584aace0e2212b2e41be5478218d4f657f5f778b2ae2a"
"checksum hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f127a908633569f208325f86f71255d3363c79721d7f9fe31cd5569908819771"
"checksum hmac-drbg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe727d41d2eec0a6574d887914347e5ff96a3b87177817e2a9820c5c87fecc2"
......
......@@ -7,9 +7,10 @@ name = "polkadot"
version = "0.5.0"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
edition = "2018"
[dependencies]
polkadot-cli = { path = "cli" }
cli = { package = "polkadot-cli", path = "cli" }
futures = "0.1"
ctrlc = { version = "3.0", features = ["termination"] }
......
......@@ -3,6 +3,7 @@ name = "polkadot-availability-store"
description = "Persistent database for parachain data"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
polkadot-primitives = { path = "../primitives" }
......
......@@ -16,22 +16,12 @@
//! Persistent database for parachain data.
extern crate polkadot_primitives;
extern crate parking_lot;
extern crate parity_codec as codec;
extern crate substrate_primitives;
extern crate kvdb;
extern crate kvdb_rocksdb;
extern crate kvdb_memorydb;
#[macro_use]
extern crate log;
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use kvdb::{KeyValueDB, DBTransaction};
use kvdb_rocksdb::{Database, DatabaseConfig};
use polkadot_primitives::Hash;
use polkadot_primitives::parachain::{Id as ParaId, BlockData, Extrinsic};
use log::warn;
use std::collections::HashSet;
use std::path::PathBuf;
......@@ -101,7 +91,7 @@ impl Store {
/// Create a new `Store` in-memory. Useful for tests.
pub fn new_in_memory() -> Self {
Store {
inner: Arc::new(::kvdb_memorydb::create(::columns::NUM_COLUMNS)),
inner: Arc::new(::kvdb_memorydb::create(columns::NUM_COLUMNS)),
}
}
......
......@@ -3,11 +3,12 @@ name = "polkadot-cli"
version = "0.5.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
edition = "2018"
[dependencies]
log = "0.4.6"
tokio = "0.1.7"
futures = "0.1.17"
exit-future = "0.1"
substrate-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
polkadot-service = { path = "../service" }
cli = { package = "substrate-cli", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
service = { package = "polkadot-service", path = "../service" }
......@@ -19,16 +19,6 @@
#![warn(missing_docs)]
#![warn(unused_extern_crates)]
extern crate futures;
extern crate tokio;
extern crate substrate_cli as cli;
extern crate polkadot_service as service;
extern crate exit_future;
#[macro_use]
extern crate log;
mod chain_spec;
use std::ops::Deref;
......@@ -36,6 +26,7 @@ use chain_spec::ChainSpec;
use futures::Future;
use tokio::runtime::Runtime;
use service::Service as BareService;
use log::info;
pub use service::{
Components as ServiceComponents, PolkadotService, CustomConfiguration, ServiceFactory, Factory,
......@@ -127,7 +118,8 @@ fn run_until_exit<T, C, W>(
let (exit_send, exit) = exit_future::signal();
let executor = runtime.executor();
cli::informant::start(&service, exit.clone(), executor.clone());
let informant = cli::informant::build(&service);
executor.spawn(exit.until(informant).map(|_| ()));
let _ = runtime.block_on(worker.work(&*service, executor.clone()));
exit_send.fire();
......
......@@ -3,14 +3,15 @@ name = "polkadot-collator"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Collator node implementation"
edition = "2018"
[dependencies]
futures = "0.1.17"
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
parity-codec = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-consensus-authorities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-consensus-common= { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
consensus_authorities = { package = "substrate-consensus-authorities", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
consensus_common = { package = "substrate-consensus-common", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
polkadot-runtime = { path = "../runtime", version = "0.1" }
polkadot-primitives = { path = "../primitives", version = "0.1" }
polkadot-cli = { path = "../cli" }
......@@ -20,4 +21,4 @@ log = "0.4"
tokio = "0.1.7"
[dev-dependencies]
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
keyring = { package = "substrate-keyring", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......@@ -44,32 +44,13 @@
//! This crate defines traits which provide context necessary for collation logic
//! to be performed, as the collation logic itself.
extern crate futures;
extern crate substrate_client as client;
extern crate parity_codec as codec;
extern crate substrate_primitives as primitives;
extern crate substrate_consensus_authorities as consensus_authorities;
extern crate substrate_consensus_common as consensus_common;
extern crate tokio;
extern crate polkadot_cli;
extern crate polkadot_runtime;
extern crate polkadot_primitives;
extern crate polkadot_network;
extern crate polkadot_validation;
#[macro_use]
extern crate log;
#[cfg(test)]
extern crate substrate_keyring as keyring;
use std::collections::HashSet;
use std::fmt;
use std::sync::Arc;
use std::time::Duration;
use futures::{future, Stream, Future, IntoFuture};
use log::{info, warn};
use client::BlockchainEvents;
use primitives::{ed25519, Pair};
use polkadot_primitives::{BlockId, SessionKey, Hash, Block};
......
......@@ -5,8 +5,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
polkadot-primitives = { path = "../primitives" }
reed-solomon-erasure = { git = "https://github.com/paritytech/reed-solomon-erasure" }
primitives = { package = "polkadot-primitives", path = "../primitives" }
reed_solomon = { package = "reed-solomon-erasure", git = "https://github.com/paritytech/reed-solomon-erasure" }
parity-codec = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
trie = { package = "substrate-trie", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......@@ -24,13 +24,7 @@
//! f is the maximum number of faulty vaildators in the system.
//! The data is coded so any f+1 chunks can be used to reconstruct the full data.
extern crate polkadot_primitives as primitives;
extern crate reed_solomon_erasure as reed_solomon;
extern crate parity_codec as codec;
extern crate substrate_primitives;
extern crate substrate_trie as trie;
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use reed_solomon::galois_16::{self, ReedSolomon};
use primitives::{Hash as H256, BlakeTwo256, HashT};
use primitives::parachain::{BlockData, Extrinsic};
......@@ -297,7 +291,7 @@ struct ShardInput<'a, I> {
cur_shard: Option<(&'a [u8], usize)>,
}
impl<'a, I: Iterator<Item=&'a [u8]>> codec::Input for ShardInput<'a, I> {
impl<'a, I: Iterator<Item=&'a [u8]>> parity_codec::Input for ShardInput<'a, I> {
fn read(&mut self, into: &mut [u8]) -> usize {
let mut read_bytes = 0;
......
......@@ -3,8 +3,8 @@ name = "polkadot-executor"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
edition = "2018"
[dependencies]
substrate-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
polkadot-runtime = { path = "../runtime" }
......@@ -17,9 +17,7 @@
//! A `CodeExecutor` specialisation which uses natively compiled runtime when the wasm to be
//! executed is equivalent to the natively compiled code.
extern crate polkadot_runtime;
#[macro_use] extern crate substrate_executor;
extern crate substrate_primitives as primitives;
use substrate_executor::native_executor_instance;
native_executor_instance!(
pub Executor,
......
......@@ -3,15 +3,15 @@ name = "polkadot-network"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot-specific networking protocol"
edition = "2018"
[dependencies]
arrayvec = "0.4"
parking_lot = "0.7.1"
polkadot-availability-store = { path = "../availability-store" }
av_store = { package = "polkadot-availability-store", path = "../availability-store" }
polkadot-validation = { path = "../validation" }
polkadot-primitives = { path = "../primitives" }
parity-codec = "3.0"
parity-codec-derive = "3.0"
parity-codec = { version = "3.0", features = ["derive"] }
substrate-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
......@@ -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;
......
......@@ -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'];
......
......@@ -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};
......
......@@ -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};
......
......@@ -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 {
......
......@@ -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,
......
......@@ -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,
......
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