Compare commits

..
Author SHA1 Message Date
noah be0a57a1d9 Publish benchmark Pages on the standing Alkane runner
next-build / build (push) Successful in 15s
2026-10-17 01:17:56 -06:00
noah 8bdcd8fb83 Pin benchmark Pages SSH host key
next-build / build (push) Successful in 15s
2026-10-17 01:05:04 -06:00
noah 885a4571ff Make wrong-sequence HAL test stop after rejected header
next-build / build (push) Successful in 12s
2026-10-16 23:02:56 -06:00
noah e746efcb94 Bound management request lifetime
next-build / build (push) Successful in 12s
2026-10-16 21:04:27 -06:00
noah 16c9d4962a Add local read-only mining status API
next-build / build (push) Canceled after 0s
2026-10-16 21:03:40 -06:00
noah 283287f74f Benchmark captured BM1366 report poll path
next-build / build (push) Canceled after 0s
2026-10-16 17:02:10 -06:00
noah 98f3eb75c0 Benchmark BM13xx protocol checksums
next-build / build (push) Canceled after 0s
2026-10-16 14:06:25 -06:00
noah 853cb845ff Benchmark HAL and Stratum socket exchanges
next-build / build (push) Canceled after 0s
2026-10-16 11:06:59 -06:00
noah e9a3c3a669 Benchmark BM1362 work and Stratum handshake paths
next-build / build (push) Canceled after 0s
2026-10-16 09:02:45 -06:00
noah 895081e509 Validate public benchmark page before upload
next-build / build (push) Canceled after 0s
2026-10-16 08:47:19 -06:00
noah b76b74cb63 Describe selected BM13xx host mining formats
next-build / build (push) Canceled after 0s
2026-10-16 08:12:51 -06:00
noah 289ad40d86 Select BM1362 work encoding for captured replay
next-build / build (push) Canceled after 0s
2026-10-16 08:11:46 -06:00
noah f0c9d4d904 Set captured midstate count in BM1366 work
next-build / build (push) Canceled after 0s
2026-10-16 08:03:40 -06:00
noah f6b5df831e Publish OS benchmarks to public Pages site
next-build / build (push) Canceled after 0s
2026-10-16 07:19:41 -06:00
noah d1d7c576cf Bound queued OS CI attempts per branch
next-build / build (push) Canceled after 0s
2026-10-16 07:08:18 -06:00
noah 8d19cdeae6 Schedule CI badge refresh without workflow recursion
next-build / build (push) Successful in 18s
2026-10-16 07:03:17 -06:00
noah 52e6093011 Require complete OS microbenchmark measurements
next-build / build (push) Successful in 18s
2026-10-16 05:02:08 -06:00
noah 7fd9c8eee3 Keep buffered Stratum partial line deadline across drains
next-build / build (push) Successful in 13s
2026-10-16 04:01:56 -06:00
noah f302bbbb24 Attach OS quality gate evidence to metrics
next-build / build (push) Successful in 14s
2026-10-16 02:06:01 -06:00
noah b22b494ede Grade OS code quality from static checks
next-build / build (push) Successful in 15s
2026-10-16 02:02:53 -06:00
noah 6c23ce847d Coalesce pending CI badge updates
next-build / build (push) Successful in 15s
2026-10-16 01:02:52 -06:00
noah 6a466a611f Reject invalid BM1362 geometry and baud requests
next-build / build (push) Successful in 18s
2026-10-15 22:07:45 -06:00
noah 1300d7e372 Benchmark BM1362 frame encoding
next-build / build (push) Successful in 18s
2026-10-15 22:06:01 -06:00
noah 66e4f3d47a Add Rust BM1362 wire frame encoders
next-build / build (push) Successful in 18s
2026-10-15 22:04:07 -06:00
noah 37028cc3eb Verify Litecoin Scrypt shares in conformance gate
next-build / build (push) Successful in 18s
2026-10-15 21:05:08 -06:00
noah 0e6fd9269b Add simulator mining command to Alkane OS
next-build / build (push) Canceled after 0s
2026-10-15 18:22:49 -06:00
noah 3d63bbb3eb Set Rust-first core implementation policy
next-build / build (push) Canceled after 0s
2026-10-15 14:46:30 -06:00
noah 5d8f14c992 Shorten OS README to scope and release gates
next-build / build (push) Canceled after 0s
2026-10-15 14:37:04 -06:00
noah 6f87f48dca Document miner work ID and shutdown guards
next-build / build (push) Successful in 10s
2026-10-15 13:04:51 -06:00
noah 7d398caa66 Reserve ASIC work IDs until hardware flush and fault on failed shutdown
next-build / build (push) Successful in 16s
2026-10-15 13:04:14 -06:00
noah 96dd7bf6d2 Clean OS CI outputs after build and release
next-build / build (push) Canceled after 0s
2026-10-15 11:48:14 -06:00
noah 59249d44d3 Verify BM1362 capture through shared miner work path
next-build / build (push) Canceled after 0s
2026-10-15 05:50:00 -06:00
noah f011557cd5 Add MIT Litecoin Scrypt share verifier
next-build / build (push) Canceled after 0s
2026-10-15 04:56:39 -06:00
noah d52996c02a Accept captured BM1362 share through strict pool
next-build / build (push) Canceled after 0s
2026-10-15 04:28:46 -06:00
noah b59aa8d9c1 Verify BM1362 captured share through HAL replay
next-build / build (push) Canceled after 0s
2026-10-15 04:20:29 -06:00
noah 523ec5fd0b Replay 33 captured BM1366 shares through pool
next-build / build (push) Canceled after 0s
2026-10-15 04:11:00 -06:00
noah a1d8e34390 Flush ASIC work before recycling job IDs
next-build / build (push) Canceled after 0s
2026-10-15 03:55:13 -06:00
noah 2d6233cdc7 Verify captured BM1366 share through strict pool replay
next-build / build (push) Canceled after 0s
2026-10-15 03:47:59 -06:00
noah eb9dcf830b Calibrate microbenchmarks and measure quality grade
next-build / build (push) Canceled after 0s
2026-10-15 03:17:58 -06:00
noah af49d4905d Require Git tag for completed release
next-build / build (push) Canceled after 0s
2026-10-15 03:09:11 -06:00
noah 8fa9e5d9e6 Bind share evidence to Stratum work and improve pool polling
next-build / build (push) Canceled after 0s
2026-10-15 03:07:16 -06:00
noah 492fe68c9e Verify release artifacts and keep uploads draft until complete
next-build / build (push) Canceled after 0s
2026-10-15 02:49:03 -06:00
noah f215cb3196 Fail closed on pool and HAL faults and bind release evidence to CI run
next-build / build (push) Canceled after 0s
2026-10-15 02:33:33 -06:00
noah 6e3b798273 Cross-check release evidence against built target matrix
next-build / build (push) Canceled after 0s
2026-10-15 02:16:34 -06:00
noah 16b55b58e3 Bound pool share replies and advance mining cycle
next-build / build (push) Canceled after 0s
2026-10-15 02:12:19 -06:00
noah 90a2fe12d5 Track pool jobs and share replies in connection
next-build / build (push) Canceled after 0s
2026-10-15 01:56:55 -06:00
noah bc38a4a787 Negotiate pool extensions and authorize over bounded transport
next-build / build (push) Canceled after 0s
2026-10-15 01:44:12 -06:00
noah 654b205e00 Add bounded Stratum TCP transport and request frames
next-build / build (push) Canceled after 0s
2026-10-15 01:31:33 -06:00
noah ece32ef55f Track Stratum jobs across ASIC work IDs
next-build / build (push) Canceled after 0s
2026-10-15 01:16:19 -06:00
noah 5cd77eb5de Convert pool difficulty to exact share targets
next-build / build (push) Successful in 11s
2026-10-15 01:00:53 -06:00
noah e7a23faa5a Decode Stratum pool control notifications
next-build / build (push) Canceled after 0s
2026-10-15 00:49:35 -06:00
noah e0f9b1ab50 Vendor pinned Rust dependencies for offline SDK builds
next-build / build (push) Canceled after 0s
2026-10-15 00:15:24 -06:00
noah 323e45ab0e Decode bounded Stratum V1 pool jobs
next-build / build (push) Canceled after 0s
2026-10-15 00:05:19 -06:00
noah 6fd329e047 Format mask-checked Stratum V1 share submissions
next-build / build (push) Canceled after 0s
2026-10-15 00:00:22 -06:00
noah 7d602d2f03 Keep in-flight ASIC work across pool job changes
next-build / build (push) Canceled after 0s
2026-10-14 20:57:56 -06:00
noah 78b9416985 Use Gitea-compatible pinned artifact uploads
next-build / build (push) Canceled after 0s
2026-10-14 20:51:16 -06:00
noah d2afef19a9 Construct SHA-256 Stratum work headers for BM1366
next-build / build (push) Canceled after 0s
2026-10-14 20:24:34 -06:00
noah e67ffcd204 Record private per-commit OS benchmark history
next-build / build (push) Canceled after 0s
2026-10-14 20:17:31 -06:00
noah 6cf9ed1620 Publish measured OS badges to private branch
next-build / build (push) Canceled after 0s
2026-10-14 20:11:09 -06:00
noah 4f21677ae5 Ignore cancelled runs in completed CI badge
next-build / build (push) Canceled after 0s
2026-10-14 19:58:25 -06:00
noah 9f7d8ebb51 Add fail-safe BM1366 mining session
next-build / build (push) Canceled after 0s
2026-10-14 19:53:40 -06:00
noah 81d726cca2 Publish branch badges from completed CI runs
next-build / build (push) Successful in 11s
2026-10-14 19:47:07 -06:00
noah 74ba049b5c Add reusable BM1366 work and report codec
next-build / build (push) Successful in 10s
2026-10-14 19:43:06 -06:00
noah 46a4f58019 Verify captured ASIC shares and probe SDK simulator
next-build / build (push) Successful in 13s
2026-10-14 19:37:38 -06:00
noah e9d7200a05 Keep bounded HAL connections dependency free
next-build / build (push) Canceled after 0s
2026-10-14 19:19:37 -06:00
noah 544711885e Bound HAL socket exchanges and validate errors
next-build / build (push) Canceled after 0s
2026-10-14 19:17:12 -06:00
noah 7d3cebea79 Add versioned SDK HAL socket client
next-build / build (push) Canceled after 0s
2026-10-14 19:10:17 -06:00
noah 1ce22d9d9f Merge branch 'main' into next
next-build / build (push) Successful in 9s
2026-10-13 11:59:47 -06:00
noah 4eef88b5df Point next CI badge at next attempts
next-build / build (push) Successful in 8s
2026-10-13 11:46:20 -06:00
11 changed files with 91 additions and 164 deletions
+4 -7
View File
@@ -1,9 +1,8 @@
name: public-benchmark-pages name: public-benchmark-pages
on: on:
workflow_run: schedule:
workflows: [main-release-gate] - cron: '*/15 * * * *'
types: [completed]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
@@ -19,10 +18,8 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install SSH client - name: Install SSH client
run: | run: |
if ! command -v ssh >/dev/null 2>&1; then apt-get update -qq
apt-get update -qq apt-get install -y -qq --no-install-recommends openssh-client
apt-get install -y -qq --no-install-recommends openssh-client
fi
- name: Render measured benchmark history - name: Render measured benchmark history
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
+3 -4
View File
@@ -1,9 +1,8 @@
name: completed-ci-badge name: completed-ci-badge
on: on:
workflow_run: schedule:
workflows: [main-release-gate, next-build] - cron: '*/15 * * * *'
types: [completed]
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
@@ -12,7 +11,7 @@ concurrency:
jobs: jobs:
publish: publish:
runs-on: alkane-fast runs-on: alkane-ci
permissions: permissions:
actions: read actions: read
contents: write contents: write
-54
View File
@@ -1,54 +0,0 @@
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
+4 -12
View File
@@ -22,10 +22,8 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Install Pages SSH client - name: Install Pages SSH client
run: | run: |
if ! command -v ssh >/dev/null 2>&1; then apt-get update -qq
apt-get update -qq apt-get install -y -qq --no-install-recommends openssh-client
apt-get install -y -qq --no-install-recommends openssh-client
fi
- name: Install Rust quality tools - name: Install Rust quality tools
run: rustup component add rustfmt clippy run: rustup component add rustfmt clippy
- name: Formatting - name: Formatting
@@ -56,18 +54,12 @@ jobs:
run: | run: |
set -o pipefail set -o pipefail
cargo test --release --locked -- --ignored --nocapture --test-threads=1 | tee bench-current.txt 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 - name: Coverage tool
run: | run: |
rustup component add llvm-tools-preview rustup component add llvm-tools-preview
if [ "$(cargo llvm-cov --version 2>/dev/null || true)" != 'cargo-llvm-cov 0.8.7' ]; then if ! command -v cargo-llvm-cov >/dev/null 2>&1; then
cargo install --locked --force cargo-llvm-cov --version 0.8.7 cargo install --locked cargo-llvm-cov --version 0.8.7
fi fi
[ "$(cargo llvm-cov --version)" = 'cargo-llvm-cov 0.8.7' ]
- name: Unit test coverage - name: Unit test coverage
run: | run: |
mkdir -p coverage mkdir -p coverage
+1 -2
View File
@@ -10,10 +10,9 @@ concurrency:
jobs: jobs:
build: build:
runs-on: alkane-fast runs-on: alkane-ci
env: env:
CARGO_TARGET_DIR: target CARGO_TARGET_DIR: target
CARGO_BUILD_JOBS: 2
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
+62 -31
View File
@@ -10,53 +10,84 @@
![code quality](https://gitea.bluefla.re/blueflare/alkane-os/raw/branch/ci-badges/badges/quality.svg) ![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) ![license](https://gitea.bluefla.re/blueflare/alkane-os/raw/branch/ci-badges/badges/license.svg)
Rust mining and tuning core for Alkane control boards. The Mining and tuning core for Alkane control boards. The SDK builds board images
[SDK](https://gitea.bluefla.re/blueflare/alkane-sdk) builds board images and and supplies the hardware backend. Management uses SSH and an optional local,
provides the hardware backend. The miner has no on-board web frontend. read-only cgminer-style status endpoint; no web frontend runs on the board.
## Status ## Status
The host miner supports BM1362 and BM1366 through the SDK's simulator HAL and The CLI lists target obligations with `alkane-os --list-targets`. It can also
Stratum V1. Tests have replayed 33 captured BM1366 shares and one BM1362 mine through the SDK simulator HAL and a Stratum V1 pool. No production board
share to a loopback pool with matching ACCEPT responses. Production board backend is installed.
control is still under development.
The HAL client requests PSU shutdown on sensor faults and reserves work IDs The library has a versioned Unix-socket HAL client, BM1362 and BM1366
until a confirmed reset or shutdown. A production backend still needs a host mining sessions, Stratum V1 job and share handling, SHA-256d share
power lease, watchdog, and validated temperature limits. SHA-256d and checks, and a Litecoin Scrypt proof verifier. Its fault path requests PSU
Litecoin Scrypt proof verification are implemented; Scrypt chip report shutdown on a sensor error. Failed shutdown faults the miner until a retry
handling and mining remain open. 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.
Run `alkane-os --list-targets` for the target matrix. Set `POOL_PASSWORD` to Host tests replayed real captured nonces through the SDK HAL and a strict
the pool password, then mine with a simulator HAL socket and Stratum V1 pool: 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.
```sh For a simulator HAL socket and a Stratum V1 pool, set `ALKANE_POOL_PASSWORD`
ALKANE_POOL_PASSWORD="$POOL_PASSWORD" alkane-os --mine-simulator HAL_SOCKET POOL_ADDRESS WORKER BM1366 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
Use `BM1362` for that chip. Set `ALKANE_API_LISTEN=127.0.0.1:4028` for uses the simulator's 80 C temperature limit and exits on a pool or hardware
read-only `summary` and `version` commands; reach it remotely through SSH. 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.
## Release gate ## Release gate
`main` runs tests, benchmarks, and conformance before release; `next` builds All 64 theoretical same-vendor control-board/chip pairings are required:
release candidates. The release gate is red. It requires all 64 same-vendor 52 Bitmain and 12 WhatsMiner. A stock image may reject a pairing if the
pairings (52 Bitmain, 12 WhatsMiner), unmodified stock firmware, captured simulator records its first genuine rejection gate; Alkane OS must still
silicon nonces, difficulty-1 pool acceptance, and bench-validated models. mine. CI needs unmodified stock firmware, real captured silicon nonces,
Stock firmware may faithfully reject a pairing; Alkane OS must mine it. pool acceptance at difficulty 1 or higher, and independent bench
See the [evidence contract](ci/CONFORMANCE.md). validation. Bench devices provide captures and validation, not CI execution.
The gate is red. See [the evidence contract](ci/CONFORMANCE.md).
Badges cover host code, not board conformance. See the public `main` runs tests, benchmarks, and conformance before release. `next`
[benchmark history](https://blueflare.gitea.bluefla.re/alkane-benchmarks/os/). 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.
## Local checks ## Local checks
```sh ```sh
CARGO_TARGET_DIR=/var/tmp/alkane-os-target cargo test --locked 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
``` ```
Use an executable target directory if the source mount is `noexec`. 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.
## License ## License
[MIT](LICENSE). Vendored dependencies keep their own licenses. Alkane OS source is [MIT licensed](LICENSE). Vendored dependencies retain
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: def main() -> None:
if os.environ["GITHUB_EVENT_NAME"] not in ("workflow_run", "workflow_dispatch"): if os.environ["GITHUB_EVENT_NAME"] not in ("schedule", "workflow_dispatch"):
raise RuntimeError("badge publisher must follow CI completion or manual dispatch") raise RuntimeError("badge publisher must run on a timer or manual dispatch")
if os.environ["GITHUB_REF"] != "refs/heads/main": if os.environ["GITHUB_REF"] != "refs/heads/main":
raise RuntimeError("badge publisher must use the main branch") raise RuntimeError("badge publisher must use the main branch")
repo = os.environ["GITHUB_REPOSITORY"] repo = os.environ["GITHUB_REPOSITORY"]
+2 -6
View File
@@ -21,12 +21,8 @@ PAGES_HOST_KEY = "[gitea.bluefla.re]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO
def run(*args: str, env: dict[str, str] | None = None, def run(*args: str, env: dict[str, str] | None = None,
cwd: Path | None = None) -> subprocess.CompletedProcess[str]: cwd: Path | None = None) -> subprocess.CompletedProcess[str]:
result = subprocess.run(args, env=env, cwd=cwd, text=True, return subprocess.run(args, env=env, cwd=cwd, text=True,
capture_output=True, check=False) capture_output=True, check=True)
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: def current_main_sha() -> str:
+4 -10
View File
@@ -36,7 +36,7 @@ assert b">fail</text>" in svg
assert b"#d1242f" in svg assert b"#d1242f" in svg
assert b">pass</text>" in module.badge("next", "success", 108) assert b">pass</text>" in module.badge("next", "success", 108)
environment = { environment = {
"GITHUB_EVENT_NAME": "workflow_run", "GITHUB_EVENT_NAME": "schedule",
"GITHUB_REF": "refs/heads/main", "GITHUB_REF": "refs/heads/main",
"GITHUB_REPOSITORY": "owner/repo", "GITHUB_REPOSITORY": "owner/repo",
"GITHUB_API_URL": "https://example.invalid/api/v1", "GITHUB_API_URL": "https://example.invalid/api/v1",
@@ -49,19 +49,13 @@ with patch.dict(os.environ, environment), \
module.main() module.main()
assert latest.call_count == 2 assert latest.call_count == 2
assert [call.args[2] for call in published.call_args_list] == ["main", "next"] assert [call.args[2] for call in published.call_args_list] == ["main", "next"]
with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "workflow_dispatch"}), \ with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "workflow_run"}):
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: try:
module.main() module.main()
except RuntimeError as error: except RuntimeError as error:
assert "CI completion or manual dispatch" in str(error) assert "timer or manual dispatch" in str(error)
else: else:
raise AssertionError("scheduled event entered badge publisher") raise AssertionError("workflow_run event entered badge publisher")
for invalid in ("", "/main.svg", "../main.svg", "badges//main.svg"): for invalid in ("", "/main.svg", "../main.svg", "badges//main.svg"):
try: try:
publish_file("https://example.invalid/api/v1", "owner/repo", invalid, publish_file("https://example.invalid/api/v1", "owner/repo", invalid,
+4 -13
View File
@@ -105,12 +105,8 @@ impl PoolSession {
Ok(false) Ok(false)
} }
PoolNotification::SetVersionMask(mask) => { PoolNotification::SetVersionMask(mask) => {
if self.version_mask == Some(mask) {
return Ok(false);
}
self.version_mask = Some(mask); self.version_mask = Some(mask);
self.tracked = std::array::from_fn(|_| None); Ok(false)
Ok(true)
} }
PoolNotification::SetExtranonce(subscription) => { PoolNotification::SetExtranonce(subscription) => {
self.subscription = subscription; self.subscription = subscription;
@@ -123,7 +119,7 @@ impl PoolSession {
} }
/// Apply a pool control message and invalidate the hardware miner's work /// Apply a pool control message and invalidate the hardware miner's work
/// when an extranonce or version-mask change makes earlier jobs stale. /// when an extranonce change makes earlier jobs stale.
pub fn control_with_miner<B: HardwareBackend>( pub fn control_with_miner<B: HardwareBackend>(
&mut self, &mut self,
miner: &mut Bm1366Miner<'_, B>, miner: &mut Bm1366Miner<'_, B>,
@@ -364,15 +360,10 @@ mod tests {
), ),
Err(SessionError::UnverifiedShare) Err(SessionError::UnverifiedShare)
); );
assert_eq!( session.version_mask = VersionMask::new(0x0000_2000);
session.control(
b"{\"id\":null,\"method\":\"mining.set_version_mask\",\"params\":[\"00002000\"]}"
),
Ok(true)
);
assert_eq!( assert_eq!(
session.submission(share, "miner.worker", 8), session.submission(share, "miner.worker", 8),
Err(SessionError::StaleShare) Err(SessionError::Submit(SubmitError::UnrepresentableVersion))
); );
} }
} }
+5 -23
View File
@@ -52,27 +52,9 @@ fn difficulty_changes_on_next_job_and_old_work_keeps_its_target() {
assert_eq!(second.work_id, 8); assert_eq!(second.work_id, 8);
assert_eq!(&second.target_le[26..28], &[0xff, 0x7f]); assert_eq!(&second.target_le[26..28], &[0xff, 0x7f]);
assert_ne!(first.header, second.header); assert_ne!(first.header, second.header);
assert_eq!( assert!(pool
pool.control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#), .control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#)
Ok(true) .is_ok());
);
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(); let clean = pool.issue_notify(notify("third", true).as_bytes()).unwrap();
assert!(clean.clean_jobs); assert!(clean.clean_jobs);
assert_eq!(clean.work_id, 16); assert_eq!(clean.work_id, 16);
@@ -219,7 +201,7 @@ impl HardwareBackend for FakeBackend {
} }
#[test] #[test]
fn pool_job_dispatch_and_version_mask_invalidation_reach_the_miner() { fn pool_job_dispatch_and_extranonce_invalidation_reach_the_miner() {
let mut backend = FakeBackend { let mut backend = FakeBackend {
powered: false, powered: false,
sent: 0, sent: 0,
@@ -244,7 +226,7 @@ fn pool_job_dispatch_and_version_mask_invalidation_reach_the_miner() {
} }
pool.control_with_miner( pool.control_with_miner(
&mut miner, &mut miner,
br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#, br#"{"id":null,"method":"mining.set_extranonce","params":["aabbccdd",4]}"#,
) )
.unwrap(); .unwrap();
assert_eq!(miner.poll(), Err(MinerError::StaleReport)); assert_eq!(miner.poll(), Err(MinerError::StaleReport));