diff --git a/config/papyrus/default_config.json b/config/papyrus/default_config.json index 14d41c5994..42575b00ba 100644 --- a/config/papyrus/default_config.json +++ b/config/papyrus/default_config.json @@ -149,11 +149,6 @@ "privacy": "Public", "value": 1000 }, - "consensus.network_config.quic_port": { - "description": "The port that the node listens on for incoming quic connections.", - "privacy": "Public", - "value": 10101 - }, "consensus.network_config.secret_key": { "description": "The secret key used for building the peer id. If it's an empty string a random one will be used.", "privacy": "Private", @@ -294,11 +289,6 @@ "privacy": "Public", "value": 1000 }, - "network.quic_port": { - "description": "The port that the node listens on for incoming quic connections.", - "privacy": "Public", - "value": 10001 - }, "network.secret_key": { "description": "The secret key used for building the peer id. If it's an empty string a random one will be used.", "privacy": "Private", diff --git a/crates/papyrus_network/src/lib.rs b/crates/papyrus_network/src/lib.rs index 136010f92e..c71b583d62 100644 --- a/crates/papyrus_network/src/lib.rs +++ b/crates/papyrus_network/src/lib.rs @@ -42,7 +42,6 @@ use validator::Validate; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Validate)] pub struct NetworkConfig { pub tcp_port: u16, - pub quic_port: u16, #[serde(deserialize_with = "deserialize_seconds_to_duration")] pub session_timeout: Duration, #[serde(deserialize_with = "deserialize_seconds_to_duration")] @@ -66,12 +65,6 @@ impl SerializeConfig for NetworkConfig { "The port that the node listens on for incoming tcp connections.", ParamPrivacyInput::Public, ), - ser_param( - "quic_port", - &self.quic_port, - "The port that the node listens on for incoming quic connections.", - ParamPrivacyInput::Public, - ), ser_param( "session_timeout", &self.session_timeout.as_secs(), @@ -126,7 +119,6 @@ impl Default for NetworkConfig { fn default() -> Self { Self { tcp_port: 10000, - quic_port: 10001, session_timeout: Duration::from_secs(120), idle_connection_timeout: Duration::from_secs(120), bootstrap_peer_multiaddr: None, diff --git a/crates/papyrus_network/src/network_manager/mod.rs b/crates/papyrus_network/src/network_manager/mod.rs index 8fa5434961..decd9749de 100644 --- a/crates/papyrus_network/src/network_manager/mod.rs +++ b/crates/papyrus_network/src/network_manager/mod.rs @@ -12,10 +12,10 @@ use std::task::{Context, Poll}; use async_trait::async_trait; use futures::channel::mpsc::{Receiver, SendError, Sender}; use futures::channel::oneshot; -use futures::future::{ready, BoxFuture, Ready}; +use futures::future::{BoxFuture, Ready, ready}; use futures::sink::With; use futures::stream::{FuturesUnordered, Map, Stream}; -use futures::{pin_mut, FutureExt, Sink, SinkExt, StreamExt}; +use futures::{FutureExt, Sink, SinkExt, StreamExt, pin_mut}; use libp2p::gossipsub::{SubscriptionError, TopicHash}; use libp2p::swarm::SwarmEvent; use libp2p::{Multiaddr, PeerId, StreamProtocol, Swarm}; @@ -31,8 +31,8 @@ use crate::gossipsub_impl::Topic; use crate::mixed_behaviour::{self, BridgedBehaviour}; use crate::sqmr::behaviour::SessionError; use crate::sqmr::{self, InboundSessionId, OutboundSessionId, SessionId}; -use crate::utils::{is_localhost, StreamHashMap}; -use crate::{gossipsub_impl, NetworkConfig}; +use crate::utils::{StreamHashMap, is_localhost}; +use crate::{NetworkConfig, gossipsub_impl}; #[derive(thiserror::Error, Debug)] pub enum NetworkError { @@ -617,7 +617,6 @@ impl NetworkManager { pub fn new(config: NetworkConfig, node_version: Option) -> Self { let NetworkConfig { tcp_port, - quic_port: _, session_timeout, idle_connection_timeout, bootstrap_peer_multiaddr, @@ -628,11 +627,8 @@ impl NetworkManager { peer_manager_config, } = config; - let listen_addresses = vec![ - // TODO: uncomment once quic transpot works. - // format!("/ip4/0.0.0.0/udp/{quic_port}/quic-v1"), - format!("/ip4/0.0.0.0/tcp/{tcp_port}"), - ]; + // TODO(shahak): Add quic transport. + let listen_addresses = vec![format!("/ip4/0.0.0.0/tcp/{tcp_port}")]; let swarm = build_swarm(listen_addresses, idle_connection_timeout, secret_key, |key| { mixed_behaviour::MixedBehaviour::new( diff --git a/crates/papyrus_network/src/network_manager/swarm_trait.rs b/crates/papyrus_network/src/network_manager/swarm_trait.rs index d91cfc7f9b..b64b0ff097 100644 --- a/crates/papyrus_network/src/network_manager/swarm_trait.rs +++ b/crates/papyrus_network/src/network_manager/swarm_trait.rs @@ -8,7 +8,7 @@ use tracing::{info, warn}; use super::BroadcastedMessageMetadata; use crate::gossipsub_impl::Topic; use crate::mixed_behaviour; -use crate::peer_manager::{ReputationModifier, MALICIOUS}; +use crate::peer_manager::{MALICIOUS, ReputationModifier}; use crate::sqmr::behaviour::{PeerNotConnected, SessionIdNotFoundError}; use crate::sqmr::{Bytes, InboundSessionId, OutboundSessionId, SessionId}; diff --git a/crates/papyrus_network/src/network_manager/test.rs b/crates/papyrus_network/src/network_manager/test.rs index 1859836305..ea112e81ef 100644 --- a/crates/papyrus_network/src/network_manager/test.rs +++ b/crates/papyrus_network/src/network_manager/test.rs @@ -6,11 +6,11 @@ use std::time::Duration; use std::vec; use deadqueue::unlimited::Queue; -use futures::channel::mpsc::{unbounded, UnboundedSender}; +use futures::channel::mpsc::{UnboundedSender, unbounded}; use futures::channel::oneshot; use futures::future::FutureExt; use futures::stream::Stream; -use futures::{pin_mut, Future, SinkExt, StreamExt}; +use futures::{Future, SinkExt, StreamExt, pin_mut}; use lazy_static::lazy_static; use libp2p::core::ConnectedPoint; use libp2p::gossipsub::{SubscriptionError, TopicHash}; diff --git a/crates/papyrus_network/src/network_manager/test_utils.rs b/crates/papyrus_network/src/network_manager/test_utils.rs index be1f65427b..5c6f5cd60c 100644 --- a/crates/papyrus_network/src/network_manager/test_utils.rs +++ b/crates/papyrus_network/src/network_manager/test_utils.rs @@ -3,7 +3,7 @@ use std::time::Duration; use futures::channel::mpsc::{Receiver, SendError, Sender}; use futures::channel::oneshot; -use futures::future::{ready, Ready}; +use futures::future::{Ready, ready}; use futures::sink::With; use futures::stream::Map; use futures::{SinkExt, StreamExt}; @@ -26,9 +26,9 @@ use super::{ SqmrServerReceiver, Topic, }; +use crate::NetworkConfig; use crate::network_manager::{BroadcastReceivedMessagesConverterFn, BroadcastTopicChannels}; use crate::sqmr::Bytes; -use crate::NetworkConfig; pub fn mock_register_sqmr_protocol_client( buffer_size: usize, diff --git a/crates/sequencing/papyrus_consensus/src/config.rs b/crates/sequencing/papyrus_consensus/src/config.rs index e6016cea60..80cb011484 100644 --- a/crates/sequencing/papyrus_consensus/src/config.rs +++ b/crates/sequencing/papyrus_consensus/src/config.rs @@ -20,7 +20,6 @@ use super::types::ValidatorId; use crate::types::DEFAULT_VALIDATOR_ID; const CONSENSUS_TCP_PORT: u16 = 10100; -const CONSENSUS_QUIC_PORT: u16 = 10101; /// Configuration for consensus. #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] @@ -94,11 +93,7 @@ impl SerializeConfig for ConsensusConfig { impl Default for ConsensusConfig { fn default() -> Self { - let network_config = NetworkConfig { - tcp_port: CONSENSUS_TCP_PORT, - quic_port: CONSENSUS_QUIC_PORT, - ..Default::default() - }; + let network_config = NetworkConfig { tcp_port: CONSENSUS_TCP_PORT, ..Default::default() }; Self { chain_id: ChainId::Other("0x0".to_string()), validator_id: ValidatorId::from(DEFAULT_VALIDATOR_ID),