Deduplicating crate dependencies (part 3 of n) (#11614)

* Deduplicating crate dependencies (part 3 of n, `tiny_keccak`, `tokio-timer`, and co) (#11613)

The change includes:
```
tiny-keccak
tokio-timer
textwrap
winapi
rand
rand_xorshift
scopeguard
url
```

* Update rpc/src/v1/helpers/secretstore.rs

Co-Authored-By: Andronik Ordian <write@reusable.software>

* Update util/network-devp2p/src/connection.rs

Co-Authored-By: Andronik Ordian <write@reusable.software>

Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
Valentin Shergin 2020-04-09 02:03:27 -07:00 committed by GitHub
parent 12cbe93fbe
commit a5820b6ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 67 additions and 93 deletions

73
Cargo.lock generated
View File

@ -576,7 +576,7 @@ dependencies = [
"atty",
"bitflags",
"strsim 0.8.0",
"textwrap 0.11.0",
"textwrap",
"unicode-width",
"vec_map",
]
@ -1000,7 +1000,7 @@ dependencies = [
"rand 0.7.3",
"rlp",
"secp256k1",
"tiny-keccak 2.0.1",
"tiny-keccak 2.0.2",
"zeroize",
]
@ -1318,7 +1318,7 @@ dependencies = [
"mio",
"num_cpus",
"parking_lot 0.10.0",
"slab 0.4.2",
"slab",
"time",
"timer",
"tokio",
@ -1474,9 +1474,9 @@ dependencies = [
"secp256k1",
"serde",
"serde_json",
"slab 0.4.2",
"slab",
"tempfile",
"tiny-keccak 1.5.0",
"tiny-keccak 2.0.2",
]
[[package]]
@ -1522,7 +1522,7 @@ dependencies = [
"spec",
"state-db",
"time-utils",
"tiny-keccak 1.5.0",
"tiny-keccak 2.0.2",
"trace",
"transaction-pool",
"trie-db",
@ -1695,7 +1695,7 @@ dependencies = [
"smallvec 1.2.0",
"tempfile",
"time",
"tiny-keccak 1.5.0",
"tiny-keccak 2.0.2",
]
[[package]]
@ -2016,7 +2016,7 @@ dependencies = [
"http",
"indexmap",
"log",
"slab 0.4.2",
"slab",
"string",
"tokio-io",
]
@ -2187,7 +2187,7 @@ dependencies = [
"tokio-reactor",
"tokio-tcp",
"tokio-threadpool",
"tokio-timer 0.2.13",
"tokio-timer",
"want",
]
@ -2512,7 +2512,7 @@ dependencies = [
"jsonrpc-server-utils",
"log",
"parking_lot 0.10.0",
"slab 0.4.2",
"slab",
"ws",
]
@ -2533,7 +2533,7 @@ dependencies = [
"ethereum-types",
"hash-db",
"plain_hasher",
"tiny-keccak 1.5.0",
"tiny-keccak 2.0.2",
]
[[package]]
@ -2910,7 +2910,7 @@ dependencies = [
"log",
"miow 0.2.1",
"net2",
"slab 0.4.2",
"slab",
"winapi 0.2.8",
]
@ -2923,7 +2923,7 @@ dependencies = [
"lazycell",
"log",
"mio",
"slab 0.4.2",
"slab",
]
[[package]]
@ -3220,7 +3220,7 @@ dependencies = [
"spec",
"tempfile",
"term_size",
"textwrap 0.9.0",
"textwrap",
"toml",
"verification",
"winapi 0.3.8",
@ -3287,7 +3287,7 @@ dependencies = [
"secp256k1",
"sha2",
"subtle 2.2.2",
"tiny-keccak 2.0.1",
"tiny-keccak 2.0.2",
"zeroize",
]
@ -3414,8 +3414,8 @@ dependencies = [
"spec",
"stats",
"tempfile",
"tiny-keccak 1.5.0",
"tokio-timer 0.1.2",
"tiny-keccak 2.0.2",
"tokio-timer",
"trace",
"transaction-pool",
"transient-hashmap",
@ -4591,12 +4591,6 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e88f89a550c01e4cd809f3df4f52dc9e939f3273a2017eabd5c6d12fd98bb23"
[[package]]
name = "slab"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
[[package]]
name = "slab"
version = "0.4.2"
@ -4926,15 +4920,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
dependencies = [
"unicode-width",
]
[[package]]
name = "textwrap"
version = "0.11.0"
@ -5008,9 +4993,9 @@ dependencies = [
[[package]]
name = "tiny-keccak"
version = "2.0.1"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2953ca5148619bc99695c1274cb54c5275bbb913c6adad87e72eaf8db9787f69"
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
dependencies = [
"crunchy",
]
@ -5044,7 +5029,7 @@ dependencies = [
"tokio-sync",
"tokio-tcp",
"tokio-threadpool",
"tokio-timer 0.2.13",
"tokio-timer",
"tokio-udp",
"tokio-uds",
]
@ -5139,7 +5124,7 @@ dependencies = [
"mio",
"num_cpus",
"parking_lot 0.9.0",
"slab 0.4.2",
"slab",
"tokio-executor",
"tokio-io",
"tokio-sync",
@ -5205,20 +5190,10 @@ dependencies = [
"lazy_static",
"log",
"num_cpus",
"slab 0.4.2",
"slab",
"tokio-executor",
]
[[package]]
name = "tokio-timer"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6131e780037787ff1b3f8aad9da83bca02438b72277850dd6ad0d455e0e20efc"
dependencies = [
"futures",
"slab 0.3.0",
]
[[package]]
name = "tokio-timer"
version = "0.2.13"
@ -5227,7 +5202,7 @@ checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296"
dependencies = [
"crossbeam-utils",
"futures",
"slab 0.4.2",
"slab",
"tokio-executor",
]
@ -5825,7 +5800,7 @@ dependencies = [
"mio-extras",
"rand 0.7.3",
"sha-1",
"slab 0.4.2",
"slab",
"url 2.1.1",
]

View File

@ -76,7 +76,7 @@ serde_json = "1.0"
snapshot = { path = "ethcore/snapshot" }
spec = { path = "ethcore/spec" }
term_size = "0.3"
textwrap = "0.9"
textwrap = "0.11.0"
toml = "0.5.6"
verification = { path = "ethcore/verification" }
@ -90,7 +90,7 @@ tempfile = "3.1"
fake-fetch = { path = "util/fake-fetch" }
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.4", features = ["winsock2", "winuser", "shellapi"] }
winapi = { version = "0.3.8", features = ["winsock2", "winuser", "shellapi"] }
[features]
default = ["accounts"]

View File

@ -8,13 +8,13 @@ repository = "https://github.com/openethereum/openethereum"
[dependencies]
log = "0.4"
libc = "0.2"
rand = "0.7"
rand = "0.7.3"
ethkey = { path = "../ethkey" }
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
rustc-hex = "2.1.0"
tiny-keccak = "1.4"
tiny-keccak = "2.0.2"
time = "0.1.34"
parking_lot = "0.10.0"
parity-crypto = { version = "0.5.0", features = ["publickey"] }

View File

@ -12,7 +12,7 @@ futures = "0.1"
log = "0.4"
serde = "1.0"
serde_json = "1.0"
url = "2.1.0"
url = "2.1.1"
matches = "0.1"
parking_lot = "0.10.0"
jsonrpc-core = "14.0.3"

View File

@ -44,13 +44,13 @@ pod = { path = "pod", optional = true }
trie-db = "0.20.0"
parity-crypto = { version = "0.5.0", features = ["publickey"], optional = true }
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.7.3"
rand_xorshift = "0.2.0"
rayon = "1.1"
registrar = { path = "../util/registrar" }
rlp = "0.4.0"
rustc-hex = "2.1.0"
scopeguard = "1.0.0"
scopeguard = "1.1.0"
serde = "1.0"
serde_derive = "1.0"
snapshot = { path = "snapshot" }

View File

@ -19,7 +19,7 @@ itertools = "0.8.2"
kvdb = "0.4.0"
log = "0.4"
parity-bytes = "0.1"
rand = "0.7"
rand = "0.7.3"
parking_lot = "0.10.0"
rayon = "1.0"
rlp = "0.4.0"

View File

@ -28,7 +28,7 @@ lru-cache = "0.1"
machine = { path = "../../machine" }
parity-bytes = "0.1"
parking_lot = "0.10.0"
rand = "0.7"
rand = "0.7.3"
rlp = "0.4.0"
time-utils = { path = "../../../util/time-utils" }
unexpected = { path = "../../../util/unexpected" }

View File

@ -18,7 +18,7 @@ lazy_static = "1.3.0"
log = "0.4"
lru-cache = "0.1"
machine = { path = "../../machine" }
rand = "0.7"
rand = "0.7.3"
parking_lot = "0.10.0"
rlp = "0.4.0"
time-utils = { path = "../../../util/time-utils" }

View File

@ -33,7 +33,7 @@ rlp = "0.4.0"
rlp-derive = "0.1"
smallvec = "1.2.0"
futures = "0.1"
rand = "0.7"
rand = "0.7.3"
bincode = "1.1"
serde = "1.0"
serde_derive = "1.0"

View File

@ -45,10 +45,10 @@ serde_json = "1.0"
spec = { path = "../spec" }
state-db = { path = "../state-db" }
time-utils = { path = "../../util/time-utils" }
tiny-keccak = "1.4"
tiny-keccak = "2.0.2"
trace = { path = "../trace" }
transaction-pool = "2.0.1"
url = "2"
url = "2.1.1"
vm = { path = "../vm" }
[dev-dependencies]

View File

@ -32,12 +32,12 @@ keccak-hasher = { path = "../../util/keccak-hasher" }
kvdb = "0.4.0"
log = "0.4.8"
num_cpus = "1.10.1"
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.7.3"
rand_xorshift = "0.2.0"
parking_lot = "0.10.0"
rlp = "0.4.2"
rlp-derive = "0.1"
scopeguard = "1.0.0"
scopeguard = "1.1.0"
snappy = { package = "parity-snappy", version ="0.1.0" }
state-db = { path = "../state-db" }
trie-db = "0.20.0"

View File

@ -28,8 +28,8 @@ kvdb-rocksdb = "0.6.0"
log = "0.4.8"
parking_lot = "0.10.0"
parity-crypto = { version = "0.5.0", features = ["publickey"] }
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.7.3"
rand_xorshift = "0.2.0"
rlp = "0.4.2"
snappy = { package = "parity-snappy", version ="0.1.0" }
snapshot = { path = "../../snapshot", features = ["test-helpers"] }

View File

@ -28,7 +28,7 @@ network = { package = "ethcore-network", path = "../../util/network" }
parity-runtime = "0.1.1"
parity-crypto = { version = "0.5.0", features = ["publickey"] }
parity-util-mem = "0.5.1"
rand = "0.7"
rand = "0.7.3"
parking_lot = "0.10.0"
rlp = "0.4.0"
snapshot = { path = "../snapshot" }
@ -42,6 +42,6 @@ ethcore = { path = "..", features = ["test-helpers"] }
ethcore-io = { path = "../../util/io", features = ["mio"] }
kvdb-memorydb = "0.4.0"
machine = { path = "../machine" }
rand_xorshift = "0.2"
rand_xorshift = "0.2.0"
rustc-hex = "2.1.0"
spec = { path = "../spec" }

View File

@ -11,7 +11,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
ethash = { path = "../ethash", optional = true }
fetch = { path = "../util/fetch", optional = true }
hyper = { version = "0.12", optional = true }
url = { version = "2", optional = true }
url = { version = "2.1.1", optional = true }
# Miner
ansi_term = "0.11"

View File

@ -12,8 +12,8 @@ ansi_term = "0.11"
futures = "0.1.6"
log = "0.4"
order-stat = "0.1"
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.7.3"
rand_xorshift = "0.2.0"
rustc-hex = "2.1.0"
semver = "0.9"
serde = "1.0"
@ -21,8 +21,8 @@ serde_derive = "1.0"
serde_json = "1.0"
parking_lot = "0.10.0"
tempfile = "3.1"
tiny-keccak = "1.4"
tokio-timer = "0.1"
tiny-keccak = "2.0.2"
tokio-timer = "0.2.13"
transient-hashmap = "0.4"
itertools = "0.8.2"

View File

@ -23,7 +23,7 @@ use bytes::Bytes;
use jsonrpc_core::Error;
use v1::helpers::errors;
use v1::types::EncryptedDocumentKey;
use tiny_keccak::Keccak;
use tiny_keccak::{Keccak, Hasher};
/// Initialization vector length.
const INIT_VEC_LEN: usize = 16;
@ -95,7 +95,7 @@ pub fn decrypt_document_with_shadow(decrypted_secret: Public, common_point: Publ
/// Calculate Keccak(ordered servers set)
pub fn ordered_servers_keccak(servers_set: BTreeSet<H512>) -> H256 {
let mut servers_set_keccak = Keccak::new_keccak256();
let mut servers_set_keccak = Keccak::v256();
for server in servers_set {
servers_set_keccak.update(&server.0);
}

View File

@ -17,7 +17,7 @@
//! Parity-specific PUB-SUB rpc implementation.
use std::sync::Arc;
use std::time::Duration;
use std::time::{Duration, Instant};
use parking_lot::RwLock;
use jsonrpc_core::{self as core, Result, MetaIoHandler};
@ -43,12 +43,8 @@ impl<S: core::Middleware<Metadata>> PubSubClient<S> {
let poll_manager = Arc::new(RwLock::new(GenericPollManager::new(rpc)));
let pm2 = Arc::downgrade(&poll_manager);
let timer = tokio_timer::wheel()
.tick_duration(Duration::from_millis(500))
.build();
// Start ticking
let interval = timer.interval(Duration::from_millis(1000));
let interval = tokio_timer::Interval::new(Instant::now() + Duration::from_millis(500), Duration::from_millis(1000));
executor.spawn(interval
.map_err(|e| warn!("Polling timer error: {:?}", e))
.for_each(move |_| {

View File

@ -21,7 +21,7 @@ parity-bytes = "0.1"
parity-hash-fetch = { path = "hash-fetch" }
parity-path = "0.1"
parity-version = { path = "../util/version" }
rand = "0.7"
rand = "0.7.3"
parking_lot = "0.10.0"
semver = "0.9"
target_info = "0.1"

View File

@ -12,7 +12,7 @@ futures = "0.1"
log = "0.4"
mime = "0.3"
mime_guess = "2.0.1"
rand = "0.7"
rand = "0.7.3"
rustc-hex = "2.1.0"
fetch = { path = "../../util/fetch" }
parity-bytes = "0.1"

View File

@ -13,7 +13,7 @@ hyper-rustls = "0.18"
http = "0.1"
log = "0.4"
tokio = "0.1.22"
url = "2"
url = "2.1.1"
bytes = "0.4"
[features]

View File

@ -8,6 +8,6 @@ license = "GPL-3.0"
[dependencies]
ethereum-types = "0.8.0"
tiny-keccak = "1.4.2"
tiny-keccak = "2.0.2"
hash-db = "0.15.0"
plain_hasher = "0.2"

View File

@ -31,8 +31,11 @@ impl Hasher for KeccakHasher {
type StdHasher = PlainHasher;
const LENGTH: usize = 32;
fn hash(x: &[u8]) -> Self::Out {
use tiny_keccak::Hasher;
let mut out = [0; 32];
Keccak::keccak256(x, &mut out);
let mut keccak256 = Keccak::v256();
keccak256.update(x);
keccak256.finalize(&mut out);
out.into()
}
}

View File

@ -28,13 +28,13 @@ parity-crypto = { version = "0.5.0", features = ["publickey"] }
parity-path = "0.1"
parity-snappy = "0.1"
parking_lot = "0.10.0"
rand = "0.7"
rand = "0.7.3"
rlp = "0.4.0"
secp256k1 = "0.17"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
slab = "0.4.2"
tiny-keccak = "1.4"
tiny-keccak = "2.0.2"
[dev-dependencies]
assert_matches = "1.2"

View File

@ -31,7 +31,7 @@ use mio::deprecated::{EventLoop, Handler, TryRead, TryWrite};
use mio::tcp::TcpStream;
use parity_bytes::Bytes;
use rlp::{Rlp, RlpStream};
use tiny_keccak::Keccak;
use tiny_keccak::{Keccak, Hasher};
use ethcore_io::{IoContext, StreamToken};
use network::Error;
@ -329,12 +329,12 @@ impl EncryptedConnection {
(&mut key_material[32..64]).copy_from_slice(key_material_keccak.as_bytes());
let mac_encoder_key: Secret = Secret::copy_from_slice(&key_material[32..64]).expect("can create Secret from 32 bytes; qed");
let mut egress_mac = Keccak::new_keccak256();
let mut egress_mac = Keccak::v256();
let mut mac_material = H256::from_slice(&key_material[32..64]) ^ handshake.remote_nonce;
egress_mac.update(mac_material.as_bytes());
egress_mac.update(if handshake.originated { &handshake.auth_cipher } else { &handshake.ack_cipher });
let mut ingress_mac = Keccak::new_keccak256();
let mut ingress_mac = Keccak::v256();
mac_material = H256::from_slice(&key_material[32..64]) ^ handshake.nonce;
ingress_mac.update(mac_material.as_bytes());
ingress_mac.update(if handshake.originated { &handshake.ack_cipher } else { &handshake.auth_cipher });