build-test-release / release (push) Successful in 6m53s
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
75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Refresh the .cargo-checksum.json of vendored asic-rs crates after the patch
|
|
queue (thirdparty/asic-rs/patches/) has been applied to the cargo-vendored tree.
|
|
|
|
cargo verifies each vendored file against the per-file SHA256 in that crate's
|
|
.cargo-checksum.json; a patched file whose checksum is stale fails the build. For
|
|
every crate named on the command line (or, with --all, every asic-rs* crate under
|
|
vendor/), this recomputes the SHA256 of each file already listed in the manifest
|
|
and rewrites it, preserving the top-level "package"/"$comment" keys. Files not
|
|
listed are left alone (cargo only checks listed files).
|
|
|
|
Usage:
|
|
refresh-checksums.py <crate-dir> [<crate-dir> ...]
|
|
refresh-checksums.py --all # every vendor/asic-rs* crate
|
|
"""
|
|
import hashlib
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPO = Path(__file__).resolve().parents[2]
|
|
VENDOR = REPO / "vendor"
|
|
|
|
|
|
def sha256(path: Path) -> str:
|
|
h = hashlib.sha256()
|
|
with open(path, "rb") as f:
|
|
for chunk in iter(lambda: f.read(1 << 16), b""):
|
|
h.update(chunk)
|
|
return h.hexdigest()
|
|
|
|
|
|
def refresh(crate_dir: Path) -> int:
|
|
manifest = crate_dir / ".cargo-checksum.json"
|
|
if not manifest.exists():
|
|
print(f"skip {crate_dir.name}: no .cargo-checksum.json")
|
|
return 0
|
|
data = json.loads(manifest.read_text())
|
|
files = data.get("files", {})
|
|
changed = 0
|
|
for rel in list(files):
|
|
fp = crate_dir / rel
|
|
if not fp.exists():
|
|
print(f" WARN {crate_dir.name}: listed file missing: {rel}")
|
|
continue
|
|
new = sha256(fp)
|
|
if new != files[rel]:
|
|
files[rel] = new
|
|
changed += 1
|
|
if changed:
|
|
manifest.write_text(json.dumps(data, separators=(",", ":")))
|
|
print(f"{crate_dir.name}: refreshed {changed} checksum(s)")
|
|
else:
|
|
print(f"{crate_dir.name}: no changes")
|
|
return changed
|
|
|
|
|
|
def main() -> None:
|
|
args = sys.argv[1:]
|
|
if not args:
|
|
print(__doc__)
|
|
sys.exit(2)
|
|
if args == ["--all"]:
|
|
crates = sorted(p for p in VENDOR.glob("asic-rs*") if p.is_dir())
|
|
else:
|
|
crates = [Path(a) if Path(a).is_absolute() else (VENDOR / a) for a in args]
|
|
total = 0
|
|
for c in crates:
|
|
total += refresh(c)
|
|
print(f"done: {total} checksum(s) refreshed across {len(crates)} crate(s)")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|