[ethcore]: move client test types to test-helpers (#11062)
This commit is contained in:
parent
acad59b300
commit
b6415c6196
@ -21,7 +21,7 @@ use common_types::blockchain_info::BlockChainInfo;
|
||||
use common_types::encoded;
|
||||
use common_types::ids::BlockId;
|
||||
use common_types::transaction::{Action, PendingTransaction};
|
||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::test_helpers::{EachBlockWith, TestBlockChainClient};
|
||||
use ethereum_types::{H256, U256, Address, BigEndianHash};
|
||||
use net::context::IoContext;
|
||||
use net::load_timer::MOVING_SAMPLE_SIZE;
|
||||
|
@ -1099,7 +1099,7 @@ mod tests {
|
||||
use trie::Recorder;
|
||||
use hash::keccak;
|
||||
|
||||
use ethcore::client::{TestBlockChainClient, EachBlockWith};
|
||||
use ethcore::test_helpers::{TestBlockChainClient, EachBlockWith};
|
||||
use client_traits::{BlockInfo, BlockChainClient};
|
||||
use common_types::header::Header;
|
||||
use common_types::encoded;
|
||||
|
@ -396,7 +396,7 @@ impl<L: AsLightClient> AsLightClient for LightProvider<L> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::test_helpers::{EachBlockWith, TestBlockChainClient};
|
||||
use super::Provider;
|
||||
|
||||
#[test]
|
||||
|
@ -22,19 +22,9 @@ mod client;
|
||||
mod config;
|
||||
mod traits;
|
||||
|
||||
#[cfg(any(test, feature = "test-helpers"))]
|
||||
mod evm_test_client;
|
||||
#[cfg(any(test, feature = "test-helpers"))]
|
||||
mod test_client;
|
||||
|
||||
pub use self::client::Client;
|
||||
pub use self::config::{ClientConfig, DatabaseCompactionProfile, VMType};
|
||||
pub use self::traits::{
|
||||
ReopenBlock, PrepareOpenBlock, ImportSealedBlock, BroadcastProposalBlock,
|
||||
Call, EngineInfo, BlockProducer, SealedBlockImporter,
|
||||
};
|
||||
|
||||
#[cfg(any(test, feature = "test-helpers"))]
|
||||
pub use self::evm_test_client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess};
|
||||
#[cfg(any(test, feature = "test-helpers"))]
|
||||
pub use self::test_client::{TestBlockChainClient, EachBlockWith, TestState};
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use client::{EvmTestClient, Client, ClientConfig};
|
||||
use client::{Client, ClientConfig};
|
||||
use client_traits::{ImportBlock, ChainInfo};
|
||||
use spec::Genesis;
|
||||
use ethjson;
|
||||
use miner::Miner;
|
||||
use io::IoChannel;
|
||||
use test_helpers;
|
||||
use test_helpers::{self, EvmTestClient};
|
||||
use types::verification::Unverified;
|
||||
use verification::VerifierType;
|
||||
use super::SKIP_TEST_STATE;
|
||||
|
@ -18,8 +18,8 @@ use std::path::Path;
|
||||
use super::test_common::*;
|
||||
use pod::PodState;
|
||||
use trace;
|
||||
use client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess};
|
||||
use ethjson;
|
||||
use test_helpers::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess};
|
||||
use types::transaction::SignedTransaction;
|
||||
use vm::EnvInfo;
|
||||
use super::SKIP_TEST_STATE;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
use std::path::Path;
|
||||
use super::test_common::*;
|
||||
use client::EvmTestClient;
|
||||
use test_helpers::EvmTestClient;
|
||||
use ethjson;
|
||||
use rlp::Rlp;
|
||||
use types::{
|
||||
|
@ -1491,10 +1491,12 @@ mod tests {
|
||||
use hash::keccak;
|
||||
use rustc_hex::FromHex;
|
||||
|
||||
use client::{TestBlockChainClient, EachBlockWith, ImportSealedBlock};
|
||||
use client_traits::ChainInfo;
|
||||
use client::ImportSealedBlock;
|
||||
use miner::{MinerService, PendingOrdering};
|
||||
use test_helpers::{generate_dummy_client, generate_dummy_client_with_spec};
|
||||
use test_helpers::{
|
||||
generate_dummy_client, generate_dummy_client_with_spec, TestBlockChainClient, EachBlockWith
|
||||
};
|
||||
use types::{
|
||||
BlockNumber,
|
||||
transaction::Transaction
|
||||
|
@ -16,6 +16,18 @@
|
||||
|
||||
//! Set of different helpers for client tests
|
||||
|
||||
mod test_client;
|
||||
mod evm_test_client;
|
||||
|
||||
/// Re-export for tests only
|
||||
pub use evm::CreateContractAddress;
|
||||
/// Re-export for tests only
|
||||
pub use trie::TrieSpec;
|
||||
/// Re-export for tests only
|
||||
pub use self::test_client::{TestBlockChainClient, EachBlockWith, TestState};
|
||||
/// Re-export for tests only
|
||||
pub use self::evm_test_client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess};
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::{fs, io};
|
||||
@ -53,10 +65,6 @@ use spec::{Spec, self};
|
||||
use account_state::*;
|
||||
use state_db::StateDB;
|
||||
|
||||
/// Re-export for tests only
|
||||
pub use evm::CreateContractAddress;
|
||||
/// Re-export for tests only
|
||||
pub use trie::TrieSpec;
|
||||
|
||||
/// Creates test block with corresponding header
|
||||
pub fn create_test_block(header: &Header) -> Bytes {
|
@ -636,15 +636,15 @@ fn all_expected<A, B, F>(values: &[A], expected_values: &[B], is_expected: F) ->
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use spec;
|
||||
use ethkey::{Generator,Random};
|
||||
use ethkey::{Generator, Random};
|
||||
use hash::keccak;
|
||||
use parking_lot::RwLock;
|
||||
use rlp::{encode_list,RlpStream};
|
||||
use rlp::{encode_list, RlpStream};
|
||||
use tests::helpers::TestIo;
|
||||
use tests::snapshot::TestSnapshotService;
|
||||
use types::transaction::{Transaction,SignedTransaction};
|
||||
use types::transaction::{Transaction, SignedTransaction};
|
||||
use triehash_ethereum::ordered_trie_root;
|
||||
use types::header::Header as BlockHeader;
|
||||
|
||||
|
@ -544,7 +544,7 @@ impl BlockCollection {
|
||||
mod test {
|
||||
use super::{BlockCollection, SyncHeader};
|
||||
use client_traits::BlockChainClient;
|
||||
use ethcore::client::{TestBlockChainClient, EachBlockWith};
|
||||
use ethcore::test_helpers::{TestBlockChainClient, EachBlockWith};
|
||||
use types::{
|
||||
ids::BlockId,
|
||||
BlockNumber,
|
||||
|
@ -801,11 +801,11 @@ impl SyncHandler {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use client_traits::ChainInfo;
|
||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::test_helpers::{EachBlockWith, TestBlockChainClient};
|
||||
use parking_lot::RwLock;
|
||||
use rlp::Rlp;
|
||||
use std::collections::{VecDeque};
|
||||
use tests::helpers::{TestIo};
|
||||
use std::collections::VecDeque;
|
||||
use tests::helpers::TestIo;
|
||||
use tests::snapshot::TestSnapshotService;
|
||||
|
||||
use super::*;
|
||||
|
@ -1408,7 +1408,7 @@ pub mod tests {
|
||||
use std::collections::{VecDeque};
|
||||
use ethkey;
|
||||
use network::PeerId;
|
||||
use tests::helpers::{TestIo};
|
||||
use tests::helpers::TestIo;
|
||||
use tests::snapshot::TestSnapshotService;
|
||||
use ethereum_types::{H256, U256, Address};
|
||||
use parking_lot::RwLock;
|
||||
@ -1417,7 +1417,7 @@ pub mod tests {
|
||||
use super::*;
|
||||
use ::SyncConfig;
|
||||
use super::{PeerInfo, PeerAsking};
|
||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::test_helpers::{EachBlockWith, TestBlockChainClient};
|
||||
use client_traits::{BlockInfo, BlockChainClient, ChainInfo};
|
||||
use ethcore::miner::{MinerService, PendingOrdering};
|
||||
use types::header::Header;
|
||||
|
@ -336,7 +336,7 @@ impl SyncPropagator {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use client_traits::{BlockInfo, ChainInfo};
|
||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::test_helpers::{EachBlockWith, TestBlockChainClient};
|
||||
use parking_lot::RwLock;
|
||||
use rlp::Rlp;
|
||||
use std::collections::VecDeque;
|
||||
|
@ -394,17 +394,17 @@ impl SyncSupplier {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::collections::{VecDeque};
|
||||
use tests::helpers::{TestIo};
|
||||
use std::collections::VecDeque;
|
||||
use tests::helpers::TestIo;
|
||||
use tests::snapshot::TestSnapshotService;
|
||||
use ethereum_types::{H256};
|
||||
use ethereum_types::H256;
|
||||
use parking_lot::RwLock;
|
||||
use bytes::Bytes;
|
||||
use rlp::{Rlp, RlpStream};
|
||||
use super::{*, super::tests::*};
|
||||
use blocks::SyncHeader;
|
||||
use client_traits::BlockChainClient;
|
||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::test_helpers::{EachBlockWith, TestBlockChainClient};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
use tests::helpers::TestNet;
|
||||
|
||||
use ethcore::client::EachBlockWith;
|
||||
use ethcore::test_helpers::EachBlockWith;
|
||||
use client_traits::BlockInfo;
|
||||
use types::ids::BlockId;
|
||||
|
||||
|
@ -22,7 +22,7 @@ use std::sync::Arc;
|
||||
use light_sync::*;
|
||||
use tests::helpers::{TestNet, Peer as PeerLike, TestPacket};
|
||||
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use spec;
|
||||
use io::IoChannel;
|
||||
use kvdb_memorydb;
|
||||
|
@ -17,7 +17,7 @@
|
||||
use std::sync::Arc;
|
||||
use types::ids::BlockId;
|
||||
use client_traits::{BlockChainClient, ChainInfo};
|
||||
use ethcore::client::{TestBlockChainClient, EachBlockWith};
|
||||
use ethcore::test_helpers::{TestBlockChainClient, EachBlockWith};
|
||||
use client_traits::BlockInfo;
|
||||
use chain::SyncState;
|
||||
use super::helpers::*;
|
||||
|
@ -27,10 +27,9 @@ use types::{
|
||||
io_message::ClientIoMessage,
|
||||
};
|
||||
use client_traits::{BlockChainClient, ChainNotify};
|
||||
use ethcore::client::{
|
||||
TestBlockChainClient,
|
||||
Client as EthcoreClient,
|
||||
ClientConfig,
|
||||
use ethcore::{
|
||||
client::{Client as EthcoreClient, ClientConfig},
|
||||
test_helpers::TestBlockChainClient
|
||||
};
|
||||
use snapshot::SnapshotService;
|
||||
use spec::{self, Spec};
|
||||
|
@ -21,7 +21,7 @@ use ethereum_types::H256;
|
||||
use parking_lot::Mutex;
|
||||
use bytes::Bytes;
|
||||
use snapshot::SnapshotService;
|
||||
use ethcore::client::EachBlockWith;
|
||||
use ethcore::test_helpers::EachBlockWith;
|
||||
use types::{
|
||||
BlockNumber,
|
||||
snapshot::{ManifestData, RestorationStatus},
|
||||
|
@ -22,7 +22,7 @@ use common_types::verification::Unverified;
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use ethash::{EthashParams, Ethash};
|
||||
use ethereum_types::U256;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use spec::new_constantinople_test_machine;
|
||||
use tempdir::TempDir;
|
||||
|
||||
|
@ -377,9 +377,8 @@ mod tests {
|
||||
use engine::Engine;
|
||||
use ethkey::{Random, Generator};
|
||||
use spec;
|
||||
use ethcore::{
|
||||
client::TestBlockChainClient,
|
||||
test_helpers::{create_test_block_with_data, create_test_block}
|
||||
use ethcore::test_helpers::{
|
||||
create_test_block_with_data, create_test_block, TestBlockChainClient
|
||||
};
|
||||
use common_types::{
|
||||
engines::params::CommonParams,
|
||||
|
@ -19,10 +19,7 @@
|
||||
use std::time::{Instant, Duration};
|
||||
|
||||
use common_types::transaction;
|
||||
use ethcore::{
|
||||
client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess},
|
||||
test_helpers::TrieSpec,
|
||||
};
|
||||
use ethcore::test_helpers::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess, TrieSpec};
|
||||
use ethereum_types::{H256, U256};
|
||||
use ethjson;
|
||||
use pod::PodState;
|
||||
|
@ -120,7 +120,7 @@ fn get_param<'a>(query: &'a str, name: &str) -> Option<&'a str> {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
use super::*;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
|
||||
fn get_mocked_handler() -> IpfsHandler {
|
||||
IpfsHandler::new(None.into(), None.into(), Arc::new(TestBlockChainClient::new()))
|
||||
|
@ -23,8 +23,9 @@ use bytes::Bytes;
|
||||
use client_traits::{Nonce, StateClient};
|
||||
use engine::{Engine, signer::EngineSigner};
|
||||
use ethcore::block::SealedBlock;
|
||||
use ethcore::client::{PrepareOpenBlock, EngineInfo, TestState};
|
||||
use ethcore::client::{PrepareOpenBlock, EngineInfo};
|
||||
use ethcore::miner::{self, MinerService, AuthoringParams, FilterOptions};
|
||||
use ethcore::test_helpers::TestState;
|
||||
use ethereum_types::{H256, U256, Address};
|
||||
use miner::pool::local_transactions::Status as LocalTransactionStatus;
|
||||
use miner::pool::{verifier, VerifiedTransaction, QueueStatus};
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
|
||||
use jsonrpc_core::IoHandler;
|
||||
use v1::{Debug, DebugClient};
|
||||
|
@ -21,7 +21,7 @@ use std::time::{Instant, Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
use accounts::AccountProvider;
|
||||
use client_traits::BlockChainClient;
|
||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::test_helpers::{EachBlockWith, TestBlockChainClient};
|
||||
use ethcore::miner::{self, MinerService};
|
||||
use ethereum_types::{H160, H256, U256, Address, Bloom};
|
||||
use machine::executed::Executed;
|
||||
|
@ -23,7 +23,7 @@ use jsonrpc_pubsub::Session;
|
||||
use std::time::Duration;
|
||||
|
||||
use v1::{EthPubSub, EthPubSubClient, Metadata};
|
||||
use ethcore::client::{TestBlockChainClient, EachBlockWith};
|
||||
use ethcore::test_helpers::{TestBlockChainClient, EachBlockWith};
|
||||
use parity_runtime::Runtime;
|
||||
use ethereum_types::{Address, H256};
|
||||
use client_traits::{BlockInfo, ChainNotify};
|
||||
|
@ -15,7 +15,7 @@
|
||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::sync::Arc;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use ethcore_logger::RotatingLogger;
|
||||
use ethereum_types::{Address, U256, H256, BigEndianHash, Bloom};
|
||||
use ethstore::ethkey::{Generator, Random};
|
||||
|
@ -20,7 +20,7 @@ use rustc_hex::FromHex;
|
||||
use ethereum_types::{U256, Address};
|
||||
|
||||
use ethcore::miner::MinerService;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use sync::ManageNetwork;
|
||||
|
||||
use jsonrpc_core::IoHandler;
|
||||
|
@ -20,7 +20,7 @@ use std::str::FromStr;
|
||||
use bytes::ToPretty;
|
||||
use accounts::AccountProvider;
|
||||
use ethereum_types::{Address, H520, U256};
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use jsonrpc_core::IoHandler;
|
||||
use parking_lot::Mutex;
|
||||
use types::transaction::{Action, Transaction};
|
||||
|
@ -20,7 +20,7 @@ use ethereum_types::{H520, U256, Address};
|
||||
use bytes::ToPretty;
|
||||
|
||||
use accounts::AccountProvider;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use parity_runtime::Runtime;
|
||||
use parking_lot::Mutex;
|
||||
use rlp::encode;
|
||||
|
@ -33,14 +33,14 @@ use v1::tests::mocked::parity;
|
||||
|
||||
use accounts::AccountProvider;
|
||||
use bytes::ToPretty;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use ethereum_types::{U256, Address, Signature, H256};
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethkey::Secret;
|
||||
use ethstore::ethkey::{Generator, Random};
|
||||
use parity_runtime::{Runtime, Executor};
|
||||
use parking_lot::Mutex;
|
||||
use serde_json;
|
||||
use types::transaction::{Transaction, Action, SignedTransaction};
|
||||
use parity_runtime::{Runtime, Executor};
|
||||
|
||||
struct SigningTester {
|
||||
pub runtime: Runtime,
|
||||
|
@ -18,7 +18,7 @@ use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use accounts::AccountProvider;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use ethereum_types::{U256, Address};
|
||||
use parity_runtime::Runtime;
|
||||
use parking_lot::Mutex;
|
||||
@ -30,7 +30,7 @@ use jsonrpc_core::IoHandler;
|
||||
use v1::{EthClientOptions, EthSigning, SigningUnsafeClient};
|
||||
use v1::helpers::nonce;
|
||||
use v1::helpers::dispatch::{self, FullDispatcher};
|
||||
use v1::tests::helpers::{TestMinerService};
|
||||
use v1::tests::helpers::TestMinerService;
|
||||
use v1::metadata::Metadata;
|
||||
|
||||
fn blockchain_client() -> Arc<TestBlockChainClient> {
|
||||
|
@ -19,7 +19,7 @@ use std::sync::Arc;
|
||||
use machine::executed::Executed;
|
||||
use trace::trace::{Action, Res, Call};
|
||||
use trace::LocalizedTrace;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
use ethcore::test_helpers::TestBlockChainClient;
|
||||
use ethereum_types::{Address, H256};
|
||||
|
||||
use types::transaction::CallError;
|
||||
|
@ -723,7 +723,7 @@ pub mod tests {
|
||||
use std::sync::Arc;
|
||||
use semver::Version;
|
||||
use tempdir::TempDir;
|
||||
use ethcore::client::{TestBlockChainClient, EachBlockWith};
|
||||
use ethcore::test_helpers::{TestBlockChainClient, EachBlockWith};
|
||||
use self::fetch::Error;
|
||||
use super::*;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user