[ethcore]: reduce re-exports (#11059)

* [ethcore]: reduce re-exports

Last piece of refactoring to close #10130 after work done by @dvdplm et. al

After this PR, we have the following re-exports from other crates in `non-testbuilds`:
- evm::VMType (client)
- ethcore_miner::local_accounts::LocalAccounts (miner)
- ethcore_miner::pool::PendingOrdering (miner)

I think the miner re-exports make sense (closely tied to the module) and `VMType` (related to module but not closely)

* fix(grumbles): remove re-export `VerifierType`
This commit is contained in:
Niklas Adolfsson 2019-09-16 17:12:21 +02:00 committed by Andronik Ordian
parent bceb1d5691
commit 0051c26acf
14 changed files with 33 additions and 35 deletions

View File

@ -120,7 +120,7 @@ use ethabi::FunctionOutputDecoder;
use vm::CreateContractAddress; use vm::CreateContractAddress;
// Source avaiable at https://github.com/parity-contracts/private-tx/blob/master/contracts/PrivateContract.sol // Source avaiable at https://github.com/parity-contracts/private-tx/blob/master/contracts/PrivateContract.sol
const DEFAULT_STUB_CONTRACT: &'static str = include_str!("../res/private.evm"); const DEFAULT_STUB_CONTRACT: &str = include_str!("../res/private.evm");
use_contract!(private_contract, "res/private.json"); use_contract!(private_contract, "res/private.json");

View File

@ -33,12 +33,10 @@ extern crate log;
use std::sync::Arc; use std::sync::Arc;
use rustc_hex::{FromHex, ToHex}; use rustc_hex::{FromHex, ToHex};
use types::ids::BlockId; use types::ids::BlockId;
use types::transaction::{Transaction, Action}; use types::transaction::{Transaction, Action};
use ethcore::{ use ethcore::{
CreateContractAddress, test_helpers::{CreateContractAddress, generate_dummy_client, push_block_with_transactions, new_db},
test_helpers::{generate_dummy_client, push_block_with_transactions, new_db},
miner::Miner, miner::Miner,
}; };
use client_traits::BlockChainClient; use client_traits::BlockChainClient;

View File

@ -45,12 +45,11 @@ use blockchain::{
BlockNumberKey, BlockNumberKey,
BlockProvider, BlockProvider,
BlockReceipts, BlockReceipts,
CacheSize as BlockChainCacheSize,
ExtrasInsert, ExtrasInsert,
TransactionAddress, TransactionAddress,
TreeRoute TreeRoute
}; };
// re-export
pub use blockchain::CacheSize as BlockChainCacheSize;
use call_contract::{CallContract, RegistryInfo}; use call_contract::{CallContract, RegistryInfo};
use client::{ use client::{
bad_blocks, BlockProducer, BroadcastProposalBlock, Call, bad_blocks, BlockProducer, BroadcastProposalBlock, Call,
@ -93,7 +92,7 @@ use machine::{
executive::{contract_address, Executive, TransactOptions}, executive::{contract_address, Executive, TransactOptions},
transaction_ext::Transaction, transaction_ext::Transaction,
}; };
use miner::{Miner, MinerService}; use miner::{Miner, MinerService, PendingOrdering};
use snapshot::{self, SnapshotClient, SnapshotWriter}; use snapshot::{self, SnapshotClient, SnapshotWriter};
use spec::Spec; use spec::Spec;
use state_db::StateDB; use state_db::StateDB;
@ -2124,7 +2123,7 @@ impl BlockChainClient for Client {
).as_u64() as usize ).as_u64() as usize
) )
}; };
self.importer.miner.ready_transactions(self, max_len, ::miner::PendingOrdering::Priority) self.importer.miner.ready_transactions(self, max_len, PendingOrdering::Priority)
} }
fn signing_chain_id(&self) -> Option<u64> { fn signing_chain_id(&self) -> Option<u64> {

View File

@ -16,14 +16,13 @@
use std::str::FromStr; use std::str::FromStr;
use verification::{VerifierType, QueueConfig}; use blockchain::Config as BlockChainConfig;
use journaldb; use journaldb;
use snapshot::SnapshotConfiguration; use snapshot::SnapshotConfiguration;
use trace::Config as TraceConfig;
use types::client_types::Mode; use types::client_types::Mode;
use verification::{VerifierType, QueueConfig};
pub use std::time::Duration;
pub use blockchain::Config as BlockChainConfig;
pub use trace::Config as TraceConfig;
pub use evm::VMType; pub use evm::VMType;
/// Client state db compaction profile /// Client state db compaction profile

View File

@ -20,22 +20,21 @@ mod ancient_import;
mod bad_blocks; mod bad_blocks;
mod client; mod client;
mod config; mod config;
mod traits;
#[cfg(any(test, feature = "test-helpers"))] #[cfg(any(test, feature = "test-helpers"))]
mod evm_test_client; mod evm_test_client;
#[cfg(any(test, feature = "test-helpers"))] #[cfg(any(test, feature = "test-helpers"))]
mod test_client; mod test_client;
pub use self::client::Client; pub use self::client::Client;
pub use self::config::{ClientConfig, DatabaseCompactionProfile, BlockChainConfig, VMType}; pub use self::config::{ClientConfig, DatabaseCompactionProfile, VMType};
#[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};
pub use self::traits::{ pub use self::traits::{
ReopenBlock, PrepareOpenBlock, ImportSealedBlock, BroadcastProposalBlock, ReopenBlock, PrepareOpenBlock, ImportSealedBlock, BroadcastProposalBlock,
Call, EngineInfo, BlockProducer, SealedBlockImporter, Call, EngineInfo, BlockProducer, SealedBlockImporter,
}; };
pub use verification::VerifierType; #[cfg(any(test, feature = "test-helpers"))]
pub use self::evm_test_client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess};
mod traits; #[cfg(any(test, feature = "test-helpers"))]
pub use self::test_client::{TestBlockChainClient, EachBlockWith, TestState};

View File

@ -123,6 +123,3 @@ mod tests;
pub mod json_tests; pub mod json_tests;
#[cfg(any(test, feature = "test-helpers"))] #[cfg(any(test, feature = "test-helpers"))]
pub mod test_helpers; pub mod test_helpers;
pub use evm::CreateContractAddress;
pub use trie::TrieSpec;

View File

@ -53,6 +53,11 @@ use spec::{Spec, self};
use account_state::*; use account_state::*;
use state_db::StateDB; 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 /// Creates test block with corresponding header
pub fn create_test_block(header: &Header) -> Bytes { pub fn create_test_block(header: &Header) -> Bytes {
let mut rlp = RlpStream::new_list(3); let mut rlp = RlpStream::new_list(3);

View File

@ -38,7 +38,7 @@ rand = "0.6"
rlp = "0.4.0" rlp = "0.4.0"
snapshot = { path = "../snapshot" } snapshot = { path = "../snapshot" }
trace-time = "0.1" trace-time = "0.1"
triehash-ethereum = {version = "0.2", path = "../../util/triehash-ethereum" } triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" }
[dev-dependencies] [dev-dependencies]
env_logger = "0.5" env_logger = "0.5"

View File

@ -25,6 +25,7 @@ extern crate client_traits;
extern crate common_types as types; extern crate common_types as types;
extern crate ethcore; extern crate ethcore;
extern crate ethcore_io as io; extern crate ethcore_io as io;
extern crate ethcore_light as light;
extern crate ethcore_network as network; extern crate ethcore_network as network;
extern crate ethcore_network_devp2p as devp2p; extern crate ethcore_network_devp2p as devp2p;
extern crate ethcore_private_tx; extern crate ethcore_private_tx;
@ -42,8 +43,6 @@ extern crate rlp;
extern crate snapshot; extern crate snapshot;
extern crate triehash_ethereum; extern crate triehash_ethereum;
extern crate ethcore_light as light;
#[cfg(test)] extern crate env_logger; #[cfg(test)] extern crate env_logger;
#[cfg(test)] extern crate kvdb_memorydb; #[cfg(test)] extern crate kvdb_memorydb;
#[cfg(test)] extern crate rustc_hex; #[cfg(test)] extern crate rustc_hex;

View File

@ -26,9 +26,8 @@ use client_traits::BlockChainClient;
use engine::signer; use engine::signer;
use ethcore::{ use ethcore::{
client::Client, client::Client,
CreateContractAddress,
miner::{self, MinerService}, miner::{self, MinerService},
test_helpers::{push_block_with_transactions, new_db}, test_helpers::{CreateContractAddress, push_block_with_transactions, new_db},
}; };
use ethcore_private_tx::{Provider, ProviderConfig, NoopEncryptor, Importer, SignedPrivateTransaction, StoringKeyProvider}; use ethcore_private_tx::{Provider, ProviderConfig, NoopEncryptor, Importer, SignedPrivateTransaction, StoringKeyProvider};
use ethkey::KeyPair; use ethkey::KeyPair;
@ -176,8 +175,10 @@ fn sync_private_state() {
let mut net = TestNet::with_spec(2, SyncConfig::default(), seal_spec); let mut net = TestNet::with_spec(2, SyncConfig::default(), seal_spec);
let client0 = net.peer(0).chain.clone(); let client0 = net.peer(0).chain.clone();
let client1 = net.peer(1).chain.clone(); let client1 = net.peer(1).chain.clone();
let io_handler0: Arc<IoHandler<ClientIoMessage<Client>>> = Arc::new(TestIoHandler::new(net.peer(0).chain.clone())); let io_handler0: Arc<dyn IoHandler<ClientIoMessage<Client>>> =
let io_handler1: Arc<IoHandler<ClientIoMessage<Client>>> = Arc::new(TestIoHandler::new(net.peer(1).chain.clone())); Arc::new(TestIoHandler::new(net.peer(0).chain.clone()));
let io_handler1: Arc<dyn IoHandler<ClientIoMessage<Client>>> =
Arc::new(TestIoHandler::new(net.peer(1).chain.clone()));
net.peer(0).miner.set_author(miner::Author::Sealer(signer::from_keypair(s0.clone()))); net.peer(0).miner.set_author(miner::Author::Sealer(signer::from_keypair(s0.clone())));
net.peer(1).miner.set_author(miner::Author::Sealer(signer::from_keypair(s1.clone()))); net.peer(1).miner.set_author(miner::Author::Sealer(signer::from_keypair(s1.clone())));

View File

@ -21,7 +21,7 @@ use std::time::{Instant, Duration};
use common_types::transaction; use common_types::transaction;
use ethcore::{ use ethcore::{
client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess}, client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess},
TrieSpec, test_helpers::TrieSpec,
}; };
use ethereum_types::{H256, U256}; use ethereum_types::{H256, U256};
use ethjson; use ethjson;

View File

@ -42,7 +42,7 @@ use parity_bytes::Bytes;
use docopt::Docopt; use docopt::Docopt;
use rustc_hex::FromHex; use rustc_hex::FromHex;
use ethereum_types::{U256, Address}; use ethereum_types::{U256, Address};
use ethcore::{json_tests, TrieSpec}; use ethcore::{json_tests, test_helpers::TrieSpec};
use spec; use spec;
use serde::Deserialize; use serde::Deserialize;
use vm::{ActionParams, CallType}; use vm::{ActionParams, CallType};
@ -443,7 +443,7 @@ fn die<T: fmt::Display>(msg: T) -> ! {
mod tests { mod tests {
use common_types::transaction; use common_types::transaction;
use docopt::Docopt; use docopt::Docopt;
use ethcore::TrieSpec; use ethcore::test_helpers::TrieSpec;
use ethjson::test_helpers::state::State; use ethjson::test_helpers::state::State;
use serde::Deserialize; use serde::Deserialize;

View File

@ -29,7 +29,7 @@ use bytes::Bytes;
use ansi_term::Colour; use ansi_term::Colour;
use sync::{NetworkConfiguration, validate_node_url, self}; use sync::{NetworkConfiguration, validate_node_url, self};
use ethkey::{Secret, Public}; use ethkey::{Secret, Public};
use ethcore::client::{VMType}; use ethcore::client::VMType;
use ethcore::miner::{stratum, MinerOptions}; use ethcore::miner::{stratum, MinerOptions};
use snapshot::SnapshotConfiguration; use snapshot::SnapshotConfiguration;
use miner::pool; use miner::pool;

View File

@ -21,8 +21,9 @@ use std::fs::File;
use std::collections::HashSet; use std::collections::HashSet;
use ethereum_types::{U256, Address}; use ethereum_types::{U256, Address};
use journaldb::Algorithm; use journaldb::Algorithm;
use ethcore::client::{VMType, DatabaseCompactionProfile, ClientConfig, VerifierType}; use ethcore::client::{VMType, DatabaseCompactionProfile, ClientConfig};
use ethcore::miner::{PendingSet, Penalization}; use ethcore::miner::{PendingSet, Penalization};
use verification::VerifierType;
use miner::pool::PrioritizationStrategy; use miner::pool::PrioritizationStrategy;
use cache::CacheConfig; use cache::CacheConfig;
use dir::DatabaseDirectories; use dir::DatabaseDirectories;