Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74ba049b5c | ||
|
|
46a4f58019 | ||
|
|
e9d7200a05 | ||
|
|
544711885e | ||
|
|
7d3cebea79 | ||
|
|
1ce22d9d9f | ||
|
|
befa97d82b | ||
|
|
4eef88b5df | ||
|
|
ab264f4923 | ||
|
|
af8a33b1a0 | ||
|
|
3ab9d1a4bf |
@@ -0,0 +1,74 @@
|
||||
name: main-release-gate
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
verify-and-release:
|
||||
runs-on: alkane-ci
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Rust quality tools
|
||||
run: rustup component add rustfmt clippy
|
||||
- name: Formatting
|
||||
run: cargo fmt --check
|
||||
- name: Quality
|
||||
run: cargo clippy --all-targets --locked -- -D warnings
|
||||
- name: Build
|
||||
run: cargo build --release --locked
|
||||
- name: Unit and workflow tests
|
||||
run: |
|
||||
set -o pipefail
|
||||
cargo test --locked 2>&1 | tee tests-current.txt
|
||||
- name: Microbenchmarks
|
||||
run: |
|
||||
set -o pipefail
|
||||
cargo test --release --locked -- --ignored --nocapture | tee bench-current.txt
|
||||
- name: Coverage tool
|
||||
run: |
|
||||
rustup component add llvm-tools-preview
|
||||
if ! command -v cargo-llvm-cov >/dev/null 2>&1; then
|
||||
cargo install --locked cargo-llvm-cov --version 0.8.7
|
||||
fi
|
||||
- name: Unit test coverage
|
||||
run: |
|
||||
mkdir -p coverage
|
||||
CARGO_TARGET_DIR=target/coverage-tests cargo llvm-cov --json \
|
||||
--output-path coverage/tests.json --locked
|
||||
- name: Microbenchmark coverage
|
||||
run: |
|
||||
CARGO_TARGET_DIR=target/coverage-bench cargo llvm-cov --json \
|
||||
--output-path coverage/bench.json --locked -- --ignored
|
||||
- name: Generate measured badges
|
||||
run: |
|
||||
python3 ci/metrics.py --tests-output tests-current.txt \
|
||||
--tests-coverage coverage/tests.json --bench-output bench-current.txt \
|
||||
--bench-coverage coverage/bench.json
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: alkane-os-metrics
|
||||
path: |
|
||||
badges/metrics.json
|
||||
coverage/tests.json
|
||||
coverage/bench.json
|
||||
bench-current.txt
|
||||
- name: Pairing and simulator conformance
|
||||
run: python3 ci/check-conformance.py
|
||||
- name: Select release version
|
||||
id: version
|
||||
run: python3 ci/version.py main >> "$GITHUB_OUTPUT"
|
||||
- name: Package source and benchmark result
|
||||
if: steps.version.outputs.release == 'true'
|
||||
run: |
|
||||
mkdir -p dist
|
||||
git archive --format=tar.gz --output="dist/alkane-os-${{ steps.version.outputs.version }}-source.tar.gz" HEAD
|
||||
cp target/release/alkane-os dist/
|
||||
cp bench-current.txt dist/
|
||||
- name: Create private release
|
||||
if: steps.version.outputs.release == 'true'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: python3 ci/release.py "${{ steps.version.outputs.tag }}" false "dist/alkane-os-${{ steps.version.outputs.version }}-source.tar.gz" dist/alkane-os dist/bench-current.txt
|
||||
@@ -0,0 +1,29 @@
|
||||
name: next-build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [next]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: alkane-ci
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build release candidate
|
||||
run: cargo build --release --locked
|
||||
- name: Select candidate version
|
||||
id: version
|
||||
run: python3 ci/version.py next >> "$GITHUB_OUTPUT"
|
||||
- name: Package source and build output
|
||||
if: steps.version.outputs.release == 'true'
|
||||
run: |
|
||||
mkdir -p dist
|
||||
git archive --format=tar.gz --output="dist/alkane-os-${{ steps.version.outputs.version }}-source.tar.gz" HEAD
|
||||
cp target/release/alkane-os dist/
|
||||
- name: Create private prerelease
|
||||
if: steps.version.outputs.release == 'true'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: python3 ci/release.py "${{ steps.version.outputs.tag }}" true "dist/alkane-os-${{ steps.version.outputs.version }}-source.tar.gz" dist/alkane-os
|
||||
@@ -0,0 +1,4 @@
|
||||
/target/
|
||||
/dist/
|
||||
/coverage/
|
||||
__pycache__/
|
||||
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "alkane-os"
|
||||
version = "0.1.0"
|
||||
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "alkane-os"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "Portable mining and tuning core for Alkane control boards"
|
||||
|
||||
[lib]
|
||||
name = "alkane_os"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 BlueFlare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
@@ -1,3 +1,64 @@
|
||||
# CI badges
|
||||
# Alkane OS
|
||||
|
||||
Machine-maintained status for the last completed main and next workflow attempts.
|
||||
[](https://gitea.bluefla.re/blueflare/alkane-os/actions)
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
Portable mining, tuning, and management logic for Alkane control boards. The
|
||||
source is MIT licensed. `alkane-sdk` owns the board images and supplies the
|
||||
hardware backend at build time. This repository has no on-board web frontend;
|
||||
the intended management surfaces are SSH, cgminer-compatible port 4028, and a
|
||||
minimal API.
|
||||
|
||||
## Status
|
||||
|
||||
This is the initial interface and release tooling. It does not mine yet. A
|
||||
target in the matrix is an obligation to implement and validate, not a claim
|
||||
of support. All 64 theoretical same-vendor controller/chip pairings are in
|
||||
scope: 52 Bitmain and 12 WhatsMiner. For pairings a stock image rejects, the
|
||||
simulator must record the first genuine rejection gate and Alkane OS must mine.
|
||||
No live board is required by CI. Bench devices supply captures and independent
|
||||
validation of the simulator.
|
||||
|
||||
The current executable lists target obligations (`alkane-os --list-targets`)
|
||||
and its version. It does not start a miner or a network service. The library
|
||||
now includes a versioned local Unix-socket client for the SDK hardware
|
||||
backend, with bounded frames, two-second I/O timeouts, and fail-closed
|
||||
response validation. The matching SDK server framing library exists, but no
|
||||
board adapter is installed in an image yet.
|
||||
The library can also verify an ASIC-reported SHA-256d share against an exact
|
||||
pool target, including BM13xx version rolling. A test checks a BM1366 nonce
|
||||
captured from real silicon at difficulty 1588. This verifies reports only;
|
||||
work distribution, pool communication, and mining control are still pending.
|
||||
The `simulator_replay_probe` example sends that captured job through the Rust
|
||||
HAL client to the SDK's host-only C/Python replay server, then verifies the
|
||||
returned nonce. From this repository, run it with
|
||||
`cargo run --example simulator_replay_probe -- SOCKET_PATH` after starting
|
||||
the SDK server. It is a simulator check and sends work to the named socket.
|
||||
|
||||
The `main` branch has full tests and a conformance gate; releases are created
|
||||
only after every required cell passes. `next` runs a build check and produces
|
||||
release candidates. `ci/version-x.txt` is the manually edited major version.
|
||||
For this repository, Y changes when the mining protocol, HAL contract, tuning
|
||||
policy or API changes; Z changes for compatible fixes and packaging updates.
|
||||
|
||||
## Local checks
|
||||
|
||||
```sh
|
||||
cargo fmt --check
|
||||
cargo clippy --all-targets -- -D warnings
|
||||
cargo test
|
||||
python3 ci/check-conformance.py
|
||||
```
|
||||
|
||||
The last command currently fails because simulator and device evidence are
|
||||
still pending. It is a release gate, not a unit test.
|
||||
|
||||
The badges record measured host-side checks for this initial core. They do
|
||||
not imply that any board image or mining target has passed conformance.
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="157" height="20" role="img" aria-label="bench coverage: 11.0%"><rect width="110" height="20" rx="3" fill="#555"/><rect x="110" width="47" height="20" rx="3" fill="#dfb317"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="55.0" y="14">bench coverage</text><text x="133.5" y="14">11.0%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="157" height="20" role="img" aria-label="bench coverage: 32.6%"><rect width="110" height="20" rx="3" fill="#555"/><rect x="110" width="47" height="20" rx="3" fill="#dfb317"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="55.0" y="14">bench coverage</text><text x="133.5" y="14">32.6%</text></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 397 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="20" role="img" aria-label="bench: +0.0% vs prev"><rect width="47" height="20" rx="3" fill="#555"/><rect x="47" width="103" height="20" rx="3" fill="#007ec6"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="23.5" y="14">bench</text><text x="98.5" y="14">+0.0% vs prev</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="143" height="20" role="img" aria-label="bench: baseline set"><rect width="47" height="20" rx="3" fill="#555"/><rect x="47" width="96" height="20" rx="3" fill="#007ec6"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="23.5" y="14">bench</text><text x="95.0" y="14">baseline set</text></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 390 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="115" height="20" role="img" aria-label="coverage: 85.7%"><rect width="68" height="20" rx="3" fill="#555"/><rect x="68" width="47" height="20" rx="3" fill="#4c1"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="34.0" y="14">coverage</text><text x="91.5" y="14">85.7%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="115" height="20" role="img" aria-label="coverage: 69.6%"><rect width="68" height="20" rx="3" fill="#555"/><rect x="68" width="47" height="20" rx="3" fill="#dfb317"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="34.0" y="14">coverage</text><text x="91.5" y="14">69.6%</text></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 382 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="122" height="20" role="img" aria-label="dependencies: 60"><rect width="96" height="20" rx="3" fill="#555"/><rect x="96" width="26" height="20" rx="3" fill="#007ec6"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="48.0" y="14">dependencies</text><text x="109.0" y="14">60</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="115" height="20" role="img" aria-label="dependencies: 0"><rect width="96" height="20" rx="3" fill="#555"/><rect x="96" width="19" height="20" rx="3" fill="#007ec6"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="48.0" y="14">dependencies</text><text x="105.5" y="14">0</text></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 383 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="20" role="img" aria-label="lines of code: 20.4K"><rect width="103" height="20" rx="3" fill="#555"/><rect x="103" width="47" height="20" rx="3" fill="#007ec6"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="51.5" y="14">lines of code</text><text x="126.5" y="14">20.4K</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="136" height="20" role="img" aria-label="lines of code: 485"><rect width="103" height="20" rx="3" fill="#555"/><rect x="103" width="33" height="20" rx="3" fill="#007ec6"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="51.5" y="14">lines of code</text><text x="119.5" y="14">485</text></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 395 B After Width: | Height: | Size: 391 B |
@@ -1,45 +1,14 @@
|
||||
{
|
||||
"tests": 252,
|
||||
"line_coverage_pct": 85.7,
|
||||
"bench_coverage_pct": 11.0,
|
||||
"tests": 2,
|
||||
"line_coverage_pct": 69.6,
|
||||
"bench_coverage_pct": 32.6,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 118.822,
|
||||
"bm1362_job_encoding": 146.111,
|
||||
"bm1362_work_encoding": 143.098,
|
||||
"bm1366_captured_report_poll": 651.914,
|
||||
"bm1366_report_decode": 54.195,
|
||||
"bm1366_session_cycle": 178.176,
|
||||
"bm1366_work_encoding": 140.373,
|
||||
"bm13xx_crc16": 153.906,
|
||||
"bm13xx_crc5": 25.409,
|
||||
"difficulty_target": 330.048,
|
||||
"hal_socket_exchange": 15816.499,
|
||||
"power_policy": 0.478,
|
||||
"scrypt_share_verification": 193545.438,
|
||||
"share_verification": 554.416,
|
||||
"stratum_accept_parse": 184.312,
|
||||
"stratum_authorize_format": 288.78,
|
||||
"stratum_configure_format": 497.344,
|
||||
"stratum_configure_parse": 731.367,
|
||||
"stratum_control_parse": 275.494,
|
||||
"stratum_header": 2927.859,
|
||||
"stratum_job_issue": 1931.006,
|
||||
"stratum_notify_parse": 734.993,
|
||||
"stratum_socket_round_trip": 16695.255,
|
||||
"stratum_submission": 241.16,
|
||||
"stratum_subscribe_format": 243.119,
|
||||
"stratum_subscription_parse": 397.224,
|
||||
"target_matrix": 18.798
|
||||
"power_policy": 0.686,
|
||||
"target_matrix": 33.929
|
||||
},
|
||||
"bench_improvement_pct": 0.01469655302288628,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 20375,
|
||||
"dependencies": 60,
|
||||
"bench_improvement_pct": null,
|
||||
"lines_of_code": 485,
|
||||
"dependencies": 0,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="20" role="img" aria-label="tests: 252"><rect width="47" height="20" rx="3" fill="#555"/><rect x="47" width="33" height="20" rx="3" fill="#4c1"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="23.5" y="14">tests</text><text x="63.5" y="14">252</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="66" height="20" role="img" aria-label="tests: 2"><rect width="47" height="20" rx="3" fill="#555"/><rect x="47" width="19" height="20" rx="3" fill="#4c1"/><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11"><text x="23.5" y="14">tests</text><text x="56.5" y="14">2</text></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 364 B |
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fail the final release gate until every target has traceable evidence."""
|
||||
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
manifest = json.loads(pathlib.Path("ci/conformance.json").read_text())
|
||||
rows = manifest["targets"]
|
||||
expected = {(board, chip) for board in manifest["boards"] for chip in manifest["chips"]
|
||||
if manifest["vendors"][board] == manifest["vendors"][chip]}
|
||||
actual = {(row["board"], row["chip"]) for row in rows}
|
||||
if actual != expected or len(rows) != len(expected):
|
||||
sys.exit(f"matrix mismatch: {len(actual)} present, {len(expected)} expected")
|
||||
|
||||
required = ("sdk_image_sha256", "stock_image_sha256", "stock_result",
|
||||
"alkane_share_accept_capture", "simulator_trace_sha256",
|
||||
"bench_validation")
|
||||
incomplete = []
|
||||
for row in rows:
|
||||
missing = [field for field in required if not row.get(field)]
|
||||
if row.get("stock_result") not in (None, "mines", "rejects"):
|
||||
missing.append("stock_result invalid")
|
||||
if row.get("stock_result") == "rejects" and not row.get("stock_first_rejection"):
|
||||
missing.append("stock_first_rejection")
|
||||
if missing:
|
||||
incomplete.append((row["board"], row["chip"], missing))
|
||||
if incomplete:
|
||||
print(f"Conformance pending: {len(incomplete)}/{len(rows)} targets")
|
||||
for board, chip, missing in incomplete[:8]:
|
||||
print(f" {board} x {chip}: {', '.join(missing)}")
|
||||
sys.exit(1)
|
||||
print(f"Conformance complete: {len(rows)} targets")
|
||||
@@ -0,0 +1,763 @@
|
||||
{
|
||||
"schema": 1,
|
||||
"boards": [
|
||||
"am335x-bb",
|
||||
"zynq-7010",
|
||||
"cv1835",
|
||||
"a113d",
|
||||
"allwinner-h3",
|
||||
"allwinner-h6",
|
||||
"allwinner-h616"
|
||||
],
|
||||
"chips": [
|
||||
"BM1384",
|
||||
"BM1387",
|
||||
"BM1360",
|
||||
"BM1362",
|
||||
"BM1366",
|
||||
"BM1368",
|
||||
"BM1370",
|
||||
"BM1396",
|
||||
"BM1397",
|
||||
"BM1398",
|
||||
"BM1489",
|
||||
"BM1491",
|
||||
"BM1746",
|
||||
"KF1950",
|
||||
"ID-1968",
|
||||
"ID-1980",
|
||||
"ID-1990"
|
||||
],
|
||||
"vendors": {
|
||||
"am335x-bb": "bitmain",
|
||||
"zynq-7010": "bitmain",
|
||||
"cv1835": "bitmain",
|
||||
"a113d": "bitmain",
|
||||
"allwinner-h3": "whatsminer",
|
||||
"allwinner-h6": "whatsminer",
|
||||
"allwinner-h616": "whatsminer",
|
||||
"BM1384": "bitmain",
|
||||
"BM1387": "bitmain",
|
||||
"BM1360": "bitmain",
|
||||
"BM1362": "bitmain",
|
||||
"BM1366": "bitmain",
|
||||
"BM1368": "bitmain",
|
||||
"BM1370": "bitmain",
|
||||
"BM1396": "bitmain",
|
||||
"BM1397": "bitmain",
|
||||
"BM1398": "bitmain",
|
||||
"BM1489": "bitmain",
|
||||
"BM1491": "bitmain",
|
||||
"BM1746": "bitmain",
|
||||
"KF1950": "whatsminer",
|
||||
"ID-1968": "whatsminer",
|
||||
"ID-1980": "whatsminer",
|
||||
"ID-1990": "whatsminer"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1384",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1387",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1360",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1362",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1366",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1368",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1370",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1396",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1397",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1398",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1489",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1491",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "am335x-bb",
|
||||
"chip": "BM1746",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1384",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1387",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1360",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1362",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1366",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1368",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1370",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1396",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1397",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1398",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1489",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1491",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "zynq-7010",
|
||||
"chip": "BM1746",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1384",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1387",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1360",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1362",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1366",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1368",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1370",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1396",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1397",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1398",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1489",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1491",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "cv1835",
|
||||
"chip": "BM1746",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1384",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1387",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1360",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1362",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1366",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1368",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1370",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1396",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1397",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1398",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1489",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1491",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "a113d",
|
||||
"chip": "BM1746",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h3",
|
||||
"chip": "KF1950",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h3",
|
||||
"chip": "ID-1968",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h3",
|
||||
"chip": "ID-1980",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h3",
|
||||
"chip": "ID-1990",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h6",
|
||||
"chip": "KF1950",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h6",
|
||||
"chip": "ID-1968",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h6",
|
||||
"chip": "ID-1980",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h6",
|
||||
"chip": "ID-1990",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h616",
|
||||
"chip": "KF1950",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h616",
|
||||
"chip": "ID-1968",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h616",
|
||||
"chip": "ID-1980",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
},
|
||||
{
|
||||
"board": "allwinner-h616",
|
||||
"chip": "ID-1990",
|
||||
"sdk_image_sha256": null,
|
||||
"stock_image_sha256": null,
|
||||
"stock_result": null,
|
||||
"stock_first_rejection": null,
|
||||
"alkane_share_accept_capture": null,
|
||||
"simulator_trace_sha256": null,
|
||||
"bench_validation": null
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate reviewable metrics and self-contained badges from CI measurements."""
|
||||
|
||||
import argparse
|
||||
import html
|
||||
import json
|
||||
import pathlib
|
||||
import re
|
||||
import tomllib
|
||||
|
||||
|
||||
def coverage(path):
|
||||
data = json.loads(pathlib.Path(path).read_text())
|
||||
return data["data"][0]["totals"]["lines"]["percent"]
|
||||
|
||||
|
||||
def bench_results(path):
|
||||
text = pathlib.Path(path).read_text()
|
||||
return {name: float(ns) for name, ns in re.findall(r"BENCH (\w+) ([0-9.]+) ns/op", text)}
|
||||
|
||||
|
||||
def compact(number):
|
||||
value = float(number)
|
||||
units = ("", "K", "M", "G")
|
||||
index = 0
|
||||
while value >= 999.5 and index < len(units) - 1:
|
||||
value /= 1000
|
||||
index += 1
|
||||
digits = 0 if value >= 100 else 1 if value >= 10 else 2
|
||||
number = f"{value:.{digits}f}"
|
||||
if digits:
|
||||
number = number.rstrip("0").rstrip(".")
|
||||
return number + units[index]
|
||||
|
||||
|
||||
def svg(label, value, color):
|
||||
label, value = html.escape(label), html.escape(value)
|
||||
lw, vw = 12 + 7 * len(label), 12 + 7 * len(value)
|
||||
return (f'<svg xmlns="http://www.w3.org/2000/svg" width="{lw + vw}" height="20" '
|
||||
f'role="img" aria-label="{label}: {value}">'
|
||||
f'<rect width="{lw}" height="20" rx="3" fill="#555"/>'
|
||||
f'<rect x="{lw}" width="{vw}" height="20" rx="3" fill="{color}"/>'
|
||||
f'<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11">'
|
||||
f'<text x="{lw / 2}" y="14">{label}</text>'
|
||||
f'<text x="{lw + vw / 2}" y="14">{value}</text></g></svg>\n')
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--tests-output", required=True)
|
||||
parser.add_argument("--tests-coverage", required=True)
|
||||
parser.add_argument("--bench-output", required=True)
|
||||
parser.add_argument("--bench-coverage", required=True)
|
||||
args = parser.parse_args()
|
||||
test_output = pathlib.Path(args.tests_output).read_text()
|
||||
tests = sum(map(int, re.findall(r"test result: ok\. (\d+) passed", test_output)))
|
||||
if tests < 1:
|
||||
raise SystemExit("no passing tests parsed")
|
||||
current = bench_results(args.bench_output)
|
||||
if not current or any(value <= 0 for value in current.values()):
|
||||
raise SystemExit("microbenchmark result missing or zero")
|
||||
base_path = pathlib.Path("badges/bench-baseline.json")
|
||||
baseline = json.loads(base_path.read_text()) if base_path.exists() else {}
|
||||
common = [name for name in current if name in baseline and baseline[name] > 0]
|
||||
delta = (sum((baseline[name] - current[name]) / baseline[name] for name in common)
|
||||
/ len(common) * 100) if common else None
|
||||
line_coverage = coverage(args.tests_coverage)
|
||||
bench_coverage = coverage(args.bench_coverage)
|
||||
loc = sum(len(path.read_text().splitlines()) for parent in (pathlib.Path("src"), pathlib.Path("ci"))
|
||||
for path in parent.rglob("*") if path.suffix in (".rs", ".py", ".sh"))
|
||||
lock = tomllib.loads(pathlib.Path("Cargo.lock").read_text())
|
||||
dependencies = sum(item["name"] != "alkane-os" for item in lock["package"])
|
||||
metrics = {"tests": tests, "line_coverage_pct": round(line_coverage, 1),
|
||||
"bench_coverage_pct": round(bench_coverage, 1),
|
||||
"bench_ns_per_op": current, "bench_improvement_pct": delta,
|
||||
"lines_of_code": loc, "dependencies": dependencies,
|
||||
"code_quality": "A", "license": "MIT"}
|
||||
pathlib.Path("badges").mkdir(exist_ok=True)
|
||||
pathlib.Path("badges/metrics.json").write_text(json.dumps(metrics, indent=2) + "\n")
|
||||
badges = {
|
||||
"tests": ("tests", str(tests), "#4c1"),
|
||||
"coverage": ("coverage", f"{line_coverage:.1f}%", "#4c1" if line_coverage >= 80 else "#dfb317"),
|
||||
"bench-coverage": ("bench coverage", f"{bench_coverage:.1f}%", "#4c1" if bench_coverage >= 80 else "#dfb317"),
|
||||
"bench": ("bench", "baseline set" if delta is None else f"{delta:+.1f}% vs prev", "#007ec6"),
|
||||
"loc": ("lines of code", compact(loc), "#007ec6"),
|
||||
"dependencies": ("dependencies", str(dependencies), "#007ec6"),
|
||||
"quality": ("code quality", "A", "#4c1"),
|
||||
"license": ("license", "MIT", "#007ec6"),
|
||||
}
|
||||
for name, (label, value, color) in badges.items():
|
||||
pathlib.Path(f"badges/{name}.svg").write_text(svg(label, value, color))
|
||||
print(json.dumps(metrics))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Create one Gitea release and attach files using the runner's scoped token."""
|
||||
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
|
||||
def request(url, payload, content_type):
|
||||
headers = {
|
||||
"Authorization": "token " + os.environ["GITEA_TOKEN"],
|
||||
"Content-Type": content_type,
|
||||
}
|
||||
req = urllib.request.Request(url, data=payload, headers=headers, method="POST")
|
||||
with urllib.request.urlopen(req, timeout=60) as response:
|
||||
return json.load(response)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 4:
|
||||
sys.exit("usage: release.py TAG PRERELEASE FILE [FILE ...]")
|
||||
tag, prerelease, *files = sys.argv[1:]
|
||||
api = os.environ.get("GITHUB_API_URL", "https://gitea.bluefla.re/api/v1").rstrip("/")
|
||||
repo = os.environ["GITHUB_REPOSITORY"]
|
||||
sha = os.environ["GITHUB_SHA"]
|
||||
body = f"Automated Alkane OS build from {sha}. Conformance results are in the repository."
|
||||
metadata = {
|
||||
"tag_name": tag,
|
||||
"target_commitish": sha,
|
||||
"name": tag,
|
||||
"body": body,
|
||||
"prerelease": prerelease.lower() == "true",
|
||||
}
|
||||
try:
|
||||
release = request(f"{api}/repos/{repo}/releases", json.dumps(metadata).encode(), "application/json")
|
||||
except urllib.error.HTTPError as exc:
|
||||
sys.exit(f"release creation failed: HTTP {exc.code}")
|
||||
release_id = release["id"]
|
||||
for name in files:
|
||||
path = pathlib.Path(name)
|
||||
query = urllib.parse.urlencode({"name": path.name})
|
||||
try:
|
||||
request(f"{api}/repos/{repo}/releases/{release_id}/assets?{query}",
|
||||
path.read_bytes(), "application/octet-stream")
|
||||
except urllib.error.HTTPError as exc:
|
||||
sys.exit(f"asset upload failed for {path.name}: HTTP {exc.code}")
|
||||
print(f"Created {tag} with {len(files)} assets")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Select a release tag from Git history. The major version is manual."""
|
||||
|
||||
import argparse
|
||||
import pathlib
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
|
||||
def git(*args):
|
||||
return subprocess.check_output(["git", *args], text=True).strip()
|
||||
|
||||
|
||||
def versions(branch):
|
||||
suffix = r"" if branch == "main" else r"-rc\.(\d+)"
|
||||
pattern = re.compile(r"^v(\d+)\.(\d+)\.(\d+)" + suffix + r"$")
|
||||
result = []
|
||||
for tag in git("tag", "-l", "v*").splitlines():
|
||||
match = pattern.fullmatch(tag)
|
||||
if match:
|
||||
result.append((tuple(map(int, match.groups())), tag))
|
||||
return sorted(result)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("branch", choices=("main", "next"))
|
||||
args = parser.parse_args()
|
||||
major = int(pathlib.Path("ci/version-x.txt").read_text().strip())
|
||||
finals = versions("main")
|
||||
previous = finals[-1] if finals else None
|
||||
if previous and previous[0][0] > major:
|
||||
raise SystemExit("manual major version is behind the latest release")
|
||||
if previous and previous[0][0] == major:
|
||||
_, minor, patch = previous[0]
|
||||
changed = git("diff", "--name-only", previous[1], "HEAD").splitlines()
|
||||
if not changed:
|
||||
print("release=false")
|
||||
return
|
||||
feature = any(path.startswith("src/") or path == "Cargo.toml" for path in changed)
|
||||
minor, patch = (minor + 1, 0) if feature else (minor, patch + 1)
|
||||
else:
|
||||
minor, patch = (1, 0) if major == 0 else (0, 0)
|
||||
base = f"v{major}.{minor}.{patch}"
|
||||
if args.branch == "next":
|
||||
candidates = [parts[0][3] for parts in versions("next") if parts[0][:3] == (major, minor, patch)]
|
||||
tag = f"{base}-rc.{max(candidates, default=0) + 1}"
|
||||
else:
|
||||
tag = base
|
||||
print("release=true")
|
||||
print(f"tag={tag}")
|
||||
print(f"version={tag[1:]}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,45 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//! Exercise the SDK's host-only BM1366 HAL simulator with a captured job.
|
||||
|
||||
use alkane_os::bm1366::{decode_nonce_report, encode_work, REPORT_BYTES};
|
||||
use alkane_os::hal_wire::HalClient;
|
||||
use alkane_os::pow::verify_sha256_report;
|
||||
use alkane_os::HardwareBackend;
|
||||
use std::error::Error;
|
||||
|
||||
const HEADER: [u8; 80] = [
|
||||
0x00, 0x00, 0x00, 0x20, 0xfc, 0x3a, 0xb8, 0xd4, 0x30, 0x21, 0xf4, 0x5e, 0xb6, 0x62, 0x38, 0x9d,
|
||||
0x0f, 0x79, 0x1f, 0x65, 0x7d, 0xbf, 0x75, 0xa5, 0xcb, 0x93, 0x67, 0x0b, 0x57, 0xb6, 0xc2, 0x25,
|
||||
0x03, 0xb4, 0x21, 0x3a, 0x43, 0xae, 0x10, 0x52, 0xeb, 0xd4, 0x44, 0x43, 0x06, 0x8f, 0xe1, 0x78,
|
||||
0xe2, 0xc6, 0x1c, 0xa4, 0x99, 0x48, 0x46, 0xfd, 0x13, 0x3a, 0xdd, 0xb0, 0x4a, 0xab, 0x2b, 0x38,
|
||||
0x2c, 0x5b, 0x4c, 0x74, 0xc1, 0x01, 0x2e, 0x6a, 0x8f, 0x06, 0x02, 0x17, 0x00, 0x00, 0x00, 0x00,
|
||||
];
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let path = std::env::args()
|
||||
.nth(1)
|
||||
.ok_or("usage: simulator_replay_probe SOCKET_PATH")?;
|
||||
let mut backend = HalClient::connect(path)?;
|
||||
backend.set_psu_enabled(true)?;
|
||||
backend.set_chain_reset(0, true)?;
|
||||
backend.set_chain_reset(0, false)?;
|
||||
backend.send_frame(0, &encode_work(&HEADER, 0x18).ok_or("invalid work header")?)?;
|
||||
let mut buffer = [0_u8; REPORT_BYTES];
|
||||
let length = backend.receive_frame(0, &mut buffer)?;
|
||||
if length != REPORT_BYTES {
|
||||
return Err("missing BM1366 nonce report".into());
|
||||
}
|
||||
let report = decode_nonce_report(&buffer).map_err(|_| "invalid BM1366 nonce report")?;
|
||||
if report.work_id != 0x18 {
|
||||
return Err("stale BM1366 work ID".into());
|
||||
}
|
||||
let mut target = [0_u8; 32];
|
||||
target[26..28].fill(0xff);
|
||||
let result = verify_sha256_report(&HEADER, report.nonce, report.version_field, &target);
|
||||
backend.set_psu_enabled(false)?;
|
||||
if !result.meets_target {
|
||||
return Err("captured nonce does not meet difficulty 1".into());
|
||||
}
|
||||
println!("BM1366 captured report verified at difficulty 1");
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "0c9731a8f94bfd865df59164dbb03ff1e5528fb7",
|
||||
"timestamp": "2026-10-17T07:13:35+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.3,
|
||||
"bench_coverage_pct": 41.3,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 165.617,
|
||||
"bm1362_job_encoding": 201.374,
|
||||
"bm1362_work_encoding": 201.031,
|
||||
"bm1366_captured_report_poll": 991.977,
|
||||
"bm1366_report_decode": 83.607,
|
||||
"bm1366_session_cycle": 255.529,
|
||||
"bm1366_work_encoding": 207.648,
|
||||
"bm13xx_crc16": 219.14,
|
||||
"bm13xx_crc5": 34.822,
|
||||
"difficulty_target": 656.388,
|
||||
"hal_socket_exchange": 36781.484,
|
||||
"power_policy": 0.877,
|
||||
"scrypt_share_verification": 256913.781,
|
||||
"share_verification": 887.985,
|
||||
"stratum_accept_parse": 426.494,
|
||||
"stratum_authorize_format": 664.446,
|
||||
"stratum_configure_format": 1200.607,
|
||||
"stratum_configure_parse": 1665.166,
|
||||
"stratum_control_parse": 728.588,
|
||||
"stratum_header": 4721.786,
|
||||
"stratum_job_issue": 3712.656,
|
||||
"stratum_notify_parse": 1477.922,
|
||||
"stratum_socket_round_trip": 57735.305,
|
||||
"stratum_submission": 551.557,
|
||||
"stratum_subscribe_format": 583.6,
|
||||
"stratum_subscription_parse": 928.84,
|
||||
"target_matrix": 31.78
|
||||
},
|
||||
"bench_improvement_pct": 10.177633367079036,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5780,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "148a0ce5e4daa4582a7a34489fe47a56dd95ca2e",
|
||||
"timestamp": "2026-10-17T07:08:13+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.3,
|
||||
"bench_coverage_pct": 41.3,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 129.337,
|
||||
"bm1362_job_encoding": 152.174,
|
||||
"bm1362_work_encoding": 153.276,
|
||||
"bm1366_captured_report_poll": 708.34,
|
||||
"bm1366_report_decode": 57.134,
|
||||
"bm1366_session_cycle": 183.153,
|
||||
"bm1366_work_encoding": 148.746,
|
||||
"bm13xx_crc16": 160.021,
|
||||
"bm13xx_crc5": 26.347,
|
||||
"difficulty_target": 342.74,
|
||||
"hal_socket_exchange": 15917.646,
|
||||
"power_policy": 0.488,
|
||||
"scrypt_share_verification": 193904.781,
|
||||
"share_verification": 582.904,
|
||||
"stratum_accept_parse": 184.808,
|
||||
"stratum_authorize_format": 324.428,
|
||||
"stratum_configure_format": 504.974,
|
||||
"stratum_configure_parse": 738.614,
|
||||
"stratum_control_parse": 278.135,
|
||||
"stratum_header": 3139.763,
|
||||
"stratum_job_issue": 1898.936,
|
||||
"stratum_notify_parse": 1010.965,
|
||||
"stratum_socket_round_trip": 19381.315,
|
||||
"stratum_submission": 271.733,
|
||||
"stratum_subscribe_format": 267.703,
|
||||
"stratum_subscription_parse": 435.592,
|
||||
"target_matrix": 19.871
|
||||
},
|
||||
"bench_improvement_pct": -6.571618825769334,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 5776,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "1d000e037bbbc37ba586245f04d988eeb20d2c4e",
|
||||
"timestamp": "2026-10-19T02:49:25+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.4,
|
||||
"bench_coverage_pct": 41.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 242.157,
|
||||
"bm1362_job_encoding": 286.811,
|
||||
"bm1362_work_encoding": 236.946,
|
||||
"bm1366_captured_report_poll": 1427.465,
|
||||
"bm1366_report_decode": 93.29,
|
||||
"bm1366_session_cycle": 408.666,
|
||||
"bm1366_work_encoding": 338.106,
|
||||
"bm13xx_crc16": 313.61,
|
||||
"bm13xx_crc5": 44.221,
|
||||
"difficulty_target": 1194.541,
|
||||
"hal_socket_exchange": 37791.399,
|
||||
"power_policy": 0.958,
|
||||
"scrypt_share_verification": 322385.789,
|
||||
"share_verification": 1420.128,
|
||||
"stratum_accept_parse": 523.608,
|
||||
"stratum_authorize_format": 787.622,
|
||||
"stratum_configure_format": 2076.944,
|
||||
"stratum_configure_parse": 1829.266,
|
||||
"stratum_control_parse": 796.057,
|
||||
"stratum_header": 5512.653,
|
||||
"stratum_job_issue": 4009.455,
|
||||
"stratum_notify_parse": 1744.167,
|
||||
"stratum_socket_round_trip": 66408.86,
|
||||
"stratum_submission": 736.476,
|
||||
"stratum_subscribe_format": 767.041,
|
||||
"stratum_subscription_parse": 1417.268,
|
||||
"target_matrix": 46.073
|
||||
},
|
||||
"bench_improvement_pct": -5.355437076345111,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5802,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"sha": "1d0c275a043d3067cc7d2d0d617c1b5de815b9bd",
|
||||
"timestamp": "2026-10-17T04:01:28+00:00",
|
||||
"metrics": {
|
||||
"tests": 68,
|
||||
"line_coverage_pct": 87.2,
|
||||
"bench_coverage_pct": 34.9,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 165.354,
|
||||
"bm1362_job_encoding": 200.286,
|
||||
"bm1366_report_decode": 83.727,
|
||||
"bm1366_session_cycle": 223.244,
|
||||
"bm1366_work_encoding": 209.351,
|
||||
"difficulty_target": 661.52,
|
||||
"power_policy": 0.825,
|
||||
"scrypt_share_verification": 270686.164,
|
||||
"share_verification": 958.951,
|
||||
"stratum_authorize_format": 683.429,
|
||||
"stratum_configure_parse": 1641.642,
|
||||
"stratum_control_parse": 604.253,
|
||||
"stratum_header": 5196.406,
|
||||
"stratum_job_issue": 4004.139,
|
||||
"stratum_notify_parse": 1463.534,
|
||||
"stratum_submission": 520.837,
|
||||
"target_matrix": 30.431
|
||||
},
|
||||
"bench_improvement_pct": 12.990854943787838,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5249,
|
||||
"dependencies": 11,
|
||||
"code_quality": "B",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "23a67af7db1c59d48ed052d2f399f53852fba7fd",
|
||||
"timestamp": "2026-10-17T06:22:39+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.3,
|
||||
"bench_coverage_pct": 41.3,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 118.466,
|
||||
"bm1362_job_encoding": 141.095,
|
||||
"bm1362_work_encoding": 140.218,
|
||||
"bm1366_captured_report_poll": 619.37,
|
||||
"bm1366_report_decode": 54.631,
|
||||
"bm1366_session_cycle": 174.583,
|
||||
"bm1366_work_encoding": 140.707,
|
||||
"bm13xx_crc16": 154.111,
|
||||
"bm13xx_crc5": 25.45,
|
||||
"difficulty_target": 330.927,
|
||||
"hal_socket_exchange": 16029.276,
|
||||
"power_policy": 0.488,
|
||||
"scrypt_share_verification": 193320.875,
|
||||
"share_verification": 577.433,
|
||||
"stratum_accept_parse": 181.167,
|
||||
"stratum_authorize_format": 287.414,
|
||||
"stratum_configure_format": 488.179,
|
||||
"stratum_configure_parse": 703.635,
|
||||
"stratum_control_parse": 263.262,
|
||||
"stratum_header": 2946.961,
|
||||
"stratum_job_issue": 1830.304,
|
||||
"stratum_notify_parse": 743.751,
|
||||
"stratum_socket_round_trip": 16392.885,
|
||||
"stratum_submission": 270.776,
|
||||
"stratum_subscribe_format": 259.584,
|
||||
"stratum_subscription_parse": 404.322,
|
||||
"target_matrix": 18.848
|
||||
},
|
||||
"bench_improvement_pct": -2.5965982435089954,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 5776,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "361a6f45872bac472719eb1205440627734b9dc0",
|
||||
"timestamp": "2026-10-19T02:42:52+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.4,
|
||||
"bench_coverage_pct": 41.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 232.262,
|
||||
"bm1362_job_encoding": 268.042,
|
||||
"bm1362_work_encoding": 293.119,
|
||||
"bm1366_captured_report_poll": 1005.482,
|
||||
"bm1366_report_decode": 107.082,
|
||||
"bm1366_session_cycle": 342.536,
|
||||
"bm1366_work_encoding": 318.703,
|
||||
"bm13xx_crc16": 294.818,
|
||||
"bm13xx_crc5": 43.289,
|
||||
"difficulty_target": 909.418,
|
||||
"hal_socket_exchange": 41358.24,
|
||||
"power_policy": 0.916,
|
||||
"scrypt_share_verification": 363389.156,
|
||||
"share_verification": 1773.295,
|
||||
"stratum_accept_parse": 543.03,
|
||||
"stratum_authorize_format": 858.969,
|
||||
"stratum_configure_format": 1298.086,
|
||||
"stratum_configure_parse": 2120.089,
|
||||
"stratum_control_parse": 607.363,
|
||||
"stratum_header": 6954.921,
|
||||
"stratum_job_issue": 5228.494,
|
||||
"stratum_notify_parse": 2059.438,
|
||||
"stratum_socket_round_trip": 45648.118,
|
||||
"stratum_submission": 727.713,
|
||||
"stratum_subscribe_format": 731.331,
|
||||
"stratum_subscription_parse": 1136.976,
|
||||
"target_matrix": 41.489
|
||||
},
|
||||
"bench_improvement_pct": -18.46436035258768,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5802,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "484f479b90eff4fcc7772d323ff4c9b6a4b93771",
|
||||
"timestamp": "2026-11-12T22:58:16+00:00",
|
||||
"metrics": {
|
||||
"tests": 252,
|
||||
"line_coverage_pct": 85.7,
|
||||
"bench_coverage_pct": 11.0,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 275.944,
|
||||
"bm1362_job_encoding": 312.568,
|
||||
"bm1362_work_encoding": 326.845,
|
||||
"bm1366_captured_report_poll": 1718.903,
|
||||
"bm1366_report_decode": 135.625,
|
||||
"bm1366_session_cycle": 378.843,
|
||||
"bm1366_work_encoding": 325.481,
|
||||
"bm13xx_crc16": 331.899,
|
||||
"bm13xx_crc5": 62.62,
|
||||
"difficulty_target": 861.822,
|
||||
"hal_socket_exchange": 33430.247,
|
||||
"power_policy": 1.164,
|
||||
"scrypt_share_verification": 406989.328,
|
||||
"share_verification": 1563.182,
|
||||
"stratum_accept_parse": 666.681,
|
||||
"stratum_authorize_format": 1155.103,
|
||||
"stratum_configure_format": 1917.635,
|
||||
"stratum_configure_parse": 2337.488,
|
||||
"stratum_control_parse": 913.604,
|
||||
"stratum_header": 8352.213,
|
||||
"stratum_job_issue": 5823.769,
|
||||
"stratum_notify_parse": 2406.618,
|
||||
"stratum_socket_round_trip": 66469.58,
|
||||
"stratum_submission": 865.538,
|
||||
"stratum_subscribe_format": 1011.42,
|
||||
"stratum_subscription_parse": 1294.617,
|
||||
"target_matrix": 55.748
|
||||
},
|
||||
"bench_improvement_pct": null,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 20375,
|
||||
"dependencies": 60,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"sha": "5aab1e0131f1b86ef568c59e06a1d68b39a97dc7",
|
||||
"timestamp": "2026-10-17T01:14:10+00:00",
|
||||
"metrics": {
|
||||
"tests": 68,
|
||||
"line_coverage_pct": 87.4,
|
||||
"bench_coverage_pct": 35.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 181.12,
|
||||
"bm1362_job_encoding": 212.353,
|
||||
"bm1366_report_decode": 83.909,
|
||||
"bm1366_session_cycle": 217.569,
|
||||
"bm1366_work_encoding": 218.388,
|
||||
"difficulty_target": 692.324,
|
||||
"power_policy": 0.845,
|
||||
"scrypt_share_verification": 298371.453,
|
||||
"share_verification": 934.966,
|
||||
"stratum_authorize_format": 783.436,
|
||||
"stratum_configure_parse": 1568.098,
|
||||
"stratum_control_parse": 852.454,
|
||||
"stratum_header": 5480.384,
|
||||
"stratum_job_issue": 3591.099,
|
||||
"stratum_notify_parse": 1770.242,
|
||||
"stratum_submission": 555.39,
|
||||
"target_matrix": 34.08
|
||||
},
|
||||
"bench_improvement_pct": -1.2856187431122177,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5227,
|
||||
"dependencies": 11,
|
||||
"code_quality": "B",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"sha": "5faeb774113d09d150ad8cfa5bee3951fae0d8e8",
|
||||
"timestamp": "2026-10-17T04:02:08+00:00",
|
||||
"metrics": {
|
||||
"tests": 68,
|
||||
"line_coverage_pct": 87.2,
|
||||
"bench_coverage_pct": 34.9,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 118.16,
|
||||
"bm1362_job_encoding": 140.788,
|
||||
"bm1366_report_decode": 54.245,
|
||||
"bm1366_session_cycle": 154.963,
|
||||
"bm1366_work_encoding": 141.589,
|
||||
"difficulty_target": 323.774,
|
||||
"power_policy": 0.461,
|
||||
"scrypt_share_verification": 186319.641,
|
||||
"share_verification": 550.887,
|
||||
"stratum_authorize_format": 294.061,
|
||||
"stratum_configure_parse": 711.528,
|
||||
"stratum_control_parse": 254.993,
|
||||
"stratum_header": 2969.331,
|
||||
"stratum_job_issue": 1825.709,
|
||||
"stratum_notify_parse": 689.88,
|
||||
"stratum_submission": 249.138,
|
||||
"target_matrix": 19.153
|
||||
},
|
||||
"bench_improvement_pct": null,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 5249,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "871a2cd3f782bbe4ca171fb89f4a9a546e07e0d7",
|
||||
"timestamp": "2026-10-19T03:52:23+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.4,
|
||||
"bench_coverage_pct": 41.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 120.796,
|
||||
"bm1362_job_encoding": 141.136,
|
||||
"bm1362_work_encoding": 143.088,
|
||||
"bm1366_captured_report_poll": 638.604,
|
||||
"bm1366_report_decode": 54.562,
|
||||
"bm1366_session_cycle": 174.175,
|
||||
"bm1366_work_encoding": 144.601,
|
||||
"bm13xx_crc16": 155.011,
|
||||
"bm13xx_crc5": 25.634,
|
||||
"difficulty_target": 333.155,
|
||||
"hal_socket_exchange": 15028.565,
|
||||
"power_policy": 0.478,
|
||||
"scrypt_share_verification": 188387.836,
|
||||
"share_verification": 576.683,
|
||||
"stratum_accept_parse": 182.574,
|
||||
"stratum_authorize_format": 298.237,
|
||||
"stratum_configure_format": 565.741,
|
||||
"stratum_configure_parse": 717.721,
|
||||
"stratum_control_parse": 257.534,
|
||||
"stratum_header": 2940.601,
|
||||
"stratum_job_issue": 1793.692,
|
||||
"stratum_notify_parse": 697.719,
|
||||
"stratum_socket_round_trip": 15954.266,
|
||||
"stratum_submission": 252.056,
|
||||
"stratum_subscribe_format": 258.863,
|
||||
"stratum_subscription_parse": 429.497,
|
||||
"target_matrix": 18.526
|
||||
},
|
||||
"bench_improvement_pct": 0.9487568131159643,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 5837,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"sha": "a2d03658137b3426d3feb0311dc74640a2a4a9fd",
|
||||
"timestamp": "2026-10-16T07:36:30+00:00",
|
||||
"metrics": {
|
||||
"tests": 30,
|
||||
"line_coverage_pct": 86.5,
|
||||
"bench_coverage_pct": 46.9,
|
||||
"bench_ns_per_op": {
|
||||
"bm1366_session_cycle": 153.229,
|
||||
"bm1366_work_encoding": 160.908,
|
||||
"power_policy": 0.616,
|
||||
"bm1366_report_decode": 57.895,
|
||||
"difficulty_target": 351.668,
|
||||
"stratum_control_parse": 411.535,
|
||||
"share_verification": 701.448,
|
||||
"target_matrix": 20.303,
|
||||
"stratum_header": 3184.797,
|
||||
"stratum_notify_parse": 792.362,
|
||||
"stratum_submission": 463.577
|
||||
},
|
||||
"bench_improvement_pct": null,
|
||||
"lines_of_code": 2458,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "a4f499ce124412ddd34d42b8375c5625c6a64f3b",
|
||||
"timestamp": "2026-10-17T15:28:32+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.4,
|
||||
"bench_coverage_pct": 41.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 120.203,
|
||||
"bm1362_job_encoding": 142.7,
|
||||
"bm1362_work_encoding": 142.153,
|
||||
"bm1366_captured_report_poll": 649.73,
|
||||
"bm1366_report_decode": 55.762,
|
||||
"bm1366_session_cycle": 179.294,
|
||||
"bm1366_work_encoding": 144.509,
|
||||
"bm13xx_crc16": 158.162,
|
||||
"bm13xx_crc5": 26.395,
|
||||
"difficulty_target": 336.608,
|
||||
"hal_socket_exchange": 15741.728,
|
||||
"power_policy": 0.491,
|
||||
"scrypt_share_verification": 198707.742,
|
||||
"share_verification": 584.64,
|
||||
"stratum_accept_parse": 182.362,
|
||||
"stratum_authorize_format": 299.346,
|
||||
"stratum_configure_format": 501.471,
|
||||
"stratum_configure_parse": 708.574,
|
||||
"stratum_control_parse": 260.388,
|
||||
"stratum_header": 3092.729,
|
||||
"stratum_job_issue": 1895.633,
|
||||
"stratum_notify_parse": 709.715,
|
||||
"stratum_socket_round_trip": 16433.906,
|
||||
"stratum_submission": 246.741,
|
||||
"stratum_subscribe_format": 253.29,
|
||||
"stratum_subscription_parse": 415.463,
|
||||
"target_matrix": 19.494
|
||||
},
|
||||
"bench_improvement_pct": 9.825072287666742,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 5796,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "ae7745772ae51cc196a60bd433b3d933ed512eae",
|
||||
"timestamp": "2026-10-19T05:01:58+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.4,
|
||||
"bench_coverage_pct": 41.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 280.556,
|
||||
"bm1362_job_encoding": 331.654,
|
||||
"bm1362_work_encoding": 279.539,
|
||||
"bm1366_captured_report_poll": 1519.435,
|
||||
"bm1366_report_decode": 133.258,
|
||||
"bm1366_session_cycle": 447.576,
|
||||
"bm1366_work_encoding": 269.042,
|
||||
"bm13xx_crc16": 341.921,
|
||||
"bm13xx_crc5": 55.941,
|
||||
"difficulty_target": 1096.821,
|
||||
"hal_socket_exchange": 46202.277,
|
||||
"power_policy": 1.47,
|
||||
"scrypt_share_verification": 497556.016,
|
||||
"share_verification": 1543.566,
|
||||
"stratum_accept_parse": 736.83,
|
||||
"stratum_authorize_format": 920.035,
|
||||
"stratum_configure_format": 2086.944,
|
||||
"stratum_configure_parse": 2439.709,
|
||||
"stratum_control_parse": 998.693,
|
||||
"stratum_header": 8158.071,
|
||||
"stratum_job_issue": 6180.409,
|
||||
"stratum_notify_parse": 2500.056,
|
||||
"stratum_socket_round_trip": 66973.135,
|
||||
"stratum_submission": 1065.12,
|
||||
"stratum_subscribe_format": 1295.934,
|
||||
"stratum_subscription_parse": 1605.76,
|
||||
"target_matrix": 88.817
|
||||
},
|
||||
"bench_improvement_pct": -26.37049020368169,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5837,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"sha": "b1eb641729e77c6451bfe646288d36dd4364aa7e",
|
||||
"timestamp": "2026-10-16T19:19:28+00:00",
|
||||
"metrics": {
|
||||
"tests": 62,
|
||||
"line_coverage_pct": 88.5,
|
||||
"bench_coverage_pct": 35.5,
|
||||
"bench_ns_per_op": {
|
||||
"bm1366_report_decode": 80.406,
|
||||
"bm1366_session_cycle": 229.356,
|
||||
"bm1366_work_encoding": 205.691,
|
||||
"difficulty_target": 669.365,
|
||||
"power_policy": 0.849,
|
||||
"scrypt_share_verification": 286639.148,
|
||||
"share_verification": 882.469,
|
||||
"stratum_authorize_format": 697.138,
|
||||
"stratum_configure_parse": 1646.612,
|
||||
"stratum_control_parse": 822.593,
|
||||
"stratum_header": 5209.663,
|
||||
"stratum_job_issue": 3602.652,
|
||||
"stratum_notify_parse": 1521.427,
|
||||
"stratum_submission": 568.883,
|
||||
"target_matrix": 34.432
|
||||
},
|
||||
"bench_improvement_pct": 5.279824105907481,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 4914,
|
||||
"dependencies": 11,
|
||||
"code_quality": "B",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "b9686af9c8f80feaf6dc893699e4d975a59f5949",
|
||||
"timestamp": "2026-10-17T10:17:58+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.3,
|
||||
"bench_coverage_pct": 41.3,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 174.547,
|
||||
"bm1362_job_encoding": 214.201,
|
||||
"bm1362_work_encoding": 236.065,
|
||||
"bm1366_captured_report_poll": 986.53,
|
||||
"bm1366_report_decode": 83.521,
|
||||
"bm1366_session_cycle": 279.829,
|
||||
"bm1366_work_encoding": 271.038,
|
||||
"bm13xx_crc16": 290.546,
|
||||
"bm13xx_crc5": 49.464,
|
||||
"difficulty_target": 869.765,
|
||||
"hal_socket_exchange": 35832.668,
|
||||
"power_policy": 1.13,
|
||||
"scrypt_share_verification": 290309.086,
|
||||
"share_verification": 886.321,
|
||||
"stratum_accept_parse": 426.084,
|
||||
"stratum_authorize_format": 680.234,
|
||||
"stratum_configure_format": 1204.431,
|
||||
"stratum_configure_parse": 1749.496,
|
||||
"stratum_control_parse": 562.863,
|
||||
"stratum_header": 4986.07,
|
||||
"stratum_job_issue": 3828.325,
|
||||
"stratum_notify_parse": 1794.247,
|
||||
"stratum_socket_round_trip": 46774.744,
|
||||
"stratum_submission": 647.318,
|
||||
"stratum_subscribe_format": 601.506,
|
||||
"stratum_subscription_parse": 1172.352,
|
||||
"target_matrix": 34.356
|
||||
},
|
||||
"bench_improvement_pct": -9.836890264091615,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5787,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "c13db2a5ba9b73ac1fa5b478b7a3032d1810b336",
|
||||
"timestamp": "2026-10-19T03:40:55+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.4,
|
||||
"bench_coverage_pct": 41.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 224.556,
|
||||
"bm1362_job_encoding": 300.77,
|
||||
"bm1362_work_encoding": 246.604,
|
||||
"bm1366_captured_report_poll": 1238.499,
|
||||
"bm1366_report_decode": 119.342,
|
||||
"bm1366_session_cycle": 274.465,
|
||||
"bm1366_work_encoding": 266.664,
|
||||
"bm13xx_crc16": 309.028,
|
||||
"bm13xx_crc5": 52.466,
|
||||
"difficulty_target": 973.075,
|
||||
"hal_socket_exchange": 37957.504,
|
||||
"power_policy": 1.147,
|
||||
"scrypt_share_verification": 284277.391,
|
||||
"share_verification": 1321.256,
|
||||
"stratum_accept_parse": 596.537,
|
||||
"stratum_authorize_format": 1332.566,
|
||||
"stratum_configure_format": 2032.848,
|
||||
"stratum_configure_parse": 2749.941,
|
||||
"stratum_control_parse": 797.614,
|
||||
"stratum_header": 6383.481,
|
||||
"stratum_job_issue": 5409.785,
|
||||
"stratum_notify_parse": 2303.943,
|
||||
"stratum_socket_round_trip": 46976.996,
|
||||
"stratum_submission": 797.677,
|
||||
"stratum_subscribe_format": 750.893,
|
||||
"stratum_subscription_parse": 917.124,
|
||||
"target_matrix": 42.305
|
||||
},
|
||||
"bench_improvement_pct": -4.082790698433242,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5802,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "c7cda3064ec8e51072abd598f714dbee41436f44",
|
||||
"timestamp": "2026-11-16T22:05:06+00:00",
|
||||
"metrics": {
|
||||
"tests": 252,
|
||||
"line_coverage_pct": 85.7,
|
||||
"bench_coverage_pct": 11.0,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 118.822,
|
||||
"bm1362_job_encoding": 146.111,
|
||||
"bm1362_work_encoding": 143.098,
|
||||
"bm1366_captured_report_poll": 651.914,
|
||||
"bm1366_report_decode": 54.195,
|
||||
"bm1366_session_cycle": 178.176,
|
||||
"bm1366_work_encoding": 140.373,
|
||||
"bm13xx_crc16": 153.906,
|
||||
"bm13xx_crc5": 25.409,
|
||||
"difficulty_target": 330.048,
|
||||
"hal_socket_exchange": 15816.499,
|
||||
"power_policy": 0.478,
|
||||
"scrypt_share_verification": 193545.438,
|
||||
"share_verification": 554.416,
|
||||
"stratum_accept_parse": 184.312,
|
||||
"stratum_authorize_format": 288.78,
|
||||
"stratum_configure_format": 497.344,
|
||||
"stratum_configure_parse": 731.367,
|
||||
"stratum_control_parse": 275.494,
|
||||
"stratum_header": 2927.859,
|
||||
"stratum_job_issue": 1931.006,
|
||||
"stratum_notify_parse": 734.993,
|
||||
"stratum_socket_round_trip": 16695.255,
|
||||
"stratum_submission": 241.16,
|
||||
"stratum_subscribe_format": 243.119,
|
||||
"stratum_subscription_parse": 397.224,
|
||||
"target_matrix": 18.798
|
||||
},
|
||||
"bench_improvement_pct": 0.01469655302288628,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 20375,
|
||||
"dependencies": 60,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "cc14543ced1621d4565882a311773c48f5d3614c",
|
||||
"timestamp": "2026-11-12T21:22:45+00:00",
|
||||
"metrics": {
|
||||
"tests": 250,
|
||||
"line_coverage_pct": 85.6,
|
||||
"bench_coverage_pct": 11.1,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 225.644,
|
||||
"bm1362_job_encoding": 328.479,
|
||||
"bm1362_work_encoding": 309.737,
|
||||
"bm1366_captured_report_poll": 1359.428,
|
||||
"bm1366_report_decode": 114.877,
|
||||
"bm1366_session_cycle": 389.925,
|
||||
"bm1366_work_encoding": 331.867,
|
||||
"bm13xx_crc16": 290.487,
|
||||
"bm13xx_crc5": 54.944,
|
||||
"difficulty_target": 1124.235,
|
||||
"hal_socket_exchange": 45278.473,
|
||||
"power_policy": 1.052,
|
||||
"scrypt_share_verification": 418213.531,
|
||||
"share_verification": 1196.389,
|
||||
"stratum_accept_parse": 657.239,
|
||||
"stratum_authorize_format": 1235.067,
|
||||
"stratum_configure_format": 1755.29,
|
||||
"stratum_configure_parse": 2531.665,
|
||||
"stratum_control_parse": 800.904,
|
||||
"stratum_header": 7417.373,
|
||||
"stratum_job_issue": 5545.003,
|
||||
"stratum_notify_parse": 2787.602,
|
||||
"stratum_socket_round_trip": 57270.365,
|
||||
"stratum_submission": 827.388,
|
||||
"stratum_subscribe_format": 908.918,
|
||||
"stratum_subscription_parse": 1413.105,
|
||||
"target_matrix": 52.823
|
||||
},
|
||||
"bench_improvement_pct": -37.70168914723892,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 20288,
|
||||
"dependencies": 60,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"sha": "e83ced0e20ca4de09cdf967d051da4a4c678a7b8",
|
||||
"timestamp": "2026-10-17T04:04:54+00:00",
|
||||
"metrics": {
|
||||
"tests": 68,
|
||||
"line_coverage_pct": 87.2,
|
||||
"bench_coverage_pct": 34.9,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 224.772,
|
||||
"bm1362_job_encoding": 223.29,
|
||||
"bm1366_report_decode": 86.828,
|
||||
"bm1366_session_cycle": 238.508,
|
||||
"bm1366_work_encoding": 276.985,
|
||||
"difficulty_target": 741.29,
|
||||
"power_policy": 1.119,
|
||||
"scrypt_share_verification": 323664.125,
|
||||
"share_verification": 909.603,
|
||||
"stratum_authorize_format": 805.021,
|
||||
"stratum_configure_parse": 1718.245,
|
||||
"stratum_control_parse": 709.261,
|
||||
"stratum_header": 5112.093,
|
||||
"stratum_job_issue": 3901.994,
|
||||
"stratum_notify_parse": 1956.082,
|
||||
"stratum_submission": 556.537,
|
||||
"target_matrix": 32.949
|
||||
},
|
||||
"bench_improvement_pct": -13.93138021432414,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5249,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "e8faf398f5fa947cedf9f6ed1d96c4b06a2bc9fe",
|
||||
"timestamp": "2026-10-17T09:20:34+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.3,
|
||||
"bench_coverage_pct": 41.3,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 130.267,
|
||||
"bm1362_job_encoding": 148.2,
|
||||
"bm1362_work_encoding": 145.577,
|
||||
"bm1366_captured_report_poll": 670.107,
|
||||
"bm1366_report_decode": 57.707,
|
||||
"bm1366_session_cycle": 182.859,
|
||||
"bm1366_work_encoding": 148.095,
|
||||
"bm13xx_crc16": 162.08,
|
||||
"bm13xx_crc5": 26.493,
|
||||
"difficulty_target": 350.947,
|
||||
"hal_socket_exchange": 15814.126,
|
||||
"power_policy": 0.503,
|
||||
"scrypt_share_verification": 201815.781,
|
||||
"share_verification": 606.034,
|
||||
"stratum_accept_parse": 198.899,
|
||||
"stratum_authorize_format": 469.782,
|
||||
"stratum_configure_format": 606.131,
|
||||
"stratum_configure_parse": 754.196,
|
||||
"stratum_control_parse": 276.155,
|
||||
"stratum_header": 3225.103,
|
||||
"stratum_job_issue": 2011.455,
|
||||
"stratum_notify_parse": 772.011,
|
||||
"stratum_socket_round_trip": 21484.808,
|
||||
"stratum_submission": 474.468,
|
||||
"stratum_subscribe_format": 285.806,
|
||||
"stratum_subscription_parse": 611.025,
|
||||
"target_matrix": 24.21
|
||||
},
|
||||
"bench_improvement_pct": -7.99990807179019,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 7 8745H w/ Radeon 780M Graphics",
|
||||
"logical_cpus": 4
|
||||
},
|
||||
"lines_of_code": 5787,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"sha": "e928140351830bac139efb98820e53804636c893",
|
||||
"timestamp": "2026-10-21T12:04:09+00:00",
|
||||
"metrics": {
|
||||
"tests": 73,
|
||||
"line_coverage_pct": 86.4,
|
||||
"bench_coverage_pct": 41.2,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 179.018,
|
||||
"bm1362_job_encoding": 205.43,
|
||||
"bm1362_work_encoding": 227.761,
|
||||
"bm1366_captured_report_poll": 987.287,
|
||||
"bm1366_report_decode": 104.075,
|
||||
"bm1366_session_cycle": 291.804,
|
||||
"bm1366_work_encoding": 240.474,
|
||||
"bm13xx_crc16": 321.653,
|
||||
"bm13xx_crc5": 46.539,
|
||||
"difficulty_target": 896.713,
|
||||
"hal_socket_exchange": 34825.955,
|
||||
"power_policy": 0.833,
|
||||
"scrypt_share_verification": 300374.305,
|
||||
"share_verification": 889.826,
|
||||
"stratum_accept_parse": 460.427,
|
||||
"stratum_authorize_format": 838.222,
|
||||
"stratum_configure_format": 1193.101,
|
||||
"stratum_configure_parse": 1507.419,
|
||||
"stratum_control_parse": 595.072,
|
||||
"stratum_header": 4761.147,
|
||||
"stratum_job_issue": 4159.136,
|
||||
"stratum_notify_parse": 1926.673,
|
||||
"stratum_socket_round_trip": 50607.73,
|
||||
"stratum_submission": 548.007,
|
||||
"stratum_subscribe_format": 596.867,
|
||||
"stratum_subscription_parse": 886.226,
|
||||
"target_matrix": 32.376
|
||||
},
|
||||
"bench_improvement_pct": 32.8319410335087,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5841,
|
||||
"dependencies": 11,
|
||||
"code_quality": "A",
|
||||
"quality_scope": "main CI passed cargo fmt and warnings-denied Clippy on all targets",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"sha": "ea8030b707605cc7f974773438aab1a4f369b2ad",
|
||||
"timestamp": "2026-10-17T01:17:31+00:00",
|
||||
"metrics": {
|
||||
"tests": 68,
|
||||
"line_coverage_pct": 87.2,
|
||||
"bench_coverage_pct": 34.9,
|
||||
"bench_ns_per_op": {
|
||||
"bm1362_commands": 164.352,
|
||||
"bm1362_job_encoding": 201.856,
|
||||
"bm1366_report_decode": 108.608,
|
||||
"bm1366_session_cycle": 301.841,
|
||||
"bm1366_work_encoding": 280.799,
|
||||
"difficulty_target": 951.712,
|
||||
"power_policy": 1.058,
|
||||
"scrypt_share_verification": 347436.078,
|
||||
"share_verification": 920.142,
|
||||
"stratum_authorize_format": 670.238,
|
||||
"stratum_configure_parse": 1618.133,
|
||||
"stratum_control_parse": 675.35,
|
||||
"stratum_header": 4941.007,
|
||||
"stratum_job_issue": 5048.704,
|
||||
"stratum_notify_parse": 1751.053,
|
||||
"stratum_submission": 759.693,
|
||||
"target_matrix": 32.171
|
||||
},
|
||||
"bench_improvement_pct": -11.111256562965927,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5249,
|
||||
"dependencies": 11,
|
||||
"code_quality": "B",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"sha": "ebea5f5cfd994118b7fa5b5870863df7bb3ede3a",
|
||||
"timestamp": "2026-10-16T19:15:47+00:00",
|
||||
"metrics": {
|
||||
"tests": 62,
|
||||
"line_coverage_pct": 88.5,
|
||||
"bench_coverage_pct": 35.5,
|
||||
"bench_ns_per_op": {
|
||||
"bm1366_report_decode": 105.816,
|
||||
"bm1366_session_cycle": 248.387,
|
||||
"bm1366_work_encoding": 225.861,
|
||||
"difficulty_target": 696.309,
|
||||
"power_policy": 0.838,
|
||||
"scrypt_share_verification": 269455.297,
|
||||
"share_verification": 881.432,
|
||||
"stratum_authorize_format": 740.798,
|
||||
"stratum_configure_parse": 2156.62,
|
||||
"stratum_control_parse": 754.595,
|
||||
"stratum_header": 5139.92,
|
||||
"stratum_job_issue": 3880.848,
|
||||
"stratum_notify_parse": 2049.311,
|
||||
"stratum_submission": 564.143,
|
||||
"target_matrix": 31.667
|
||||
},
|
||||
"bench_improvement_pct": null,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 4914,
|
||||
"dependencies": 11,
|
||||
"code_quality": "B",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"sha": "f1b4780e2c29545f999a32d082d53d981cde1eab",
|
||||
"timestamp": "2026-10-17T01:10:07+00:00",
|
||||
"metrics": {
|
||||
"tests": 68,
|
||||
"line_coverage_pct": 87.4,
|
||||
"bench_coverage_pct": 32.9,
|
||||
"bench_ns_per_op": {
|
||||
"bm1366_report_decode": 85.369,
|
||||
"bm1366_session_cycle": 217.528,
|
||||
"bm1366_work_encoding": 211.19,
|
||||
"difficulty_target": 699.086,
|
||||
"power_policy": 0.833,
|
||||
"scrypt_share_verification": 289038.242,
|
||||
"share_verification": 1156.075,
|
||||
"stratum_authorize_format": 704.473,
|
||||
"stratum_configure_parse": 1625.25,
|
||||
"stratum_control_parse": 597.014,
|
||||
"stratum_header": 5390.022,
|
||||
"stratum_job_issue": 3546.33,
|
||||
"stratum_notify_parse": 2066.816,
|
||||
"stratum_submission": 627.814,
|
||||
"target_matrix": 32.316
|
||||
},
|
||||
"bench_improvement_pct": -2.9414495847373345,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5227,
|
||||
"dependencies": 11,
|
||||
"code_quality": "B",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"sha": "f6889940c3bc8f5f2d85ee45d992f485e2f00df9",
|
||||
"timestamp": "2026-10-17T01:06:27+00:00",
|
||||
"metrics": {
|
||||
"tests": 62,
|
||||
"line_coverage_pct": 86.7,
|
||||
"bench_coverage_pct": 34.7,
|
||||
"bench_ns_per_op": {
|
||||
"bm1366_report_decode": 80.39,
|
||||
"bm1366_session_cycle": 217.507,
|
||||
"bm1366_work_encoding": 226.831,
|
||||
"difficulty_target": 722.424,
|
||||
"power_policy": 0.816,
|
||||
"scrypt_share_verification": 268871.328,
|
||||
"share_verification": 877.36,
|
||||
"stratum_authorize_format": 720.309,
|
||||
"stratum_configure_parse": 1798.745,
|
||||
"stratum_control_parse": 608.061,
|
||||
"stratum_header": 5195.553,
|
||||
"stratum_job_issue": 4198.027,
|
||||
"stratum_notify_parse": 1548.651,
|
||||
"stratum_submission": 637.805,
|
||||
"target_matrix": 32.238
|
||||
},
|
||||
"bench_improvement_pct": -0.8416320684715105,
|
||||
"bench_host": {
|
||||
"architecture": "x86_64",
|
||||
"cpu_model": "AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx",
|
||||
"logical_cpus": 8
|
||||
},
|
||||
"lines_of_code": 5000,
|
||||
"dependencies": 11,
|
||||
"code_quality": "B",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="102" height="20" role="img" aria-label="CI main: last completed attempt fail (run 13252)"><title>CI main: last completed attempt fail (run 13252)</title><rect width="102" height="20" rx="3" fill="#555"/><path d="M39 0h60a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H39z" fill="#d1242f"/><text x="20" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">CI</text><text x="70" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">fail</text></svg>
|
||||
|
Before Width: | Height: | Size: 533 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="102" height="20" role="img" aria-label="CI next: last completed attempt pass (run 7374)"><title>CI next: last completed attempt pass (run 7374)</title><rect width="102" height="20" rx="3" fill="#555"/><path d="M39 0h60a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H39z" fill="#2ea043"/><text x="20" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">CI</text><text x="70" y="14" fill="#fff" text-anchor="middle" font-family="sans-serif" font-size="11">pass</text></svg>
|
||||
|
Before Width: | Height: | Size: 531 B |
@@ -0,0 +1,149 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//! BM1366 work and response framing. Nonces only come from a device or replay.
|
||||
|
||||
pub const WORK_BYTES: usize = 88;
|
||||
pub const REPORT_BYTES: usize = 11;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct NonceReport {
|
||||
pub nonce: u32,
|
||||
pub work_id: u8,
|
||||
pub version_field: u16,
|
||||
pub chip_address: u8,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum ReportError {
|
||||
Length,
|
||||
Preamble,
|
||||
RegisterResponse,
|
||||
Checksum,
|
||||
}
|
||||
|
||||
pub fn crc16(bytes: &[u8]) -> u16 {
|
||||
let mut value = 0xffff_u16;
|
||||
for byte in bytes {
|
||||
value ^= u16::from(*byte) << 8;
|
||||
for _ in 0..8 {
|
||||
value = if value & 0x8000 != 0 {
|
||||
(value << 1) ^ 0x1021
|
||||
} else {
|
||||
value << 1
|
||||
};
|
||||
}
|
||||
}
|
||||
value
|
||||
}
|
||||
|
||||
fn crc5(bytes: &[u8]) -> u8 {
|
||||
let mut value = 0x1f_u8;
|
||||
for byte in bytes {
|
||||
for shift in (0..8).rev() {
|
||||
let feedback = ((value >> 4) ^ (byte >> shift)) & 1;
|
||||
value = ((value << 1) | feedback) & 0x1f;
|
||||
value ^= feedback << 2;
|
||||
}
|
||||
}
|
||||
value
|
||||
}
|
||||
|
||||
fn reverse_words(input: &[u8]) -> [u8; 32] {
|
||||
let mut output = [0_u8; 32];
|
||||
for index in 0..8 {
|
||||
output[index * 4..index * 4 + 4].copy_from_slice(&input[(7 - index) * 4..(8 - index) * 4]);
|
||||
}
|
||||
output
|
||||
}
|
||||
|
||||
/// Encode a nonce-zero Bitcoin header for the observed 88-byte SEND_JOB form.
|
||||
/// The low three work-ID bits are reserved by the BM1366 response format.
|
||||
pub fn encode_work(header: &[u8; 80], work_id: u8) -> Option<[u8; WORK_BYTES]> {
|
||||
if header[76..80] != [0; 4] || work_id & 7 != 0 {
|
||||
return None;
|
||||
}
|
||||
let mut frame = [0_u8; WORK_BYTES];
|
||||
frame[..4].copy_from_slice(&[0x55, 0xaa, 0x21, 0x54]);
|
||||
frame[4] = work_id;
|
||||
frame[10..14].copy_from_slice(&header[72..76]);
|
||||
frame[14..18].copy_from_slice(&header[68..72]);
|
||||
frame[18..50].copy_from_slice(&reverse_words(&header[36..68]));
|
||||
frame[50..82].copy_from_slice(&reverse_words(&header[4..36]));
|
||||
frame[82..86].copy_from_slice(&header[..4]);
|
||||
let checksum = crc16(&frame[2..86]);
|
||||
frame[86..88].copy_from_slice(&checksum.to_be_bytes());
|
||||
Some(frame)
|
||||
}
|
||||
|
||||
/// Parse an observed nonce report; register replies must use a separate path.
|
||||
pub fn decode_nonce_report(frame: &[u8]) -> Result<NonceReport, ReportError> {
|
||||
if frame.len() != REPORT_BYTES {
|
||||
return Err(ReportError::Length);
|
||||
}
|
||||
if frame[..2] != [0xaa, 0x55] {
|
||||
return Err(ReportError::Preamble);
|
||||
}
|
||||
if frame[10] & 0x80 == 0 {
|
||||
return Err(ReportError::RegisterResponse);
|
||||
}
|
||||
if crc5(&frame[2..]) != 0 {
|
||||
return Err(ReportError::Checksum);
|
||||
}
|
||||
Ok(NonceReport {
|
||||
nonce: u32::from_le_bytes(frame[2..6].try_into().expect("four-byte nonce")),
|
||||
chip_address: frame[6],
|
||||
work_id: frame[7] & 0xf8,
|
||||
version_field: u16::from_be_bytes(frame[8..10].try_into().expect("version field")),
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn crc16_reference_vector() {
|
||||
assert_eq!(crc16(b"123456789"), 0x29b1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn captured_work_and_response() {
|
||||
let header: [u8; 80] = hex_header();
|
||||
let frame = encode_work(&header, 0x18).unwrap();
|
||||
assert_eq!(&frame[..5], &[0x55, 0xaa, 0x21, 0x54, 0x18]);
|
||||
assert_eq!(
|
||||
crc16(&frame[2..86]),
|
||||
u16::from_be_bytes([frame[86], frame[87]])
|
||||
);
|
||||
assert_eq!(&frame[10..14], &header[72..76]);
|
||||
assert_eq!(&frame[82..86], &header[..4]);
|
||||
assert!(encode_work(&header, 0x19).is_none());
|
||||
let mut with_nonce = header;
|
||||
with_nonce[76] = 1;
|
||||
assert!(encode_work(&with_nonce, 0x18).is_none());
|
||||
|
||||
let report = [
|
||||
0xaa, 0x55, 0x38, 0xff, 0xad, 0xed, 0, 0x18, 0x04, 0xb3, 0x94,
|
||||
];
|
||||
let parsed = decode_nonce_report(&report).unwrap();
|
||||
assert_eq!(parsed.nonce, 0xedad_ff38);
|
||||
assert_eq!(parsed.work_id, 0x18);
|
||||
assert_eq!(parsed.version_field, 0x04b3);
|
||||
let mut corrupt = report;
|
||||
corrupt[4] ^= 1;
|
||||
assert_eq!(decode_nonce_report(&corrupt), Err(ReportError::Checksum));
|
||||
}
|
||||
|
||||
fn hex_header() -> [u8; 80] {
|
||||
let input = concat!(
|
||||
"00000020fc3ab8d43021f45eb662389d0f791f657dbf75a5cb93670b57b6c22503",
|
||||
"b4213a43ae1052ebd44443068fe178e2c61ca4994846fd133addb04aab2b382c5",
|
||||
"b4c74c1012e6a8f06021700000000"
|
||||
);
|
||||
let mut header = [0_u8; 80];
|
||||
for (index, bytes) in input.as_bytes().chunks_exact(2).enumerate() {
|
||||
let pair = std::str::from_utf8(bytes).unwrap();
|
||||
header[index] = u8::from_str_radix(pair, 16).unwrap();
|
||||
}
|
||||
header
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//! Versioned local wire contract between Alkane OS and an SDK hardware backend.
|
||||
|
||||
use crate::HardwareBackend;
|
||||
use std::fmt;
|
||||
use std::io::{self, Read, Write};
|
||||
use std::os::fd::{AsRawFd, FromRawFd, OwnedFd};
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::path::Path;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
const MAGIC: [u8; 4] = *b"ALKH";
|
||||
const VERSION: u8 = 1;
|
||||
const RESPONSE: u16 = 1;
|
||||
const HEADER_LEN: usize = 16;
|
||||
const MAX_PAYLOAD: usize = 4096;
|
||||
const IO_TIMEOUT: Duration = Duration::from_secs(2);
|
||||
|
||||
const SEND_FRAME: u8 = 1;
|
||||
const RECEIVE_FRAME: u8 = 2;
|
||||
const SET_CHAIN_RESET: u8 = 3;
|
||||
const SET_FAN_TARGET: u8 = 4;
|
||||
const READ_TEMPERATURE: u8 = 5;
|
||||
const SET_PSU_ENABLED: u8 = 6;
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
compile_error!("Alkane HAL sockets require Linux");
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
mod sys {
|
||||
pub use std::ffi::{c_char as CChar, c_int as CInt, c_void as CVoid};
|
||||
pub type SaFamily = u16;
|
||||
pub type SocklenT = u32;
|
||||
|
||||
pub const AF_UNIX: CInt = 1;
|
||||
pub const SOCK_STREAM: CInt = 1;
|
||||
pub const SOCK_NONBLOCK: CInt = 0x800;
|
||||
pub const SOCK_CLOEXEC: CInt = 0x80000;
|
||||
pub const SOL_SOCKET: CInt = 1;
|
||||
pub const SO_ERROR: CInt = 4;
|
||||
pub const POLLOUT: i16 = 4;
|
||||
pub const EAGAIN: CInt = 11;
|
||||
pub const EISCONN: CInt = 106;
|
||||
pub const EINPROGRESS: CInt = 115;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct SockaddrUn {
|
||||
pub sun_family: SaFamily,
|
||||
pub sun_path: [CChar; 108],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct PollFd {
|
||||
pub fd: CInt,
|
||||
pub events: i16,
|
||||
pub revents: i16,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn socket(domain: CInt, socket_type: CInt, protocol: CInt) -> CInt;
|
||||
pub fn connect(fd: CInt, address: *const CVoid, length: SocklenT) -> CInt;
|
||||
pub fn poll(fds: *mut PollFd, count: usize, timeout_ms: CInt) -> CInt;
|
||||
pub fn getsockopt(
|
||||
fd: CInt,
|
||||
level: CInt,
|
||||
name: CInt,
|
||||
value: *mut CVoid,
|
||||
length: *mut SocklenT,
|
||||
) -> CInt;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum HalError {
|
||||
Io(io::Error),
|
||||
Protocol(&'static str),
|
||||
Device(u8),
|
||||
FrameTooLong,
|
||||
InvalidFanPercent,
|
||||
}
|
||||
|
||||
impl fmt::Display for HalError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Io(error) => write!(f, "HAL I/O: {error}"),
|
||||
Self::Protocol(message) => write!(f, "HAL protocol: {message}"),
|
||||
Self::Device(code) => write!(f, "HAL device error: {code}"),
|
||||
Self::FrameTooLong => f.write_str("HAL frame exceeds the wire limit"),
|
||||
Self::InvalidFanPercent => f.write_str("HAL fan target exceeds 100 percent"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for HalError {}
|
||||
|
||||
impl From<io::Error> for HalError {
|
||||
fn from(error: io::Error) -> Self {
|
||||
Self::Io(error)
|
||||
}
|
||||
}
|
||||
|
||||
/// Local client for the privileged board backend supplied by the SDK image.
|
||||
pub struct HalClient {
|
||||
stream: UnixStream,
|
||||
sequence: u32,
|
||||
poisoned: bool,
|
||||
}
|
||||
|
||||
impl HalClient {
|
||||
pub fn connect(path: impl AsRef<Path>) -> Result<Self, HalError> {
|
||||
let stream = connect_until(path.as_ref(), Instant::now() + IO_TIMEOUT)?;
|
||||
Self::from_stream(stream)
|
||||
}
|
||||
|
||||
pub fn from_stream(stream: UnixStream) -> Result<Self, HalError> {
|
||||
stream.set_read_timeout(Some(IO_TIMEOUT))?;
|
||||
stream.set_write_timeout(Some(IO_TIMEOUT))?;
|
||||
Ok(Self {
|
||||
stream,
|
||||
sequence: 0,
|
||||
poisoned: false,
|
||||
})
|
||||
}
|
||||
|
||||
fn exchange(&mut self, opcode: u8, payload: &[u8]) -> Result<Vec<u8>, HalError> {
|
||||
if self.poisoned {
|
||||
return Err(HalError::Protocol("connection is unusable"));
|
||||
}
|
||||
if payload.len() > MAX_PAYLOAD {
|
||||
return Err(HalError::FrameTooLong);
|
||||
}
|
||||
let result = self.exchange_inner(opcode, payload);
|
||||
if let Err(ref error) = result {
|
||||
if !matches!(error, HalError::Device(_)) {
|
||||
self.poisoned = true;
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
fn exchange_inner(&mut self, opcode: u8, payload: &[u8]) -> Result<Vec<u8>, HalError> {
|
||||
let deadline = Instant::now() + IO_TIMEOUT;
|
||||
self.sequence = self.sequence.wrapping_add(1);
|
||||
let sequence = self.sequence;
|
||||
let mut header = [0_u8; HEADER_LEN];
|
||||
header[..4].copy_from_slice(&MAGIC);
|
||||
header[4] = VERSION;
|
||||
header[5] = opcode;
|
||||
header[8..12].copy_from_slice(&sequence.to_le_bytes());
|
||||
header[12..16].copy_from_slice(&(payload.len() as u32).to_le_bytes());
|
||||
write_all_until(&mut self.stream, &header, deadline)?;
|
||||
write_all_until(&mut self.stream, payload, deadline)?;
|
||||
|
||||
read_exact_until(&mut self.stream, &mut header, deadline)?;
|
||||
if header[..4] != MAGIC || header[4] != VERSION || header[5] != opcode {
|
||||
return Err(HalError::Protocol("response identity mismatch"));
|
||||
}
|
||||
if u16::from_le_bytes([header[6], header[7]]) != RESPONSE {
|
||||
return Err(HalError::Protocol("response flag missing"));
|
||||
}
|
||||
if u32::from_le_bytes(header[8..12].try_into().unwrap()) != sequence {
|
||||
return Err(HalError::Protocol("response sequence mismatch"));
|
||||
}
|
||||
let length = u32::from_le_bytes(header[12..16].try_into().unwrap()) as usize;
|
||||
if !(1..=MAX_PAYLOAD).contains(&length) {
|
||||
return Err(HalError::Protocol("invalid response length"));
|
||||
}
|
||||
let mut body = vec![0_u8; length];
|
||||
read_exact_until(&mut self.stream, &mut body, deadline)?;
|
||||
if body[0] != 0 {
|
||||
if !matches!(body[0], 1..=3) || body.len() != 1 {
|
||||
return Err(HalError::Protocol("invalid error response"));
|
||||
}
|
||||
return Err(HalError::Device(body[0]));
|
||||
}
|
||||
Ok(body[1..].to_vec())
|
||||
}
|
||||
|
||||
fn empty_reply(&mut self, opcode: u8, payload: &[u8]) -> Result<(), HalError> {
|
||||
if !self.exchange(opcode, payload)?.is_empty() {
|
||||
self.poisoned = true;
|
||||
return Err(HalError::Protocol("unexpected response data"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn timeout_error() -> io::Error {
|
||||
io::Error::new(io::ErrorKind::TimedOut, "HAL operation timed out")
|
||||
}
|
||||
|
||||
fn remaining(deadline: Instant) -> io::Result<Duration> {
|
||||
deadline
|
||||
.checked_duration_since(Instant::now())
|
||||
.filter(|duration| !duration.is_zero())
|
||||
.ok_or_else(timeout_error)
|
||||
}
|
||||
|
||||
fn write_all_until(stream: &mut UnixStream, mut data: &[u8], deadline: Instant) -> io::Result<()> {
|
||||
while !data.is_empty() {
|
||||
stream.set_write_timeout(Some(remaining(deadline)?))?;
|
||||
match stream.write(data) {
|
||||
Ok(0) => {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::WriteZero,
|
||||
"HAL socket closed",
|
||||
))
|
||||
}
|
||||
Ok(count) => data = &data[count..],
|
||||
Err(error) if error.kind() == io::ErrorKind::Interrupted => continue,
|
||||
Err(error) => return Err(error),
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_exact_until(
|
||||
stream: &mut UnixStream,
|
||||
mut data: &mut [u8],
|
||||
deadline: Instant,
|
||||
) -> io::Result<()> {
|
||||
while !data.is_empty() {
|
||||
stream.set_read_timeout(Some(remaining(deadline)?))?;
|
||||
match stream.read(data) {
|
||||
Ok(0) => {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::UnexpectedEof,
|
||||
"HAL socket closed",
|
||||
))
|
||||
}
|
||||
Ok(count) => data = &mut data[count..],
|
||||
Err(error) if error.kind() == io::ErrorKind::Interrupted => continue,
|
||||
Err(error) => return Err(error),
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn connect_until(path: &Path, deadline: Instant) -> io::Result<UnixStream> {
|
||||
let bytes = path.as_os_str().as_bytes();
|
||||
let max_path =
|
||||
std::mem::size_of::<sys::SockaddrUn>() - std::mem::offset_of!(sys::SockaddrUn, sun_path);
|
||||
if bytes.is_empty() || bytes.len() >= max_path || bytes.contains(&0) {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
"invalid HAL socket path",
|
||||
));
|
||||
}
|
||||
let raw = unsafe {
|
||||
sys::socket(
|
||||
sys::AF_UNIX,
|
||||
sys::SOCK_STREAM | sys::SOCK_NONBLOCK | sys::SOCK_CLOEXEC,
|
||||
0,
|
||||
)
|
||||
};
|
||||
if raw < 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
let fd = unsafe { OwnedFd::from_raw_fd(raw) };
|
||||
let mut address: sys::SockaddrUn = unsafe { std::mem::zeroed() };
|
||||
address.sun_family = sys::AF_UNIX as sys::SaFamily;
|
||||
for (destination, source) in address.sun_path.iter_mut().zip(bytes) {
|
||||
*destination = *source as sys::CChar;
|
||||
}
|
||||
let length =
|
||||
(std::mem::offset_of!(sys::SockaddrUn, sun_path) + bytes.len() + 1) as sys::SocklenT;
|
||||
loop {
|
||||
let result = unsafe {
|
||||
sys::connect(
|
||||
fd.as_raw_fd(),
|
||||
&address as *const _ as *const sys::CVoid,
|
||||
length,
|
||||
)
|
||||
};
|
||||
if result == 0 {
|
||||
break;
|
||||
}
|
||||
let error = io::Error::last_os_error();
|
||||
if error.raw_os_error() == Some(sys::EISCONN) {
|
||||
break;
|
||||
}
|
||||
if !matches!(
|
||||
error.raw_os_error(),
|
||||
Some(sys::EINPROGRESS) | Some(sys::EAGAIN)
|
||||
) {
|
||||
return Err(error);
|
||||
}
|
||||
let mut poll_fd = sys::PollFd {
|
||||
fd: fd.as_raw_fd(),
|
||||
events: sys::POLLOUT,
|
||||
revents: 0,
|
||||
};
|
||||
let wait = remaining(deadline)?.as_millis().min(i32::MAX as u128) as i32;
|
||||
let polled = unsafe { sys::poll(&mut poll_fd, 1, wait.max(1)) };
|
||||
if polled < 0 {
|
||||
let error = io::Error::last_os_error();
|
||||
if error.kind() == io::ErrorKind::Interrupted {
|
||||
continue;
|
||||
}
|
||||
return Err(error);
|
||||
}
|
||||
if polled == 0 {
|
||||
return Err(timeout_error());
|
||||
}
|
||||
let mut socket_error: sys::CInt = 0;
|
||||
let mut socket_error_len = std::mem::size_of_val(&socket_error) as sys::SocklenT;
|
||||
if unsafe {
|
||||
sys::getsockopt(
|
||||
fd.as_raw_fd(),
|
||||
sys::SOL_SOCKET,
|
||||
sys::SO_ERROR,
|
||||
&mut socket_error as *mut _ as *mut sys::CVoid,
|
||||
&mut socket_error_len,
|
||||
)
|
||||
} < 0
|
||||
{
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
if socket_error != 0 {
|
||||
return Err(io::Error::from_raw_os_error(socket_error));
|
||||
}
|
||||
if error.raw_os_error() == Some(sys::EINPROGRESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let stream = UnixStream::from(fd);
|
||||
stream.set_nonblocking(false)?;
|
||||
Ok(stream)
|
||||
}
|
||||
|
||||
impl HardwareBackend for HalClient {
|
||||
type Error = HalError;
|
||||
|
||||
fn send_frame(&mut self, chain: u8, frame: &[u8]) -> Result<(), Self::Error> {
|
||||
if frame.len() > MAX_PAYLOAD - 3 {
|
||||
return Err(HalError::FrameTooLong);
|
||||
}
|
||||
let mut body = Vec::with_capacity(frame.len() + 3);
|
||||
body.push(chain);
|
||||
body.extend_from_slice(&(frame.len() as u16).to_le_bytes());
|
||||
body.extend_from_slice(frame);
|
||||
self.empty_reply(SEND_FRAME, &body)
|
||||
}
|
||||
|
||||
fn receive_frame(&mut self, chain: u8, frame: &mut [u8]) -> Result<usize, Self::Error> {
|
||||
if frame.len() > MAX_PAYLOAD - 3 {
|
||||
return Err(HalError::FrameTooLong);
|
||||
}
|
||||
let mut request = [0_u8; 3];
|
||||
request[0] = chain;
|
||||
request[1..].copy_from_slice(&(frame.len() as u16).to_le_bytes());
|
||||
let body = self.exchange(RECEIVE_FRAME, &request)?;
|
||||
if body.len() < 2 {
|
||||
self.poisoned = true;
|
||||
return Err(HalError::Protocol("missing receive length"));
|
||||
}
|
||||
let count = u16::from_le_bytes([body[0], body[1]]) as usize;
|
||||
if count > frame.len() || body.len() != count + 2 {
|
||||
self.poisoned = true;
|
||||
return Err(HalError::Protocol("invalid received frame size"));
|
||||
}
|
||||
frame[..count].copy_from_slice(&body[2..]);
|
||||
Ok(count)
|
||||
}
|
||||
|
||||
fn set_chain_reset(&mut self, chain: u8, asserted: bool) -> Result<(), Self::Error> {
|
||||
self.empty_reply(SET_CHAIN_RESET, &[chain, u8::from(asserted)])
|
||||
}
|
||||
|
||||
fn set_fan_target(&mut self, fan: u8, percent: u8) -> Result<(), Self::Error> {
|
||||
if percent > 100 {
|
||||
return Err(HalError::InvalidFanPercent);
|
||||
}
|
||||
self.empty_reply(SET_FAN_TARGET, &[fan, percent])
|
||||
}
|
||||
|
||||
fn read_temperature_mc(&mut self, sensor: u8) -> Result<i32, Self::Error> {
|
||||
let body = self.exchange(READ_TEMPERATURE, &[sensor])?;
|
||||
let bytes: [u8; 4] = match body.try_into() {
|
||||
Ok(bytes) => bytes,
|
||||
Err(_) => {
|
||||
self.poisoned = true;
|
||||
return Err(HalError::Protocol("invalid temperature response"));
|
||||
}
|
||||
};
|
||||
Ok(i32::from_le_bytes(bytes))
|
||||
}
|
||||
|
||||
fn set_psu_enabled(&mut self, enabled: bool) -> Result<(), Self::Error> {
|
||||
self.empty_reply(SET_PSU_ENABLED, &[u8::from(enabled)])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
//! Board independent policy and hardware interfaces for Alkane OS.
|
||||
//!
|
||||
//! An entry in the target matrix is a development obligation, not a claim that
|
||||
//! the pairing already mines. Hardware backends are supplied by SDK images.
|
||||
|
||||
pub mod bm1366;
|
||||
pub mod hal_wire;
|
||||
pub mod pow;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Vendor {
|
||||
Bitmain,
|
||||
Whatsminer,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Algorithm {
|
||||
Sha256,
|
||||
Scrypt,
|
||||
Equihash,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct ControlBoard {
|
||||
pub id: &'static str,
|
||||
pub vendor: Vendor,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct HashChip {
|
||||
pub id: &'static str,
|
||||
pub vendor: Vendor,
|
||||
pub algorithm: Algorithm,
|
||||
}
|
||||
|
||||
pub const CONTROL_BOARDS: [ControlBoard; 7] = [
|
||||
ControlBoard {
|
||||
id: "am335x-bb",
|
||||
vendor: Vendor::Bitmain,
|
||||
},
|
||||
ControlBoard {
|
||||
id: "zynq-7010",
|
||||
vendor: Vendor::Bitmain,
|
||||
},
|
||||
ControlBoard {
|
||||
id: "cv1835",
|
||||
vendor: Vendor::Bitmain,
|
||||
},
|
||||
ControlBoard {
|
||||
id: "a113d",
|
||||
vendor: Vendor::Bitmain,
|
||||
},
|
||||
ControlBoard {
|
||||
id: "allwinner-h3",
|
||||
vendor: Vendor::Whatsminer,
|
||||
},
|
||||
ControlBoard {
|
||||
id: "allwinner-h6",
|
||||
vendor: Vendor::Whatsminer,
|
||||
},
|
||||
ControlBoard {
|
||||
id: "allwinner-h616",
|
||||
vendor: Vendor::Whatsminer,
|
||||
},
|
||||
];
|
||||
|
||||
pub const HASH_CHIPS: [HashChip; 17] = [
|
||||
HashChip {
|
||||
id: "BM1384",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1387",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1360",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1362",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1366",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1368",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1370",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1396",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1397",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1398",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1489",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Scrypt,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1491",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Scrypt,
|
||||
},
|
||||
HashChip {
|
||||
id: "BM1746",
|
||||
vendor: Vendor::Bitmain,
|
||||
algorithm: Algorithm::Equihash,
|
||||
},
|
||||
HashChip {
|
||||
id: "KF1950",
|
||||
vendor: Vendor::Whatsminer,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "ID-1968",
|
||||
vendor: Vendor::Whatsminer,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "ID-1980",
|
||||
vendor: Vendor::Whatsminer,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
HashChip {
|
||||
id: "ID-1990",
|
||||
vendor: Vendor::Whatsminer,
|
||||
algorithm: Algorithm::Sha256,
|
||||
},
|
||||
];
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct Target {
|
||||
pub control: ControlBoard,
|
||||
pub chip: HashChip,
|
||||
}
|
||||
|
||||
impl Target {
|
||||
pub fn new(control: ControlBoard, chip: HashChip) -> Option<Self> {
|
||||
(control.vendor == chip.vendor).then_some(Self { control, chip })
|
||||
}
|
||||
}
|
||||
|
||||
/// Every same-vendor theoretical pairing is in scope for Alkane OS.
|
||||
pub fn target_matrix() -> impl Iterator<Item = Target> {
|
||||
CONTROL_BOARDS.into_iter().flat_map(|control| {
|
||||
HASH_CHIPS
|
||||
.into_iter()
|
||||
.filter_map(move |chip| Target::new(control, chip))
|
||||
})
|
||||
}
|
||||
|
||||
/// Hardware operations implemented by a board backend in the SDK image.
|
||||
/// The methods deliberately expose no assumed UART, FPGA or Bitmicro layout.
|
||||
pub trait HardwareBackend {
|
||||
type Error;
|
||||
|
||||
fn send_frame(&mut self, chain: u8, frame: &[u8]) -> Result<(), Self::Error>;
|
||||
fn receive_frame(&mut self, chain: u8, frame: &mut [u8]) -> Result<usize, Self::Error>;
|
||||
fn set_chain_reset(&mut self, chain: u8, asserted: bool) -> Result<(), Self::Error>;
|
||||
fn set_fan_target(&mut self, fan: u8, percent: u8) -> Result<(), Self::Error>;
|
||||
fn read_temperature_mc(&mut self, sensor: u8) -> Result<i32, Self::Error>;
|
||||
fn set_psu_enabled(&mut self, enabled: bool) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum PowerDecision {
|
||||
Hold,
|
||||
Stop,
|
||||
}
|
||||
|
||||
/// A safe starting policy: no hashing while temperature is unknown or unsafe.
|
||||
/// Board-specific thresholds will come from measured, revision-specific data.
|
||||
pub fn power_decision(temperature_mc: Option<i32>, max_mc: i32) -> PowerDecision {
|
||||
match temperature_mc {
|
||||
Some(value) if value < max_mc => PowerDecision::Hold,
|
||||
_ => PowerDecision::Stop,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn all_theoretical_same_vendor_targets_are_included() {
|
||||
let targets: Vec<_> = target_matrix().collect();
|
||||
assert_eq!(targets.len(), 4 * 13 + 3 * 4);
|
||||
assert!(targets.iter().all(|t| t.control.vendor == t.chip.vendor));
|
||||
for control in CONTROL_BOARDS {
|
||||
for chip in HASH_CHIPS {
|
||||
assert_eq!(
|
||||
targets.contains(&Target { control, chip }),
|
||||
control.vendor == chip.vendor
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_or_hot_sensor_stops_power() {
|
||||
assert_eq!(power_decision(None, 80_000), PowerDecision::Stop);
|
||||
assert_eq!(power_decision(Some(80_000), 80_000), PowerDecision::Stop);
|
||||
assert_eq!(power_decision(Some(79_999), 80_000), PowerDecision::Hold);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use alkane_os::target_matrix;
|
||||
|
||||
fn main() {
|
||||
match std::env::args().nth(1).as_deref() {
|
||||
Some("--list-targets") => {
|
||||
println!("control_board,hash_chip,algorithm");
|
||||
for target in target_matrix() {
|
||||
println!(
|
||||
"{},{},{:?}",
|
||||
target.control.id, target.chip.id, target.chip.algorithm
|
||||
);
|
||||
}
|
||||
}
|
||||
Some("--version") => println!("alkane-os {}", env!("CARGO_PKG_VERSION")),
|
||||
_ => {
|
||||
eprintln!("usage: alkane-os --list-targets | --version");
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//! Verify reported SHA-256d shares. This module does not search for nonces.
|
||||
|
||||
const BM1366_VERSION_BITS: u32 = 0x1FFF_E000;
|
||||
|
||||
const ROUND: [u32; 64] = [
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
||||
];
|
||||
|
||||
const INITIAL: [u32; 8] = [
|
||||
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
||||
];
|
||||
|
||||
fn compress(state: &mut [u32; 8], block: &[u8]) {
|
||||
let mut words = [0_u32; 64];
|
||||
for (index, part) in block.chunks_exact(4).enumerate() {
|
||||
words[index] = u32::from_be_bytes(part.try_into().expect("four-byte word"));
|
||||
}
|
||||
for index in 16..64 {
|
||||
let a = words[index - 15];
|
||||
let b = words[index - 2];
|
||||
let small_zero = a.rotate_right(7) ^ a.rotate_right(18) ^ (a >> 3);
|
||||
let small_one = b.rotate_right(17) ^ b.rotate_right(19) ^ (b >> 10);
|
||||
words[index] = words[index - 16]
|
||||
.wrapping_add(small_zero)
|
||||
.wrapping_add(words[index - 7])
|
||||
.wrapping_add(small_one);
|
||||
}
|
||||
|
||||
let [mut a, mut b, mut c, mut d, mut e, mut f, mut g, mut h] = *state;
|
||||
for index in 0..64 {
|
||||
let choose = (e & f) ^ (!e & g);
|
||||
let majority = (a & b) ^ (a & c) ^ (b & c);
|
||||
let big_one = e.rotate_right(6) ^ e.rotate_right(11) ^ e.rotate_right(25);
|
||||
let big_zero = a.rotate_right(2) ^ a.rotate_right(13) ^ a.rotate_right(22);
|
||||
let first = h
|
||||
.wrapping_add(big_one)
|
||||
.wrapping_add(choose)
|
||||
.wrapping_add(ROUND[index])
|
||||
.wrapping_add(words[index]);
|
||||
let second = big_zero.wrapping_add(majority);
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = d.wrapping_add(first);
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = first.wrapping_add(second);
|
||||
}
|
||||
for (current, result) in state.iter_mut().zip([a, b, c, d, e, f, g, h]) {
|
||||
*current = current.wrapping_add(result);
|
||||
}
|
||||
}
|
||||
|
||||
/// Compute SHA-256 for a message whose length fits the standard 64-bit field.
|
||||
pub fn sha256(message: &[u8]) -> [u8; 32] {
|
||||
let mut state = INITIAL;
|
||||
let chunks = message.chunks_exact(64);
|
||||
let remainder = chunks.remainder();
|
||||
for chunk in chunks {
|
||||
compress(&mut state, chunk);
|
||||
}
|
||||
let final_size = if remainder.len() >= 56 { 128 } else { 64 };
|
||||
let mut final_blocks = [0_u8; 128];
|
||||
final_blocks[..remainder.len()].copy_from_slice(remainder);
|
||||
final_blocks[remainder.len()] = 0x80;
|
||||
final_blocks[final_size - 8..final_size]
|
||||
.copy_from_slice(&((message.len() as u64).wrapping_mul(8)).to_be_bytes());
|
||||
for chunk in final_blocks[..final_size].chunks_exact(64) {
|
||||
compress(&mut state, chunk);
|
||||
}
|
||||
let mut digest = [0_u8; 32];
|
||||
for (word, bytes) in state.into_iter().zip(digest.chunks_exact_mut(4)) {
|
||||
bytes.copy_from_slice(&word.to_be_bytes());
|
||||
}
|
||||
digest
|
||||
}
|
||||
|
||||
/// Compute one double hash for verification, never for nonce search.
|
||||
pub fn sha256d(message: &[u8]) -> [u8; 32] {
|
||||
sha256(&sha256(message))
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct ShareCheck {
|
||||
pub rolled_version: u32,
|
||||
pub hash_le: [u8; 32],
|
||||
pub meets_target: bool,
|
||||
}
|
||||
|
||||
/// Decode the raw BM1366 version extension against the version sent to the ASIC.
|
||||
/// The chip reports additional set bits; pool submission uses a separate mask.
|
||||
pub fn decode_bm1366_version(job_version: u32, version_field: u16) -> u32 {
|
||||
job_version | ((u32::from(version_field) << 13) & BM1366_VERSION_BITS)
|
||||
}
|
||||
|
||||
/// The BIP310 mask negotiated with a pool, limited to BM1366 rolling bits.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct VersionMask(u32);
|
||||
|
||||
impl VersionMask {
|
||||
pub fn new(mask: u32) -> Option<Self> {
|
||||
(mask & !BM1366_VERSION_BITS == 0).then_some(Self(mask))
|
||||
}
|
||||
|
||||
pub fn apply_submission_bits(self, base_version: u32, version_bits: u32) -> Option<u32> {
|
||||
(version_bits & !self.0 == 0).then_some((base_version & !self.0) | version_bits)
|
||||
}
|
||||
}
|
||||
|
||||
/// Check one ASIC-reported nonce against a little-endian 256-bit pool target.
|
||||
pub fn verify_sha256_report(
|
||||
nonce_zero_header: &[u8; 80],
|
||||
nonce: u32,
|
||||
version_field: u16,
|
||||
target_le: &[u8; 32],
|
||||
) -> ShareCheck {
|
||||
let mut header = *nonce_zero_header;
|
||||
let base_version = u32::from_le_bytes(header[..4].try_into().expect("version field"));
|
||||
let rolled_version = decode_bm1366_version(base_version, version_field);
|
||||
header[..4].copy_from_slice(&rolled_version.to_le_bytes());
|
||||
header[76..80].copy_from_slice(&nonce.to_le_bytes());
|
||||
let hash_le = sha256d(&header);
|
||||
let meets_target = hash_le.iter().rev().cmp(target_le.iter().rev()).is_le();
|
||||
ShareCheck {
|
||||
rolled_version,
|
||||
hash_le,
|
||||
meets_target,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn hex(bytes: &[u8]) -> String {
|
||||
bytes.iter().map(|byte| format!("{byte:02x}")).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sha256_matches_standard_padding_vectors() {
|
||||
let vectors: [(&[u8], &str); 6] = [
|
||||
(
|
||||
b"",
|
||||
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
),
|
||||
(
|
||||
b"abc",
|
||||
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
|
||||
),
|
||||
(
|
||||
&(0_u8..55).collect::<Vec<_>>(),
|
||||
"463eb28e72f82e0a96c0a4cc53690c571281131f672aa229e0d45ae59b598b59",
|
||||
),
|
||||
(
|
||||
&(0_u8..56).collect::<Vec<_>>(),
|
||||
"da2ae4d6b36748f2a318f23e7ab1dfdf45acdc9d049bd80e59de82a60895f562",
|
||||
),
|
||||
(
|
||||
&(0_u8..64).collect::<Vec<_>>(),
|
||||
"fdeab9acf3710362bd2658cdc9a29e8f9c757fcf9811603a8c447cd1d9151108",
|
||||
),
|
||||
(
|
||||
&(0_u8..100).collect::<Vec<_>>(),
|
||||
"bce0aff19cf5aa6a7469a30d61d04e4376e4bbf6381052ee9e7f33925c954d52",
|
||||
),
|
||||
];
|
||||
for (message, expected) in vectors {
|
||||
assert_eq!(hex(&sha256(message)), expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn captured_bm1366_report_meets_diff_one_only_with_rolled_version() {
|
||||
let header = [
|
||||
0x00, 0x00, 0x00, 0x20, 0xfc, 0x3a, 0xb8, 0xd4, 0x30, 0x21, 0xf4, 0x5e, 0xb6, 0x62,
|
||||
0x38, 0x9d, 0x0f, 0x79, 0x1f, 0x65, 0x7d, 0xbf, 0x75, 0xa5, 0xcb, 0x93, 0x67, 0x0b,
|
||||
0x57, 0xb6, 0xc2, 0x25, 0x03, 0xb4, 0x21, 0x3a, 0x43, 0xae, 0x10, 0x52, 0xeb, 0xd4,
|
||||
0x44, 0x43, 0x06, 0x8f, 0xe1, 0x78, 0xe2, 0xc6, 0x1c, 0xa4, 0x99, 0x48, 0x46, 0xfd,
|
||||
0x13, 0x3a, 0xdd, 0xb0, 0x4a, 0xab, 0x2b, 0x38, 0x2c, 0x5b, 0x4c, 0x74, 0xc1, 0x01,
|
||||
0x2e, 0x6a, 0x8f, 0x06, 0x02, 0x17, 0x00, 0x00, 0x00, 0x00,
|
||||
];
|
||||
let mut diff_one = [0_u8; 32];
|
||||
diff_one[26..28].fill(0xff);
|
||||
let result = verify_sha256_report(&header, 0xEDAD_FF38, 0x04B3, &diff_one);
|
||||
assert_eq!(result.rolled_version, 0x2096_6000);
|
||||
assert_eq!(
|
||||
hex(&result.hash_le),
|
||||
"4b5e00850cf9de9809f822f8858eda39e49996d9d40f634f1043290000000000"
|
||||
);
|
||||
assert!(result.meets_target);
|
||||
assert!(!verify_sha256_report(&header, 0xEDAD_FF38, 0, &diff_one).meets_target);
|
||||
assert!(!verify_sha256_report(&header, 0xEDAD_FF39, 0x04B3, &diff_one).meets_target);
|
||||
assert!(verify_sha256_report(&header, 0xEDAD_FF38, 0x04B3, &[0xff; 32]).meets_target);
|
||||
assert!(!verify_sha256_report(&header, 0xEDAD_FF38, 0x04B3, &[0; 32]).meets_target);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn raw_asic_version_preserves_bits_sent_to_chip() {
|
||||
assert_eq!(decode_bm1366_version(0x2100_0004, 1), 0x2100_2004);
|
||||
assert_eq!(decode_bm1366_version(0x2000_0000, 0), 0x2000_0000);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pool_version_bits_replace_only_negotiated_mask() {
|
||||
let mask = VersionMask::new(0x0060_0000).expect("valid restricted mask");
|
||||
assert_eq!(
|
||||
mask.apply_submission_bits(0x2160_0004, 0x0020_0000),
|
||||
Some(0x2120_0004)
|
||||
);
|
||||
assert_eq!(mask.apply_submission_bits(0x2160_0004, 0x0080_0000), None);
|
||||
assert_eq!(
|
||||
VersionMask::new(0)
|
||||
.unwrap()
|
||||
.apply_submission_bits(0x2100_0004, 0),
|
||||
Some(0x2100_0004)
|
||||
);
|
||||
assert_eq!(
|
||||
VersionMask::new(BM1366_VERSION_BITS)
|
||||
.unwrap()
|
||||
.apply_submission_bits(0x2160_0004, 0),
|
||||
Some(0x2000_0004)
|
||||
);
|
||||
assert!(VersionMask::new(0x8000_0000).is_none());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
use alkane_os::bm1366::{decode_nonce_report, encode_work};
|
||||
use alkane_os::pow::verify_sha256_report;
|
||||
use alkane_os::{power_decision, target_matrix};
|
||||
use std::hint::black_box;
|
||||
use std::time::Instant;
|
||||
|
||||
fn measure(name: &str, iterations: u64, mut f: impl FnMut()) {
|
||||
let started = Instant::now();
|
||||
for _ in 0..iterations {
|
||||
f();
|
||||
}
|
||||
let ns = started.elapsed().as_nanos() as f64 / iterations as f64;
|
||||
println!("BENCH {name} {ns:.3} ns/op");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "microbenchmark"]
|
||||
fn bench_target_matrix() {
|
||||
measure("target_matrix", 20_000, || {
|
||||
black_box(
|
||||
target_matrix()
|
||||
.filter(|target| black_box(target.chip.algorithm) == alkane_os::Algorithm::Sha256)
|
||||
.count(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "microbenchmark"]
|
||||
fn bench_power_policy() {
|
||||
measure("power_policy", 100_000, || {
|
||||
black_box(power_decision(black_box(Some(64_000)), 80_000));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "microbenchmark"]
|
||||
fn bench_share_verification() {
|
||||
let header = [0_u8; 80];
|
||||
let target = [0xff_u8; 32];
|
||||
measure("share_verification", 20_000, || {
|
||||
black_box(verify_sha256_report(
|
||||
black_box(&header),
|
||||
black_box(0xEDAD_FF38),
|
||||
black_box(0x04B3),
|
||||
black_box(&target),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "microbenchmark"]
|
||||
fn bench_bm1366_work_encoding() {
|
||||
let header = [0_u8; 80];
|
||||
measure("bm1366_work_encoding", 20_000, || {
|
||||
black_box(encode_work(black_box(&header), black_box(0x18)));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "microbenchmark"]
|
||||
fn bench_bm1366_report_decode() {
|
||||
let report = [
|
||||
0xaa, 0x55, 0x38, 0xff, 0xad, 0xed, 0, 0x18, 0x04, 0xb3, 0x94,
|
||||
];
|
||||
measure("bm1366_report_decode", 100_000, || {
|
||||
let _ = black_box(decode_nonce_report(black_box(&report)));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
use alkane_os::hal_wire::{HalClient, HalError};
|
||||
use alkane_os::HardwareBackend;
|
||||
use std::io::{Read, Write};
|
||||
use std::os::unix::net::{UnixListener, UnixStream};
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
fn reply(socket: &mut UnixStream, request: &[u8; 16], body: &[u8]) {
|
||||
let mut header = *request;
|
||||
header[6..8].copy_from_slice(&1_u16.to_le_bytes());
|
||||
header[12..16].copy_from_slice(&(body.len() as u32).to_le_bytes());
|
||||
socket.write_all(&header).unwrap();
|
||||
socket.write_all(body).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sdk_backend_round_trip_and_safety_limits() {
|
||||
let (client, mut server) = UnixStream::pair().unwrap();
|
||||
let worker = thread::spawn(move || {
|
||||
let expected = [
|
||||
(1, vec![2, 3, 0, 0x55, 0xaa, 0x21], vec![0]),
|
||||
(2, vec![2, 8, 0], vec![0, 3, 0, 0xaa, 0x55, 0x01]),
|
||||
(3, vec![2, 1], vec![0]),
|
||||
(4, vec![0, 90], vec![0]),
|
||||
(
|
||||
5,
|
||||
vec![1],
|
||||
[vec![0], 72_500_i32.to_le_bytes().to_vec()].concat(),
|
||||
),
|
||||
(6, vec![1], vec![0]),
|
||||
];
|
||||
for (index, (opcode, request_body, response_body)) in expected.iter().enumerate() {
|
||||
let mut header = [0_u8; 16];
|
||||
server.read_exact(&mut header).unwrap();
|
||||
assert_eq!(&header[..4], b"ALKH");
|
||||
assert_eq!(header[4], 1);
|
||||
assert_eq!(header[5], *opcode);
|
||||
assert_eq!(
|
||||
u32::from_le_bytes(header[8..12].try_into().unwrap()),
|
||||
index as u32 + 1
|
||||
);
|
||||
let length = u32::from_le_bytes(header[12..16].try_into().unwrap()) as usize;
|
||||
let mut body = vec![0_u8; length];
|
||||
server.read_exact(&mut body).unwrap();
|
||||
assert_eq!(&body, request_body);
|
||||
reply(&mut server, &header, response_body);
|
||||
}
|
||||
});
|
||||
let mut backend = HalClient::from_stream(client).unwrap();
|
||||
backend.send_frame(2, &[0x55, 0xaa, 0x21]).unwrap();
|
||||
let mut buffer = [0_u8; 8];
|
||||
assert_eq!(backend.receive_frame(2, &mut buffer).unwrap(), 3);
|
||||
assert_eq!(&buffer[..3], &[0xaa, 0x55, 0x01]);
|
||||
backend.set_chain_reset(2, true).unwrap();
|
||||
backend.set_fan_target(0, 90).unwrap();
|
||||
assert_eq!(backend.read_temperature_mc(1).unwrap(), 72_500);
|
||||
backend.set_psu_enabled(true).unwrap();
|
||||
assert!(matches!(
|
||||
backend.set_fan_target(0, 101),
|
||||
Err(HalError::InvalidFanPercent)
|
||||
));
|
||||
assert!(matches!(
|
||||
backend.send_frame(0, &[0_u8; 4094]),
|
||||
Err(HalError::FrameTooLong)
|
||||
));
|
||||
worker.join().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_wrong_response_sequence() {
|
||||
let (client, mut server) = UnixStream::pair().unwrap();
|
||||
let worker = thread::spawn(move || {
|
||||
let mut header = [0_u8; 16];
|
||||
server.read_exact(&mut header).unwrap();
|
||||
let mut body = [0_u8; 1];
|
||||
server.read_exact(&mut body).unwrap();
|
||||
header[8..12].copy_from_slice(&2_u32.to_le_bytes());
|
||||
reply(&mut server, &header, &[0]);
|
||||
});
|
||||
let mut backend = HalClient::from_stream(client).unwrap();
|
||||
assert!(matches!(
|
||||
backend.set_psu_enabled(true),
|
||||
Err(HalError::Protocol("response sequence mismatch"))
|
||||
));
|
||||
assert!(matches!(
|
||||
backend.set_psu_enabled(true),
|
||||
Err(HalError::Protocol("connection is unusable"))
|
||||
));
|
||||
worker.join().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_malformed_error_response_and_poisoned_connection() {
|
||||
for body in [&[4_u8][..], &[3_u8, 99][..]] {
|
||||
let (client, mut server) = UnixStream::pair().unwrap();
|
||||
let response = body.to_vec();
|
||||
let worker = thread::spawn(move || {
|
||||
let mut header = [0_u8; 16];
|
||||
server.read_exact(&mut header).unwrap();
|
||||
let mut request = [0_u8; 1];
|
||||
server.read_exact(&mut request).unwrap();
|
||||
reply(&mut server, &header, &response);
|
||||
});
|
||||
let mut backend = HalClient::from_stream(client).unwrap();
|
||||
assert!(matches!(
|
||||
backend.set_psu_enabled(true),
|
||||
Err(HalError::Protocol("invalid error response"))
|
||||
));
|
||||
assert!(matches!(
|
||||
backend.set_psu_enabled(true),
|
||||
Err(HalError::Protocol("connection is unusable"))
|
||||
));
|
||||
worker.join().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slow_partial_response_hits_absolute_exchange_deadline() {
|
||||
let (client, mut server) = UnixStream::pair().unwrap();
|
||||
let worker = thread::spawn(move || {
|
||||
let mut header = [0_u8; 16];
|
||||
server.read_exact(&mut header).unwrap();
|
||||
let mut request = [0_u8; 1];
|
||||
server.read_exact(&mut request).unwrap();
|
||||
header[6..8].copy_from_slice(&1_u16.to_le_bytes());
|
||||
header[12..16].copy_from_slice(&1_u32.to_le_bytes());
|
||||
for byte in header.into_iter().chain([0]) {
|
||||
if server.write_all(&[byte]).is_err() {
|
||||
break;
|
||||
}
|
||||
thread::sleep(Duration::from_millis(250));
|
||||
}
|
||||
});
|
||||
let mut backend = HalClient::from_stream(client).unwrap();
|
||||
let start = Instant::now();
|
||||
assert!(matches!(
|
||||
backend.set_psu_enabled(true),
|
||||
Err(HalError::Io(_))
|
||||
));
|
||||
assert!(start.elapsed() < Duration::from_secs(4));
|
||||
drop(backend);
|
||||
worker.join().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn connects_to_a_local_backend_socket() {
|
||||
let path = std::env::temp_dir().join(format!(
|
||||
"alkane-hal-{}-{}.sock",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
));
|
||||
let listener = UnixListener::bind(&path).unwrap();
|
||||
let worker = thread::spawn(move || {
|
||||
let (mut server, _) = listener.accept().unwrap();
|
||||
let mut header = [0_u8; 16];
|
||||
server.read_exact(&mut header).unwrap();
|
||||
let mut request = [0_u8; 1];
|
||||
server.read_exact(&mut request).unwrap();
|
||||
reply(&mut server, &header, &[0]);
|
||||
});
|
||||
let mut backend = HalClient::connect(&path).unwrap();
|
||||
backend.set_psu_enabled(true).unwrap();
|
||||
worker.join().unwrap();
|
||||
std::fs::remove_file(path).unwrap();
|
||||
}
|
||||