Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

[ethcore]: reduce re-exports #11059

Merged
merged 2 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ethcore/private-tx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
4 changes: 1 addition & 3 deletions ethcore/private-tx/tests/private_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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> {
Expand Down
8 changes: 4 additions & 4 deletions ethcore/src/client/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

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::QueueConfig;

pub use std::time::Duration;
pub use blockchain::Config as BlockChainConfig;
pub use trace::Config as TraceConfig;
pub use evm::VMType;
pub use verification::VerifierType;

/// Client state db compaction profile
#[derive(Debug, PartialEq, Clone)]
Expand Down
15 changes: 7 additions & 8 deletions ethcore/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 0 additions & 3 deletions ethcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
5 changes: 5 additions & 0 deletions ethcore/src/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ethcore/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rand = "0.6"
rlp = "0.4.0"
snapshot = { path = "../snapshot" }
trace-time = "0.1"
triehash-ethereum = {version = "0.2", path = "../../util/triehash-ethereum" }
triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" }

[dev-dependencies]
env_logger = "0.5"
Expand Down
3 changes: 1 addition & 2 deletions ethcore/sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions ethcore/sync/src/tests/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())));
Expand Down
2 changes: 1 addition & 1 deletion evmbin/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions evmbin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion parity/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion parity/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down