//! 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 //! MEMORY-SNAPSHOT). 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". struct Board { ip: &'static str, model: &'static str, firmware: &'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![] }; // 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.model == "Antminer S17" || self.model.starts_with("Antminer S19") || self.model.starts_with("Antminer S21"); MinerRow { ip: self.ip.to_string(), selected: false, model: self.model.to_string(), firmware: self.firmware.to_string(), hashrate_ths: self.hashrate, expected_ths: self.expected, efficiency, power_w: self.power, chip_temp_c: self.temp, 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), 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 }, light_flashing: Some(false), 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, }, ..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 { let boards = [ Board { ip: "10.255.1.112", model: "Antminer S17", firmware: "Stock", 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", model: "Antminer S19", firmware: "OurOS 1.2", 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", model: "Antminer S19j Pro", firmware: "OurOS 1.2", 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", model: "Antminer S19k Pro", firmware: "OurOS 1.2", 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", model: "Antminer S21 Pro", firmware: "Stock", 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", model: "WhatsMiner M30S", firmware: "WMOS H3", 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", model: "WhatsMiner M30S+", firmware: "WMOS H616", 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", model: "WhatsMiner M50", firmware: "WMOS CB4", 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", model: "Antminer S19", firmware: "WardenOS dev", 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() }