Update dependencies (#1527)

* update to latest env_logger

* roundabout dependency update

* Update to latest vengen

* Update rand to 0.6

* Update to latest rng shuffle API

* Roundabout update of dependencies

* Update rustc_hex

* Update wasm

* Fix logging setup in tests

* revert to fix test
This commit is contained in:
Benjamin Kampmann
2019-01-25 12:44:41 +01:00
committed by Bastian Köcher
parent b187695af7
commit ab4c70b379
28 changed files with 531 additions and 825 deletions
+4 -4
View File
@@ -14,8 +14,8 @@ error-chain = "0.12"
bitflags = "1.0"
futures = "0.1.17"
linked-hash-map = "0.5"
rustc-hex = "1.0"
rand = "0.5"
rustc-hex = "2.0"
rand = "0.6"
substrate-primitives = { path = "../../core/primitives" }
substrate-consensus-common = { path = "../../core/consensus/common" }
substrate-client = { path = "../../core/client" }
@@ -25,12 +25,12 @@ parity-codec-derive = "2.1"
substrate-network-libp2p = { path = "../../core/network-libp2p" }
tokio = "0.1.11"
env_logger = { version = "0.4", optional = true }
env_logger = { version = "0.6", optional = true }
substrate-keyring = { path = "../../core/keyring", optional = true }
substrate-test-client = { path = "../../core/test-client", optional = true }
[dev-dependencies]
env_logger = { version = "0.4" }
env_logger = { version = "0.6" }
substrate-keyring = { path = "../../core/keyring" }
substrate-test-client = { path = "../../core/test-client" }
@@ -20,7 +20,7 @@
use std::collections::{HashMap, HashSet};
use futures::sync::mpsc;
use std::time::{Instant, Duration};
use rand::{self, Rng};
use rand::{self, seq::SliceRandom};
use network_libp2p::NodeIndex;
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Hash, HashFor};
use runtime_primitives::generic::BlockId;
@@ -125,7 +125,7 @@ impl<B: BlockT> ConsensusGossip<B> {
.filter_map(|(id, ref peer)| if !peer.is_authority && !peer.known_messages.contains(&(topic, message_hash)) { Some(*id) } else { None })
.collect();
rand::thread_rng().shuffle(&mut non_authorities);
non_authorities.shuffle(&mut rand::thread_rng());
let non_authorities: HashSet<_> = if non_authorities.is_empty() {
HashSet::new()
} else {
+4 -4
View File
@@ -725,12 +725,12 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
fn on_remote_read_request(&self, io: &mut SyncIo, who: NodeIndex, request: message::RemoteReadRequest<B::Hash>) {
trace!(target: "sync", "Remote read request {} from {} ({} at {})",
request.id, who, request.key.to_hex(), request.block);
request.id, who, request.key.to_hex::<String>(), request.block);
let proof = match self.context_data.chain.read_proof(&request.block, &request.key) {
Ok(proof) => proof,
Err(error) => {
trace!(target: "sync", "Remote read request {} from {} ({} at {}) failed with: {}",
request.id, who, request.key.to_hex(), request.block, error);
request.id, who, request.key.to_hex::<String>(), request.block, error);
Default::default()
},
};
@@ -766,13 +766,13 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
fn on_remote_changes_request(&self, io: &mut SyncIo, who: NodeIndex, request: message::RemoteChangesRequest<B::Hash>) {
trace!(target: "sync", "Remote changes proof request {} from {} for key {} ({}..{})",
request.id, who, request.key.to_hex(), request.first, request.last);
request.id, who, request.key.to_hex::<String>(), request.first, request.last);
let key = StorageKey(request.key);
let proof = match self.context_data.chain.key_changes_proof(request.first, request.last, request.min, request.max, &key) {
Ok(proof) => proof,
Err(error) => {
trace!(target: "sync", "Remote changes proof request {} from {} for key {} ({}..{}) failed with: {}",
request.id, who, key.0.to_hex(), request.first, request.last, error);
request.id, who, key.0.to_hex::<String>(), request.first, request.last, error);
ChangesProof::<B::Header> {
max_block: Zero::zero(),
proof: vec![],
+10 -8
View File
@@ -23,7 +23,7 @@ use super::*;
#[test]
fn sync_from_two_peers_works() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = TestNet::new(3);
net.peer(1).push_blocks(100, false);
net.peer(2).push_blocks(100, false);
@@ -35,7 +35,7 @@ fn sync_from_two_peers_works() {
#[test]
fn sync_from_two_peers_with_ancestry_search_works() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = TestNet::new(3);
net.peer(0).push_blocks(10, true);
net.peer(1).push_blocks(100, false);
@@ -57,7 +57,7 @@ fn sync_long_chain_works() {
#[test]
fn sync_no_common_longer_chain_fails() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = TestNet::new(3);
net.peer(0).push_blocks(20, true);
net.peer(1).push_blocks(20, false);
@@ -67,13 +67,15 @@ fn sync_no_common_longer_chain_fails() {
#[test]
fn sync_justifications() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = JustificationTestNet::new(3);
net.peer(0).push_blocks(20, false);
net.sync();
// there's currently no justification for block #10
assert_eq!(net.peer(0).client().justification(&BlockId::Number(10)).unwrap(), None);
assert_eq!(net.peer(1).client().justification(&BlockId::Number(10)).unwrap(), None);
// we finalize block #10 for peer 0 with a justification
net.peer(0).client().finalize_block(BlockId::Number(10), Some(Vec::new()), true).unwrap();
@@ -88,7 +90,7 @@ fn sync_justifications() {
#[test]
fn sync_after_fork_works() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = TestNet::new(3);
net.sync_step();
net.peer(0).push_blocks(30, false);
@@ -112,7 +114,7 @@ fn sync_after_fork_works() {
#[test]
fn syncs_all_forks() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = TestNet::new(4);
net.sync_step();
net.peer(0).push_blocks(2, false);
@@ -129,7 +131,7 @@ fn syncs_all_forks() {
#[test]
fn own_blocks_are_announced() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = TestNet::new(3);
net.sync(); // connect'em
net.peer(0).generate_blocks(1, BlockOrigin::Own, |builder| builder.bake().unwrap());
@@ -146,7 +148,7 @@ fn own_blocks_are_announced() {
#[test]
fn blocks_are_not_announced_by_light_nodes() {
::env_logger::init().ok();
let _ = ::env_logger::try_init();
let mut net = TestNet::new(0);
// full peer0 is connected to light peer