Skip to content
Open
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
7 changes: 5 additions & 2 deletions monad-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,11 @@ where

let shared_key = Arc::new(identity);
let wireauth_config = monad_wireauth::Config::default();
let auth_protocol =
monad_raptorcast::auth::WireAuthProtocol::new(wireauth_config, shared_key.clone());
let auth_protocol = monad_raptorcast::auth::WireAuthProtocol::new(
&monad_raptorcast::auth::metrics::UDP_METRICS,
wireauth_config,
shared_key.clone(),
);

MultiRouter::new(
self_id,
Expand Down
7 changes: 5 additions & 2 deletions monad-raptorcast/examples/latency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,11 @@ fn setup_node(

let keypair_arc = Arc::new(keypair);
let wireauth_config = monad_wireauth::Config::default();
let auth_protocol =
monad_raptorcast::auth::WireAuthProtocol::new(wireauth_config, keypair_arc.clone());
let auth_protocol = monad_raptorcast::auth::WireAuthProtocol::new(
&monad_raptorcast::auth::metrics::UDP_METRICS,
wireauth_config,
keypair_arc.clone(),
);

let mut raptorcast = RaptorCast::<
SignatureType,
Expand Down
2 changes: 2 additions & 0 deletions monad-raptorcast/src/auth/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ pub const GAUGE_RAPTORCAST_AUTH_AUTHENTICATED_UDP_BYTES_READ: &str =
"monad.raptorcast.auth.authenticated_udp_bytes_read";
pub const GAUGE_RAPTORCAST_AUTH_NON_AUTHENTICATED_UDP_BYTES_READ: &str =
"monad.raptorcast.auth.non_authenticated_udp_bytes_read";

monad_wireauth::define_metric_names!(UDP_METRICS, "udp");
8 changes: 6 additions & 2 deletions monad-raptorcast/src/auth/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ pub struct WireAuthProtocol {
}

impl WireAuthProtocol {
pub fn new(config: monad_wireauth::Config, signing_key: Arc<monad_secp::KeyPair>) -> Self {
pub fn new(
metric_names: &'static monad_wireauth::MetricNames,
config: monad_wireauth::Config,
signing_key: Arc<monad_secp::KeyPair>,
) -> Self {
let context = monad_wireauth::StdContext::new();
Self {
api: monad_wireauth::API::new(config, signing_key, context),
api: monad_wireauth::API::new(metric_names, config, signing_key, context),
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions monad-raptorcast/src/auth/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,11 @@ mod tests {
let keypair = keypair(seed);
let public_key = keypair.pubkey();
let config = Config::default();
let auth_protocol = WireAuthProtocol::new(config, Arc::new(keypair));
let auth_protocol = WireAuthProtocol::new(
&crate::auth::metrics::UDP_METRICS,
config,
Arc::new(keypair),
);
let authenticated_handle =
AuthenticatedSocketHandle::new(authenticated_socket, auth_protocol);
let socket =
Expand Down Expand Up @@ -606,7 +610,11 @@ mod tests {
..Default::default()
};

let auth_protocol = WireAuthProtocol::new(config, Arc::new(local_keypair));
let auth_protocol = WireAuthProtocol::new(
&crate::auth::metrics::UDP_METRICS,
config,
Arc::new(local_keypair),
);
let mut handle = AuthenticatedSocketHandle::new(authenticated_socket, auth_protocol);

assert_eq!(poll!(pin!(handle.timer())), Poll::Pending);
Expand Down
3 changes: 2 additions & 1 deletion monad-raptorcast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ where
let pd = PeerDiscoveryDriver::new(peer_discovery_builder);
let shared_pd = Arc::new(Mutex::new(pd));
let wireauth_config = monad_wireauth::Config::default();
let auth_protocol = auth::WireAuthProtocol::new(wireauth_config, shared_key);
let auth_protocol =
auth::WireAuthProtocol::new(&auth::metrics::UDP_METRICS, wireauth_config, shared_key);
RaptorCast::<ST, M, OM, SE, NopDiscovery<ST>, _>::new(
config,
SecondaryRaptorCastModeConfig::None,
Expand Down
7 changes: 5 additions & 2 deletions monad-raptorcast/tests/wireauth_raptorcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,11 @@ fn spawn_wireauth_validator(
let (tcp_reader, tcp_writer) = dataplane.tcp_socket.split();
let config = create_raptorcast_config(keypair.clone(), sig_verification_rate_limit);
let wireauth_config = monad_wireauth::Config::default();
let auth_protocol =
monad_raptorcast::auth::WireAuthProtocol::new(wireauth_config, keypair.clone());
let auth_protocol = monad_raptorcast::auth::WireAuthProtocol::new(
&monad_raptorcast::auth::metrics::UDP_METRICS,
wireauth_config,
keypair.clone(),
);

let mut validator_rc = monad_raptorcast::RaptorCast::<
SecpSignature,
Expand Down
4 changes: 2 additions & 2 deletions monad-wireauth/benches/manager_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use std::net::SocketAddr;

use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use monad_wireauth::{messages::Packet, Config, TestContext, API};
use monad_wireauth::{messages::Packet, Config, TestContext, API, DEFAULT_METRICS};
use secp256k1::rand::rng;
use zerocopy::IntoBytes;

Expand All @@ -31,7 +31,7 @@ fn create_test_manager() -> (API<TestContext>, monad_secp::PubKey, TestContext)
let context = TestContext::new();
let context_clone = context.clone();

let manager = API::new(config, keypair, context);
let manager = API::new(DEFAULT_METRICS, config, keypair, context);
(manager, public_key, context_clone)
}

Expand Down
6 changes: 4 additions & 2 deletions monad-wireauth/examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use std::{
};

use clap::Parser;
use monad_wireauth::{messages::Packet, Config, PublicKey, StdContext, API, RETRY_ALWAYS};
use monad_wireauth::{
messages::Packet, Config, PublicKey, StdContext, API, DEFAULT_METRICS, RETRY_ALWAYS,
};
use monoio::{net::udp::UdpSocket, time::sleep_until};
use secp256k1::rand::{rngs::StdRng, SeedableRng};
use tracing::{debug, info, warn};
Expand Down Expand Up @@ -63,7 +65,7 @@ impl PeerNode {
};

let context = StdContext::new();
let manager = API::new(config, keypair, context);
let manager = API::new(DEFAULT_METRICS, config, keypair, context);
let socket = UdpSocket::bind(addr)?;

Ok(Self {
Expand Down
Loading
Loading