Compare commits

..
Author SHA1 Message Date
noah c0df4371f7 Reuse preinstalled SSH client in OS jobs
source-pr / source (pull_request) Successful in 32s
2026-10-18 20:35:05 -06:00
noah e2be7ff6de Skip Rust PR checks for README-only changes
source-pr / source (pull_request) Successful in 34s
2026-10-18 20:29:43 -06:00
noah 88d9b99165 Cache pinned OS coverage tool between main runs
source-pr / source (pull_request) Successful in 49s
2026-10-18 20:17:22 -06:00
noah 361a6f4587 Merge pull request 'Trigger Alkane OS badge updates on CI completion' (#1) from ci/completion-badge into main
main-release-gate / verify-and-release (push) Failing after 5m18s
2026-10-18 20:08:18 -06:00
noah e19cc7a66b Publish OS benchmark Pages after main CI
source-pr / source (pull_request) Successful in 38s
2026-10-18 20:03:45 -06:00
noah d496742500 Install Rust formatting component in fast OS check
source-pr / source (pull_request) Successful in 25s
2026-10-18 19:58:02 -06:00
noah 9d705ec44f Add fast OS source check for pull requests
source-pr / source (pull_request) Failing after 6s
2026-10-18 19:57:10 -06:00
noah 17e73f246a Route short OS checks to Alkane fast runner 2026-10-18 19:56:11 -06:00
noah 017a0eb22c Trigger CI badges after workflow completion 2026-10-18 19:47:34 -06:00
noah a4f499ce12 Invalidate ASIC work when pool version mask changes
main-release-gate / verify-and-release (push) Failing after 2m15s
2026-10-17 08:00:44 -06:00
noah b9686af9c8 docs: shorten OS entry guide
main-release-gate / verify-and-release (push) Failing after 3m47s
2026-10-17 01:42:50 -06:00
noah e8faf398f5 Publish benchmark Pages on the standing Alkane runner
main-release-gate / verify-and-release (push) Failing after 2m30s
2026-10-17 01:17:34 -06:00
noah 0c9731a8f9 Report benchmark Pages transport failures
main-release-gate / verify-and-release (push) Failing after 3m50s
2026-10-17 01:09:02 -06:00
noah 148a0ce5e4 Pin benchmark Pages SSH host key
main-release-gate / verify-and-release (push) Failing after 2m24s
2026-10-17 01:04:51 -06:00
noah 23a67af7db Make wrong-sequence HAL test stop after rejected header
main-release-gate / verify-and-release (push) Failing after 2m17s
2026-10-16 23:03:04 -06:00
noah 709d07775b Bound management request lifetime
main-release-gate / verify-and-release (push) Failing after 35s
2026-10-16 21:04:15 -06:00
noah b59791e0c5 Add local read-only mining status API
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 21:03:17 -06:00
noah 5501dfd66d Benchmark captured BM1366 report poll path
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 17:02:02 -06:00
noah ffaa51a092 Benchmark BM13xx protocol checksums
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 14:04:32 -06:00
noah a226191c1c Benchmark HAL and Stratum socket exchanges
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 11:06:45 -06:00
noah 9d84b7164e Benchmark BM1362 work and Stratum handshake paths
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 09:02:21 -06:00
noah e460bdc139 Validate public benchmark page before upload
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 08:45:58 -06:00
noah a951509350 Describe selected BM13xx host mining formats
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 08:12:42 -06:00
noah 46460fcec3 Select BM1362 work encoding for captured replay
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 08:11:54 -06:00
noah 5f6e7dd40d Set captured midstate count in BM1366 work
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 08:03:32 -06:00
noah c93de9fe41 Publish OS benchmarks to public Pages site
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 07:20:03 -06:00
noah 4922e49853 Bound queued OS CI attempts per branch
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 07:08:08 -06:00
noah c82693e9c1 Schedule CI badge refresh without workflow recursion
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 07:04:03 -06:00
noah 772c4aad11 Require complete OS microbenchmark measurements
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-16 05:02:18 -06:00
noah 79c6c72fd6 Keep buffered Stratum partial line deadline across drains
main-release-gate / verify-and-release (push) Failing after 1m35s
2026-10-16 04:02:03 -06:00
noah e83ced0e20 Attach OS quality gate evidence to metrics
main-release-gate / verify-and-release (push) Failing after 3m25s
2026-10-16 02:05:56 -06:00
noah 5faeb77411 Grade OS code quality from static checks
main-release-gate / verify-and-release (push) Failing after 2m7s
2026-10-16 02:02:58 -06:00
noah 1d0c275a04 Coalesce pending CI badge updates
main-release-gate / verify-and-release (push) Failing after 3m27s
2026-10-16 01:02:44 -06:00
noah ea8030b707 Reject invalid BM1362 geometry and baud requests
main-release-gate / verify-and-release (push) Failing after 3m21s
2026-10-15 22:07:41 -06:00
noah 5aab1e0131 Benchmark BM1362 frame encoding
main-release-gate / verify-and-release (push) Failing after 3m25s
2026-10-15 22:06:06 -06:00
noah f1b4780e2c Add Rust BM1362 wire frame encoders
main-release-gate / verify-and-release (push) Failing after 3m21s
2026-10-15 22:03:59 -06:00
noah f6889940c3 Verify Litecoin Scrypt shares in conformance gate
main-release-gate / verify-and-release (push) Failing after 3m22s
2026-10-15 21:04:52 -06:00
noah 31caf922b8 Add simulator mining command to Alkane OS
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 18:21:54 -06:00
noah c0f892c539 Set Rust-first core implementation policy
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 14:45:40 -06:00
noah a5fe65021b Shorten OS README to scope and release gates
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 14:36:00 -06:00
noah b1eb641729 Document miner work ID and shutdown guards
main-release-gate / verify-and-release (push) Failing after 3m25s
2026-10-15 13:04:44 -06:00
noah ebea5f5cfd Reserve ASIC work IDs until hardware flush and fault on failed shutdown
main-release-gate / verify-and-release (push) Failing after 3m31s
2026-10-15 13:04:05 -06:00
noah 024df31e66 Clean OS CI outputs after build and release
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 11:46:48 -06:00
noah 11c068e03e Verify BM1362 capture through shared miner work path
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 05:49:08 -06:00
noah db198c05f6 Add MIT Litecoin Scrypt share verifier
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 04:55:26 -06:00
noah 2e6bcd51a1 Accept captured BM1362 share through strict pool
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 04:28:41 -06:00
noah 9e01f2d5d3 Verify BM1362 captured share through HAL replay
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 04:20:19 -06:00
noah f1f7662afa Replay 33 captured BM1366 shares through pool
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 04:10:51 -06:00
noah b17c9826c7 Flush ASIC work before recycling job IDs
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 03:55:05 -06:00
noah 086ad87296 Verify captured BM1366 share through strict pool replay
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 03:47:35 -06:00
noah 58eeaf1dd4 Calibrate microbenchmarks and measure quality grade
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 03:17:39 -06:00
noah c7df11210a Require Git tag for completed release
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 03:08:58 -06:00
noah c48e7b616d Bind share evidence to Stratum work and improve pool polling
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 03:01:46 -06:00
noah c9e5f22d03 Verify release artifacts and keep uploads draft until complete
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 02:48:52 -06:00
noah 4cea798651 Fail closed on pool and HAL faults and bind release evidence to CI run
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 02:33:24 -06:00
noah 11adff8278 Cross-check release evidence against built target matrix
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 02:16:25 -06:00
noah ea6dbf3e6c Bound pool share replies and advance mining cycle
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 02:12:08 -06:00
noah bb8e6b3872 Track pool jobs and share replies in connection
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 01:56:45 -06:00
noah 3d7de8ffb7 Negotiate pool extensions and authorize over bounded transport
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 01:43:14 -06:00
noah 19a3408912 Add bounded Stratum TCP transport and request frames
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 01:30:43 -06:00
noah 970cf5bb9d Track Stratum jobs across ASIC work IDs
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 01:16:09 -06:00
noah a2d0365813 Convert pool difficulty to exact share targets
main-release-gate / verify-and-release (push) Failing after 1m43s
2026-10-15 01:00:43 -06:00
noah e9c3f36970 Decode Stratum pool control notifications
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 00:49:24 -06:00
noah 98e3b9d6a5 Vendor pinned Rust dependencies for offline SDK builds
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 00:14:07 -06:00
noah 5d352139dd Decode bounded Stratum V1 pool jobs
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 00:05:14 -06:00
noah d3599245f8 Format mask-checked Stratum V1 share submissions
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-15 00:00:19 -06:00
noah d1495ff2d5 Keep in-flight ASIC work across pool job changes
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 20:57:52 -06:00
noah 12c00693f8 Use Gitea-compatible pinned artifact uploads
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 20:51:09 -06:00
noah 2e88fdb937 Construct SHA-256 Stratum work headers for BM1366
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 20:24:26 -06:00
noah f49083ee96 Record private per-commit OS benchmark history
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 20:17:23 -06:00
noah 2c58237e78 Publish measured OS badges to private branch
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 20:10:42 -06:00
noah 7a7a5b1612 Ignore cancelled runs in completed CI badge
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 19:58:13 -06:00
noah 7e687e0d5d Add fail-safe BM1366 mining session
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 19:53:25 -06:00
noah c5f669b3c0 Publish branch badges from completed CI runs
main-release-gate / verify-and-release (push) Failing after 1m19s
2026-10-14 19:46:44 -06:00
noah 751d8c0bda Add reusable BM1366 work and report codec
main-release-gate / verify-and-release (push) Failing after 1m31s
2026-10-14 19:42:54 -06:00
noah 212cb30b97 Verify captured ASIC shares and probe SDK simulator
main-release-gate / verify-and-release (push) Failing after 1m19s
2026-10-14 19:37:16 -06:00
noah 3efc252059 Keep bounded HAL connections dependency free
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 19:19:26 -06:00
noah bd52429276 Bound HAL socket exchanges and validate errors
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 19:17:01 -06:00
noah a404927a78 Add versioned SDK HAL socket client
main-release-gate / verify-and-release (push) Canceled after 0s
2026-10-14 19:10:06 -06:00
11 changed files with 164 additions and 91 deletions
+7 -4
View File
@@ -1,8 +1,9 @@
name: public-benchmark-pages
on:
schedule:
- cron: '*/15 * * * *'
workflow_run:
workflows: [main-release-gate]
types: [completed]
workflow_dispatch:
concurrency:
@@ -18,8 +19,10 @@ jobs:
- uses: actions/checkout@v4
- name: Install SSH client
run: |
apt-get update -qq
apt-get install -y -qq --no-install-recommends openssh-client
if ! command -v ssh >/dev/null 2>&1; then
apt-get update -qq
apt-get install -y -qq --no-install-recommends openssh-client
fi
- name: Render measured benchmark history
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
+4 -3
View File
@@ -1,8 +1,9 @@
name: completed-ci-badge
on:
schedule:
- cron: '*/15 * * * *'
workflow_run:
workflows: [main-release-gate, next-build]
types: [completed]
workflow_dispatch:
concurrency:
@@ -11,7 +12,7 @@ concurrency:
jobs:
publish:
runs-on: alkane-ci
runs-on: alkane-fast
permissions:
actions: read
contents: write
+54
View File
@@ -0,0 +1,54 @@
name: source-pr
on:
pull_request:
branches: [main, next]
workflow_dispatch:
concurrency:
group: alkane-os-source-pr-${{ github.ref }}
cancel-in-progress: true
jobs:
source:
runs-on: alkane-fast
env:
CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect README-only change
id: surface
run: |
surface=full
if [ "$GITHUB_EVENT_NAME" = pull_request ] &&
{ [ "$GITHUB_BASE_REF" = main ] || [ "$GITHUB_BASE_REF" = next ]; } &&
base="$(git merge-base HEAD "origin/$GITHUB_BASE_REF" 2>/dev/null)" &&
changed="$(git diff --name-only "$base" HEAD)" &&
[ "$changed" = README.md ]; then
surface=documentation
fi
echo "surface=$surface" >> "$GITHUB_OUTPUT"
- name: Check README-only change
if: steps.surface.outputs.surface == 'documentation'
run: |
base="$(git merge-base HEAD "origin/$GITHUB_BASE_REF")"
git diff --check "$base" HEAD
if git grep -nIE '^[[:space:]]*-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----[[:space:]]*$' --; then
echo "private key material found in tracked source" >&2
exit 1
else
status=$?
[ "$status" -eq 1 ]
fi
- name: Check source
if: steps.surface.outputs.surface != 'documentation'
run: |
rustup component add rustfmt
cargo fmt --check
cargo test --locked
- name: Clean generated source check
if: always()
run: python3 ci/cleanup-generated.py
+12 -4
View File
@@ -22,8 +22,10 @@ jobs:
fetch-depth: 0
- name: Install Pages SSH client
run: |
apt-get update -qq
apt-get install -y -qq --no-install-recommends openssh-client
if ! command -v ssh >/dev/null 2>&1; then
apt-get update -qq
apt-get install -y -qq --no-install-recommends openssh-client
fi
- name: Install Rust quality tools
run: rustup component add rustfmt clippy
- name: Formatting
@@ -54,12 +56,18 @@ jobs:
run: |
set -o pipefail
cargo test --release --locked -- --ignored --nocapture --test-threads=1 | tee bench-current.txt
- name: Restore coverage tool
uses: actions/cache@v4
with:
path: /root/.cargo/bin/cargo-llvm-cov
key: cargo-llvm-cov-0.8.7-rust-1.97.1-${{ runner.os }}
- 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
if [ "$(cargo llvm-cov --version 2>/dev/null || true)" != 'cargo-llvm-cov 0.8.7' ]; then
cargo install --locked --force cargo-llvm-cov --version 0.8.7
fi
[ "$(cargo llvm-cov --version)" = 'cargo-llvm-cov 0.8.7' ]
- name: Unit test coverage
run: |
mkdir -p coverage
+2 -1
View File
@@ -10,9 +10,10 @@ concurrency:
jobs:
build:
runs-on: alkane-ci
runs-on: alkane-fast
env:
CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
steps:
- uses: actions/checkout@v4
with:
+31 -62
View File
@@ -10,84 +10,53 @@
![code quality](https://gitea.bluefla.re/blueflare/alkane-os/raw/branch/ci-badges/badges/quality.svg)
![license](https://gitea.bluefla.re/blueflare/alkane-os/raw/branch/ci-badges/badges/license.svg)
Mining and tuning core for Alkane control boards. The SDK builds board images
and supplies the hardware backend. Management uses SSH and an optional local,
read-only cgminer-style status endpoint; no web frontend runs on the board.
Rust mining and tuning core for Alkane control boards. The
[SDK](https://gitea.bluefla.re/blueflare/alkane-sdk) builds board images and
provides the hardware backend. The miner has no on-board web frontend.
## Status
The CLI lists target obligations with `alkane-os --list-targets`. It can also
mine through the SDK simulator HAL and a Stratum V1 pool. No production board
backend is installed.
The host miner supports BM1362 and BM1366 through the SDK's simulator HAL and
Stratum V1. Tests have replayed 33 captured BM1366 shares and one BM1362
share to a loopback pool with matching ACCEPT responses. Production board
control is still under development.
The library has a versioned Unix-socket HAL client, BM1362 and BM1366
host mining sessions, Stratum V1 job and share handling, SHA-256d share
checks, and a Litecoin Scrypt proof verifier. Its fault path requests PSU
shutdown on a sensor error. Failed shutdown faults the miner until a retry
succeeds. Work IDs stay reserved until a confirmed chain reset or PSU
shutdown. The backend still needs a power lease, an independent watchdog,
and a board-validated temperature limit.
The HAL client requests PSU shutdown on sensor faults and reserves work IDs
until a confirmed reset or shutdown. A production backend still needs a
power lease, watchdog, and validated temperature limits. SHA-256d and
Litecoin Scrypt proof verification are implemented; Scrypt chip report
handling and mining remain open.
Host tests replayed real captured nonces through the SDK HAL and a strict
loopback pool: 33 distinct BM1366 shares and one BM1362 share received
matching ACCEPT responses. The 33rd BM1366 job tested safe work-ID reuse
after a chain reset. These tests do not establish physical chain control,
stock-firmware boot, or production pool acceptance. The Scrypt verifier
matches Litecoin's
[block 29255 vector](https://github.com/litecoin-project/litecoin/wiki/Scrypt-proof-of-work);
BM1489/BM1491 report handling and L7/L9 mining remain open.
Run `alkane-os --list-targets` for the target matrix. Set `POOL_PASSWORD` to
the pool password, then mine with a simulator HAL socket and Stratum V1 pool:
For a simulator HAL socket and a Stratum V1 pool, set `ALKANE_POOL_PASSWORD`
and run `alkane-os --mine-simulator HAL_SOCKET POOL_ADDRESS WORKER BM1366`.
Select `BM1362` for that chip's captured job format. The optional argument
after the chip stops after that many accepted shares. The command
uses the simulator's 80 C temperature limit and exits on a pool or hardware
fault. The SDK HAL server must cut power when its client stalls or disconnects.
Set `ALKANE_API_LISTEN=127.0.0.1:4028` to expose read-only `summary` and
`version` commands during simulator mining. The endpoint accepts cgminer
JSON requests or plain command names and ends replies with a NUL byte.
It binds only to loopback; access from another machine through SSH. The
summary reports observed accepted/rejected shares and process state, without
an estimated hashrate. Other cgminer API commands are not yet implemented.
```sh
ALKANE_POOL_PASSWORD="$POOL_PASSWORD" alkane-os --mine-simulator HAL_SOCKET POOL_ADDRESS WORKER BM1366
```
Use `BM1362` for that chip. Set `ALKANE_API_LISTEN=127.0.0.1:4028` for
read-only `summary` and `version` commands; reach it remotely through SSH.
## Release gate
All 64 theoretical same-vendor control-board/chip pairings are required:
52 Bitmain and 12 WhatsMiner. A stock image may reject a pairing if the
simulator records its first genuine rejection gate; Alkane OS must still
mine. CI needs unmodified stock firmware, real captured silicon nonces,
pool acceptance at difficulty 1 or higher, and independent bench
validation. Bench devices provide captures and validation, not CI execution.
The gate is red. See [the evidence contract](ci/CONFORMANCE.md).
`main` runs tests, benchmarks, and conformance before release; `next` builds
release candidates. The release gate is red. It requires all 64 same-vendor
pairings (52 Bitmain, 12 WhatsMiner), unmodified stock firmware, captured
silicon nonces, difficulty-1 pool acceptance, and bench-validated models.
Stock firmware may faithfully reject a pairing; Alkane OS must mine it.
See the [evidence contract](ci/CONFORMANCE.md).
`main` runs tests, benchmarks, and conformance before release. `next`
builds release candidates. Edit `ci/version-x.txt` for a major release;
increment the minor version for mining protocol, HAL, tuning policy, or API
changes, and the patch version for compatible fixes.
Badges measure host code only. The CI badge shows the last completed branch
attempt and refreshes every 15 minutes when the runner is available.
Benchmark deltas compare results from the same CPU class. They
do not certify board images or the pairing matrix.
The [benchmark history](https://blueflare.gitea.bluefla.re/alkane-benchmarks/os/)
is readable without a Gitea login.
Badges cover host code, not board conformance. See the public
[benchmark history](https://blueflare.gitea.bluefla.re/alkane-benchmarks/os/).
## Local checks
```sh
export CARGO_TARGET_DIR=/var/tmp/alkane-os-target
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test --locked
cargo build --release --locked
CARGO_TARGET_DIR=/var/tmp/alkane-os-target cargo test --locked
```
Use an executable target directory if the source mount is `noexec`. The
conformance checker requires artifacts from a real CI run; its input format
is in [ci/CONFORMANCE.md](ci/CONFORMANCE.md). Rust dependencies are vendored
for offline SDK builds and keep their upstream licenses.
Use an executable target directory if the source mount is `noexec`.
## License
Alkane OS source is [MIT licensed](LICENSE). Vendored dependencies retain
their own licenses.
[MIT](LICENSE). Vendored dependencies keep their own licenses.
+2 -2
View File
@@ -55,8 +55,8 @@ def publish(api: str, repo: str, branch: str, data: bytes, token: str) -> None:
def main() -> None:
if os.environ["GITHUB_EVENT_NAME"] not in ("schedule", "workflow_dispatch"):
raise RuntimeError("badge publisher must run on a timer or manual dispatch")
if os.environ["GITHUB_EVENT_NAME"] not in ("workflow_run", "workflow_dispatch"):
raise RuntimeError("badge publisher must follow CI completion or manual dispatch")
if os.environ["GITHUB_REF"] != "refs/heads/main":
raise RuntimeError("badge publisher must use the main branch")
repo = os.environ["GITHUB_REPOSITORY"]
+6 -2
View File
@@ -21,8 +21,12 @@ PAGES_HOST_KEY = "[gitea.bluefla.re]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO
def run(*args: str, env: dict[str, str] | None = None,
cwd: Path | None = None) -> subprocess.CompletedProcess[str]:
return subprocess.run(args, env=env, cwd=cwd, text=True,
capture_output=True, check=True)
result = subprocess.run(args, env=env, cwd=cwd, text=True,
capture_output=True, check=False)
if result.returncode:
detail = result.stderr.strip()[:2000]
raise RuntimeError(f"{args[0]} {args[1]} exited {result.returncode}: {detail}")
return result
def current_main_sha() -> str:
+10 -4
View File
@@ -36,7 +36,7 @@ assert b">fail</text>" in svg
assert b"#d1242f" in svg
assert b">pass</text>" in module.badge("next", "success", 108)
environment = {
"GITHUB_EVENT_NAME": "schedule",
"GITHUB_EVENT_NAME": "workflow_run",
"GITHUB_REF": "refs/heads/main",
"GITHUB_REPOSITORY": "owner/repo",
"GITHUB_API_URL": "https://example.invalid/api/v1",
@@ -49,13 +49,19 @@ with patch.dict(os.environ, environment), \
module.main()
assert latest.call_count == 2
assert [call.args[2] for call in published.call_args_list] == ["main", "next"]
with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "workflow_run"}):
with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "workflow_dispatch"}), \
patch.object(module, "latest_completed", side_effect=[(201, "success"),
(202, "failure")]), \
patch.object(module, "publish") as published:
module.main()
assert published.call_count == 2
with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "schedule"}):
try:
module.main()
except RuntimeError as error:
assert "timer or manual dispatch" in str(error)
assert "CI completion or manual dispatch" in str(error)
else:
raise AssertionError("workflow_run event entered badge publisher")
raise AssertionError("scheduled event entered badge publisher")
for invalid in ("", "/main.svg", "../main.svg", "badges//main.svg"):
try:
publish_file("https://example.invalid/api/v1", "owner/repo", invalid,
+13 -4
View File
@@ -105,8 +105,12 @@ impl PoolSession {
Ok(false)
}
PoolNotification::SetVersionMask(mask) => {
if self.version_mask == Some(mask) {
return Ok(false);
}
self.version_mask = Some(mask);
Ok(false)
self.tracked = std::array::from_fn(|_| None);
Ok(true)
}
PoolNotification::SetExtranonce(subscription) => {
self.subscription = subscription;
@@ -119,7 +123,7 @@ impl PoolSession {
}
/// Apply a pool control message and invalidate the hardware miner's work
/// when an extranonce change makes earlier jobs stale.
/// when an extranonce or version-mask change makes earlier jobs stale.
pub fn control_with_miner<B: HardwareBackend>(
&mut self,
miner: &mut Bm1366Miner<'_, B>,
@@ -360,10 +364,15 @@ mod tests {
),
Err(SessionError::UnverifiedShare)
);
session.version_mask = VersionMask::new(0x0000_2000);
assert_eq!(
session.control(
b"{\"id\":null,\"method\":\"mining.set_version_mask\",\"params\":[\"00002000\"]}"
),
Ok(true)
);
assert_eq!(
session.submission(share, "miner.worker", 8),
Err(SessionError::Submit(SubmitError::UnrepresentableVersion))
Err(SessionError::StaleShare)
);
}
}
+23 -5
View File
@@ -52,9 +52,27 @@ fn difficulty_changes_on_next_job_and_old_work_keeps_its_target() {
assert_eq!(second.work_id, 8);
assert_eq!(&second.target_le[26..28], &[0xff, 0x7f]);
assert_ne!(first.header, second.header);
assert!(pool
.control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#)
.is_ok());
assert_eq!(
pool.control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#),
Ok(true)
);
assert_eq!(
pool.submission(
ValidShare {
nonce: 0xedad_ff38,
work_id: first.work_id,
rolled_version: 0x2000_0000,
hash_le: [0; 32],
},
"worker",
10,
),
Err(SessionError::StaleShare)
);
assert_eq!(
pool.control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#),
Ok(false)
);
let clean = pool.issue_notify(notify("third", true).as_bytes()).unwrap();
assert!(clean.clean_jobs);
assert_eq!(clean.work_id, 16);
@@ -201,7 +219,7 @@ impl HardwareBackend for FakeBackend {
}
#[test]
fn pool_job_dispatch_and_extranonce_invalidation_reach_the_miner() {
fn pool_job_dispatch_and_version_mask_invalidation_reach_the_miner() {
let mut backend = FakeBackend {
powered: false,
sent: 0,
@@ -226,7 +244,7 @@ fn pool_job_dispatch_and_extranonce_invalidation_reach_the_miner() {
}
pool.control_with_miner(
&mut miner,
br#"{"id":null,"method":"mining.set_extranonce","params":["aabbccdd",4]}"#,
br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#,
)
.unwrap();
assert_eq!(miner.poll(), Err(MinerError::StaleReport));