Round-9 #4 -- "the power-limit on the WhatsMiners doesn't apply properly" -- root-caused and verified against the live fleet, then fixed in vendored asic-rs via a new patch queue (ADR 0003). Root cause: asic-rs routes a WhatsMiner to its v3 (WhatsMinerOS) backend when the firmware date is >= 2024-11-01. The v3 privileged power-limit write (command "set.miner.power_limit" on port 4433) authenticated against account "super" but hashed the token with the WEB/admin password, and sent the watt value as a float -- so the miner rejected every write with "invalid json or password is wrong". asic-rs then swallowed that (Ok(data.is_ok()) -> Ok(false)) so the GUI showed "refused" with no reason. (Older miners, fw < 2024-11-01, use the v2 "adjust_power_limit" path, which restarts the miner on a change -- see below.) Fix (thirdparty/asic-rs/patches/0001): - v3 set_auth: the "super" account's token password is a SEPARATE v3 credential (factory default "super"), NOT the web/admin password carried by `auth`; use "super". The web password still drives the v2 (admin) path. - v3 set_power_limit: send the watts as a bare integer (a float trips the firmware's "invalid json" parser). - v2 + v3: propagate the RPC error with `?` instead of swallowing it to Ok(false), so a real failure reaches the round-9 bottom-right error indicator with the miner's own message. Verified on a live M30S+ (fw 20241108, api 3.0.1) via a read-only 4028 capture/restore harness: the fixed request returns {"code":0,"msg":"ok"}; asic-rs set_power_limit now returns Ok(true) and the miner applies the limit (it restarts to re-tune, ~10 min ramp -- expected WhatsMiner behaviour). Matches the pyasic and HashSource whatsminer-api-3 references. All test miners were returned to their prior configured limit. asic-rs patch-queue mechanism (ADR 0003 updated): asic-rs is cargo-vendored, so in-place edits are documented as a numbered patch under thirdparty/asic-rs/ plus a checksum-refresh helper and scripts/apply-asic-rs-patches.sh for re-vendoring. The committed vendor/ tree has the patch applied and its .cargo-checksum.json refreshed, so builds need nothing extra (CI builds fresh; a note documents the local `cargo clean -p` cargo-caching gotcha). Known follow-up: the v2 backend (fw < 2024-11-01) reaches the miner via "adjust_power_limit" but a changed value restarts the miner and the in-restart status check reports failure; whether it applies correctly needs its own verification. The error-propagation change surfaces that honestly meanwhile. Compile-checked (release + tests); 79 offline tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
34 lines
1.1 KiB
Bash
34 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# Re-apply the asic-rs patch queue to the cargo-vendored tree and refresh the
|
|
# affected crates' .cargo-checksum.json. Run this after `cargo vendor vendor`
|
|
# (which regenerates a pristine vendor/ and drops our edits). A normal build
|
|
# does NOT need this -- the committed vendor/ tree already has the patches
|
|
# applied and checksums refreshed; this is the re-vendoring recipe (ADR 0003).
|
|
set -euo pipefail
|
|
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
cd "$REPO"
|
|
|
|
PATCHES_DIR="thirdparty/asic-rs/patches"
|
|
shopt -s nullglob
|
|
patches=("$PATCHES_DIR"/*.patch)
|
|
if [ ${#patches[@]} -eq 0 ]; then
|
|
echo "no patches in $PATCHES_DIR"
|
|
exit 0
|
|
fi
|
|
|
|
for p in "${patches[@]}"; do
|
|
echo "== applying $p =="
|
|
if git apply --check -p1 "$p" 2>/dev/null; then
|
|
git apply -p1 "$p"
|
|
elif git apply --check -p1 --reverse "$p" 2>/dev/null; then
|
|
echo " (already applied -- skipping)"
|
|
else
|
|
echo "ERROR: $p does not apply cleanly; resolve manually." >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
echo "== refreshing checksums for all vendored asic-rs crates =="
|
|
python3 thirdparty/asic-rs/refresh-checksums.py --all
|
|
echo "done."
|