rsrRewardsAtLastPayout
is incorrectly updated to a smaller value in seizeRSR
.
#168
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
🤖_57_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/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
The text was updated successfully, but these errors were encountered: