Skip to content

feat(#593): opt-in local miner — hand off stratum URL + secret for a co-located RigForge worker#725

Merged
VijitSingh97 merged 4 commits into
develop-v1.11from
feat/593-local-miner
Jul 21, 2026
Merged

feat(#593): opt-in local miner — hand off stratum URL + secret for a co-located RigForge worker#725
VijitSingh97 merged 4 commits into
develop-v1.11from
feat/593-local-miner

Conversation

@VijitSingh97

Copy link
Copy Markdown
Collaborator

Closes #593.

What this does

Adds an opt-in local miner: a box that runs the stack 24/7 can mine with its spare CPU by co-locating a RigForge worker on the stack host, pointed at the stack's own loopback stratum. The dashboard already discovers workers from the proxy, so a local rig self-registers with no stack-side wiring — the only friction was copying two values by hand. This closes that gap.

Scope (deliberately narrowed to config + hand-off + docs)

Per the issue's re-scoped design, RigForge owns all host-level tuning (HugePages, GRUB, MSR, governor, the miner service). Pithead's job is purely to declare intent and hand off. This PR does not vendor/drive RigForge or render a RigForge config.json — those remain follow-on work; a manual RigForge install on the same host, fed the two printed values, is fully functional today.

Pithead-side wiring added:

  • local_miner.enabled config flag (default off), registered in config.reference.json to satisfy the closed-schema superset invariant (feat(dashboard): commit dashboard.energy from the config editor + close config.json smuggling gap in the control gate (#504, #33) #537/tier 1 drift guard: every config path pithead reads must exist in config.reference.json #561). The drift-guard test picks up the new config_bool read site automatically (still green).
  • pithead setup prompt"Also mine on this machine with its spare CPU?" (default N), wired through wizard_ask_shapewizard_write_config like the existing clearnet/onion/telegram opt-ins.
  • announce_local_miner() — on setup and apply, surfaces the two values a RigForge install would otherwise prompt for:
    • Pool URL: 127.0.0.1:${STRATUM_PORT} for a 0.0.0.0/loopback bind, or the configured p2pool.stratum_bind address for the specific-LAN-bind edge case the issue calls out (loopback wouldn't reach it).
    • Stratum secret: PROXY_STRATUM_PASSWORD from .env, shown only when set (a "none set" note otherwise).
  • Docs (docs/workers.md#mine-on-the-stack-host-itself) — how to enable it, that RigForge owns the host tuning, and the host-global-governor / thread-cap caveats.

No HugePage / GRUB / nr_hugepages / MSR / governor code was added — confirmed. (Note: the issue's claim that Pithead has no such code is inaccurate — optimize_kernel already does GRUB/HugePages tuning for the stack's own RandomX use — but this PR adds none and does not touch it.)

Testing

Tier-1 shell (tests/stack/run.sh), all green (1550 passed):

  • announce_local_miner hands off the stratum URL + secret only when opted in (#593) — opt-out prints nothing, absent block prints nothing, opt-in surfaces the loopback pool URL + secret + the RigForge-owns-tuning note, LAN-bind targets the bound address:port, and the no-password case is stated explicitly.
  • wizard_ask_shape has exactly 6 read prompts — prompt-count pin updated (5 → 6).
  • defaults path: no local_miner block written (opt-in off, #593) and opt-in path: local_miner.enabled written true (#593) — wizard prompt → write wiring.
  • config.reference.json stays a complete superset (tier 1 drift guard: every config path pithead reads must exist in config.reference.json #561) — passes with the new key.

Tier-4 deferred: a real co-located mining run (start a thread-capped RigForge worker against the stack's stratum, verify it self-registers and the stack keeps sync/share reliability) needs a mining host and is out of band for this config/doc change — matches the issue's own validation plan.

make lint: all touched surfaces pass (shellcheck/shfmt, docs-voice 31/31, markdownlint 0 errors). lint-proto fails locally only because it requires a running Docker daemon (Tari protobuf lint, unrelated to this change).

🤖 Generated with Claude Code

…co-located RigForge worker

A box that runs the stack 24/7 can mine with its spare CPU by co-locating a
RigForge worker on the stack host, pointed at the stack's own loopback stratum.

Pithead's side is purely intent + hand-off:
- `local_miner.enabled` config flag (default off), registered in
  config.reference.json (closed-schema superset invariant).
- A `pithead setup` prompt ("Also mine on this machine with its spare CPU?",
  default N) that writes the flag.
- announce_local_miner(): on setup/apply, surface the two values a RigForge
  install would otherwise prompt for — the pool URL (loopback 127.0.0.1:PORT,
  or the bound p2pool.stratum_bind address for the LAN-bind edge case) and the
  stratum secret already in .env — so the co-located rig self-registers through
  the proxy like any other worker.

Pithead adds NO HugePage/GRUB/MSR/governor code: RigForge owns all host-level
tuning and the miner service. Docs (docs/workers.md) state that ownership.

Tier-1 shell coverage: announce_local_miner opt-out/opt-in, loopback vs LAN
bind, no-password case; wizard prompt-count pin; wizard opt-in write. A real
co-located mining run is tier-4 (deferred).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
VijitSingh97 and others added 3 commits July 21, 2026 10:51
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…p completeness)

The new local_miner.enabled config leaf fell into the catch-all Other group, failing
the buildSections completeness test that every reference leaf resolves to a real group.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 merged commit c98e200 into develop-v1.11 Jul 21, 2026
16 checks passed
@VijitSingh97
VijitSingh97 deleted the feat/593-local-miner branch July 21, 2026 23:19
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.

1 participant