Inflated rsrTotal Due to Unchecked DAO Fee Calculation in totals() Function #241
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
🤖_28_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-reserve/blob/3f133997e186465f4904553b0f8e86ecb7bbacbf/contracts/p1/Distributor.sol#L204
Vulnerability details
Vulnerability Details
The
totals()
function is responsible for calculating the total shares for RSR and RToken distribution. It's a critical component for ensuring proper revenue distribution and maintaining system invariants.The issue is in the DAO fee calculation part of the function. The current implementation can lead to an inflation of the
rsrTotal
, potentially breaking system invariants and causing unexpected behavior in revenue distribution.Details
rsrTotal
.MAX_DISTRIBUTION
).Code Snippet
Impact
Scenario
Suppose the initial distribution is:
The
totals()
function will return:Total distribution: 105.55%, which exceeds 100%.
Fix
To address this issue, the function should be modified to incorporate the DAO fee without inflating the total distribution. Here's a potential fix:
MAX_DISTRIBUTION
.Example implementation:
This fix ensures that the total distribution always equals
MAX_DISTRIBUTION
, maintaining system invariants and providing a more accurate representation of revenue shares.Assessed type
Context
The text was updated successfully, but these errors were encountered: