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

Migrate to the 2018 edition (#273)

parent 620b8610
Pipeline #39104 failed with stages
in 8 minutes and 10 seconds
......@@ -3,9 +3,9 @@ name = "adder"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which adds to a number as its state transition"
edition = "2018"
[dependencies]
polkadot-parachain = { path = "../../parachain/", default-features = false }
parity-codec = { version = "3.5", default-features = false }
parity-codec-derive = { version = "3.3", default-features = false }
parachain = { package = "polkadot-parachain", path = "../../parachain/", default-features = false }
parity-codec = { version = "3.5", default-features = false, features = ["derive"] }
tiny-keccak = "1.4"
......@@ -2,12 +2,13 @@
name = "adder-collator"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
adder = { path = ".." }
polkadot-parachain = { path = "../../../parachain" }
polkadot-collator = { path = "../../../collator" }
polkadot-primitives = { path = "../../../primitives" }
parachain = { package = "polkadot-parachain", path = "../../../parachain" }
collator = { package = "polkadot-collator", path = "../../../collator" }
primitives = { package = "polkadot-primitives", path = "../../../primitives" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
parking_lot = "0.7.1"
ctrlc = { version = "3.0", features = ["termination"] }
......
......@@ -16,16 +16,6 @@
//! Collator for polkadot
extern crate adder;
extern crate substrate_primitives;
extern crate polkadot_parachain as parachain;
extern crate polkadot_primitives as primitives;
extern crate polkadot_collator as collator;
extern crate parking_lot;
extern crate ctrlc;
extern crate futures;
extern crate exit_future;
use std::cell::RefCell;
use std::collections::HashMap;
use std::sync::Arc;
......
......@@ -18,12 +18,6 @@
#![no_std]
#[macro_use]
extern crate parity_codec_derive;
extern crate parity_codec;
extern crate polkadot_parachain as parachain;
extern crate tiny_keccak;
use parity_codec::{Encode, Decode};
/// Head data for this parachain.
......
......@@ -2,10 +2,11 @@
name = "adder-wasm"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
adder = { path = ".." }
polkadot-parachain = { path = "../../../parachain", default-features = false, features = ["wasm-api"] }
parachain = { package = "polkadot-parachain", path = "../../../parachain", default-features = false, features = ["wasm-api"] }
tiny-keccak = "1.4"
dlmalloc = { version = "0.1.2", features = ["global"] }
......
......@@ -22,12 +22,6 @@
alloc, core_intrinsics, lang_items, core_panic_info, alloc_error_handler
)]
extern crate alloc;
extern crate adder;
extern crate polkadot_parachain as parachain;
extern crate tiny_keccak;
extern crate dlmalloc;
#[global_allocator]
static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
......
......@@ -2,6 +2,7 @@
name = "polkadot-validation"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
futures = "0.1.17"
......@@ -11,23 +12,23 @@ error-chain = "0.12"
log = "0.4.6"
exit-future = "0.1"
parity-codec = "3.1"
polkadot-availability-store = { path = "../availability-store" }
polkadot-parachain = { path = "../parachain" }
extrinsic_store = { package = "polkadot-availability-store", path = "../availability-store" }
parachain = { package = "polkadot-parachain", path = "../parachain" }
polkadot-primitives = { path = "../primitives" }
polkadot-runtime = { path = "../runtime" }
polkadot-statement-table = { path = "../statement-table" }
substrate-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-consensus-aura-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-consensus-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
srml-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-consensus-authorities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
table = { package = "polkadot-statement-table", path = "../statement-table" }
aura = { package = "substrate-consensus-aura", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
aura_primitives = { package = "substrate-consensus-aura-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
grandpa = { package = "substrate-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
consensus = { package = "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" }
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
runtime_aura = { package = "srml-aura", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
trie = { package = "substrate-trie", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
runtime_primitives = { package = "sr-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" }
[dev-dependencies]
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......@@ -42,6 +42,7 @@ use runtime_primitives::traits::{ProvideRuntimeApi, Header as HeaderT};
use tokio::runtime::TaskExecutor;
use tokio::runtime::current_thread::Runtime as LocalRuntime;
use tokio::timer::Interval;
use log::{warn, debug};
use super::{Network, Collators};
......@@ -49,7 +50,7 @@ use super::{Network, Collators};
pub(crate) fn fetch_candidates<P: BlockBody<Block>>(client: &P, block: &BlockId)
-> ClientResult<Option<impl Iterator<Item=CandidateReceipt>>>
{
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use polkadot_runtime::{Call, ParachainsCall, UncheckedExtrinsic as RuntimeExtrinsic};
let extrinsics = client.block_body(block)?;
......@@ -106,7 +107,7 @@ pub(crate) struct ServiceHandle {
pub(crate) fn start<C, N, P, SC>(
client: Arc<P>,
select_chain: SC,
parachain_validation: Arc<::ParachainValidation<C, N, P>>,
parachain_validation: Arc<crate::ParachainValidation<C, N, P>>,
thread_pool: TaskExecutor,
key: Arc<ed25519::Pair>,
extrinsic_store: ExtrinsicStore,
......
......@@ -31,6 +31,8 @@ use parachain::{wasm_executor::{self, ExternalitiesError}, MessageRef};
use error_chain::bail;
use futures::prelude::*;
use error_chain::*;
use log::debug;
/// Encapsulates connections to collators and allows collation on any parachain.
///
......@@ -113,7 +115,7 @@ impl<C: Collators, P: ProvideRuntimeApi> Future for CollationFetch<C, P>
.get_or_insert_with(move || c.collate(parachain, r).into_future())
.poll();
try_ready!(poll)
futures::try_ready!(poll)
};
let res = validate_collation(&*self.client, &self.relay_parent, &collation, self.max_block_data_size);
......
......@@ -17,8 +17,8 @@
//! Errors that can occur during the validation process.
use runtime_primitives::RuntimeString;
use primitives::ed25519::Public as AuthorityId;
use error_chain::*;
error_chain! {
foreign_links {
......
......@@ -18,9 +18,10 @@
use super::MAX_TRANSACTIONS_SIZE;
use codec::Encode;
use parity_codec::Encode;
use polkadot_primitives::{Block, Hash, BlockNumber};
use polkadot_primitives::parachain::Id as ParaId;
use error_chain::*;
error_chain! {
foreign_links {
......
......@@ -29,42 +29,6 @@
//!
//! Groups themselves may be compromised by malicious authorities.
extern crate parking_lot;
extern crate polkadot_availability_store as extrinsic_store;
extern crate polkadot_statement_table as table;
extern crate polkadot_parachain as parachain;
extern crate polkadot_runtime;
extern crate polkadot_primitives;
extern crate parity_codec as codec;
extern crate substrate_inherents as inherents;
extern crate substrate_primitives as primitives;
extern crate srml_aura as runtime_aura;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_client as client;
extern crate substrate_trie as trie;
extern crate exit_future;
extern crate tokio;
extern crate substrate_consensus_common as consensus;
extern crate substrate_consensus_aura as aura;
extern crate substrate_consensus_aura_primitives as aura_primitives;
extern crate substrate_finality_grandpa as grandpa;
extern crate substrate_transaction_pool as transaction_pool;
extern crate substrate_consensus_authorities as consensus_authorities;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate futures;
#[macro_use]
extern crate log;
#[cfg(test)]
extern crate substrate_keyring;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use std::time::{self, Duration, Instant};
......@@ -73,7 +37,7 @@ use aura::SlotDuration;
use client::{BlockchainEvents, BlockBody};
use client::blockchain::HeaderBackend;
use client::block_builder::api::BlockBuilder as BlockBuilderApi;
use codec::Encode;
use parity_codec::Encode;
use consensus::SelectChain;
use extrinsic_store::Store as ExtrinsicStore;
use parking_lot::Mutex;
......@@ -97,6 +61,8 @@ use collation::CollationFetch;
use dynamic_inclusion::DynamicInclusion;
use inherents::InherentData;
use runtime_aura::timestamp::TimestampInherentData;
use log::{info, debug, warn, trace};
use error_chain::bail;
use ed25519::Public as AuthorityId;
......@@ -313,7 +279,7 @@ impl<C, N, P> ParachainValidation<C, N, P> where
// compute the parent candidates, if we know of them.
// this will allow us to circulate outgoing messages to other peers as necessary.
let parent_candidates: Vec<_> = ::attestation_service::fetch_candidates(&*self.client, &id)
let parent_candidates: Vec<_> = crate::attestation_service::fetch_candidates(&*self.client, &id)
.ok()
.and_then(|x| x)
.map(|x| x.collect())
......@@ -514,7 +480,7 @@ impl<C, N, P, SC, TxApi> ProposerFactory<C, N, P, SC, TxApi> where
live_instances: Mutex::new(HashMap::new()),
});
let service_handle = ::attestation_service::start(
let service_handle = crate::attestation_service::start(
client,
select_chain.clone(),
parachain_validation.clone(),
......@@ -825,7 +791,7 @@ impl<C, TxApi> Future for CreateProposal<C, TxApi> where
// 1. try to propose if we have enough includable candidates and other
// delays have concluded.
let included = self.table.includable_count();
try_ready!(self.timing.poll(included));
futures::try_ready!(self.timing.poll(included));
// 2. propose
let proposed_candidates = self.table.proposed_set();
......
......@@ -29,6 +29,7 @@ use polkadot_primitives::parachain::{Id as ParaId, Collation, Extrinsic, Candida
use parking_lot::Mutex;
use futures::prelude::*;
use log::{warn, debug};
use super::{GroupInfo, TableRouter};
use self::includable::IncludabilitySender;
......@@ -79,7 +80,7 @@ impl TableContext {
}
fn sign_statement(&self, statement: table::Statement) -> table::SignedStatement {
let signature = ::sign_table_statement(&statement, &self.key, &self.parent_hash).into();
let signature = crate::sign_table_statement(&statement, &self.key, &self.parent_hash).into();
table::SignedStatement {
statement,
......@@ -284,7 +285,7 @@ impl<Fetch: Future> ParachainWork<Fetch> {
{
let max_block_data_size = self.max_block_data_size;
let validate = move |id: &_, collation: &_| {
let res = ::collation::validate_collation(
let res = crate::collation::validate_collation(
&*api,
id,
collation,
......@@ -335,7 +336,7 @@ impl<Fetch, F, Err> Future for PrimedParachainWork<Fetch, F>
let work = &mut self.inner.work;
let candidate = &work.candidate_receipt;
let pov_block = try_ready!(work.fetch.poll());
let pov_block = futures::try_ready!(work.fetch.poll());
let validation_res = (self.validate)(
&BlockId::hash(self.inner.relay_parent),
&Collation { pov: pov_block.clone(), receipt: candidate.clone() },
......@@ -637,7 +638,7 @@ mod tests {
let candidate_statement = GenericStatement::Candidate(candidate);
let signature = ::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
let signature = crate::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
let signed_statement = ::table::generic::SignedStatement {
statement: candidate_statement,
signature: signature.into(),
......@@ -691,7 +692,7 @@ mod tests {
let candidate_statement = GenericStatement::Candidate(candidate);
let signature = ::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
let signature = crate::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
let signed_statement = ::table::generic::SignedStatement {
statement: candidate_statement,
signature: signature.into(),
......@@ -827,7 +828,7 @@ mod tests {
let hash = candidate.hash();
let candidate_statement = GenericStatement::Candidate(candidate);
let signature = ::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
let signature = crate::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
let signed_statement = ::table::generic::SignedStatement {
statement: candidate_statement,
signature: signature.into(),
......
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