Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion consensus/src/mutator_set/mutator_set_accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ impl MutatorSetAccumulator {

/// Return the lowest and the highest chunk index that are represented in
/// the active window, inclusive.
///
/// The returned limits are inclusive, i.e. they point to the chunk with
/// the lowest chunk index and the chunk with the highest chunk index that
/// are still contained in the active window.
pub fn active_window_chunk_interval(&self) -> (u64, u64) {
let batch_index = self.get_batch_index();
(
batch_index,
batch_index + u64::from(WINDOW_SIZE / CHUNK_SIZE),
batch_index + u64::from(WINDOW_SIZE / CHUNK_SIZE) - 1,
)
}

Expand Down
19 changes: 5 additions & 14 deletions node/src/application/config/cli_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ use clap::Parser;
use libp2p::multiaddr::Protocol;
use libp2p::Multiaddr;
use nyks_consensus::transaction::transaction_proof::TransactionProofQuality;
use nyks_consensus::network::Network;
use nyks_consensus::type_scripts::native_currency_amount::NativeCurrencyAmount;
use nyks_rpc_core::api::ops::Namespace;
use tracing::error;

use crate::application::config::parser::multiaddr::parse_to_multiaddr;
use crate::state::mining::block_proposal::BlockProposalRejectError;
use nyks_consensus::network::Network;
use nyks_consensus::type_scripts::native_currency_amount::NativeCurrencyAmount;
use nyks_rpc_core::api::ops::Namespace;

const MAX_NUM_INPUTS_FOR_PC_BACKED_TXS: u64 = 200;

Expand Down Expand Up @@ -98,15 +98,6 @@ pub struct Args {
)]
pub(crate) max_num_peers: usize,

/// Maximum number of peers to accept from each IP address.
///
/// Multiple nodes can run on the same IP address which would either mean
/// that multiple nodes run on the same machine, or multiple machines are
/// on the same network that uses Network Address Translation and has one
/// public IP.
#[clap(long)]
pub(crate) max_connections_per_ip: Option<usize>,

/// Handshake timeout in seconds.
///
/// The timeout used for all messages received and sent during the handshake
Expand Down Expand Up @@ -170,11 +161,11 @@ pub struct Args {
pub(crate) max_mempool_size: ByteSize,

/// Port on which to listen for libp2p QUIC peer connections.
#[clap(long, default_value = "9800", value_name = "PORT")]
#[clap(long, default_value = "27828", value_name = "PORT")]
pub quic_port: u16,

/// Port on which to listen for libp2p TCP peer connections.
#[clap(long, default_value = "9801", value_name = "PORT")]
#[clap(long, default_value = "27829", value_name = "PORT")]
pub tcp_port: u16,

/// IP on which to listen for peer connections. Will default to all network
Expand Down
1 change: 1 addition & 0 deletions node/src/application/loops/sync_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl SyncLoop {
}
SuccessorsToSync::BlockValidationError => {
tracing::error!("Block validation error occurred during syncing. Possible cause: a reorg happened while syncing. Terminating sync loop.");
break;
}
}

Expand Down
31 changes: 8 additions & 23 deletions node/src/application/network/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ impl RelayStatus {
}
}

/// The libp2p adapter for the Neptune network stack.
/// The libp2p adapter for the Nyks network stack.
///
/// The [`NetworkActor`] serves as a specialized interface between the libp2p
/// network stack and the application's main loop. Unlike typical actor models,
/// this struct does not own the primary event loop; instead, it facilitates the
/// transition of libp2p-negotiated connections into the standard Neptune
/// transition of libp2p-negotiated connections into the standard Nyks
/// protocol ecosystem. Specifically, it mediates establishment of a libp2p
/// stream which it then hijacks and passes to a freshly spawned peer loop.
///
Expand All @@ -104,7 +104,7 @@ impl RelayStatus {
/// the validated [`Stream`](libp2p::Stream) and passes it into a concrete
/// protocol handler.
/// 3. **Protocol Unified Logic**: It spawns the same peer loop used by the
/// legacy network stack. Consequently Neptune message handling remains
/// legacy network stack. Consequently Nyks message handling remains
/// unified regardless of the transport layer.
///
/// ### Integration:
Expand Down Expand Up @@ -734,7 +734,7 @@ impl NetworkActor {
.count()
> 1;
if is_multihop {
tracing::warn!(
tracing::debug!(
"Rejecting multi-hop listen address {address} because multi-hop."
);
return Ok(());
Expand Down Expand Up @@ -1031,25 +1031,6 @@ impl NetworkActor {
};
tracing::debug!("{direction} connection established with {peer_id} at {address}.");

// If this address belongs to one of our sticky peers (`--peer`
// CLI arguments) then make sure we record the `PeerId`.
if self.sticky_peers.contains_key(&address) {
self.sticky_peers.entry(address.clone()).and_modify(|p| {
match p {
StickyPeer::None | StickyPeer::Dialing(_) => {
tracing::debug!(%peer_id, "Found peer id of sticky peer {address}.");
*p = StickyPeer::Connected(peer_id);
},
StickyPeer::Connected(pid) => {
if *pid != peer_id {
tracing::debug!(%peer_id, "Found *new* peer id of sticky peer {address}.");
*pid = peer_id;
}
},
}
});
}

// Store the new connection.
self.active_connections
.entry(peer_id)
Expand Down Expand Up @@ -2030,6 +2011,10 @@ impl NetworkActor {
/// instance if there are not enough active connections without on-going
/// relay commitments.
fn request_peer_relays(&mut self, num_relays: usize) {
if num_relays == 0 {
return;
}

let current_relays = self.relays.keys().collect::<HashSet<_>>();
let mut available_peers = self
.active_connections
Expand Down
4 changes: 2 additions & 2 deletions node/src/application/network/address_book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ pub(crate) struct Peer {
/// Unlike the active connection, these are persistent locations.
pub(crate) listen_addresses: Vec<Multiaddr>,

/// The software version of the node (e.g., "neptune-cash/0.6.0").
/// The software version of the node (e.g., "nyks-node/0.6.0").
/// Useful for telemetry and identifying "heavy" or "light" nodes.
pub(crate) agent_version: String,

/// The protocol version (e.g., "/neptune/-main").
/// The protocol version (e.g., "/nyks/-main").
/// Essential for ensuring you don't sync with incompatible forks.
pub(crate) protocol_version: String,

Expand Down
Loading