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

@@ -25,9 +25,10 @@ use ethereum_types::H256;
use rlp::{self, Rlp};
use types::{
BlockNumber,
block_status::BlockStatus,
ids::BlockId,
errors::{EthcoreError, BlockError, ImportError},
};
use ethcore::client::{BlockStatus, BlockId};
use sync_io::SyncIo;
use blocks::{BlockCollection, SyncBody, SyncHeader};
use chain::BlockSet;

View File

@@ -541,8 +541,11 @@ impl BlockCollection {
#[cfg(test)]
mod test {
use super::{BlockCollection, SyncHeader};
use ethcore::client::{TestBlockChainClient, EachBlockWith, BlockId, BlockChainClient};
use types::BlockNumber;
use ethcore::client::{TestBlockChainClient, EachBlockWith, BlockChainClient};
use types::{
ids::BlockId,
BlockNumber
};
use ethcore::verification::queue::kind::blocks::Unverified;
use rlp::*;

View File

@@ -108,7 +108,7 @@ use bytes::Bytes;
use rlp::{RlpStream, DecoderError};
use network::{self, PeerId, PacketId};
use network::client_version::ClientVersion;
use ethcore::client::{BlockChainClient, BlockStatus, BlockId, BlockChainInfo, BlockQueueInfo};
use ethcore::client::{BlockChainClient, BlockStatus, BlockChainInfo, BlockQueueInfo};
use ethcore::snapshot::RestorationStatus;
use sync_io::SyncIo;
use super::{WarpSync, SyncConfig};
@@ -118,8 +118,11 @@ use snapshot::{Snapshot};
use api::{EthProtocolInfo as PeerInfoDigest, WARP_SYNC_PROTOCOL_ID, PriorityTask};
use private_tx::PrivateTxHandler;
use transactions_stats::{TransactionsStats, Stats as TransactionStats};
use types::transaction::UnverifiedTransaction;
use types::BlockNumber;
use types::{
BlockNumber,
ids::BlockId,
transaction::UnverifiedTransaction
};
use self::handler::SyncHandler;
use self::sync_packet::{PacketInfo, SyncPacket};
@@ -1370,7 +1373,8 @@ pub mod tests {
use super::*;
use ::SyncConfig;
use super::{PeerInfo, PeerAsking};
use ethcore::client::{BlockChainClient, EachBlockWith, TestBlockChainClient, ChainInfo, BlockInfo};
use ethcore::client::{BlockChainClient, EachBlockWith, TestBlockChainClient, ChainInfo};
use client_traits::BlockInfo;
use ethcore::miner::{MinerService, PendingOrdering};
use types::header::Header;

View File

@@ -335,12 +335,15 @@ impl SyncPropagator {
#[cfg(test)]
mod tests {
use ethcore::client::{BlockInfo, ChainInfo, EachBlockWith, TestBlockChainClient};
use ethcore::client::{ChainInfo, EachBlockWith, TestBlockChainClient};
use client_traits::BlockInfo;
use parking_lot::RwLock;
use rlp::{Rlp};
use std::collections::{VecDeque};
use tests::helpers::{TestIo};
use tests::snapshot::TestSnapshotService;
use rlp::Rlp;
use std::collections::VecDeque;
use tests::{
helpers::TestIo,
snapshot::TestSnapshotService,
};
use super::{*, super::{*, tests::*}};

View File

@@ -46,6 +46,8 @@ extern crate ethcore_light as light;
#[cfg(test)] extern crate kvdb_memorydb;
#[cfg(test)] extern crate rustc_hex;
#[cfg(test)] extern crate rand_xorshift;
#[cfg(test)] extern crate client_traits;
#[cfg(test)] extern crate machine;
#[macro_use]
extern crate enum_primitive;

View File

@@ -16,7 +16,9 @@
use tests::helpers::TestNet;
use ethcore::client::{BlockInfo, BlockId, EachBlockWith};
use ethcore::client::EachBlockWith;
use client_traits::BlockInfo;
use types::ids::BlockId;
mod test_net;

View File

@@ -15,8 +15,10 @@
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
use std::sync::Arc;
use ethcore::client::{TestBlockChainClient, BlockChainClient, BlockId, EachBlockWith, ChainInfo, BlockInfo};
use chain::{SyncState};
use types::ids::BlockId;
use ethcore::client::{TestBlockChainClient, BlockChainClient, EachBlockWith, ChainInfo};
use client_traits::BlockInfo;
use chain::SyncState;
use super::helpers::*;
use {SyncConfig, WarpSync};
use ethcore::spec;

View File

@@ -19,15 +19,17 @@ use hash::keccak;
use io::{IoHandler, IoChannel};
use types::transaction::{Transaction, Action};
use types::ids::BlockId;
use ethcore::CreateContractAddress;
use ethcore::client::{ClientIoMessage, BlockChainClient};
use ethcore::executive::contract_address;
use ethcore::engines;
use ethcore::miner::{self, MinerService};
use ethcore::spec::Spec;
use ethcore::test_helpers::{push_block_with_transactions};
use ethcore::{
CreateContractAddress,
client::{ClientIoMessage, BlockChainClient},
engines,
miner::{self, MinerService},
spec::Spec,
test_helpers::push_block_with_transactions,
};
use ethcore_private_tx::{Provider, ProviderConfig, NoopEncryptor, Importer, SignedPrivateTransaction, StoringKeyProvider};
use ethkey::KeyPair;
use machine::executive::contract_address;
use tests::helpers::{TestNet, TestIoHandler};
use rustc_hex::FromHex;
use rlp::Rlp;