Merge remote-tracking branch 'origin/master' into validator_client-luke_wip
This commit is contained in:
		
						commit
						16706d322f
					
				| @ -6,7 +6,7 @@ edition = "2018" | |||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
| # SigP repository until PR is merged | # SigP repository until PR is merged | ||||||
| libp2p =  { git = "https://github.com/SigP/rust-libp2p", branch = "gossipsub" } | libp2p =  { git = "https://github.com/SigP/rust-libp2p", rev = "b3c32d9a821ae6cc89079499cc6e8a6bab0bffc3" } | ||||||
| types = { path =  "../../eth2/types" } | types = { path =  "../../eth2/types" } | ||||||
| ssz = { path = "../../eth2/utils/ssz" } | ssz = { path = "../../eth2/utils/ssz" } | ||||||
| ssz_derive = { path = "../../eth2/utils/ssz_derive" } | ssz_derive = { path = "../../eth2/utils/ssz_derive" } | ||||||
|  | |||||||
| @ -29,7 +29,9 @@ impl Default for Config { | |||||||
|                 .parse() |                 .parse() | ||||||
|                 .expect("is a correct multi-address")], |                 .expect("is a correct multi-address")], | ||||||
|             listen_port: 9000, |             listen_port: 9000, | ||||||
|             gs_config: GossipsubConfigBuilder::new().build(), |             gs_config: GossipsubConfigBuilder::new() | ||||||
|  |                 .max_gossip_size(4_000_000) | ||||||
|  |                 .build(), | ||||||
|             identify_config: IdentifyConfig::default(), |             identify_config: IdentifyConfig::default(), | ||||||
|             boot_nodes: Vec::new(), |             boot_nodes: Vec::new(), | ||||||
|             client_version: version::version(), |             client_version: version::version(), | ||||||
|  | |||||||
| @ -60,10 +60,13 @@ where | |||||||
| { | { | ||||||
|     type Output = RPCEvent; |     type Output = RPCEvent; | ||||||
|     type Error = DecodeError; |     type Error = DecodeError; | ||||||
|     type Future = |     type Future = upgrade::ReadOneThen< | ||||||
|         upgrade::ReadOneThen<TSocket, (), fn(Vec<u8>, ()) -> Result<RPCEvent, DecodeError>>; |         upgrade::Negotiated<TSocket>, | ||||||
|  |         (), | ||||||
|  |         fn(Vec<u8>, ()) -> Result<RPCEvent, DecodeError>, | ||||||
|  |     >; | ||||||
| 
 | 
 | ||||||
|     fn upgrade_inbound(self, socket: TSocket, _: Self::Info) -> Self::Future { |     fn upgrade_inbound(self, socket: upgrade::Negotiated<TSocket>, _: Self::Info) -> Self::Future { | ||||||
|         upgrade::read_one_then(socket, MAX_READ_SIZE, (), |packet, ()| Ok(decode(packet)?)) |         upgrade::read_one_then(socket, MAX_READ_SIZE, (), |packet, ()| Ok(decode(packet)?)) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -154,10 +157,10 @@ where | |||||||
| { | { | ||||||
|     type Output = (); |     type Output = (); | ||||||
|     type Error = io::Error; |     type Error = io::Error; | ||||||
|     type Future = upgrade::WriteOne<TSocket>; |     type Future = upgrade::WriteOne<upgrade::Negotiated<TSocket>>; | ||||||
| 
 | 
 | ||||||
|     #[inline] |     #[inline] | ||||||
|     fn upgrade_outbound(self, socket: TSocket, _: Self::Info) -> Self::Future { |     fn upgrade_outbound(self, socket: upgrade::Negotiated<TSocket>, _: Self::Info) -> Self::Future { | ||||||
|         let bytes = ssz_encode(&self); |         let bytes = ssz_encode(&self); | ||||||
|         upgrade::write_one(socket, bytes) |         upgrade::write_one(socket, bytes) | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ use crate::NetworkConfig; | |||||||
| use futures::prelude::*; | use futures::prelude::*; | ||||||
| use futures::Stream; | use futures::Stream; | ||||||
| use libp2p::core::{ | use libp2p::core::{ | ||||||
|  |     identity, | ||||||
|     muxing::StreamMuxerBox, |     muxing::StreamMuxerBox, | ||||||
|     nodes::Substream, |     nodes::Substream, | ||||||
|     transport::boxed::Boxed, |     transport::boxed::Boxed, | ||||||
| @ -36,10 +37,10 @@ impl Service { | |||||||
|         // TODO: Currently using secp256k1 key pairs. Wire protocol specifies RSA. Waiting for this
 |         // TODO: Currently using secp256k1 key pairs. Wire protocol specifies RSA. Waiting for this
 | ||||||
|         // PR to be merged to generate RSA keys: https://github.com/briansmith/ring/pull/733
 |         // PR to be merged to generate RSA keys: https://github.com/briansmith/ring/pull/733
 | ||||||
|         // TODO: Save and recover node key from disk
 |         // TODO: Save and recover node key from disk
 | ||||||
|         let local_private_key = secio::SecioKeyPair::secp256k1_generated().unwrap(); |         let local_private_key = identity::Keypair::generate_secp256k1(); | ||||||
| 
 | 
 | ||||||
|         let local_public_key = local_private_key.to_public_key(); |         let local_public_key = local_private_key.public(); | ||||||
|         let local_peer_id = local_private_key.to_peer_id(); |         let local_peer_id = PeerId::from(local_private_key.public()); | ||||||
|         info!(log, "Local peer id: {:?}", local_peer_id); |         info!(log, "Local peer id: {:?}", local_peer_id); | ||||||
| 
 | 
 | ||||||
|         let mut swarm = { |         let mut swarm = { | ||||||
| @ -132,9 +133,7 @@ impl Stream for Service { | |||||||
| 
 | 
 | ||||||
| /// The implementation supports TCP/IP, WebSockets over TCP/IP, secio as the encryption layer, and
 | /// The implementation supports TCP/IP, WebSockets over TCP/IP, secio as the encryption layer, and
 | ||||||
| /// mplex or yamux as the multiplexing layer.
 | /// mplex or yamux as the multiplexing layer.
 | ||||||
| fn build_transport( | fn build_transport(local_private_key: identity::Keypair) -> Boxed<(PeerId, StreamMuxerBox), Error> { | ||||||
|     local_private_key: secio::SecioKeyPair, |  | ||||||
| ) -> Boxed<(PeerId, StreamMuxerBox), Error> { |  | ||||||
|     // TODO: The Wire protocol currently doesn't specify encryption and this will need to be customised
 |     // TODO: The Wire protocol currently doesn't specify encryption and this will need to be customised
 | ||||||
|     // in the future.
 |     // in the future.
 | ||||||
|     let transport = libp2p::tcp::TcpConfig::new(); |     let transport = libp2p::tcp::TcpConfig::new(); | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ ssz = { path = "../utils/ssz" } | |||||||
| ssz_derive = { path = "../utils/ssz_derive" } | ssz_derive = { path = "../utils/ssz_derive" } | ||||||
| swap_or_not_shuffle = { path = "../utils/swap_or_not_shuffle" } | swap_or_not_shuffle = { path = "../utils/swap_or_not_shuffle" } | ||||||
| test_random_derive = { path = "../utils/test_random_derive" } | test_random_derive = { path = "../utils/test_random_derive" } | ||||||
| libp2p =  { git = "https://github.com/SigP/rust-libp2p", branch = "gossipsub" } | libp2p =  { git = "https://github.com/SigP/rust-libp2p", rev = "b3c32d9a821ae6cc89079499cc6e8a6bab0bffc3" } | ||||||
| 
 | 
 | ||||||
| [dev-dependencies] | [dev-dependencies] | ||||||
| env_logger = "0.6.0" | env_logger = "0.6.0" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user