Commit graph

23 commits

Author SHA1 Message Date
Virgil
e8f88e47a6 ax(mining): use explicit miner names
Some checks failed
Security Scan / security (push) Has been cancelled
Test / test (push) Has been cancelled
2026-04-04 08:39:11 +00:00
Claude
b12db10680
ax(batch): expand abbreviated parameter and local variable names across all packages
Applies AX principle 1 (Predictable Names Over Short Names) to function
signatures and local variables: s->input/raw, v->target/value, d->duration,
a,b->left,right, w->writer, r->reader, l->logger, p->part/databasePoint,
fn parameter names left as-is where they are callback conventions.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:27:21 +01:00
Claude
70fc8a6552
ax(node): remove banned fmt import from bundle.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace all fmt.Errorf calls in bundle.go with ProtocolError structs,
eliminating the banned fmt import. Error messages are preserved via
string concatenation consistent with the rest of the node package.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:10:07 +01:00
Claude
53654cffbc
ax(node): replace prose type comments with usage examples in bundle.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
BundleType, Bundle, and BundleManifest had comments restating what the
type signature already says (AX Principle 2 violation). Replaced with
concrete usage examples showing how each type is constructed and used.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:13:16 +01:00
Claude
98d34ffd07
ax(node): replace banned strings import with bytes.HasPrefix in bundle.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The strings package is banned per AX conventions. Both HasPrefix calls in
extractTarball now use bytes.HasPrefix with the bytes package already imported.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:58:05 +01:00
Claude
22b6e8ace6
ax(node): replace prose comment with usage example on createTarball
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 — comments show HOW with real values, not WHAT the
signature already says. The previous comment restated the function
signature in prose; replaced with a concrete call showing filename/
content pairs.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:49:16 +01:00
Claude
8b49b73a6f
ax(node): rename f to outputFile in extractTarball (AX Principle 1)
Single-letter variable f is not in the permitted set (i, _, t, c).
outputFile names the handle by what it contains.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:53:43 +01:00
Claude
9394bbd768
ax(node): replace prose comments with usage examples on StreamBundle/ReadBundle
AX Principle 2: comments show HOW with real values, not WHAT the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:48:32 +01:00
Claude
f268b3990f
ax(node): rename abbreviated vars dirs/dir/mode to directories/directory/fileMode
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX-1: names that require a comment to explain are too short.
'dirs', 'dir', and 'mode' all needed the surrounding comment
to clarify their meaning; full names are self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:46:49 +01:00
Claude
a6eb29a486
ax(node): replace prose comment with usage example on extractTarball
RFC-025 Principle 2 — comments must show a concrete call with realistic
values, not restate what the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:20:01 +01:00
Claude
51595300a2
ax(node): rename abbreviated dn to dataNode in CreateMinerBundle
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 1 — predictable names over short names. `dn` is an
opaque abbreviation for a *datanode.DataNode; `dataNode` conveys
the type at a glance without requiring context lookup.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:02:28 +01:00
Claude
5188cb617c
ax(ueps): remove redundant inline comment that restates the pre-function docstring
Some checks failed
Test / test (push) Has been cancelled
Security Scan / security (push) Has been cancelled
AX Principle 2: comments that restate what the surrounding code already
says are noise. The inline comment inside TestReader_ReadAndVerify_Ugly
duplicated the usage example already present in the function docstring.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:01:18 +01:00
Claude
ab83727e47
ax(node): rename abbreviated tar variables to predictable full names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace `tw`, `tr`, `buf`, `hdr` with `tarWriter`, `tarReader`,
`buffer`, `header` in createTarball and extractTarball per AX
Principle 1 (predictable names over short names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:42:02 +01:00
Claude
66d925ab56
ax(node): replace prose comment with usage examples on isJSON
AX Principle 2: comments must show how to call the function, not
restate what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:51:58 +01:00
Claude
a27cedd0a5
ax(node): replace prose comments with usage examples on ExtractProfileBundle and ExtractMinerBundle
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments must show HOW with real values, not restate what the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:50:43 +01:00
Claude
89599c122c
ax(node): replace prose comments with usage examples in bundle.go
CreateProfileBundleUnencrypted and CreateMinerBundle had comments that
restated the signature in prose. AX Principle 2 requires comments to
show a concrete call with realistic values, not describe what the type
signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:43:00 +01:00
Claude
2646772ed6
ax(node): replace prose comment on VerifyBundle with usage example
AX Principle 2 — comments show HOW with real values, not WHAT the
signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:06:38 +01:00
Claude
df8d7189d8
ax(node): replace prose description with usage example on CreateProfileBundle
AX Principle 2: comments show HOW with real values, not WHAT the signature
already says. The prose "creates an encrypted bundle containing a mining
profile" restates the type signature — deleted in favour of a concrete call.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:52:42 +01:00
Claude
c7a3f553e9
ax(node): replace prose comment with usage example on calculateChecksum
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments that restate the type signature add zero information.
Replace with a concrete usage example showing how the return value is used.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:43:24 +01:00
Claude
140f038f37
chore: migrate module path from github.com to forge.lthn.ai
Some checks failed
E2E Tests / E2E Tests (push) Failing after 1m23s
Tests / Go Tests (push) Failing after 39s
Desktop Release / Build linux (push) Failing after 46s
Release / Test (push) Failing after 2s
Tests / C++ Tests (push) Failing after 1m12s
Release / Release (push) Has been cancelled
Desktop Release / Build darwin (push) Has been cancelled
Desktop Release / Build windows (push) Has been cancelled
Desktop Release / Create Release (push) Has been cancelled
Move module declaration and all internal imports from
github.com/Snider/Mining to forge.lthn.ai/Snider/Mining. Also updates
Borg, Enchantrix, and Poindexter dependency paths to forge.lthn.ai.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:39:01 +00:00
snider
4072bdaf0d fix: Address 16 security findings from parallel code review
Critical fixes (6):
- CRIT-001/002: Add safeKeyPrefix() to prevent panic on short public keys
- CRIT-003/004: Add sync.Once pattern for thread-safe singleton initialization
- CRIT-005: Harden console ANSI parser with length limits and stricter validation
- CRIT-006: Add client-side input validation for profile creation

High priority fixes (10):
- HIGH-001: Add secondary timeout in TTMiner to prevent goroutine leak
- HIGH-002: Verify atomic flag prevents timeout middleware race
- HIGH-004: Add LimitReader (100MB) to prevent decompression bombs
- HIGH-005: Add Lines parameter validation (max 10000) in worker
- HIGH-006: Add TLS 1.2+ config with secure cipher suites
- HIGH-007: Add pool URL format and wallet length validation
- HIGH-008: Add SIGHUP handling and force cleanup on Stop() failure
- HIGH-009: Add WebSocket message size limit and event type validation
- HIGH-010: Refactor to use takeUntil(destroy$) for observable cleanup
- HIGH-011: Add sanitizeErrorDetails() with debug mode control

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 17:44:49 +00:00
snider
d61a8aff8b refactor: Remove unused code and fix nil dereference issues
- Remove unused exported functions from pkg/database (session tracking,
  bulk hashrate inserts, various query helpers)
- Remove unused exported functions from pkg/node (identity management,
  bundle operations, controller methods)
- Make internal-only functions unexported in config_manager.go and database.go
- Remove unused EventProfile* constants from events.go
- Add GetCommit() and GetBuildDate() to expose version.go variables
- Fix potential nil dereference issues flagged by Qodana:
  - Add nil checks for GetIdentity() in controller.go, transport.go, worker.go
  - Add nil checks for GetPeer() in peer_test.go
  - Add nil checks in worker_test.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 09:24:12 +00:00
snider
9a781ae3f0 feat: Add multi-node P2P mining management system
Implement secure peer-to-peer communication between Mining CLI instances
for remote control of mining rigs. Uses Borg library for encryption
(SMSG, STMF, TIM) and Poindexter for KD-tree based peer selection.

Features:
- Node identity management with X25519 keypairs
- Peer registry with multi-factor optimization (ping/hops/geo/score)
- WebSocket transport with SMSG encryption
- Controller/Worker architecture for remote operations
- TIM/STIM encrypted bundles for profile/miner deployment
- CLI commands: node, peer, remote
- REST API endpoints for node/peer/remote operations
- Docker support for P2P testing with multiple nodes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 19:49:33 +00:00