Extract engines to own crates (#10966)
* 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 * Extract the Clique engine to own crate * Extract NullEngine and the block_reward module from ethcore * Extract InstantSeal engine to own crate * Extract remaining engines * Extract executive_state to own crate so it can be used by engine crates * Remove snapshot stuff from the engine crate * Put snapshot traits back in ethcore * cleanup * Remove stuff from ethcore * Don't use itertools * itertools in aura is legit-ish * More post-merge fixes * Re-export less types in client * cleanup * Update ethcore/block-reward/Cargo.toml Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update ethcore/engines/basic-authority/Cargo.toml Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update ethcore/engines/ethash/Cargo.toml Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update ethcore/engines/clique/src/lib.rs Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * signers is already a ref * Add an EngineType enum to tighten up Engine.name() * Introduce Snapshotting enum to distinguish the type of snapshots a chain uses * Rename supports_warp to snapshot_mode * Missing import * Update ethcore/src/snapshot/consensus/mod.rs Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * remove double-semicolons
This commit is contained in:
@@ -63,7 +63,6 @@ extern crate jsonrpc_pubsub;
|
||||
|
||||
extern crate client_traits;
|
||||
extern crate common_types as types;
|
||||
extern crate engine;
|
||||
extern crate ethash;
|
||||
extern crate ethcore;
|
||||
extern crate fastmap;
|
||||
@@ -105,6 +104,9 @@ extern crate serde_derive;
|
||||
#[cfg(test)]
|
||||
extern crate rand_xorshift;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate engine;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate ethjson;
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -24,9 +24,10 @@ use rlp::Rlp;
|
||||
use ethereum_types::{Address, H64, H160, H256, U64, U256, BigEndianHash};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use account_state::state::StateInfo;
|
||||
use client_traits::{BlockChainClient, StateClient, ProvingBlockChainClient, StateOrBlock};
|
||||
use ethash::{self, SeedHashCompute};
|
||||
use ethcore::client::{StateInfo, Call, EngineInfo};
|
||||
use ethcore::client::{Call, EngineInfo};
|
||||
use ethcore::miner::{self, MinerService};
|
||||
use ethcore::snapshot::SnapshotService;
|
||||
use hash::keccak;
|
||||
@@ -37,7 +38,8 @@ use types::{
|
||||
encoded,
|
||||
ids::{BlockId, TransactionId, UncleId},
|
||||
filter::Filter as EthcoreFilter,
|
||||
transaction::{SignedTransaction, LocalizedTransaction}
|
||||
transaction::{SignedTransaction, LocalizedTransaction},
|
||||
snapshot::RestorationStatus,
|
||||
};
|
||||
|
||||
use jsonrpc_core::{BoxFuture, Result};
|
||||
@@ -518,8 +520,6 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
|
||||
}
|
||||
|
||||
fn syncing(&self) -> Result<SyncStatus> {
|
||||
use ethcore::snapshot::RestorationStatus;
|
||||
|
||||
let status = self.sync.status();
|
||||
let client = &self.client;
|
||||
let snapshot_status = self.snapshot.status();
|
||||
|
||||
@@ -23,7 +23,7 @@ use ethereum_types::{H64, H160, H256, H512, U64, U256};
|
||||
use ethcore::client::Call;
|
||||
use client_traits::{BlockChainClient, StateClient};
|
||||
use ethcore::miner::{self, MinerService, FilterOptions};
|
||||
use ethcore::snapshot::{SnapshotService, RestorationStatus};
|
||||
use ethcore::snapshot::SnapshotService;
|
||||
use account_state::state::StateInfo;
|
||||
use ethcore_logger::RotatingLogger;
|
||||
use ethkey::{crypto::ecies, Brain, Generator};
|
||||
@@ -34,6 +34,7 @@ use sync::{SyncProvider, ManageNetwork};
|
||||
use types::{
|
||||
ids::BlockId,
|
||||
verification::Unverified,
|
||||
snapshot::RestorationStatus,
|
||||
};
|
||||
use updater::{Service as UpdateService};
|
||||
use version::version_data;
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use ethcore::client::{StateInfo, Call};
|
||||
use account_state::state::StateInfo;
|
||||
use ethcore::client::Call;
|
||||
use client_traits::{BlockChainClient, StateClient};
|
||||
use ethereum_types::H256;
|
||||
use rlp::Rlp;
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use ethcore::snapshot::{ManifestData, RestorationStatus, SnapshotService};
|
||||
use ethcore::snapshot::SnapshotService;
|
||||
|
||||
use bytes::Bytes;
|
||||
use ethereum_types::H256;
|
||||
use parking_lot::Mutex;
|
||||
use types::snapshot::{ManifestData, RestorationStatus};
|
||||
|
||||
/// Mocked snapshot service (used for sync info extensions).
|
||||
pub struct TestSnapshotService {
|
||||
@@ -48,8 +49,8 @@ impl SnapshotService for TestSnapshotService {
|
||||
fn status(&self) -> RestorationStatus { self.status.lock().clone() }
|
||||
fn begin_restore(&self, _manifest: ManifestData) { }
|
||||
fn abort_restore(&self) { }
|
||||
fn abort_snapshot(&self) {}
|
||||
fn restore_state_chunk(&self, _hash: H256, _chunk: Bytes) { }
|
||||
fn restore_block_chunk(&self, _hash: H256, _chunk: Bytes) { }
|
||||
fn abort_snapshot(&self) {}
|
||||
fn shutdown(&self) { }
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ use types::{
|
||||
transaction::{Transaction, Action},
|
||||
log_entry::{LocalizedLogEntry, LogEntry},
|
||||
receipt::{LocalizedReceipt, TransactionOutcome},
|
||||
snapshot::RestorationStatus,
|
||||
};
|
||||
|
||||
use jsonrpc_core::IoHandler;
|
||||
@@ -131,8 +132,6 @@ fn rpc_eth_protocol_version() {
|
||||
|
||||
#[test]
|
||||
fn rpc_eth_syncing() {
|
||||
use ethcore::snapshot::RestorationStatus;
|
||||
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "eth_syncing", "params": [], "id": 1}"#;
|
||||
|
||||
let tester = EthTester::default();
|
||||
|
||||
Reference in New Issue
Block a user