From a4d0cb65f01d9f5a80384340cd2028109688e1fc Mon Sep 17 00:00:00 2001 From: noah Date: Thu, 24 Sep 2026 15:14:20 -0600 Subject: [PATCH] fix(gui,vnish): hashrate 0-vs-dash, paused health colours, VNish per-hashboard faults - Hashrate cell: a readable 0 hashrate now shows "0.00T" instead of a dash. The dash is reserved for an unreadable/absent hashrate. New MinerRow.hashrate_known records whether the miner reported a value; combined_si/num_value key off it, and scan/fixtures set it from data.hashrate.is_some(). - Paused-miner Health icons: the control board (brain) and PSU keep their true health (green when fine) instead of turning blue; fans turn blue only when actually stopped (0 RPM) and stay green while spinning; hashboards stay blue while paused (idle is the expected state). - VNish per-hashboard faults: DataField::Messages now also reads the summary chains (chip_statuses red/orange + per-chain state) and emits one message per faulted board, attributed to MinerComponent::HashBoard{idx}, so the Health column reds the specific board and its tooltip carries the fault instead of it landing on the brain. Applied to v1_2_0 and v1_3_0. patch 0032. Verified live: VNish 10.7.1.25 -> "Hashboard 2: 1 degraded chip(s)" on board idx 1; healthy 10.7.1.122 -> no messages. 93 unit tests pass. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Djv3oncM4LxTS5tb61Ako6 --- crates/alkane-gui/src/fixtures.rs | 4 + crates/alkane-gui/src/model.rs | 47 ++- crates/alkane-gui/src/scan.rs | 4 + crates/alkane-gui/src/ui.rs | 41 ++- ...lemetry-vnish-per-hashboard-messages.patch | 283 ++++++++++++++++++ .../.cargo-checksum.json | 2 +- .../src/backends/v1_2_0/mod.rs | 99 +++++- .../src/backends/v1_3_0/mod.rs | 99 +++++- 8 files changed, 535 insertions(+), 44 deletions(-) create mode 100644 thirdparty/asic-rs/patches/0032-telemetry-vnish-per-hashboard-messages.patch diff --git a/crates/alkane-gui/src/fixtures.rs b/crates/alkane-gui/src/fixtures.rs index eed7b76b..22577810 100644 --- a/crates/alkane-gui/src/fixtures.rs +++ b/crates/alkane-gui/src/fixtures.rs @@ -128,6 +128,10 @@ impl Board { cpu, board_code, hashrate_ths: self.hashrate, + // A miner that is mining or paused reported a current hashrate (a paused + // one reports 0 -> "0.00T"); the blank stock demo miner reports none, so + // it keeps the "-" dash (round 19 follow-up). + hashrate_known: self.mining || self.paused, expected_ths: self.expected, board_hashrates, board_voltages, diff --git a/crates/alkane-gui/src/model.rs b/crates/alkane-gui/src/model.rs index d60ba18f..bdd1e69e 100644 --- a/crates/alkane-gui/src/model.rs +++ b/crates/alkane-gui/src/model.rs @@ -82,6 +82,17 @@ pub fn format_hashrate_ths(ths: f64) -> Option { si_mantissa_and_prefix(ths * 1e12).map(|(num, prefix)| format!("{num}{prefix}")) } +/// The current-hashrate reading for the combined Hashrate cell, distinguishing a +/// reported zero from an unreadable one: `Some("0.00T")` when the firmware reported +/// a hashrate that rounds to zero, `Some("T")` for a positive reading, and +/// `None` (renders as the "-" dash) only when the hashrate is unreadable/absent. +pub fn format_hashrate_actual(ths: f64, known: bool) -> Option { + if !known { + return None; + } + Some(format_hashrate_ths(ths).unwrap_or_else(|| "0.00T".to_string())) +} + /// A hashrate number (no unit) for a given mining algorithm (round 18 #7). asic-rs /// stores every hashrate normalised to "TH/s", but for Equihash the underlying /// count is Sol/s that it reinterprets through the base H unit, so `ths * 1e12` @@ -140,8 +151,8 @@ fn join_board(vals: &[f64], f: impl Fn(f64) -> String) -> String { /// slash, prefix-only unit): blank when neither is known, the bare actual when /// only it is known, "-/" when only the expected is known, and /// "/" when both are (e.g. "80.5T/95.0T"). -fn combined_si(actual_ths: f64, expected_ths: f64) -> String { - match (format_hashrate_ths(actual_ths), format_hashrate_ths(expected_ths)) { +fn combined_si(actual_ths: f64, actual_known: bool, expected_ths: f64) -> String { + match (format_hashrate_actual(actual_ths, actual_known), format_hashrate_ths(expected_ths)) { (None, None) => String::new(), (Some(a), None) => a, (None, Some(e)) => format!("-/{e}"), @@ -496,6 +507,10 @@ pub struct MinerRow { pub faults: Vec, // performance pub hashrate_ths: f64, + /// Whether the firmware actually reported a current hashrate. A reported 0 + /// renders as "0.00T"; only an unreadable/absent reading (this is false) shows + /// the "-" dash. `hashrate_ths` alone can't distinguish the two (both are 0.0). + pub hashrate_known: bool, /// Rolling average hashrate windows in TH/s (round 19 #10, T2): 1m/5m/15m/24h. /// 0.0 means the firmware does not report that window. pub hashrate_1m_ths: f64, @@ -1489,7 +1504,10 @@ impl Column { // renders "- / " (non-empty) in that case, so the generic // blank check below is not enough on its own. match self { - Column::Hashrate if r.hashrate_ths <= 0.0 => return None, + // An unreadable hashrate has no numeric value; a reported 0 does (0.0), + // so a filter like "hashrate > 0" excludes a stopped miner but "<= 50" + // still matches it. + Column::Hashrate if !r.hashrate_known => return None, Column::TotalChips if r.total_chips.is_none() => return None, _ => {} } @@ -1596,7 +1614,7 @@ impl Column { let pool_worker = |i: usize| r.pools.get(i).map(|(_, w)| w.clone()).unwrap_or_default(); match self { Column::Ip => r.ip.clone(), - Column::Hashrate => combined_si(r.hashrate_ths, r.expected_ths), + Column::Hashrate => combined_si(r.hashrate_ths, r.hashrate_known, r.expected_ths), // Rolling average windows: a single TH/s value, blank when not reported // (round 19 #10, T2). Column::Hashrate1m => format_hashrate_ths(r.hashrate_1m_ths).unwrap_or_default(), @@ -2826,7 +2844,7 @@ mod tests { #[test] fn numeric_filter_operators() { - let r = MinerRow { hashrate_ths: 100.0, is_mining: true, ..Default::default() }; + let r = MinerRow { hashrate_ths: 100.0, hashrate_known: true, is_mining: true, ..Default::default() }; let c = Column::Hashrate; let n = |op, a: f64, b: f64| ColFilter::Num { op, a, b }.matches(c, &r); assert!(n(NumOp::Gt, 50.0, 0.0)); @@ -2847,7 +2865,7 @@ mod tests { assert_eq!(Column::Firmware.num_value(&r), None, "text column"); assert_eq!(Column::Ip.num_value(&r), None, "IP is text, not numeric"); assert_eq!(Column::Efficiency.num_value(&r), None, "blank numeric -> None"); - let r2 = MinerRow { hashrate_ths: 42.0, ..Default::default() }; + let r2 = MinerRow { hashrate_ths: 42.0, hashrate_known: true, ..Default::default() }; assert_eq!(Column::Hashrate.num_value(&r2), Some(42.0)); } @@ -2920,6 +2938,7 @@ mod tests { let actual_only = MinerRow { hashrate_ths: 60.0, + hashrate_known: true, total_chips: Some(210), ..Default::default() }; @@ -2931,11 +2950,24 @@ mod tests { expected_chips: Some(228), ..Default::default() }; - assert_eq!(Column::Hashrate.cell(&expected_only), "-/200T", "only expected -> '-/'"); + assert_eq!(Column::Hashrate.cell(&expected_only), "-/200T", "only expected (actual unreadable) -> '-/'"); assert_eq!(Column::TotalChips.cell(&expected_only), "- / 228"); + // A reported zero is a real reading -> "0.00T", never the dash. The dash + // (expected_only above) is reserved for an unreadable actual. + let reported_zero = MinerRow { + hashrate_ths: 0.0, + hashrate_known: true, + expected_ths: 200.0, + ..Default::default() + }; + assert_eq!(Column::Hashrate.cell(&reported_zero), "0.00T/200T", "reported 0 -> 0.00T, not a dash"); + let reported_zero_no_expected = MinerRow { hashrate_ths: 0.0, hashrate_known: true, ..Default::default() }; + assert_eq!(Column::Hashrate.cell(&reported_zero_no_expected), "0.00T"); + let both = MinerRow { hashrate_ths: 60.0, + hashrate_known: true, expected_ths: 200.0, total_chips: Some(190), expected_chips: Some(228), @@ -2959,6 +2991,7 @@ mod tests { let both = MinerRow { hashrate_ths: 60.0, + hashrate_known: true, expected_ths: 200.0, total_chips: Some(190), expected_chips: Some(228), diff --git a/crates/alkane-gui/src/scan.rs b/crates/alkane-gui/src/scan.rs index f7ce1281..dba3bf8a 100644 --- a/crates/alkane-gui/src/scan.rs +++ b/crates/alkane-gui/src/scan.rs @@ -747,6 +747,9 @@ fn partial_row(miner: &dyn Miner, ip: std::net::IpAddr) -> MinerRow { async fn to_row(miner: &dyn Miner) -> MinerRow { let data = miner.get_data().await; + // Whether the firmware reported a current hashrate at all: a reported 0 renders + // "0.00T", an absent one the "-" dash (round 19 follow-up). + let hashrate_known = data.hashrate.is_some(); let hashrate_ths = data .hashrate .as_ref() @@ -1111,6 +1114,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow { cpu, board_code, hashrate_ths, + hashrate_known, hashrate_1m_ths, hashrate_5m_ths, hashrate_15m_ths, diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index bbbaaced..bf92836a 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -438,33 +438,44 @@ fn encode_component_health( max_fans: usize, max_boards: usize, ) -> String { + use crate::model::CompHealth; let mut segs: Vec = Vec::new(); - // A paused/stopped miner is intentionally halted, not broken: every component - // it reports as idle (power off, fans spun down, boards not hashing) is - // expected, not a fault, so colour each one blue instead of its red/amber - // health colour -- otherwise a paused miner reads as broken (round 19 #19, - // extended: originally boards only, but idle fans/power still showed red). - // A genuinely undetected component (Unreachable) stays grey: even when paused, - // "not present" is not "paused". - let col = |h: crate::model::CompHealth| { - if r.paused && h != crate::model::CompHealth::Unreachable { + // On a paused/stopped miner, a component that is off *because* the miner is + // halted is expected, not a fault, so it reads blue (paused) instead of red. + // But this only applies where "not working" is a consequence of the pause: + // - Hashboards: idle (not hashing) is exactly what pausing does -> blue when + // paused (any detected board; an undetected one stays grey). Round 19 #19. + // - Fans: blue ONLY when actually stopped (0 RPM -> Down); a fan still + // spinning stays green/amber -- pausing doesn't necessarily stop the fans. + // - Control board + PSU: still running / powered, so they keep their true + // health (green when fine) even while paused -- never forced blue. + let paused = r.paused; + let board_col = |h: CompHealth| { + if paused && h != CompHealth::Unreachable { pal.accent } else { health_color(pal, h) } }; - segs.push((Some(col(r.power_health())), SHAPE_BOLT.to_string())); - segs.push((Some(col(r.control_health())), SHAPE_BRAIN.to_string())); + let fan_col = |h: CompHealth| { + if paused && h == CompHealth::Down { + pal.accent + } else { + health_color(pal, h) + } + }; + segs.push((Some(health_color(pal, r.power_health())), SHAPE_BOLT.to_string())); + segs.push((Some(health_color(pal, r.control_health())), SHAPE_BRAIN.to_string())); let fans = r.fan_healths(); for h in &fans { - segs.push((Some(col(*h)), SHAPE_FAN.to_string())); + segs.push((Some(fan_col(*h)), SHAPE_FAN.to_string())); } for _ in fans.len()..max_fans { segs.push((None, SHAPE_GAP.to_string())); } let boards = r.board_healths(); for h in &boards { - segs.push((Some(col(*h)), SHAPE_CHIP.to_string())); + segs.push((Some(board_col(*h)), SHAPE_CHIP.to_string())); } for _ in boards.len()..max_boards { segs.push((None, SHAPE_GAP.to_string())); @@ -1274,7 +1285,9 @@ impl App { // on the ACTUAL being known, so an unknown actual renders as // "-/" in the default colour rather than a red 0%. Column::Hashrate => { - let actual = format_hashrate_ths(r.hashrate_ths); + // A reported 0 shows "0.00T" (not a dash); the dash is only for + // an unreadable reading (hashrate_known == false). + let actual = format_hashrate_actual(r.hashrate_ths, r.hashrate_known); let expected = format_hashrate_ths(r.expected_ths); let ratio = (r.hashrate_ths > 0.0) .then(|| actual_expected_ratio(r.hashrate_ths, r.expected_ths)) diff --git a/thirdparty/asic-rs/patches/0032-telemetry-vnish-per-hashboard-messages.patch b/thirdparty/asic-rs/patches/0032-telemetry-vnish-per-hashboard-messages.patch new file mode 100644 index 00000000..bb4caba8 --- /dev/null +++ b/thirdparty/asic-rs/patches/0032-telemetry-vnish-per-hashboard-messages.patch @@ -0,0 +1,283 @@ +Subject: [PATCH 0032] telemetry: vnish per-hashboard fault messages + +Round 20 #1. VNish previously surfaced only a single miner-level state message +(board 0, no component), so per-hashboard faults landed on the control-board +(brain) tooltip instead of the board they name, and the Health column could not +red the specific faulted hashboard. + +- DataField::Messages now also collects /miner/chains from the summary (tagged), + alongside /miner/miner_status (now tagged "miner_status"). The summary chains + carry per-chain diagnostics the /chains endpoint omits: chip_statuses + {red,orange,grey} and status.state. +- parse_messages emits one MinerMessage per faulted board, attributed to + MinerComponent::HashBoard { idx } (chain ids are 1-based; board positions + 0-based): red chip(s) -> Error, a non-normal chain state with no failed chips + -> Error (state text), orange chip(s) -> Warning. Healthy boards (all grey, + state "mining") produce no message, so no false faults on good miners. +- Applied to both v1_3_0 and v1_2_0 backends. Verified live against healthy + WildRose/VNish S21 miners (10.7.1.x): all chains grey/mining -> zero messages. + +diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs +index ad2779b6..85011853 100644 +--- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs ++++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs +@@ -20,7 +20,7 @@ use asic_rs_core::{ + device::DeviceInfo, + fan::FanData, + hashrate::{HashRate, HashRateUnit}, +- message::{MessageSeverity, MinerMessage}, ++ message::{MessageSeverity, MinerComponent, MinerMessage}, + miner::TuningTarget, + operating_state::OperatingState, + pool::{PoolData, PoolGroupData, PoolURL}, +@@ -353,14 +353,26 @@ impl GetDataLocations for VnishV120 { + tag: None, + }, + )], +- DataField::Messages => vec![( +- WEB_SUMMARY, +- DataExtractor { +- func: get_by_pointer, +- key: Some("/miner/miner_status"), +- tag: None, +- }, +- )], ++ DataField::Messages => vec![ ++ ( ++ WEB_SUMMARY, ++ DataExtractor { ++ func: get_by_pointer, ++ key: Some("/miner/miner_status"), ++ tag: Some("miner_status"), ++ }, ++ ), ++ // Per-hashboard diagnostics (chip status buckets + per-chain state) ++ // for per-board fault messages in parse_messages. ++ ( ++ WEB_SUMMARY, ++ DataExtractor { ++ func: get_by_pointer, ++ key: Some("/miner/chains"), ++ tag: Some("chains"), ++ }, ++ ), ++ ], + DataField::TuningTarget => vec![( + WEB_SETTINGS, + DataExtractor { +@@ -850,9 +862,12 @@ impl GetMessages for VnishV120 { + /// reported here rather than computed from invented thresholds. + fn parse_messages(&self, data: &HashMap) -> Vec { + let mut messages = Vec::new(); ++ let msg = data.get(&DataField::Messages); + +- if let Some(status) = data.get(&DataField::Messages) +- && let Some(state) = status.pointer("/miner_state").and_then(|v| v.as_str()) ++ // Miner-level state verdict (now under the "miner_status" tag). ++ if let Some(state) = msg ++ .and_then(|v| v.pointer("/miner_status/miner_state")) ++ .and_then(|v| v.as_str()) + { + let normal = matches!( + state.to_lowercase().as_str(), +@@ -872,6 +887,68 @@ impl GetMessages for VnishV120 { + } + } + ++ // Per-hashboard faults from the summary chains (round 20 #1). VNish reports ++ // per-chip status buckets (`red` = failed, `orange` = degraded, `grey` = ++ // healthy) and a per-chain state; attribute each fault to its own board so ++ // the Health column reds the right hashboard icon and that icon's tooltip ++ // carries the specific fault, instead of everything landing on the miner- ++ // level (brain) message. Chain ids are 1-based; board positions are 0-based. ++ if let Some(chains) = msg ++ .and_then(|v| v.pointer("/chains")) ++ .and_then(|v| v.as_array()) ++ { ++ for chain in chains { ++ let Some(id) = chain.pointer("/id").and_then(|v| v.as_u64()) else { ++ continue; ++ }; ++ let idx = id.saturating_sub(1) as u16; ++ let red = chain ++ .pointer("/chip_statuses/red") ++ .and_then(|v| v.as_u64()) ++ .unwrap_or(0); ++ let orange = chain ++ .pointer("/chip_statuses/orange") ++ .and_then(|v| v.as_u64()) ++ .unwrap_or(0); ++ let state = chain ++ .pointer("/status/state") ++ .and_then(|v| v.as_str()) ++ .unwrap_or(""); ++ let state_ok = matches!( ++ state.to_lowercase().as_str(), ++ "" | "mining" | "auto-tuning" | "auto_tuning" | "tuning" ++ ); ++ ++ if red > 0 { ++ messages.push(MinerMessage::with_component( ++ 0, ++ 0, ++ format!("Hashboard {id}: {red} failed chip(s)"), ++ MessageSeverity::Error, ++ Some(MinerComponent::hashboard(idx)), ++ )); ++ } else if !state_ok { ++ // A board not in a normal state but with no failed chips: report ++ // the state itself (e.g. "initializing", "disabled", "stopped"). ++ messages.push(MinerMessage::with_component( ++ 0, ++ 0, ++ format!("Hashboard {id}: {state}"), ++ MessageSeverity::Error, ++ Some(MinerComponent::hashboard(idx)), ++ )); ++ } else if orange > 0 { ++ messages.push(MinerMessage::with_component( ++ 0, ++ 0, ++ format!("Hashboard {id}: {orange} degraded chip(s)"), ++ MessageSeverity::Warning, ++ Some(MinerComponent::hashboard(idx)), ++ )); ++ } ++ } ++ } ++ + messages + } + } +diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs +index 4f0453a1..1301a657 100644 +--- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs ++++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs +@@ -20,7 +20,7 @@ use asic_rs_core::{ + device::DeviceInfo, + fan::FanData, + hashrate::{HashRate, HashRateUnit}, +- message::{MessageSeverity, MinerMessage}, ++ message::{MessageSeverity, MinerComponent, MinerMessage}, + miner::TuningTarget, + operating_state::OperatingState, + pool::{PoolData, PoolGroupData, PoolURL}, +@@ -351,14 +351,26 @@ impl GetDataLocations for VnishV130 { + tag: None, + }, + )], +- DataField::Messages => vec![( +- WEB_SUMMARY, +- DataExtractor { +- func: get_by_pointer, +- key: Some("/miner/miner_status"), +- tag: None, +- }, +- )], ++ DataField::Messages => vec![ ++ ( ++ WEB_SUMMARY, ++ DataExtractor { ++ func: get_by_pointer, ++ key: Some("/miner/miner_status"), ++ tag: Some("miner_status"), ++ }, ++ ), ++ // Per-hashboard diagnostics (chip status buckets + per-chain state) ++ // for per-board fault messages in parse_messages. ++ ( ++ WEB_SUMMARY, ++ DataExtractor { ++ func: get_by_pointer, ++ key: Some("/miner/chains"), ++ tag: Some("chains"), ++ }, ++ ), ++ ], + DataField::TuningPercent => vec![( + WEB_SUMMARY, + DataExtractor { +@@ -805,9 +817,12 @@ impl GetMessages for VnishV130 { + /// reported here rather than computed from invented thresholds. + fn parse_messages(&self, data: &HashMap) -> Vec { + let mut messages = Vec::new(); ++ let msg = data.get(&DataField::Messages); + +- if let Some(status) = data.get(&DataField::Messages) +- && let Some(state) = status.pointer("/miner_state").and_then(|v| v.as_str()) ++ // Miner-level state verdict (now under the "miner_status" tag). ++ if let Some(state) = msg ++ .and_then(|v| v.pointer("/miner_status/miner_state")) ++ .and_then(|v| v.as_str()) + { + let normal = matches!( + state.to_lowercase().as_str(), +@@ -827,6 +842,68 @@ impl GetMessages for VnishV130 { + } + } + ++ // Per-hashboard faults from the summary chains (round 20 #1). VNish reports ++ // per-chip status buckets (`red` = failed, `orange` = degraded, `grey` = ++ // healthy) and a per-chain state; attribute each fault to its own board so ++ // the Health column reds the right hashboard icon and that icon's tooltip ++ // carries the specific fault, instead of everything landing on the miner- ++ // level (brain) message. Chain ids are 1-based; board positions are 0-based. ++ if let Some(chains) = msg ++ .and_then(|v| v.pointer("/chains")) ++ .and_then(|v| v.as_array()) ++ { ++ for chain in chains { ++ let Some(id) = chain.pointer("/id").and_then(|v| v.as_u64()) else { ++ continue; ++ }; ++ let idx = id.saturating_sub(1) as u16; ++ let red = chain ++ .pointer("/chip_statuses/red") ++ .and_then(|v| v.as_u64()) ++ .unwrap_or(0); ++ let orange = chain ++ .pointer("/chip_statuses/orange") ++ .and_then(|v| v.as_u64()) ++ .unwrap_or(0); ++ let state = chain ++ .pointer("/status/state") ++ .and_then(|v| v.as_str()) ++ .unwrap_or(""); ++ let state_ok = matches!( ++ state.to_lowercase().as_str(), ++ "" | "mining" | "auto-tuning" | "auto_tuning" | "tuning" ++ ); ++ ++ if red > 0 { ++ messages.push(MinerMessage::with_component( ++ 0, ++ 0, ++ format!("Hashboard {id}: {red} failed chip(s)"), ++ MessageSeverity::Error, ++ Some(MinerComponent::hashboard(idx)), ++ )); ++ } else if !state_ok { ++ // A board not in a normal state but with no failed chips: report ++ // the state itself (e.g. "initializing", "disabled", "stopped"). ++ messages.push(MinerMessage::with_component( ++ 0, ++ 0, ++ format!("Hashboard {id}: {state}"), ++ MessageSeverity::Error, ++ Some(MinerComponent::hashboard(idx)), ++ )); ++ } else if orange > 0 { ++ messages.push(MinerMessage::with_component( ++ 0, ++ 0, ++ format!("Hashboard {id}: {orange} degraded chip(s)"), ++ MessageSeverity::Warning, ++ Some(MinerComponent::hashboard(idx)), ++ )); ++ } ++ } ++ } ++ + messages + } + } diff --git a/vendor/asic-rs-firmwares-vnish/.cargo-checksum.json b/vendor/asic-rs-firmwares-vnish/.cargo-checksum.json index d0a5c793..791d9eca 100644 --- a/vendor/asic-rs-firmwares-vnish/.cargo-checksum.json +++ b/vendor/asic-rs-firmwares-vnish/.cargo-checksum.json @@ -1 +1 @@ -{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"de321c89f62a60690ba07d6bb145ac688c6141c458638e68b3ed36b50b8de1f1","Cargo.lock":"5942ec7c9cf5c201bd32442d65020dc3ae72e33cb5aaf374b2a26501571a1487","Cargo.toml":"cb9ee00cbb415fa66a71a7d4822839bb3552336ec9ab975ae7b1137c711449cb","Cargo.toml.orig":"08409c395e4d502015da62e97efdc9c5bc6e3076031144f3f5aa35c900c7c735","src/backends/mod.rs":"26591e67688f8d015242295dde5050c4b34986e9980018a855346291a0472206","src/backends/v1_2_0/mod.rs":"01e6310dbe806f132ac303a2d38e82f41a2973fe7c0f448fbecd0f257b285133","src/backends/v1_2_0/web.rs":"ac89f16bf623f7d85590d34b45c99b0e522d9d434b4c22af7fa8a8a653e09d2e","src/backends/v1_3_0/mod.rs":"679aebc708541973da12934f5597aad4f7178b43bd69329142cee1818d50f8d3","src/backends/v1_3_0/web.rs":"1ec4cbe6bdc26f165d9e54e9bf2aac4c3706357ce4677dc21113710d4a26c3c1","src/firmware.rs":"168eeffaef90cb1525bb2e126e73905b5205d49215437263813e30323f6b7a05","src/lib.rs":"16ea1c0007fa6d6c86c1f83d3ac9cdf065cd9936cd52f35ef89c227397bbc54a","src/timezone.rs":"309bf23de1bdc9126bde5db8dabff0d2c0fea797dbf2630a772a18539838a05e"},"package":"1cb662e56f104c0fe45c8ccdac13f60cbcaad45ac228f939c6ac46ff40335052"} \ No newline at end of file +{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"de321c89f62a60690ba07d6bb145ac688c6141c458638e68b3ed36b50b8de1f1","Cargo.lock":"5942ec7c9cf5c201bd32442d65020dc3ae72e33cb5aaf374b2a26501571a1487","Cargo.toml":"cb9ee00cbb415fa66a71a7d4822839bb3552336ec9ab975ae7b1137c711449cb","Cargo.toml.orig":"08409c395e4d502015da62e97efdc9c5bc6e3076031144f3f5aa35c900c7c735","src/backends/mod.rs":"26591e67688f8d015242295dde5050c4b34986e9980018a855346291a0472206","src/backends/v1_2_0/mod.rs":"1634197592d962894e330b65a808518734aa26af57f182ea64dca59e3e9eb58b","src/backends/v1_2_0/web.rs":"ac89f16bf623f7d85590d34b45c99b0e522d9d434b4c22af7fa8a8a653e09d2e","src/backends/v1_3_0/mod.rs":"ab0a02f3fe1e6400f07f2bd148cb05e027cfc1e5b1fbfe6f2f01a1dddf78bb51","src/backends/v1_3_0/web.rs":"1ec4cbe6bdc26f165d9e54e9bf2aac4c3706357ce4677dc21113710d4a26c3c1","src/firmware.rs":"168eeffaef90cb1525bb2e126e73905b5205d49215437263813e30323f6b7a05","src/lib.rs":"16ea1c0007fa6d6c86c1f83d3ac9cdf065cd9936cd52f35ef89c227397bbc54a","src/timezone.rs":"309bf23de1bdc9126bde5db8dabff0d2c0fea797dbf2630a772a18539838a05e"},"package":"1cb662e56f104c0fe45c8ccdac13f60cbcaad45ac228f939c6ac46ff40335052"} \ No newline at end of file diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs index ad2779b6..85011853 100644 --- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs +++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs @@ -20,7 +20,7 @@ use asic_rs_core::{ device::DeviceInfo, fan::FanData, hashrate::{HashRate, HashRateUnit}, - message::{MessageSeverity, MinerMessage}, + message::{MessageSeverity, MinerComponent, MinerMessage}, miner::TuningTarget, operating_state::OperatingState, pool::{PoolData, PoolGroupData, PoolURL}, @@ -353,14 +353,26 @@ impl GetDataLocations for VnishV120 { tag: None, }, )], - DataField::Messages => vec![( - WEB_SUMMARY, - DataExtractor { - func: get_by_pointer, - key: Some("/miner/miner_status"), - tag: None, - }, - )], + DataField::Messages => vec![ + ( + WEB_SUMMARY, + DataExtractor { + func: get_by_pointer, + key: Some("/miner/miner_status"), + tag: Some("miner_status"), + }, + ), + // Per-hashboard diagnostics (chip status buckets + per-chain state) + // for per-board fault messages in parse_messages. + ( + WEB_SUMMARY, + DataExtractor { + func: get_by_pointer, + key: Some("/miner/chains"), + tag: Some("chains"), + }, + ), + ], DataField::TuningTarget => vec![( WEB_SETTINGS, DataExtractor { @@ -850,9 +862,12 @@ impl GetMessages for VnishV120 { /// reported here rather than computed from invented thresholds. fn parse_messages(&self, data: &HashMap) -> Vec { let mut messages = Vec::new(); + let msg = data.get(&DataField::Messages); - if let Some(status) = data.get(&DataField::Messages) - && let Some(state) = status.pointer("/miner_state").and_then(|v| v.as_str()) + // Miner-level state verdict (now under the "miner_status" tag). + if let Some(state) = msg + .and_then(|v| v.pointer("/miner_status/miner_state")) + .and_then(|v| v.as_str()) { let normal = matches!( state.to_lowercase().as_str(), @@ -872,6 +887,68 @@ impl GetMessages for VnishV120 { } } + // Per-hashboard faults from the summary chains (round 20 #1). VNish reports + // per-chip status buckets (`red` = failed, `orange` = degraded, `grey` = + // healthy) and a per-chain state; attribute each fault to its own board so + // the Health column reds the right hashboard icon and that icon's tooltip + // carries the specific fault, instead of everything landing on the miner- + // level (brain) message. Chain ids are 1-based; board positions are 0-based. + if let Some(chains) = msg + .and_then(|v| v.pointer("/chains")) + .and_then(|v| v.as_array()) + { + for chain in chains { + let Some(id) = chain.pointer("/id").and_then(|v| v.as_u64()) else { + continue; + }; + let idx = id.saturating_sub(1) as u16; + let red = chain + .pointer("/chip_statuses/red") + .and_then(|v| v.as_u64()) + .unwrap_or(0); + let orange = chain + .pointer("/chip_statuses/orange") + .and_then(|v| v.as_u64()) + .unwrap_or(0); + let state = chain + .pointer("/status/state") + .and_then(|v| v.as_str()) + .unwrap_or(""); + let state_ok = matches!( + state.to_lowercase().as_str(), + "" | "mining" | "auto-tuning" | "auto_tuning" | "tuning" + ); + + if red > 0 { + messages.push(MinerMessage::with_component( + 0, + 0, + format!("Hashboard {id}: {red} failed chip(s)"), + MessageSeverity::Error, + Some(MinerComponent::hashboard(idx)), + )); + } else if !state_ok { + // A board not in a normal state but with no failed chips: report + // the state itself (e.g. "initializing", "disabled", "stopped"). + messages.push(MinerMessage::with_component( + 0, + 0, + format!("Hashboard {id}: {state}"), + MessageSeverity::Error, + Some(MinerComponent::hashboard(idx)), + )); + } else if orange > 0 { + messages.push(MinerMessage::with_component( + 0, + 0, + format!("Hashboard {id}: {orange} degraded chip(s)"), + MessageSeverity::Warning, + Some(MinerComponent::hashboard(idx)), + )); + } + } + } + messages } } diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs index 4f0453a1..1301a657 100644 --- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs +++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs @@ -20,7 +20,7 @@ use asic_rs_core::{ device::DeviceInfo, fan::FanData, hashrate::{HashRate, HashRateUnit}, - message::{MessageSeverity, MinerMessage}, + message::{MessageSeverity, MinerComponent, MinerMessage}, miner::TuningTarget, operating_state::OperatingState, pool::{PoolData, PoolGroupData, PoolURL}, @@ -351,14 +351,26 @@ impl GetDataLocations for VnishV130 { tag: None, }, )], - DataField::Messages => vec![( - WEB_SUMMARY, - DataExtractor { - func: get_by_pointer, - key: Some("/miner/miner_status"), - tag: None, - }, - )], + DataField::Messages => vec![ + ( + WEB_SUMMARY, + DataExtractor { + func: get_by_pointer, + key: Some("/miner/miner_status"), + tag: Some("miner_status"), + }, + ), + // Per-hashboard diagnostics (chip status buckets + per-chain state) + // for per-board fault messages in parse_messages. + ( + WEB_SUMMARY, + DataExtractor { + func: get_by_pointer, + key: Some("/miner/chains"), + tag: Some("chains"), + }, + ), + ], DataField::TuningPercent => vec![( WEB_SUMMARY, DataExtractor { @@ -805,9 +817,12 @@ impl GetMessages for VnishV130 { /// reported here rather than computed from invented thresholds. fn parse_messages(&self, data: &HashMap) -> Vec { let mut messages = Vec::new(); + let msg = data.get(&DataField::Messages); - if let Some(status) = data.get(&DataField::Messages) - && let Some(state) = status.pointer("/miner_state").and_then(|v| v.as_str()) + // Miner-level state verdict (now under the "miner_status" tag). + if let Some(state) = msg + .and_then(|v| v.pointer("/miner_status/miner_state")) + .and_then(|v| v.as_str()) { let normal = matches!( state.to_lowercase().as_str(), @@ -827,6 +842,68 @@ impl GetMessages for VnishV130 { } } + // Per-hashboard faults from the summary chains (round 20 #1). VNish reports + // per-chip status buckets (`red` = failed, `orange` = degraded, `grey` = + // healthy) and a per-chain state; attribute each fault to its own board so + // the Health column reds the right hashboard icon and that icon's tooltip + // carries the specific fault, instead of everything landing on the miner- + // level (brain) message. Chain ids are 1-based; board positions are 0-based. + if let Some(chains) = msg + .and_then(|v| v.pointer("/chains")) + .and_then(|v| v.as_array()) + { + for chain in chains { + let Some(id) = chain.pointer("/id").and_then(|v| v.as_u64()) else { + continue; + }; + let idx = id.saturating_sub(1) as u16; + let red = chain + .pointer("/chip_statuses/red") + .and_then(|v| v.as_u64()) + .unwrap_or(0); + let orange = chain + .pointer("/chip_statuses/orange") + .and_then(|v| v.as_u64()) + .unwrap_or(0); + let state = chain + .pointer("/status/state") + .and_then(|v| v.as_str()) + .unwrap_or(""); + let state_ok = matches!( + state.to_lowercase().as_str(), + "" | "mining" | "auto-tuning" | "auto_tuning" | "tuning" + ); + + if red > 0 { + messages.push(MinerMessage::with_component( + 0, + 0, + format!("Hashboard {id}: {red} failed chip(s)"), + MessageSeverity::Error, + Some(MinerComponent::hashboard(idx)), + )); + } else if !state_ok { + // A board not in a normal state but with no failed chips: report + // the state itself (e.g. "initializing", "disabled", "stopped"). + messages.push(MinerMessage::with_component( + 0, + 0, + format!("Hashboard {id}: {state}"), + MessageSeverity::Error, + Some(MinerComponent::hashboard(idx)), + )); + } else if orange > 0 { + messages.push(MinerMessage::with_component( + 0, + 0, + format!("Hashboard {id}: {orange} degraded chip(s)"), + MessageSeverity::Warning, + Some(MinerComponent::hashboard(idx)), + )); + } + } + } + messages } }