1.8 KiB
1.8 KiB
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__.py—RegistryContract,RegistryWallet, in-memory_state.registry(~103–206)packages/tracker/meshnet_tracker/billing.py— SQLite persistence pattern (~60, event log)packages/tracker/meshnet_tracker/accounts.py— SQLite + event replication (~40–56)
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
- Red: record strike, restart tracker process, strike count is 0 — must fail.
- Green: persist + reload; gossip replicates strike events if multi-tracker.
- Red: banned wallet registers node — must reject (wire to routing).
Acceptance criteria
- Strike/ban/reputation survive tracker restart (SQLite or equivalent)
RegistryContract.list_walletsreflects persisted state- Banned wallet rejected at registration and excluded from routes
- Reputation score field present for routing/audit issues (08–09)
- Event-sourced mutations compatible with future Raft (ADR-0019)
ADR links
Blocked by
02-a2-unified-auth-boundary_completed.md