Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3638e0e
Add a memory-only option for the network
tomaka Jun 27, 2019
aaf3a01
Tests cleanup
tomaka Jun 27, 2019
7dec78f
Make grandpa/aura/babe compile
tomaka Jun 28, 2019
70932f8
Aura and Babe tests now passing
tomaka Jun 28, 2019
1825b87
More work on tests rewrite
tomaka Jun 29, 2019
89ed890
Attempt to fix grandpa
tomaka Jun 29, 2019
3886734
Make more grandpa tests pass
tomaka Jun 29, 2019
3e4d612
More grandpa tests work
tomaka Jun 29, 2019
6b21b0c
Work on sync tests
tomaka Jun 29, 2019
2251da5
More work
tomaka Jun 29, 2019
cbd76e8
Merge remote-tracking branch 'upstream/master' into transport-config
tomaka Jul 2, 2019
4243b4f
light_peer_imports_header_from_announce passes
tomaka Jul 2, 2019
788b579
can_sync_small_non_best_forks passes
tomaka Jul 2, 2019
529cc09
syncing_node_not_major_syncing_when_disconnected passes
tomaka Jul 2, 2019
25a2d3b
blocks_are_not_announced_by_light_nodes passing
tomaka Jul 2, 2019
363207e
All sync tests passing 🎉
tomaka Jul 2, 2019
528082b
Some TestNet cleanup
tomaka Jul 2, 2019
a23888a
Work on grandpa tests
tomaka Jul 3, 2019
46f89bb
More grandpa work
tomaka Jul 3, 2019
affe4b1
GrandPa work
tomaka Jul 3, 2019
68c72f1
Add check about block_import
tomaka Jul 3, 2019
bdc5568
Merge remote-tracking branch 'upstream/master' into transport-config
tomaka Jul 4, 2019
0d34cc8
Remove the temporarily added Sync
tomaka Jul 4, 2019
9703e6f
Fix network tests warnings
tomaka Jul 4, 2019
104a88c
voter_persists_its_votes passes
tomaka Jul 4, 2019
a03a0e4
Fix imports in network tests
tomaka Jul 4, 2019
1ec1f9d
Fix service tests
tomaka Jul 4, 2019
3afa8b4
Call on_block_imported 🤷
tomaka Jul 4, 2019
38c7e93
Add shortcut
tomaka Jul 5, 2019
63e2ffc
Merge remote-tracking branch 'upstream/master' into transport-config
tomaka Jul 5, 2019
743af81
Merge remote-tracking branch 'upstream/master' into transport-config
tomaka Jul 5, 2019
ad40093
Finish using shortcut
tomaka Jul 5, 2019
041523d
Merge remote-tracking branch 'upstream/master' into transport-config
tomaka Jul 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions core/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use service::{
};
use network::{
self, multiaddr::Protocol,
config::{NetworkConfiguration, NonReservedPeerMode, NodeKeyConfig},
config::{NetworkConfiguration, TransportConfig, NonReservedPeerMode, NodeKeyConfig},
build_multiaddr,
};
use primitives::H256;
Expand Down Expand Up @@ -354,7 +354,10 @@ fn fill_network_configuration(
config.in_peers = cli.in_peers;
config.out_peers = cli.out_peers;

config.enable_mdns = !is_dev && !cli.no_mdns;
config.transport = TransportConfig::Normal {
enable_mdns: !is_dev && !cli.no_mdns,
wasm_external_transport: None,
};

Ok(())
}
Expand Down
37 changes: 6 additions & 31 deletions core/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ pub fn import_queue<B, C, P>(
#[cfg(test)]
mod tests {
use super::*;
use futures::stream::Stream as _;
use futures::{Async, stream::Stream as _};
use consensus_common::NoNetwork as DummyOracle;
use network::test::*;
use network::test::{Block as TestBlock, PeersClient, PeersFullClient};
Expand Down Expand Up @@ -756,11 +756,9 @@ mod tests {
}

const SLOT_DURATION: u64 = 1;
const TEST_ROUTING_INTERVAL: Duration = Duration::from_millis(50);

pub struct AuraTestNet {
peers: Vec<Arc<Peer<(), DummySpecialization>>>,
started: bool,
peers: Vec<Peer<(), DummySpecialization>>,
}

impl TestNetFactory for AuraTestNet {
Expand All @@ -772,7 +770,6 @@ mod tests {
fn from_config(_config: &ProtocolConfig) -> Self {
AuraTestNet {
peers: Vec::new(),
started: false,
}
}

Expand Down Expand Up @@ -800,38 +797,24 @@ mod tests {
}
}

fn uses_tokio(&self) -> bool {
true
}

fn peer(&self, i: usize) -> &Peer<Self::PeerData, DummySpecialization> {
&self.peers[i]
}

fn peers(&self) -> &Vec<Arc<Peer<Self::PeerData, DummySpecialization>>> {
fn peers(&self) -> &Vec<Peer<Self::PeerData, DummySpecialization>> {
&self.peers
}

fn mut_peers<F: FnOnce(&mut Vec<Arc<Peer<Self::PeerData, DummySpecialization>>>)>(&mut self, closure: F) {
fn mut_peers<F: FnOnce(&mut Vec<Peer<Self::PeerData, DummySpecialization>>)>(&mut self, closure: F) {
closure(&mut self.peers);
}

fn started(&self) -> bool {
self.started
}

fn set_started(&mut self, new: bool) {
self.started = new;
}
}

#[test]
#[allow(deprecated)]
fn authoring_blocks() {
let _ = ::env_logger::try_init();
let mut net = AuraTestNet::new(3);

net.start();
let net = AuraTestNet::new(3);

let peers = &[
(0, Keyring::Alice),
Expand Down Expand Up @@ -884,15 +867,7 @@ mod tests {
.map(|_| ())
.map_err(|_| ());

let drive_to_completion = ::tokio_timer::Interval::new_interval(TEST_ROUTING_INTERVAL)
.for_each(move |_| {
net.lock().send_import_notifications();
net.lock().sync_without_disconnects();
Ok(())
})
.map(|_| ())
.map_err(|_| ());

let drive_to_completion = futures::future::poll_fn(|| { net.lock().poll(); Ok(Async::NotReady) });
let _ = runtime.block_on(wait_for.select(drive_to_completion).map_err(|_| ())).unwrap();
}

Expand Down
36 changes: 6 additions & 30 deletions core/consensus/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ mod tests {
use super::generic::DigestItem;
use client::BlockchainEvents;
use test_client;
use futures::stream::Stream;
use futures::{Async, stream::Stream as _};
use log::debug;
use std::time::Duration;
type Item = generic::DigestItem<Hash>;
Expand Down Expand Up @@ -919,11 +919,9 @@ mod tests {
}

const SLOT_DURATION: u64 = 1;
const TEST_ROUTING_INTERVAL: Duration = Duration::from_millis(50);

pub struct BabeTestNet {
peers: Vec<Arc<Peer<(), DummySpecialization>>>,
started: bool,
peers: Vec<Peer<(), DummySpecialization>>,
}

impl TestNetFactory for BabeTestNet {
Expand All @@ -936,7 +934,6 @@ mod tests {
debug!(target: "babe", "Creating test network from config");
BabeTestNet {
peers: Vec::new(),
started: false,
}
}

Expand All @@ -963,34 +960,22 @@ mod tests {
})
}

fn uses_tokio(&self) -> bool {
true
}

fn peer(&self, i: usize) -> &Peer<Self::PeerData, DummySpecialization> {
trace!(target: "babe", "Retreiving a peer");
&self.peers[i]
}

fn peers(&self) -> &Vec<Arc<Peer<Self::PeerData, DummySpecialization>>> {
fn peers(&self) -> &Vec<Peer<Self::PeerData, DummySpecialization>> {
trace!(target: "babe", "Retreiving peers");
&self.peers
}

fn mut_peers<F: FnOnce(&mut Vec<Arc<Peer<Self::PeerData, DummySpecialization>>>)>(
fn mut_peers<F: FnOnce(&mut Vec<Peer<Self::PeerData, DummySpecialization>>)>(
&mut self,
closure: F,
) {
closure(&mut self.peers);
}

fn started(&self) -> bool {
self.started
}

fn set_started(&mut self, new: bool) {
self.started = new;
}
}

#[test]
Expand All @@ -1003,10 +988,9 @@ mod tests {
fn authoring_blocks() {
drop(env_logger::try_init());
debug!(target: "babe", "checkpoint 1");
let mut net = BabeTestNet::new(3);
let net = BabeTestNet::new(3);
debug!(target: "babe", "checkpoint 2");

net.start();
debug!(target: "babe", "checkpoint 3");

let peers = &[
Expand Down Expand Up @@ -1060,15 +1044,7 @@ mod tests {
.map(drop)
.map_err(drop);

let drive_to_completion = ::tokio_timer::Interval::new_interval(TEST_ROUTING_INTERVAL)
.for_each(move |_| {
net.lock().send_import_notifications();
net.lock().sync_without_disconnects();
Ok(())
})
.map(drop)
.map_err(drop);

let drive_to_completion = futures::future::poll_fn(|| { net.lock().poll(); Ok(Async::NotReady) });
let _ = runtime.block_on(wait_for.select(drive_to_completion).map_err(drop)).unwrap();
}

Expand Down
Loading