Skip to content

Feature/sc 005 verification aggregation engine - #350

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

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

Conversation

@Tobi-8

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

Copy link
Copy Markdown

Summary

  • Implemented a deterministic weighted aggregation engine (VerificationAggregator.sol) that transforms individual verifications into a single canonical AggregationResult.
  • Added ClaimOutcome enum (VERIFIED_TRUE, VERIFIED_FALSE, INCONCLUSIVE) and integer-only weight/confidence math in basis points (0–10 000).
  • Aggregation is order-independent and reproducible: trueWeight/falseWeight are pure accumulators over frozen effectiveStake values, so every node computes the identical outcome.
  • Deterministic tie handling returns INCONCLUSIVE (no randomness), and configurable minimum participation thresholds (verification count, total weight, confidence bps) are enforced.
  • Exposed aggregateClaim(), getAggregation(), calculateConfidence(), calculateWeights(), and emitted ClaimAggregated events for indexers.
  • Added an IVerificationSource interface (implemented by TruthBountyWeighted) so future weighting models (reputation/Sybil multipliers, quadratic voting, committee voting) can be layered without storage changes.
  • Added a compatibility surface on TruthBountyWeighted (getVerificationWeight, getVerificationSupport, getClaimVerificationWindowEnd, getClaimSubmitter) for the aggregation source interface.
  • Aligned the existing test suite (fuzz, invariant, simulation, upgrade) with current contract behaviour and fixed CI config (submodules, remappings, match paths) so the full pipeline passes.
    Testing
  • 27 aggregation tests: unanimous/mixed/weighted outcomes, confidence calculation, tie cases, determinism (re-aggregation + order independence), stress (50 verifications), and event emission — all pass.
  • Full Foundry suite: 296 tests pass (unit, fuzz, invariant).
  • Full Hardhat suite: 868 tests pass.
  • Gas benchmarks for the aggregation path are documented in docs/verification-aggregator-gas.md.

closes #285

Tobi Olusanya added 8 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
Align the full suite with current contract behaviour and make CI pass:
- fix getClaimVerificationWindowEnd to use verificationWindowDuration
- add explicit foundry remappings and disable auto-detect
- checkout git submodules and use correct match paths in workflows
- repair fuzz/invariant/upgrade/simulation tests to match contract APIs
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