Skip to content

Feature/oracle reliability weighting 1765 - #1785

Merged
Olowodarey merged 5 commits into
Arena1X:mainfrom
jaynomyaks:feature/oracle-reliability-weighting-1765
Aug 30, 2026
Merged

Feature/oracle reliability weighting 1765#1785
Olowodarey merged 5 commits into
Arena1X:mainfrom
jaynomyaks:feature/oracle-reliability-weighting-1765

Conversation

@jaynomyaks

Copy link
Copy Markdown
Contributor

[Backend] Oracle: Persist Reliability Scores and Weight Consensus

Problem

Oracle consensus in oracle.service.ts treats all submissions equally, even when some oracles have historically inaccurate records. A single unreliable oracle can sway consensus toward incorrect outcomes.

Solution

Implemented reliability-weighted consensus (#1765):

  1. Persist Reliability Scores: Created OracleReliabilityHistory entity to maintain immutable audit trail of score changes per oracle, indexed for fast retrieval
  2. Calculate Rolling Reliability: Updated recordOutcome() to accept matchId and persist history records (score = correct_submissions / total_submissions)
  3. Weight Consensus Votes: Modified getMatchConsensus() to weight votes by each oracle's reliability score, preventing any single oracle from dominating
  4. Floor Constraint: Applied weight floor to ensure distributed consensus even when high-reliability oracles participate

Changes

  • Entity: OracleReliabilityHistory – immutable audit trail of reliability updates
  • Migration: 1788042840000-CreateOracleReliabilityHistory – table with indexes on (data_source, created_at)
  • Service: Enhanced OracleReliabilityService with history persistence and weight configuration
  • Service: Updated OracleService.getMatchConsensus() for weighted voting
  • Tests: Added 11 reliability tests + 3 weighted consensus tests; all passing

Acceptance Criteria

✅ Consensus outcome shifts toward higher-reliability oracles
✅ Scores update after resolution and persist in history
✅ Covered by comprehensive unit tests
✅ Single high-reliability oracle cannot unilaterally decide

Closes #1765

- New immutable entity to track reliability score changes per oracle
- Records match_id, was_correct flag, previous/new scores
- Enables reconstruction of weighted consensus decisions at any point
- Addresses requirement to persist reliability scores per oracle (Arena1X#1765)
- TypeORM migration for oracle_reliability_history table
- Records immutable history of reliability score updates per oracle
- Indexed on data_source and (data_source, created_at) for auditing
- Enables reconstruction of consensus at any point (Arena1X#1765)
…weighting

- recordOutcome now accepts matchId to persist history records
- Add getScoreHistory() to retrieve audit trail for a source
- Add WEIGHT_FLOOR and DEFAULT_WEIGHT configuration constants
- Add getWeightFloor() and getDefaultWeight() configuration getters
- Weights bounded in [0, 1], floor prevents single oracle dominance (Arena1X#1765)
- Load oracle weights from reliability service for each submission
- Accumulate weighted votes instead of simple vote counts
- Determine consensus winner by weighted majority vote
- A single oracle cannot dominate even with perfect reliability (Arena1X#1765)
…ability

- Register OracleReliabilityHistory entity in oracle module
- Update reliability service tests for score history persistence
- Add weighted consensus tests to oracle service tests:
  - Verify weights applied based on reliability scores
  - Ensure single oracle cannot dominate even with perfect reliability
  - Test 50/50 weighted tie detection
- All tests passing (Arena1X#1765)
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
insight-arena-4rll Ready Ready Preview Aug 29, 2026 11:00pm

@Olowodarey
Olowodarey merged commit e4e7ee7 into Arena1X:main Aug 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] oracle: Persist reliability scores and weight consensus by them

2 participants