Extract the Engine trait (#10958)
* Add client-traits crate Move the BlockInfo trait to new crate * New crate `machine` Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code. * Use new machine and client-traits crates in ethcore * Use new crates machine and client-traits instead of ethcore where appropriate * Fix tests * Don't re-export so many types from ethcore::client * Fixing more fallout from removing re-export * fix test * More fallout from not re-exporting types * Add some docs * cleanup * import the macro edition style * Tweak docs * Add missing import * remove unused ethabi_derive imports * Use latest ethabi-contract * Move many traits from ethcore/client/traits to client-traits crate Initial version of extracted Engine trait * Move snapshot related traits to the engine crate (eew) * Move a few snapshot related types to common_types Cleanup Executed as exported from machine crate * fix warning * Gradually introduce new engine crate: snapshot * ethcore typechecks with new engine crate * Sort out types outside ethcore * Add an EpochVerifier to ethash and use that in Engine.epoch_verifier() Cleanup * Document pub members * Sort out tests Sort out default impls for EpochVerifier * Add test-helpers feature and move EngineSigner impl to the right place * Sort out tests * Sort out tests and refactor verification types * Fix missing traits * More missing traits Fix Histogram * Fix tests and cleanup * cleanup * Put back needed logger import * Don't rexport common_types from ethcore/src/client Don't export ethcore::client::* * Remove files no longer used Use types from the engine crate Explicit exports from engine::engine * Get rid of itertools * Move a few more traits from ethcore to client-traits: BlockChainReset, ScheduleInfo, StateClient * Move ProvingBlockChainClient to client-traits * Don't re-export ForkChoice and Transition from ethcore * Address grumbles: sort imports, remove commented out code * Fix merge resolution error * merge failure
This commit is contained in:
@@ -26,12 +26,13 @@ use types::{
|
||||
ids::BlockId,
|
||||
transaction::{PendingTransaction, Transaction, Action, Condition},
|
||||
filter::Filter,
|
||||
verification::Unverified,
|
||||
view,
|
||||
views::BlockView,
|
||||
};
|
||||
|
||||
use client::{BlockChainClient, BlockChainReset, Client, ClientConfig, ChainInfo, PrepareOpenBlock, ImportSealedBlock, ImportBlock};
|
||||
use client_traits::BlockInfo;
|
||||
use client::{Client, ClientConfig, PrepareOpenBlock, ImportSealedBlock};
|
||||
use client_traits::{BlockInfo, BlockChainClient, BlockChainReset, ChainInfo, ImportBlock};
|
||||
use crate::spec;
|
||||
use machine::executive::{Executive, TransactOptions};
|
||||
use miner::{Miner, PendingOrdering, MinerService};
|
||||
@@ -41,7 +42,6 @@ use test_helpers::{
|
||||
generate_dummy_client, push_blocks_to_client, get_test_client_with_blocks, get_good_dummy_block_seq,
|
||||
generate_dummy_client_with_data, get_good_dummy_block, get_bad_state_dummy_block
|
||||
};
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
|
||||
#[test]
|
||||
fn imports_from_empty() {
|
||||
@@ -210,7 +210,7 @@ fn can_generate_gas_price_histogram() {
|
||||
let client = generate_dummy_client_with_data(20, 1, slice_into![6354,8593,6065,4842,7845,7002,689,4958,4250,6098,5804,4320,643,8895,2296,8589,7145,2000,2512,1408]);
|
||||
|
||||
let hist = client.gas_price_corpus(20).histogram(5).unwrap();
|
||||
let correct_hist = ::stats::Histogram { bucket_bounds: vec_into![643, 2294, 3945, 5596, 7247, 8898], counts: vec![4,2,4,6,4] };
|
||||
let correct_hist = stats::Histogram { bucket_bounds: vec_into![643, 2294, 3945, 5596, 7247, 8898], counts: vec![4,2,4,6,4] };
|
||||
assert_eq!(hist, correct_hist);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ fn does_not_propagate_delayed_transactions() {
|
||||
|
||||
#[test]
|
||||
fn transaction_proof() {
|
||||
use ::client::ProvingBlockChainClient;
|
||||
use client_traits::ProvingBlockChainClient;
|
||||
|
||||
let client = generate_dummy_client(0);
|
||||
let address = Address::random();
|
||||
|
||||
@@ -22,21 +22,21 @@ use block::*;
|
||||
use ethereum_types::{U256, Address};
|
||||
use io::*;
|
||||
use crate::spec;
|
||||
use client::*;
|
||||
use test_helpers::get_temp_state_db;
|
||||
use client::{BlockChainClient, Client, ClientConfig};
|
||||
use client::{Client, ClientConfig};
|
||||
use client_traits::{BlockChainClient, ImportBlock};
|
||||
use std::sync::Arc;
|
||||
use std::str::FromStr;
|
||||
use miner::Miner;
|
||||
use trace::{RewardType, LocalizedTrace};
|
||||
use trace::trace::Action::Reward;
|
||||
use test_helpers;
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
use types::{
|
||||
ids::BlockId,
|
||||
transaction::{Action, Transaction},
|
||||
trace_filter::Filter as TraceFilter,
|
||||
header::Header,
|
||||
verification::Unverified,
|
||||
view,
|
||||
views::BlockView,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user