Extract Machine from ethcore (#10949)

* 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
This commit is contained in:
David
2019-08-13 12:33:34 +02:00
committed by GitHub
parent 509fda727b
commit 73f4564b66
107 changed files with 1042 additions and 583 deletions

View File

@@ -22,15 +22,18 @@ use ethkey::KeyPair;
use hash::keccak;
use io::IoChannel;
use tempdir::TempDir;
use types::transaction::{PendingTransaction, Transaction, Action, Condition};
use types::filter::Filter;
use types::view;
use types::views::BlockView;
use types::{
ids::BlockId,
transaction::{PendingTransaction, Transaction, Action, Condition},
filter::Filter,
view,
views::BlockView,
};
use client::{BlockChainClient, BlockChainReset, Client, ClientConfig, BlockId, ChainInfo, PrepareOpenBlock, ImportSealedBlock, ImportBlock};
use client::BlockInfo;
use client::{BlockChainClient, BlockChainReset, Client, ClientConfig, ChainInfo, PrepareOpenBlock, ImportSealedBlock, ImportBlock};
use client_traits::BlockInfo;
use crate::spec;
use executive::{Executive, TransactOptions};
use machine::executive::{Executive, TransactOptions};
use miner::{Miner, PendingOrdering, MinerService};
use account_state::{State, CleanupMode, backend};
use test_helpers::{

View File

@@ -20,8 +20,11 @@ use std::sync::Arc;
use hash::keccak;
use vm::{EnvInfo, ActionParams, ActionValue, CallType, ParamsType};
use evm::{Factory, VMType};
use executive::Executive;
use substate::Substate;
use machine::{
executive::Executive,
substate::Substate,
test_helpers::new_eip210_test_machine,
};
use test_helpers::get_temp_state_with_factory;
use trace::{NoopVMTracer, NoopTracer};
use types::transaction::SYSTEM_ADDRESS;
@@ -29,7 +32,6 @@ use types::transaction::SYSTEM_ADDRESS;
use rustc_hex::FromHex;
use ethereum_types::{H256, Address};
use crate::spec;
evm_test!{test_blockhash_eip210: test_blockhash_eip210_int}
fn test_blockhash_eip210(factory: Factory) {
@@ -39,7 +41,7 @@ fn test_blockhash_eip210(factory: Factory) {
let test_blockhash_contract = "73fffffffffffffffffffffffffffffffffffffffe33141561007a57600143036020526000356101006020510755600061010060205107141561005057600035610100610100602051050761010001555b6000620100006020510714156100755760003561010062010000602051050761020001555b61014a565b4360003512151561009057600060405260206040f35b610100600035430312156100b357610100600035075460605260206060f3610149565b62010000600035430312156100d157600061010060003507146100d4565b60005b156100f6576101006101006000350507610100015460805260206080f3610148565b630100000060003543031215610116576000620100006000350714610119565b60005b1561013c57610100620100006000350507610200015460a052602060a0f3610147565b600060c052602060c0f35b5b5b5b5b";
let blockhash_contract_code = Arc::new(test_blockhash_contract.from_hex().unwrap());
let blockhash_contract_code_hash = keccak(blockhash_contract_code.as_ref());
let machine = spec::new_eip210_test_machine();
let machine = new_eip210_test_machine();
let mut env_info = EnvInfo::default();
// populate state with 256 last hashes

View File

@@ -28,14 +28,18 @@ use client::{BlockChainClient, Client, ClientConfig};
use std::sync::Arc;
use std::str::FromStr;
use miner::Miner;
use types::transaction::{Action, Transaction};
use trace::{RewardType, LocalizedTrace};
use trace::trace::Action::Reward;
use test_helpers;
use verification::queue::kind::blocks::Unverified;
use types::header::Header;
use types::view;
use types::views::BlockView;
use types::{
ids::BlockId,
transaction::{Action, Transaction},
trace_filter::Filter as TraceFilter,
header::Header,
view,
views::BlockView,
};
#[test]
fn can_trace_block_and_uncle_reward() {