Skip to content

feat(control): add mining program restart without a reboot - #418

Merged
b-rowan merged 3 commits into
256foundation:masterfrom
dmgblockchain:HELM-5514-feat-restart-mining
Oct 20, 2026
Merged

b-rowan merged 3 commits into
256foundation:masterfrom
dmgblockchain:HELM-5514-feat-restart-mining

Conversation

@cryptographicturk

@cryptographicturk cryptographicturk commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pyasic has restart_backend(), which restarts the mining program without rebooting the operating system. asic-rs only has restart(), a full device reboot, so callers moving from pyasic lose that action. This adds it.

  • New RestartMining trait with restart_mining() and supports_restart_mining(), unsupported by default, added to HasMinerControl. It follows the shape of Restart / Pause / Resume.
  • Python: await miner.restart_mining() and miner.supports_restart_mining, with regenerated stubs.
  • C FFI: asic_rs_miner_restart_mining and a restart_mining capability flag.
  • Go: Miner.RestartMining() and Supports.RestartMining.
  • Docs: a "Restart Mining" column in the supported-devices matrix and a row in docs/api.md.

A rejected request is returned as an error carrying the firmware's own message, not as false.

Backends

Firmware Request Evidence
Braiins OS+ 25.07 / 26.04 backends PUT /api/v1/actions/restart Confirmed present in the device's own OpenAPI document on two newer Braiins OS+ releases, and in the vendored meta/braiins documents ("Restarts mining", distinct from actions/reboot)
ePIC UMC POST /softreboot with {"param": null, "password": ...} Confirmed present in the device's own OpenAPI document, and in the vendored meta/epic documents
Braiins OS+ 21.09 / 25.03 / 25.05 backends GraphQL bosminer { restart } Same mutation set_pools_config already sends; not confirmed on a device
VNish 1.2 / 1.3 POST /api/v1/mining/restart From pyasic and the vendored meta/vnish documents; not confirmed on a device
Auradine POST /restart with parameter gcminer From pyasic; not confirmed on a device
LuxOS RPC resetminer From pyasic; not confirmed on a device

Every other backend reports unsupported, including AntMiner stock (pyasic returns False there too).

If you would prefer a smaller first PR, I am happy to drop the four unconfirmed backends and send them as a follow-up.

Testing

  • cargo fmt --all -- --check
  • cargo test --all --locked --exclude asic-rs-pydantic --exclude asic-rs-pydantic-macros --exclude pyasic-rs --exclude asic-rs-ffi: 418 passed (rebased onto current master, rustc 1.99.1)
  • cargo test -p asic-rs-ffi --locked -- --test-threads=1: 11 passed
  • Python tests after maturin develop --features python --extras test: 126 passed
  • Go tests were not run locally.

This adds 19 mocked tests (request sent and error path per firmware, and the FFI error path). They are mocked tests only: no endpoint here has been exercised on real hardware. Whether each one keeps the operating system up, and how long mining is down afterwards, has not been measured.

Some of the new tests live in restart_mining_tests.rs files beside the Braiins and LuxOS backends rather than in the existing tests module, to stay clear of other open changes to those modules. I can fold them in if you prefer.

Unrelated observation

Not changed by this PR: on VNish, the existing restart() calls mining/restart rather than system/reboot, so it restarts mining instead of rebooting the device, and restart() and restart_mining() currently reach the same endpoint there.

🤖 Generated with Claude Code

@b-rowan b-rowan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just drop a couple of redundant tests, looks good other than that.

Comment thread asic-rs-firmwares/antminer/src/backends/v2020/restart_mining_tests.rs Outdated
Comment thread asic-rs-firmwares/antminer/src/backends/v2023_07/mod.rs Outdated
Comment thread asic-rs-firmwares/antminer/src/backends/v2020/mod.rs Outdated
Comment thread asic-rs-firmwares/antminer/src/backends/v2023_07/restart_mining_tests.rs Outdated
cryptographicturk and others added 3 commits October 20, 2026 14:43
`Restart` reboots the whole device. Several firmwares can also restart
only the mining program, which keeps the OS up and returns to hashing
sooner, and pyasic exposes that as `restart_backend()`. asic-rs had no
equivalent, so callers moving off pyasic lost the action.

Add a `RestartMining` trait (`restart_mining()`,
`supports_restart_mining()`, unsupported by default) to
`HasMinerControl`, and implement it where the firmware has a dedicated
endpoint:

- Braiins OS+ 25.07 / 26.04: `PUT /api/v1/actions/restart`
- Braiins OS+ 21.09 / 25.03 / 25.05: GraphQL `bosminer { restart }`
- ePIC UMC: `POST /softreboot`
- VNish 1.2 / 1.3: `POST /api/v1/mining/restart`
- Auradine: `POST /restart` with parameter `gcminer`
- LuxOS: RPC `resetminer`

Every other backend, including AntMiner stock, reports unsupported.
Rejections are returned as errors carrying the firmware's own message
rather than being collapsed into `false`.

Expose the control as `restart_mining()` / `supports_restart_mining` in
the Python bindings and stubs, `asic_rs_miner_restart_mining` and the
`restart_mining` capability flag in the C FFI, and `RestartMining()` in
Go, and add a Restart Mining column to the supported-devices matrix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Both backends were added upstream after this branch was cut and need the
trait impl now that RestartMining is part of HasMinerControl. Both report
unsupported.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cryptographicturk
cryptographicturk force-pushed the HELM-5514-feat-restart-mining branch from d7e20ee to f1663ae Compare October 20, 2026 21:51
@cryptographicturk

Copy link
Copy Markdown
Contributor Author

@b-rowan Dropped the two AntMiner restart_mining_tests.rs files along with their mod declarations, and rebased onto master to resolve the conflict with #419. The Braiins backends merged cleanly, so #419's error propagation is kept alongside restart_mining. The only textual conflict was the support matrix in docs/supported-devices.md. Forgeaxe and AntMiner v2018 landed after this branch was cut, so they now have the default RestartMining impl too. fmt and tests pass locally (418 passed). Clippy already fails on master in asic-rs-core (35 existing errors), so I linted the rest with those lints allowed. Mocked tests only; not run against real miners.

@b-rowan
b-rowan merged commit 56a6094 into 256foundation:master Oct 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants