Skip to content

Feature/sc 009 reputation decay - #336

Open
Tobi-8 wants to merge 2 commits into
DigiNodes:mainfrom
Tobi-8:feature/sc-009-reputation-decay
Open

Feature/sc 009 reputation decay#336
Tobi-8 wants to merge 2 commits into
DigiNodes:mainfrom
Tobi-8:feature/sc-009-reputation-decay

Conversation

@Tobi-8

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

Copy link
Copy Markdown

Summary

Implement Reputation Decay Engine (SC-009) with governance-configurable decay parameters,
inactivity tracking, activity reset, minimum reputation floor, and full IReputationOracle
integration.

  • ReputationDecay.sol: core engine with lazy decay evaluation + explicit applyDecay
  • ReputationDecayConfig struct: decayInterval, decayPercentage (basis points),
    minimumReputation, enabled — all governance-configurable via setDecayConfig
  • Linear decay formula: intervals × decayPercentage, capped at 100% BPS
  • Inactivity tracking per address with activity reset via recordActivity
  • View functions: calculateDecay, isDecayRequired, nextDecayTimestamp
  • Implements IReputationOracle: getReputationScore, isActive, getLastReputationUpdate
  • Events: ReputationDecayed, ReputationUpdated, ActivityRecorded, DecayConfigUpdated
  • __gap[50] for upgrade-safe storage
  • Pre-existing compilation fixes: BootstrapController.sol (PAUSER_ROLE),
    MigrationManager.sol (PAUSER_ROLE), hardhat viaIR for RewardEngine.sol

closes #289

Tobi Olusanya added 2 commits July 28, 2026 21:16
- Add VerificationAggregation contract with ClaimOutcome enum, AggregationResult struct
- Implement deterministic weighted consensus: TRUE/FALSE weight calculation, confidence scoring
- Add configurable thresholds: min verification count, min total stake, min confidence
- Handle ties deterministically (INCONCLUSIVE)
- Emit ClaimAggregated event for indexers
- Add IVerificationSource interface for future extensibility (reputation weighting, quadratic voting, etc.)
- Add view functions to TruthBountyWeighted for voter iteration: getClaimVoterCount, getClaimVoterAt, getVerificationWeight, getVerificationSupport, getClaimVerificationWindowEnd, getClaimSubmitter
- Write comprehensive Foundry tests: successful cases, tie handling, determinism, stress tests, gas benchmarks
- Pure integer arithmetic, no floating-point
- Order-independent aggregation guarantees identical output across all nodes
…SC-009)

- Rewrite ReputationDecay.sol: inherit GovernanceOwnable, minimum reputation
  floor, inactivity tracking, linear decay, recordActivity, applyDecay,
  view functions, full IReputationOracle compliance.
- Rewrite tests (ReputationDecay.ts, RBAC.test.ts): 57 tests across
  deployment, decay, governance, access control, edge cases.
- Add Foundry fuzz tests (test/fuzz/ReputationDecayFuzz.t.sol).
- Fix pre-existing compilation errors in BootstrapController.sol and
  MigrationManager.sol (missing PAUSER_ROLE). Enable viaIR in hardhat
  config for stack-too-deep in RewardEngine.sol.
@dDevAhmed

Copy link
Copy Markdown
Contributor

resolve conflicts @Tobi-8

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-009 — Implement Reputation Decay Engine

2 participants