Migrate state-db, state-machine, telemetry, test-client and test-runtime to the 2018 edition (#1623)

This commit is contained in:
Stanislav Tkach
2019-01-30 16:51:59 +02:00
committed by Bastian Köcher
parent 2037c52fbe
commit f98f9ac58a
33 changed files with 158 additions and 200 deletions
@@ -16,7 +16,6 @@
//! Block Builder extensions for tests.
use codec;
use client;
use keyring;
use runtime;
@@ -41,7 +40,7 @@ impl<'a, A> BlockBuilderExt for client::block_builder::BlockBuilder<'a, runtime:
fn sign_tx(transfer: runtime::Transfer) -> runtime::Extrinsic {
let signature = keyring::Keyring::from_raw_public(transfer.from.to_fixed_bytes())
.unwrap()
.sign(&codec::Encode::encode(&transfer))
.sign(&parity_codec::Encode::encode(&transfer))
.into();
runtime::Extrinsic::Transfer(transfer, signature)
}
+6 -12
View File
@@ -18,26 +18,19 @@
#![warn(missing_docs)]
extern crate parity_codec as codec;
extern crate substrate_primitives as primitives;
extern crate sr_primitives as runtime_primitives;
#[macro_use] extern crate substrate_executor as executor;
pub extern crate substrate_client as client;
pub extern crate substrate_keyring as keyring;
pub extern crate substrate_test_runtime as runtime;
pub extern crate substrate_consensus_common as consensus;
extern crate substrate_state_machine as state_machine;
pub mod client_ext;
pub mod trait_tests;
mod block_builder_ext;
pub use client_ext::TestClient;
pub use block_builder_ext::BlockBuilderExt;
pub use client;
pub use client::blockchain;
pub use client::backend;
pub use executor::NativeExecutor;
pub use keyring;
pub use runtime;
pub use consensus;
use std::sync::Arc;
use primitives::Blake2Hasher;
@@ -48,7 +41,8 @@ use keyring::Keyring;
mod local_executor {
#![allow(missing_docs)]
use super::runtime;
use runtime;
use executor::native_executor_instance;
// FIXME #1576 change the macro and pass in the `BlakeHasher` that dispatch needs from here instead
native_executor_instance!(
pub LocalExecutor,
@@ -23,11 +23,11 @@ use std::sync::Arc;
use keyring::Keyring;
use consensus::BlockOrigin;
use primitives::Blake2Hasher;
use ::TestClient;
use crate::TestClient;
use runtime_primitives::traits::Block as BlockT;
use backend;
use blockchain::{Backend as BlockChainBackendT, HeaderBackend};
use ::BlockBuilderExt;
use crate::backend;
use crate::blockchain::{Backend as BlockChainBackendT, HeaderBackend};
use crate::{BlockBuilderExt, new_with_backend};
use runtime::{self, Transfer};
use runtime_primitives::generic::BlockId;
@@ -41,7 +41,7 @@ pub fn test_leaves_for_backend<B: 'static>(backend: Arc<B>) where
// B2 -> C3
// A1 -> D2
let client = ::new_with_backend(backend.clone(), false);
let client = new_with_backend(backend.clone(), false);
let genesis_hash = client.info().unwrap().chain.genesis_hash;
@@ -153,7 +153,7 @@ pub fn test_blockchain_query_by_number_gets_canonical<B: 'static>(backend: Arc<B
// A1 -> B2 -> B3 -> B4
// B2 -> C3
// A1 -> D2
let client = ::new_with_backend(backend, false);
let client = new_with_backend(backend, false);
// G -> A1
let a1 = client.new_block().unwrap().bake().unwrap();