Closed howlbot-integration[bot] closed 3 months ago
require(revTotals.rsrTotal + revTotals.rTokenTotal == MAX_DISTRIBUTION, "Invalid total distribution");
This is not an invariant of the protocol.
The Distributor table does not need to sum to 10000 (100%). This is documented here as the invariant
sum across destinations must be at least MAX_DISTRIBUTION
Explicitly saying, they are ratios but need to be a minimum of MAX_DISTRIBUTION
, they do not need to sum to it!
thereksfour marked the issue as unsatisfactory: Invalid
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