Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Migrate to the 2018 edition (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-tkach authored and gavofyork committed May 29, 2019
1 parent 620b861 commit cc0c54c
Show file tree
Hide file tree
Showing 53 changed files with 230 additions and 421 deletions.
29 changes: 21 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
1 change: 1 addition & 0 deletions availability-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
16 changes: 3 additions & 13 deletions availability-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)),
}
}

Expand Down
5 changes: 3 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
14 changes: 3 additions & 11 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,14 @@
#![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;
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,
Expand Down Expand Up @@ -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();
Expand Down
11 changes: 6 additions & 5 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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" }
21 changes: 1 addition & 20 deletions collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions erasure-coding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
10 changes: 2 additions & 8 deletions erasure-coding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
4 changes: 1 addition & 3 deletions executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
1 change: 1 addition & 0 deletions network/src/collator_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions network/src/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
Loading

0 comments on commit cc0c54c

Please sign in to comment.