[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;
// 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");

View File

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

View File

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

View File

@ -16,14 +16,13 @@
use std::str::FromStr;
use verification::{VerifierType, QueueConfig};
use blockchain::Config as BlockChainConfig;
use journaldb;
use snapshot::SnapshotConfiguration;
use trace::Config as TraceConfig;
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;
/// Client state db compaction profile

View File

@ -20,22 +20,21 @@ mod ancient_import;
mod bad_blocks;
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, BlockChainConfig, 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::config::{ClientConfig, DatabaseCompactionProfile, VMType};
pub use self::traits::{
ReopenBlock, PrepareOpenBlock, ImportSealedBlock, BroadcastProposalBlock,
Call, EngineInfo, BlockProducer, SealedBlockImporter,
};
pub use verification::VerifierType;
mod traits;
#[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};

View File

@ -123,6 +123,3 @@ mod tests;
pub mod json_tests;
#[cfg(any(test, feature = "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 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 {
let mut rlp = RlpStream::new_list(3);

View File

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

View File

@ -26,9 +26,8 @@ use client_traits::BlockChainClient;
use engine::signer;
use ethcore::{
client::Client,
CreateContractAddress,
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 ethkey::KeyPair;
@ -176,8 +175,10 @@ fn sync_private_state() {
let mut net = TestNet::with_spec(2, SyncConfig::default(), seal_spec);
let client0 = net.peer(0).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_handler1: Arc<IoHandler<ClientIoMessage<Client>>> = Arc::new(TestIoHandler::new(net.peer(1).chain.clone()));
let io_handler0: Arc<dyn IoHandler<ClientIoMessage<Client>>> =
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(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 ethcore::{
client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess},
TrieSpec,
test_helpers::TrieSpec,
};
use ethereum_types::{H256, U256};
use ethjson;

View File

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

View File

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

View File

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