feat: USDT reward system — billing ledger, devnet treasury, settlement loop, forfeiture PoW, tracker dashboard (US-030…US-035, ADR-0015)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Dobromir Popov
2026-07-02 22:31:02 +02:00
parent 4d4ab607ca
commit 1e0aa6ea8f
24 changed files with 3168 additions and 994 deletions

View File

@@ -1,27 +1,26 @@
---
name: project-status
description: Current state of neuron-tai development as of 2026-07-01
metadata:
description: Current state of neuron-tai development as of 2026-07-02
metadata:
node_type: memory
type: project
originSessionId: 8fb120ee-7b8e-45be-98c0-b5ae9c64d1ec
---
# Project Status (2026-07-01)
# Project Status (2026-07-02)
29/30 user stories done. US-030 is the only open story, ready for ralph.
All 35 user stories in docs/prd.json are done (35/35), including the reward-system arc US-030…US-035 completed 2026-07-02:
## US-030 — Manual route selection + hop-penalty benchmarking
- Status: open / ready
- Optional `"route": [node_id, ...]` in POST /v1/chat/completions body
- `POST /v1/benchmark/hop-penalty` — privileged (non-empty Authorization header), fans out to 1/2/3-node routes, records per-hop latency
- Results appended to `benchmark_results.json` in tracker working dir
- `GET /v1/benchmark/results` — also auth-gated
- Routing algorithm unchanged — data collection only
- Source: `.scratch/distributed-inference-network/issues/30-manual-route-and-hop-benchmark.md`
- **BillingLedger** (packages/tracker/meshnet_tracker/billing.py): event-sourced USDT ledger, gossip-replicated across the hive (id-deduped events), SQLite-persisted. 90/10 split by work units, per-model per-1K-token pricing, 402 before routing.
- **Solana custodial adapter** (packages/contracts/meshnet_contracts/solana_adapter.py): urllib JSON-RPC + solders signing. NOTE: installed solana-py 0.40 has NO sync client — don't import solana.rpc.api / spl.token.client.
- **scripts/devnet_setup.py**: creates mock-USDT mint + treasury, writes .env.devnet; --mint-to funds test clients.
- **TrackerServer threads**: deposit watcher (exactly-once via deposit-<sig> event ids) + leader-only settlement loop (threshold OR max-period, dust floor, resend-by-settlement-id → no double-pay).
- **Forfeiture penalty**: validator forfeits pending balance + strike; 3 strikes ban; probation redirects shares to protocol cut. Math in packages/validator/README.md.
- **Web dashboard**: GET /dashboard on any tracker, embedded dashboard.html, 4s polling.
**Why:** Need real hop-latency data to eventually optimize route selection beyond synthetic benchmarks.
**How to apply:** When asked about next steps, US-030 is the one ready story.
Suite: 222 passed, 3 skipped (openai/langchain packages missing in .venv — pre-existing).
**Why:** design locked in ADR-0015 (USDT custodial settlement; TAI deferred, protocol cut = future TAI liquidity).
**How to apply:** next steps are live devnet verification (run devnet_setup.py, start tracker with --solana-rpc-url/--usdt-mint/--treasury-keypair --billing-db), then the TAI mint when volume justifies it. Work not yet committed to git as of session end — check git status.
## Windows CUDA node (working as of 2026-07-01)
- miniforge3 base env, torch 2.7.1+cu118, torchvision 0.22.x+cu118