Trust Scoring System
Styx uses a dynamic trust scoring system to weight witness reports based on their historical accuracy. This implements Property 12: Witness trust decays when witnesses provide incorrect information.Overview
Not all witnesses are equally reliable. The trust scoring system:- Tracks the accuracy of each witness over time
- Increases trust for correct reports
- Decreases trust for incorrect reports
- Never allows trust to reach zero (minimum weight maintained)
- Influences how much each witness’s opinion affects the final belief
Trust Score Range
Why Minimum Trust is 0.1 (Not Zero)
Witnesses never lose all influence because:- Past errors don’t mean future errors - A witness that was wrong before might be right now
- Network conditions change - What appeared wrong might have been a partition
- Bootstrap problem - If trust reaches zero, a witness can never recover
- Minority reports matter - Even low-trust witnesses can provide valuable signals
Trust Evolution
Trust scores evolve based on report accuracy:Correct Report
When a witness provides a correct report:- Current trust: 0.70
- After correct report: 0.75
- After 6 more correct reports: 1.00 (capped)
Wrong Report
When a witness provides a wrong report:- Current trust: 0.80
- After wrong report: 0.70
- After 7 more wrong reports: 0.10 (floored)
Asymmetric Recovery
Notice that trust decays faster than it recovers:- Decay rate: 0.10 per wrong report
- Recovery rate: 0.05 per correct report
- Safety over liveness - False death declarations are worse than false liveness
- Earn trust slowly - Witnesses must prove reliability over time
- Lose trust quickly - Incorrect reports are serious mistakes
Witness Record Structure
Tracking Metrics
- Trust: Current trust score (what matters for aggregation)
- CorrectReports: Total correct reports (for analysis)
- WrongReports: Total wrong reports (for analysis)
- LastReport: Most recent belief reported by this witness
How Trust Affects Aggregation
Witness reports are combined using trust-weighted averaging:Example Calculation
Three witnesses report about node X:| Witness | Trust | Alive | Dead | Unknown |
|---|---|---|---|---|
| W1 | 1.0 | 0.90 | 0.05 | 0.05 |
| W2 | 0.7 | 0.80 | 0.10 | 0.10 |
| W3 | 0.3 | 0.20 | 0.70 | 0.10 |
Default Trust for New Witnesses
New witnesses start at DefaultTrust = 0.8, which is:- Higher than minimum (0.1) - They get meaningful weight from the start
- Lower than maximum (1.0) - They must prove themselves
- Optimistic but cautious - Assumes witnesses are generally honest
Trust Registry Operations
Register a New Witness
Get Current Trust
Record a Report
Trust Score Evolution Examples
Scenario 1: Reliable Witness
A witness that consistently provides correct reports:Scenario 2: Unreliable Witness
A witness that frequently provides wrong reports:Scenario 3: Recovery from Mistakes
A witness that made mistakes but then improves:Scenario 4: Mixed Performance
A witness with alternating correct and wrong reports:Integration with Byzantine Fault Tolerance
The trust scoring system complements Styx’s BFT mechanisms:- Trust scores handle gradual degradation and mistakes
- BFT aggregation handles malicious behavior and worst-case scenarios
- Partition detection handles network splits that affect trust scoring
Determining Report Correctness
How does the system know if a report was correct or wrong?- Ground truth from finality - If a node is declared dead (finality), witnesses who reported high dead confidence were correct
- Eventual consistency - Over time, the aggregated belief converges to reality
- Causal events - If a node produces a causal event, witnesses who reported it alive were correct
- Partition resolution - After a partition heals, the majority view is used to score minority witnesses
Thread Safety
The witness registry is thread-safe using read-write locks:- Read operations (GetTrust, GetRecord): Use
RLock() - Write operations (Register, RecordCorrect, RecordWrong): Use
Lock()
Configuration Tuning
The trust scoring constants can be tuned based on system needs:| Constant | Default | Purpose | Tuning Guidance |
|---|---|---|---|
| MaxTrust | 1.0 | Ceiling | Don’t change (normalized) |
| MinTrust | 0.1 | Floor | Increase for stricter filtering |
| DefaultTrust | 0.8 | Bootstrap | Decrease for more cautious start |
| DecayRate | 0.1 | Penalty | Increase to punish errors more |
| RecoveryRate | 0.05 | Reward | Increase to allow faster recovery |
Conservative Settings
Permissive Settings
Best Practices
For Witness Operators
- Ensure accurate local observations - Your trust depends on report quality
- Monitor your trust score - Declining trust indicates systemic issues
- Investigate wrong reports - Understand why you disagreed with ground truth
- Consider network position - Witnesses in unusual network positions may see different realities
For Oracle Operators
- Monitor witness trust distribution - If all witnesses have low trust, investigate
- Remove persistently wrong witnesses - If trust stays at minimum for long periods
- Diversify witness network positions - Reduce correlation and improve coverage
- Analyze trust patterns - Sudden trust drops may indicate partitions or attacks
Trust Score as a Signal
Low trust scores can indicate:- Network partition - Witness in different partition sees different reality
- Clock skew - Timing issues cause incorrect timeout interpretations
- Malicious witness - Deliberately reporting false information
- Buggy implementation - Software errors in witness’s belief computation
Related Components
- System Design - Overall architecture
- Byzantine Fault Tolerance - Handling malicious nodes
- Core Concepts - Understanding beliefs and confidence