Files
neuron-tai/.scratch/alpha-hardening/issues/05-a1-a5-persist-strike-ban-reputation_completed.md
2026-07-13 14:14:37 +02:00

1.8 KiB
Raw Permalink 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_completed.md