Files
neuron-tai/.scratch/alpha-hardening/issues/05-a1-a5-persist-strike-ban-reputation.md
Dobromir Popov 9abe83b5f4 feat(alpha): complete hardening backlog
Complete the alpha-hardening Ralph task set, including tracker billing/accounting guards, validator fraud-audit primitives, wallet binding proof support, documentation runbooks, and updated tests.

Verification: .venv/bin/python -m compileall -q packages tests; .venv/bin/python -m pytest -q --tb=short (313 passed, 3 skipped, 1 failed: tests/test_mining_cli.py::test_legacy_start_without_port_uses_next_available_port because meshnet-node pid 1263451 is already listening on port 7000).
2026-07-05 21:47:23 +03:00

1.8 KiB
Raw Blame History

Status: done

05 — A1/A5: Persist strike, ban, and reputation state

What to build

Registry strike/ban/reputation state today lives in RAM-only _LocalContractState — tracker restart wipes penalties. Persist to SQLite (same pattern as BillingLedger and AccountStore) so reputation carries forward per ADR-0016 §4.

Code refs:

  • packages/contracts/meshnet_contracts/__init__.pyRegistryContract, RegistryWallet, in-memory _state.registry (~103206)
  • packages/tracker/meshnet_tracker/billing.py — SQLite persistence pattern (~60, event log)
  • packages/tracker/meshnet_tracker/accounts.py — SQLite + event replication (~4056)

Include fields for: strike_count, banned, completed_job_count, graduated reputation score (float, default 1.0), last_audit_ts, probation tracking.

Scope split: this issue owns schema + persistence + load/reload only. Reputation scoring deltas (audit pass/fail adjustments, decay rules) belong in issue 08.

Test-first

  1. Red: record strike, restart tracker process, strike count is 0 — must fail.
  2. Green: persist + reload; gossip replicates strike events if multi-tracker.
  3. Red: banned wallet registers node — must reject (wire to routing).

Acceptance criteria

  • Strike/ban/reputation survive tracker restart (SQLite or equivalent)
  • RegistryContract.list_wallets reflects persisted state
  • Banned wallet rejected at registration and excluded from routes
  • Reputation score field present for routing/audit issues (0809)
  • Event-sourced mutations compatible with future Raft (ADR-0019)

Blocked by

  • 02-a2-unified-auth-boundary.md