Migrate finality-grandpa to the 2018 edition (#1797)

This commit is contained in:
Stanislav Tkach
2019-02-15 21:06:18 +02:00
committed by Robert Habermeier
parent c122e8eee8
commit 34e3487035
19 changed files with 71 additions and 106 deletions
+5 -35
View File
@@ -52,45 +52,15 @@
//! any signaled changes based on whether the signaling block is included in the
//! newly-finalized chain.
extern crate finality_grandpa as grandpa;
extern crate futures;
extern crate substrate_client as client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_consensus_common as consensus_common;
extern crate substrate_network as network;
extern crate substrate_primitives;
extern crate tokio;
extern crate parking_lot;
extern crate parity_codec as codec;
extern crate substrate_finality_grandpa_primitives as fg_primitives;
extern crate rand;
#[macro_use]
extern crate log;
#[cfg(feature="service-integration")]
extern crate substrate_service as service;
#[cfg(test)]
extern crate substrate_keyring as keyring;
#[cfg(test)]
extern crate substrate_test_client as test_client;
#[cfg(test)]
extern crate env_logger;
#[macro_use]
extern crate parity_codec_derive;
use futures::prelude::*;
use log::{debug, info, warn};
use futures::sync::{self, mpsc, oneshot};
use client::{
BlockchainEvents, CallExecutor, Client, backend::Backend,
error::Error as ClientError,
};
use client::blockchain::HeaderBackend;
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use runtime_primitives::traits::{
NumberFor, Block as BlockT, Header as HeaderT, DigestFor, ProvideRuntimeApi, Hash as HashT,
DigestItemFor, DigestItem,
@@ -407,7 +377,7 @@ pub fn block_import<B, E, Block: BlockT<Hash=H256>, RA, PRA>(
authority_set
}
Some(raw) => ::authorities::AuthoritySet::decode(&mut &raw[..])
Some(raw) => crate::authorities::AuthoritySet::decode(&mut &raw[..])
.ok_or_else(|| ::client::error::ErrorKind::Backend(
format!("GRANDPA authority set kept in invalid format")
))?
@@ -466,7 +436,7 @@ fn committer_communication<Block: BlockT<Hash=H256>, B, E, N, RA>(
DigestItemFor<Block>: DigestItem<AuthorityId=Ed25519AuthorityId>,
{
// verification stream
let commit_in = ::communication::checked_commit_stream::<Block, _>(
let commit_in = crate::communication::checked_commit_stream::<Block, _>(
set_id,
network.commit_messages(set_id),
voters.clone(),
@@ -483,7 +453,7 @@ fn committer_communication<Block: BlockT<Hash=H256>, B, E, N, RA>(
.map(|pair| voters.contains_key(&pair.public().into()))
.unwrap_or(false);
let commit_out = ::communication::CommitsOut::<Block, _>::new(
let commit_out = crate::communication::CommitsOut::<Block, _>::new(
network.clone(),
set_id,
is_voter,