RigForge is the companion miner for the Pithead P2Pool stack. Bug fixes, CPU tuning profiles, and docs changes are all welcome.
If your idea is about the stack as a whole rather than the miner, the Pithead repo may be the better home for it.
- For anything beyond a small fix, open an issue first so we can agree on the approach before you spend time on it. This avoids duplicated work.
- Check the existing issues to see if someone is already on it.
RigForge is portable Bash that has to run on Ubuntu/Debian. macOS is best effort: it has no CI or bench coverage, but the Darwin code paths still work and stay working, so don't break them gratuitously:
-
Keep it portable. Avoid GNU-only flags and other Linux-isms where a POSIX-friendly alternative exists, and guard platform-specific code paths.
-
Run
make lintbefore you push and fix any warnings. It runs ShellCheck andshfmtover the script, utilities, and the test scripts, exactly as CI does:make lint # or: make test (lint + the full dependency-free suite)CI runs the same checks with pinned tools (shfmt 3.14.1, diff-cover 11.0.2 for patch coverage, and zizmor 1.32.0 for workflow security), so use matching versions when reproducing a CI finding. (
make fmtauto-applies theshfmtformatting.)make lintalso runs the topology gate and the file budget gate below. -
Update the README or other docs when you change behavior or add options.
-
New
config.jsonkeys are lowercasesnake_case, matching Pithead. The three SCREAMING legacy keys (ACCESS_TOKEN,DONATION,HOME_DIR) are frozen as-is — never rename a shipped key.
Install the hooks once and they run on every commit, catching issues before they reach CI:
make dev-setup # installs the linter toolchain (brew/apt) + the git hooks in one go
# — or by hand:
pipx install pre-commit # or: pip install pre-commit
pre-commit installThis runs make lint (ShellCheck + shfmt over the Makefile's SHELL_FILES), make lint-md,
make lint-yaml and make lint-actions (actionlint, when a workflow file changes),
gitleaks secret scanning (the same pinned version CI runs, so
a committed token or pool credential is caught before it's pushed), and a few hygiene checks:
private-key detection, a large-file guard, and final-newline and trailing-whitespace fixers.
make lint fails if a source file grows past its ceiling. Two rules, and
scripts/lint-file-budget.sh is the whole implementation:
- A file over 400 lines must have a row in
docs/dev/file-budget.tsvrecording its current line count. Over 800 with no row, the refusal names the hard ceiling instead — a new file has no reason to be born that big. - Ceilings only ever go down. The gate compares your budget file against
developand rejects any row whose ceiling rose. A row's first appearance must record the file's real count, not reserve headroom above it. A file that shrinks back to 400 or under drops its row.
make lint-file-budget # self-test, then the gate
scripts/lint-file-budget.sh --generate # reprint the budget this tree implies; commit it by handProse (*.md), data (*.json), the generated Cargo.lock, and binaries are exempt. Prose grows by
nature and is not source to split; JSON here is config and fixtures; Cargo.lock is written by
cargo; binary files are skipped by detection, not by a path list. A glob in is_exempt matches /
too. rigforge.sh is deliberately not exempt.
Rust source (*.rs) is ordinary source under this gate: a .rs file over 400 lines needs a row, a
new one never starts above the target, and there is no Rust exemption. Split a growing module
instead of asking for a row.
If your change is refused because the ceiling equals the file's current size, the ratchet has left no slack, which is intended. Ask first whether a line-neutral form of the change exists; that question usually dissolves the problem. If there genuinely is none, fold the addition into the same commit as a cut that makes room for it — never a follow-on PR, which cannot raise the ceiling to fit.
Regenerate the budget file rather than merging it, and never resolve a conflict in it by taking a
side: both sides are measurements of different trees, and taking one bakes in a count that was never
true of the merged result. The gate never rewrites this baseline: --generate prints a proposed copy
to stdout, and a contributor deliberately redirects and reviews it.
tests/manifest.json lists every suite the Makefile or a workflow runs, with its file, phases, all_runs, timeout_seconds, inputs, exit_codes and needs. Phases exist only for harnesses that dispatch on their first argument (tests/e2e-real.sh, tests/e2e-pithead.sh, tests/e2e/linux.sh); every other suite runs whole and has an empty list. all_runs is the subset the all phase runs. needs draws on needs_vm, needs_hardware, needs_docker, needs_root and needs_macos. The manifest names no CI system, host or status context. tests/manifest-selftest.sh runs in make test-suite and fails when the phases, all_runs or documented inputs drift from the harnesses, or when the Makefile or a workflow runs a tests/ script that has no suite, so update the manifest in the same change that adds a suite, phase or input. A documented input is any E2E_* name in a harness's leading comment block, or any NAME= there that the harness does not set itself.
The YAML, workflow, Markdown, and link checks gate in CI and have matching Make targets for local runs:
make lint-yaml # yamllint the workflows + configs (.yamllint)
make lint-actions # actionlint the workflows (bad needs/refs, invalid runners, shell bugs in run blocks)
make lint-md # markdownlint the docs (.markdownlint-cli2.yaml + npm lockfile; needs Node 22+)
make lint-links # lychee link-check the docs (.lychee.toml; needs lychee — runs weekly in CI)
make lint-all # shell + yaml + markdown + workflows in one go
make ci # everything CI runs that can run locally (adds the container e2e when Docker is up)The Markdown linter is pinned in package.json + package-lock.json, which make lint-md installs
from with npm ci; validate a pin update with make lint-md.
Every step in .github/workflows/ci.yml and .github/workflows/security.yml carries a
setup:/assert:/cleanup:/scan: category as the first word of its name and an id prefixed by
that category, and every job ends with an if: always() assert: categorize outcome step
(scripts/ci-categorize.sh) that prints each step's outcome under its category to the job summary.
A red gate therefore names the category that broke: setup-* rows mean the toolchain never came
up, assert-* rows are the gate's own verdict, scan-* rows are a gitleaks or zizmor finding that
blocks the merge, and a red cleanup-* row means the allowlist kernel-test image built but could
not be removed (a leaked container or a broken Docker daemon). The categorize step runs the helper
from the checkout, so when setup: Checkout itself fails that step fails too and prints no table;
the red setup-checkout step is then the category. tests/test-workflow-contract.sh
(in make test-suite) fails when a step loses its category, id, or categorize coverage, when a step
or job gains an unapproved or misplaced if: condition, or when a preserved gate (the full-history
gitleaks scan and its checksum-verified install, the online zizmor advisory audit, the file-budget base check,
the allowlist kernel-test pair, the deploy, appliance and isolation e2e passes and the
assert: Require every Docker mode gate over them, the stock-home matrix, the Homebrew formula proof
and its OS matrix, every make lint*/make test* entry point CI runs) stops appearing with its exact command.
The e2e passes and the allowlist image build run under if: ${{ !cancelled() }} so one failed mode
does not hide the others; the allowlist test runs only once its image built, so a failed build shows
as a red setup-allowlist-image row, a skipped assert-allowlist row and a red gate. The test pins
workflow text, not hosted execution: a green hosted run is what proves the environment itself stayed
honest.
Why the workflows look the way they do: the lint, coverage and stock-home checkouts and the gitleaks
checkout fetch full history, because gitleaks scans every commit, diff-cover compares against the
base branch, and FILE_BUDGET_REQUIRE_BASE=1 makes the file-budget gate fail rather than skip its
ceilings-only-go-down half when origin/develop is missing. Tool installs (shellcheck, shfmt,
actionlint, gitleaks) are pinned and checksum-verified; the lint job unpacks shellcheck and shfmt in
RUNNER_TEMP so the file-budget gate never counts an unpacked toolchain as a source file; keep
GITLEAKS_VERSION in lockstep with the gitleaks pre-commit hook. gitleaks runs with --redact so a
match never reaches the public log, and zizmor runs its online audits with GH_TOKEN so an advisory
against a pinned action fails the gate. gitleaks skips the weekly schedule, which exists only for
zizmor's advisory re-audit; history does not change between pushes. Checkouts set
persist-credentials: false because CI never pushes. The Ubuntu test suite still drives the
deprecated Darwin paths through stubs (#493), and the container e2e runs the standard deploy,
RIGFORGE_APPLIANCE=1 (#348) and the isolation pass.
Dependabot opens bump PRs (labelled dependencies so they queue first) for every manifest it can
read: GitHub Actions, the pre-commit hooks, the Python CI tools in tools/requirements-ci.txt, the
npm devDependency, and the container test images pinned by tag and digest in the Dockerfiles under
tests/e2e/, tests/coverage/ and tests/docker/. The tools no manifest can express —
shellcheck, shfmt, actionlint, gitleaks, lychee and jq, installed by curl with a sha256 check — are
watched by the weekly tool-bump.yml watcher; the Rust toolchain pin in rust-toolchain.toml and
cargo-deny are registered there too, and Dependabot's cargo entry covers Cargo.lock. The watcher
reports stale pins without changing them; failed or malformed upstream responses remain unchecked
and fail the watcher. It also confirms that the sibling scheduled workflows ran on their last
schedule: only a scheduled run counts, and a lookup that finds nothing is unchecked, never a pass.
The Rust workspace (Cargo.toml, crates/) is gated by make rust-check: rust-fmt, rust-clippy,
rust-test, rust-deny (needs cargo-deny), rust-musl (needs the pinned musl target and readelf) and
rust-msrv. make check fails, not skips, when cargo is present but cargo-deny, readelf or the musl
target is missing. make check runs lint-all, the suite and those gates, and prints a skip line where
cargo is missing. lint, test and the pre-commit hooks never need cargo. The jobs live in
.github/workflows/rust.yml; the aarch64 build there is best effort and never fails the workflow.
Dependabot checks GitHub Actions, pip and npm daily and the test images weekly. Pip, npm and docker group minor and patch version updates into one PR each; security updates stay one PR per package, and the three-day cooldown on pip and npm never delays them.
The Security backlog expiry check in security.yml lists open issues labelled security-baseline and
branch:<base> whose expires: YYYY-MM-DD line has passed, on PRs into develop and develop-v*.
Issues carrying only review: never count. Dependabot and bot/xmrig-* PRs, PRs labelled security
and PRs that close the issue are exempt. It only warns until the ENFORCE_FROM date in the job, then
fails; extend an expiry by editing the date in the issue.
An .editorconfig encodes the whitespace conventions (shfmt -i 4, LF, final
newline) so most editors match these checks automatically.
The files under crates/rigforge-core/tests/golden/jq-1.7.1/ hold what real jq 1.7.1 printed for
each input row; they are never edited by hand. scripts/make-goldens.sh jq regenerates them by
running the local jq over the corpus in that script and in scripts/goldens-docs.sh and
scripts/goldens-ops.sh (each file starts with the jq arguments, then one row per input: hex input,
jq status, hex output, label). Regenerate with jq 1.7.1 (jq --version must print jq-1.7.1; the
Linux test image has it) and commit the result together with the corpus change. make rust-goldens
regenerates and fails on any difference or stray file, and prints a skip line under any other jq;
the goldens job in .github/workflows/rust.yml runs it with a pinned jq 1.7.1. jq 1.6 and 1.8
are not committed as golden sets: the jq_live* tests compare against binaries named by JQ16
and JQ18 and print a SKIPPED line when the variable is unset (CI sets both). make rust-mutants
applies each row of tests/rust/mutants.tsv (file, exact text, replacement, test filter) to a
scratch copy and requires the named tests to fail; a row whose text is not found exactly once is
refused.
RigForge uses a two-branch model (same as Pithead):
developis the default, integration branch. All PRs targetdevelop.mainis the release branch.developis merged intomainat each release, and version tags are cut frommain.
- Fork the repo and create a topic branch off
develop. - Make your change and confirm
shellcheckpasses. - Open a PR against
developand fill out the template. Before you submit any bench proof, finishmake lint-allandmake test(the suite includes the offline contract credential checks), then submit withbench-ci submit --base develop. Retry a submission whose outcome is unknown with its original--idempotency-key; a deliberate rerun of a completed job omits the key so the client generates a fresh one. Cancelling superseded runs stays manual. - A PR into
developmerges on green required checks and review of the head SHA. Merges are explicit, never automatic: bring the branch up to date withdevelop, thengh pr merge --squash. Only the owner's account merges; a PR intomainalso needs the code owner's review.
Keep PRs focused and the description clear about what changed and why. Small, reviewable changes get merged faster.
By contributing, you agree that your contributions are licensed under the project's MIT License.