Files
neuron-tai/.scratch/alpha-hardening/issues/09-fraud-reputation-routing-adaptive-audit.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

39 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Status: done
# 09 — FRAUD: Reputation-weighted routing + adaptive audit rate
## What to build
Wire reputation into route selection and audit sampling. Default network audit budget ≈5% — **not a cap**. New/low-reputation nodes: 2030% audit rate; veterans: 23% floor ≥2%. Tripwires escalate rate without direct punishment.
**Code refs:**
- `packages/tracker/meshnet_tracker/server.py` — route selection `_select_route`, `_effective_throughput` (~1747, routing helpers)
- `packages/validator/meshnet_validator/__init__.py``sample_rate=0.05`
- Research: `.scratch/alpha-hardening/research-verifiable-inference.md` §1.1, §6, §8 layers 24
Audit selection must be unpredictable at request time (tracker RNG after commitment window opens).
## Test-first
1. Red: uniform 5% sample regardless of reputation — test expects higher rate for low-reputation wallet.
2. Green: budget balancer keeps fleet-wide average ≈ configured target.
3. Routing prefers higher reputation among equal throughput candidates.
## Acceptance criteria
- [ ] Per-wallet audit probability function of reputation (newcomer high, veteran low, floor ≥2%)
- [ ] Fleet-wide audit budget configurable (~5% default target); over ≥1000 requests with fixed seed, measured fleet audit rate within **±1.0 percentage point** of configured target (e.g. 4.06.0% at 5% default)
- [ ] Route scoring includes reputation multiplier (earnings scale with tenure)
- [ ] Passive tripwire flags (perplexity/repetition) bump audit rate only
- [ ] Tests: deterministic seed for sampling distribution checks
## ADR links
- [ADR-0018](../../docs/adr/0018-fraud-detection-verification-and-reputation.md) §1, §67
- [ADR-0013](../../docs/adr/0013-rolling-stats-smart-routing.md)
## Blocked by
- `08-fraud-reputation-model-persistence.md`