Compare commits

...
6 Commits
Author SHA1 Message Date
noah 10d7fd6d95 Merge pull request 'Show hashboards and SHA-256 for VNish models asic-rs does not know' (#19) from fix/vnish-unknown-model-boards into main 2026-11-03 08:48:11 -07:00
noahandClaude Opus 5.5 9b440a46e3 Show hashboards and SHA-256 for VNish models asic-rs does not know
VNish reports the 88-chip S19 as "Antminer S19 (88)", which asic-rs parses
to an Unknown model with no hardware table. The VNish backends sized the
board list from that table, so all three live chains were dropped and the
Health column drew no hashboard icons for hashing miners; the same model also
got an Unknown hash algorithm. Size boards from the chains the miner reports
when the table is missing, and infer the algorithm from the Antminer family
letter (helper shared with the stock backend). asic-rs patch 0034.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 09:32:28 -06:00
noah c3b0dc6c8a Merge pull request 'Say in the Windows zip README whether the executable is signed' (#18) from windows-signed-readme into main 2026-11-03 07:21:11 -07:00
noahandClaude Opus 5.5 bfda29a845 Say in the Windows zip's README whether the executable is signed
Signing is now on (Azure Artifact Signing profile alkane-toolkit); the README
tells site users how to confirm the Blueflare signature, or that an unsigned
build will trip SmartScreen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 08:07:21 -06:00
noah 2c58cbac48 Merge pull request 'Sign the Windows build with Azure Artifact Signing' (#17) from windows-signing into main 2026-11-02 19:51:15 -07:00
noahandClaude Opus 5.5 174b162dfd Sign the Windows build with Azure Artifact Signing
- ci/sign-windows.sh signs alkane-toolkit.exe from Linux with jsign through
  the blueflaresigning account (RFC 3161 timestamped), using the
  least-privilege CI service principal alkane-toolkit-ci-signer. It is a
  no-op until the repository variable AZURE_SIGNING_PROFILE names a
  certificate profile; after that any signing failure fails the build.
- release.yml and next.yml sign before packaging; windows-native.yml checks
  the signature with Get-AuthenticodeSignature on real Windows and requires
  Valid once signing is on.
- CI image adds a Java runtime and a checksum-pinned jsign 7.6 (re-pinned);
  windows-ci.sh fetches the same jar on older images.
- scripts/enable-windows-signing.sh turns signing on after Microsoft
  approves the publisher identity validation: creates the PublicTrust
  certificate profile, narrows the signer role to it, sets the variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 20:38:21 -06:00
24 changed files with 747 additions and 47 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
publish:
runs-on: alkane-verify
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
permissions:
contents: read
steps:
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
publish:
runs-on: alkane-verify
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
permissions:
actions: read
contents: write
+10 -2
View File
@@ -17,7 +17,7 @@ jobs:
windows:
runs-on: alkane-ci
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
env:
CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
@@ -64,6 +64,14 @@ jobs:
- name: Build Windows candidate
if: steps.version.outputs.release == 'true'
run: bash ci/windows-ci.sh build
- name: Sign Windows candidate (Azure Artifact Signing)
if: steps.version.outputs.release == 'true'
env:
AZURE_SIGNING_PROFILE: ${{ vars.AZURE_SIGNING_PROFILE }}
AZURE_SIGNING_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
AZURE_SIGNING_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
AZURE_SIGNING_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
run: bash ci/windows-ci.sh sign
- name: Package Windows candidate
if: steps.version.outputs.release == 'true'
run: bash ci/windows-ci.sh package "${{ steps.version.outputs.version }}"
@@ -80,7 +88,7 @@ jobs:
needs: windows
runs-on: alkane-ci
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
env:
CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
+10 -2
View File
@@ -23,7 +23,7 @@ jobs:
windows:
runs-on: alkane-ci
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
env:
CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
@@ -91,6 +91,14 @@ jobs:
- name: Headless UI self-test (Windows build, under Wine)
run: bash ci/windows-ci.sh selftest
- name: Sign Windows executable (Azure Artifact Signing)
env:
AZURE_SIGNING_PROFILE: ${{ vars.AZURE_SIGNING_PROFILE }}
AZURE_SIGNING_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
AZURE_SIGNING_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
AZURE_SIGNING_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
run: bash ci/windows-ci.sh sign
- name: Package Windows artifact
if: steps.ver.outputs.release == 'true'
run: bash ci/windows-ci.sh package "${{ steps.ver.outputs.version }}"
@@ -120,7 +128,7 @@ jobs:
needs: windows
runs-on: alkane-ci
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
env:
CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
check:
runs-on: alkane-fast
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
env:
CARGO_BUILD_JOBS: 2
steps:
+2 -2
View File
@@ -13,7 +13,7 @@ jobs:
verify:
runs-on: alkane-verify
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
outputs:
surface: ${{ steps.surface.outputs.surface }}
env:
@@ -203,7 +203,7 @@ jobs:
if: needs.verify.outputs.surface == 'full'
runs-on: alkane-verify
container:
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
env:
CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
+12
View File
@@ -63,6 +63,18 @@ jobs:
$os = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
"Testing run $env:RUN_ID on Windows $($os.DisplayVersion) build $($os.CurrentBuild)"
- name: Authenticode signature (native Windows)
env:
SIGNING_ENABLED: ${{ vars.AZURE_SIGNING_PROFILE }}
run: |
# Windows itself judges the signature: chain to a trusted root,
# intact file hash, valid timestamp. Required once signing is on.
$sig = Get-AuthenticodeSignature "$env:ALKANE_NATIVE\alkane-toolkit.exe"
Write-Host "Signature: $($sig.Status) $($sig.StatusMessage)"
if ($sig.SignerCertificate) { Write-Host "Signer: $($sig.SignerCertificate.Subject)" }
if ($sig.TimeStamperCertificate) { Write-Host "Timestamp: $($sig.TimeStamperCertificate.Subject)" }
if ($env:SIGNING_ENABLED -and $sig.Status -ne 'Valid') { exit 1 }
- name: Unit tests (native Windows)
run: |
$failed = @()
+2 -1
View File
@@ -13,7 +13,8 @@ case "$mode" in
# Windows cross build (mingw-w64, posix threads) + Wine for its tests.
windows) packages=(libssl-dev pkg-config ca-certificates
gcc-mingw-w64-x86-64-posix g++-mingw-w64-x86-64-posix
binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev wine wine64 xvfb xauth) ;;
binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev wine wine64 xvfb xauth
openjdk-21-jre-headless) ;;
*) echo "unknown dependency set: $mode" >&2; exit 2 ;;
esac
+13 -1
View File
@@ -9,6 +9,8 @@
# scripts/build-wx-windows.sh and stamped with the source digest the same
# way as the wxGTK prefix (ci/ensure-wx-prefix.sh rebuilds on a mismatch)
# - Wine with an initialised prefix, to run the Windows tests and self-test
# - a Java runtime and jsign (checksum-pinned), to Authenticode-sign the .exe
# through Azure Artifact Signing (ci/sign-windows.sh)
#
# Build and push from the workstation with ci/images/build-image.sh.
ARG BASE=gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
@@ -18,9 +20,18 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
gcc-mingw-w64-x86-64-posix g++-mingw-w64-x86-64-posix \
binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev \
wine wine64 xvfb xauth \
wine wine64 xvfb xauth openjdk-21-jre-headless \
&& rm -rf /var/lib/apt/lists/*
# jsign (Maven Central net.jsign:jsign; keep in step with ci/windows-ci.sh).
ARG JSIGN_VERSION=7.6
ARG JSIGN_SHA256=6cf58aa080e7ff82656f320cff8d4a3bff30408df8766806dcba3740dd839fa5
RUN mkdir -p /opt/jsign \
&& curl -sSfL -o /opt/jsign/jsign.jar \
"https://repo1.maven.org/maven2/net/jsign/jsign/${JSIGN_VERSION}/jsign-${JSIGN_VERSION}.jar" \
&& echo "${JSIGN_SHA256} /opt/jsign/jsign.jar" | sha256sum -c - \
&& java -jar /opt/jsign/jsign.jar --help >/dev/null
RUN rustup target add x86_64-pc-windows-gnu
# The build context is the repository root, filtered by
@@ -44,4 +55,5 @@ RUN test -s /root/.cache/wx-3.3.3-mingw/lib/libwx_mswu-3.3-x86_64-w64-mingw32.a
&& test -s /root/.cache/wx-3.3.3-linux/lib/libwx_gtk3u-3.3.a \
&& x86_64-w64-mingw32-g++-posix --version >/dev/null \
&& wine --version \
&& test -s /opt/jsign/jsign.jar \
&& rustup target list --installed | grep -qx x86_64-pc-windows-gnu
+19
View File
@@ -15,6 +15,7 @@
import json
import pathlib
import struct
import sys
import zipfile
@@ -26,6 +27,7 @@ def release(version: str, exe: str, out_dir: str) -> None:
exe_path = pathlib.Path(exe)
if exe_path.suffix != ".exe" or not exe_path.is_file():
sys.exit(f"not a Windows executable: {exe}")
signed = _has_authenticode_signature(exe_path)
name = f"alkane-toolkit-v{version}-windows-x86_64"
out = pathlib.Path(out_dir) / f"{name}.zip"
out.parent.mkdir(parents=True, exist_ok=True)
@@ -35,6 +37,14 @@ def release(version: str, exe: str, out_dir: str) -> None:
"Run alkane-toolkit.exe. No installer and no extra runtime are needed:\r\n"
"the executable is self-contained and runs on Windows 10 and 11.\r\n"
"\r\n"
+ (
"The executable is signed by Blueflare (Azure Artifact Signing). To check:\r\n"
"right-click alkane-toolkit.exe > Properties > Digital Signatures.\r\n"
if signed else
"This build is not code-signed, so Windows SmartScreen may warn on first\r\n"
"run: choose More info > Run anyway.\r\n"
)
+ "\r\n"
"Settings are kept in %APPDATA%\\alkane-toolkit.\r\n"
"SSH-based actions use the OpenSSH client built into Windows (ssh.exe);\r\n"
"HTTP actions use curl.exe, also built in.\r\n"
@@ -49,6 +59,15 @@ def release(version: str, exe: str, out_dir: str) -> None:
print(out)
def _has_authenticode_signature(exe: pathlib.Path) -> bool:
"""True if the PE file carries a certificate table (an Authenticode signature)."""
data = exe.read_bytes()
pe = struct.unpack_from("<I", data, 0x3C)[0]
magic = struct.unpack_from("<H", data, pe + 24)[0]
dirs = pe + 24 + (96 if magic == 0x10B else 112)
return struct.unpack_from("<II", data, dirs + 4 * 8)[1] > 0
def tests(cargo_json: str, out_zip: str) -> None:
executables = []
for line in pathlib.Path(cargo_json).read_text().splitlines():
+1 -1
View File
@@ -1 +1 @@
gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
gitea.bluefla.re/blueflare/alkane-ci@sha256:4929b2979851f1f12fb8f92ef74236ae4c2ea735a41ead94a16af416a4f0a1a5
+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# Authenticode-sign Windows executables with Azure Artifact Signing (formerly
# Trusted Signing), from Linux, with jsign. Every signature is RFC 3161
# timestamped: the signing certificates live only a few days, the timestamp is
# what keeps a signature valid after that.
#
# ci/sign-windows.sh FILE.exe [FILE.exe ...]
#
# Configuration (environment):
# AZURE_SIGNING_PROFILE certificate profile name; EMPTY = signing not set
# up yet: the files are left unsigned (exit 0)
# AZURE_SIGNING_ACCOUNT signing account (default blueflaresigning)
# AZURE_SIGNING_ENDPOINT account endpoint (default https://wus2.codesigning.azure.net)
# Credentials, one of:
# AZURE_SIGNING_TENANT_ID + AZURE_SIGNING_CLIENT_ID + AZURE_SIGNING_CLIENT_SECRET
# (the CI service principal alkane-toolkit-ci-signer, role
# "Artifact Signing Certificate Profile Signer" on the account only)
# AZURE_SIGNING_TOKEN an access token for https://codesigning.azure.net,
# e.g. from `az account get-access-token --resource https://codesigning.azure.net`
# ALKANE_JSIGN_JAR jsign jar (default /opt/jsign/jsign.jar, from the CI image)
#
# Once a profile is configured, any failure fails the job: a release is never
# shipped half-signed or silently unsigned.
set -euo pipefail
[ "$#" -gt 0 ] || { sed -n '3,25p' "$0" >&2; exit 2; }
profile="${AZURE_SIGNING_PROFILE:-}"
if [ -z "$profile" ]; then
echo "Windows code signing is not enabled (AZURE_SIGNING_PROFILE unset); leaving $* unsigned"
exit 0
fi
account="${AZURE_SIGNING_ACCOUNT:-blueflaresigning}"
endpoint="${AZURE_SIGNING_ENDPOINT:-https://wus2.codesigning.azure.net}"
jar="${ALKANE_JSIGN_JAR:-/opt/jsign/jsign.jar}"
[ -f "$jar" ] || { echo "jsign not found at $jar" >&2; exit 1; }
if [ -z "${AZURE_SIGNING_TOKEN:-}" ]; then
: "${AZURE_SIGNING_TENANT_ID:?signing credentials missing}"
: "${AZURE_SIGNING_CLIENT_ID:?signing credentials missing}"
: "${AZURE_SIGNING_CLIENT_SECRET:?signing credentials missing}"
# Client-credentials token for the signing service. The secret and token
# stay in this process's environment, never on a command line.
AZURE_SIGNING_TOKEN="$(python3 - <<'PY'
import json, os, sys, urllib.parse, urllib.request
body = urllib.parse.urlencode({
"grant_type": "client_credentials",
"client_id": os.environ["AZURE_SIGNING_CLIENT_ID"],
"client_secret": os.environ["AZURE_SIGNING_CLIENT_SECRET"],
"scope": "https://codesigning.azure.net/.default",
}).encode()
url = f"https://login.microsoftonline.com/{os.environ['AZURE_SIGNING_TENANT_ID']}/oauth2/v2.0/token"
try:
with urllib.request.urlopen(url, body, timeout=60) as r:
print(json.load(r)["access_token"])
except Exception as e:
sys.exit(f"could not get a signing token: {e}")
PY
)"
fi
export AZURE_SIGNING_TOKEN
for file in "$@"; do
java -jar "$jar" \
--storetype TRUSTEDSIGNING \
--keystore "${endpoint#https://}" \
--storepass env:AZURE_SIGNING_TOKEN \
--alias "$account/$profile" \
--alg SHA-256 \
--tsaurl http://timestamp.acs.microsoft.com --tsmode RFC3161 \
--tsretries 3 --tsretrywait 10 \
--name "Alkane Toolkit" \
--url https://gitea.bluefla.re/blueflare/alkane-toolkit \
"$file"
# jsign fails on any error; also make sure a signature actually landed in
# the PE certificate table before the file goes anywhere.
python3 - "$file" <<'PY'
import struct, sys
data = open(sys.argv[1], "rb").read()
pe = struct.unpack_from("<I", data, 0x3C)[0]
magic = struct.unpack_from("<H", data, pe + 24)[0]
dirs = pe + 24 + (96 if magic == 0x10B else 112)
offset, size = struct.unpack_from("<II", data, dirs + 4 * 8) # IMAGE_DIRECTORY_ENTRY_SECURITY
if size == 0:
sys.exit(f"{sys.argv[1]}: no Authenticode signature after signing")
print(f"{sys.argv[1]}: signed ({size} byte certificate table)")
PY
done
+5 -2
View File
@@ -43,6 +43,7 @@ def check_workflow_contract() -> None:
"Clippy (Windows target, warnings are errors)", "Build release (Windows)",
"Unit tests (Windows build, under Wine)",
"Headless UI self-test (Windows build, under Wine)",
"Sign Windows executable (Azure Artifact Signing)",
"Package Windows artifact", "Clean generated Toolkit build",
)),
("next.yml", "next", "candidate", (
@@ -50,7 +51,8 @@ def check_workflow_contract() -> None:
"Create private prerelease", "Clean generated Toolkit build",
)),
("next.yml", "next", "windows", (
"Build Windows candidate", "Package Windows candidate",
"Build Windows candidate", "Sign Windows candidate (Azure Artifact Signing)",
"Package Windows candidate",
"Clean generated Toolkit build",
)),
("verify.yml", "main", "verify", (
@@ -83,7 +85,8 @@ def check_workflow_contract() -> None:
condition = steps[position].get("if")
if gate in {"Create Gitea release + upload artifact",
"Create private prerelease", "Package Windows artifact",
"Build Windows candidate", "Package Windows candidate"}:
"Build Windows candidate", "Package Windows candidate",
"Sign Windows candidate (Azure Artifact Signing)"}:
assert condition is not None and "release == 'true'" in condition, path
elif filename == "verify.yml" and gate in {
"Build", "Unit tests", "Microbenchmarks",
+16 -1
View File
@@ -8,6 +8,9 @@
# windows-ci.sh build release alkane-toolkit.exe
# windows-ci.sh test all unit tests, run under Wine
# windows-ci.sh selftest headless UI self-test under Wine + Xvfb
# windows-ci.sh sign Authenticode-sign alkane-toolkit.exe through
# Azure Artifact Signing (ci/sign-windows.sh;
# a no-op until AZURE_SIGNING_PROFILE is set)
# windows-ci.sh package VERSION dist/alkane-toolkit-vVERSION-windows-x86_64.zip
# windows-ci.sh test-bundle dist/alkane-toolkit-windows-tests.zip (for
# the native Windows job)
@@ -30,6 +33,15 @@ case "${1:-}" in
toolchain)
bash ci/ensure-build-deps.sh windows
rustup target list --installed | grep -qx "$target" || rustup target add "$target"
# jsign ships in the CI image; fetch the same pinned jar on older images.
jsign_version=7.6
jsign_sha256=6cf58aa080e7ff82656f320cff8d4a3bff30408df8766806dcba3740dd839fa5
if [ ! -s /opt/jsign/jsign.jar ]; then
mkdir -p /opt/jsign
curl -sSfL -o /opt/jsign/jsign.jar \
"https://repo1.maven.org/maven2/net/jsign/jsign/$jsign_version/jsign-$jsign_version.jar"
echo "$jsign_sha256 /opt/jsign/jsign.jar" | sha256sum -c -
fi
;;
clippy)
rustup component add clippy >/dev/null 2>&1 || true
@@ -53,6 +65,9 @@ case "${1:-}" in
selftest)
bash scripts/ui-selftest-windows.sh "$exe"
;;
sign)
bash ci/sign-windows.sh "$exe"
;;
package)
python3 ci/package-windows.py release "${2:?usage: windows-ci.sh package VERSION}" "$exe" dist
;;
@@ -64,7 +79,7 @@ case "${1:-}" in
dist/alkane-toolkit-windows-tests.zip
;;
*)
sed -n '3,16p' "$0" >&2
sed -n '3,19p' "$0" >&2
exit 2
;;
esac
+37
View File
@@ -59,6 +59,43 @@ target and a prebuilt wxMSW prefix to the Linux image. Rebuild it with
`ci/images/build-image.sh TAG` from the workstation that holds the registry
credential; the script pins the new digest everywhere.
## Code signing
Release and `-rc` executables are Authenticode-signed with Azure Artifact
Signing (formerly Trusted Signing), so Windows and SmartScreen show
"Blueflare" as the verified publisher instead of "Unknown publisher".
| Piece | Where |
|-------|-------|
| Signing account | `blueflaresigning` (Basic), resource group `rg-blueflare-signing`, West US 2, endpoint `https://wus2.codesigning.azure.net` |
| CI identity | service principal `alkane-toolkit-ci-signer`, role "Artifact Signing Certificate Profile Signer" on the certificate profile only; Gitea secrets `AZURE_SIGNING_TENANT_ID`, `AZURE_SIGNING_CLIENT_ID`, `AZURE_SIGNING_CLIENT_SECRET` (secret expires 2027-11-03) |
| Switch | Gitea repository variable `AZURE_SIGNING_PROFILE` (certificate profile name); unset = builds stay unsigned |
| Signer | `ci/sign-windows.sh` (jsign from the CI image, RFC 3161 timestamp from `timestamp.acs.microsoft.com`) |
| Check | `windows-native.yml` requires `Get-AuthenticodeSignature` = Valid on real Windows once signing is on |
Signing is on since 2026-11-03 (identity validation approved, certificate
profile `alkane-toolkit`, PublicTrust). The zip's README.txt states whether its
executable is signed. To set it up again, e.g. for a new profile, after an
identity validation is approved (portal: signing account > Identity
validations):
```sh
scripts/enable-windows-signing.sh <identity-validation-id>
```
It creates the PublicTrust certificate profile, narrows the CI identity to it,
and sets `AZURE_SIGNING_PROFILE`. From then on a signing failure fails the
release. Rotate the CI secret before it expires with
`az ad sp credential reset --id <appId> --years 1` and update the Gitea secret.
Sign by hand (any machine with Java, `az login` and the Signer role):
```sh
AZURE_SIGNING_PROFILE=alkane-toolkit ALKANE_JSIGN_JAR=jsign.jar \
AZURE_SIGNING_TOKEN=$(az account get-access-token --resource https://codesigning.azure.net --query accessToken -o tsv) \
ci/sign-windows.sh alkane-toolkit.exe
```
## Native Windows runner
`windows-native.yml` runs on the self-hosted runner `win11-test-vm`
+58
View File
@@ -0,0 +1,58 @@
#!/bin/sh
# Turn on Authenticode signing of the Windows build, once Microsoft has
# approved the publisher identity validation for the Artifact Signing account.
#
# scripts/enable-windows-signing.sh IDENTITY_VALIDATION_ID [PROFILE]
#
# IDENTITY_VALIDATION_ID is shown in the Azure portal: signing account
# "blueflaresigning" > Objects > Identity validations > (approved entry).
# The script
# 1. creates the PublicTrust certificate profile PROFILE (default
# alkane-toolkit) bound to that identity,
# 2. narrows the CI signer's role from the whole account to that profile,
# 3. sets the Gitea repository variable AZURE_SIGNING_PROFILE, which makes
# ci/sign-windows.sh sign every release and candidate from then on.
#
# Run on the workstation: it needs `az login` as an account owner and the
# Gitea admin token (~/.config/gitea/token), neither of which CI ever sees.
# Re-running is safe.
set -eu
IVID=${1:?usage: enable-windows-signing.sh IDENTITY_VALIDATION_ID [PROFILE]}
PROFILE=${2:-alkane-toolkit}
RG=rg-blueflare-signing
ACCOUNT=blueflaresigning
SIGNER=alkane-toolkit-ci-signer
REPO=blueflare/alkane-toolkit
TOKEN_FILE=${GITEA_TOKEN_FILE:-$HOME/.config/gitea/token}
if ! az trustedsigning certificate-profile show -g "$RG" --account-name "$ACCOUNT" \
-n "$PROFILE" --only-show-errors -o none 2>/dev/null; then
az trustedsigning certificate-profile create -g "$RG" --account-name "$ACCOUNT" \
-n "$PROFILE" --profile-type PublicTrust --identity-validation-id "$IVID" \
--only-show-errors -o none
fi
az trustedsigning certificate-profile show -g "$RG" --account-name "$ACCOUNT" -n "$PROFILE" \
--only-show-errors --query "{profile:name, state:provisioningState, status:status}" -o table
# Least privilege: the CI identity may sign with this profile and nothing else.
profile_id=$(az trustedsigning certificate-profile show -g "$RG" --account-name "$ACCOUNT" \
-n "$PROFILE" --only-show-errors --query id -o tsv)
account_id=${profile_id%/certificateProfiles/*}
sp=$(az ad sp list --display-name "$SIGNER" --query "[0].id" -o tsv)
role="Artifact Signing Certificate Profile Signer"
az role assignment create --assignee-object-id "$sp" --assignee-principal-type ServicePrincipal \
--role "$role" --scope "$profile_id" -o none
az role assignment delete --assignee "$sp" --role "$role" --scope "$account_id" 2>/dev/null || true
# Switch signing on for CI (repository variable, not a secret).
api=https://gitea.bluefla.re/api/v1/repos/$REPO/actions/variables/AZURE_SIGNING_PROFILE
body=$(printf '{"value":"%s"}' "$PROFILE")
auth() { printf 'header = "Authorization: token %s"\n' "$(cat "$TOKEN_FILE")"; }
code=$(auth | curl -sS --config - -X PUT -H 'Content-Type: application/json' -d "$body" \
-o /dev/null -w '%{http_code}' "$api")
[ "$code" = 204 ] || [ "$code" = 201 ] || {
code=$(auth | curl -sS --config - -X POST -H 'Content-Type: application/json' -d "$body" \
-o /dev/null -w '%{http_code}' "$api")
}
case "$code" in 201|204) echo "Gitea AZURE_SIGNING_PROFILE=$PROFILE: signing is on" ;;
*) echo "setting the Gitea variable failed (HTTP $code)" >&2; exit 1 ;; esac
@@ -0,0 +1,308 @@
Subject: [PATCH 0034] vnish: keep the reported boards and infer the algorithm for unknown models
Field report 2026-11-03: VNish Antminer S19 (88) units showed no hashboard
icons while hashing. VNish reports the model as "Antminer S19 (88)", which is
not in asic-rs' alias table, so it parses to AntMinerModel::Unknown with no
hardware table. parse_hashboards sized the board list from that table
(board_count() = None -> 0 boards) and dropped all three live chains the
miner reports in /summary. The same Unknown model also got
HashAlgorithm::Unknown, so its hashrate was bucketed as "Unknown Hashrate".
- VNish v1.2.x and v1.3.x parse_hashboards: when the model has no hardware
table, size the boards from the highest 1-based chain id the miner reports
(a dead middle board keeps its slot). Known models are unchanged.
- infer_antminer_algo (family letter: S/T -> SHA-256, L -> Scrypt,
Z -> Equihash, ambiguous -> Unknown) moves from the stock v2020 backend
into asic-rs-makes-antminer as a public function; the stock backend and
both VNish backends now use it for models the table cannot place.
Tests: unknown_model_keeps_the_reported_chains (both VNish backends, chain
data from the live 10.4.0.179 unit); the existing
unknown_models_infer_algo_from_family_letter still passes against the moved
helper. Live-verified read-only on all 13 fleet S19 (88) units (10.4.x,
10.7.1.190): three hashboard icons each, per-board state intact (e.g. one red
board on 10.4.1.111), and the KPI reads "SHA-256 Hashrate".
diff --git a/vendor/asic-rs-firmwares-antminer/src/backends/v2020/mod.rs b/vendor/asic-rs-firmwares-antminer/src/backends/v2020/mod.rs
index 71195737..872bd1de 100644
--- a/vendor/asic-rs-firmwares-antminer/src/backends/v2020/mod.rs
+++ b/vendor/asic-rs-firmwares-antminer/src/backends/v2020/mod.rs
@@ -202,27 +202,7 @@ fn miner_conf_with_fan_config(miner_conf: &Value, config: FanConfig) -> Value {
Value::Object(payload)
}
-/// Infer an Antminer's hash algorithm from its model-family letter, for models
-/// asic-rs' alias table doesn't recognise (round 13 #5). Only the families whose
-/// entire product line shares one algorithm are inferred; anything ambiguous
-/// (the K-series spans Kadena/KHeavyHash/Eaglesong, DR is Blake256 while D is
-/// X11) is left Unknown rather than guessed wrong.
-fn infer_antminer_algo(model: &str) -> HashAlgorithm {
- let upper = model.to_ascii_uppercase();
- let name = upper
- .strip_prefix("ANTMINER ")
- .unwrap_or(&upper)
- .trim_start();
- match name.chars().next() {
- // Z9 / Z11 / Z15 / Z15 Pro / Z15J -- the whole Z line is Equihash.
- Some('Z') => HashAlgorithm::Equihash,
- // L3+ / L7 / L9 / L11 -- the whole L line is Scrypt.
- Some('L') => HashAlgorithm::Scrypt,
- // S9..S21 and T9..T21 (and future revisions) are all SHA-256.
- Some('S') | Some('T') => HashAlgorithm::SHA256,
- _ => HashAlgorithm::Unknown,
- }
-}
+use asic_rs_makes_antminer::models::infer_antminer_algo;
impl AntMinerV2020 {
pub fn new(ip: IpAddr, model: impl MinerModel) -> Self {
diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs
index 2c14f217..3c8e1bee 100644
--- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs
+++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs
@@ -1,5 +1,6 @@
use std::{collections::HashMap, net::IpAddr, str::FromStr, time::Duration};
+use asic_rs_makes_antminer::models::infer_antminer_algo;
use anyhow;
use asic_rs_core::{
config::{
@@ -17,7 +18,7 @@ use asic_rs_core::{
DataCollector, DataExtensions, DataExtractor, DataField, DataLocation, get_by_pointer,
},
command::MinerCommand,
- device::DeviceInfo,
+ device::{DeviceInfo, HashAlgorithm},
fan::FanData,
hashrate::{HashRate, HashRateUnit},
message::{MessageSeverity, MinerComponent, MinerMessage},
@@ -52,7 +53,14 @@ pub struct VnishV120 {
impl VnishV120 {
pub fn new(ip: IpAddr, model: impl MinerModel) -> Self {
let auth = Self::default_auth();
- let algo = model.hash_algorithm();
+ // A model outside asic-rs' alias table (VNish's "Antminer S19 (88)")
+ // resolves to HashAlgorithm::Unknown, which left its hashrate bucketed
+ // as "Unknown Hashrate". Infer it from the Antminer family letter, as
+ // the stock backend does.
+ let algo = match model.hash_algorithm() {
+ HashAlgorithm::Unknown => infer_antminer_algo(&model.to_string()),
+ known => known,
+ };
VnishV120 {
ip,
web: VnishWebAPI::new(ip, 80, auth),
@@ -509,8 +517,24 @@ impl GetHashboards for VnishV120 {
.and_then(|v| v.pointer("/factory"))
.and_then(|v| v.as_array());
- let mut hashboards: Vec<BoardData> =
- (0..self.device_info.hardware.board_count().unwrap_or(0) as usize)
+ // The model's hardware table gives the board count. For a model asic-rs
+ // does not know (e.g. VNish "Antminer S19 (88)") there is no table, and
+ // sizing from it dropped every live chain -- the boards then vanished
+ // from the data although the miner reports them. Fall back to what the
+ // miner reports: the highest 1-based chain id, so a dead middle board
+ // still keeps its slot.
+ let reported_boards = all_chains
+ .iter()
+ .filter_map(|c| c.pointer("/id").and_then(|v| v.as_u64()))
+ .max()
+ .unwrap_or(0) as usize;
+ let board_count = self
+ .device_info
+ .hardware
+ .board_count()
+ .map(|n| n as usize)
+ .unwrap_or(reported_boards);
+ let mut hashboards: Vec<BoardData> = (0..board_count)
.map(|idx| {
BoardData::new(idx as u8, self.device_info.hardware.chips_for_board(idx))
})
@@ -1524,4 +1548,42 @@ mod tests {
assert!(config.available.contains(&Tz::Etc__GMT));
assert_eq!(config.available.last(), Some(&Tz::Etc__GMTMinus14));
}
+
+ /// Same as the 1.3.x backend: a model with no hardware table (VNish's
+ /// "Antminer S19 (88)") must keep the chains the miner reports instead of
+ /// sizing the board list to zero. Live 1.2.7 units (e.g. 10.4.1.111) run it.
+ #[tokio::test]
+ async fn unknown_model_keeps_the_reported_chains() {
+ let miner = VnishV120::new(
+ IpAddr::from([127, 0, 0, 1]),
+ AntMinerModel::Unknown("ANTMINER S19 (88)".to_string()),
+ );
+ let mut results = HashMap::new();
+ results.insert(
+ MinerCommand::WebAPI {
+ command: "info",
+ parameters: None,
+ },
+ json!({ "miner": "Antminer S19 (88)", "hr_measure": "GH/s", "fw_version": "1.2.7" }),
+ );
+ results.insert(
+ MinerCommand::WebAPI {
+ command: "summary",
+ parameters: None,
+ },
+ json!({ "miner": { "hr_realtime": 82600.0, "chains": [
+ { "id": 1, "hashrate_rt": 27537.83 },
+ { "id": 2, "hashrate_rt": 27511.20 },
+ { "id": 3, "hashrate_rt": 27601.04 }
+ ] } }),
+ );
+ let mock_api = MockAPIClient::new(results);
+ let mut collector = DataCollector::new_with_client(&miner, &mock_api);
+ let miner_data = miner.parse_data(collector.collect_all().await);
+
+ assert_eq!(miner_data.hashboards.len(), 3, "one board per reported chain");
+ // ...and its hashrate is SHA-256 (family letter S), not "Unknown".
+ assert_eq!(miner_data.hashrate.expect("hashrate").algo, HashAlgorithm::SHA256);
+ assert!(miner_data.hashboards.iter().all(|b| b.hashrate.is_some()));
+ }
}
diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs
index e6247923..0e009f1c 100644
--- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs
+++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs
@@ -1,5 +1,6 @@
use std::{collections::HashMap, net::IpAddr, str::FromStr, time::Duration};
+use asic_rs_makes_antminer::models::infer_antminer_algo;
use anyhow;
use asic_rs_core::{
config::{
@@ -17,7 +18,7 @@ use asic_rs_core::{
DataCollector, DataExtensions, DataExtractor, DataField, DataLocation, get_by_pointer,
},
command::MinerCommand,
- device::DeviceInfo,
+ device::{DeviceInfo, HashAlgorithm},
fan::FanData,
hashrate::{HashRate, HashRateUnit},
message::{MessageSeverity, MinerComponent, MinerMessage},
@@ -52,7 +53,14 @@ pub struct VnishV130 {
impl VnishV130 {
pub fn new(ip: IpAddr, model: impl MinerModel) -> Self {
let auth = Self::default_auth();
- let algo = model.hash_algorithm();
+ // A model outside asic-rs' alias table (VNish's "Antminer S19 (88)")
+ // resolves to HashAlgorithm::Unknown, which left its hashrate bucketed
+ // as "Unknown Hashrate". Infer it from the Antminer family letter, as
+ // the stock backend does.
+ let algo = match model.hash_algorithm() {
+ HashAlgorithm::Unknown => infer_antminer_algo(&model.to_string()),
+ known => known,
+ };
VnishV130 {
ip,
web: VnishWebAPI::new(ip, 80, auth),
@@ -516,8 +524,24 @@ impl GetHashboards for VnishV130 {
.and_then(|v| v.pointer("/factory"))
.and_then(|v| v.as_array());
- let mut hashboards: Vec<BoardData> =
- (0..self.device_info.hardware.board_count().unwrap_or(0) as usize)
+ // The model's hardware table gives the board count. For a model asic-rs
+ // does not know (e.g. VNish "Antminer S19 (88)") there is no table, and
+ // sizing from it dropped every live chain -- the boards then vanished
+ // from the data although the miner reports them. Fall back to what the
+ // miner reports: the highest 1-based chain id, so a dead middle board
+ // still keeps its slot.
+ let reported_boards = all_chains
+ .iter()
+ .filter_map(|c| c.pointer("/id").and_then(|v| v.as_u64()))
+ .max()
+ .unwrap_or(0) as usize;
+ let board_count = self
+ .device_info
+ .hardware
+ .board_count()
+ .map(|n| n as usize)
+ .unwrap_or(reported_boards);
+ let mut hashboards: Vec<BoardData> = (0..board_count)
.map(|idx| {
BoardData::new(idx as u8, self.device_info.hardware.chips_for_board(idx))
})
@@ -1661,4 +1685,46 @@ mod tests {
assert!(config.available.contains(&Tz::Etc__GMT));
assert_eq!(config.available.last(), Some(&Tz::Etc__GMTMinus14));
}
+
+ /// A model asic-rs has no hardware table for -- VNish reports the 88-chip
+ /// S19 as "Antminer S19 (88)" -- must still surface the boards the miner
+ /// reports. Sizing the board list from the (absent) table dropped all
+ /// three live chains, so the GUI drew no hashboard icons for a hashing
+ /// miner. Chain values match the live 10.4.0.179 unit.
+ #[tokio::test]
+ async fn unknown_model_keeps_the_reported_chains() {
+ let miner = VnishV130::new(
+ IpAddr::from([127, 0, 0, 1]),
+ AntMinerModel::Unknown("ANTMINER S19 (88)".to_string()),
+ );
+ let mut results = HashMap::new();
+ results.insert(
+ web("info"),
+ json!({ "miner": "Antminer S19 (88)", "model": "s19-88", "hr_measure": "GH/s" }),
+ );
+ results.insert(
+ web("summary"),
+ json!({
+ "miner": {
+ "hr_realtime": 82600.0,
+ "chains": [
+ { "id": 1, "hashrate_rt": 27537.83, "chip_statuses": { "grey": 88 } },
+ { "id": 2, "hashrate_rt": 27511.20, "chip_statuses": { "grey": 88 } },
+ { "id": 3, "hashrate_rt": 27601.04, "chip_statuses": { "grey": 88 } }
+ ]
+ }
+ }),
+ );
+ let mock_api = MockAPIClient::new(results);
+ let mut collector = DataCollector::new_with_client(&miner, &mock_api);
+ let miner_data = miner.parse_data(collector.collect_all().await);
+
+ assert_eq!(miner_data.hashboards.len(), 3, "one board per reported chain");
+ // ...and its hashrate is SHA-256 (family letter S), not "Unknown".
+ assert_eq!(miner_data.hashrate.expect("hashrate").algo, HashAlgorithm::SHA256);
+ for (i, board) in miner_data.hashboards.iter().enumerate() {
+ assert_eq!(board.position as usize, i);
+ assert!(board.hashrate.is_some(), "board {i} keeps its live hashrate");
+ }
+ }
}
diff --git a/vendor/asic-rs-makes-antminer/src/models.rs b/vendor/asic-rs-makes-antminer/src/models.rs
index f52639fe..e3185089 100644
--- a/vendor/asic-rs-makes-antminer/src/models.rs
+++ b/vendor/asic-rs-makes-antminer/src/models.rs
@@ -201,6 +201,29 @@ pub enum AntMinerModel {
Unknown(String),
}
+/// Infer an Antminer's hash algorithm from its model-family letter, for models
+/// asic-rs' alias table doesn't recognise (round 13 #5). Only the families whose
+/// entire product line shares one algorithm are inferred; anything ambiguous
+/// (the K-series spans Kadena/KHeavyHash/Eaglesong, DR is Blake256 while D is
+/// X11) is left Unknown rather than guessed wrong. Shared by every firmware
+/// backend that runs on Antminer hardware (stock, VNish).
+pub fn infer_antminer_algo(model: &str) -> HashAlgorithm {
+ let upper = model.to_ascii_uppercase();
+ let name = upper
+ .strip_prefix("ANTMINER ")
+ .unwrap_or(&upper)
+ .trim_start();
+ match name.chars().next() {
+ // Z9 / Z11 / Z15 / Z15 Pro / Z15J -- the whole Z line is Equihash.
+ Some('Z') => HashAlgorithm::Equihash,
+ // L3+ / L7 / L9 / L11 -- the whole L line is Scrypt.
+ Some('L') => HashAlgorithm::Scrypt,
+ // S9..S21 and T9..T21 (and future revisions) are all SHA-256.
+ Some('S') | Some('T') => HashAlgorithm::SHA256,
+ _ => HashAlgorithm::Unknown,
+ }
+}
+
impl FromStr for AntMinerModel {
type Err = ModelSelectionError;
+1 -1
View File
@@ -1 +1 @@
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"6e42d50107b1a43fd7cf4a4c4f538468a337ed219ad8d6b23bd9abdabd123bd5","Cargo.lock":"7f984c7231c91f2def8f3e2e923a85c2e0b3239492f5ce23400881ea4de1aa16","Cargo.toml":"8a447efc18cd97d019a9771fb258b06f694499500561564eec75480e46bcc554","Cargo.toml.orig":"6c9e7b86804255debe03545c6358eb975d3d470810a19e6c40c680299a686b1f","src/backends/mod.rs":"65cdc60cdf38968f5a7e197338f4cf6173406ce69a4f0aaa96a9e29f4f581b6e","src/backends/v2020/firmware.rs":"5a41bfb8f42f17523e68f8702e87d75bcdb268bd4950bb66227f6966ef3576a9","src/backends/v2020/mod.rs":"b2dbba5377a739bc8be3380cfbd09aa80893841c15c305bfd25f900ba7b6a0c9","src/backends/v2020/rpc.rs":"b517f88b9125fe1d8a20d5167f5d0d105b1339fce3d1a9fad5592e00470f46fb","src/backends/v2020/web.rs":"a6a3ad3eb77551b098b0092553b02cee43d165476d8c92164e12a1e765753b0d","src/backends/v2023_07/firmware.rs":"c07668e351d48dab3e24511b1aa9ab5e408bbcb5a438fdb0542a1377f94b9bbb","src/backends/v2023_07/mod.rs":"0906bff13eb51bd47fb0e06cc2c1955fe459c601cb467efc917801ead825dd61","src/backends/v2023_07/rpc.rs":"2b24bbb432b302dd15f7a354054fc96c6a75cac2c8e75b8bcc11da37255a05a3","src/backends/v2023_07/web.rs":"d39b67ed83781b2c4fa84a445b9ffe785ae3001941f800ad9860e050c61c6506","src/firmware.rs":"e75c21d63218204b61bfab067599402e5c0b20452beaf0b16bfa79bf8afb6b35","src/lib.rs":"53f7acddeff8f7d82f80d09e0a9f91962011f9ccf2e441c4ca05cd7fc4eb292e","src/test/json/mod.rs":"a3ef4d6805bb4f8ea087e3a9b875e5a1664580e1ff3e3cd2015bb0c5c18ae7bb","src/test/json/v2020/devs.json":"df17cdfc9522e23450702b93f70ff701892db54c6ce6d986300453ad5e0d22db","src/test/json/v2020/mod.rs":"4c2512d36af834d400a865a94c2e8b1919f9d8dcbf54ab2530c73861c51af67d","src/test/json/v2020/pools.json":"4c4d19ad3ef0de84bfb18daaa48428b5f7917d23287c0196eacf3a6e389e7634","src/test/json/v2020/stats.json":"6d3cb463abb7539ae77aa44ef38e62a5dc0db54670aeacf3bbd01e83f49aa1fd","src/test/json/v2020/summary.json":"2f18c81f989b7c5f70dcb0ddac0520e56ec98b6da25c24e59354a6126c965dae","src/test/json/v2020/system_info.json":"51d1ce922e39a254518a24be56ca86ef1b5843582fb26c1ff0ec4ff6f8f91ccf","src/test/json/v2020/version.json":"ae898c4c9ea3462c3e79f9de755f1fccb4ef122b94a4a512e61aa74491c1a8e9","src/test/json/v2023_07/l11_stats.json":"2eab324f253ced9a0ea4e46466691e0e71fc6fde7558fec86bd5acf6bb9c717d","src/test/json/v2023_07/l11_summary.json":"1e0fdb61b968005d0ec5393d9dc889b09efb1398ffa427629bcc0a98d1b67c22","src/test/json/v2023_07/l11_version.json":"d116921a71731c6e492aed109731c39561e34a24c7df2a88d11ac52b80f6100a","src/test/json/v2023_07/l9_stats.json":"731ee545f16dafd356d22703248b91a37f74585ad73cc27441eb3461ce53dca0","src/test/json/v2023_07/l9_summary.json":"b32b5131ad46859b270d2dbb6bdba3c4e5d7301298daee4ce56332c98faaf81d","src/test/json/v2023_07/l9_version.json":"82f03ca6ea8873f12c4d9455f21b98c547801b58fbff1dcd83c837c0f337a129","src/test/json/v2023_07/mod.rs":"1360a8b155b120f2e755ede0736bcc0d76a9d1d693b984a1b51a16e6c0413791","src/test/mod.rs":"ed52c3d613eabc4a0346bb38bcfdf7a94933d61e368d3c9094821edeab92f81b"},"package":"0c06e3ecbf95ae3fe5e30aacae55cf6e7ad3d965f4a93b2f85c7b64f61fc75e2"}
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"6e42d50107b1a43fd7cf4a4c4f538468a337ed219ad8d6b23bd9abdabd123bd5","Cargo.lock":"7f984c7231c91f2def8f3e2e923a85c2e0b3239492f5ce23400881ea4de1aa16","Cargo.toml":"8a447efc18cd97d019a9771fb258b06f694499500561564eec75480e46bcc554","Cargo.toml.orig":"6c9e7b86804255debe03545c6358eb975d3d470810a19e6c40c680299a686b1f","src/backends/mod.rs":"65cdc60cdf38968f5a7e197338f4cf6173406ce69a4f0aaa96a9e29f4f581b6e","src/backends/v2020/firmware.rs":"5a41bfb8f42f17523e68f8702e87d75bcdb268bd4950bb66227f6966ef3576a9","src/backends/v2020/mod.rs":"f709048edc8eddf71d848d0f3c55c3e2c748726072f9c838482062b66524d875","src/backends/v2020/rpc.rs":"b517f88b9125fe1d8a20d5167f5d0d105b1339fce3d1a9fad5592e00470f46fb","src/backends/v2020/web.rs":"a6a3ad3eb77551b098b0092553b02cee43d165476d8c92164e12a1e765753b0d","src/backends/v2023_07/firmware.rs":"c07668e351d48dab3e24511b1aa9ab5e408bbcb5a438fdb0542a1377f94b9bbb","src/backends/v2023_07/mod.rs":"0906bff13eb51bd47fb0e06cc2c1955fe459c601cb467efc917801ead825dd61","src/backends/v2023_07/rpc.rs":"2b24bbb432b302dd15f7a354054fc96c6a75cac2c8e75b8bcc11da37255a05a3","src/backends/v2023_07/web.rs":"d39b67ed83781b2c4fa84a445b9ffe785ae3001941f800ad9860e050c61c6506","src/firmware.rs":"e75c21d63218204b61bfab067599402e5c0b20452beaf0b16bfa79bf8afb6b35","src/lib.rs":"53f7acddeff8f7d82f80d09e0a9f91962011f9ccf2e441c4ca05cd7fc4eb292e","src/test/json/mod.rs":"a3ef4d6805bb4f8ea087e3a9b875e5a1664580e1ff3e3cd2015bb0c5c18ae7bb","src/test/json/v2020/devs.json":"df17cdfc9522e23450702b93f70ff701892db54c6ce6d986300453ad5e0d22db","src/test/json/v2020/mod.rs":"4c2512d36af834d400a865a94c2e8b1919f9d8dcbf54ab2530c73861c51af67d","src/test/json/v2020/pools.json":"4c4d19ad3ef0de84bfb18daaa48428b5f7917d23287c0196eacf3a6e389e7634","src/test/json/v2020/stats.json":"6d3cb463abb7539ae77aa44ef38e62a5dc0db54670aeacf3bbd01e83f49aa1fd","src/test/json/v2020/summary.json":"2f18c81f989b7c5f70dcb0ddac0520e56ec98b6da25c24e59354a6126c965dae","src/test/json/v2020/system_info.json":"51d1ce922e39a254518a24be56ca86ef1b5843582fb26c1ff0ec4ff6f8f91ccf","src/test/json/v2020/version.json":"ae898c4c9ea3462c3e79f9de755f1fccb4ef122b94a4a512e61aa74491c1a8e9","src/test/json/v2023_07/l11_stats.json":"2eab324f253ced9a0ea4e46466691e0e71fc6fde7558fec86bd5acf6bb9c717d","src/test/json/v2023_07/l11_summary.json":"1e0fdb61b968005d0ec5393d9dc889b09efb1398ffa427629bcc0a98d1b67c22","src/test/json/v2023_07/l11_version.json":"d116921a71731c6e492aed109731c39561e34a24c7df2a88d11ac52b80f6100a","src/test/json/v2023_07/l9_stats.json":"731ee545f16dafd356d22703248b91a37f74585ad73cc27441eb3461ce53dca0","src/test/json/v2023_07/l9_summary.json":"b32b5131ad46859b270d2dbb6bdba3c4e5d7301298daee4ce56332c98faaf81d","src/test/json/v2023_07/l9_version.json":"82f03ca6ea8873f12c4d9455f21b98c547801b58fbff1dcd83c837c0f337a129","src/test/json/v2023_07/mod.rs":"1360a8b155b120f2e755ede0736bcc0d76a9d1d693b984a1b51a16e6c0413791","src/test/mod.rs":"ed52c3d613eabc4a0346bb38bcfdf7a94933d61e368d3c9094821edeab92f81b"},"package":"0c06e3ecbf95ae3fe5e30aacae55cf6e7ad3d965f4a93b2f85c7b64f61fc75e2"}
+1 -21
View File
@@ -202,27 +202,7 @@ fn miner_conf_with_fan_config(miner_conf: &Value, config: FanConfig) -> Value {
Value::Object(payload)
}
/// Infer an Antminer's hash algorithm from its model-family letter, for models
/// asic-rs' alias table doesn't recognise (round 13 #5). Only the families whose
/// entire product line shares one algorithm are inferred; anything ambiguous
/// (the K-series spans Kadena/KHeavyHash/Eaglesong, DR is Blake256 while D is
/// X11) is left Unknown rather than guessed wrong.
fn infer_antminer_algo(model: &str) -> HashAlgorithm {
let upper = model.to_ascii_uppercase();
let name = upper
.strip_prefix("ANTMINER ")
.unwrap_or(&upper)
.trim_start();
match name.chars().next() {
// Z9 / Z11 / Z15 / Z15 Pro / Z15J -- the whole Z line is Equihash.
Some('Z') => HashAlgorithm::Equihash,
// L3+ / L7 / L9 / L11 -- the whole L line is Scrypt.
Some('L') => HashAlgorithm::Scrypt,
// S9..S21 and T9..T21 (and future revisions) are all SHA-256.
Some('S') | Some('T') => HashAlgorithm::SHA256,
_ => HashAlgorithm::Unknown,
}
}
use asic_rs_makes_antminer::models::infer_antminer_algo;
impl AntMinerV2020 {
pub fn new(ip: IpAddr, model: impl MinerModel) -> Self {
+1 -1
View File
@@ -1 +1 @@
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"de321c89f62a60690ba07d6bb145ac688c6141c458638e68b3ed36b50b8de1f1","Cargo.lock":"5942ec7c9cf5c201bd32442d65020dc3ae72e33cb5aaf374b2a26501571a1487","Cargo.toml":"cb9ee00cbb415fa66a71a7d4822839bb3552336ec9ab975ae7b1137c711449cb","Cargo.toml.orig":"08409c395e4d502015da62e97efdc9c5bc6e3076031144f3f5aa35c900c7c735","src/backends/mod.rs":"26591e67688f8d015242295dde5050c4b34986e9980018a855346291a0472206","src/backends/v1_2_0/mod.rs":"a1b0eb9e2e57cad0190eb8f31dafff0999e31c3602db2b8d84e9dd45c955b623","src/backends/v1_2_0/web.rs":"ac89f16bf623f7d85590d34b45c99b0e522d9d434b4c22af7fa8a8a653e09d2e","src/backends/v1_3_0/mod.rs":"9aa230fe942ca775f812300f0041f5565861ef32ad73207e48d02b41e423ee25","src/backends/v1_3_0/web.rs":"1ec4cbe6bdc26f165d9e54e9bf2aac4c3706357ce4677dc21113710d4a26c3c1","src/firmware.rs":"168eeffaef90cb1525bb2e126e73905b5205d49215437263813e30323f6b7a05","src/lib.rs":"16ea1c0007fa6d6c86c1f83d3ac9cdf065cd9936cd52f35ef89c227397bbc54a","src/timezone.rs":"309bf23de1bdc9126bde5db8dabff0d2c0fea797dbf2630a772a18539838a05e"},"package":"1cb662e56f104c0fe45c8ccdac13f60cbcaad45ac228f939c6ac46ff40335052"}
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"de321c89f62a60690ba07d6bb145ac688c6141c458638e68b3ed36b50b8de1f1","Cargo.lock":"5942ec7c9cf5c201bd32442d65020dc3ae72e33cb5aaf374b2a26501571a1487","Cargo.toml":"cb9ee00cbb415fa66a71a7d4822839bb3552336ec9ab975ae7b1137c711449cb","Cargo.toml.orig":"08409c395e4d502015da62e97efdc9c5bc6e3076031144f3f5aa35c900c7c735","src/backends/mod.rs":"26591e67688f8d015242295dde5050c4b34986e9980018a855346291a0472206","src/backends/v1_2_0/mod.rs":"f0818aae9410bcf4cf6f2efbb867ce9ea8a7542cc9cf9942be1b99570e2912c4","src/backends/v1_2_0/web.rs":"ac89f16bf623f7d85590d34b45c99b0e522d9d434b4c22af7fa8a8a653e09d2e","src/backends/v1_3_0/mod.rs":"3e1e10869930c72135ec98e69293c0aeb07d4c31c06e8f8301aa1dbfc87552bb","src/backends/v1_3_0/web.rs":"1ec4cbe6bdc26f165d9e54e9bf2aac4c3706357ce4677dc21113710d4a26c3c1","src/firmware.rs":"168eeffaef90cb1525bb2e126e73905b5205d49215437263813e30323f6b7a05","src/lib.rs":"16ea1c0007fa6d6c86c1f83d3ac9cdf065cd9936cd52f35ef89c227397bbc54a","src/timezone.rs":"309bf23de1bdc9126bde5db8dabff0d2c0fea797dbf2630a772a18539838a05e"},"package":"1cb662e56f104c0fe45c8ccdac13f60cbcaad45ac228f939c6ac46ff40335052"}
+66 -4
View File
@@ -1,5 +1,6 @@
use std::{collections::HashMap, net::IpAddr, str::FromStr, time::Duration};
use asic_rs_makes_antminer::models::infer_antminer_algo;
use anyhow;
use asic_rs_core::{
config::{
@@ -17,7 +18,7 @@ use asic_rs_core::{
DataCollector, DataExtensions, DataExtractor, DataField, DataLocation, get_by_pointer,
},
command::MinerCommand,
device::DeviceInfo,
device::{DeviceInfo, HashAlgorithm},
fan::FanData,
hashrate::{HashRate, HashRateUnit},
message::{MessageSeverity, MinerComponent, MinerMessage},
@@ -52,7 +53,14 @@ pub struct VnishV120 {
impl VnishV120 {
pub fn new(ip: IpAddr, model: impl MinerModel) -> Self {
let auth = Self::default_auth();
let algo = model.hash_algorithm();
// A model outside asic-rs' alias table (VNish's "Antminer S19 (88)")
// resolves to HashAlgorithm::Unknown, which left its hashrate bucketed
// as "Unknown Hashrate". Infer it from the Antminer family letter, as
// the stock backend does.
let algo = match model.hash_algorithm() {
HashAlgorithm::Unknown => infer_antminer_algo(&model.to_string()),
known => known,
};
VnishV120 {
ip,
web: VnishWebAPI::new(ip, 80, auth),
@@ -509,8 +517,24 @@ impl GetHashboards for VnishV120 {
.and_then(|v| v.pointer("/factory"))
.and_then(|v| v.as_array());
let mut hashboards: Vec<BoardData> =
(0..self.device_info.hardware.board_count().unwrap_or(0) as usize)
// The model's hardware table gives the board count. For a model asic-rs
// does not know (e.g. VNish "Antminer S19 (88)") there is no table, and
// sizing from it dropped every live chain -- the boards then vanished
// from the data although the miner reports them. Fall back to what the
// miner reports: the highest 1-based chain id, so a dead middle board
// still keeps its slot.
let reported_boards = all_chains
.iter()
.filter_map(|c| c.pointer("/id").and_then(|v| v.as_u64()))
.max()
.unwrap_or(0) as usize;
let board_count = self
.device_info
.hardware
.board_count()
.map(|n| n as usize)
.unwrap_or(reported_boards);
let mut hashboards: Vec<BoardData> = (0..board_count)
.map(|idx| {
BoardData::new(idx as u8, self.device_info.hardware.chips_for_board(idx))
})
@@ -1524,4 +1548,42 @@ mod tests {
assert!(config.available.contains(&Tz::Etc__GMT));
assert_eq!(config.available.last(), Some(&Tz::Etc__GMTMinus14));
}
/// Same as the 1.3.x backend: a model with no hardware table (VNish's
/// "Antminer S19 (88)") must keep the chains the miner reports instead of
/// sizing the board list to zero. Live 1.2.7 units (e.g. 10.4.1.111) run it.
#[tokio::test]
async fn unknown_model_keeps_the_reported_chains() {
let miner = VnishV120::new(
IpAddr::from([127, 0, 0, 1]),
AntMinerModel::Unknown("ANTMINER S19 (88)".to_string()),
);
let mut results = HashMap::new();
results.insert(
MinerCommand::WebAPI {
command: "info",
parameters: None,
},
json!({ "miner": "Antminer S19 (88)", "hr_measure": "GH/s", "fw_version": "1.2.7" }),
);
results.insert(
MinerCommand::WebAPI {
command: "summary",
parameters: None,
},
json!({ "miner": { "hr_realtime": 82600.0, "chains": [
{ "id": 1, "hashrate_rt": 27537.83 },
{ "id": 2, "hashrate_rt": 27511.20 },
{ "id": 3, "hashrate_rt": 27601.04 }
] } }),
);
let mock_api = MockAPIClient::new(results);
let mut collector = DataCollector::new_with_client(&miner, &mock_api);
let miner_data = miner.parse_data(collector.collect_all().await);
assert_eq!(miner_data.hashboards.len(), 3, "one board per reported chain");
// ...and its hashrate is SHA-256 (family letter S), not "Unknown".
assert_eq!(miner_data.hashrate.expect("hashrate").algo, HashAlgorithm::SHA256);
assert!(miner_data.hashboards.iter().all(|b| b.hashrate.is_some()));
}
}
+70 -4
View File
@@ -1,5 +1,6 @@
use std::{collections::HashMap, net::IpAddr, str::FromStr, time::Duration};
use asic_rs_makes_antminer::models::infer_antminer_algo;
use anyhow;
use asic_rs_core::{
config::{
@@ -17,7 +18,7 @@ use asic_rs_core::{
DataCollector, DataExtensions, DataExtractor, DataField, DataLocation, get_by_pointer,
},
command::MinerCommand,
device::DeviceInfo,
device::{DeviceInfo, HashAlgorithm},
fan::FanData,
hashrate::{HashRate, HashRateUnit},
message::{MessageSeverity, MinerComponent, MinerMessage},
@@ -52,7 +53,14 @@ pub struct VnishV130 {
impl VnishV130 {
pub fn new(ip: IpAddr, model: impl MinerModel) -> Self {
let auth = Self::default_auth();
let algo = model.hash_algorithm();
// A model outside asic-rs' alias table (VNish's "Antminer S19 (88)")
// resolves to HashAlgorithm::Unknown, which left its hashrate bucketed
// as "Unknown Hashrate". Infer it from the Antminer family letter, as
// the stock backend does.
let algo = match model.hash_algorithm() {
HashAlgorithm::Unknown => infer_antminer_algo(&model.to_string()),
known => known,
};
VnishV130 {
ip,
web: VnishWebAPI::new(ip, 80, auth),
@@ -516,8 +524,24 @@ impl GetHashboards for VnishV130 {
.and_then(|v| v.pointer("/factory"))
.and_then(|v| v.as_array());
let mut hashboards: Vec<BoardData> =
(0..self.device_info.hardware.board_count().unwrap_or(0) as usize)
// The model's hardware table gives the board count. For a model asic-rs
// does not know (e.g. VNish "Antminer S19 (88)") there is no table, and
// sizing from it dropped every live chain -- the boards then vanished
// from the data although the miner reports them. Fall back to what the
// miner reports: the highest 1-based chain id, so a dead middle board
// still keeps its slot.
let reported_boards = all_chains
.iter()
.filter_map(|c| c.pointer("/id").and_then(|v| v.as_u64()))
.max()
.unwrap_or(0) as usize;
let board_count = self
.device_info
.hardware
.board_count()
.map(|n| n as usize)
.unwrap_or(reported_boards);
let mut hashboards: Vec<BoardData> = (0..board_count)
.map(|idx| {
BoardData::new(idx as u8, self.device_info.hardware.chips_for_board(idx))
})
@@ -1661,4 +1685,46 @@ mod tests {
assert!(config.available.contains(&Tz::Etc__GMT));
assert_eq!(config.available.last(), Some(&Tz::Etc__GMTMinus14));
}
/// A model asic-rs has no hardware table for -- VNish reports the 88-chip
/// S19 as "Antminer S19 (88)" -- must still surface the boards the miner
/// reports. Sizing the board list from the (absent) table dropped all
/// three live chains, so the GUI drew no hashboard icons for a hashing
/// miner. Chain values match the live 10.4.0.179 unit.
#[tokio::test]
async fn unknown_model_keeps_the_reported_chains() {
let miner = VnishV130::new(
IpAddr::from([127, 0, 0, 1]),
AntMinerModel::Unknown("ANTMINER S19 (88)".to_string()),
);
let mut results = HashMap::new();
results.insert(
web("info"),
json!({ "miner": "Antminer S19 (88)", "model": "s19-88", "hr_measure": "GH/s" }),
);
results.insert(
web("summary"),
json!({
"miner": {
"hr_realtime": 82600.0,
"chains": [
{ "id": 1, "hashrate_rt": 27537.83, "chip_statuses": { "grey": 88 } },
{ "id": 2, "hashrate_rt": 27511.20, "chip_statuses": { "grey": 88 } },
{ "id": 3, "hashrate_rt": 27601.04, "chip_statuses": { "grey": 88 } }
]
}
}),
);
let mock_api = MockAPIClient::new(results);
let mut collector = DataCollector::new_with_client(&miner, &mock_api);
let miner_data = miner.parse_data(collector.collect_all().await);
assert_eq!(miner_data.hashboards.len(), 3, "one board per reported chain");
// ...and its hashrate is SHA-256 (family letter S), not "Unknown".
assert_eq!(miner_data.hashrate.expect("hashrate").algo, HashAlgorithm::SHA256);
for (i, board) in miner_data.hashboards.iter().enumerate() {
assert_eq!(board.position as usize, i);
assert!(board.hashrate.is_some(), "board {i} keeps its live hashrate");
}
}
}
+1 -1
View File
@@ -1 +1 @@
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"aaaa0f14e3aff2543d3d09a4515efa5ab439f0651a36b582e87b9843d0475752","Cargo.lock":"58da2f3399ff680bf7d619204897b4edf5c03d336a8c3cceb54c9aba280bfed1","Cargo.toml":"57f92bf3808fa6f468dbabf43763a808d9ead128eef83b748f940ef3b219a80e","Cargo.toml.orig":"cbfb99fc843dd61ad2025dcfc16bd435afd2b6d43c2c983867af08af415916f1","src/hardware.rs":"6a52c19b38be83fe47ccf8f6c6fe3b7d9597575b79366fbc678ea3586953dd52","src/lib.rs":"b2f55767a7f3fdacb1e898c5cb961c2dec8481823f94386ee67628960e91bf7d","src/make.rs":"e968e4dbd745d485fc9ad4c5a4c081d679eddce11f66e572f81f2dbe37ede3f0","src/models.rs":"b4ea44fc627ff6c8b41bf8758d6ce6074aa690fe9f6c95a9cb3d1cdbd00e51d6"},"package":"67cca6e6bf4ac14562084ce7534521ffa7cd313fa39e2392f98ff98a047a4353"}
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"aaaa0f14e3aff2543d3d09a4515efa5ab439f0651a36b582e87b9843d0475752","Cargo.lock":"58da2f3399ff680bf7d619204897b4edf5c03d336a8c3cceb54c9aba280bfed1","Cargo.toml":"57f92bf3808fa6f468dbabf43763a808d9ead128eef83b748f940ef3b219a80e","Cargo.toml.orig":"cbfb99fc843dd61ad2025dcfc16bd435afd2b6d43c2c983867af08af415916f1","src/hardware.rs":"6a52c19b38be83fe47ccf8f6c6fe3b7d9597575b79366fbc678ea3586953dd52","src/lib.rs":"b2f55767a7f3fdacb1e898c5cb961c2dec8481823f94386ee67628960e91bf7d","src/make.rs":"e968e4dbd745d485fc9ad4c5a4c081d679eddce11f66e572f81f2dbe37ede3f0","src/models.rs":"11bb8edd2417dbbd8754b56d35488db5e3d4655e16e71eee85291fabea876e99"},"package":"67cca6e6bf4ac14562084ce7534521ffa7cd313fa39e2392f98ff98a047a4353"}
+23
View File
@@ -201,6 +201,29 @@ pub enum AntMinerModel {
Unknown(String),
}
/// Infer an Antminer's hash algorithm from its model-family letter, for models
/// asic-rs' alias table doesn't recognise (round 13 #5). Only the families whose
/// entire product line shares one algorithm are inferred; anything ambiguous
/// (the K-series spans Kadena/KHeavyHash/Eaglesong, DR is Blake256 while D is
/// X11) is left Unknown rather than guessed wrong. Shared by every firmware
/// backend that runs on Antminer hardware (stock, VNish).
pub fn infer_antminer_algo(model: &str) -> HashAlgorithm {
let upper = model.to_ascii_uppercase();
let name = upper
.strip_prefix("ANTMINER ")
.unwrap_or(&upper)
.trim_start();
match name.chars().next() {
// Z9 / Z11 / Z15 / Z15 Pro / Z15J -- the whole Z line is Equihash.
Some('Z') => HashAlgorithm::Equihash,
// L3+ / L7 / L9 / L11 -- the whole L line is Scrypt.
Some('L') => HashAlgorithm::Scrypt,
// S9..S21 and T9..T21 (and future revisions) are all SHA-256.
Some('S') | Some('T') => HashAlgorithm::SHA256,
_ => HashAlgorithm::Unknown,
}
}
impl FromStr for AntMinerModel {
type Err = ModelSelectionError;