libp2p-0.5.0 (#1971)

* Update libp2p. Add support for ed25519 node (network) keys.

  * Update networking to the changes from https://github.com/libp2p/rust-libp2p/pull/972.
  * Add support for using ed25519 keys for libp2p networking.
  * Add support for reading libp2p secret keys from (external) files.

* Adapt to changes from https://github.com/libp2p/rust-libp2p/pull/992

* More tests.

* Cosmetics

* Deduplicate tests.

* Remove quickcheck from tests that don't use extra random inputs.

* Remove quickcheck.

* Swap new/default impls for NetworkConfiguration.

* Use libp2p-0.5.0 from crates.io.

* Post-rebase update.

* Remove unnecessary wildcard pattern.

* Combine two overlapping tests.
This commit is contained in:
Roman Borschel
2019-03-19 11:16:25 +01:00
committed by GitHub
parent 648b11e118
commit 57387ef585
19 changed files with 757 additions and 528 deletions
+10 -12
View File
@@ -25,7 +25,6 @@ use futures::{Future, Stream};
use tempdir::TempDir;
use tokio::runtime::Runtime;
use tokio::timer::Interval;
use primitives::blake2_256;
use service::{
ServiceFactory,
Configuration,
@@ -34,8 +33,8 @@ use service::{
Roles,
FactoryExtrinsic,
};
use network::{Protocol, SyncProvider, ManageNetwork};
use network::config::{NetworkConfiguration, NonReservedPeerMode};
use network::{multiaddr, SyncProvider, ManageNetwork};
use network::config::{NetworkConfiguration, NodeKeyConfig, Secret, NonReservedPeerMode};
use sr_primitives::traits::As;
use sr_primitives::generic::BlockId;
use consensus::{ImportBlock, BlockImport};
@@ -64,10 +63,6 @@ impl<F: ServiceFactory> TestNet<F> {
}
}
fn node_private_key_string(index: u32) -> String {
format!("N{}", index)
}
fn node_config<F: ServiceFactory> (
index: u32,
spec: &FactoryChainSpec<F>,
@@ -83,17 +78,20 @@ fn node_config<F: ServiceFactory> (
keys.push(seed);
}
let config_path = Some(String::from(root.join("network").to_str().unwrap()));
let net_config_path = config_path.clone();
let network_config = NetworkConfiguration {
config_path: Some(root.join("network").to_str().unwrap().into()),
net_config_path: Some(root.join("network").to_str().unwrap().into()),
config_path,
net_config_path,
listen_addresses: vec! [
iter::once(Protocol::Ip4(Ipv4Addr::new(127, 0, 0, 1)))
.chain(iter::once(Protocol::Tcp(base_port + index as u16)))
iter::once(multiaddr::Protocol::Ip4(Ipv4Addr::new(127, 0, 0, 1)))
.chain(iter::once(multiaddr::Protocol::Tcp(base_port + index as u16)))
.collect()
],
public_addresses: vec![],
boot_nodes: vec![],
use_secret: Some(blake2_256(node_private_key_string(index).as_bytes())),
node_key: NodeKeyConfig::Ed25519(Secret::New),
in_peers: 50,
out_peers: 450,
reserved_nodes: vec![],