Skip to content

Commit

Permalink
fix(network): remove quic_port from NetworkConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahakShama committed Dec 10, 2024
1 parent a24b326 commit 14137b4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 39 deletions.
10 changes: 0 additions & 10 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 0 additions & 8 deletions crates/papyrus_network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 6 additions & 10 deletions crates/papyrus_network/src/network_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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 {
Expand Down Expand Up @@ -617,7 +617,6 @@ impl NetworkManager {
pub fn new(config: NetworkConfig, node_version: Option<String>) -> Self {
let NetworkConfig {
tcp_port,
quic_port: _,
session_timeout,
idle_connection_timeout,
bootstrap_peer_multiaddr,
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_network/src/network_manager/swarm_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
4 changes: 2 additions & 2 deletions crates/papyrus_network/src/network_manager/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
4 changes: 2 additions & 2 deletions crates/papyrus_network/src/network_manager/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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<Query, Response>(
buffer_size: usize,
Expand Down
7 changes: 1 addition & 6 deletions crates/sequencing/papyrus_consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 14137b4

Please sign in to comment.