From 1d3566d5e7968391a656ef67807e605d6ca59e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Le=C5=9Bniak?= Date: Mon, 31 Oct 2022 12:17:11 +0100 Subject: [PATCH 1/5] trait ConnectionInfo --- finality-aleph/src/tcp_network.rs | 26 +++++++++++++++++++- finality-aleph/src/validator_network/mock.rs | 21 +++++++++++++++- finality-aleph/src/validator_network/mod.rs | 14 ++++++++--- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/finality-aleph/src/tcp_network.rs b/finality-aleph/src/tcp_network.rs index d04bd4da6d..0c4d1af8f8 100644 --- a/finality-aleph/src/tcp_network.rs +++ b/finality-aleph/src/tcp_network.rs @@ -10,9 +10,33 @@ use tokio::net::{ use crate::{ network::{Multiaddress, NetworkIdentity, PeerId}, - validator_network::{Dialer, Listener, Splittable}, + validator_network::{ConnectionInfo, Dialer, Listener, Splittable}, }; +impl ConnectionInfo for TcpStream { + type Address = std::net::SocketAddr; + + fn peer_address(&self) -> Result { + self.peer_addr() + } +} + +impl ConnectionInfo for OwnedWriteHalf { + type Address = std::net::SocketAddr; + + fn peer_address(&self) -> Result { + self.peer_addr() + } +} + +impl ConnectionInfo for OwnedReadHalf { + type Address = std::net::SocketAddr; + + fn peer_address(&self) -> Result { + self.peer_addr() + } +} + impl Splittable for TcpStream { type Sender = OwnedWriteHalf; type Receiver = OwnedReadHalf; diff --git a/finality-aleph/src/validator_network/mock.rs b/finality-aleph/src/validator_network/mock.rs index 117f70178d..021bdfa179 100644 --- a/finality-aleph/src/validator_network/mock.rs +++ b/finality-aleph/src/validator_network/mock.rs @@ -10,7 +10,10 @@ use aleph_primitives::{AuthorityId, KEY_TYPE}; use sp_keystore::{testing::KeyStore, CryptoStore}; use tokio::io::{duplex, AsyncRead, AsyncWrite, DuplexStream, ReadBuf}; -use crate::{crypto::AuthorityPen, validator_network::Splittable}; +use crate::{ + crypto::AuthorityPen, + validator_network::{ConnectionInfo, Splittable}, +}; /// Create a single authority id and pen of the same type, not related to each other. pub async fn keys() -> (AuthorityId, AuthorityPen) { @@ -74,6 +77,22 @@ impl AsyncWrite for MockSplittable { } } +impl ConnectionInfo for MockSplittable { + type Address = String; + + fn peer_address(&self) -> Result { + Ok(String::from("MOCK_ADDRESS")) + } +} + +impl ConnectionInfo for DuplexStream { + type Address = String; + + fn peer_address(&self) -> Result { + Ok(String::from("MOCK_ADDRESS")) + } +} + impl Splittable for MockSplittable { type Sender = DuplexStream; type Receiver = DuplexStream; diff --git a/finality-aleph/src/validator_network/mod.rs b/finality-aleph/src/validator_network/mod.rs index db5d5e5000..2b6552dcb9 100644 --- a/finality-aleph/src/validator_network/mod.rs +++ b/finality-aleph/src/validator_network/mod.rs @@ -49,10 +49,18 @@ pub trait Network: Send + 'static { async fn next(&mut self) -> Option; } +/// Reports address of the peer that we are connected to. +pub trait ConnectionInfo { + type Address: Display; + + /// Return the address of the peer that we are connected to. + fn peer_address(&self) -> Result; +} + /// A stream that can be split into a sending and receiving part. -pub trait Splittable: AsyncWrite + AsyncRead + Unpin + Send { - type Sender: AsyncWrite + Unpin + Send; - type Receiver: AsyncRead + Unpin + Send; +pub trait Splittable: AsyncWrite + AsyncRead + ConnectionInfo + Unpin + Send { + type Sender: AsyncWrite + ConnectionInfo + Unpin + Send; + type Receiver: AsyncRead + ConnectionInfo + Unpin + Send; /// Split into the sending and receiving part. fn split(self) -> (Self::Sender, Self::Receiver); From 070d832b8af757f1b1fbe4c77c30a1cefacf456b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Le=C5=9Bniak?= Date: Mon, 31 Oct 2022 19:11:35 +0100 Subject: [PATCH 2/5] done --- finality-aleph/src/tcp_network.rs | 27 +++++++------- .../src/testing/mocks/validator_network.rs | 31 ++++++++++++++-- .../src/validator_network/incoming.rs | 3 +- finality-aleph/src/validator_network/mock.rs | 14 +++----- finality-aleph/src/validator_network/mod.rs | 6 ++-- .../src/validator_network/outgoing.rs | 36 +++++++++---------- 6 files changed, 69 insertions(+), 48 deletions(-) diff --git a/finality-aleph/src/tcp_network.rs b/finality-aleph/src/tcp_network.rs index 0c4d1af8f8..f0fa9686ff 100644 --- a/finality-aleph/src/tcp_network.rs +++ b/finality-aleph/src/tcp_network.rs @@ -14,26 +14,29 @@ use crate::{ }; impl ConnectionInfo for TcpStream { - type Address = std::net::SocketAddr; - - fn peer_address(&self) -> Result { - self.peer_addr() + fn peer_address_info(&self) -> String { + match self.peer_addr() { + Ok(addr) => addr.to_string(), + Err(e) => e.to_string(), + } } } impl ConnectionInfo for OwnedWriteHalf { - type Address = std::net::SocketAddr; - - fn peer_address(&self) -> Result { - self.peer_addr() + fn peer_address_info(&self) -> String { + match self.peer_addr() { + Ok(addr) => addr.to_string(), + Err(e) => e.to_string(), + } } } impl ConnectionInfo for OwnedReadHalf { - type Address = std::net::SocketAddr; - - fn peer_address(&self) -> Result { - self.peer_addr() + fn peer_address_info(&self) -> String { + match self.peer_addr() { + Ok(addr) => addr.to_string(), + Err(e) => e.to_string(), + } } } diff --git a/finality-aleph/src/testing/mocks/validator_network.rs b/finality-aleph/src/testing/mocks/validator_network.rs index 17bc72cbd0..1ed693869d 100644 --- a/finality-aleph/src/testing/mocks/validator_network.rs +++ b/finality-aleph/src/testing/mocks/validator_network.rs @@ -26,7 +26,8 @@ use crate::{ crypto::AuthorityPen, network::{mock::Channel, Data, Multiaddress, NetworkIdentity}, validator_network::{ - mock::random_keys, Dialer as DialerT, Listener as ListenerT, Network, Service, Splittable, + mock::random_keys, ConnectionInfo, Dialer as DialerT, Listener as ListenerT, Network, + PeerAddressInfo, Service, Splittable, }, }; @@ -119,6 +120,7 @@ impl MockNetwork { pub struct UnreliableDuplexStream { stream: DuplexStream, counter: Option, + peer_address: Address, } impl AsyncWrite for UnreliableDuplexStream { @@ -160,11 +162,16 @@ impl AsyncRead for UnreliableDuplexStream { pub struct UnreliableSplittable { incoming_data: UnreliableDuplexStream, outgoing_data: UnreliableDuplexStream, + peer_address: Address, } impl UnreliableSplittable { /// Create a pair of mock splittables connected to each other. - pub fn new(max_buf_size: usize, ends_after: Option) -> (Self, Self) { + pub fn new( + max_buf_size: usize, + ends_after: Option, + peer_address: Address, + ) -> (Self, Self) { let (in_a, out_b) = duplex(max_buf_size); let (in_b, out_a) = duplex(max_buf_size); ( @@ -172,21 +179,27 @@ impl UnreliableSplittable { incoming_data: UnreliableDuplexStream { stream: in_a, counter: ends_after, + peer_address, }, outgoing_data: UnreliableDuplexStream { stream: out_a, counter: ends_after, + peer_address, }, + peer_address, }, UnreliableSplittable { incoming_data: UnreliableDuplexStream { stream: in_b, counter: ends_after, + peer_address, }, outgoing_data: UnreliableDuplexStream { stream: out_b, counter: ends_after, + peer_address, }, + peer_address, }, ) } @@ -216,6 +229,18 @@ impl AsyncWrite for UnreliableSplittable { } } +impl ConnectionInfo for UnreliableSplittable { + fn peer_address_info(&self) -> PeerAddressInfo { + self.peer_address.to_string() + } +} + +impl ConnectionInfo for UnreliableDuplexStream { + fn peer_address_info(&self) -> PeerAddressInfo { + self.peer_address.to_string() + } +} + impl Splittable for UnreliableSplittable { type Sender = UnreliableDuplexStream; type Receiver = UnreliableDuplexStream; @@ -308,7 +333,7 @@ impl UnreliableConnectionMaker { info!(target: "validator-network", "UnreliableConnectionMaker: waiting for new request..."); let (addr, c) = self.dialers.next().await.expect("should receive"); info!(target: "validator-network", "UnreliableConnectionMaker: received request"); - let (l_stream, r_stream) = Connection::new(4096, connections_end_after); + let (l_stream, r_stream) = Connection::new(4096, connections_end_after, addr); info!(target: "validator-network", "UnreliableConnectionMaker: sending stream"); c.send(l_stream).expect("should send"); self.listeners[addr as usize] diff --git a/finality-aleph/src/validator_network/incoming.rs b/finality-aleph/src/validator_network/incoming.rs index 2200c41b8b..60f41089e4 100644 --- a/finality-aleph/src/validator_network/incoming.rs +++ b/finality-aleph/src/validator_network/incoming.rs @@ -65,7 +65,8 @@ pub async fn incoming( result_for_parent: mpsc::UnboundedSender<(AuthorityId, oneshot::Sender<()>)>, data_for_user: mpsc::UnboundedSender, ) { + let addr = stream.peer_address_info(); if let Err(e) = manage_incoming(authority_pen, stream, result_for_parent, data_for_user).await { - info!(target: "validator-network", "Incoming connection failed: {}", e); + info!(target: "validator-network", "Incoming connection failed: {}. Peer address info: {}", e, addr); } } diff --git a/finality-aleph/src/validator_network/mock.rs b/finality-aleph/src/validator_network/mock.rs index 349ba9c574..383a365501 100644 --- a/finality-aleph/src/validator_network/mock.rs +++ b/finality-aleph/src/validator_network/mock.rs @@ -13,7 +13,7 @@ use tokio::io::{duplex, AsyncRead, AsyncWrite, DuplexStream, ReadBuf}; use crate::{ crypto::AuthorityPen, - validator_network::{ConnectionInfo, Splittable}, + validator_network::{ConnectionInfo, PeerAddressInfo, Splittable}, }; /// Create a random authority id and pen pair. @@ -90,18 +90,14 @@ impl AsyncWrite for MockSplittable { } impl ConnectionInfo for MockSplittable { - type Address = String; - - fn peer_address(&self) -> Result { - Ok(String::from("MOCK_ADDRESS")) + fn peer_address_info(&self) -> PeerAddressInfo { + String::from("MOCK_ADDRESS") } } impl ConnectionInfo for DuplexStream { - type Address = String; - - fn peer_address(&self) -> Result { - Ok(String::from("MOCK_ADDRESS")) + fn peer_address_info(&self) -> PeerAddressInfo { + String::from("MOCK_ADDRESS") } } diff --git a/finality-aleph/src/validator_network/mod.rs b/finality-aleph/src/validator_network/mod.rs index 69e4d7309a..1afa9a8d56 100644 --- a/finality-aleph/src/validator_network/mod.rs +++ b/finality-aleph/src/validator_network/mod.rs @@ -49,12 +49,12 @@ pub trait Network: Send + 'static { async fn next(&mut self) -> Option; } +pub type PeerAddressInfo = String; + /// Reports address of the peer that we are connected to. pub trait ConnectionInfo { - type Address: Display; - /// Return the address of the peer that we are connected to. - fn peer_address(&self) -> Result; + fn peer_address_info(&self) -> PeerAddressInfo; } /// A stream that can be split into a sending and receiving part. diff --git a/finality-aleph/src/validator_network/outgoing.rs b/finality-aleph/src/validator_network/outgoing.rs index 36115181ab..497ec8d53a 100644 --- a/finality-aleph/src/validator_network/outgoing.rs +++ b/finality-aleph/src/validator_network/outgoing.rs @@ -10,14 +10,14 @@ use crate::{ validator_network::{ protocol_negotiation::{protocol, ProtocolNegotiationError}, protocols::ProtocolError, - Data, Dialer, + ConnectionInfo, Data, Dialer, PeerAddressInfo, }, }; enum OutgoingError> { Dial(ND::Error), - ProtocolNegotiation(ProtocolNegotiationError), - Protocol(ProtocolError), + ProtocolNegotiation(PeerAddressInfo, ProtocolNegotiationError), + Protocol(PeerAddressInfo, ProtocolError), } impl> Display for OutgoingError { @@ -25,24 +25,16 @@ impl> Display for OutgoingError { use OutgoingError::*; match self { Dial(e) => write!(f, "dial error: {}", e), - ProtocolNegotiation(e) => write!(f, "protocol negotiation error: {}", e), - Protocol(e) => write!(f, "protocol error: {}", e), + ProtocolNegotiation(addr, e) => write!( + f, + "protocol negotiation error: {}, peer address info: {}", + e, addr + ), + Protocol(addr, e) => write!(f, "protocol error: {}, peer address info: {}", e, addr), } } } -impl> From for OutgoingError { - fn from(e: ProtocolNegotiationError) -> Self { - OutgoingError::ProtocolNegotiation(e) - } -} - -impl> From for OutgoingError { - fn from(e: ProtocolError) -> Self { - OutgoingError::Protocol(e) - } -} - async fn manage_outgoing>( authority_pen: AuthorityPen, peer_id: AuthorityId, @@ -55,12 +47,16 @@ async fn manage_outgoing>( .connect(addresses) .await .map_err(OutgoingError::Dial)?; + let peer_address_info = stream.peer_address_info(); debug!(target: "validator-network", "Performing outgoing protocol negotiation."); - let (stream, protocol) = protocol(stream).await?; + let (stream, protocol) = protocol(stream) + .await + .map_err(|e| OutgoingError::ProtocolNegotiation(peer_address_info.clone(), e))?; debug!(target: "validator-network", "Negotiated protocol, running."); - Ok(protocol + protocol .manage_outgoing(stream, authority_pen, peer_id, result_for_parent) - .await?) + .await + .map_err(|e| OutgoingError::Protocol(peer_address_info.clone(), e)) } const RETRY_DELAY: Duration = Duration::from_secs(10); From ca316a032c4fba30fe73764abdab634a4aec8e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Le=C5=9Bniak?= Date: Mon, 7 Nov 2022 11:48:05 +0100 Subject: [PATCH 3/5] fix --- finality-aleph/src/tcp_network.rs | 2 +- .../src/testing/mocks/validator_network.rs | 52 +++++++++++-------- .../src/validator_network/incoming.rs | 2 +- .../src/validator_network/outgoing.rs | 10 ++-- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/finality-aleph/src/tcp_network.rs b/finality-aleph/src/tcp_network.rs index f0fa9686ff..dd2ee8ef5b 100644 --- a/finality-aleph/src/tcp_network.rs +++ b/finality-aleph/src/tcp_network.rs @@ -17,7 +17,7 @@ impl ConnectionInfo for TcpStream { fn peer_address_info(&self) -> String { match self.peer_addr() { Ok(addr) => addr.to_string(), - Err(e) => e.to_string(), + Err(e) => format!("unknown address: {}", e), } } } diff --git a/finality-aleph/src/testing/mocks/validator_network.rs b/finality-aleph/src/testing/mocks/validator_network.rs index 1ed693869d..de78b23ec5 100644 --- a/finality-aleph/src/testing/mocks/validator_network.rs +++ b/finality-aleph/src/testing/mocks/validator_network.rs @@ -170,36 +170,37 @@ impl UnreliableSplittable { pub fn new( max_buf_size: usize, ends_after: Option, - peer_address: Address, + l_address: Address, + r_address: Address, ) -> (Self, Self) { - let (in_a, out_b) = duplex(max_buf_size); - let (in_b, out_a) = duplex(max_buf_size); + let (l_in, r_out) = duplex(max_buf_size); + let (r_in, l_out) = duplex(max_buf_size); ( UnreliableSplittable { incoming_data: UnreliableDuplexStream { - stream: in_a, + stream: l_in, counter: ends_after, - peer_address, + peer_address: r_address, }, outgoing_data: UnreliableDuplexStream { - stream: out_a, + stream: l_out, counter: ends_after, - peer_address, + peer_address: r_address, }, - peer_address, + peer_address: r_address, }, UnreliableSplittable { incoming_data: UnreliableDuplexStream { - stream: in_b, + stream: r_in, counter: ends_after, - peer_address, + peer_address: l_address, }, outgoing_data: UnreliableDuplexStream { - stream: out_b, + stream: r_out, counter: ends_after, - peer_address, + peer_address: l_address, }, - peer_address, + peer_address: l_address, }, ) } @@ -259,7 +260,9 @@ const TWICE_MAX_DATA_SIZE: usize = 32 * 1024 * 1024; #[derive(Clone)] pub struct MockDialer { - channel_connect: mpsc::UnboundedSender<(Address, oneshot::Sender)>, + // used for logging + own_address: Address, + channel_connect: mpsc::UnboundedSender<(Address, Address, oneshot::Sender)>, } #[async_trait::async_trait] @@ -270,7 +273,7 @@ impl DialerT
for MockDialer { async fn connect(&mut self, addresses: Vec
) -> Result { let (tx, rx) = oneshot::channel(); self.channel_connect - .unbounded_send((addresses[0], tx)) + .unbounded_send((self.own_address, addresses[0], tx)) .expect("should send"); Ok(rx.await.expect("should receive")) } @@ -291,7 +294,7 @@ impl ListenerT for MockListener { } pub struct UnreliableConnectionMaker { - dialers: mpsc::UnboundedReceiver<(Address, oneshot::Sender)>, + dialers: mpsc::UnboundedReceiver<(Address, Address, oneshot::Sender)>, listeners: Vec>, } @@ -313,6 +316,7 @@ impl UnreliableConnectionMaker { for id in ids.into_iter() { let (tx_listener, rx_listener) = mpsc::unbounded(); let dialer = MockDialer { + own_address: addr.get(&id).expect("should be there")[0], channel_connect: tx_dialer.clone(), }; let listener = MockListener { @@ -331,13 +335,19 @@ impl UnreliableConnectionMaker { pub async fn run(&mut self, connections_end_after: Option) { loop { info!(target: "validator-network", "UnreliableConnectionMaker: waiting for new request..."); - let (addr, c) = self.dialers.next().await.expect("should receive"); + let (dialer_address, listener_address, c) = + self.dialers.next().await.expect("should receive"); info!(target: "validator-network", "UnreliableConnectionMaker: received request"); - let (l_stream, r_stream) = Connection::new(4096, connections_end_after, addr); + let (dialer_stream, listener_stream) = Connection::new( + 4096, + connections_end_after, + dialer_address, + listener_address, + ); info!(target: "validator-network", "UnreliableConnectionMaker: sending stream"); - c.send(l_stream).expect("should send"); - self.listeners[addr as usize] - .unbounded_send(r_stream) + c.send(dialer_stream).expect("should send"); + self.listeners[listener_address as usize] + .unbounded_send(listener_stream) .expect("should send"); } } diff --git a/finality-aleph/src/validator_network/incoming.rs b/finality-aleph/src/validator_network/incoming.rs index 60f41089e4..b45bd7135a 100644 --- a/finality-aleph/src/validator_network/incoming.rs +++ b/finality-aleph/src/validator_network/incoming.rs @@ -67,6 +67,6 @@ pub async fn incoming( ) { let addr = stream.peer_address_info(); if let Err(e) = manage_incoming(authority_pen, stream, result_for_parent, data_for_user).await { - info!(target: "validator-network", "Incoming connection failed: {}. Peer address info: {}", e, addr); + info!(target: "validator-network", "Incoming connection from {} failed: {}.", addr, e); } } diff --git a/finality-aleph/src/validator_network/outgoing.rs b/finality-aleph/src/validator_network/outgoing.rs index 497ec8d53a..06ececc713 100644 --- a/finality-aleph/src/validator_network/outgoing.rs +++ b/finality-aleph/src/validator_network/outgoing.rs @@ -27,10 +27,14 @@ impl> Display for OutgoingError { Dial(e) => write!(f, "dial error: {}", e), ProtocolNegotiation(addr, e) => write!( f, - "protocol negotiation error: {}, peer address info: {}", - e, addr + "Outgoing connection to {} failed, protocol negotiation error: {}.", + addr, e + ), + Protocol(addr, e) => write!( + f, + "Outgoing connection to {} failed, protocol error: {}.", + addr, e ), - Protocol(addr, e) => write!(f, "protocol error: {}, peer address info: {}", e, addr), } } } From f2754f1d2dde7763d52f4b36c732cdec58860064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Le=C5=9Bniak?= Date: Tue, 8 Nov 2022 07:56:56 +0100 Subject: [PATCH 4/5] fix again --- finality-aleph/src/validator_network/outgoing.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finality-aleph/src/validator_network/outgoing.rs b/finality-aleph/src/validator_network/outgoing.rs index 06ececc713..c28e36106a 100644 --- a/finality-aleph/src/validator_network/outgoing.rs +++ b/finality-aleph/src/validator_network/outgoing.rs @@ -27,12 +27,12 @@ impl> Display for OutgoingError { Dial(e) => write!(f, "dial error: {}", e), ProtocolNegotiation(addr, e) => write!( f, - "Outgoing connection to {} failed, protocol negotiation error: {}.", + "communication with {} failed, protocol negotiation error: {}", addr, e ), Protocol(addr, e) => write!( f, - "Outgoing connection to {} failed, protocol error: {}.", + "communication with {} failed, protocol error: {}", addr, e ), } From 2ced0049bf7ad7e6143758c19766a97a41766cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Le=C5=9Bniak?= Date: Tue, 8 Nov 2022 08:03:28 +0100 Subject: [PATCH 5/5] even more logs --- finality-aleph/src/validator_network/outgoing.rs | 8 ++++---- finality-aleph/src/validator_network/service.rs | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/finality-aleph/src/validator_network/outgoing.rs b/finality-aleph/src/validator_network/outgoing.rs index c28e36106a..344155b4b0 100644 --- a/finality-aleph/src/validator_network/outgoing.rs +++ b/finality-aleph/src/validator_network/outgoing.rs @@ -1,4 +1,4 @@ -use std::fmt::{Display, Error as FmtError, Formatter}; +use std::fmt::{Debug, Display, Error as FmtError, Formatter}; use aleph_primitives::AuthorityId; use futures::channel::mpsc; @@ -68,7 +68,7 @@ const RETRY_DELAY: Duration = Duration::from_secs(10); /// Establish an outgoing connection to the provided peer using the dialer and then manage it. /// While this works it will send any data from the user to the peer. Any failures will be reported /// to the parent, so that connections can be reestablished if necessary. -pub async fn outgoing>( +pub async fn outgoing>( authority_pen: AuthorityPen, peer_id: AuthorityId, dialer: ND, @@ -79,12 +79,12 @@ pub async fn outgoing>( authority_pen, peer_id.clone(), dialer, - addresses, + addresses.clone(), result_for_parent.clone(), ) .await { - info!(target: "validator-network", "Outgoing connection to {} failed: {}, will retry after {}s.", peer_id, e, RETRY_DELAY.as_secs()); + info!(target: "validator-network", "Outgoing connection to {} {:?} failed: {}, will retry after {}s.", peer_id, addresses, e, RETRY_DELAY.as_secs()); sleep(RETRY_DELAY).await; if result_for_parent.unbounded_send((peer_id, None)).is_err() { debug!(target: "validator-network", "Could not send the closing message, we've probably been terminated by the parent service."); diff --git a/finality-aleph/src/validator_network/service.rs b/finality-aleph/src/validator_network/service.rs index ead09e5256..298d8d8158 100644 --- a/finality-aleph/src/validator_network/service.rs +++ b/finality-aleph/src/validator_network/service.rs @@ -1,3 +1,5 @@ +use std::fmt::Debug; + use aleph_primitives::AuthorityId; use futures::{ channel::{mpsc, oneshot}, @@ -71,7 +73,7 @@ impl Network for ServiceInterface { } /// A service that has to be run for the validator network to work. -pub struct Service, NL: Listener> { +pub struct Service, NL: Listener> { commands_from_interface: mpsc::UnboundedReceiver>, next_to_interface: mpsc::UnboundedSender, manager: Manager, @@ -81,7 +83,7 @@ pub struct Service, NL: Listener> { authority_pen: AuthorityPen, } -impl, NL: Listener> Service { +impl, NL: Listener> Service { /// Create a new validator network service plus an interface for interacting with it. pub fn new( dialer: ND,