moved nym-gateway-probe to monorepo and updated rust-edition to 2024 (#6094)
dont build netstack in CI additional rust 2024 fixes fixes removed temp.rs first round of cleanup removed duplicated NS types moved gateway probe to the monorepo
This commit is contained in:
committed by
GitHub
parent
18ff09608c
commit
827c13b69e
@@ -4,9 +4,9 @@ use std::{
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
use futures::{pin_mut, stream::FuturesUnordered, StreamExt};
|
||||
use futures::{StreamExt, pin_mut, stream::FuturesUnordered};
|
||||
use log::{debug, error, info};
|
||||
use nym_sphinx::chunking::{monitoring, SentFragment};
|
||||
use nym_sphinx::chunking::{SentFragment, monitoring};
|
||||
use nym_topology::{NymRouteProvider, RoutingNode};
|
||||
use nym_types::monitoring::{MonitorMessage, NodeResult};
|
||||
use nym_validator_client::nym_api::routes::{STATUS, SUBMIT_GATEWAY, SUBMIT_NODE, V1_API_VERSION};
|
||||
@@ -14,7 +14,7 @@ use rand::SeedableRng;
|
||||
use rand_chacha::ChaCha8Rng;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::task::JoinHandle;
|
||||
use tokio_postgres::{binary_copy::BinaryCopyInWriter, types::Type, Client, NoTls};
|
||||
use tokio_postgres::{Client, NoTls, binary_copy::BinaryCopyInWriter, types::Type};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::{NYM_API_URL, PRIVATE_KEY, TOPOLOGY};
|
||||
@@ -247,21 +247,21 @@ impl NetworkAccount {
|
||||
fn find_missing_fragments(&mut self) {
|
||||
let mut missing_fragments_map = HashMap::new();
|
||||
for fragment_set_id in &self.incomplete_fragment_sets {
|
||||
if let Some(fragment_ref) = monitoring::FRAGMENTS_RECEIVED.get(fragment_set_id) {
|
||||
if let Some(ref_fragment) = fragment_ref.value().first() {
|
||||
let ref_header = ref_fragment.header();
|
||||
let ref_id_set = (0..ref_header.total_fragments()).collect::<HashSet<u8>>();
|
||||
let recieved_set = fragment_ref
|
||||
.value()
|
||||
.iter()
|
||||
.map(|f| f.header().current_fragment())
|
||||
.collect::<HashSet<u8>>();
|
||||
let missing_fragments = ref_id_set
|
||||
.difference(&recieved_set)
|
||||
.cloned()
|
||||
.collect::<Vec<u8>>();
|
||||
missing_fragments_map.insert(*fragment_set_id, missing_fragments);
|
||||
}
|
||||
if let Some(fragment_ref) = monitoring::FRAGMENTS_RECEIVED.get(fragment_set_id)
|
||||
&& let Some(ref_fragment) = fragment_ref.value().first()
|
||||
{
|
||||
let ref_header = ref_fragment.header();
|
||||
let ref_id_set = (0..ref_header.total_fragments()).collect::<HashSet<u8>>();
|
||||
let recieved_set = fragment_ref
|
||||
.value()
|
||||
.iter()
|
||||
.map(|f| f.header().current_fragment())
|
||||
.collect::<HashSet<u8>>();
|
||||
let missing_fragments = ref_id_set
|
||||
.difference(&recieved_set)
|
||||
.cloned()
|
||||
.collect::<Vec<u8>>();
|
||||
missing_fragments_map.insert(*fragment_set_id, missing_fragments);
|
||||
};
|
||||
}
|
||||
self.missing_fragments = missing_fragments_map;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use axum::{
|
||||
Json,
|
||||
extract::{Path, State},
|
||||
http::StatusCode,
|
||||
Json,
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use log::{debug, error, warn};
|
||||
use nym_sdk::mixnet::MixnetMessageSender;
|
||||
use nym_sphinx::chunking::{monitoring, ReceivedFragment, SentFragment};
|
||||
use petgraph::{dot::Dot, Graph};
|
||||
use rand::{distributions::Alphanumeric, seq::SliceRandom, Rng};
|
||||
use nym_sphinx::chunking::{ReceivedFragment, SentFragment, monitoring};
|
||||
use petgraph::{Graph, dot::Dot};
|
||||
use rand::{Rng, distributions::Alphanumeric, seq::SliceRandom};
|
||||
use serde::Serialize;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
@@ -19,9 +19,9 @@ use tokio::time::timeout;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::{
|
||||
accounting::{all_node_stats, NetworkAccount, NetworkAccountStats, NodeStats},
|
||||
http::AppState,
|
||||
MIXNET_TIMEOUT,
|
||||
accounting::{NetworkAccount, NetworkAccountStats, NodeStats, all_node_stats},
|
||||
http::AppState,
|
||||
};
|
||||
|
||||
#[derive(ToSchema, Serialize)]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use crate::accounting::{NetworkAccount, NetworkAccountStats, NodeStats};
|
||||
use crate::handlers::{
|
||||
accounting_handler, all_nodes_stats_handler, graph_handler, mermaid_handler, mix_dot_handler,
|
||||
node_stats_handler, recv_handler, send_handler, sent_handler, stats_handler, FragmentsReceived,
|
||||
FragmentsSent,
|
||||
FragmentsReceived, FragmentsSent, accounting_handler, all_nodes_stats_handler, graph_handler,
|
||||
mermaid_handler, mix_dot_handler, node_stats_handler, recv_handler, send_handler, sent_handler,
|
||||
stats_handler,
|
||||
};
|
||||
use axum::routing::{get, post};
|
||||
use axum::Router;
|
||||
use axum::routing::{get, post};
|
||||
use log::info;
|
||||
use nym_sphinx::chunking::fragment::FragmentHeader;
|
||||
use nym_sphinx::chunking::{ReceivedFragment, SentFragment};
|
||||
@@ -83,9 +83,15 @@ impl HttpServer {
|
||||
let server_future =
|
||||
axum::serve(listener, app).with_graceful_shutdown(self.cancel.cancelled_owned());
|
||||
|
||||
info!("##########################################################################################");
|
||||
info!("######################### HTTP server running, with {n_clients} clients ############################################");
|
||||
info!("##########################################################################################");
|
||||
info!(
|
||||
"##########################################################################################"
|
||||
);
|
||||
info!(
|
||||
"######################### HTTP server running, with {n_clients} clients ############################################"
|
||||
);
|
||||
info!(
|
||||
"##########################################################################################"
|
||||
);
|
||||
|
||||
server_future.await?;
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ use nym_sdk::mixnet::{self, MixnetClient};
|
||||
use nym_sphinx::chunking::monitoring;
|
||||
use nym_topology::provider_trait::ToTopologyMetadata;
|
||||
use nym_topology::{HardcodedTopologyProvider, NymTopology};
|
||||
use nym_validator_client::nym_api::NymApiClientExt;
|
||||
use nym_validator_client::UserAgent;
|
||||
use nym_validator_client::nym_api::NymApiClientExt;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::sync::LazyLock;
|
||||
@@ -154,7 +154,9 @@ fn generate_key_pair() -> Result<()> {
|
||||
let mut private_key_file = File::create("network-monitor-private")?;
|
||||
private_key_file.write_all(keypair.private_key().to_base58_string().as_bytes())?;
|
||||
|
||||
info!("Generated keypair, public key to 'network-monitor-public', and private key to 'network-monitor-private', public key should be whitelisted with the nym-api");
|
||||
info!(
|
||||
"Generated keypair, public key to 'network-monitor-public', and private key to 'network-monitor-private', public key should be whitelisted with the nym-api"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user