Complete merging of network addition branch

This commit is contained in:
Age Manning 2019-06-23 12:34:00 +10:00
parent cf459b60a9
commit 84ea5adffe
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93
11 changed files with 12 additions and 22 deletions

View File

@ -22,5 +22,4 @@ tokio-timer = "0.2.10"
futures = "0.1.25"
exit-future = "0.1.3"
state_processing = { path = "../eth2/state_processing" }
slog = "^2.2.3"
env_logger = "0.6.1"

View File

@ -3,7 +3,6 @@ use eth2_libp2p::multiaddr::Protocol;
use eth2_libp2p::Multiaddr;
use fork_choice::ForkChoiceAlgorithm;
use http_server::HttpServerConfig;
use network::NetworkConfig;
use network::{ChainType, NetworkConfig};
use serde_derive::{Deserialize, Serialize};
use slog::{error, o, Drain, Level};
@ -29,7 +28,7 @@ impl Default for ClientConfig {
db_name: "chain_db".to_string(),
// Note: there are no default bootnodes specified.
// Once bootnodes are established, add them here.
network: NetworkConfig::new(vec![]),
network: NetworkConfig::new(),
rpc: rpc::RPCConfig::default(),
http: HttpServerConfig::default(),
}

View File

@ -8,7 +8,7 @@ edition = "2018"
beacon_chain = { path = "../beacon_chain" }
clap = "2.32.0"
# SigP repository
libp2p = { git = "https://github.com/SigP/rust-libp2p", rev = "8d5e5bbbe32d07ad271d6a2e15fde0347894061a" }
libp2p = { git = "https://github.com/SigP/rust-libp2p", rev = "71744d4090ebd93a993d1b390787919add4098fd" }
types = { path = "../../eth2/types" }
serde = "1.0"
serde_derive = "1.0"

View File

@ -111,14 +111,16 @@ impl<TSubstream: AsyncRead + AsyncWrite> NetworkBehaviourEventProcess<IdentifyEv
);
info.listen_addrs.truncate(20);
}
self.events
.push(BehaviourEvent::Identified(peer_id, Box::new(info)));
trace!(self.log, "Found addresses"; "Peer Id" => format!("{:?}", peer_id), "Addresses" => format!("{:?}", info.listen_addrs));
// inject the found addresses into our discovery behaviour
for address in &info.listen_addrs {
self.discovery
.add_connected_address(&peer_id, address.clone());
}
self.events
.push(BehaviourEvent::Identified(peer_id, Box::new(info)));
}
IdentifyEvent::Error { .. } => {}
IdentifyEvent::SendBack { .. } => {}

View File

@ -1,8 +1,8 @@
use clap::ArgMatches;
use libp2p::gossipsub::{GossipsubConfig, GossipsubConfigBuilder};
use libp2p::multiaddr::{Error as MultiaddrError, Multiaddr};
use serde_derive::{Deserialize, Serialize};
use std::time::Duration;
use types::multiaddr::{Error as MultiaddrError, Multiaddr};
/// The beacon node topic string to subscribe to.
pub const BEACON_PUBSUB_TOPIC: &str = "beacon_node";

View File

@ -55,7 +55,7 @@ impl<TSubstream> Discovery<TSubstream> {
/// We have discovered an address for a peer, add it to known peers.
pub fn add_connected_address(&mut self, peer_id: &PeerId, address: Multiaddr) {
// pass the address on to kademlia
self.discovery.add_connected_address(peer_id, address);
self.discovery.add_address(peer_id, address);
}
}

View File

@ -5,7 +5,6 @@ use eth2_libp2p::rpc::methods::*;
use eth2_libp2p::rpc::{RPCRequest, RPCResponse, RequestId};
use eth2_libp2p::PeerId;
use slog::{debug, error, info, o, trace, warn};
use ssz::TreeHash;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;

View File

@ -62,7 +62,6 @@ pub fn start_server<T: BeaconChainTypes + Clone + 'static>(
let instance = AttestationServiceInstance {
network_chan,
chain: beacon_chain.clone(),
network_chan,
log: log.clone(),
};
create_attestation_service(instance)

View File

@ -4,7 +4,7 @@ use clap::{App, Arg};
use client::{ClientConfig, Eth2Config};
use env_logger::{Builder, Env};
use eth2_config::{get_data_dir, read_from_file, write_to_file};
use slog::{crit, o, Drain};
use slog::{crit, o, Drain, Level};
use std::path::PathBuf;
pub const DEFAULT_DATA_DIR: &str = ".lighthouse";

View File

@ -32,7 +32,6 @@ swap_or_not_shuffle = { path = "../utils/swap_or_not_shuffle" }
test_random_derive = { path = "../utils/test_random_derive" }
tree_hash = { path = "../utils/tree_hash" }
tree_hash_derive = { path = "../utils/tree_hash_derive" }
libp2p = { git = "https://github.com/SigP/rust-libp2p", rev = "b3c32d9a821ae6cc89079499cc6e8a6bab0bffc3" }
[dev-dependencies]
env_logger = "0.6.0"

View File

@ -104,10 +104,7 @@ pub struct ChainSpec {
domain_voluntary_exit: u32,
domain_transfer: u32,
/*
* Network specific parameters
*/
pub boot_nodes: Vec<Multiaddr>,
pub boot_nodes: Vec<String>,
pub chain_id: u8,
}
@ -230,12 +227,8 @@ impl ChainSpec {
pub fn minimal() -> Self {
let genesis_slot = Slot::new(0);
// Note: these bootnodes are placeholders.
//
// Should be updated once static bootnodes exist.
let boot_nodes = vec!["/ip4/127.0.0.1/tcp/9000"
.parse()
.expect("correct multiaddr")];
// Note: bootnodes to be updated when static nodes exist.
let boot_nodes = vec![];
Self {
target_committee_size: 4,