You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`AL_RETRAIN_THRESHOLD`|`50`| Min labels for full retrain |
359
+
|`AL_ROLLBACK_AUC_DROP`|`0.01`| Max AUC drop before rollback |
360
+
331
361
## Development
332
362
333
363
```bash
@@ -514,6 +544,33 @@ defines the relevant shared type before inventing a new one.
514
544
-[ ] SDK for protocol integrations (Python + JavaScript)
515
545
-[x] Open dataset release: labelled SDEX wash trade patterns — see [`data/dataset_card.md`](data/dataset_card.md)
516
546
547
+
## Security
548
+
549
+
LedgerLens includes a hardened inference stack to protect against adversarial attacks on the model layer itself. See [`docs/security.md`](docs/security.md) for full details.
550
+
551
+
### Artifact Integrity (Ed25519 Trust Chain)
552
+
553
+
Every trained model artifact is verified through a four-step chain before loading:
554
+
555
+
1. SHA-256 of the `.joblib` file matches the value recorded in `metrics.json`
556
+
2.`metrics.json` carries a valid Ed25519 detached signature (`metrics.json.sig`)
557
+
3. The signing key fingerprint matches `TRUSTED_SIGNING_KEY_FINGERPRINT`
558
+
4. The training dataset SHA-256 matches the recorded provenance (optional)
559
+
560
+
`ModelIntegrityError` is raised on any failure. A CI grep check enforces that every `joblib.load` in `detection/` is immediately followed by `verify_chain`.
561
+
562
+
### Byzantine-Fault-Tolerant Ensemble Voting
563
+
564
+
The three models (RF, XGBoost, LightGBM) vote using a **trimmed mean / median** scheme. If the spread across model scores exceeds `BFT_SCORE_DIVERGENCE_THRESHOLD` (default 30 points), the outlier scores are trimmed and the median is used — ensuring a single compromised model cannot shift the final score by more than ~17 points. Divergence events are logged, counted in a Prometheus counter (`bft_divergence_detected_total`), and surfaced in the score response as `bft_divergence: true`.
565
+
566
+
### Label Poisoning Detection
567
+
568
+
Each training run records the SHA-256 of the input dataset and the label distribution. If the wash-trade ratio has shifted more than `POISON_LABEL_RATIO_THRESHOLD` (default 15%) from the stored baseline, training is aborted and an alert is written to `reports/poisoning_alert_{timestamp}.json`.
569
+
570
+
### Annotation Queue Integrity
571
+
572
+
Each annotation in `data/annotation_queue.json` is protected by an HMAC-SHA256 computed over `wallet|label|annotator_id|annotated_at`, keyed by `ANNOTATION_HMAC_SECRET`. Tampered annotations are rejected before they can influence a training run.
573
+
517
574
## Why This Matters
518
575
519
576
A DEX where volume figures cannot be trusted is one that institutional participants and serious traders will avoid. LedgerLens is an **open-source public good** — its scores, methodology, and training data are fully transparent and auditable, and will always be free to query.
0 commit comments