Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4aa0b575c1 | |||
| 6308d61d45 | |||
| 90c04aef12 | |||
| b507326ab5 | |||
| 412692888b | |||
| 5dfab6e30c |
@@ -12,6 +12,7 @@
|
|||||||
- wallet: the wallet backend learned how to keep track of validator name, either hardcoded or by querying the status endpoint.
|
- wallet: the wallet backend learned how to keep track of validator name, either hardcoded or by querying the status endpoint.
|
||||||
- mixnet-contract: Replace all naked `-` with `saturating_sub`.
|
- mixnet-contract: Replace all naked `-` with `saturating_sub`.
|
||||||
- mixnet-contract: Added ClaimOperatorReward and ClaimDelegatorReward messages ([#1292])
|
- mixnet-contract: Added ClaimOperatorReward and ClaimDelegatorReward messages ([#1292])
|
||||||
|
- mixnode: Added basic mixnode hardware reporting to the HTTP API.
|
||||||
- vesting-contract: Added ClaimOperatorReward and ClaimDelegatorReward messages ([#1292])
|
- vesting-contract: Added ClaimOperatorReward and ClaimDelegatorReward messages ([#1292])
|
||||||
- validator-api: add Swagger to document the REST API ([#1249]).
|
- validator-api: add Swagger to document the REST API ([#1249]).
|
||||||
- validator-api: add `estimated_node_profit` and `estimated_operator_cost` to `reward-estimate` endpoint ([#1284])
|
- validator-api: add `estimated_node_profit` and `estimated_operator_cost` to `reward-estimate` endpoint ([#1284])
|
||||||
|
|||||||
Generated
+33
@@ -1140,6 +1140,16 @@ dependencies = [
|
|||||||
"cipher 0.4.3",
|
"cipher 0.4.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cupid"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8bad352a84b567cc38a5854e3aa8ee903cb8519a25d0b799b739bafffd1f91a1"
|
||||||
|
dependencies = [
|
||||||
|
"gcc",
|
||||||
|
"rustc_version 0.2.3",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "curve25519-dalek"
|
name = "curve25519-dalek"
|
||||||
version = "3.2.0"
|
version = "3.2.0"
|
||||||
@@ -2001,6 +2011,12 @@ dependencies = [
|
|||||||
"tungstenite",
|
"tungstenite",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gcc"
|
||||||
|
version = "0.3.55"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "generator"
|
name = "generator"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@@ -3155,6 +3171,7 @@ dependencies = [
|
|||||||
"colored",
|
"colored",
|
||||||
"config",
|
"config",
|
||||||
"crypto",
|
"crypto",
|
||||||
|
"cupid",
|
||||||
"dirs",
|
"dirs",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
"futures",
|
"futures",
|
||||||
@@ -3173,6 +3190,7 @@ dependencies = [
|
|||||||
"rocket",
|
"rocket",
|
||||||
"serde",
|
"serde",
|
||||||
"serial_test",
|
"serial_test",
|
||||||
|
"sysinfo",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util 0.6.9",
|
"tokio-util 0.6.9",
|
||||||
"toml",
|
"toml",
|
||||||
@@ -5495,6 +5513,21 @@ dependencies = [
|
|||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sysinfo"
|
||||||
|
version = "0.24.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a6a8e71535da31837213ac114531d31def75d7aebd133264e420a3451fa7f703"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
"ntapi",
|
||||||
|
"once_cell",
|
||||||
|
"rayon",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tap"
|
name = "tap"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ rust-version = "1.58.1"
|
|||||||
bs58 = "0.4.0"
|
bs58 = "0.4.0"
|
||||||
clap = { version = "3.0.10", features = ["cargo", "derive"] }
|
clap = { version = "3.0.10", features = ["cargo", "derive"] }
|
||||||
colored = "2.0"
|
colored = "2.0"
|
||||||
|
cupid = "0.6.1"
|
||||||
dirs = "3.0"
|
dirs = "3.0"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
futures = "0.3.0"
|
futures = "0.3.0"
|
||||||
@@ -28,6 +29,7 @@ pretty_env_logger = "0.4.0"
|
|||||||
rand = "0.7.3"
|
rand = "0.7.3"
|
||||||
rocket = { version="0.5.0-rc.1", features = ["json"] }
|
rocket = { version="0.5.0-rc.1", features = ["json"] }
|
||||||
serde = { version="1.0", features = ["derive"] }
|
serde = { version="1.0", features = ["derive"] }
|
||||||
|
sysinfo = "0.24.1"
|
||||||
tokio = { version="1.8", features = ["rt-multi-thread", "net", "signal"] }
|
tokio = { version="1.8", features = ["rt-multi-thread", "net", "signal"] }
|
||||||
tokio-util = { version="0.6.7", features = ["codec"] }
|
tokio-util = { version="0.6.7", features = ["codec"] }
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
use rocket::serde::{json::Json, Serialize};
|
||||||
|
use sysinfo::{System, SystemExt};
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(crate = "rocket::serde")]
|
||||||
|
pub(crate) struct Hardware {
|
||||||
|
ram: String,
|
||||||
|
num_cores: usize,
|
||||||
|
crypto_hardware: Option<CryptoHardware>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(crate = "rocket::serde")]
|
||||||
|
pub(crate) struct CryptoHardware {
|
||||||
|
aesni: bool,
|
||||||
|
processor: String,
|
||||||
|
sgx: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provides hardware information which Nym can use to optimize mixnet speed over time (memory, crypto hardware, CPU, cores, etc).
|
||||||
|
#[get("/hardware")]
|
||||||
|
pub(crate) fn hardware() -> Json<Hardware> {
|
||||||
|
Json(hardware_info())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gives back a summary report of whatever system hardware info we can get for this platform.
|
||||||
|
fn hardware_info() -> Hardware {
|
||||||
|
let crypto_hardware = hardware_info_from_cupid();
|
||||||
|
hardware_from_sysinfo(crypto_hardware)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sysinfo gives back basic stuff like number of CPU cores and available memory. If available, this includes the hardware encryption
|
||||||
|
/// extensions report
|
||||||
|
fn hardware_from_sysinfo(crypto_hardware: Option<CryptoHardware>) -> Hardware {
|
||||||
|
let mut system = System::new_all();
|
||||||
|
let total_memory = system.free_memory();
|
||||||
|
system.refresh_all();
|
||||||
|
let ram = format!("{}KB", total_memory);
|
||||||
|
let cores = system.cpus();
|
||||||
|
let num_cores = cores.len();
|
||||||
|
Hardware {
|
||||||
|
crypto_hardware,
|
||||||
|
ram,
|
||||||
|
num_cores,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The `cupid` crate gives back a report on available hardware encryption extensions which may be useful for future mixnet optimizations.
|
||||||
|
///
|
||||||
|
/// Note: this information is generally only available on x86 platforms for Linux.
|
||||||
|
fn hardware_info_from_cupid() -> Option<CryptoHardware> {
|
||||||
|
cupid::master().map(|info| CryptoHardware {
|
||||||
|
aesni: info.aesni(),
|
||||||
|
processor: info.brand_string().unwrap().to_string(),
|
||||||
|
sgx: info.sgx(),
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
pub(crate) mod description;
|
pub(crate) mod description;
|
||||||
|
pub(crate) mod hardware;
|
||||||
pub(crate) mod stats;
|
pub(crate) mod stats;
|
||||||
pub(crate) mod verloc;
|
pub(crate) mod verloc;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use crate::config::persistence::pathfinder::MixNodePathfinder;
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::node::http::{
|
use crate::node::http::{
|
||||||
description::description,
|
description::description,
|
||||||
|
hardware::hardware,
|
||||||
not_found,
|
not_found,
|
||||||
stats::stats,
|
stats::stats,
|
||||||
verloc::{verloc as verlocRoute, VerlocState},
|
verloc::{verloc as verlocRoute, VerlocState},
|
||||||
@@ -139,7 +140,7 @@ impl MixNode {
|
|||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
rocket::build()
|
rocket::build()
|
||||||
.configure(config)
|
.configure(config)
|
||||||
.mount("/", routes![verlocRoute, description, stats])
|
.mount("/", routes![verlocRoute, description, stats, hardware])
|
||||||
.register("/", catchers![not_found])
|
.register("/", catchers![not_found])
|
||||||
.manage(verloc_state)
|
.manage(verloc_state)
|
||||||
.manage(descriptor)
|
.manage(descriptor)
|
||||||
|
|||||||
Reference in New Issue
Block a user