allod bitcoin: operator command for the template's bitcoin node #93
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/nexus#93
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
An operator command for the template's bitcoin node,
allod bitcoin status|start|stop|clearnet|cli, so the node is driven from the hypervisor the way the forge VM will be.Primary goals:
status— waits on the node's own RPC, not the domain, because a node mid first-sync blocks RPC through coin-cache flushes; prints height, sync state and whether the clearnet exception is active.startandstop— drive the libvirt domain with local virsh and refuse anywhere but the hosting hypervisor;stopis an ACPI shutdown that waits out the node's stop timeout fromfacts.nixand never destroys;startreturns when RPC answers, which is mid-sync.clearnet— re-enables the clearnet exception for a node that fell behind; undone by the node's own switch within minutes once synced; never a standing mode.cli—bitcoin-cliover the admin SSH channel.allod-bitcoinon PATH, invoked throughallod's fallback for unlisted namespaces, likeallod forgewill.Current state and specifics
A private deployment carries this as an executable in its own host profile, reading the same
facts.nixas the node profile. Moving it toallod/nexusbeside the other host scripts, with its stub test intests/, makes it part of the template; the node profile itself is the matchingallod/profilesissue.Scope
In: the script, its test, the README line. Out: the profile and
facts.nix(allod/profiles), any wallet link.Implementation is ready on branch
agent/bitcoin-command, one commit, relayed to the owner for the pull request. Proposed PR body follows.This adds
allod bitcoin status|start|stop|clearnet|cli, the operator command for a template bitcoin-node machine, to the hypervisor's Home Manager module. Nothing changes on a running hypervisor until a deployment sets the newnexus.bitcoinNode.factsoption: with it unset, as it is by default and in the template, no command is installed and every other package in the module is exactly what it was. What proves it is the 39-case stub test (stand-insshandvirshfirst on PATH) and a second check that composes the module under home-manager with the option set, unset, and misset. If it is wrong, revert the commit; the command holds no state of its own.What moves
nix/bitcoin-node-command.nix: the generator a private deployment runs today, unchanged except that the node's facts arrive as an argument instead of an import of the profiles repo. Facts cross no flake boundary:nexuskeeps its three inputs.nix/home.nix:nexus.bitcoinNode.facts(a typed submodule of the eight facts;nullships nothing) andnexus.bitcoinNode.machines(ssh host names; the command defaults to the one machine when exactly one is listed).machinesset withfactsunset fails evaluation. The package list moved underconfigunchanged.tests/bitcoin-node-command.shand thebitcoin-node-commandcheck;bitcoin-node-command-optionsfor the module's three states; a five-fileallod-toolsfixture undertests/fixtures/so the options check needs no real tools checkout.README.md: a Bitcoin node command section with the snippet a deployment adds to its hypervisor definition, reading the facts from the node profile's ownfacts.nix(allod/profiles#14) so the two cannot disagree.Fix round (one cold cross-family review, gpt-5.6-sol)
Two findings taken:
clearnettreated a missing marker as proof the node was on clearnet and exited 0 when the exception unit was in fact inactive; the probe now tells the three states apart and re-enables clearnet in that case (one new test case). The string facts are typed to refuse an apostrophe, since they are single-quoted into the remote scripts (one new assertion in the options check). Six findings discarded: two describe the clearnet state the operator asked for, one needssystemctlitself to fail, the start budget counts probes and so can wait longer than ten minutes but prints elapsed seconds throughout, the stub-only mutation test is the design (the live machine is the witness), and two comments are traps that stay.Risk
R2: a new operator command behind an option that is off by default;
start/stopdrive libvirt andclearnetmutates the node's network mode, all behind explicit subcommands and a confirmation. Residual after validation: the command's behaviour against a real node is witnessed by the private deployment, not by these checks. Rollback is a revert.Validation
Branch
agent/bitcoin-command, one commit (b7f8c95). Run on the integrator's machine against that commit:nix flake check .:all checks passed!(bitcoin-node-command,bitcoin-node-command-options,provisioning-contractwith the new test in its shellcheck list, and the existing checks).nix build .#checks.x86_64-linux.bitcoin-node-command:39 bitcoin-node command tests passed.(38 carried over from the private suite plus the exception-off case).nix build .#checks.x86_64-linux.bitcoin-node-command-options: four assertions pass: facts set installsallod-bitcoin; facts unset installs nothing; machines without facts fails evaluation; a fact with an apostrophe fails evaluation.nix eval .#homeModules.host --apply 'm: builtins.typeOf m':"lambda".clearnetprobe change, which that deployment does not carry yet.Closes allod/nexus#93.
Landed on master in commit
bb9ceba: nix/bitcoin-node-command.nix behind nexus.bitcoinNode.facts, with tests/bitcoin-node-command.sh. Verified against the files on master today; closing as completed.