9.1 KiB
HANDOFF — alkane-toolkit
For: resuming this work in Claude Code (or any fresh agent session).
Read order: this file → docs/IMPLEMENTATION-PLAN.md → docs/UI-SPEC.md → docs/adr/000{1,2,3}*.md → README.md.
Parent project: ~/Ultron/projects/miner-firmware/ (its HANDOFF.md, AGENTS.md and MEMORY-SNAPSHOT/ hold the bench context and standing orders — read them before touching real hardware).
1. What this repo is
alkane-toolkit = cross-platform desktop toolkit (pure-Rust GUI on wxWidgets)
to install stock or alkaneOS on ASIC miner control boards, whatever they
currently run. Sibling repo ~/Ultron/projects/miner-firmware/alkane-sdk/
owns the board doctrine (docs/install-methods.md = the invariants) and the
board metadata (boards/*/board.yml); this toolkit mechanizes those recipes.
- Remote:
https://gitea.bluefla.re/blueflare/alkane-toolkit(private, branchmain, tipb264cdd6) - GitHub is DEAD (account suspended): never touch github remotes; old ones are kept as
github-suspendedin sibling clones - Gitea auth: token in
~/.config/gitea/token, askpass helper~/.config/gitea/askpass(usernoah, admin). For git:export GIT_ASKPASS=~/.config/gitea/askpass GIT_TERMINAL_PROMPT=0
2. Current state (2026-09-15)
Ships today (M1 primary view):
- Discovery via vendored asic-rs 0.8.1 (MinerFactory::scan_stream over the configured CIDR list)
- UI-SPEC primary view: 6 KPIs (Total/Hashing/Slow/Not hashing/total hashrate/est. power), scan-ranges editor, Excel-style filter panel, columns panel, sortable + drag-reorderable table with row checkboxes, IP pinned first, default order hashrate → power → chip temp → cooling → firmware → pool worker → model/status
- Pure-Rust GUI on wxWidgets: vendored wx-rs 0.2.0 extended by patches (upstream stubs Linux and had no widgets) + vendored wxWidgets 3.3.3 (static monolithic GTK3)
- Built + smoke-tested on this machine (debug + release run clean under xvfb)
Not done yet (open threads, in rough priority):
- Windows + macOS builds —
scripts/build-gui-{windows,macos}.shexist; Windows needs msys2/MSVC (wx-rs build.rs handles msys2 paths natively), macOS needs a Mac to link. Consider a gitea Actions CI runner. No CI config exists at all yet. - ARP/ICMP pre-pass for link-up-but-silent boards (M1 scope, spec'd in plan §5, not implemented)
- Column order/visibility persistence (
ui.conf— spec'd in UI-SPEC "Implementation notes", not implemented) - Sort-direction indicator in headers; per-model "Slow" bands (currently flat 80% of expected); model-derived power estimates for units that don't report wattage
- M2: verify-image port (magic/min-size/integrity) + artifact registry expansion (
crates/alkane-artifacts/data/manifest-seed.csv= 14 sha256'd bench artifacts; bulk archives 3.7GB/624MB not hashed) - M3+: first install pathway (zynq-7010 stock↔stock, proven on the bench S17), then per plan §7. Note no alkaneOS build exists (SDK boards all "bake"), so installs are stock↔stock only until the SDK produces artifacts.
3. How to build / run (this machine)
cd ~/Ultron/projects/miner-firmware/alkane-toolkit
scripts/build-wx-linux.sh # once: wx 3.3.3 → ~/.cache/wx-3.3.3-linux (out-of-tree)
scripts/build-gui-linux.sh # release build (needs WX_RS_WXCONFIG, script sets it)
/usr/local/bin/alkane-toolkit # installed binary; or ~/.cache/alkane-tk-target/release/alkane-toolkit
Needs a display (user's desktop session has DISPLAY=:0). Headless smoke test:
timeout 15 xvfb-run -a /usr/local/bin/alkane-toolkit — rc 124 = ran until killed (good), rc 139 = crash.
4. Machine quirks (these cost hours — don't re-learn them)
- The synced project mount is noexec for newly-written files: never build or execute anything inside the repo tree. wx builds go to
~/.cache/wxbuild, cargo target to~/.cache/alkane-tk-target(set machine-locally via~/.cargo/config.toml, NOT committed). cargo vendor vendorDELETES unmanaged directories under vendor/. Hand-made trees live inthirdparty/(wxwidgets, wx-rs). Only cargo-managed crate sources are invendor/(341 crates; offline builds via committed.cargo/config.toml).- /tmp tmpfs is 100% full (bench artifacts live there — do not clean). Build outputs must not go to /tmp.
- The FS is very slow for many-file operations:
git addof thirdparty/wxwidgets (~10k files) takes ~20 min; extraction of the wx tarball will blow a 120 s timeout. Run big FS operations as background jobs and poll. - sudo:
sudo -S -p '' <cmd> < ~/.sudopass(non-interactive). - Rust 1.97.1, cargo, gdb, xvfb-run, mingw-w64, gtk3 dev, pcre2 dev all installed.
5. Architecture map
crates/
alkane-core/ domain types (stub — next milestone fills it)
alkane-discovery/ asic-rs dependency wired (engine lives in alkane-gui/scan.rs today)
alkane-access/ stub (SSH/foothold layer, M3+)
alkane-flash/ stub (write/verify engines, M3+)
alkane-artifacts/ manifest-seed.csv (14 artifacts w/ sha256)
alkane-cli/ stub bin
alkane-gui/ THE APP (bin "alkane-toolkit"): main.rs, model.rs, scan.rs, ui.rs
thirdparty/
wxwidgets/wxWidgets-3.3.3/ pristine dist tarball tree (+ VERSION sha256, patches/ empty)
wx-rs/wx-rs-0.2.0-patched/ the used crate (path dep) + VERSION + patches/:
0001 linux/GTK3 wx-config build path (build.rs; handles full-path .a in --libs!)
0002 Rust widget bindings (src/widgets.rs: Widget API + single event dispatcher)
0003 C++ widget bridge (cpp_src/widgets_bridge.cpp: panel/sizers/static text/
button/textctrl/checkbox/checklistbox/dialog/dvlc/timer/destroy)
0004 upstream fixes (Linux get_client_size branch; init render/handle_events —
upstream left them UNINITIALIZED: 5ms render timer calls garbage in release)
vendor/ cargo-managed ONLY (341 crates, offline)
scripts/ build-wx-linux.sh, build-gui-{linux,windows,macos}.sh
docs/ IMPLEMENTATION-PLAN.md, UI-SPEC.md, adr/0001-0003
Key implementation facts (don't re-derive):
- Event model: ONE C callback (
wxbr_set_widget_event_fn) → Rustset_event_handler(Handler); all events funnel throughui::dispatch(thread_local APP). Event kinds: ButtonClicked(id), DvlcValueChanged(row,col), DvlcHeaderClick(col), DvlcReordered, TimerTick(id). - Table semantics:
view.order= creation order = display order; toggle col is creation idx 0 (bool variants only);dvlc_col_at_pos()maps display→creation after a drag; store rows are appended in filtered+sorted view order, so store row ==view_idx[row]. Header click sort cycles asc→desc→off and refills. - Scan thread: std thread + own tokio runtime + std mpsc; a 1 s wx Timer drains it (
App::drain_scan). Ranges:~/.config/alkane-toolkit/scan-ranges.txt(default 10.255.1.0/24), parse viascan::parse_cidr. - asic-rs API:
MinerFactory::from_subnet("a.b.c.d/p"),.scan_stream()→Stream<Item=Box<dyn Miner>>;Miner::get_data().await -> MinerData(trait atasic_rs::core::traits::miner::Miner);HashRate.clone().as_unit(HashRateUnit::TeraHash).value;Power::as_watts(),Temperature::as_celsius(),AngularVelocity::as_rpm(); pools:MinerData.pools[].pools[]with.user/.active. - wx 3.3 API gotchas hit:
store->GetValueByRow(v,row,col)(not GetValue),GetColumnPosition()(no GetColumnAt),--enable-dataviewdoesn't exist,--disable-stc --without-catch2 --disable-testsneeded only if using the GitHub source export (the dist tarball in thirdparty/ is complete — just chmod +x configure).
6. Verification evidence
cargo build --workspace --offlineclean (network-independent; all sources vendored)- Release binary smoke-tested twice under xvfb: runs until killed, no crash, no wx warnings
- Git: tip
b264cdd6pushed to gitea (gitea reposizefield updates lazily — the commit has 16k files/4.9M insertions incl. the wx tree) - NOT yet verified: a human eyeballing the window on the real bench fleet (xvfb smoke ≠ visual check). First thing next session: run it, confirm the 9 bench boards render.
7. Bench fleet context (for the scan you'll see)
9 boards live on 10.255.1.0/24: S17 stock (.112, root+EMPTY password, legacy SSH algos), S19 xil OurOS (.166), S19j Pro bb OurOS (.152), S19k Pro cv OurOS (.167), S21 Pro aml stock (.149), WhatsMiner H3 (.126), H616 (.131), M50 CB4 (.148 — random MAC, address moves), WardenOS dev (.115). Scanning is read-only and routine; the live-fleet-ops rules (no auth bursts, gentle on prod 10.2.1.0/24) are standing orders in AGENTS.md. Never install/flash anything without the operator explicitly asking.
8. Conventions for this repo
- Confidence tags (CONFIRMED/DERIVED/EXTERNAL) on claims in docs; cite file paths.
- Commit style so far: single-line imperative summaries, no sign-off noise.
- The repo has no AGENTS.md/CLAUDE.md yet — if you establish repo-level rules, write them there and keep them short.
- When you change the vendored wx-rs: edit
thirdparty/wx-rs/wx-rs-0.2.0-patched/, regenerate the matchingpatches/NNNN-*.patchviadiff -u /tmp/pristine ...(pristine tarball URL+sha inVERSION), commit both.