Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Extract spec to own crate (#10978)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dvdplm authored and sorpaas committed Aug 23, 2019
1 parent 79b671f commit fbf425c
Show file tree
Hide file tree
Showing 80 changed files with 336 additions and 199 deletions.
59 changes: 55 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 36 additions & 38 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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-path = "0.1"
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" }
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 }

parking_lot = "0.8"
regex = "1.0"
registrar = { path = "util/registrar" }

parity-util-mem = { version = "0.2.0", features = ["jemalloc-global"] }
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"
Expand Down
1 change: 1 addition & 0 deletions ethash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion ethash/benches/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion ethash/benches/progpow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
14 changes: 2 additions & 12 deletions ethash/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,9 @@ use std::path::{Path, PathBuf};
use std::slice;
use std::sync::Arc;

type Cache = Either<Vec<Node>, MmapMut>;

#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub enum OptimizeFor {
Cpu,
Memory,
}
use common_types::engines::OptimizeFor;

impl Default for OptimizeFor {
fn default() -> Self {
OptimizeFor::Cpu
}
}
type Cache = Either<Vec<Node>, MmapMut>;

fn byte_size(cache: &Cache) -> usize {
use self::Either::{Left, Right};
Expand Down
Loading

0 comments on commit fbf425c

Please sign in to comment.