asic-rs telemetry T2b: cumulative share stats (difficulty acc/rej, stale, blocks)
build-test-release / release (push) Successful in 17m46s
build-test-release / release (push) Successful in 17m46s
Round 19 #10 telemetry extension, tier 2b. Adds the cumulative share statistics from item #10 end to end: difficulty-weighted accepted/rejected work, raw stale share count, and blocks found. Core (asic-rs-core): - New ShareSummary sub-struct (data/share.rs) with a parse_cgminer_share_summary helper reading a cgminer/btminer SUMMARY[0] object. - New DataField::ShareSummary; MinerData gains share_summary. - Rides the existing GetBestShare trait via a defaulted parse_share_summary method (no new supertrait bound, no per-backend empty impl); parse_data wires it in. Backends (read the already-fetched SUMMARY, so no extra round-trips; these are miner-level aggregates -> top-level MinerData fields, not per-pool PoolData): - Antminer v2020 + v2023_07, LuxOS, WhatsMiner V1 + V2 override parse_share_summary. - Braiins (no cumulative difficulty), ePIC (current difficulty only), WhatsMiner V3 and VNish expose none and inherit None -- fixtures confirm. GUI: four new columns (Diff acc / Diff rej / Stale / Blocks), right-aligned, in the Pools category, auto-hidden when empty. MinerRow gains the four fields; to_row reads them from share_summary. ALL_COLUMNS 63 -> 67. Fixture tests: whatsminer v1 and antminer v2020 assert the parsed values. Patch 0026. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Djv3oncM4LxTS5tb61Ako6
This commit is contained in:
@@ -590,6 +590,13 @@ pub struct MinerRow {
|
||||
/// (round 19 #10). `None` when the firmware reports neither.
|
||||
pub accepted_shares: Option<u64>,
|
||||
pub rejected_shares: Option<u64>,
|
||||
/// Cumulative share statistics from the miner summary (round 19 #10, T2):
|
||||
/// difficulty-weighted accepted / rejected work, raw stale count, and blocks
|
||||
/// found. `None` where the firmware does not report the value.
|
||||
pub difficulty_accepted: Option<f64>,
|
||||
pub difficulty_rejected: Option<f64>,
|
||||
pub stale_shares: Option<u64>,
|
||||
pub found_blocks: Option<u64>,
|
||||
// state
|
||||
pub uptime_secs: u64,
|
||||
pub light_flashing: Option<bool>,
|
||||
@@ -1130,6 +1137,14 @@ pub enum Column {
|
||||
Accepted,
|
||||
Rejected,
|
||||
RejectRatio,
|
||||
/// Cumulative share statistics (round 19 #10, T2): difficulty-weighted
|
||||
/// accepted / rejected work, raw stale count, and blocks found. Populated on
|
||||
/// the cgminer family (Antminer, LuxOS, WhatsMiner V1/V2); other firmwares
|
||||
/// leave them empty (auto-hidden).
|
||||
DiffAccepted,
|
||||
DiffRejected,
|
||||
StaleShares,
|
||||
Blocks,
|
||||
/// Per-hashboard hashrate / voltage / frequency, slash-joined like Chip temp.
|
||||
BoardHashrate,
|
||||
BoardVoltage,
|
||||
@@ -1145,7 +1160,7 @@ pub enum Column {
|
||||
|
||||
/// Every column, in registry order. Ip first, then the default-visible set
|
||||
/// (UI-SPEC order), then all remaining metrics.
|
||||
pub const ALL_COLUMNS: [Column; 63] = [
|
||||
pub const ALL_COLUMNS: [Column; 67] = [
|
||||
Column::Ip,
|
||||
Column::Hashrate,
|
||||
Column::Hashrate1m,
|
||||
@@ -1201,6 +1216,10 @@ pub const ALL_COLUMNS: [Column; 63] = [
|
||||
Column::Accepted,
|
||||
Column::Rejected,
|
||||
Column::RejectRatio,
|
||||
Column::DiffAccepted,
|
||||
Column::DiffRejected,
|
||||
Column::StaleShares,
|
||||
Column::Blocks,
|
||||
Column::BoardHashrate,
|
||||
Column::BoardVoltage,
|
||||
Column::BoardFrequency,
|
||||
@@ -1250,6 +1269,10 @@ impl Column {
|
||||
Column::Accepted => "Accepted",
|
||||
Column::Rejected => "Rejected",
|
||||
Column::RejectRatio => "Reject %",
|
||||
Column::DiffAccepted => "Diff acc",
|
||||
Column::DiffRejected => "Diff rej",
|
||||
Column::StaleShares => "Stale",
|
||||
Column::Blocks => "Blocks",
|
||||
Column::BoardHashrate => "Board HR",
|
||||
Column::BoardVoltage => "Board V",
|
||||
Column::BoardFrequency => "Board freq",
|
||||
@@ -1319,6 +1342,8 @@ impl Column {
|
||||
Column::Target => 110,
|
||||
Column::Accepted | Column::Rejected => 100,
|
||||
Column::RejectRatio => 90,
|
||||
Column::DiffAccepted | Column::DiffRejected => 110,
|
||||
Column::StaleShares | Column::Blocks => 80,
|
||||
Column::BoardHashrate | Column::BoardVoltage | Column::BoardFrequency => 130,
|
||||
Column::PsuVersion => 100,
|
||||
Column::PsuSerial => 150,
|
||||
@@ -1381,6 +1406,10 @@ impl Column {
|
||||
| Column::Accepted
|
||||
| Column::Rejected
|
||||
| Column::RejectRatio
|
||||
| Column::DiffAccepted
|
||||
| Column::DiffRejected
|
||||
| Column::StaleShares
|
||||
| Column::Blocks
|
||||
| Column::BoardHashrate
|
||||
| Column::BoardVoltage
|
||||
| Column::BoardFrequency
|
||||
@@ -1463,6 +1492,12 @@ impl Column {
|
||||
Column::Accepted => SortKey::Num(r.accepted_shares.map(|v| v as f64).unwrap_or(none)),
|
||||
Column::Rejected => SortKey::Num(r.rejected_shares.map(|v| v as f64).unwrap_or(none)),
|
||||
Column::RejectRatio => SortKey::Num(r.reject_ratio().unwrap_or(none)),
|
||||
Column::DiffAccepted => SortKey::Num(r.difficulty_accepted.unwrap_or(none)),
|
||||
Column::DiffRejected => SortKey::Num(r.difficulty_rejected.unwrap_or(none)),
|
||||
Column::StaleShares => {
|
||||
SortKey::Num(r.stale_shares.map(|v| v as f64).unwrap_or(none))
|
||||
}
|
||||
Column::Blocks => SortKey::Num(r.found_blocks.map(|v| v as f64).unwrap_or(none)),
|
||||
Column::BoardHashrate => SortKey::Num(avg_or(&r.board_hashrates, none)),
|
||||
Column::BoardVoltage => SortKey::Num(avg_positive(&r.board_voltages, none)),
|
||||
Column::BoardFrequency => SortKey::Num(avg_positive(&r.board_frequencies, none)),
|
||||
@@ -1559,6 +1594,12 @@ impl Column {
|
||||
Column::Accepted => r.accepted_shares.map(|v| v.to_string()).unwrap_or_default(),
|
||||
Column::Rejected => r.rejected_shares.map(|v| v.to_string()).unwrap_or_default(),
|
||||
Column::RejectRatio => r.reject_ratio().map(|v| format!("{v:.2}%")).unwrap_or_default(),
|
||||
// Difficulty-weighted work (SI-formatted like Best share); raw stale /
|
||||
// block counts as plain integers (round 19 #10, T2).
|
||||
Column::DiffAccepted => r.difficulty_accepted.map(|v| format_si(v, "")).unwrap_or_default(),
|
||||
Column::DiffRejected => r.difficulty_rejected.map(|v| format_si(v, "")).unwrap_or_default(),
|
||||
Column::StaleShares => r.stale_shares.map(|v| v.to_string()).unwrap_or_default(),
|
||||
Column::Blocks => r.found_blocks.map(|v| v.to_string()).unwrap_or_default(),
|
||||
// Per-hashboard hashrate / voltage / frequency, slash-joined like Chip
|
||||
// temp; "-" for a board with no reading, blank when none at all.
|
||||
Column::BoardHashrate => join_board(&r.board_hashrates, |v| {
|
||||
@@ -1670,7 +1711,8 @@ impl Column {
|
||||
Column::Worker | Column::PoolAccount | Column::PoolUrl | Column::Pool1Url
|
||||
| Column::Pool1Worker | Column::Pool2Url | Column::Pool2Worker | Column::Pool3Url
|
||||
| Column::Pool3Worker | Column::Accepted | Column::Rejected
|
||||
| Column::RejectRatio => (7, "Pools"),
|
||||
| Column::RejectRatio | Column::DiffAccepted | Column::DiffRejected
|
||||
| Column::StaleShares | Column::Blocks => (7, "Pools"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1189,6 +1189,11 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
||||
}
|
||||
any.then_some(total)
|
||||
},
|
||||
// Cumulative share stats from the miner summary (round 19 #10, T2).
|
||||
difficulty_accepted: data.share_summary.as_ref().and_then(|s| s.difficulty_accepted),
|
||||
difficulty_rejected: data.share_summary.as_ref().and_then(|s| s.difficulty_rejected),
|
||||
stale_shares: data.share_summary.as_ref().and_then(|s| s.stale_shares),
|
||||
found_blocks: data.share_summary.as_ref().and_then(|s| s.found_blocks),
|
||||
uptime_secs: data.uptime.map(|d| d.as_secs()).unwrap_or(0),
|
||||
light_flashing: data.light_flashing,
|
||||
operating_state,
|
||||
|
||||
Reference in New Issue
Block a user