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:
David 2019-08-23 15:32:58 +02:00 committed by Wei Tang
parent 79b671f6c7
commit fbf425c4e2
80 changed files with 341 additions and 204 deletions

59
Cargo.lock generated
View File

@ -187,6 +187,7 @@ dependencies = [
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"state-db 0.1.0",
"time-utils 0.1.0",
"unexpected 0.1.0",
@ -258,6 +259,7 @@ dependencies = [
"machine 0.1.0",
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"validator-set 0.1.0",
]
@ -362,6 +364,7 @@ dependencies = [
"ethereum-types 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"machine 0.1.0",
"spec 0.1.0",
"trace 0.1.0",
]
@ -521,6 +524,7 @@ dependencies = [
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"state-db 0.1.0",
"time-utils 0.1.0",
"unexpected 0.1.0",
@ -955,6 +959,7 @@ dependencies = [
name = "ethash"
version = "1.12.0"
dependencies = [
"common-types 0.1.0",
"criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -986,6 +991,7 @@ dependencies = [
"machine 0.1.0",
"macros 0.1.0",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"unexpected 0.1.0",
]
@ -1009,11 +1015,9 @@ dependencies = [
"account-db 0.1.0",
"account-state 0.1.0",
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"authority-round 0.1.0",
"basic-authority 0.1.0",
"blooms-db 0.1.0",
"client-traits 0.1.0",
"clique 0.1.0",
"common-types 0.1.0",
"criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1023,7 +1027,6 @@ dependencies = [
"ethabi-contract 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ethabi-derive 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.12.0",
"ethash-engine 0.1.0",
"ethcore-accounts 0.1.0",
"ethcore-blockchain 0.1.0",
"ethcore-bloom-journal 0.1.0",
@ -1041,7 +1044,6 @@ dependencies = [
"fetch 0.1.0",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"instant-seal 0.1.0",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"journaldb 0.2.0",
"keccak-hash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1074,6 +1076,7 @@ dependencies = [
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"state-db 0.1.0",
"stats 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1237,6 +1240,7 @@ dependencies = [
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"stats 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"trie-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1390,6 +1394,7 @@ dependencies = [
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"state-db 0.1.0",
"time-utils 0.1.0",
"tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1457,6 +1462,7 @@ dependencies = [
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb-rocksdb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"trace-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1512,6 +1518,7 @@ dependencies = [
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"trace-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"triehash-ethereum 0.2.0",
]
@ -1653,6 +1660,7 @@ dependencies = [
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"trace 0.1.0",
"vm 0.1.0",
@ -1680,6 +1688,7 @@ dependencies = [
"patricia-trie-ethereum 0.1.0",
"pod 0.1.0",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"trace 0.1.0",
"trie-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"trie-vm-factories 0.1.0",
@ -2102,6 +2111,7 @@ dependencies = [
"keccak-hash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"machine 0.1.0",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"trace 0.1.0",
]
@ -2519,6 +2529,7 @@ dependencies = [
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"state-db 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"trace 0.1.0",
@ -2750,6 +2761,7 @@ dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -3004,6 +3016,7 @@ dependencies = [
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3150,6 +3163,7 @@ dependencies = [
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"stats 0.1.0",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -4153,6 +4167,42 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "spec"
version = "0.1.0"
dependencies = [
"account-state 0.1.0",
"authority-round 0.1.0",
"basic-authority 0.1.0",
"clique 0.1.0",
"common-types 0.1.0",
"engine 0.1.0",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.12.0",
"ethash-engine 0.1.0",
"ethcore 1.12.0",
"ethcore-builtin 0.1.0",
"ethereum-types 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethjson 0.1.0",
"evm 0.1.0",
"executive-state 0.1.0",
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"instant-seal 0.1.0",
"journaldb 0.2.0",
"keccak-hash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"machine 0.1.0",
"null-engine 0.1.0",
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pod 0.1.0",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"trace 0.1.0",
"trie-vm-factories 0.1.0",
"vm 0.1.0",
]
[[package]]
name = "spin"
version = "0.5.0"
@ -4863,6 +4913,7 @@ dependencies = [
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spec 0.1.0",
"triehash-ethereum 0.2.0",
"unexpected 0.1.0",
"vm 0.1.0",

View File

@ -7,32 +7,16 @@ license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
blooms-db = { path = "util/blooms-db" }
log = "0.4"
rustc-hex = "1.0"
docopt = "1.0"
clap = "2"
term_size = "0.3"
textwrap = "0.9"
num_cpus = "1.2"
number_prefix = "0.2"
rpassword = "1.0"
semver = "0.9"
ansi_term = "0.11"
parking_lot = "0.8"
regex = "1.0"
atty = "0.2.8"
toml = "0.4"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
futures = "0.1"
fdlimit = "0.1"
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
jsonrpc-core = "12.0.0"
parity-bytes = "0.1"
blooms-db = { path = "util/blooms-db" }
clap = "2"
cli-signer= { path = "cli-signer" }
client-traits = { path = "ethcore/client-traits" }
common-types = { path = "ethcore/types" }
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
dir = { path = "util/dir" }
docopt = "1.0"
engine = { path = "ethcore/engine" }
ethcore = { path = "ethcore", features = ["parity"] }
ethcore-accounts = { path = "accounts", optional = true }
@ -45,36 +29,50 @@ ethcore-logger = { path = "parity/logger" }
ethcore-miner = { path = "miner" }
ethcore-network = { path = "util/network" }
ethcore-private-tx = { path = "ethcore/private-tx" }
ethcore-secretstore = { path = "secret-store", optional = true }
ethcore-service = { path = "ethcore/service" }
ethcore-sync = { path = "ethcore/sync" }
ethereum-types = "0.6.0"
ethkey = { path = "accounts/ethkey" }
ethstore = { path = "accounts/ethstore" }
fdlimit = "0.1"
futures = "0.1"
journaldb = { path = "util/journaldb" }
jsonrpc-core = "12.0.0"
keccak-hash = "0.2.0"
kvdb = "0.1"
kvdb-rocksdb = "0.1.3"
log = "0.4"
migration-rocksdb = { path = "util/migration-rocksdb" }
node-filter = { path = "ethcore/node-filter" }
rlp = "0.4.0"
cli-signer= { path = "cli-signer" }
num_cpus = "1.2"
number_prefix = "0.2"
panic_hook = { path = "util/panic-hook" }
parity-bytes = "0.1"
parity-daemonize = "0.3"
parity-hash-fetch = { path = "updater/hash-fetch" }
parity-ipfs-api = { path = "ipfs" }
parity-local-store = { path = "miner/local-store" }
parity-runtime = { path = "util/runtime" }
parity-rpc = { path = "rpc" }
parity-updater = { path = "updater" }
parity-version = { path = "util/version" }
parity-path = "0.1"
dir = { path = "util/dir" }
panic_hook = { path = "util/panic-hook" }
keccak-hash = "0.2.0"
migration-rocksdb = { path = "util/migration-rocksdb" }
kvdb = "0.1"
kvdb-rocksdb = "0.1.3"
journaldb = { path = "util/journaldb" }
ethcore-secretstore = { path = "secret-store", optional = true }
registrar = { path = "util/registrar" }
parity-rpc = { path = "rpc" }
parity-runtime = { path = "util/runtime" }
parity-updater = { path = "updater" }
parity-util-mem = { version = "0.2.0", features = ["jemalloc-global"] }
parity-version = { path = "util/version" }
parking_lot = "0.8"
regex = "1.0"
registrar = { path = "util/registrar" }
rlp = "0.4.0"
rpassword = "1.0"
rustc-hex = "1.0"
semver = "0.9"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
spec = { path = "ethcore/spec" }
term_size = "0.3"
textwrap = "0.9"
toml = "0.4"
[build-dependencies]
rustc_version = "0.2"

View File

@ -5,6 +5,7 @@ version = "1.12.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
common-types = { path = "../ethcore/types" }
crunchy = "0.1.0"
either = "1.0.0"
ethereum-types = "0.6.0"

View File

@ -17,9 +17,11 @@
#[macro_use]
extern crate criterion;
extern crate ethash;
extern crate common_types;
use criterion::Criterion;
use ethash::{NodeCacheBuilder, OptimizeFor};
use ethash::NodeCacheBuilder;
use common_types::engines::OptimizeFor;
const HASH: [u8; 32] = [
0xf5, 0x7e, 0x6f, 0x3a, 0xcf, 0xc0, 0xdd, 0x4b,

View File

@ -3,14 +3,16 @@ extern crate criterion;
extern crate ethash;
extern crate rustc_hex;
extern crate tempdir;
extern crate common_types;
use criterion::Criterion;
use ethash::progpow;
use tempdir::TempDir;
use rustc_hex::FromHex;
use ethash::{NodeCacheBuilder, OptimizeFor};
use ethash::NodeCacheBuilder;
use ethash::compute::light_compute;
use common_types::engines::OptimizeFor;
fn bench_hashimoto_light(c: &mut Criterion) {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());

View File

@ -30,20 +30,10 @@ use std::path::{Path, PathBuf};
use std::slice;
use std::sync::Arc;
use common_types::engines::OptimizeFor;
type Cache = Either<Vec<Node>, MmapMut>;
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub enum OptimizeFor {
Cpu,
Memory,
}
impl Default for OptimizeFor {
fn default() -> Self {
OptimizeFor::Cpu
}
}
fn byte_size(cache: &Cache) -> usize {
use self::Either::{Left, Right};

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
extern crate common_types;
extern crate either;
extern crate ethereum_types;
extern crate memmap;
@ -51,14 +52,17 @@ pub mod progpow;
#[cfg(not(feature = "bench"))]
mod progpow;
pub use cache::{NodeCacheBuilder, OptimizeFor};
pub use cache::NodeCacheBuilder;
pub use compute::{ProofOfWork, quick_get_difficulty, slow_hash_block_number};
pub use seed_compute::SeedHashCompute;
pub use shared::ETHASH_EPOCH_LENGTH;
use common_types::engines::OptimizeFor;
use compute::Light;
use ethereum_types::{BigEndianHash, U256, U512};
use keccak::H256;
use parking_lot::Mutex;
pub use seed_compute::SeedHashCompute;
pub use shared::ETHASH_EPOCH_LENGTH;
use std::mem;
use std::path::{Path, PathBuf};
use std::convert::TryFrom;

View File

@ -419,7 +419,8 @@ pub fn generate_cdag(cache: &[Node]) -> CDag {
mod test {
use tempdir::TempDir;
use cache::{NodeCacheBuilder, OptimizeFor};
use common_types::engines::OptimizeFor;
use cache::NodeCacheBuilder;
use keccak::H256;
use rustc_hex::FromHex;
use serde_json::{self, Value};

View File

@ -9,12 +9,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
account-db = { path = "account-db" }
account-state = { path = "account-state" }
authority-round = { path = "./engines/authority-round" }
ansi_term = "0.11"
basic-authority = { path = "./engines/basic-authority" }
basic-authority = { path = "./engines/basic-authority", optional = true} # used by test-helpers feature
blooms-db = { path = "../util/blooms-db", optional = true }
client-traits = { path = "./client-traits" }
clique = { path = "./engines/clique" }
common-types = { path = "types" }
crossbeam-utils = "0.6"
engine = { path = "./engine" }
@ -22,25 +20,22 @@ env_logger = { version = "0.5", optional = true }
ethabi = "8.0"
ethabi-contract = "8.0"
ethabi-derive = "8.0"
ethash = { path = "../ethash" }
ethash-engine = { path = "./engines/ethash" }
ethash = { path = "../ethash", optional = true }
ethjson = { path = "../json", optional = true }
ethkey = { path = "../accounts/ethkey", optional = true }
ethcore-blockchain = { path = "./blockchain" }
ethcore-bloom-journal = { path = "../util/bloom" }
ethcore-builtin = { path = "./builtin" }
ethcore-call-contract = { path = "./call-contract" }
ethcore-db = { path = "./db" }
ethcore-io = { path = "../util/io" }
ethcore-miner = { path = "../miner" }
ethcore-stratum = { path = "../miner/stratum", optional = true }
ethereum-types = "0.6.0"
ethjson = { path = "../json" }
ethkey = { path = "../accounts/ethkey" }
evm = { path = "evm" }
executive-state = { path = "executive-state" }
futures = "0.1"
hash-db = "0.15.0"
parity-util-mem = "0.2.0"
instant-seal = { path = "./engines/instant-seal" }
itertools = "0.5"
journaldb = { path = "../util/journaldb" }
keccak-hash = "0.2.0"
@ -54,14 +49,13 @@ log = "0.4"
macros = { path = "../util/macros", optional = true }
machine = { path = "./machine" }
memory-cache = { path = "../util/memory-cache" }
null-engine = { path = "./engines/null-engine" }
num_cpus = "1.2"
parity-bytes = "0.1"
parity-snappy = "0.1"
parking_lot = "0.8"
pod = { path = "pod", optional = true }
trie-db = "0.15.0"
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
pod = { path = "pod" }
rand = "0.6"
rand_xorshift = "0.1.1"
rayon = "1.1"
@ -70,6 +64,7 @@ rlp_derive = { path = "../util/rlp-derive" }
rustc-hex = "1.0"
serde = "1.0"
serde_derive = "1.0"
spec = { path = "spec" }
state-db = { path = "state-db" }
stats = { path = "../util/stats" }
tempdir = { version = "0.3", optional = true }
@ -84,15 +79,21 @@ vm = { path = "vm" }
[dev-dependencies]
blooms-db = { path = "../util/blooms-db" }
ethcore-builtin = { path = "./builtin" }
criterion = "0.2"
engine = { path = "./engine", features = ["test-helpers"] }
env_logger = "0.5"
ethash = { path = "../ethash" }
ethcore-accounts = { path = "../accounts" }
ethjson = { path = "../json" }
ethkey = { path = "../accounts/ethkey" }
fetch = { path = "../util/fetch" }
kvdb-rocksdb = "0.1.3"
machine = { path = "./machine", features = ["test-helpers"] }
macros = { path = "../util/macros" }
null-engine = { path = "./engines/null-engine" }
parity-runtime = { path = "../util/runtime" }
pod = { path = "pod" }
rlp_compress = { path = "../util/rlp-compress" }
serde_json = "1.0"
tempdir = "0.3"
@ -126,7 +127,8 @@ ci-skip-tests = []
# Run memory/cpu heavy tests.
test-heavy = []
# Compile test helpers
test-helpers = ["tempdir", "kvdb-rocksdb", "blooms-db", "macros", "basic-authority/test-helpers"]
# note[dvdplm]: "basic-authority/test-helpers" is needed so that `generate_dummy_client_with_spec` works
test-helpers = ["tempdir", "kvdb-rocksdb", "blooms-db", "ethash", "ethjson", "ethkey", "macros", "pod", "basic-authority/test-helpers"]
[[bench]]
name = "builtin"

View File

@ -19,3 +19,4 @@ trace = { path = "../trace" }
[dev-dependencies]
ethcore = { path = "..", features = ["test-helpers"] }
spec = { path = "../spec" }

View File

@ -164,11 +164,12 @@ mod test {
use std::str::FromStr;
use ethcore::{
client::PrepareOpenBlock,
spec,
test_helpers::generate_dummy_client_with_spec,
};
use ethereum_types::{U256, Address};
use engine::SystemOrCodeCallKind;
use spec;
use crate::{BlockRewardContract, RewardKind};
#[test]

View File

@ -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"

View File

@ -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;

View File

@ -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 = []

View File

@ -222,7 +222,6 @@ mod tests {
use ethereum_types::H520;
use ethcore::{
block::*,
spec,
test_helpers::get_temp_state_db
};
use accounts::AccountProvider;

View File

@ -27,4 +27,5 @@ unexpected = { path = "../../../util/unexpected" }
[dev-dependencies]
ethcore = { path = "../..", features = ["test-helpers"] }
spec = { path = "../../spec" }
state-db = { path = "../../state-db" }

View File

@ -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,

View File

@ -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"

View File

@ -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};

View File

@ -17,4 +17,5 @@ trace = { path = "../../trace" }
[dev-dependencies]
ethcore = { path = "../..", features = ["test-helpers"] }
spec = { path = "../../spec" }
rlp = "0.4.2"

View File

@ -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() {

View File

@ -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 = []

View File

@ -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;

View File

@ -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;

View File

@ -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};

View File

@ -29,5 +29,6 @@ evm = { path = "../evm" }
keccak-hash = "0.2.0"
pod = { path = "../pod" }
rustc-hex = "1.0"
spec = { path = "../spec" }
trie-db = "0.15.0"
ethtrie = { package = "patricia-trie-ethereum", path = "../../util/patricia-trie-ethereum" }

View File

@ -273,7 +273,6 @@ mod tests {
use ethkey::Secret;
use ethereum_types::{H256, U256, Address, BigEndianHash};
use ethcore::{
spec,
test_helpers::{get_temp_state, get_temp_state_db}
};
use ethtrie;
@ -281,6 +280,7 @@ mod tests {
use machine::Machine;
use pod::{self, PodAccount, PodState};
use rustc_hex::FromHex;
use spec;
use ::trace::{FlatTrace, TraceError, trace};
use trie_db::{TrieFactory, TrieSpec};
use vm::EnvInfo;

View File

@ -39,6 +39,7 @@ itertools = "0.5"
bincode = "1.1"
serde = "1.0"
serde_derive = "1.0"
spec = { path = "../spec" }
parking_lot = "0.8"
stats = { path = "../../util/stats" }
keccak-hash = "0.2.0"

View File

@ -41,7 +41,7 @@ use common_types::{
header::Header,
ids::BlockId,
};
use ethcore::spec::{Spec, SpecHardcodedSync};
use spec::{Spec, SpecHardcodedSync};
use ethereum_types::{H256, H264, U256};
use parity_util_mem::{MallocSizeOf, MallocSizeOfOps};
use kvdb::{DBTransaction, KeyValueDB};
@ -877,7 +877,7 @@ mod tests {
use cache::Cache;
use common_types::header::Header;
use common_types::ids::BlockId;
use ethcore::spec;
use spec;
use ethereum_types::U256;
use kvdb::KeyValueDB;
use kvdb_memorydb;

View File

@ -21,7 +21,7 @@ use std::sync::{Weak, Arc};
use engine::{Engine, EpochChange, Proof};
use ethcore::client::{ClientReport, ClientIoMessage};
use ethcore::verification::queue::{self, HeaderQueue};
use ethcore::spec::{Spec, SpecHardcodedSync};
use spec::{Spec, SpecHardcodedSync};
use io::IoChannel;
use parking_lot::{Mutex, RwLock};
use ethereum_types::{H256, U256};
@ -252,7 +252,7 @@ impl<T: ChainDataFetcher> Client<T> {
}
/// Get the header queue info.
pub fn queue_info(&self) -> queue::QueueInfo {
pub fn queue_info(&self) -> BlockQueueInfo {
self.queue.queue_info()
}
@ -546,7 +546,7 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
fn chain_info(&self) -> BlockChainInfo { Client::chain_info(self) }
fn queue_info(&self) -> queue::QueueInfo {
fn queue_info(&self) -> BlockQueueInfo {
self.queue.queue_info()
}

View File

@ -24,7 +24,7 @@ use common_types::errors::EthcoreError as CoreError;
use ethcore_db as db;
use ethcore_blockchain::BlockChainDB;
use ethcore::client::ClientIoMessage;
use ethcore::spec::Spec;
use spec::Spec;
use io::{IoContext, IoError, IoHandler, IoService};
use cache::Cache;
@ -113,7 +113,7 @@ impl<T: ChainDataFetcher> IoHandler<ClientIoMessage> for ImportBlocks<T> {
#[cfg(test)]
mod tests {
use super::Service;
use ethcore::spec;
use spec;
use std::sync::Arc;
use cache::Cache;

View File

@ -85,6 +85,7 @@ extern crate parking_lot;
#[macro_use]
extern crate rlp_derive;
extern crate serde;
extern crate spec;
extern crate smallvec;
extern crate stats;
extern crate vm;

View File

@ -39,6 +39,7 @@ ethjson = { path = "../../json" }
ethkey = { path = "../../accounts/ethkey" }
macros = { path = "../../util/macros" }
rustc-hex = "1.0"
spec = { path = "../spec" }
tempdir = "0.3"
trace = { path = "../trace" }

View File

@ -408,7 +408,7 @@ mod tests {
use std::str::FromStr;
use common_types::header::Header;
use super::*;
use ethcore::spec;
use spec;
fn get_default_ethash_extensions() -> EthashExtensions {
EthashExtensions {

View File

@ -160,12 +160,12 @@ mod test {
};
use ethcore::{
client::{Client, ClientConfig},
spec::Spec,
miner::Miner,
test_helpers,
};
use ethkey::{Secret, KeyPair};
use ethcore_io::IoChannel;
use spec::Spec;
use super::TransactionFilter;

View File

@ -24,4 +24,5 @@ lru-cache = "0.1"
ethcore = { path = "..", features = ["test-helpers"] }
kvdb-memorydb = "0.1"
ethcore-io = { path = "../../util/io" }
spec = { path = "../spec" }
tempdir = "0.3"

View File

@ -34,6 +34,8 @@ extern crate ethcore_io as io;
extern crate kvdb_memorydb;
#[cfg(test)]
extern crate tempdir;
#[cfg(test)]
extern crate spec;
#[macro_use]
extern crate log;
@ -130,7 +132,7 @@ mod test {
use std::sync::{Arc, Weak};
use client_traits::BlockChainClient;
use ethcore::spec::Spec;
use spec::Spec;
use ethcore::client::{Client, ClientConfig};
use ethcore::miner::Miner;
use ethcore::test_helpers;

View File

@ -43,6 +43,7 @@ rustc-hex = "1.0"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
spec = { path = "../spec" }
state-db = { path = "../state-db" }
time-utils = { path = "../../util/time-utils" }
tiny-keccak = "1.4"

View File

@ -26,6 +26,7 @@ extern crate ethkey;
extern crate keccak_hash as hash;
extern crate rustc_hex;
extern crate machine;
extern crate spec;
#[macro_use]
extern crate log;
@ -39,7 +40,6 @@ use ethcore::{
CreateContractAddress,
test_helpers::{generate_dummy_client, push_block_with_transactions, new_db},
miner::Miner,
spec,
};
use client_traits::BlockChainClient;
use ethkey::{Secret, KeyPair, Signature};

View File

@ -15,6 +15,7 @@ ethcore-sync = { path = "../sync" }
ethereum-types = "0.6.0"
kvdb = "0.1"
log = "0.4"
spec = { path = "../spec" }
trace-time = "0.1"
[dev-dependencies]

View File

@ -23,6 +23,7 @@ extern crate ethcore_private_tx;
extern crate ethcore_sync as sync;
extern crate ethereum_types;
extern crate kvdb;
extern crate spec;
#[macro_use]
extern crate log;

View File

@ -30,7 +30,7 @@ use ethcore::client::{Client, ClientConfig, ChainNotify, ClientIoMessage};
use ethcore::miner::Miner;
use ethcore::snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
use ethcore::snapshot::{SnapshotService as _SnapshotService};
use ethcore::spec::Spec;
use spec::Spec;
use common_types::{
errors::{EthcoreError, SnapshotError},
snapshot::RestorationStatus,
@ -298,7 +298,7 @@ mod tests {
use ethcore_db::NUM_COLUMNS;
use ethcore::client::ClientConfig;
use ethcore::miner::Miner;
use ethcore::spec;
use spec;
use ethcore::test_helpers;
use kvdb_rocksdb::{DatabaseConfig, CompactionProfile};
use super::*;

41
ethcore/spec/Cargo.toml Normal file
View File

@ -0,0 +1,41 @@
[package]
description = "Ethereum engine specification"
name = "spec"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0"
[dependencies]
account-state = { path = "../account-state" }
authority-round = { path = "../engines/authority-round" }
basic-authority = { path = "../engines/basic-authority" }
builtin = { package = "ethcore-builtin", path = "../builtin" }
bytes = { package = "parity-bytes", version = "0.1.0" }
clique = { path = "../engines/clique" }
common-types = { path = "../types" }
engine = { path = "../engine" }
ethash = { path = "../../ethash" }
ethash-engine = { path = "../engines/ethash" }
ethereum-types = "0.6.0"
ethjson = { path = "../../json" }
evm = { path = "../evm" }
executive-state = { path = "../executive-state" }
hash-db = "0.15.0"
instant-seal = { path = "../engines/instant-seal" }
journaldb = { path = "../../util/journaldb" }
keccak-hash = "0.2.0"
kvdb-memorydb = "0.1.0"
log = "0.4.8"
machine = { path = "../machine" }
null-engine = { path = "../engines/null-engine" }
pod = { path = "../pod" }
rlp = "0.4.2"
trace = { path = "../trace" }
trie-vm-factories = { path = "../trie-vm-factories" }
vm = { path = "../vm" }
[dev-dependencies]
ethcore = { path = "..", features = ["test-helpers"] }
env_logger = "0.5"
tempdir = "0.3.7"

View File

@ -49,7 +49,7 @@ macro_rules! bundle_test_machine {
($($path: expr => $name: ident), *) => {
$(
/// Bundled test spec
pub fn $name() -> crate::machine::Machine {
pub fn $name() -> machine::Machine {
crate::spec::Spec::load_machine(
include_bytes!(concat!("../../res/", $path, ".json")) as &[u8]
).expect(concat!("Chain spec ", $path, " is invalid."))
@ -119,10 +119,10 @@ bundle_test_machine! {
#[cfg(test)]
mod tests {
use account_state::State;
use common_types::{view, views::BlockView};
use ethereum_types::U256;
use tempdir::TempDir;
use test_helpers::get_temp_state_db;
use types::{view, views::BlockView};
use ethcore::test_helpers::get_temp_state_db;
use super::{new_morden, new_foundation};

View File

@ -16,8 +16,8 @@
use ethereum_types::{H256, U256, Address};
use ethjson;
use hash::KECCAK_NULL_RLP;
use spec::seal::Seal;
use keccak_hash::KECCAK_NULL_RLP;
use crate::seal::Seal;
/// Genesis components.
pub struct Genesis {

View File

@ -23,4 +23,4 @@ mod spec;
pub use self::chain::*;
pub use self::genesis::Genesis;
pub use self::spec::{Spec, SpecHardcodedSync, SpecParams, OptimizeFor};
pub use self::spec::{Spec, SpecHardcodedSync, SpecParams};

View File

@ -24,41 +24,42 @@ use std::{
sync::Arc,
};
use bytes::Bytes;
use ethereum_types::{H256, Bloom, U256, Address};
use ethjson;
use hash::{KECCAK_NULL_RLP, keccak};
use rlp::{Rlp, RlpStream};
use types::{
use common_types::{
BlockNumber,
header::Header,
encoded,
engines::params::CommonParams,
engines::{OptimizeFor, params::CommonParams},
errors::EthcoreError as Error,
transaction::{Action, Transaction},
};
use vm::{EnvInfo, CallType, ActionValue, ActionParams, ParamsType};
use builtin::Builtin;
use engine::Engine;
use clique::Clique;
use null_engine::NullEngine;
use instant_seal::{InstantSeal, InstantSealParams};
use account_state::{Backend, State, backend::Basic as BasicBackend};
use authority_round::AuthorityRound;
use basic_authority::BasicAuthority;
use bytes::Bytes;
use builtin::Builtin;
use clique::Clique;
use engine::Engine;
use ethash_engine::Ethash;
use machine::{
executive::Executive,
machine::Machine,
substate::Substate,
};
use trie_vm_factories::Factories;
use ethereum_types::{H256, Bloom, U256, Address};
use ethjson;
use instant_seal::{InstantSeal, InstantSealParams};
use keccak_hash::{KECCAK_NULL_RLP, keccak};
use log::{trace, warn};
use machine::{executive::Executive, Machine, substate::Substate};
use null_engine::NullEngine;
use pod::PodState;
use spec::Genesis;
use spec::seal::Generic as GenericSeal;
use account_state::{Backend, State, backend::Basic as BasicBackend};
use rlp::{Rlp, RlpStream};
use trace::{NoopTracer, NoopVMTracer};
use trie_vm_factories::Factories;
use vm::{EnvInfo, CallType, ActionValue, ActionParams, ParamsType};
use crate::{
Genesis,
seal::Generic as GenericSeal,
};
pub use ethash::OptimizeFor;
/// Runtime parameters for the spec that are related to how the software should run the chain,
/// rather than integral properties of the chain itself.
@ -489,8 +490,6 @@ impl Spec {
/// initialize genesis epoch data, using in-memory database for
/// constructor.
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> {
use types::transaction::{Action, Transaction};
let genesis = self.genesis_header();
let factories = Default::default();
@ -505,7 +504,7 @@ impl Spec {
let call = |a, d| {
let mut db = db.boxed_clone();
let env_info = ::evm::EnvInfo {
let env_info = evm::EnvInfo {
number: 0,
author: *genesis.author(),
timestamp: genesis.timestamp(),
@ -525,7 +524,7 @@ impl Spec {
data: d,
}.fake_sign(from);
let res = ::executive_state::prove_transaction_virtual(
let res = executive_state::prove_transaction_virtual(
db.as_hash_db_mut(),
*genesis.state_root(),
&tx,
@ -545,14 +544,15 @@ impl Spec {
#[cfg(test)]
mod tests {
use super::*;
use account_state::State;
use test_helpers::get_temp_state_db;
use tempdir::TempDir;
use types::view;
use types::views::BlockView;
use std::str::FromStr;
use crate::spec;
use account_state::State;
use common_types::{view, views::BlockView};
use ethereum_types::{Address, H256};
use ethcore::test_helpers::get_temp_state_db;
use tempdir::TempDir;
use super::Spec;
#[test]
fn test_load_empty() {
@ -562,7 +562,7 @@ mod tests {
#[test]
fn test_chain() {
let test_spec = spec::new_test();
let test_spec = crate::new_test();
assert_eq!(
test_spec.state_root,
@ -578,7 +578,7 @@ mod tests {
#[test]
fn genesis_constructor() {
let _ = ::env_logger::try_init();
let spec = spec::new_test_constructor();
let spec = crate::new_test_constructor();
let db = spec.ensure_db_good(get_temp_state_db(), &Default::default())
.unwrap();
let state = State::from_existing(

View File

@ -500,7 +500,7 @@ mod tests {
verification::Unverified,
};
use hash_db::EMPTY_PREFIX;
use crate::spec;
use spec;
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
fn enact_bytes(

View File

@ -58,6 +58,7 @@ use types::{
client_types::Mode,
blockchain_info::BlockChainInfo,
block_status::BlockStatus,
verification::VerificationQueueInfo as BlockQueueInfo,
};
use vm::{Schedule, LastHashes};
@ -80,7 +81,6 @@ use spec::{Spec, self};
use account_state::state::StateInfo;
use state_db::StateDB;
use trace::LocalizedTrace;
use verification::queue::QueueInfo as BlockQueueInfo;
/// Test client.
pub struct TestBlockChainClient {

View File

@ -39,7 +39,7 @@ use ethtrie;
use rlp::RlpStream;
use hash::keccak;
use ethereum_types::BigEndianHash;
use crate::spec;
use spec;
use super::HookType;

View File

@ -55,32 +55,23 @@
extern crate account_db;
extern crate account_state;
extern crate authority_round;
extern crate ansi_term;
extern crate basic_authority;
extern crate client_traits;
extern crate common_types as types;
extern crate clique;
extern crate crossbeam_utils;
extern crate engine;
extern crate ethabi;
extern crate ethash;
extern crate ethash_engine;
extern crate ethcore_blockchain as blockchain;
extern crate ethcore_bloom_journal as bloom_journal;
extern crate ethcore_builtin as builtin;
extern crate ethcore_call_contract as call_contract;
extern crate ethcore_db as db;
extern crate ethcore_io as io;
extern crate ethcore_miner;
extern crate ethereum_types;
extern crate ethjson;
extern crate ethkey;
extern crate executive_state;
extern crate trie_vm_factories;
extern crate futures;
extern crate hash_db;
extern crate instant_seal;
extern crate itertools;
extern crate journaldb;
extern crate keccak_hash as hash;
@ -92,12 +83,10 @@ extern crate kvdb_memorydb;
extern crate len_caching_lock;
extern crate machine;
extern crate memory_cache;
extern crate null_engine;
extern crate num_cpus;
extern crate parity_bytes as bytes;
extern crate parity_snappy as snappy;
extern crate parking_lot;
extern crate pod;
extern crate trie_db as trie;
extern crate patricia_trie_ethereum as ethtrie;
extern crate rand;
@ -108,6 +97,7 @@ extern crate parity_util_mem as malloc_size_of;
#[cfg(any(test, feature = "test-helpers"))]
extern crate rustc_hex;
extern crate serde;
extern crate spec;
extern crate state_db;
extern crate time_utils;
extern crate trace;
@ -122,6 +112,13 @@ extern crate rand_xorshift;
extern crate ethcore_accounts as accounts;
#[cfg(feature = "stratum")]
extern crate ethcore_stratum;
#[cfg(any(test, feature = "stratum"))]
extern crate ethash;
#[cfg(any(test, feature = "test-helpers"))]
extern crate ethkey;
#[cfg(any(test, feature = "test-helpers"))]
extern crate ethjson;
#[cfg(any(test, feature = "tempdir"))]
extern crate tempdir;
#[cfg(any(test, feature = "kvdb-rocksdb"))]
@ -129,9 +126,13 @@ extern crate kvdb_rocksdb;
#[cfg(any(test, feature = "json-tests"))]
#[macro_use]
extern crate lazy_static;
#[cfg(any(test, feature = "json-tests", feature = "test-helpers", feature = "parity"))]
#[cfg(any(test, feature = "test-helpers"))]
#[macro_use]
extern crate macros;
#[cfg(test)]
extern crate null_engine;
#[cfg(any(test, feature = "test-helpers"))]
extern crate pod;
#[cfg(any(test, feature = "blooms-db"))]
extern crate blooms_db;
#[cfg(any(test, feature = "env_logger"))]
@ -161,7 +162,6 @@ pub mod block;
pub mod client;
pub mod miner;
pub mod snapshot;
pub mod spec;
pub mod verification;
#[cfg(test)]

View File

@ -1498,7 +1498,7 @@ mod tests {
BlockNumber,
transaction::Transaction
};
use crate::spec;
use spec;
#[test]
fn should_prepare_block_to_seal() {

View File

@ -907,7 +907,7 @@ impl Drop for Service {
mod tests {
use client::ClientIoMessage;
use io::{IoService};
use crate::spec;
use spec;
use journaldb::Algorithm;
use snapshot::SnapshotService;
use super::*;

View File

@ -33,7 +33,7 @@ use parking_lot::Mutex;
use snappy;
use kvdb::DBTransaction;
use test_helpers;
use crate::spec;
use spec;
const SNAPSHOT_MODE: ::snapshot::PowSnapshot = ::snapshot::PowSnapshot { blocks: 30000, max_restore_blocks: 30000 };

View File

@ -32,7 +32,7 @@ use types::{
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
use snapshot::service::{Service, ServiceParams};
use snapshot::{chunk_state, chunk_secondary, SnapshotService};
use crate::spec;
use spec;
use test_helpers::{new_db, new_temp_db, generate_dummy_client_with_spec_and_data, restoration_db_handler};
use parking_lot::Mutex;

View File

@ -33,7 +33,7 @@ use types::{
use client::{Client, ClientConfig, PrepareOpenBlock, ImportSealedBlock};
use client_traits::{BlockInfo, BlockChainClient, BlockChainReset, ChainInfo, ImportBlock};
use crate::spec;
use spec;
use machine::executive::{Executive, TransactOptions};
use miner::{Miner, PendingOrdering, MinerService};
use account_state::{State, CleanupMode, backend};

View File

@ -21,7 +21,7 @@ use hash::keccak;
use block::*;
use ethereum_types::{U256, Address};
use io::*;
use crate::spec;
use spec;
use test_helpers::get_temp_state_db;
use client::{Client, ClientConfig};
use client_traits::{BlockChainClient, ImportBlock};

View File

@ -16,20 +16,26 @@
//! Block verification utilities.
use call_contract::CallContract;
use client_traits::BlockInfo;
mod verification;
mod verifier;
pub mod queue;
mod canon_verifier;
mod noop_verifier;
pub use self::verification::*;
pub use self::verification::FullFamilyParams;
pub use self::verifier::Verifier;
pub use self::canon_verifier::CanonVerifier;
pub use self::noop_verifier::NoopVerifier;
pub use self::queue::{BlockQueue, Config as QueueConfig, VerificationQueue, QueueInfo};
pub use self::queue::{BlockQueue, Config as QueueConfig};
use call_contract::CallContract;
use client_traits::BlockInfo;
use self::verification::{
verify_block_basic,
verify_block_unordered,
verify_header_params,
};
use self::canon_verifier::CanonVerifier;
use self::noop_verifier::NoopVerifier;
/// Verifier type.
#[derive(Debug, PartialEq, Clone)]

View File

@ -29,12 +29,13 @@ use io::*;
use engine::Engine;
use client::ClientIoMessage;
use len_caching_lock::LenCachingMutex;
use types::errors::{BlockError, EthcoreError as Error, ImportError};
use types::{
errors::{BlockError, EthcoreError as Error, ImportError},
verification::VerificationQueueInfo as QueueInfo,
};
use self::kind::{BlockLike, Kind};
pub use types::verification::VerificationQueueInfo as QueueInfo;
pub mod kind;
const MIN_MEM_LIMIT: usize = 16384;
@ -743,7 +744,7 @@ mod tests {
view,
views::BlockView,
};
use crate::spec;
use spec;
// create a test block queue.
// auto_scaling enables verifier adjustment.

View File

@ -372,7 +372,7 @@ mod tests {
use hash::keccak;
use engine::Engine;
use ethkey::{Random, Generator};
use crate::spec;
use spec;
use test_helpers::{create_test_block_with_data, create_test_block};
use types::{
encoded,

View File

@ -46,3 +46,4 @@ ethcore-io = { path = "../../util/io", features = ["mio"] }
kvdb-memorydb = "0.1"
rustc-hex = "1.0"
rand_xorshift = "0.1.1"
spec = { path = "../spec" }

View File

@ -637,7 +637,7 @@ fn all_expected<A, B, F>(values: &[A], expected_values: &[B], is_expected: F) ->
mod tests {
use super::*;
use ethcore::client::TestBlockChainClient;
use ethcore::spec;
use spec;
use ethkey::{Generator,Random};
use hash::keccak;
use parking_lot::RwLock;

View File

@ -49,6 +49,7 @@ extern crate ethcore_light as light;
#[cfg(test)] extern crate rand_xorshift;
#[cfg(test)] extern crate machine;
#[cfg(test)] extern crate engine;
#[cfg(test)] extern crate spec;
#[macro_use]
extern crate enum_primitive;

View File

@ -23,7 +23,7 @@ use light_sync::*;
use tests::helpers::{TestNet, Peer as PeerLike, TestPacket};
use ethcore::client::TestBlockChainClient;
use ethcore::spec;
use spec;
use io::IoChannel;
use kvdb_memorydb;
use light::client::fetch::{self, Unavailable};

View File

@ -22,7 +22,7 @@ use client_traits::BlockInfo;
use chain::SyncState;
use super::helpers::*;
use {SyncConfig, WarpSync};
use ethcore::spec;
use spec;
#[test]
fn two_peers() {

View File

@ -21,7 +21,7 @@ use io::{IoHandler, IoChannel};
use client_traits::ChainInfo;
use engine::signer;
use ethcore::client::{ClientIoMessage};
use ethcore::spec;
use spec;
use ethcore::miner::{self, MinerService};
use ethkey::{KeyPair, Secret};
use types::transaction::{Action, PendingTransaction, Transaction};

View File

@ -26,7 +26,7 @@ use client_traits::BlockChainClient;
use ethcore::client::{TestBlockChainClient, Client as EthcoreClient,
ClientConfig, ChainNotify, NewBlocks, ChainMessageType, ClientIoMessage};
use ethcore::snapshot::SnapshotService;
use ethcore::spec::{self, Spec};
use spec::{self, Spec};
use ethcore_private_tx::PrivateStateDB;
use ethcore::miner::Miner;
use ethcore::test_helpers;

View File

@ -25,7 +25,6 @@ use ethcore::{
CreateContractAddress,
client::ClientIoMessage,
miner::{self, MinerService},
spec::Spec,
test_helpers::{push_block_with_transactions, new_db},
};
use ethcore_private_tx::{Provider, ProviderConfig, NoopEncryptor, Importer, SignedPrivateTransaction, StoringKeyProvider};
@ -34,6 +33,7 @@ use machine::executive::contract_address;
use tests::helpers::{TestNet, TestIoHandler};
use rustc_hex::FromHex;
use rlp::Rlp;
use spec::Spec;
use SyncConfig;
fn seal_spec() -> Spec {

View File

@ -28,6 +28,21 @@ pub mod epoch;
pub mod params;
pub mod machine;
/// Optimize cache for CPU or memory usage
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub enum OptimizeFor {
/// Optimize cache for CPU
Cpu,
/// Optimize cache for memory
Memory,
}
impl Default for OptimizeFor {
fn default() -> Self {
OptimizeFor::Cpu
}
}
/// Ethash/Clique specific seal
#[derive(Debug, PartialEq)]
pub struct EthashSeal {

View File

@ -24,6 +24,7 @@ pod = { path = "../ethcore/pod" }
rustc-hex = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
spec = { path = "../ethcore/spec" }
trace = { path = "../ethcore/trace" }
vm = { path = "../ethcore/vm" }

View File

@ -20,13 +20,13 @@ use std::time::{Instant, Duration};
use common_types::transaction;
use ethcore::{
client::{self, EvmTestClient, EvmTestError, TransactErr, TransactSuccess},
spec,
client::{EvmTestClient, EvmTestError, TransactErr, TransactSuccess},
TrieSpec,
};
use ethereum_types::{H256, U256};
use ethjson;
use pod::PodState;
use spec;
use trace;
use vm::ActionParams;
@ -244,7 +244,7 @@ pub mod tests {
use super::*;
use tempdir::TempDir;
use ethereum_types::Address;
use ethcore::spec::{self, Spec};
use spec::{self, Spec};
pub fn run_test<T, I, F>(
informant: I,

View File

@ -42,7 +42,8 @@ use parity_bytes::Bytes;
use docopt::Docopt;
use rustc_hex::FromHex;
use ethereum_types::{U256, Address};
use ethcore::{spec, json_tests, TrieSpec};
use ethcore::{json_tests, TrieSpec};
use spec;
use serde::Deserialize;
use vm::{ActionParams, CallType};

View File

@ -18,10 +18,10 @@ use std::sync::Arc;
use std::time::Duration;
use ethcore::client::DatabaseCompactionProfile;
use ethcore::spec::{SpecParams, OptimizeFor};
use spec::SpecParams;
use light::client::fetch::Unavailable as UnavailableDataFetcher;
use light::Cache as LightDataCache;
use types::engines::OptimizeFor;
use params::{SpecType, Pruning};
use helpers::execute_upgrades;
use dir::Directories;

View File

@ -73,6 +73,7 @@ extern crate parity_runtime;
extern crate parity_updater as updater;
extern crate parity_version;
extern crate registrar;
extern crate spec;
#[macro_use]
extern crate log as rlog;

View File

@ -18,7 +18,7 @@ use std::collections::HashSet;
use std::time::Duration;
use std::{str, fs, fmt};
use ethcore::spec::{Spec, SpecParams, self};
use spec::{Spec, SpecParams, self};
use ethereum_types::{U256, Address};
use parity_runtime::Executor;
use hash_fetch::fetch::Client as FetchClient;

View File

@ -26,7 +26,7 @@ use client_traits::{BlockInfo, BlockChainClient};
use ethcore::client::{Client, DatabaseCompactionProfile, VMType};
use ethcore::miner::{self, stratum, Miner, MinerService, MinerOptions};
use ethcore::snapshot::{self, SnapshotConfiguration};
use ethcore::spec::{SpecParams, OptimizeFor};
use spec::SpecParams;
use ethcore::verification::queue::VerifierSettings;
use ethcore_logger::{Config as LogConfig, RotatingLogger};
use ethcore_service::ClientService;
@ -43,6 +43,7 @@ use parity_runtime::Runtime;
use sync::{self, SyncConfig, PrivateTxHandler};
use types::{
client_types::Mode,
engines::OptimizeFor,
ids::BlockId,
snapshot::Snapshotting,
};

View File

@ -64,6 +64,7 @@ parity-updater = { path = "../updater" }
parity-version = { path = "../util/version" }
rlp = "0.4.0"
account-state = { path = "../ethcore/account-state" }
spec = { path = "../ethcore/spec" }
stats = { path = "../util/stats" }
trace = { path = "../ethcore/trace" }
vm = { path = "../ethcore/vm" }

View File

@ -85,6 +85,7 @@ extern crate parity_version as version;
extern crate eip_712;
extern crate rlp;
extern crate account_state;
extern crate spec;
extern crate stats;
extern crate tempdir;
extern crate trace;

View File

@ -22,7 +22,7 @@ use accounts::AccountProvider;
use client_traits::{BlockChainClient, ChainInfo, ImportBlock};
use ethcore::client::{Client, ClientConfig};
use ethcore::miner::Miner;
use ethcore::spec::{Genesis, Spec, self};
use spec::{Genesis, Spec, self};
use ethcore::test_helpers;
use ethcore::verification::VerifierType;
use ethereum_types::{Address, H256, U256};