Closed howlbot-integration[bot] closed 2 months ago
The rsrRewards()
function already reflects the adjusted stakeRSR
and draftRSR
variables after seizure: https://github.com/reserve-protocol/protocol/blob/72fc1f6e41da01e733c0a7e96cdb8ebb45bf1065/contracts/p1/StRSR.sol#L694
thereksfour marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/p1/StRSR.sol#L471-L473
Vulnerability details
Impact
rsrRewardsAtLastPayout
is incorrectly updated to a smaller value inseizeRSR
. This results in the staker pool receiving less rewards in subsequent reward payouts than expected.Proof of Concept
In function
seizeRSR
, the amount of seizedstakeRSR
,draftRSR
, andrewards
are calculated based on the seized ratio, whereseizedRatio = ceil(rsrAmount / rsrBalance)
. At line 472, the seizedrsrRewards
is calculated as(rewards * rsrAmount + (rsrBalance - 1)) / rsrBalance
, and is then added to the totalseizedRSR
. Then the seizedrsrRewards
should be subtracted from the currentrsrRewards
to updatersrRewardsAtLastPayout
. However, it is the totalseizedRSR
is subtracted from the currentrsrRewards
instead of the seizedrsrRewards
. This results inrsrRewardsAtLastPayout
being incorrectly updated to a smaller value.https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/p1/StRSR.sol#L471-L473
The
rsrRewardsAtLastPayout
is used in_payoutRewards
to calculate the payout amount (L609-L610). IfrsrRewardsAtLastPayout
is incorrectly updated to a smaller value, the staker pool will receive less rewards than expected.https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/p1/StRSR.sol#L600-L611
Tools Used
VS Code
Recommended Mitigation Steps
Update the
rsrRewardsAtLastPayout
by subtracting the seizedrsrRewards
from the currentrsrRewards
instead of the totalseizedRSR
.Assessed type
Other