Extract spec to own crate (#10978)
* 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 * Extract spec to own crate * Put back the test-helpers from basic-authority * Fix ethcore benchmarks * Reduce the public api of ethcore/verification * 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> * missing import * Fix import * double semi
This commit is contained in:
@@ -34,6 +34,7 @@ accounts = { package = "ethcore-accounts", path = "../../../accounts" }
|
||||
engine = { path = "../../engine", features = ["test-helpers"] }
|
||||
env_logger = "0.6.2"
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
spec = { path = "../../spec" }
|
||||
state-db = { path = "../../state-db" }
|
||||
validator-set = { path = "../validator-set", features = ["test-helpers"] }
|
||||
serde_json = "1"
|
||||
|
||||
@@ -1683,12 +1683,12 @@ mod tests {
|
||||
generate_dummy_client_with_spec, get_temp_state_db,
|
||||
TestNotify
|
||||
},
|
||||
spec::{self, Spec},
|
||||
};
|
||||
use engine::Engine;
|
||||
use block_reward::BlockRewardContract;
|
||||
use validator_set::{TestSet, SimpleList};
|
||||
use machine::Machine;
|
||||
use spec::{self, Spec};
|
||||
use validator_set::{TestSet, SimpleList};
|
||||
use ethjson;
|
||||
use serde_json;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ engine = { path = "../../engine", features = ["test-helpers"] }
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
keccak-hash = "0.2.0"
|
||||
tempdir = "0.3"
|
||||
spec = { path = "../../spec" }
|
||||
|
||||
[features]
|
||||
test-helpers = []
|
||||
|
||||
@@ -222,7 +222,6 @@ mod tests {
|
||||
use ethereum_types::H520;
|
||||
use ethcore::{
|
||||
block::*,
|
||||
spec,
|
||||
test_helpers::get_temp_state_db
|
||||
};
|
||||
use accounts::AccountProvider;
|
||||
|
||||
@@ -27,4 +27,5 @@ unexpected = { path = "../../../util/unexpected" }
|
||||
|
||||
[dev-dependencies]
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
spec = { path = "../../spec" }
|
||||
state-db = { path = "../../state-db" }
|
||||
|
||||
@@ -240,8 +240,6 @@ impl Clique {
|
||||
/// Note we need to `mock` the miner and it is introduced to test block verification to trigger new blocks
|
||||
/// to mainly test consensus edge cases
|
||||
pub fn with_test(epoch_length: u64, period: u64) -> Self {
|
||||
use ethcore::spec;
|
||||
|
||||
Self {
|
||||
epoch_length,
|
||||
period,
|
||||
|
||||
@@ -23,4 +23,5 @@ unexpected = { path = "../../../util/unexpected" }
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
keccak-hash = "0.2.0"
|
||||
rlp = "0.4.2"
|
||||
spec = { path = "../../spec" }
|
||||
tempdir = "0.3"
|
||||
|
||||
@@ -25,6 +25,7 @@ use common_types::{
|
||||
header::Header,
|
||||
engines::{
|
||||
EthashSeal,
|
||||
OptimizeFor,
|
||||
params::CommonParams,
|
||||
},
|
||||
errors::{BlockError, EthcoreError as Error},
|
||||
@@ -33,7 +34,7 @@ use common_types::{
|
||||
use engine::Engine;
|
||||
use ethereum_types::{H256, U256};
|
||||
use ethjson;
|
||||
use ethash::{self, quick_get_difficulty, slow_hash_block_number, EthashManager, OptimizeFor};
|
||||
use ethash::{self, quick_get_difficulty, slow_hash_block_number, EthashManager};
|
||||
use keccak_hash::{KECCAK_EMPTY_LIST_RLP};
|
||||
use log::trace;
|
||||
use macros::map;
|
||||
@@ -493,9 +494,9 @@ mod tests {
|
||||
use ethcore::{
|
||||
block::*,
|
||||
test_helpers::get_temp_state_db,
|
||||
spec::{new_morden, new_mcip3_test, new_homestead_test_machine, Spec},
|
||||
};
|
||||
use rlp;
|
||||
use spec::{new_morden, new_mcip3_test, new_homestead_test_machine, Spec};
|
||||
use tempdir::TempDir;
|
||||
|
||||
use super::{Ethash, EthashParams, ecip1017_eras_block_reward};
|
||||
|
||||
@@ -17,4 +17,5 @@ trace = { path = "../../trace" }
|
||||
|
||||
[dev-dependencies]
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
spec = { path = "../../spec" }
|
||||
rlp = "0.4.2"
|
||||
|
||||
@@ -114,9 +114,9 @@ mod tests {
|
||||
use ethereum_types::{H520, Address};
|
||||
use ethcore::{
|
||||
test_helpers::get_temp_state_db,
|
||||
spec,
|
||||
block::*,
|
||||
};
|
||||
use spec;
|
||||
|
||||
#[test]
|
||||
fn instant_can_seal() {
|
||||
|
||||
@@ -11,8 +11,8 @@ client-traits = { path = "../../client-traits" }
|
||||
common-types = { path = "../../types" }
|
||||
engine = { path = "../../engine" }
|
||||
ethabi = "8.0.1"
|
||||
ethabi-derive = "8.0.0"
|
||||
ethabi-contract = "8.0.1"
|
||||
ethabi-derive = "8.0.0"
|
||||
ethereum-types = "0.6.0"
|
||||
ethjson = { path = "../../../json" }
|
||||
executive-state = { path = "../../executive-state" }
|
||||
@@ -32,13 +32,14 @@ vm = { path = "../../vm" }
|
||||
|
||||
[dev-dependencies]
|
||||
accounts = { package = "ethcore-accounts", path = "../../../accounts" }
|
||||
engine = { path = "../../engine", features = ["test-helpers"] }
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
keccak-hash = "0.2.0"
|
||||
ethkey = { path = "../../../accounts/ethkey" }
|
||||
rustc-hex = "1.0"
|
||||
call-contract = { package = "ethcore-call-contract", path = "../../call-contract" }
|
||||
engine = { path = "../../engine", features = ["test-helpers"] }
|
||||
env_logger = "0.6.2"
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
ethkey = { path = "../../../accounts/ethkey" }
|
||||
keccak-hash = "0.2.0"
|
||||
rustc-hex = "1.0"
|
||||
spec = { path = "../../spec" }
|
||||
|
||||
[features]
|
||||
test-helpers = []
|
||||
|
||||
@@ -146,10 +146,12 @@ impl ValidatorSet for ValidatorContract {
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use accounts::AccountProvider;
|
||||
use call_contract::CallContract;
|
||||
use common_types::{header::Header, ids::BlockId};
|
||||
use client_traits::{BlockChainClient, ChainInfo, BlockInfo};
|
||||
use ethcore::{
|
||||
miner::{self, MinerService},
|
||||
spec,
|
||||
test_helpers::generate_dummy_client_with_spec,
|
||||
};
|
||||
use ethereum_types::{H520, Address};
|
||||
@@ -157,9 +159,7 @@ mod tests {
|
||||
use parity_bytes::ToPretty;
|
||||
use rlp::encode;
|
||||
use rustc_hex::FromHex;
|
||||
use accounts::AccountProvider;
|
||||
use call_contract::CallContract;
|
||||
use client_traits::{BlockChainClient, ChainInfo, BlockInfo};
|
||||
use spec;
|
||||
|
||||
use super::super::ValidatorSet;
|
||||
use super::ValidatorContract;
|
||||
|
||||
@@ -156,22 +156,21 @@ mod tests {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use accounts::AccountProvider;
|
||||
use client_traits::{BlockChainClient, BlockInfo, ChainInfo, ImportBlock, EngineClient};
|
||||
use common_types::{
|
||||
header::Header,
|
||||
ids::BlockId,
|
||||
verification::Unverified,
|
||||
};
|
||||
use client_traits::{BlockChainClient, BlockInfo, ChainInfo, ImportBlock, EngineClient};
|
||||
use engine::EpochChange;
|
||||
|
||||
use ethkey::Secret;
|
||||
use ethcore::{
|
||||
miner::{self, MinerService},
|
||||
test_helpers::{generate_dummy_client_with_spec, generate_dummy_client_with_spec_and_data},
|
||||
spec,
|
||||
};
|
||||
use ethereum_types::Address;
|
||||
use ethkey::Secret;
|
||||
use keccak_hash::keccak;
|
||||
use spec;
|
||||
|
||||
use crate::ValidatorSet;
|
||||
use super::Multi;
|
||||
|
||||
@@ -251,7 +251,7 @@ impl ValidatorSafeContract {
|
||||
|
||||
LogEntry {
|
||||
address: self.contract_address,
|
||||
topics: topics,
|
||||
topics,
|
||||
data: Vec::new(), // irrelevant for bloom.
|
||||
}.bloom()
|
||||
}
|
||||
@@ -467,7 +467,6 @@ mod tests {
|
||||
use client_traits::{BlockInfo, ChainInfo, ImportBlock, EngineClient};
|
||||
use engine::{EpochChange, Proof};
|
||||
use ethcore::{
|
||||
spec,
|
||||
miner::{self, MinerService},
|
||||
test_helpers::{generate_dummy_client_with_spec, generate_dummy_client_with_spec_and_data}
|
||||
};
|
||||
@@ -475,6 +474,7 @@ mod tests {
|
||||
use ethereum_types::Address;
|
||||
use keccak_hash::keccak;
|
||||
use rustc_hex::FromHex;
|
||||
use spec;
|
||||
|
||||
use super::super::ValidatorSet;
|
||||
use super::{ValidatorSafeContract, EVENT_NAME_HASH};
|
||||
|
||||
Reference in New Issue
Block a user