Files
neuron-tai/.scratch/distributed-inference-network/issues/07-fraud-detection-slash.md
Dobromir Popov 2f1f9717be tasks
2026-06-29 00:10:21 +03:00

29 lines
1.8 KiB
Markdown

Status: ready-for-agent
# 07 — Fraud detection: validator + on-chain slash
## What to build
Implement the optimistic fraud detection loop. After each inference request completes, the validator process independently decides whether to re-run the request on a reference node (~5% sample rate). If the reference output diverges from the node's output beyond a configurable floating-point tolerance, the validator submits a slash transaction on-chain.
The validator is a separate process (not the gateway or tracker). It subscribes to completed inference events, selects a random sample, re-runs those requests against a trusted reference node, compares outputs, and submits slash proofs when fraud is detected.
On slash: the offending node's stake balance decreases by the configured slash amount; its strike count increments. The gateway reads strike state from the registry contract on each route selection and excludes nodes that exceed the strike threshold.
Node operators receive a push notification (logged to stdout and, if configured, a webhook) when their node is slashed.
## Acceptance criteria
- [ ] The validator process samples ~5% of completed inference requests (configurable)
- [ ] A node returning a deliberately wrong output is detected and slashed within one validation cycle
- [ ] The on-chain stake balance of the slashed node decreases by the correct slash amount
- [ ] The strike count for the slashed node increments on-chain
- [ ] A node that reaches the strike threshold is excluded from route selection on the next gateway request
- [ ] A slashed node logs a clear warning to stdout
- [ ] An integration test: run a deliberately-bad node, send 20 requests, assert at least one slash transaction is submitted and the node is eventually excluded from routes
## Blocked by
- `05-openai-compatible-gateway.md`
- `06-solana-stake-and-settlement.md`