Skip to content

Feature/sc 005 verification aggregation engine - #349

Open
Tobi-8 wants to merge 6 commits into
DigiNodes:mainfrom
Tobi-8:feature/sc-005-verification-aggregation-engine
Open

Feature/sc 005 verification aggregation engine#349
Tobi-8 wants to merge 6 commits into
DigiNodes:mainfrom
Tobi-8:feature/sc-005-verification-aggregation-engine

Conversation

@Tobi-8

@Tobi-8 Tobi-8 commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • Add VerificationAggregator (contracts/VerificationAggregator.sol): a pure, integer-only consensus calculator that folds frozen effectiveStake votes from TruthBountyWeighted into trueWeight / falseWeight / totalWeight, resolves a canonical ClaimOutcome (VERIFIED_TRUE / VERIFIED_FALSE / INCONCLUSIVE), and stores an AggregationResult (with confidence in 0–10 000 bps) per claim.
  • Deterministic by construction: the voter loop is order-independent (no sorting, no randomness); repeated calls return identical output.
  • Tie handling returns INCONCLUSIVE (exact ties, zero participation); configurable minimum-participation thresholds (verification count, total weight, confidence) enforced with ThresholdNotMet.
  • API: aggregateClaim(), getAggregation(), calculateWeights(), calculateConfidence(), isAggregated(); emits ClaimAggregated(claimId, outcome, confidence) for indexers.
  • TruthBountyWeighted now implements IVerificationSource read getters (getClaimVoterCount, getClaimVoterAt, getVoteData); no storage layout changes, so future weighting models (reputation/quadratic/zk) can be layered without breaking compatibility.
  • Engine is a pure calculator: it never transfers funds, slashes, or updates reputation.
  • Documented gas benchmarks (docs/verification-aggregator-gas.md): aggregateClaim avg ~158k gas.
    Testing
  • 25 new tests in test/VerificationAggregator.test.ts covering: unanimous/mixed/weighted-majority outcomes, confidence math, tie cases → INCONCLUSIVE, minimum-participation reverts, determinism (reversed vote order), repeat-aggregation guard, stress (10-verifier set, repeated claims), and access control.
  • Full hardhat suite: 383 passing, 0 failing.

closes #285

Tobi Olusanya added 6 commits August 9, 2026 18:52
…iour

- Fix grace-period timing and staleness assertions in reputation tests
- Align large-withdrawal cooldown, tie-refund, and min-stake tests
- Update fuzz/invariant tests to match contract invariants
- Pin OpenZeppelin contracts-upgradeable submodule
…on engine

- Add VerificationAggregator: pure integer consensus calculator producing
  ClaimOutcome (VERIFIED_TRUE / VERIFIED_FALSE / INCONCLUSIVE) from weighted
  verification totals
- Compute trueWeight/falseWeight/totalWeight and confidence in basis points,
  order-independent over the voter list
- Enforce configurable minimum participation thresholds (count, weight,
  confidence)
- Expose aggregateClaim/getAggregation/calculateWeights/calculateConfidence
  and emit ClaimAggregated for indexers
- Add IVerificationSource read getters to TruthBountyWeighted
- Add unit, determinism, tie, threshold and stress tests; document gas
  benchmarks
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.

SC-005 — Implement Weighted Verification Aggregation Engine

1 participant