Table/model (Rust): - #12: default columns are now IP, Model, Errors, Hashrate, Power, Chip temp, Firmware, CPU, Boards, Access, in that display order (initial ViewState and the built-in "Default" preset both updated). - #14: removed the Control board column (CPU + Board replace it); the underlying control-board string stays on MinerRow for the SSH PIC probe. - #6 (part 1): firmware family strips the vendor word asic-rs prepends on stock firmware ("AntMiner Stock" -> "Stock"), moving it into FW Version. - #17: air-cooled miners' ambient reading routes to a new "Env temp" column instead of "Fluid temp" (asic-rs reports ambient in its fluid field and has no cooling-type flag; cooling type is inferred from the model name). - #16: relative-hashrate (actual/expected) sort -- the Hashrate header cycles absolute-asc/desc then relative-asc/desc, with right-click menu entries; HashrateRel is a sort-only pseudo-column. Rendering (wx-rs SegmentRenderer bridge, mirrored to patches/0003 per ADR 0003): - #3: the per-row zebra background now fills the whole column-wide cell (wx shrinks a custom renderer's rect to the content size, so the earlier fill covered only the text; Render now fills GetOwner()->GetWidth() and wxGTK clips it to the cell). - #1/#7: uncoloured segments (combined-cell slashes, "Stock" firmware) take the tree widget's themed text colour at its live GTK state, so they dim on window-backdrop like the native cells. - #10: the Boards column renders per-hashboard status dots (green hashing / red faulted / grey undetected, board 1 rightmost); the Light column renders a yellow locate dot while flashing. - #13: the Access column renders a padlock icon (green open = writable, red closed = view-only) instead of "locked"/"unlocked" text. Shapes draw from control-char sentinels (never emoji/pictographs), font- independent. Self-test verifies the icon columns structurally. 82 unit tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
235 lines
12 KiB
Rust
235 lines
12 KiB
Rust
//! Bench-fleet fixtures: the expected hardware output of the 9 boards on
|
|
//! 10.255.1.0/24 (see ../../../HANDOFF.md section 7 and the parent project's
|
|
//! [removed]). These are the reference values the workflow tests compare
|
|
//! the application's actual output against, and the rows the offline
|
|
//! `ALKANE_FAKE_SCAN` demo mode renders. Only miners that respond become rows,
|
|
//! so there is no synthetic "offline" fixture.
|
|
//!
|
|
//! Hashrate/power/temp are representative per-model figures (the bench boards
|
|
//! are not always energised); the point of the fixtures is a fixed, known input
|
|
//! set so the transforms (formatting, KPI aggregation, sort, filter, the "slow"
|
|
//! band) can be checked deterministically. Update these if the bench inventory
|
|
//! changes.
|
|
|
|
use crate::model::{is_slow, MinerRow};
|
|
|
|
/// One fixture board, pre-transform. `expected` of 0.0 means "band unknown".
|
|
/// `make`/`model_id`/`board` mirror what asic-rs actually reports (compact
|
|
/// identifiers + a bare control-board name) so the fixtures exercise the real
|
|
/// crate::naming transform, not pre-cleaned strings.
|
|
struct Board {
|
|
ip: &'static str,
|
|
make: &'static str,
|
|
model_id: &'static str,
|
|
board: &'static str,
|
|
firmware: &'static str,
|
|
fw_version: &'static str,
|
|
hashrate: f64,
|
|
expected: f64,
|
|
power: f64,
|
|
temp: f64,
|
|
fan: f64,
|
|
worker: &'static str,
|
|
mining: bool,
|
|
/// True for the bench board deliberately rebucketed into the "paused"
|
|
/// status/KPI bucket (not-mining but operator-paused, distinct from a
|
|
/// unit that is simply idle/not-hashing).
|
|
paused: bool,
|
|
}
|
|
|
|
impl Board {
|
|
fn into_row(self) -> MinerRow {
|
|
let slow = is_slow(self.mining, self.hashrate, self.expected);
|
|
// A few extra metrics so the demo/offline mode shows non-empty values
|
|
// for some of the additional columns.
|
|
let last_octet: u8 = self.ip.rsplit('.').next().and_then(|s| s.parse().ok()).unwrap_or(0);
|
|
let (boards, chips, efficiency) = if self.mining {
|
|
(Some(3u32), Some(210u32), if self.hashrate > 0.0 { self.power / self.hashrate } else { 0.0 })
|
|
} else {
|
|
(None, None, 0.0)
|
|
};
|
|
let fan_rpms = if self.mining {
|
|
vec![self.fan, self.fan * 0.95, self.fan * 1.02]
|
|
} else {
|
|
vec![]
|
|
};
|
|
// Three per-hashboard chip temps around the average (so the offline demo
|
|
// shows the "77 / 64 / 74" per-board Chip-temp cell).
|
|
let board_temps = if self.mining && self.temp > 0.0 {
|
|
vec![self.temp + 2.0, self.temp - 3.0, self.temp + 1.0]
|
|
} else {
|
|
vec![]
|
|
};
|
|
// Air-cooled WhatsMiners report an ambient reading (asic-rs surfaces it in
|
|
// its fluid_temperature field); the scan routes it to env_temp for
|
|
// air-cooled models, so the demo mirrors that (round 11 #17).
|
|
let env_temp_c = if self.mining && self.make.eq_ignore_ascii_case("whatsminer") {
|
|
27.0
|
|
} else {
|
|
0.0
|
|
};
|
|
// Per-hashboard health dots for the Boards column (round 11 #10): mining
|
|
// units show three green dots, except two demo cases -- the slow S21 Pro
|
|
// has one faulted (red) board, and one VNish S19 has a board that wasn't
|
|
// detected (grey) -- so the offline demo exercises all three states.
|
|
use crate::model::BoardHealth::{Fault, Missing, Ok};
|
|
let board_status = if self.mining {
|
|
match self.ip {
|
|
"10.255.1.149" => vec![Ok, Fault, Ok],
|
|
"10.255.1.166" => vec![Ok, Ok, Missing],
|
|
_ => vec![Ok, Ok, Ok],
|
|
}
|
|
} else {
|
|
vec![]
|
|
};
|
|
// Firmware-flash capability is modeled on the real Bitmain/Antminer
|
|
// upgrade path (S17/S19/S21 family); WhatsMiner boards in this fleet
|
|
// don't advertise it, so both true and false show up and the
|
|
// firmware menu item is testable.
|
|
let firmware_flash = self.make.eq_ignore_ascii_case("antminer")
|
|
&& (self.model_id == "S17"
|
|
|| self.model_id.starts_with("S19")
|
|
|| self.model_id.starts_with("S21"));
|
|
// Derive the display identity through the same path the live scan uses.
|
|
let brand = crate::naming::brand(self.make);
|
|
let model = crate::naming::clean_model(self.make, self.model_id);
|
|
let submodel = crate::naming::submodel(self.make, self.model_id);
|
|
let control_board = crate::naming::control_board_code(self.make, self.board, &model);
|
|
let cpu = crate::naming::control_board_cpu(self.make, self.board, &model);
|
|
let board_code = crate::naming::control_board_board(self.make, self.board, &model);
|
|
MinerRow {
|
|
ip: self.ip.to_string(),
|
|
selected: false,
|
|
model,
|
|
brand,
|
|
submodel,
|
|
firmware: self.firmware.to_string(),
|
|
fw_version: self.fw_version.to_string(),
|
|
cpu,
|
|
board_code,
|
|
hashrate_ths: self.hashrate,
|
|
expected_ths: self.expected,
|
|
efficiency,
|
|
power_w: self.power,
|
|
chip_temp_c: self.temp,
|
|
board_temps,
|
|
env_temp_c,
|
|
fan_rpms,
|
|
worker: self.worker.to_string(),
|
|
is_mining: self.mining,
|
|
slow,
|
|
paused: self.paused,
|
|
// offline defaults to false (online); these bench rows are reachable.
|
|
mac: format!("AA:BB:CC:00:{:02X}:{last_octet:02X}", last_octet.wrapping_mul(3)),
|
|
hostname: format!("miner-{last_octet}"),
|
|
hashboards: boards,
|
|
expected_hashboards: Some(3),
|
|
board_status,
|
|
total_chips: chips,
|
|
psu_fan_rpm: if self.mining { self.fan * 0.9 } else { 0.0 },
|
|
uptime_secs: if self.mining { 3600 * 24 * 2 + 3600 * 5 } else { 0 },
|
|
// One unit is "being located" so the Light column's yellow dot is
|
|
// demonstrable offline (round 11 #10).
|
|
light_flashing: Some(self.ip == "10.255.1.167"),
|
|
pool_url: if self.worker.is_empty() { String::new() } else { "stratum+tcp://pool.blueflare:3333".to_string() },
|
|
pools: if self.worker.is_empty() {
|
|
Vec::new()
|
|
} else {
|
|
vec![
|
|
("stratum+tcp://pool.blueflare:3333".to_string(), self.worker.to_string()),
|
|
("stratum+tcp://backup.blueflare:3333".to_string(), format!("{}_bak", self.worker)),
|
|
]
|
|
},
|
|
operating_state: if self.paused {
|
|
"paused".to_string()
|
|
} else if self.mining {
|
|
"mining".to_string()
|
|
} else {
|
|
"idle".to_string()
|
|
},
|
|
// Synthetic capabilities so the right-click config menu is
|
|
// exercisable offline: mining units support everything, idle ones
|
|
// only the fault light + restart (to show the capability intersection).
|
|
caps: crate::model::MinerCaps {
|
|
fault_light: true,
|
|
restart: true,
|
|
pause: self.mining,
|
|
resume: self.mining,
|
|
power_limit: self.mining,
|
|
tuning: self.mining,
|
|
firmware_flash,
|
|
},
|
|
// Demo values for the round-8/9 columns (synthetic, so the columns
|
|
// show variety offline). control_board is derived above via naming.
|
|
algorithm: "SHA256".to_string(),
|
|
control_board,
|
|
pic_present: if self.model_id.contains("S21") {
|
|
Some(false) // noPIC example
|
|
} else if self.make.eq_ignore_ascii_case("antminer") {
|
|
Some(true)
|
|
} else {
|
|
None // WhatsMiner: unknown over the network
|
|
},
|
|
// Access: idle/view-only units (no worker) shown locked; the rest
|
|
// unlocked. (Live rows infer this from control capabilities.)
|
|
write_locked: Some(self.worker.is_empty()),
|
|
// Concise, prefix-free lines (matching summarize_messages output):
|
|
// the Errors column shows the count, these are the hover tooltip.
|
|
errors: if self.model_id == "S21Pro" {
|
|
vec![
|
|
"hashrate 70% below expected".to_string(),
|
|
"chip temperature high (HashBoard 2)".to_string(),
|
|
]
|
|
} else {
|
|
Vec::new()
|
|
},
|
|
..Default::default()
|
|
}
|
|
}
|
|
}
|
|
|
|
/// The 9 bench boards (9 rows total). One is idle/not-hashing (S17 stock,
|
|
/// .112); one is paused (WardenOS dev, .115 - deliberately rebucketed from idle
|
|
/// so the "paused" status/KPI bucket is exercisable offline); one is slow (S21
|
|
/// Pro aml stock at ~30% of expected); the other six hash normally.
|
|
///
|
|
/// Derived totals (used by the workflow tests):
|
|
/// total = 9, hashing = 6, slow = 1, not hashing = 1, paused = 1,
|
|
/// total hashrate = 685.0 TH/s, total power = 21300 W.
|
|
pub fn bench_fleet() -> Vec<MinerRow> {
|
|
let boards = [
|
|
// firmware families span the palette (Stock/VNish/Braiins/LuxOS/ePIC/
|
|
// Hive/BixBit/Alkane) so the offline demo shows the Firmware colouring.
|
|
Board { ip: "10.255.1.112", make: "Antminer", model_id: "S17", board: "Xilinx", firmware: "Stock", fw_version: "",
|
|
hashrate: 0.0, expected: 0.0, power: 0.0, temp: 0.0, fan: 0.0,
|
|
worker: "", mining: false, paused: false },
|
|
Board { ip: "10.255.1.166", make: "Antminer", model_id: "S19", board: "BeagleBoneBlack", firmware: "VNish", fw_version: "1.2.8",
|
|
hashrate: 95.0, expected: 96.0, power: 3250.0, temp: 65.0, fan: 4200.0,
|
|
worker: "blueflare.s19", mining: true, paused: false },
|
|
Board { ip: "10.255.1.152", make: "Antminer", model_id: "S19jPro", board: "AMLogic", firmware: "Braiins", fw_version: "25.05.1",
|
|
hashrate: 100.0, expected: 104.0, power: 3100.0, temp: 62.0, fan: 3900.0,
|
|
worker: "blueflare.s19jpro", mining: true, paused: false },
|
|
Board { ip: "10.255.1.167", make: "Antminer", model_id: "S19KPro", board: "AMLogic", firmware: "LuxOS", fw_version: "2024.9.0",
|
|
hashrate: 120.0, expected: 128.0, power: 3300.0, temp: 68.0, fan: 4500.0,
|
|
worker: "blueflare.s19kpro", mining: true, paused: false },
|
|
Board { ip: "10.255.1.149", make: "Antminer", model_id: "S21Pro", board: "CVITek", firmware: "ePIC", fw_version: "1.0.3",
|
|
hashrate: 60.0, expected: 200.0, power: 1500.0, temp: 55.0, fan: 3000.0,
|
|
worker: "blueflare.s21pro", mining: true, paused: false }, // slow: 60/200 = 30%
|
|
Board { ip: "10.255.1.126", make: "Whatsminer", model_id: "M30SVE40", board: "H3", firmware: "Stock", fw_version: "H3.0.1",
|
|
hashrate: 92.0, expected: 96.0, power: 3400.0, temp: 70.0, fan: 4800.0,
|
|
worker: "blueflare.h3", mining: true, paused: false },
|
|
Board { ip: "10.255.1.131", make: "Whatsminer", model_id: "M30SPlusVE40", board: "H616", firmware: "Hive", fw_version: "1.0",
|
|
hashrate: 100.0, expected: 100.0, power: 3450.0, temp: 71.0, fan: 4900.0,
|
|
worker: "blueflare.h616", mining: true, paused: false },
|
|
Board { ip: "10.255.1.148", make: "Whatsminer", model_id: "M50VH50", board: "H6", firmware: "BixBit", fw_version: "2.1",
|
|
hashrate: 118.0, expected: 122.0, power: 3300.0, temp: 66.0, fan: 4600.0,
|
|
worker: "blueflare.m50", mining: true, paused: false },
|
|
// Rebucketed from idle/not-hashing to paused so the "paused"
|
|
// status/KPI bucket is exercisable in the fake-scan/offline demo.
|
|
Board { ip: "10.255.1.115", make: "Antminer", model_id: "S19", board: "BeagleBoneBlack", firmware: "Alkane", fw_version: "0.1",
|
|
hashrate: 0.0, expected: 0.0, power: 0.0, temp: 0.0, fan: 0.0,
|
|
worker: "", mining: false, paused: true },
|
|
];
|
|
boards.into_iter().map(Board::into_row).collect()
|
|
}
|