Migrate consensus (common, aura-primitives, aura, rhd) to 2018 edition (#1548)

This commit is contained in:
Stanislav Tkach
2019-01-24 17:51:33 +02:00
committed by Gav Wood
parent a5cafa68b1
commit 7f05bd959f
14 changed files with 65 additions and 136 deletions
@@ -157,7 +157,7 @@ pub trait JustificationImport<B: BlockT> {
type Error: ::std::error::Error + Send + 'static;
/// Called by the import queue when it is started.
fn on_start(&self, _link: &::import_queue::Link<B>) { }
fn on_start(&self, _link: &crate::import_queue::Link<B>) { }
/// Import a Block justification and finalize the given block.
fn import_justification(
@@ -16,6 +16,8 @@
//! Error types in Consensus
use runtime_version::RuntimeVersion;
use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed,
impl_extract_backtrace, impl_error_chain_kind};
error_chain! {
errors {
@@ -18,8 +18,10 @@
use super::MAX_TRANSACTIONS_SIZE;
use codec::Encode;
use parity_codec::Encode;
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, As};
use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed,
impl_extract_backtrace, impl_error_chain_kind, bail};
type BlockNumber = u64;
@@ -24,16 +24,17 @@
//! The `BasicQueue` and `BasicVerifier` traits allow serial queues to be
//! instantiated simply.
use block_import::{ImportBlock, BlockImport, JustificationImport, ImportResult, BlockOrigin};
use crate::block_import::{ImportBlock, BlockImport, JustificationImport, ImportResult, BlockOrigin};
use std::collections::{HashSet, VecDeque};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use parking_lot::{Condvar, Mutex, RwLock};
use log::{trace, debug};
use runtime_primitives::Justification;
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero, AuthorityIdFor};
use error::Error as ConsensusError;
use crate::error::Error as ConsensusError;
/// Shared block import struct used by the queue.
pub type SharedBlockImport<B> = Arc<dyn BlockImport<B, Error=ConsensusError> + Send + Sync>;
@@ -26,23 +26,6 @@
// our error-chain could potentially blow up otherwise
#![recursion_limit="128"]
extern crate substrate_primitives as primitives;
extern crate substrate_inherents as inherents;
extern crate futures;
extern crate parking_lot;
extern crate sr_version as runtime_version;
extern crate sr_primitives as runtime_primitives;
#[cfg(any(test, feature = "test-helpers"))]
extern crate substrate_test_client as test_client;
extern crate tokio;
extern crate parity_codec as codec;
extern crate parity_codec_derive;
#[macro_use]
extern crate error_chain;
#[macro_use] extern crate log;
use std::sync::Arc;
use runtime_primitives::generic::BlockId;