Skip to content

Feature/sc 005 verification aggregation engine - #347

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

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

Conversation

@Tobi-8

@Tobi-8 Tobi-8 commented Jul 31, 2026

Copy link
Copy Markdown

Summary

  • Added VerificationAggregator — a deterministic, integer-only weighted consensus engine (SC-005).
  • Aggregates every claim verification into trueWeight/falseWeight/totalWeight via the IVerificationSource interface, with weight = frozen effectiveStake recorded by TruthBountyWeighted at vote time.
  • Computes canonical ClaimOutcome (VERIFIED_TRUE / VERIFIED_FALSE / INCONCLUSIVE) and a 0–10 000 bps confidence score.
  • Deterministic tie handling: equal weights, zero participation, and sub-threshold outcomes resolve to INCONCLUSIVE; no randomness.
  • Configurable minimum-participation thresholds (count, total weight, confidence) enforced in aggregateClaim.
  • Exposes aggregateClaim(), getAggregation(), calculateConfidence(), calculateWeights(); emits ClaimAggregated.
  • Pure consensus calculator — never settles, slashes, or transfers funds; extensible to reputation/quadratic/committee weighting without storage changes.
  • TruthBountyWeighted exposes minimal getClaimVoterCount/getClaimVoterAt/getVoteData view functions for the aggregator.
  • Resolved pre-existing compile blockers on main (PAUSER_ROLE in BootstrapController/MigrationManager, GOVERNANCE_ROLE getter, RewardEngine stack-too-deep) so the suite compiles and CI can run.

Testing

  • 36 tests in test/VerificationAggregator.test.ts: unanimous TRUE/FALSE, mixed, weighted majorities, ties → INCONCLUSIVE, threshold enforcement, idempotency, determinism (same vote multiset in different orders → identical results), 100-verifier stress (decisive + tie), and gas benchmarks.
  • Full suite: 352 passing. 28 pre-existing failures remain on main in unrelated features (BootstrapController bootstrap flow, ExampleSettlement, StaleReputation, TieResolution, TruthBountyWeighted) — verified present independent of this change.
  • Gas (hardhat, solc 0.8.28, runs 200): calculateWeights ≈122k (10 votes) / ≈961k (100 votes); aggregateClaim ≈225k / ≈1 063k; getAggregation ≈35k (constant); cost scales ~linearly (~9.3k gas/vote).

Closes #285

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