Feisty Opaque Vulture - lastCheckpointTime
is updated even when the totalEarningPower
is zero and causes reward tokens to be stuck in the contract
#86
Labels
Won't Fix
The sponsor confirmed this issue will not be fixed
Feisty Opaque Vulture
Medium
lastCheckpointTime
is updated even when thetotalEarningPower
is zero and causes reward tokens to be stuck in the contractSummary
Stakers accumulate rewards monotonically over time. But when the
totalEarningPower
equals0
, thelastCheckpointTime
is updated even though therewardPerTokenAccumulatedCheckpoint
stays the same. Consequently, the total amount of reward tokens that has been sent to the contract cannot be accumulated and will remain in the contract.Vulnerability Detail
When
rewardPerTokenAccumulated()
is called but thetotalEarningPower
equals0
, it is not updated. However, thelastCheckpointTime
is updated.As a result, reward tokens will remain in the contract and cannot be accumulated in the future.
Impact
Reward tokens which have not been accumulated will remain in the contract. If noone staked during the whole reward duration, the whole reward amount remains in the contract.
Code Snippet
https://github.com/sherlock-audit/2024-11-tally/blob/b125d1f2b52170a3789b1060a52fc6609e6e2262/staker/src/GovernanceStaker.sol#L439-L441
https://github.com/sherlock-audit/2024-11-tally/blob/b125d1f2b52170a3789b1060a52fc6609e6e2262/staker/src/GovernanceStaker.sol#L304
Tool used
Manual Review
Recommendation
Consider implementing a withdraw functionality so that leftover reward tokens can be withdrawn.
The text was updated successfully, but these errors were encountered: