diff --git a/Cargo.lock b/Cargo.lock index abb2fd705..3150bf81f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,13 +69,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bigint" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -406,6 +405,7 @@ dependencies = [ "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "stats 0.1.0", @@ -417,11 +417,11 @@ dependencies = [ name = "ethcore-bigint" version = "0.1.3" dependencies = [ - "bigint 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bigint 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -570,6 +570,7 @@ dependencies = [ "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", @@ -597,7 +598,7 @@ dependencies = [ "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "native-contracts 0.1.0", "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -653,7 +654,7 @@ dependencies = [ "rlp 0.2.0", "rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "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)", "sha3 0.1.0", "table 0.1.0", @@ -682,7 +683,7 @@ version = "0.1.0" dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-util 1.7.0", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -698,7 +699,7 @@ dependencies = [ "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -708,7 +709,7 @@ version = "0.1.0" dependencies = [ "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethkey 0.2.0", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -725,7 +726,7 @@ dependencies = [ "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -741,7 +742,7 @@ version = "0.1.0" dependencies = [ "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethstore 0.1.0", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -777,6 +778,7 @@ dependencies = [ "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.7.0", "ethcore-util 1.7.0", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -896,7 +898,7 @@ dependencies = [ "libusb 0.3.0 (git+https://github.com/paritytech/libusb-rs)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1655,7 +1657,7 @@ dependencies = [ "parity-reactor 0.1.0", "parity-ui 1.7.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1693,7 +1695,7 @@ dependencies = [ "native-contracts 0.1.0", "parity-reactor 0.1.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1769,7 +1771,7 @@ dependencies = [ "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2122,7 +2124,7 @@ dependencies = [ "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bigint 0.1.3", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2182,7 +2184,7 @@ dependencies = [ name = "rpc-cli" version = "1.4.0" dependencies = [ - "bigint 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bigint 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-util 1.7.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "parity-rpc 1.7.0", @@ -2202,6 +2204,11 @@ dependencies = [ "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc-hex" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc-serialize" version = "0.3.19" @@ -2908,7 +2915,7 @@ dependencies = [ "checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0" "checksum base-x 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2f59103b47307f76e03bef1633aec7fa9e29bfb5aa6daf5a334f94233c71f6c1" "checksum base32 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9605ba46d61df0410d8ac686b0007add8172eba90e8e909c347856fe794d8c" -"checksum bigint 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d493e6869ed11b135750f4a4f44d574a52bf8f67e656cdc15b4085316c2098b6" +"checksum bigint 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d0673c930652d3d4d6dcd5c45b5db4fa5f8f33994d7323618c43c083b223e8c" "checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e" "checksum bit-set 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e6e1e6fb1c9e3d6fcdec57216a74eaa03e41f52a22f13a16438251d8e88b89da" "checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" @@ -3065,6 +3072,7 @@ dependencies = [ "checksum rpassword 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d3a99497c5c544e629cc8b359ae5ede321eba5fa8e5a8078f3ced727a976c3f" "checksum rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab6e42be826e215f30ff830904f8f4a0933c6e2ae890e1af8b408f5bae60081e" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" +"checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e" "checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e114e275f7c9b5d50bb52b28f9aac1921209f02aa6077c8b255e21eefaf8ffa" diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 429ed01f5..ba6cf67ce 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -17,7 +17,7 @@ parity-dapps-glue = "1.7" mime = "0.2" mime_guess = "1.6.1" rand = "0.3" -rustc-serialize = "0.3" +rustc-hex = "1.0" serde = "0.9" serde_derive = "0.9" serde_json = "0.9" diff --git a/dapps/src/apps/fetcher/mod.rs b/dapps/src/apps/fetcher/mod.rs index d621042c4..ff14def7b 100644 --- a/dapps/src/apps/fetcher/mod.rs +++ b/dapps/src/apps/fetcher/mod.rs @@ -23,7 +23,7 @@ mod installers; use std::{fs, env}; use std::path::PathBuf; use std::sync::Arc; -use rustc_serialize::hex::FromHex; +use rustc_hex::FromHex; use fetch::{Client as FetchClient, Fetch}; use hash_fetch::urlhint::{URLHintContract, URLHint, URLHintResult}; use parity_reactor::Remote; diff --git a/dapps/src/lib.rs b/dapps/src/lib.rs index 1cbc446a7..0b93f4e39 100644 --- a/dapps/src/lib.rs +++ b/dapps/src/lib.rs @@ -24,7 +24,7 @@ extern crate futures; extern crate linked_hash_map; extern crate mime_guess; extern crate rand; -extern crate rustc_serialize; +extern crate rustc_hex; extern crate serde; extern crate serde_json; extern crate time; diff --git a/dapps/src/tests/fetch.rs b/dapps/src/tests/fetch.rs index 51650a963..8abc86196 100644 --- a/dapps/src/tests/fetch.rs +++ b/dapps/src/tests/fetch.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use devtools::http_client; -use rustc_serialize::hex::FromHex; +use rustc_hex::FromHex; use tests::helpers::{ serve_with_registrar, serve_with_registrar_and_sync, serve_with_fetch, serve_with_registrar_and_fetch, serve_with_registrar_and_fetch_and_threads, diff --git a/dapps/src/tests/helpers/registrar.rs b/dapps/src/tests/helpers/registrar.rs index 58aad9886..d7890675b 100644 --- a/dapps/src/tests/helpers/registrar.rs +++ b/dapps/src/tests/helpers/registrar.rs @@ -17,7 +17,7 @@ use std::str; use std::sync::Arc; use std::collections::HashMap; -use rustc_serialize::hex::FromHex; +use rustc_hex::FromHex; use hash_fetch::urlhint::ContractClient; use util::{Bytes, Address, Mutex, H256, ToPretty}; diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 168cf803c..99986d6da 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -46,6 +46,7 @@ num_cpus = "1.2" rand = "0.3" rlp = { path = "../util/rlp" } rust-crypto = "0.2.34" +rustc-hex = "1.0" rustc-serialize = "0.3" semver = "0.6" stats = { path = "../util/stats" } diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index 8f66c270d..4412df567 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -1460,7 +1460,7 @@ impl BlockChain { mod tests { #![cfg_attr(feature="dev", allow(similar_names))] use std::sync::Arc; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use util::kvdb::KeyValueDB; use util::hash::*; use util::sha3::Hashable; diff --git a/ethcore/src/builtin.rs b/ethcore/src/builtin.rs index 90190ac8e..084be4666 100644 --- a/ethcore/src/builtin.rs +++ b/ethcore/src/builtin.rs @@ -500,7 +500,7 @@ mod tests { use super::{Builtin, Linear, ethereum_builtin, Pricer, Modexp}; use ethjson; use util::{U256, BytesRef}; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; #[test] fn identity() { @@ -524,7 +524,6 @@ mod tests { #[test] fn sha256() { - use rustc_serialize::hex::FromHex; let f = ethereum_builtin("sha256"); let i = [0u8; 0]; @@ -548,7 +547,6 @@ mod tests { #[test] fn ripemd160() { - use rustc_serialize::hex::FromHex; let f = ethereum_builtin("ripemd160"); let i = [0u8; 0]; @@ -568,7 +566,6 @@ mod tests { #[test] fn ecrecover() { - use rustc_serialize::hex::FromHex; /*let k = KeyPair::from_secret(b"test".sha3()).unwrap(); let a: Address = From::from(k.public().sha3()); println!("Address: {}", a); @@ -627,7 +624,6 @@ mod tests { #[test] fn modexp() { - use rustc_serialize::hex::FromHex; let f = Builtin { pricer: Box::new(Modexp { divisor: 20 }), @@ -714,7 +710,6 @@ mod tests { #[test] fn bn128_add() { - use rustc_serialize::hex::FromHex; let f = Builtin { pricer: Box::new(Linear { base: 0, word: 0 }), @@ -776,7 +771,6 @@ mod tests { #[test] fn bn128_mul() { - use rustc_serialize::hex::FromHex; let f = Builtin { pricer: Box::new(Linear { base: 0, word: 0 }), diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index 19fdd74c8..e656e6c42 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -17,6 +17,7 @@ //! Test client. use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder}; +use rustc_hex::FromHex; use util::*; use rlp::*; use ethkey::{Generator, Random}; diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index 70d4e0ced..e7d0dab86 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -651,6 +651,7 @@ impl Engine for Tendermint { #[cfg(test)] mod tests { + use rustc_hex::FromHex; use util::*; use block::*; use error::{Error, BlockError}; diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index c2d3fd064..46f5c8512 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -126,6 +126,7 @@ impl ValidatorSet for ValidatorContract { #[cfg(test)] mod tests { + use rustc_hex::FromHex; use util::*; use rlp::encode; use spec::Spec; diff --git a/ethcore/src/engines/validator_set/safe_contract.rs b/ethcore/src/engines/validator_set/safe_contract.rs index de8d16ddc..e999439ee 100644 --- a/ethcore/src/engines/validator_set/safe_contract.rs +++ b/ethcore/src/engines/validator_set/safe_contract.rs @@ -420,6 +420,7 @@ impl ValidatorSet for ValidatorSafeContract { #[cfg(test)] mod tests { + use rustc_hex::FromHex; use util::*; use types::ids::BlockId; use spec::Spec; diff --git a/ethcore/src/env_info.rs b/ethcore/src/env_info.rs index cc42008d5..4f6a330b0 100644 --- a/ethcore/src/env_info.rs +++ b/ethcore/src/env_info.rs @@ -76,8 +76,6 @@ impl From for EnvInfo { #[cfg(test)] mod tests { - extern crate rustc_serialize; - use std::str::FromStr; use super::*; use util::{U256, Address}; diff --git a/ethcore/src/evm/interpreter/shared_cache.rs b/ethcore/src/evm/interpreter/shared_cache.rs index ed3b59340..a93afa79a 100644 --- a/ethcore/src/evm/interpreter/shared_cache.rs +++ b/ethcore/src/evm/interpreter/shared_cache.rs @@ -92,7 +92,7 @@ impl Default for SharedCache { #[test] fn test_find_jump_destinations() { - use util::FromHex; + use rustc_hex::FromHex; // given let code = "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b01600055".from_hex().unwrap(); diff --git a/ethcore/src/evm/tests.rs b/ethcore/src/evm/tests.rs index 7f3cf0e1c..f7d82daa4 100644 --- a/ethcore/src/evm/tests.rs +++ b/ethcore/src/evm/tests.rs @@ -14,12 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +use std::fmt::Debug; +use rustc_hex::FromHex; use util::*; use action_params::{ActionParams, ActionValue}; use env_info::EnvInfo; use types::executed::CallType; use evm::{self, Ext, Schedule, Factory, GasLeft, VMType, ContractCreateResult, MessageCallResult, CreateContractAddress, ReturnData}; -use std::fmt::Debug; use tests::helpers::*; use types::transaction::SYSTEM_ADDRESS; use executive::Executive; diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index b486aa8d4..4038fe30d 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -578,9 +578,10 @@ impl<'a, B: 'a + StateBackend, E: Engine + ?Sized> Executive<'a, B, E> { #[allow(dead_code)] mod tests { use std::sync::Arc; + use rustc_hex::FromHex; use ethkey::{Generator, Random}; use super::*; - use util::{H256, U256, U512, Address, FromHex, FromStr}; + use util::{H256, U256, U512, Address, FromStr}; use util::bytes::BytesRef; use action_params::{ActionParams, ActionValue}; use env_info::EnvInfo; diff --git a/ethcore/src/header.rs b/ethcore/src/header.rs index aa114c01e..f5bf1dcfd 100644 --- a/ethcore/src/header.rs +++ b/ethcore/src/header.rs @@ -305,7 +305,7 @@ impl HeapSizeOf for Header { #[cfg(test)] mod tests { - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use rlp; use super::Header; diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 7dc49fff8..746a737bf 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -99,6 +99,7 @@ extern crate num_cpus; extern crate num; extern crate rand; extern crate rlp; +extern crate rustc_hex; extern crate rustc_serialize; extern crate semver; extern crate stats; diff --git a/ethcore/src/miner/banning_queue.rs b/ethcore/src/miner/banning_queue.rs index 20b46d760..46d7e7cf8 100644 --- a/ethcore/src/miner/banning_queue.rs +++ b/ethcore/src/miner/banning_queue.rs @@ -209,13 +209,14 @@ impl DerefMut for BanningTransactionQueue { #[cfg(test)] mod tests { use std::time::Duration; + use rustc_hex::FromHex; use super::{BanningTransactionQueue, Threshold}; use ethkey::{Random, Generator}; use transaction::{Transaction, SignedTransaction, Action}; use error::{Error, TransactionError}; use client::TransactionImportResult; use miner::{TransactionQueue, TransactionOrigin}; - use util::{U256, Address, FromHex, Hashable}; + use util::{U256, Address, Hashable}; use miner::transaction_queue::test::DummyTransactionDetailsProvider; fn queue() -> BanningTransactionQueue { diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index c772490ba..208c778bc 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -1261,10 +1261,11 @@ mod tests { use std::sync::Arc; use std::time::Duration; + use rustc_hex::FromHex; use super::super::{MinerService, PrioritizationStrategy}; use super::*; use block::IsBlock; - use util::{U256, FromHex}; + use util::U256; use ethkey::{Generator, Random}; use client::{BlockChainClient, TestBlockChainClient, EachBlockWith, TransactionImportResult}; use header::BlockNumber; diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index d833f8f6a..8da9f7150 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -27,13 +27,13 @@ //! extern crate ethcore_util as util; //! extern crate ethcore; //! extern crate ethkey; -//! extern crate rustc_serialize; +//! extern crate rustc_hex; //! //! use util::{U256, Address}; //! use ethkey::{Random, Generator}; //! use ethcore::miner::{TransactionQueue, RemovalReason, TransactionQueueDetailsProvider, AccountDetails, TransactionOrigin}; //! use ethcore::transaction::*; -//! use rustc_serialize::hex::FromHex; +//! use rustc_hex::FromHex; //! //! #[derive(Default)] //! struct DummyTransactionDetailsProvider; @@ -1422,7 +1422,7 @@ fn check_if_removed(sender: &Address, nonce: &U256, dropped: Option for PendingTransaction { #[test] fn sender_test() { - let t: UnverifiedTransaction = decode(&::rustc_serialize::hex::FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap()); + let t: UnverifiedTransaction = decode(&::rustc_hex::FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap()); assert_eq!(t.data, b""); assert_eq!(t.gas, U256::from(0x5208u64)); assert_eq!(t.gas_price, U256::from(0x01u64)); @@ -612,7 +612,7 @@ fn should_recover_from_network_specific_signing() { #[test] fn should_agree_with_vitalik() { - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; let test_vector = |tx_data: &str, address: &'static str| { let signed = decode(&FromHex::from_hex(tx_data).unwrap()); diff --git a/ethcore/src/views/block.rs b/ethcore/src/views/block.rs index 463eb7240..f00ca548f 100644 --- a/ethcore/src/views/block.rs +++ b/ethcore/src/views/block.rs @@ -163,7 +163,7 @@ impl<'a> Hashable for BlockView<'a> { #[cfg(test)] mod tests { use std::str::FromStr; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use util::H256; use super::BlockView; diff --git a/ethcore/src/views/body.rs b/ethcore/src/views/body.rs index c32796628..038e152b0 100644 --- a/ethcore/src/views/body.rs +++ b/ethcore/src/views/body.rs @@ -130,7 +130,7 @@ impl<'a> BodyView<'a> { #[cfg(test)] mod tests { - use util::*; + use rustc_hex::FromHex; use super::BodyView; use blockchain::BlockChain; diff --git a/ethcore/src/views/header.rs b/ethcore/src/views/header.rs index 618728525..4506d98ec 100644 --- a/ethcore/src/views/header.rs +++ b/ethcore/src/views/header.rs @@ -104,7 +104,7 @@ impl<'a> Hashable for HeaderView<'a> { #[cfg(test)] mod tests { use std::str::FromStr; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use util::{H256, Address, H2048, U256}; use super::HeaderView; diff --git a/ethcore/src/views/transaction.rs b/ethcore/src/views/transaction.rs index 0b5b2e1ff..11c7fc2f1 100644 --- a/ethcore/src/views/transaction.rs +++ b/ethcore/src/views/transaction.rs @@ -77,7 +77,7 @@ impl<'a> Hashable for TransactionView<'a> { #[cfg(test)] mod tests { use std::str::FromStr; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use util::U256; use super::TransactionView; diff --git a/ethkey/Cargo.toml b/ethkey/Cargo.toml index 7d038a7f7..342410adc 100644 --- a/ethkey/Cargo.toml +++ b/ethkey/Cargo.toml @@ -8,7 +8,7 @@ rand = "0.3.14" lazy_static = "0.2" tiny-keccak = "1.2" eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" } -rustc-serialize = "0.3" +rustc-hex = "1.0" ethcore-bigint = { path = "../util/bigint" } rust-crypto = "0.2" byteorder = "1.0" diff --git a/ethkey/cli/Cargo.toml b/ethkey/cli/Cargo.toml index 01cc9849f..b8da13908 100644 --- a/ethkey/cli/Cargo.toml +++ b/ethkey/cli/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] [dependencies] ethkey = { path = "../" } -rustc-serialize = "0.3" +rustc-hex = "1.0" docopt = "0.7" [[bin]] diff --git a/ethkey/cli/src/main.rs b/ethkey/cli/src/main.rs index 757c8198f..53a6adb4d 100644 --- a/ethkey/cli/src/main.rs +++ b/ethkey/cli/src/main.rs @@ -15,13 +15,13 @@ // along with Parity. If not, see . extern crate docopt; -extern crate rustc_serialize; +extern crate rustc_hex; extern crate ethkey; use std::{env, fmt, process}; use std::num::ParseIntError; use docopt::Docopt; -use rustc_serialize::hex::{FromHex, FromHexError}; +use rustc_hex::{FromHex, FromHexError}; use ethkey::{KeyPair, Random, Brain, Prefix, Error as EthkeyError, Generator, sign, verify_public, verify_address}; pub const USAGE: &'static str = r#" diff --git a/ethkey/src/keypair.rs b/ethkey/src/keypair.rs index 8975063d5..5a13d476b 100644 --- a/ethkey/src/keypair.rs +++ b/ethkey/src/keypair.rs @@ -16,7 +16,7 @@ use std::fmt; use secp256k1::key; -use rustc_serialize::hex::ToHex; +use rustc_hex::ToHex; use keccak::Keccak256; use super::{Secret, Public, Address, SECP256K1, Error}; diff --git a/ethkey/src/lib.rs b/ethkey/src/lib.rs index 60039b671..e87e198df 100644 --- a/ethkey/src/lib.rs +++ b/ethkey/src/lib.rs @@ -19,7 +19,7 @@ extern crate rand; extern crate lazy_static; extern crate tiny_keccak; extern crate secp256k1; -extern crate rustc_serialize; +extern crate rustc_hex; extern crate ethcore_bigint as bigint; extern crate crypto as rcrypto; extern crate byteorder; diff --git a/ethkey/src/signature.rs b/ethkey/src/signature.rs index 91fe3e2a3..67115c98b 100644 --- a/ethkey/src/signature.rs +++ b/ethkey/src/signature.rs @@ -21,7 +21,7 @@ use std::str::FromStr; use std::hash::{Hash, Hasher}; use secp256k1::{Message as SecpMessage, RecoverableSignature, RecoveryId, Error as SecpError}; use secp256k1::key::{SecretKey, PublicKey}; -use rustc_serialize::hex::{ToHex, FromHex}; +use rustc_hex::{ToHex, FromHex}; use bigint::hash::{H520, H256}; use {Secret, Public, SECP256K1, Error, Message, public_to_address, Address}; diff --git a/ethstore/Cargo.toml b/ethstore/Cargo.toml index a2efaf286..62263d801 100755 --- a/ethstore/Cargo.toml +++ b/ethstore/Cargo.toml @@ -11,7 +11,7 @@ ethkey = { path = "../ethkey" } serde = "0.9" serde_json = "0.9" serde_derive = "0.9" -rustc-serialize = "0.3" +rustc-hex = "1.0" rust-crypto = "0.2.36" tiny-keccak = "1.0" time = "0.1.34" diff --git a/ethstore/cli/Cargo.toml b/ethstore/cli/Cargo.toml index 28e210cec..09ec9d13f 100644 --- a/ethstore/cli/Cargo.toml +++ b/ethstore/cli/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -rustc-serialize = "0.3" +rustc-hex = "1.0" docopt = "0.7" ethstore = { path = "../" } diff --git a/ethstore/cli/src/main.rs b/ethstore/cli/src/main.rs index 3e8df3a35..b73f06711 100644 --- a/ethstore/cli/src/main.rs +++ b/ethstore/cli/src/main.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -extern crate rustc_serialize; +extern crate rustc_hex; extern crate docopt; extern crate ethstore; diff --git a/ethstore/src/json/bytes.rs b/ethstore/src/json/bytes.rs index c7ecfec4c..3a48fa2a1 100644 --- a/ethstore/src/json/bytes.rs +++ b/ethstore/src/json/bytes.rs @@ -17,7 +17,7 @@ use std::{ops, str}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::de::Error; -use rustc_serialize::hex::{ToHex, FromHex, FromHexError}; +use rustc_hex::{ToHex, FromHex, FromHexError}; #[derive(Debug, PartialEq)] pub struct Bytes(Vec); diff --git a/ethstore/src/json/hash.rs b/ethstore/src/json/hash.rs index 328f155c2..43920c3a0 100644 --- a/ethstore/src/json/hash.rs +++ b/ethstore/src/json/hash.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use std::{ops, fmt, str}; -use rustc_serialize::hex::{FromHex, ToHex}; +use rustc_hex::{FromHex, ToHex}; use serde::{Serialize, Serializer, Deserialize, Deserializer}; use serde::de::{Visitor, Error as SerdeError}; use super::Error; diff --git a/ethstore/src/json/id.rs b/ethstore/src/json/id.rs index 8dfcc3028..a1db0ccc5 100644 --- a/ethstore/src/json/id.rs +++ b/ethstore/src/json/id.rs @@ -16,7 +16,7 @@ //! Universaly unique identifier. use std::{fmt, str}; -use rustc_serialize::hex::{ToHex, FromHex}; +use rustc_hex::{ToHex, FromHex}; use serde::{Deserialize, Serialize, Deserializer, Serializer}; use serde::de::{Visitor, Error as SerdeError}; use super::Error; diff --git a/ethstore/src/lib.rs b/ethstore/src/lib.rs index 06a8259de..65935f89c 100755 --- a/ethstore/src/lib.rs +++ b/ethstore/src/lib.rs @@ -23,7 +23,7 @@ extern crate itertools; extern crate libc; extern crate parking_lot; extern crate rand; -extern crate rustc_serialize; +extern crate rustc_hex; extern crate serde; extern crate serde_json; extern crate smallvec; diff --git a/evmbin/Cargo.toml b/evmbin/Cargo.toml index 55defab7b..c43a48042 100644 --- a/evmbin/Cargo.toml +++ b/evmbin/Cargo.toml @@ -9,6 +9,7 @@ name = "parity-evm" path = "./src/main.rs" [dependencies] +rustc-hex = "1.0" rustc-serialize = "0.3" docopt = { version = "0.7" } ethcore = { path = "../ethcore" } diff --git a/evmbin/benches/mod.rs b/evmbin/benches/mod.rs index 7ddc50681..a3017c37e 100644 --- a/evmbin/benches/mod.rs +++ b/evmbin/benches/mod.rs @@ -26,14 +26,14 @@ extern crate test; extern crate ethcore; extern crate evm; extern crate ethcore_util; -extern crate rustc_serialize; +extern crate rustc_hex; use self::test::{Bencher, black_box}; use evm::run_vm; use ethcore::action_params::ActionParams; use ethcore_util::U256; -use rustc_serialize::hex::FromHex; +use rustc_hex::FromHex; #[bench] fn simple_loop_usize(b: &mut Bencher) { diff --git a/evmbin/src/display/json.rs b/evmbin/src/display/json.rs index 38265c14c..1791640d6 100644 --- a/evmbin/src/display/json.rs +++ b/evmbin/src/display/json.rs @@ -122,7 +122,7 @@ impl trace::VMTracer for Informant { fn prepare_subtrace(&self, code: &[u8]) -> Self where Self: Sized { let mut vm = Informant::default(); vm.depth = self.depth + 1; - vm.code = code.into_vec(); + vm.code = code.to_vec(); vm.gas_used = self.gas_used; vm } diff --git a/evmbin/src/main.rs b/evmbin/src/main.rs index a7d90b90b..ab4ddc4c1 100644 --- a/evmbin/src/main.rs +++ b/evmbin/src/main.rs @@ -19,6 +19,7 @@ #![warn(missing_docs)] #![allow(dead_code)] extern crate ethcore; +extern crate rustc_hex; extern crate rustc_serialize; extern crate docopt; extern crate ethcore_util as util; @@ -26,7 +27,8 @@ extern crate ethcore_util as util; use std::sync::Arc; use std::{fmt, fs}; use docopt::Docopt; -use util::{U256, FromHex, Bytes, Address}; +use rustc_hex::FromHex; +use util::{U256, Bytes, Address}; use ethcore::spec; use ethcore::action_params::ActionParams; diff --git a/hash-fetch/Cargo.toml b/hash-fetch/Cargo.toml index 600402559..b02a74f64 100644 --- a/hash-fetch/Cargo.toml +++ b/hash-fetch/Cargo.toml @@ -13,7 +13,7 @@ log = "0.3" mime = "0.2" mime_guess = "1.6.1" rand = "0.3" -rustc-serialize = "0.3" +rustc-hex = "1.0" fetch = { path = "../util/fetch" } ethcore-util = { path = "../util" } parity-reactor = { path = "../util/reactor" } diff --git a/hash-fetch/src/lib.rs b/hash-fetch/src/lib.rs index 9019f744d..4952ecea2 100644 --- a/hash-fetch/src/lib.rs +++ b/hash-fetch/src/lib.rs @@ -30,7 +30,7 @@ extern crate mime_guess; extern crate native_contracts; extern crate parity_reactor; extern crate rand; -extern crate rustc_serialize; +extern crate rustc_hex; pub extern crate fetch; diff --git a/hash-fetch/src/urlhint.rs b/hash-fetch/src/urlhint.rs index cd7d2a2c5..bc4b63cf2 100644 --- a/hash-fetch/src/urlhint.rs +++ b/hash-fetch/src/urlhint.rs @@ -17,7 +17,7 @@ //! URLHint Contract use std::sync::Arc; -use rustc_serialize::hex::ToHex; +use rustc_hex::ToHex; use mime::Mime; use mime_guess; @@ -209,7 +209,7 @@ fn guess_mime_type(url: &str) -> Option { pub mod tests { use std::sync::Arc; use std::str::FromStr; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use futures::{BoxFuture, Future, IntoFuture}; diff --git a/hw/Cargo.toml b/hw/Cargo.toml index ca236d130..261721470 100644 --- a/hw/Cargo.toml +++ b/hw/Cargo.toml @@ -15,4 +15,4 @@ ethkey = { path = "../ethkey" } ethcore-bigint = { path = "../util/bigint" } [dev-dependencies] -rustc-serialize = "0.3" +rustc-hex = "1.0" diff --git a/hw/src/ledger.rs b/hw/src/ledger.rs index 2f209afa5..0d787588d 100644 --- a/hw/src/ledger.rs +++ b/hw/src/ledger.rs @@ -340,7 +340,7 @@ impl Manager { #[test] fn smoke() { - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; let mut manager = Manager::new().unwrap(); manager.update_devices().unwrap(); for d in &manager.devices { diff --git a/hw/src/lib.rs b/hw/src/lib.rs index a35607305..cda6c2241 100644 --- a/hw/src/lib.rs +++ b/hw/src/lib.rs @@ -22,7 +22,7 @@ extern crate libusb; extern crate ethkey; extern crate ethcore_bigint as bigint; #[macro_use] extern crate log; -#[cfg(test)] extern crate rustc_serialize; +#[cfg(test)] extern crate rustc_hex; mod ledger; diff --git a/json/Cargo.toml b/json/Cargo.toml index 577d0d9e8..d0fec9933 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] [dependencies] ethcore-util = { path = "../util" } -rustc-serialize = "0.3" +rustc-hex = "1.0" serde = "0.9" serde_json = "0.9" serde_derive = "0.9" diff --git a/json/src/bytes.rs b/json/src/bytes.rs index 0900ec999..5b474ba7d 100644 --- a/json/src/bytes.rs +++ b/json/src/bytes.rs @@ -19,7 +19,7 @@ use std::fmt; use std::str::FromStr; use std::ops::Deref; -use rustc_serialize::hex::FromHex; +use rustc_hex::FromHex; use serde::{Deserialize, Deserializer}; use serde::de::{Error, Visitor}; diff --git a/json/src/hash.rs b/json/src/hash.rs index 78fa77bd9..6a2df6515 100644 --- a/json/src/hash.rs +++ b/json/src/hash.rs @@ -20,7 +20,7 @@ use std::str::FromStr; use std::fmt; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::de::{Error, Visitor}; -use rustc_serialize::hex::ToHex; +use rustc_hex::ToHex; use util::hash::{H64 as Hash64, H160 as Hash160, H256 as Hash256, H520 as Hash520, H2048 as Hash2048}; diff --git a/json/src/lib.rs b/json/src/lib.rs index b65b18cab..c03b9f439 100644 --- a/json/src/lib.rs +++ b/json/src/lib.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -extern crate rustc_serialize; +extern crate rustc_hex; extern crate serde; extern crate serde_json; extern crate ethcore_util as util; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index c2fe7fb8a..7b083a3ac 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -15,7 +15,7 @@ multihash ="0.6" order-stat = "0.1" rand = "0.3" rust-crypto = "0.2" -rustc-serialize = "0.3" +rustc-hex = "1.0" semver = "0.6" serde = "0.9" serde_derive = "0.9" diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 7b8e207b8..38dafc0a4 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -26,7 +26,7 @@ extern crate futures; extern crate multihash; extern crate order_stat; extern crate rand; -extern crate rustc_serialize; +extern crate rustc_hex; extern crate semver; extern crate serde; extern crate serde_json; diff --git a/rpc/src/v1/helpers/secretstore.rs b/rpc/src/v1/helpers/secretstore.rs index 9563302d9..246d0fa3f 100644 --- a/rpc/src/v1/helpers/secretstore.rs +++ b/rpc/src/v1/helpers/secretstore.rs @@ -99,7 +99,7 @@ fn decrypt_with_shadow_coefficients(mut decrypted_shadow: Public, mut common_sha #[cfg(test)] mod tests { use util::Bytes; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use super::{encrypt_document, decrypt_document, decrypt_document_with_shadow}; #[test] diff --git a/rpc/src/v1/tests/mocked/eth.rs b/rpc/src/v1/tests/mocked/eth.rs index 3f158f1c5..33d46c04f 100644 --- a/rpc/src/v1/tests/mocked/eth.rs +++ b/rpc/src/v1/tests/mocked/eth.rs @@ -18,7 +18,7 @@ use std::str::FromStr; use std::collections::HashMap; use std::sync::Arc; use std::time::{Instant, Duration}; -use rustc_serialize::hex::{FromHex, ToHex}; +use rustc_hex::{FromHex, ToHex}; use time::get_time; use rlp; @@ -536,7 +536,7 @@ fn rpc_eth_transaction_count_by_number_pending() { #[test] fn rpc_eth_pending_transaction_by_hash() { - use util::{H256, FromHex}; + use util::H256; use rlp; use ethcore::transaction::SignedTransaction; diff --git a/rpc/src/v1/tests/mocked/parity_set.rs b/rpc/src/v1/tests/mocked/parity_set.rs index cff9e710d..443379b4f 100644 --- a/rpc/src/v1/tests/mocked/parity_set.rs +++ b/rpc/src/v1/tests/mocked/parity_set.rs @@ -16,7 +16,7 @@ use std::sync::Arc; use std::str::FromStr; -use rustc_serialize::hex::FromHex; +use rustc_hex::FromHex; use util::{U256, Address}; use ethcore::miner::MinerService; diff --git a/rpc/src/v1/types/bytes.rs b/rpc/src/v1/types/bytes.rs index b290dd5ac..22a74f97d 100644 --- a/rpc/src/v1/types/bytes.rs +++ b/rpc/src/v1/types/bytes.rs @@ -17,10 +17,9 @@ //! Serializable wrapper around vector of bytes use std::fmt; -use rustc_serialize::hex::ToHex; +use rustc_hex::{ToHex, FromHex}; use serde::{Serialize, Serializer, Deserialize, Deserializer}; use serde::de::{Error, Visitor}; -use util::common::FromHex; /// Wrapper structure around vector of bytes. #[derive(Debug, PartialEq, Eq, Default, Hash, Clone)] @@ -98,7 +97,7 @@ impl Visitor for BytesVisitor { mod tests { use super::*; use serde_json; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; #[test] fn test_bytes_serialize() { diff --git a/rpc/src/v1/types/call_request.rs b/rpc/src/v1/types/call_request.rs index 04c9efcaf..71b562e45 100644 --- a/rpc/src/v1/types/call_request.rs +++ b/rpc/src/v1/types/call_request.rs @@ -55,7 +55,7 @@ impl Into for CallRequest { #[cfg(test)] mod tests { use std::str::FromStr; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use serde_json; use v1::types::{U256, H160}; use super::CallRequest; diff --git a/rpc/src/v1/types/hash.rs b/rpc/src/v1/types/hash.rs index 2f230510d..166aebfa3 100644 --- a/rpc/src/v1/types/hash.rs +++ b/rpc/src/v1/types/hash.rs @@ -19,7 +19,7 @@ use std::str::FromStr; use std::cmp::Ordering; use std::hash::{Hash, Hasher}; use serde; -use rustc_serialize::hex::{ToHex, FromHex}; +use rustc_hex::{ToHex, FromHex}; use util::{H64 as Eth64, H160 as Eth160, H256 as Eth256, H520 as Eth520, H512 as Eth512, H2048 as Eth2048}; macro_rules! impl_hash { diff --git a/rpc/src/v1/types/transaction_request.rs b/rpc/src/v1/types/transaction_request.rs index 242c02360..cb74e071b 100644 --- a/rpc/src/v1/types/transaction_request.rs +++ b/rpc/src/v1/types/transaction_request.rs @@ -131,7 +131,7 @@ impl Into for TransactionRequest { #[cfg(test)] mod tests { use std::str::FromStr; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use serde_json; use v1::types::{U256, H160, TransactionCondition}; use super::*; diff --git a/rpc_cli/Cargo.toml b/rpc_cli/Cargo.toml index 2a473a6ab..52fc58fe4 100644 --- a/rpc_cli/Cargo.toml +++ b/rpc_cli/Cargo.toml @@ -9,7 +9,7 @@ version = "1.4.0" [dependencies] futures = "0.1" rpassword = "0.3.0" -bigint = "2.0" +bigint = "3.0" parity-rpc = { path = "../rpc" } parity-rpc-client = { path = "../rpc_client" } ethcore-util = { path = "../util" } diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index d31ebe11d..2d7eccfa4 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -19,7 +19,7 @@ serde_json = "0.9" serde_derive = "0.9" futures = "0.1" futures-cpupool = "0.1" -rustc-serialize = "0.3" +rustc-hex = "1.0" tokio-core = "0.1.6" tokio-io = "0.1.0" tokio-service = "0.1" diff --git a/secret_store/src/lib.rs b/secret_store/src/lib.rs index 209a32cc2..4176bd322 100644 --- a/secret_store/src/lib.rs +++ b/secret_store/src/lib.rs @@ -22,7 +22,7 @@ extern crate futures; extern crate futures_cpupool; extern crate hyper; extern crate parking_lot; -extern crate rustc_serialize; +extern crate rustc_hex; extern crate serde; extern crate serde_json; #[macro_use] diff --git a/secret_store/src/serialization.rs b/secret_store/src/serialization.rs index c88e9edf7..4b42311cf 100644 --- a/secret_store/src/serialization.rs +++ b/secret_store/src/serialization.rs @@ -17,7 +17,7 @@ use std::fmt; use std::cmp::{Ord, PartialOrd, Ordering}; use std::ops::Deref; -use rustc_serialize::hex::{ToHex, FromHex}; +use rustc_hex::{ToHex, FromHex}; use serde::{Serialize, Deserialize, Serializer, Deserializer}; use serde::de::{Visitor, Error as SerdeError}; use ethkey::{Public, Secret, Signature}; diff --git a/util/Cargo.toml b/util/Cargo.toml index 0af5635ab..8a0928ff5 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -10,7 +10,7 @@ build = "build.rs" [dependencies] log = "0.3" env_logger = "0.4" -rustc-serialize = "0.3" +rustc-hex = "1.0" rand = "0.3.12" time = "0.1.34" rocksdb = { git = "https://github.com/paritytech/rust-rocksdb" } @@ -26,7 +26,7 @@ ethcore-devtools = { path = "../devtools" } libc = "0.2.7" vergen = "0.1" target_info = "0.1" -ethcore-bigint = { path = "bigint" } +ethcore-bigint = { path = "bigint", features = ["heapsizeof"] } parking_lot = "0.4" using_queue = { path = "using_queue" } table = { path = "table" } diff --git a/util/benches/bigint.rs b/util/benches/bigint.rs deleted file mode 100644 index 59377c511..000000000 --- a/util/benches/bigint.rs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -//! benchmarking for bigint -//! should be started with: -//! ```bash -//! multirust run nightly cargo bench -//! ``` - -#![feature(test)] -#![feature(asm)] - -extern crate test; -extern crate ethcore_util; - -use test::{Bencher, black_box}; -use ethcore_util::{U256, U512, U128}; - -#[bench] -fn u256_add(b: &mut Bencher) { - b.iter(|| { - let n = black_box(10000); - let zero = black_box(U256::zero()); - (0..n).fold(zero, |old, new| { old.overflowing_add(U256::from(black_box(new))).0 }) - }); -} - -#[bench] -fn u256_sub(b: &mut Bencher) { - b.iter(|| { - let n = black_box(10000); - let max = black_box(U256::max_value()); - (0..n).fold(max, |old, new| { old.overflowing_sub(U256::from(black_box(new))).0 }) - }); -} - -#[bench] -fn u512_sub(b: &mut Bencher) { - b.iter(|| { - let n = black_box(10000); - let max = black_box(U512::max_value()); - (0..n).fold( - max, - |old, new| { - let new = black_box(new); - let p = new % 2; - old.overflowing_sub(U512([p, p, p, p, p, p, p, new])).0 - } - ) - }); -} - -#[bench] -fn u512_add(b: &mut Bencher) { - b.iter(|| { - let n = black_box(10000); - let zero = black_box(U512::zero()); - (0..n).fold(zero, - |old, new| { - let new = black_box(new); - old.overflowing_add(U512([new, new, new, new, new, new, new, new])).0 - }) - }); -} - -#[bench] -fn u256_mul(b: &mut Bencher) { - b.iter(|| { - let n = black_box(10000); - let one = black_box(U256::one()); - (0..n).fold(one, |old, new| { old.overflowing_mul(U256::from(black_box(new))).0 }) - }); -} - - -#[bench] -fn u256_full_mul(b: &mut Bencher) { - b.iter(|| { - let n = black_box(10000); - let one = black_box(U256::one()); - (0..n).fold(one, - |old, new| { - let new = black_box(new); - let U512(ref u512words) = old.full_mul(U256([new, new, new, new])); - U256([u512words[0], u512words[2], u512words[2], u512words[3]]) - }) - }); -} - - -#[bench] -fn u128_mul(b: &mut Bencher) { - b.iter(|| { - let n = black_box(10000); - (0..n).fold(U128([12345u64, 0u64]), |old, new| { old.overflowing_mul(U128::from(new)).0 }) - }); -} - diff --git a/util/bigint/Cargo.toml b/util/bigint/Cargo.toml index c1225f72c..477925334 100644 --- a/util/bigint/Cargo.toml +++ b/util/bigint/Cargo.toml @@ -8,12 +8,13 @@ version = "0.1.3" authors = ["Parity Technologies "] [dependencies] -bigint = "2.0" -rustc-serialize = "0.3" -heapsize = "0.4" +bigint = "3.0" +rustc-hex = "1.0" rand = "0.3.12" libc = "0.2" +heapsize = { version = "0.4", optional = true } [features] x64asm_arithmetic=[] rust_arithmetic=[] +heapsizeof = ["heapsize", "bigint/heapsizeof"] diff --git a/util/bigint/src/hash.rs b/util/bigint/src/hash.rs index 942ffc6fb..748236285 100644 --- a/util/bigint/src/hash.rs +++ b/util/bigint/src/hash.rs @@ -8,15 +8,14 @@ //! General hash types, a fixed-size raw-data type used as the output of hash functions. -use std::{ops, fmt, cmp}; +use std::{ops, fmt, cmp, str}; use std::cmp::{min, Ordering}; use std::ops::{Deref, DerefMut, BitXor, BitAnd, BitOr, IndexMut, Index}; use std::hash::{Hash, Hasher, BuildHasherDefault}; use std::collections::{HashMap, HashSet}; -use std::str::FromStr; use rand::Rng; use rand::os::OsRng; -use rustc_serialize::hex::{FromHex, FromHexError}; +use rustc_hex::{FromHex, FromHexError}; use bigint::U256; use libc::{c_void, memcmp}; @@ -141,7 +140,7 @@ macro_rules! impl_hash { } } - impl FromStr for $from { + impl str::FromStr for $from { type Err = FromHexError; fn from_str(s: &str) -> Result<$from, FromHexError> { @@ -349,9 +348,9 @@ macro_rules! impl_hash { fn from(s: &'static str) -> $from { let s = clean_0x(s); if s.len() % 2 == 1 { - $from::from_str(&("0".to_owned() + s)).unwrap() + ("0".to_owned() + s).parse().unwrap() } else { - $from::from_str(s).unwrap() + s.parse().unwrap() } } } @@ -435,6 +434,7 @@ impl_hash!(H520, 65); impl_hash!(H1024, 128); impl_hash!(H2048, 256); +#[cfg(feature="heapsizeof")] known_heap_size!(0, H32, H64, H128, H160, H256, H264, H512, H520, H1024, H2048); // Specialized HashMap and HashSet diff --git a/util/bigint/src/lib.rs b/util/bigint/src/lib.rs index ed22bfcfb..7a85de6a1 100644 --- a/util/bigint/src/lib.rs +++ b/util/bigint/src/lib.rs @@ -11,10 +11,13 @@ #![cfg_attr(asm_available, feature(asm))] extern crate rand; -extern crate rustc_serialize; +extern crate rustc_hex; extern crate bigint; extern crate libc; -#[macro_use] extern crate heapsize; + +#[cfg(feature="heapsizeof")] +#[macro_use] +extern crate heapsize; pub mod hash; diff --git a/util/network/Cargo.toml b/util/network/Cargo.toml index edbbefd17..63b5ad50e 100644 --- a/util/network/Cargo.toml +++ b/util/network/Cargo.toml @@ -20,6 +20,7 @@ igd = "0.6" libc = "0.2.7" parking_lot = "0.4" ansi_term = "0.9" +rustc-hex = "1.0" rustc-serialize = "0.3" ethcore-io = { path = "../io" } ethcore-util = { path = ".." } diff --git a/util/network/src/discovery.rs b/util/network/src/discovery.rs index ad995188d..138ba23ba 100644 --- a/util/network/src/discovery.rs +++ b/util/network/src/discovery.rs @@ -559,7 +559,7 @@ mod tests { use node_table::{Node, NodeId, NodeEndpoint}; use std::str::FromStr; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use ethkey::{Random, Generator}; use AllowIP; diff --git a/util/network/src/handshake.rs b/util/network/src/handshake.rs index 9f6474c39..f5c4e118a 100644 --- a/util/network/src/handshake.rs +++ b/util/network/src/handshake.rs @@ -331,7 +331,7 @@ impl Handshake { #[cfg(test)] mod test { use std::sync::Arc; - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use super::*; use util::hash::H256; use io::*; diff --git a/util/network/src/lib.rs b/util/network/src/lib.rs index 8fae474ff..80654d503 100644 --- a/util/network/src/lib.rs +++ b/util/network/src/lib.rs @@ -66,6 +66,7 @@ extern crate crypto as rcrypto; extern crate rand; extern crate time; extern crate ansi_term; //TODO: remove this +extern crate rustc_hex; extern crate rustc_serialize; extern crate igd; extern crate libc; diff --git a/util/rlp/Cargo.toml b/util/rlp/Cargo.toml index b6ca67984..aa682e469 100644 --- a/util/rlp/Cargo.toml +++ b/util/rlp/Cargo.toml @@ -10,5 +10,5 @@ authors = ["Parity Technologies "] elastic-array = "0.9" ethcore-bigint = { path = "../bigint" } lazy_static = "0.2" -rustc-serialize = "0.3" +rustc-hex = "1.0" byteorder = "1.0" diff --git a/util/rlp/src/lib.rs b/util/rlp/src/lib.rs index e7e20b17d..f7596b2bc 100644 --- a/util/rlp/src/lib.rs +++ b/util/rlp/src/lib.rs @@ -41,7 +41,7 @@ extern crate byteorder; extern crate ethcore_bigint as bigint; extern crate elastic_array; -extern crate rustc_serialize; +extern crate rustc_hex; #[macro_use] extern crate lazy_static; diff --git a/util/rlp/src/rlpin.rs b/util/rlp/src/rlpin.rs index 918db4d0c..f4f3d3d58 100644 --- a/util/rlp/src/rlpin.rs +++ b/util/rlp/src/rlpin.rs @@ -273,7 +273,7 @@ impl<'a, 'view> Iterator for RlpIterator<'a, 'view> { #[test] fn break_it() { - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; use bigint::prelude::U256; let h: Vec = FromHex::from_hex("f84d0589010efbef67941f79b2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").unwrap(); diff --git a/util/rlp/src/untrusted_rlp.rs b/util/rlp/src/untrusted_rlp.rs index bc47dee0f..c027438b0 100644 --- a/util/rlp/src/untrusted_rlp.rs +++ b/util/rlp/src/untrusted_rlp.rs @@ -8,7 +8,7 @@ use std::cell::Cell; use std::fmt; -use rustc_serialize::hex::ToHex; +use rustc_hex::ToHex; use impls::decode_usize; use {Decodable, DecoderError}; @@ -389,7 +389,7 @@ mod tests { #[test] fn test_rlp_display() { - use rustc_serialize::hex::FromHex; + use rustc_hex::FromHex; let data = "f84d0589010efbef67941f79b2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470".from_hex().unwrap(); let rlp = UntrustedRlp::new(&data); assert_eq!(format!("{}", rlp), "[\"0x05\", \"0x010efbef67941f79b2\", \"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\", \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"]"); diff --git a/util/src/error.rs b/util/src/error.rs index 5fcc6fd8f..4ed2fc9bd 100644 --- a/util/src/error.rs +++ b/util/src/error.rs @@ -16,7 +16,7 @@ //! General error types for use in ethcore. -use rustc_serialize::hex::FromHexError; +use rustc_hex::FromHexError; use rlp::DecoderError; use std::fmt; use hash::H256; diff --git a/util/src/lib.rs b/util/src/lib.rs index 5c988bbbc..c6a50f58b 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -87,7 +87,7 @@ //! cargo build --release //! ``` -extern crate rustc_serialize; +extern crate rustc_hex; extern crate rand; extern crate rocksdb; extern crate env_logger; diff --git a/util/src/standard.rs b/util/src/standard.rs index 6363eecd8..19521a5d5 100644 --- a/util/src/standard.rs +++ b/util/src/standard.rs @@ -39,11 +39,7 @@ pub use std::cmp::*; pub use std::sync::Arc; pub use std::collections::*; -pub use rustc_serialize::json::Json; -pub use rustc_serialize::base64::FromBase64; -pub use rustc_serialize::hex::{FromHex, FromHexError}; - pub use heapsize::HeapSizeOf; pub use itertools::Itertools; -pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard}; \ No newline at end of file +pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};