Repository navigation
feat(control): add mining program restart without a reboot - #418
Conversation
b-rowan
left a comment
There was a problem hiding this comment.
Just drop a couple of redundant tests, looks good other than that.
`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>
d7e20ee to
f1663ae
Compare
|
@b-rowan Dropped the two AntMiner |
Summary
pyasic has
restart_backend(), which restarts the mining program without rebooting the operating system. asic-rs only hasrestart(), a full device reboot, so callers moving from pyasic lose that action. This adds it.RestartMiningtrait withrestart_mining()andsupports_restart_mining(), unsupported by default, added toHasMinerControl. It follows the shape ofRestart/Pause/Resume.await miner.restart_mining()andminer.supports_restart_mining, with regenerated stubs.asic_rs_miner_restart_miningand arestart_miningcapability flag.Miner.RestartMining()andSupports.RestartMining.docs/api.md.A rejected request is returned as an error carrying the firmware's own message, not as
false.Backends
PUT /api/v1/actions/restartmeta/braiinsdocuments ("Restarts mining", distinct fromactions/reboot)POST /softrebootwith{"param": null, "password": ...}meta/epicdocumentsbosminer { restart }set_pools_configalready sends; not confirmed on a devicePOST /api/v1/mining/restartmeta/vnishdocuments; not confirmed on a devicePOST /restartwith parametergcminerresetminerEvery other backend reports unsupported, including AntMiner stock (pyasic returns
Falsethere 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 -- --checkcargo 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 passedmaturin develop --features python --extras test: 126 passedThis 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.rsfiles beside the Braiins and LuxOS backends rather than in the existingtestsmodule, 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()callsmining/restartrather thansystem/reboot, so it restarts mining instead of rebooting the device, andrestart()andrestart_mining()currently reach the same endpoint there.🤖 Generated with Claude Code