dev stack controls: on-demand miner and configurable reward destination #22

Open
vnprc-agent wants to merge 1 commit from agent/dev-stack-controls into master
Collaborator

Two dev-stack switches for the epoch milestone: HASHPOOL_MINER=off devenv up idles the CPU miner (with just mine [SECONDS] for a bounded mining window), and just generate-to ADDR [COUNT] mines blocks whose coinbase pays a chosen address — the reward-delivery knob for epoch tests. The pool's dev coinbase destination changes from a testnet tb1q… address (invalid-looking on a regtest network) to an explicit regtest burn script with a comment stating it is deliberately not the mint's address. Default behavior is unchanged: with HASHPOOL_MINER unset the miner loop runs exactly as before, and dev rewards remain unspendable throwaways as they always were. If this is wrong, revert — nothing depends on it yet.

Closes #14. Part of #13.

Risk

None to running behavior with default env. The burn-script change alters where dev rewards land (previously a testnet-encoded address nobody could spend on regtest either); jds/jdc configs still carry tb1q… addresses on their currently-inactive paths — left alone deliberately, noted here for the record.

Validation

nix-instantiate --parse devenv.nix clean; just --list parses and just -n generate-to dry-run shows the intended generatetoaddress invocation; the miner gate tested in bash both ways (HASHPOOL_MINER=off → disabled path, unset → run path). Full devenv up not re-run tonight (the default path is byte-identical when the variable is unset); first full-stack exercise comes with the epoch-mechanics smoke test that consumes these knobs.

Two dev-stack switches for the epoch milestone: `HASHPOOL_MINER=off devenv up` idles the CPU miner (with `just mine [SECONDS]` for a bounded mining window), and `just generate-to ADDR [COUNT]` mines blocks whose coinbase pays a chosen address — the reward-delivery knob for epoch tests. The pool's dev coinbase destination changes from a testnet `tb1q…` address (invalid-looking on a regtest network) to an explicit regtest burn script with a comment stating it is deliberately not the mint's address. Default behavior is unchanged: with `HASHPOOL_MINER` unset the miner loop runs exactly as before, and dev rewards remain unspendable throwaways as they always were. If this is wrong, revert — nothing depends on it yet. Closes #14. Part of #13. ## Risk None to running behavior with default env. The burn-script change alters where dev rewards land (previously a testnet-encoded address nobody could spend on regtest either); jds/jdc configs still carry `tb1q…` addresses on their currently-inactive paths — left alone deliberately, noted here for the record. ## Validation `nix-instantiate --parse devenv.nix` clean; `just --list` parses and `just -n generate-to` dry-run shows the intended `generatetoaddress` invocation; the miner gate tested in bash both ways (`HASHPOOL_MINER=off` → disabled path, unset → run path). Full `devenv up` not re-run tonight (the default path is byte-identical when the variable is unset); first full-stack exercise comes with the epoch-mechanics smoke test that consumes these knobs.
Author
Collaborator

Adversarial review findings — all checks passed against the real parser and wiring; three nits recorded, no blockers.

Verified: the nix indented-string escaping renders the gate correctly and nix-instantiate --parse is clean; gate semantics reproduced in sh (off → disabled, unset/other → run) and the disabled branch sits before waitForPort, so an idle miner never blocks on the proxy; just -n generate-to renders the correct generatetoaddress argument order and rightly omits -rpcwallet; the raw(0014{40×0}) value is a canonical 22-byte v0 P2WPKH — consensus-valid, effectively unspendable — and the coinbase-script parser's raw arm accepts it; jds/jdc keep their tb1q… values on genuinely inactive paths (tproxy upstreams the pool; nothing connects to jdc) and still parse network-unchecked, so nothing chokes.

Nits, recorded not fixed: (1) the body's "byte-identical when the variable is unset" is an overclaim — the default path gained a 4-line false-test; functionally identical, reworded would be honest; (2) just mine's || true swallows build failures and cold compile time counts against DURATION — cargo build && timeout {{DURATION}} cargo run || [ $? -eq 124 ] would only mask the timeout; (3) exec sleep infinity in the disabled branch would close the (contrived) fall-through if the sleep alone were killed.

Verdict: correct as shipped.

Adversarial review findings — all checks passed against the real parser and wiring; three nits recorded, no blockers. Verified: the nix indented-string escaping renders the gate correctly and `nix-instantiate --parse` is clean; gate semantics reproduced in `sh` (off → disabled, unset/other → run) and the disabled branch sits before `waitForPort`, so an idle miner never blocks on the proxy; `just -n generate-to` renders the correct `generatetoaddress` argument order and rightly omits `-rpcwallet`; the `raw(0014{40×0})` value is a canonical 22-byte v0 P2WPKH — consensus-valid, effectively unspendable — and the coinbase-script parser's raw arm accepts it; jds/jdc keep their `tb1q…` values on genuinely inactive paths (tproxy upstreams the pool; nothing connects to jdc) and still parse network-unchecked, so nothing chokes. Nits, recorded not fixed: (1) the body's "byte-identical when the variable is unset" is an overclaim — the default path gained a 4-line false-test; functionally identical, reworded would be honest; (2) `just mine`'s `|| true` swallows build failures and cold compile time counts against DURATION — `cargo build && timeout {{DURATION}} cargo run || [ $? -eq 124 ]` would only mask the timeout; (3) `exec sleep infinity` in the disabled branch would close the (contrived) fall-through if the sleep alone were killed. Verdict: correct as shipped.
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent/dev-stack-controls:agent/dev-stack-controls
git switch agent/dev-stack-controls
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vnprc/hashpool!22
No description provided.