misc
This commit is contained in:
Generated
+3
@@ -7519,7 +7519,10 @@ dependencies = [
|
||||
"nym-common",
|
||||
"nym-crypto",
|
||||
"nym-lp-data",
|
||||
"nym-node",
|
||||
"nym-sphinx",
|
||||
"nym-sphinx-addressing",
|
||||
"nym-sphinx-params",
|
||||
"rand 0.8.6",
|
||||
"rand_distr",
|
||||
"serde",
|
||||
|
||||
@@ -197,7 +197,6 @@ default-members = [
|
||||
"service-providers/network-requester",
|
||||
"tools/internal/localnet-orchestrator",
|
||||
"tools/nymvisor",
|
||||
"tools/internal/localnet-orchestrator",
|
||||
]
|
||||
|
||||
exclude = ["contracts", "nym-wallet", "cpu-cycles"]
|
||||
|
||||
@@ -148,6 +148,8 @@ nym-test-utils = { workspace = true }
|
||||
[features]
|
||||
tokio-console = ["console-subscriber", "nym-task/tokio-tracing"]
|
||||
otel = ["nym-bin-common/otel-otlp", "dep:opentelemetry", "dep:opentelemetry_sdk"]
|
||||
mix-sim = []
|
||||
defaul = ["mix-sim"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -33,8 +33,8 @@ use tokio::time::interval;
|
||||
use tracing::*;
|
||||
|
||||
pub mod error;
|
||||
pub(crate) mod messages;
|
||||
mod pipeline;
|
||||
pub mod messages;
|
||||
pub mod pipeline;
|
||||
mod processing;
|
||||
|
||||
const PIPELINE_TICKING_DURATION: Duration = Duration::from_millis(1);
|
||||
|
||||
@@ -12,4 +12,4 @@ mod nymnode;
|
||||
mod wire;
|
||||
|
||||
pub(crate) use mixing_node::MixingNodeDataPipeline;
|
||||
pub(crate) use nymnode::NymNodeDataPipeline;
|
||||
pub use nymnode::NymNodeDataPipeline;
|
||||
|
||||
@@ -29,14 +29,14 @@ use crate::node::{
|
||||
routing_filter::RoutingFilter,
|
||||
};
|
||||
|
||||
pub(crate) struct NymNodeDataPipeline<R> {
|
||||
pub struct NymNodeDataPipeline<R> {
|
||||
state: Arc<SharedLpDataState>,
|
||||
gateway_state: Arc<SharedGatewayLpDataState>,
|
||||
wire: WirePipeline<R>,
|
||||
}
|
||||
|
||||
impl<R: Rng> NymNodeDataPipeline<R> {
|
||||
pub(crate) fn new(
|
||||
pub fn new(
|
||||
state: Arc<SharedLpDataState>,
|
||||
gateway_state: Arc<SharedGatewayLpDataState>,
|
||||
rng: R,
|
||||
|
||||
@@ -19,7 +19,7 @@ pub(crate) const PACKET_BUFFER_SIZE: usize = 100;
|
||||
|
||||
pub mod handler;
|
||||
mod listener;
|
||||
pub(crate) mod shared;
|
||||
pub mod shared;
|
||||
|
||||
pub struct LpDataSetup {
|
||||
listener: LpDataListener,
|
||||
@@ -49,13 +49,8 @@ impl LpDataSetup {
|
||||
shutdown.clone_shutdown_token(),
|
||||
);
|
||||
|
||||
let handler = LpDataHandler::new(
|
||||
shared_state,
|
||||
gateway_state,
|
||||
input_rx,
|
||||
output_tx,
|
||||
&shutdown,
|
||||
)?;
|
||||
let handler =
|
||||
LpDataHandler::new(shared_state, gateway_state, input_rx, output_tx, &shutdown)?;
|
||||
|
||||
Ok(LpDataSetup {
|
||||
listener,
|
||||
|
||||
@@ -24,7 +24,7 @@ use std::{
|
||||
use tracing::{Span, warn};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) struct ProcessingConfig {
|
||||
pub struct ProcessingConfig {
|
||||
pub(crate) maximum_packet_delay: Duration,
|
||||
pub(crate) client_forwarding_enabled: bool,
|
||||
}
|
||||
@@ -39,24 +39,24 @@ impl ProcessingConfig {
|
||||
}
|
||||
|
||||
/// Shared state for LP data connections
|
||||
pub(crate) struct SharedLpDataState {
|
||||
pub struct SharedLpDataState {
|
||||
/// LP configuration (for timestamp validation, etc.)
|
||||
pub lp_config: LpConfig,
|
||||
pub(crate) lp_config: LpConfig,
|
||||
|
||||
pub processing_config: ProcessingConfig,
|
||||
pub(crate) processing_config: ProcessingConfig,
|
||||
|
||||
pub sphinx_keys: ActiveSphinxKeys,
|
||||
pub(crate) sphinx_keys: ActiveSphinxKeys,
|
||||
|
||||
pub replay_protection_filter: ReplayProtectionBloomfilters,
|
||||
pub(crate) replay_protection_filter: ReplayProtectionBloomfilters,
|
||||
|
||||
pub message_reconstructor: MessageReconstructor<Instant, Duration>,
|
||||
pub(crate) message_reconstructor: MessageReconstructor<Instant, Duration>,
|
||||
|
||||
pub routing_filter: NetworkRoutingFilter,
|
||||
pub(crate) routing_filter: NetworkRoutingFilter,
|
||||
|
||||
/// Metrics collection
|
||||
pub metrics: NymNodeMetrics,
|
||||
pub(crate) metrics: NymNodeMetrics,
|
||||
|
||||
pub shutdown_token: ShutdownToken,
|
||||
pub(crate) shutdown_token: ShutdownToken,
|
||||
}
|
||||
|
||||
impl SharedLpDataState {
|
||||
@@ -192,12 +192,12 @@ impl SharedLpDataState {
|
||||
///
|
||||
/// Only constructed and consumed when the node operates in a client-forwarding
|
||||
/// role (entry/exit).
|
||||
pub(crate) struct SharedGatewayLpDataState {
|
||||
pub struct SharedGatewayLpDataState {
|
||||
pub(crate) cached_topology: CachedFullTopology,
|
||||
}
|
||||
|
||||
impl SharedGatewayLpDataState {
|
||||
pub fn new(cached_topology: CachedFullTopology) -> Self {
|
||||
pub(crate) fn new(cached_topology: CachedFullTopology) -> Self {
|
||||
Self { cached_topology }
|
||||
}
|
||||
|
||||
@@ -206,3 +206,47 @@ impl SharedGatewayLpDataState {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "mix-sim")]
|
||||
impl SharedLpDataState {
|
||||
/// Build a [`SharedLpDataState`] for use in a discrete simulator.
|
||||
///
|
||||
/// Initialises the state with:
|
||||
/// - the provided x25519 private key as the only sphinx key (rotation 0),
|
||||
/// - replay protection disabled,
|
||||
/// - the testnet routing filter (allows all destinations),
|
||||
/// - client forwarding enabled,
|
||||
/// - fresh metrics and a never-firing shutdown token.
|
||||
pub fn new_for_simulation(
|
||||
sphinx_private_key: nym_crypto::asymmetric::x25519::PrivateKey,
|
||||
) -> Self {
|
||||
use crate::node::key_rotation::active_keys::ActiveSphinxKeys;
|
||||
use crate::node::key_rotation::key::SphinxPrivateKey;
|
||||
use crate::node::replay_protection::bloomfilter::ReplayProtectionBloomfilters;
|
||||
use crate::node::routing_filter::network_filter::NetworkRoutingFilter;
|
||||
|
||||
let primary = SphinxPrivateKey::import(sphinx_private_key, 0);
|
||||
SharedLpDataState {
|
||||
lp_config: LpConfig::default(),
|
||||
processing_config: ProcessingConfig {
|
||||
maximum_packet_delay: Duration::from_secs(10),
|
||||
client_forwarding_enabled: true,
|
||||
},
|
||||
sphinx_keys: ActiveSphinxKeys::new_loaded(primary, None),
|
||||
replay_protection_filter: ReplayProtectionBloomfilters::new_disabled(),
|
||||
message_reconstructor: MessageReconstructor::default(),
|
||||
routing_filter: NetworkRoutingFilter::new_empty(true),
|
||||
metrics: NymNodeMetrics::default(),
|
||||
shutdown_token: ShutdownToken::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "mix-sim")]
|
||||
impl SharedGatewayLpDataState {
|
||||
pub fn new_for_simulation() -> Self {
|
||||
Self {
|
||||
cached_topology: CachedFullTopology::new_empty(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user