From 2d2513b35ae5b9f204332f61a267554b0b1e1bc1 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 18 Oct 2019 15:12:16 +0200 Subject: [PATCH] [dependencies] bump rand 0.7 (#11022) * network-devp2p: bump rand `0.7` * updater: bump rand `0.7` * hash-fetch: bump rand `0.7` * ethcore-sync: bump rand `0.7` * rpc: dont work yet * [private-tx] remove unused rand * [ethcore-snapshot] bump rand 0.7 * [engine clique]: bump rand 0.7 * [engine authority-round]: remove rand * [ethcore-blockchain]: bump rand 0.7 * [ethcore]: bump rand 0.7 * [ethcore-light]: bump rand 0.7 * [ethstore]: bump rand 0.7 * Fix for rand usage in rpc * [rpc]: fix test build * [ethcore-sync]: fix test build * [snapshot tests]: rand 0.7 * [ethkey]: bump rand 0.7 * [rpc]: resolve TODO incompatible `rand versions` * [ethkey] use `rust-secp256k1` master branch * fix(bad merge): ethcoore-light remove itertools * [rpc tests]: revert rpc test changes in #11139 `#11139` makes use a different `RNG/seed`, not `H64::random_using(&mut self.rand)` This commit reverts the changed tests (the generated id by `Subscribers::next_id`) * [ethkey/random]: resolve introduced `TODO` --- Cargo.lock | 105 ++++++++++++------ accounts/ethkey/Cargo.toml | 2 +- accounts/ethkey/src/random.rs | 10 +- accounts/ethstore/Cargo.toml | 2 +- accounts/ethstore/src/random.rs | 6 +- accounts/ethstore/tests/util/transient_dir.rs | 2 +- ethcore/Cargo.toml | 3 +- ethcore/blockchain/Cargo.toml | 2 +- ethcore/engines/authority-round/Cargo.toml | 1 - ethcore/engines/clique/Cargo.toml | 2 +- ethcore/light/Cargo.toml | 2 +- ethcore/snapshot/Cargo.toml | 4 +- ethcore/snapshot/snapshot-tests/Cargo.toml | 4 +- ethcore/snapshot/src/consensus/work.rs | 2 +- ethcore/src/client/client.rs | 2 +- ethcore/sync/Cargo.toml | 4 +- ethcore/sync/src/light_sync/mod.rs | 2 +- rpc/Cargo.toml | 6 +- rpc/src/authcodes.rs | 2 +- rpc/src/v1/helpers/secretstore.rs | 2 +- rpc/src/v1/helpers/subscribers.rs | 10 +- rpc/src/v1/helpers/subscription_manager.rs | 2 +- rpc/src/v1/tests/mocked/eth_pubsub.rs | 29 +++-- rpc/src/v1/tests/mocked/pubsub.rs | 8 +- updater/Cargo.toml | 2 +- updater/hash-fetch/Cargo.toml | 2 +- updater/hash-fetch/src/client.rs | 4 +- util/network-devp2p/Cargo.toml | 2 +- util/network-devp2p/src/node_table.rs | 5 +- 29 files changed, 130 insertions(+), 99 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3c465b99..e13978c93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,7 +183,6 @@ dependencies = [ "machine 0.1.0", "macros 0.1.0", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "spec 0.1.0", @@ -544,7 +543,7 @@ dependencies = [ "machine 0.1.0", "macros 0.1.0", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "spec 0.1.0", "state-db 0.1.0", @@ -929,12 +928,12 @@ dependencies = [ [[package]] name = "eth-secp256k1" version = "0.5.7" -source = "git+https://github.com/paritytech/rust-secp256k1#a96ad75aead23caa7f79cb61620c3a8c77d711d9" +source = "git+https://github.com/paritytech/rust-secp256k1#246aefeef6337d208d820936e8e868f11d80e98c" dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1067,7 +1066,8 @@ dependencies = [ "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", "pod 0.1.0", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "registrar 0.0.1", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1126,7 +1126,7 @@ dependencies = [ "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rlp_compress 0.1.0", @@ -1235,7 +1235,7 @@ dependencies = [ "parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rlp_derive 0.1.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1344,7 +1344,7 @@ dependencies = [ "parity-path 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1515,8 +1515,8 @@ dependencies = [ "parity-runtime 0.1.0", "parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "snapshot 0.1.0", @@ -1561,7 +1561,7 @@ dependencies = [ "parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wordlist 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1598,7 +1598,7 @@ dependencies = [ "parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wordlist 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1811,6 +1811,11 @@ name = "fs_extra" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -2085,7 +2090,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "xmltree 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2822,7 +2827,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3058,7 +3063,7 @@ dependencies = [ "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-runtime 0.1.0", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "registrar 0.0.1", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3171,8 +3176,8 @@ dependencies = [ "parity-version 2.7.0", "parking_lot 0.9.0 (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.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3285,7 +3290,7 @@ dependencies = [ "parity-path 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-version 2.7.0", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3667,11 +3672,13 @@ dependencies = [ [[package]] name = "rand" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3696,7 +3703,7 @@ dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3722,7 +3729,7 @@ name = "rand_chacha" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3740,12 +3747,20 @@ name = "rand_core" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.3.0" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -3761,7 +3776,7 @@ name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3777,7 +3792,7 @@ name = "rand_isaac" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3794,7 +3809,7 @@ name = "rand_pcg" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3803,7 +3818,15 @@ name = "rand_xorshift" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3836,6 +3859,14 @@ dependencies = [ "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "redox_syscall" version = "0.1.40" @@ -4213,8 +4244,8 @@ dependencies = [ "parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rlp_derive 0.1.0", "snapshot-tests 0.1.0", @@ -4258,8 +4289,8 @@ dependencies = [ "parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie-ethereum 0.1.0", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "snapshot 0.1.0", "spec 0.1.0", @@ -4442,7 +4473,7 @@ name = "tempdir" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5403,6 +5434,7 @@ dependencies = [ "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fs-swap 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "921d332c89b3b61a826de38c61ee5b6e02c56806cade1b0e5d81bd71f57a71bb" "checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" @@ -5553,14 +5585,15 @@ dependencies = [ "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a" "checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" "checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a" "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" -"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" @@ -5568,9 +5601,11 @@ dependencies = [ "checksum rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a788ae3edb696cfcba1c19bfd388cc4b8c21f8a408432b199c072825084da58a" "checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" "checksum rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e18c91676f670f6f0312764c759405f13afb98d5d73819840cf72a518487bff" "checksum rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4b0186e22767d5b9738a05eab7c6ac90b15db17e5b5f9bd87976dd7d89a10a4" "checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" diff --git a/accounts/ethkey/Cargo.toml b/accounts/ethkey/Cargo.toml index 2719b2009..fb3716ad0 100644 --- a/accounts/ethkey/Cargo.toml +++ b/accounts/ethkey/Cargo.toml @@ -13,7 +13,7 @@ lazy_static = "1.0" log = "0.4" parity-wordlist = "1.3" quick-error = "1.2.2" -rand = "0.6" +rand = "0.7" rustc-hex = "1.0" serde = "1.0" serde_derive = "1.0" diff --git a/accounts/ethkey/src/random.rs b/accounts/ethkey/src/random.rs index 39f72eb0c..08ccd2624 100644 --- a/accounts/ethkey/src/random.rs +++ b/accounts/ethkey/src/random.rs @@ -21,14 +21,12 @@ use super::{Generator, KeyPair, SECP256K1}; pub struct Random; impl Generator for Random { - type Error = ::std::io::Error; + type Error = std::io::Error; fn generate(&mut self) -> Result { - let mut rng = OsRng::new()?; - match rng.generate() { - Ok(pair) => Ok(pair), - Err(void) => match void {}, // LLVM unreachable - } + Generator::generate(&mut OsRng).map_err(|void| { + match void {} // LLVM unreachable + }) } } diff --git a/accounts/ethstore/Cargo.toml b/accounts/ethstore/Cargo.toml index 1cd69d8aa..99943611c 100644 --- a/accounts/ethstore/Cargo.toml +++ b/accounts/ethstore/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] [dependencies] log = "0.4" libc = "0.2" -rand = "0.6" +rand = "0.7" ethkey = { path = "../ethkey" } serde = "1.0" serde_json = "1.0" diff --git a/accounts/ethstore/src/random.rs b/accounts/ethstore/src/random.rs index 3e2df33b6..bbaa0f3c4 100644 --- a/accounts/ethstore/src/random.rs +++ b/accounts/ethstore/src/random.rs @@ -23,7 +23,7 @@ pub trait Random { impl Random for [u8; 16] { fn random() -> Self { let mut result = [0u8; 16]; - let mut rng = OsRng::new().unwrap(); + let mut rng = OsRng; rng.fill_bytes(&mut result); result } @@ -32,7 +32,7 @@ impl Random for [u8; 16] { impl Random for [u8; 32] { fn random() -> Self { let mut result = [0u8; 32]; - let mut rng = OsRng::new().unwrap(); + let mut rng = OsRng; rng.fill_bytes(&mut result); result } @@ -40,6 +40,6 @@ impl Random for [u8; 32] { /// Generate a random string of given length. pub fn random_string(length: usize) -> String { - let mut rng = OsRng::new().expect("Not able to operate without random source."); + let rng = OsRng; rng.sample_iter(&Alphanumeric).take(length).collect() } diff --git a/accounts/ethstore/tests/util/transient_dir.rs b/accounts/ethstore/tests/util/transient_dir.rs index 90fe7303b..8d91000f7 100644 --- a/accounts/ethstore/tests/util/transient_dir.rs +++ b/accounts/ethstore/tests/util/transient_dir.rs @@ -21,7 +21,7 @@ use ethstore::accounts_dir::{KeyDirectory, RootDiskDirectory}; use ethstore::{Error, SafeAccount}; pub fn random_dir() -> PathBuf { - let mut rng = OsRng::new().unwrap(); + let mut rng = OsRng; let mut dir = env::temp_dir(); dir.push(format!("{:x}-{:x}", rng.next_u64(), rng.next_u64())); dir diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 97c1e8f1a..aca6a9243 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -45,7 +45,8 @@ parking_lot = "0.9" pod = { path = "pod", optional = true } trie-db = "0.15.0" patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" } -rand = "0.6" +rand = "0.7" +rand_xorshift = "0.2" rayon = "1.1" registrar = { path = "../util/registrar" } rlp = "0.4.0" diff --git a/ethcore/blockchain/Cargo.toml b/ethcore/blockchain/Cargo.toml index 5e69700bb..5552e966f 100644 --- a/ethcore/blockchain/Cargo.toml +++ b/ethcore/blockchain/Cargo.toml @@ -19,8 +19,8 @@ itertools = "0.5" kvdb = "0.1" log = "0.4" parity-bytes = "0.1" +rand = "0.7" parking_lot = "0.9" -rand = "0.6" rayon = "1.0" rlp = "0.4.0" rlp_compress = { path = "../../util/rlp-compress" } diff --git a/ethcore/engines/authority-round/Cargo.toml b/ethcore/engines/authority-round/Cargo.toml index f27f42d4b..79083299a 100644 --- a/ethcore/engines/authority-round/Cargo.toml +++ b/ethcore/engines/authority-round/Cargo.toml @@ -23,7 +23,6 @@ lru-cache = "0.1" machine = { path = "../../machine" } macros = { path = "../../../util/macros" } parking_lot = "0.9" -rand = "0.6" rlp = "0.4.0" time-utils = { path = "../../../util/time-utils" } unexpected = { path = "../../../util/unexpected" } diff --git a/ethcore/engines/clique/Cargo.toml b/ethcore/engines/clique/Cargo.toml index fa7efa184..2c831813c 100644 --- a/ethcore/engines/clique/Cargo.toml +++ b/ethcore/engines/clique/Cargo.toml @@ -19,8 +19,8 @@ log = "0.4" lru-cache = "0.1" machine = { path = "../../machine" } macros = { path = "../../../util/macros" } +rand = "0.7" parking_lot = "0.9" -rand = "0.6" rlp = "0.4.0" time-utils = { path = "../../../util/time-utils" } unexpected = { path = "../../../util/unexpected" } diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index 6f02dc284..e52faf854 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -33,7 +33,7 @@ rlp = "0.4.0" rlp_derive = { path = "../../util/rlp-derive" } smallvec = "0.6" futures = "0.1" -rand = "0.6" +rand = "0.7" bincode = "1.1" serde = "1.0" serde_derive = "1.0" diff --git a/ethcore/snapshot/Cargo.toml b/ethcore/snapshot/Cargo.toml index dd3749274..882c9c5c9 100644 --- a/ethcore/snapshot/Cargo.toml +++ b/ethcore/snapshot/Cargo.toml @@ -28,9 +28,9 @@ keccak-hasher = { path = "../../util/keccak-hasher" } kvdb = "0.1" log = "0.4.8" num_cpus = "1.10.1" +rand = "0.7" +rand_xorshift = "0.2" parking_lot = "0.9" -rand = "0.6" -rand_xorshift = "0.1.1" rlp = "0.4.2" rlp_derive = { path = "../../util/rlp-derive" } snappy = { package = "parity-snappy", version ="0.1.0" } diff --git a/ethcore/snapshot/snapshot-tests/Cargo.toml b/ethcore/snapshot/snapshot-tests/Cargo.toml index 9172977ae..efe6ec190 100644 --- a/ethcore/snapshot/snapshot-tests/Cargo.toml +++ b/ethcore/snapshot/snapshot-tests/Cargo.toml @@ -28,8 +28,8 @@ kvdb = "0.1" kvdb-rocksdb = { version = "0.1.5" } log = "0.4.8" parking_lot = "0.9" -rand = "0.6" -rand_xorshift = "0.1.1" +rand = "0.7" +rand_xorshift = "0.2" rlp = "0.4.2" snappy = { package = "parity-snappy", version ="0.1.0" } snapshot = { path = "../../snapshot", features = ["test-helpers"] } diff --git a/ethcore/snapshot/src/consensus/work.rs b/ethcore/snapshot/src/consensus/work.rs index eb035fb77..fede7e9d6 100644 --- a/ethcore/snapshot/src/consensus/work.rs +++ b/ethcore/snapshot/src/consensus/work.rs @@ -222,7 +222,7 @@ impl PowRebuilder { Ok(PowRebuilder { chain, db, - rng: OsRng::new().map_err(|e| format!("{}", e))?, + rng: OsRng, disconnected: Vec::new(), best_number: manifest.block_number, best_hash: manifest.block_hash, diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 30c5ba020..795a0e6de 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -469,7 +469,7 @@ impl Importer { { trace_time!("import_old_block"); // verify the block, passing the chain for updating the epoch verifier. - let mut rng = OsRng::new().map_err(|e| format!("{}", e))?; + let mut rng = OsRng; self.ancient_verifier.verify(&mut rng, &unverified.header, &chain)?; // Commit results diff --git a/ethcore/sync/Cargo.toml b/ethcore/sync/Cargo.toml index 7ec854f03..f8018599a 100644 --- a/ethcore/sync/Cargo.toml +++ b/ethcore/sync/Cargo.toml @@ -27,8 +27,8 @@ macros = { path = "../../util/macros" } network = { package = "ethcore-network", path = "../../util/network" } parity-runtime = { path = "../../util/runtime" } parity-util-mem = "0.2.0" +rand = "0.7" parking_lot = "0.9" -rand = "0.6" rlp = "0.4.0" snapshot = { path = "../snapshot" } trace-time = "0.1" @@ -41,6 +41,6 @@ ethcore = { path = "..", features = ["test-helpers"] } ethcore-io = { path = "../../util/io", features = ["mio"] } kvdb-memorydb = "0.1.2" machine = { path = "../machine" } -rand_xorshift = "0.1.1" +rand_xorshift = "0.2" rustc-hex = "1.0" spec = { path = "../spec" } diff --git a/ethcore/sync/src/light_sync/mod.rs b/ethcore/sync/src/light_sync/mod.rs index 2de8003d6..a7d415d3f 100644 --- a/ethcore/sync/src/light_sync/mod.rs +++ b/ethcore/sync/src/light_sync/mod.rs @@ -716,7 +716,7 @@ impl LightSync { peers: RwLock::new(HashMap::new()), pending_reqs: Mutex::new(HashMap::new()), client: client, - rng: Mutex::new(OsRng::new()?), + rng: Mutex::new(OsRng), senders: RwLock::new(Vec::new()), state: Mutex::new(SyncStateWrapper::idle()), is_idle: Mutex::new(true), diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index f8bc69f76..761808084 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -14,14 +14,14 @@ futures = "0.1.6" log = "0.4" multihash = "0.8" order-stat = "0.1" -parking_lot = "0.9" -rand = "0.6" -rand_xorshift = "0.1.1" +rand = "0.7" +rand_xorshift = "0.2" rustc-hex = "1.0" semver = "0.9" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" +parking_lot = "0.9" tempdir = "0.3" tiny-keccak = "1.4" tokio-timer = "0.1" diff --git a/rpc/src/authcodes.rs b/rpc/src/authcodes.rs index a4f440a71..4c3e905e6 100644 --- a/rpc/src/authcodes.rs +++ b/rpc/src/authcodes.rs @@ -173,7 +173,7 @@ impl AuthCodes { /// Generates and returns a new code that can be used by `SignerUIs` pub fn generate_new(&mut self) -> io::Result { - let mut rng = OsRng::new()?; + let rng = OsRng; let code = rng.sample_iter(&Alphanumeric).take(TOKEN_LENGTH).collect::(); let readable_code = code.as_bytes() .chunks(4) diff --git a/rpc/src/v1/helpers/secretstore.rs b/rpc/src/v1/helpers/secretstore.rs index 6b90246cd..3db4578eb 100644 --- a/rpc/src/v1/helpers/secretstore.rs +++ b/rpc/src/v1/helpers/secretstore.rs @@ -118,7 +118,7 @@ fn into_document_key(key: Bytes) -> Result { fn initialization_vector() -> [u8; INIT_VEC_LEN] { let mut result = [0u8; INIT_VEC_LEN]; - let mut rng = OsRng::new().unwrap(); + let mut rng = OsRng; rng.fill_bytes(&mut result); result } diff --git a/rpc/src/v1/helpers/subscribers.rs b/rpc/src/v1/helpers/subscribers.rs index 2c75ed500..b07000bca 100644 --- a/rpc/src/v1/helpers/subscribers.rs +++ b/rpc/src/v1/helpers/subscribers.rs @@ -18,7 +18,7 @@ use std::{ops, str}; use std::collections::HashMap; -use rand::RngCore; + use jsonrpc_pubsub::{typed::{Subscriber, Sink}, SubscriptionId}; use ethereum_types::H64; @@ -44,11 +44,11 @@ impl Id { #[cfg(not(test))] mod random { - use rand; + use rand::rngs::OsRng; pub type Rng = rand::rngs::OsRng; - pub fn new() -> Rng { Rng::new().expect("Valid random source is required.") } + pub fn new() -> Rng { OsRng } } #[cfg(test)] @@ -79,9 +79,7 @@ impl Default for Subscribers { impl Subscribers { fn next_id(&mut self) -> Id { - let mut data = H64::default(); - // TODO [grbIzl] rework with proper H64::random_using with rand 0.7 - self.rand.fill_bytes(&mut data.as_bytes_mut()); + let data = H64::random_using(&mut self.rand); Id(data) } diff --git a/rpc/src/v1/helpers/subscription_manager.rs b/rpc/src/v1/helpers/subscription_manager.rs index 597a08f33..b2dacba88 100644 --- a/rpc/src/v1/helpers/subscription_manager.rs +++ b/rpc/src/v1/helpers/subscription_manager.rs @@ -165,7 +165,7 @@ mod tests { let mut el = Runtime::new().unwrap(); let mut poll_manager = poll_manager(); let (id, rx) = poll_manager.subscribe(Default::default(), "hello".into(), Params::None); - assert_eq!(id, SubscriptionId::String("0x4333966aca52ad0b".into())); + assert_eq!(id, SubscriptionId::String("0x43ca64edf03768e1".into())); // then poll_manager.tick().wait().unwrap(); diff --git a/rpc/src/v1/tests/mocked/eth_pubsub.rs b/rpc/src/v1/tests/mocked/eth_pubsub.rs index 86938d8f4..7aee32307 100644 --- a/rpc/src/v1/tests/mocked/eth_pubsub.rs +++ b/rpc/src/v1/tests/mocked/eth_pubsub.rs @@ -62,13 +62,13 @@ fn should_subscribe_to_new_heads() { // Subscribe let request = r#"{"jsonrpc": "2.0", "method": "eth_subscribe", "params": ["newHeads"], "id": 1}"#; - let response = r#"{"jsonrpc":"2.0","result":"0x4333966aca52ad0b","id":1}"#; + let response = r#"{"jsonrpc":"2.0","result":"0x43ca64edf03768e1","id":1}"#; assert_eq!(io.handle_request_sync(request, metadata.clone()), Some(response.to_owned())); // Check notifications handler.new_blocks(NewBlocks::new(vec![], vec![], ChainRoute::new(vec![(h1, ChainRouteType::Enacted)]), vec![], vec![], DURATION_ZERO, true)); let (res, receiver) = receiver.into_future().wait().unwrap(); - let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"author":"0x0000000000000000000000000000000000000000","difficulty":"0x1","extraData":"0x","gasLimit":"0xf4240","gasUsed":"0x0","hash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","number":"0x1","parentHash":"0x0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":[],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x1c9","stateRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","timestamp":"0x0","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"},"subscription":"0x4333966aca52ad0b"}}"#; + let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"author":"0x0000000000000000000000000000000000000000","difficulty":"0x1","extraData":"0x","gasLimit":"0xf4240","gasUsed":"0x0","hash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","number":"0x1","parentHash":"0x0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":[],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x1c9","stateRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","timestamp":"0x0","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"},"subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); // Notify about two blocks @@ -76,14 +76,14 @@ fn should_subscribe_to_new_heads() { // Receive both let (res, receiver) = receiver.into_future().wait().unwrap(); - let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"author":"0x0000000000000000000000000000000000000000","difficulty":"0x2","extraData":"0x","gasLimit":"0xf4240","gasUsed":"0x0","hash":"0x44e5ecf454ea99af9d8a8f2ca0daba96964c90de05db7a78f59b84ae9e749706","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","number":"0x2","parentHash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":[],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x1c9","stateRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","timestamp":"0x0","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"},"subscription":"0x4333966aca52ad0b"}}"#; + let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"author":"0x0000000000000000000000000000000000000000","difficulty":"0x2","extraData":"0x","gasLimit":"0xf4240","gasUsed":"0x0","hash":"0x44e5ecf454ea99af9d8a8f2ca0daba96964c90de05db7a78f59b84ae9e749706","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","number":"0x2","parentHash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":[],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x1c9","stateRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","timestamp":"0x0","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"},"subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); let (res, receiver) = receiver.into_future().wait().unwrap(); - let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"author":"0x0000000000000000000000000000000000000000","difficulty":"0x3","extraData":"0x","gasLimit":"0xf4240","gasUsed":"0x0","hash":"0xdf04a98bb0c6fa8441bd429822f65a46d0cb553f6bcef602b973e65c81497f8e","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","number":"0x3","parentHash":"0x44e5ecf454ea99af9d8a8f2ca0daba96964c90de05db7a78f59b84ae9e749706","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":[],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x1c9","stateRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","timestamp":"0x0","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"},"subscription":"0x4333966aca52ad0b"}}"#; + let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"author":"0x0000000000000000000000000000000000000000","difficulty":"0x3","extraData":"0x","gasLimit":"0xf4240","gasUsed":"0x0","hash":"0xdf04a98bb0c6fa8441bd429822f65a46d0cb553f6bcef602b973e65c81497f8e","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","number":"0x3","parentHash":"0x44e5ecf454ea99af9d8a8f2ca0daba96964c90de05db7a78f59b84ae9e749706","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":[],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x1c9","stateRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","timestamp":"0x0","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"},"subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); // And unsubscribe - let request = r#"{"jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0x4333966aca52ad0b"], "id": 1}"#; + let request = r#"{"jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0x43ca64edf03768e1"], "id": 1}"#; let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#; assert_eq!(io.handle_request_sync(request, metadata), Some(response.to_owned())); @@ -132,7 +132,7 @@ fn should_subscribe_to_logs() { // Subscribe let request = r#"{"jsonrpc": "2.0", "method": "eth_subscribe", "params": ["logs", {}], "id": 1}"#; - let response = r#"{"jsonrpc":"2.0","result":"0x4333966aca52ad0b","id":1}"#; + let response = r#"{"jsonrpc":"2.0","result":"0x43ca64edf03768e1","id":1}"#; assert_eq!(io.handle_request_sync(request, metadata.clone()), Some(response.to_owned())); // Check notifications (enacted) @@ -140,7 +140,7 @@ fn should_subscribe_to_logs() { let (res, receiver) = receiver.into_future().wait().unwrap(); let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"address":"0x0000000000000000000000000000000000000005","blockHash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","blockNumber":"0x1","data":"0x","logIndex":"0x0","removed":false,"topics":["0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"transactionHash":""#.to_owned() + &format!("0x{:x}", tx_hash) - + r#"","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"},"subscription":"0x4333966aca52ad0b"}}"#; + + r#"","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"},"subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); // Check notifications (retracted) @@ -148,11 +148,11 @@ fn should_subscribe_to_logs() { let (res, receiver) = receiver.into_future().wait().unwrap(); let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"address":"0x0000000000000000000000000000000000000005","blockHash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","blockNumber":"0x1","data":"0x","logIndex":"0x0","removed":true,"topics":["0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"transactionHash":""#.to_owned() + &format!("0x{:x}", tx_hash) - + r#"","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"removed"},"subscription":"0x4333966aca52ad0b"}}"#; + + r#"","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"removed"},"subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); // And unsubscribe - let request = r#"{"jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0x4333966aca52ad0b"], "id": 1}"#; + let request = r#"{"jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0x43ca64edf03768e1"], "id": 1}"#; let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#; assert_eq!(io.handle_request_sync(request, metadata), Some(response.to_owned())); @@ -185,22 +185,22 @@ fn should_subscribe_to_pending_transactions() { // Subscribe let request = r#"{"jsonrpc": "2.0", "method": "eth_subscribe", "params": ["newPendingTransactions"], "id": 1}"#; - let response = r#"{"jsonrpc":"2.0","result":"0x4333966aca52ad0b","id":1}"#; + let response = r#"{"jsonrpc":"2.0","result":"0x43ca64edf03768e1","id":1}"#; assert_eq!(io.handle_request_sync(request, metadata.clone()), Some(response.to_owned())); // Send new transactions pool_sender.unbounded_send(Arc::new(vec![H256::from_low_u64_be(5), H256::from_low_u64_be(7)])).unwrap(); let (res, receiver) = receiver.into_future().wait().unwrap(); - let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":"0x0000000000000000000000000000000000000000000000000000000000000005","subscription":"0x4333966aca52ad0b"}}"#; + let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":"0x0000000000000000000000000000000000000000000000000000000000000005","subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); let (res, receiver) = receiver.into_future().wait().unwrap(); - let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":"0x0000000000000000000000000000000000000000000000000000000000000007","subscription":"0x4333966aca52ad0b"}}"#; + let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":"0x0000000000000000000000000000000000000000000000000000000000000007","subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); // And unsubscribe - let request = r#"{"jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0x4333966aca52ad0b"], "id": 1}"#; + let request = r#"{"jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0x43ca64edf03768e1"], "id": 1}"#; let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#; assert_eq!(io.handle_request_sync(request, metadata), Some(response.to_owned())); @@ -224,8 +224,7 @@ fn eth_subscribe_syncing() { let (sender, _receiver) = futures::sync::mpsc::channel(8); metadata.session = Some(Arc::new(Session::new(sender))); - // Subscribe - let response = r#"{"jsonrpc":"2.0","result":"0x4333966aca52ad0b","id":1}"#; + let response = r#"{"jsonrpc":"2.0","result":"0x43ca64edf03768e1","id":1}"#; let request = r#"{"jsonrpc": "2.0", "method": "eth_subscribe", "params": ["syncing"], "id": 1}"#; assert_eq!(io.handle_request_sync(request, metadata.clone()), Some(response.to_owned())); } diff --git a/rpc/src/v1/tests/mocked/pubsub.rs b/rpc/src/v1/tests/mocked/pubsub.rs index 077e69e5a..a0fafa4ba 100644 --- a/rpc/src/v1/tests/mocked/pubsub.rs +++ b/rpc/src/v1/tests/mocked/pubsub.rs @@ -53,22 +53,22 @@ fn should_subscribe_to_a_method() { // Subscribe let request = r#"{"jsonrpc": "2.0", "method": "parity_subscribe", "params": ["hello", []], "id": 1}"#; - let response = r#"{"jsonrpc":"2.0","result":"0x4333966aca52ad0b","id":1}"#; + let response = r#"{"jsonrpc":"2.0","result":"0x43ca64edf03768e1","id":1}"#; assert_eq!(io.handle_request_sync(request, metadata.clone()), Some(response.to_owned())); // Check notifications let (res, receiver) = receiver.into_future().wait().unwrap(); let response = - r#"{"jsonrpc":"2.0","method":"parity_subscription","params":{"result":"hello","subscription":"0x4333966aca52ad0b"}}"#; + r#"{"jsonrpc":"2.0","method":"parity_subscription","params":{"result":"hello","subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); let (res, receiver) = receiver.into_future().wait().unwrap(); let response = - r#"{"jsonrpc":"2.0","method":"parity_subscription","params":{"result":"world","subscription":"0x4333966aca52ad0b"}}"#; + r#"{"jsonrpc":"2.0","method":"parity_subscription","params":{"result":"world","subscription":"0x43ca64edf03768e1"}}"#; assert_eq!(res, Some(response.into())); // And unsubscribe - let request = r#"{"jsonrpc": "2.0", "method": "parity_unsubscribe", "params": ["0x4333966aca52ad0b"], "id": 1}"#; + let request = r#"{"jsonrpc": "2.0", "method": "parity_unsubscribe", "params": ["0x43ca64edf03768e1"], "id": 1}"#; let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#; assert_eq!(io.handle_request_sync(request, metadata), Some(response.to_owned())); diff --git a/updater/Cargo.toml b/updater/Cargo.toml index 31ddb463a..90ff44c9a 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -21,8 +21,8 @@ parity-bytes = "0.1" parity-hash-fetch = { path = "hash-fetch" } parity-path = "0.1" parity-version = { path = "../util/version" } +rand = "0.7" parking_lot = "0.9" -rand = "0.6" semver = "0.9" target_info = "0.1" diff --git a/updater/hash-fetch/Cargo.toml b/updater/hash-fetch/Cargo.toml index b3781ec78..0aaca33e7 100644 --- a/updater/hash-fetch/Cargo.toml +++ b/updater/hash-fetch/Cargo.toml @@ -12,7 +12,7 @@ futures = "0.1" log = "0.4" mime = "0.3" mime_guess = "2.0.0-alpha.2" -rand = "0.6" +rand = "0.7" rustc-hex = "1.0" fetch = { path = "../../util/fetch" } parity-bytes = "0.1" diff --git a/updater/hash-fetch/src/client.rs b/updater/hash-fetch/src/client.rs index a5bd577c2..a12dc29c2 100644 --- a/updater/hash-fetch/src/client.rs +++ b/updater/hash-fetch/src/client.rs @@ -178,9 +178,9 @@ impl HashFetch for Client { fn random_temp_path() -> PathBuf { use rand::{Rng, rngs::OsRng, distributions::Alphanumeric}; - use ::std::env; + use std::env; - let mut rng = OsRng::new().expect("Reliable random source is required to work."); + let rng = OsRng; let file: String = rng.sample_iter(&Alphanumeric).take(12).collect(); let mut path = env::temp_dir(); diff --git a/util/network-devp2p/Cargo.toml b/util/network-devp2p/Cargo.toml index 9df85ee13..bc9ead6b3 100644 --- a/util/network-devp2p/Cargo.toml +++ b/util/network-devp2p/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" log = "0.4" mio = "0.6.8" bytes = "0.4" -rand = "0.6" +rand = "0.7" tiny-keccak = "1.4" slab = "0.2" igd = "0.9" diff --git a/util/network-devp2p/src/node_table.rs b/util/network-devp2p/src/node_table.rs index 6d68a7fd2..4242dad98 100644 --- a/util/network-devp2p/src/node_table.rs +++ b/util/network-devp2p/src/node_table.rs @@ -26,7 +26,7 @@ use std::time::{self, Duration, SystemTime}; use ethereum_types::H512; use log::{debug, warn}; -use rand::{self, Rng}; +use rand::seq::SliceRandom; use rlp::{DecoderError, Rlp, RlpStream}; use serde::{Deserialize, Serialize}; use serde_json; @@ -373,7 +373,8 @@ impl NodeTable { a.time().cmp(&b.time()) }); - rand::thread_rng().shuffle(&mut unknown); + let mut rng = rand::thread_rng(); + unknown.shuffle(&mut rng); success.append(&mut unknown); success.append(&mut failures);