From d80dd81d7799a63ab68507e0c1a36d01bf0b6826 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Fri, 22 Dec 2017 09:37:39 -0400 Subject: [PATCH] parity-version pr reopen (#7136) * parity-version module split from util removed unused util deps and features trigger buildbot again only kvdb links rocksdb snappy linker issues * rm snappy * fixed old version imports --- Cargo.lock | 32 +++++++++++----------- Cargo.toml | 2 +- dapps/Cargo.toml | 1 + dapps/src/handlers/content.rs | 2 +- dapps/src/lib.rs | 1 + ethcore/src/state/account.rs | 9 +++++++ parity/cli/usage.rs | 2 +- parity/configuration.rs | 3 ++- parity/helpers.rs | 2 +- parity/main.rs | 1 + parity/params.rs | 3 ++- parity/run.rs | 2 +- rpc/Cargo.toml | 1 + rpc/src/lib.rs | 1 + rpc/src/v1/impls/light/parity.rs | 2 +- rpc/src/v1/impls/parity.rs | 2 +- rpc/src/v1/impls/web3.rs | 2 +- rpc/src/v1/tests/mocked/parity.rs | 4 +-- rpc/src/v1/tests/mocked/web3.rs | 2 +- updater/Cargo.toml | 1 + updater/src/lib.rs | 1 + updater/src/types/version_info.rs | 2 +- updater/src/updater.rs | 4 +-- util/Cargo.toml | 34 ++++-------------------- util/src/lib.rs | 23 ---------------- util/version/Cargo.toml | 14 ++++++++++ util/{ => version}/build.rs | 2 +- util/{src/misc.rs => version/src/lib.rs} | 15 ++++------- 28 files changed, 74 insertions(+), 96 deletions(-) create mode 100644 util/version/Cargo.toml rename util/{ => version}/build.rs (97%) rename util/{src/misc.rs => version/src/lib.rs} (93%) diff --git a/Cargo.lock b/Cargo.lock index e1104596a..55e88f5e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -715,31 +715,14 @@ dependencies = [ name = "ethcore-util" version = "1.9.0" dependencies = [ - "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", "ethcore-bigint 0.2.1", "ethcore-bytes 0.1.0", - "ethcore-logger 1.9.0", "hashdb 0.1.1", - "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "journaldb 0.1.0", "keccak-hash 0.1.0", - "kvdb 0.1.0", - "kvdb-memorydb 0.1.0", - "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.1.1", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.1.0", - "rlp 0.2.1", - "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "triehash 0.1.0", - "util-error 0.1.0", - "vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1938,6 +1921,7 @@ dependencies = [ "parity-rpc 1.9.0", "parity-rpc-client 1.4.0", "parity-updater 1.9.0", + "parity-version 0.1.0", "parity-whisper 0.1.0", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "path 0.1.0", @@ -1983,6 +1967,7 @@ dependencies = [ "parity-hash-fetch 1.9.0", "parity-reactor 0.1.0", "parity-ui 1.9.0", + "parity-version 0.1.0", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2130,6 +2115,7 @@ dependencies = [ "order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-reactor 0.1.0", "parity-updater 1.9.0", + "parity-version 0.1.0", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2237,12 +2223,24 @@ dependencies = [ "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-hash-fetch 1.9.0", "parity-reactor 0.1.0", + "parity-version 0.1.0", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "path 0.1.0", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-version" +version = "0.1.0" +dependencies = [ + "ethcore-bytes 0.1.0", + "rlp 0.2.1", + "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parity-wasm" version = "0.15.3" diff --git a/Cargo.toml b/Cargo.toml index 31a0c1d28..a79dafd3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ parity-reactor = { path = "util/reactor" } parity-rpc = { path = "rpc" } parity-rpc-client = { path = "rpc_client" } parity-updater = { path = "updater" } +parity-version = { path = "util/version" } parity-whisper = { path = "whisper" } path = { path = "util/path" } panic_hook = { path = "panic_hook" } @@ -98,7 +99,6 @@ test-heavy = ["ethcore/test-heavy"] evm-debug = ["ethcore/evm-debug"] evm-debug-tests = ["ethcore/evm-debug-tests"] slow-blocks = ["ethcore/slow-blocks"] -final = ["ethcore-util/final"] secretstore = ["ethcore-secretstore"] [[bin]] diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index f44bc2d92..ac9becaa6 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -37,6 +37,7 @@ parity-hash-fetch = { path = "../hash-fetch" } parity-reactor = { path = "../util/reactor" } parity-ui = { path = "./ui" } keccak-hash = { path = "../util/hash" } +parity-version = { path = "../util/version" } [dev-dependencies] env_logger = "0.4" diff --git a/dapps/src/handlers/content.rs b/dapps/src/handlers/content.rs index 13d1fb0b9..711a985bd 100644 --- a/dapps/src/handlers/content.rs +++ b/dapps/src/handlers/content.rs @@ -19,7 +19,7 @@ use hyper::{self, mime, header}; use hyper::StatusCode; -use util::version; +use parity_version::version; use handlers::add_security_headers; use Embeddable; diff --git a/dapps/src/lib.rs b/dapps/src/lib.rs index 0d9a33aa7..19dd7f70b 100644 --- a/dapps/src/lib.rs +++ b/dapps/src/lib.rs @@ -41,6 +41,7 @@ extern crate parity_dapps_glue as parity_dapps; extern crate parity_hash_fetch as hash_fetch; extern crate parity_ui; extern crate keccak_hash as hash; +extern crate parity_version; #[macro_use] extern crate futures; diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index 2d9a37e81..f4b6f0b4b 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -35,6 +35,15 @@ use std::cell::{RefCell, Cell}; const STORAGE_CACHE_ITEMS: usize = 8192; +/// Boolean type for clean/dirty status. +#[derive(PartialEq, Eq, Clone, Copy, Debug)] +pub enum Filth { + /// Data has not been changed. + Clean, + /// Data has been changed. + Dirty, +} + /// Single account in the system. /// Keeps track of changes to the code and storage. /// The changes are applied in `commit_storage` and `commit_code` diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 71ac01295..388afd1c1 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -152,7 +152,7 @@ macro_rules! usage { use toml; use std::{fs, io, process}; use std::io::{Read, Write}; - use util::version; + use parity_version::version; use clap::{Arg, App, SubCommand, AppSettings, ArgMatches as ClapArgMatches, Error as ClapError, ErrorKind as ClapErrorKind}; use helpers::replace_home; use std::ffi::OsStr; diff --git a/parity/configuration.rs b/parity/configuration.rs index 72d667062..715e63db5 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -25,7 +25,8 @@ use cli::{Args, ArgsError}; use hash::keccak; use bigint::prelude::U256; use bigint::hash::H256; -use util::{version_data, Address, version}; +use util::Address; +use parity_version::{version_data, version}; use bytes::Bytes; use ansi_term::Colour; use ethsync::{NetworkConfiguration, validate_node_url, self}; diff --git a/parity/helpers.rs b/parity/helpers.rs index 68bcce93d..88ff333d9 100644 --- a/parity/helpers.rs +++ b/parity/helpers.rs @@ -213,7 +213,7 @@ pub fn default_network_config() -> ::ethsync::NetworkConfiguration { ip_filter: IpFilter::default(), reserved_nodes: Vec::new(), allow_non_reserved: true, - client_version: ::util::version(), + client_version: ::parity_version::version(), } } diff --git a/parity/main.rs b/parity/main.rs index 9ed01b6f7..c8ea6ead8 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -67,6 +67,7 @@ extern crate parity_local_store as local_store; extern crate parity_reactor; extern crate parity_rpc; extern crate parity_updater as updater; +extern crate parity_version; extern crate parity_whisper; extern crate path; extern crate rpc_cli; diff --git a/parity/params.rs b/parity/params.rs index 4a768e07d..2d5cb8a7d 100644 --- a/parity/params.rs +++ b/parity/params.rs @@ -17,7 +17,8 @@ use std::{str, fs, fmt}; use std::time::Duration; use bigint::prelude::U256; -use util::{Address, version_data}; +use util::Address; +use parity_version::version_data; use journaldb::Algorithm; use ethcore::spec::{Spec, SpecParams}; use ethcore::ethereum; diff --git a/parity/run.rs b/parity/run.rs index f3a2b4f43..064f02d34 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -39,7 +39,7 @@ use parity_reactor::EventLoop; use parity_rpc::{NetworkSettings, informant, is_major_importing}; use updater::{UpdatePolicy, Updater}; use ansi_term::Colour; -use util::version; +use parity_version::version; use parking_lot::{Condvar, Mutex}; use node_filter::NodeFilter; use journaldb::Algorithm; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 6fba076e8..17ac43bd4 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -54,6 +54,7 @@ fetch = { path = "../util/fetch" } node-health = { path = "../dapps/node-health" } parity-reactor = { path = "../util/reactor" } parity-updater = { path = "../updater" } +parity-version = { path = "../util/version" } rlp = { path = "../util/rlp" } stats = { path = "../util/stats" } vm = { path = "../ethcore/vm" } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index d26a77c8e..f326cb381 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -62,6 +62,7 @@ extern crate fetch; extern crate node_health; extern crate parity_reactor; extern crate parity_updater as updater; +extern crate parity_version as version; extern crate rlp; extern crate stats; extern crate keccak_hash as hash; diff --git a/rpc/src/v1/impls/light/parity.rs b/rpc/src/v1/impls/light/parity.rs index 6987f8082..1be734df4 100644 --- a/rpc/src/v1/impls/light/parity.rs +++ b/rpc/src/v1/impls/light/parity.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use std::collections::{BTreeMap, HashSet}; -use util::misc::version_data; +use version::version_data; use crypto::{ecies, DEFAULT_MAC}; use ethkey::{Brain, Generator}; diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index b10659322..4cb02f9cb 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -20,7 +20,7 @@ use std::str::FromStr; use std::collections::{BTreeMap, HashSet}; use util::Address; -use util::misc::version_data; +use version::version_data; use crypto::{DEFAULT_MAC, ecies}; use ethkey::{Brain, Generator}; diff --git a/rpc/src/v1/impls/web3.rs b/rpc/src/v1/impls/web3.rs index 44055507f..6915af1d1 100644 --- a/rpc/src/v1/impls/web3.rs +++ b/rpc/src/v1/impls/web3.rs @@ -17,7 +17,7 @@ //! Web3 rpc implementation. use hash::keccak; use jsonrpc_core::Result; -use util::version; +use version::version; use v1::traits::Web3; use v1::types::{H256, Bytes}; diff --git a/rpc/src/v1/tests/mocked/parity.rs b/rpc/src/v1/tests/mocked/parity.rs index 9153a17b3..e25f3e4d3 100644 --- a/rpc/src/v1/tests/mocked/parity.rs +++ b/rpc/src/v1/tests/mocked/parity.rs @@ -234,14 +234,14 @@ fn rpc_parity_chain_id() { #[test] fn rpc_parity_default_extra_data() { - use util::misc; + use version::version_data; use bytes::ToPretty; let deps = Dependencies::new(); let io = deps.default_client(); let request = r#"{"jsonrpc": "2.0", "method": "parity_defaultExtraData", "params": [], "id": 1}"#; - let response = format!(r#"{{"jsonrpc":"2.0","result":"0x{}","id":1}}"#, misc::version_data().to_hex()); + let response = format!(r#"{{"jsonrpc":"2.0","result":"0x{}","id":1}}"#, version_data().to_hex()); assert_eq!(io.handle_request_sync(request), Some(response)); } diff --git a/rpc/src/v1/tests/mocked/web3.rs b/rpc/src/v1/tests/mocked/web3.rs index 46a83bb3d..aceb36e56 100644 --- a/rpc/src/v1/tests/mocked/web3.rs +++ b/rpc/src/v1/tests/mocked/web3.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use jsonrpc_core::IoHandler; -use util::version; +use version::version; use v1::{Web3, Web3Client}; #[test] diff --git a/updater/Cargo.toml b/updater/Cargo.toml index a67559f68..ec1b99296 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -19,4 +19,5 @@ futures = "0.1" parking_lot = "0.4" parity-hash-fetch = { path = "../hash-fetch" } parity-reactor = { path = "../util/reactor" } +parity-version = { path = "../util/version" } path = { path = "../util/path" } diff --git a/updater/src/lib.rs b/updater/src/lib.rs index c0da3b6a1..73ebc7ec4 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -28,6 +28,7 @@ extern crate ethsync; extern crate futures; extern crate target_info; extern crate parity_reactor; +extern crate parity_version as version; extern crate path; extern crate semver; diff --git a/updater/src/types/version_info.rs b/updater/src/types/version_info.rs index 778e57087..ea9b44577 100644 --- a/updater/src/types/version_info.rs +++ b/updater/src/types/version_info.rs @@ -19,7 +19,7 @@ use std::fmt; use semver::{Version}; use bigint::hash::H160; -use util::misc::raw_package_info; +use version::raw_package_info; use types::ReleaseTrack; /// Version information of a particular release. diff --git a/updater/src/updater.rs b/updater/src/updater.rs index 91c9181f8..72ddaa7fe 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -34,7 +34,7 @@ use bigint::hash::{H160, H256}; use util::Address; use bytes::Bytes; use parking_lot::Mutex; -use util::misc; +use version; /// Filter for releases. #[derive(Debug, Eq, PartialEq, Clone)] @@ -115,7 +115,7 @@ fn platform() -> String { } else if cfg!(target_os = "linux") { format!("{}-unknown-linux-gnu", Target::arch()) } else { - misc::platform() + version::platform() } } diff --git a/util/Cargo.toml b/util/Cargo.toml index 964b19c8f..e60b3c8eb 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -5,39 +5,15 @@ license = "GPL-3.0" name = "ethcore-util" version = "1.9.0" authors = ["Parity Technologies "] -build = "build.rs" [dependencies] -log = "0.3" -env_logger = "0.4" -rustc-hex = "1.0" -eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" } -elastic-array = "0.9" -rlp = { path = "rlp" } -heapsize = "0.4" -keccak-hash = { path = "hash" } -libc = "0.2.7" -target_info = "0.1" ethcore-bigint = { path = "bigint", features = ["heapsizeof"] } -parking_lot = "0.4" -tiny-keccak= "1.0" -ethcore-logger = { path = "../logger" } -triehash = { path = "triehash" } hashdb = { path = "hashdb" } -patricia-trie = { path = "patricia_trie" } -ethcore-bytes = { path = "bytes" } memorydb = { path = "memorydb" } -util-error = { path = "error" } -kvdb = { path = "kvdb" } -journaldb = { path = "journaldb" } [dev-dependencies] -kvdb-memorydb = { path = "kvdb-memorydb" } - -[features] -default = [] -final = [] - -[build-dependencies] -vergen = "0.1" -rustc_version = "0.1.0" +ethcore-bytes = { path = "bytes" } +keccak-hash = { path = "hash" } +log = "0.3" +patricia-trie = { path = "patricia_trie" } +triehash = { path = "triehash" } diff --git a/util/src/lib.rs b/util/src/lib.rs index 18a95e470..4094ed967 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -70,33 +70,10 @@ //! cargo build --release //! ``` -extern crate rustc_hex; -extern crate env_logger; -extern crate secp256k1; -extern crate elastic_array; -extern crate libc; -extern crate target_info; extern crate ethcore_bigint as bigint; -extern crate ethcore_bytes as bytes; -extern crate parking_lot; -extern crate tiny_keccak; -extern crate rlp; -extern crate heapsize; -extern crate ethcore_logger; -extern crate keccak_hash as keccak; extern crate hashdb; extern crate memorydb; -extern crate patricia_trie as trie; -extern crate kvdb; -extern crate util_error as error; -#[cfg(test)] -extern crate kvdb_memorydb; - - -pub mod misc; - -pub use misc::*; pub use hashdb::*; pub use memorydb::MemoryDB; diff --git a/util/version/Cargo.toml b/util/version/Cargo.toml new file mode 100644 index 000000000..22bf07fb1 --- /dev/null +++ b/util/version/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "parity-version" +version = "0.1.0" +authors = ["Parity Technologies "] +build = "build.rs" + +[dependencies] +ethcore-bytes = { path = "../bytes" } +rlp = { path = "../rlp" } +target_info = "0.1" + +[build-dependencies] +vergen = "0.1" +rustc_version = "0.1.0" diff --git a/util/build.rs b/util/version/build.rs similarity index 97% rename from util/build.rs rename to util/version/build.rs index 08ef81697..b5d3dd81d 100644 --- a/util/build.rs +++ b/util/version/build.rs @@ -17,11 +17,11 @@ extern crate vergen; extern crate rustc_version; -use vergen::*; use std::env; use std::fs::File; use std::io::Write; use std::path::Path; +use vergen::{vergen, OutputFns}; fn main() { vergen(OutputFns::all()).unwrap(); diff --git a/util/src/misc.rs b/util/version/src/lib.rs similarity index 93% rename from util/src/misc.rs rename to util/version/src/lib.rs index 6a1a11708..236f11914 100644 --- a/util/src/misc.rs +++ b/util/version/src/lib.rs @@ -16,9 +16,13 @@ //! Diff misc. -use rlp::RlpStream; +extern crate target_info; +extern crate ethcore_bytes as bytes; +extern crate rlp; + use target_info::Target; use bytes::Bytes; +use rlp::RlpStream; include!(concat!(env!("OUT_DIR"), "/version.rs")); include!(concat!(env!("OUT_DIR"), "/rustc_version.rs")); @@ -31,15 +35,6 @@ const THIS_TRACK: &'static str = "nightly"; const THIS_TRACK: &'static str = "unstable"; // ^^^ This gets used when we're not building a final release; should stay as "unstable". -/// Boolean type for clean/dirty status. -#[derive(PartialEq, Eq, Clone, Copy, Debug)] -pub enum Filth { - /// Data has not been changed. - Clean, - /// Data has been changed. - Dirty, -} - /// Get the platform identifier. pub fn platform() -> String { let env = Target::env();