Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: low
Invalid

[L-1] In updateReward:: RewardsPool the variable `newRewards` should be initialized as int256 rather than uint256

**Description: In the function **updateReward::RewardsPoolthe variable unint256 newRwards should be initialized as int256 rather than uint256 to avoid unecessary revert if withdrawableRewards(_account) > userRewards[_account]

function updateReward(address _account) public virtual {
uint256 newRewards = withdrawableRewards(_account) - userRewards[_account];
//this if statement is not utilized as uint256 newRewards cannot be negative
if (newRewards > 0) {
userRewards[_account] += newRewards;
}
userRewardPerTokenPaid[_account] = rewardPerToken;
}

Impact: Unecessary revert where updateReward::RewardsPool is called in the protocol (given where withdrawableRewards(_account) > userRewards[_account])

Recommended Mitigation:

function updateReward(address _account) public virtual {
- uint256 newRewards = withdrawableRewards(_account) - userRewards[_account];
+ int256 newRewards = withdrawableRewards(_account) - userRewards[_account];
//so this next line can be utilized
if (newRewards > 0) {
userRewards[_account] += newRewards;
}
userRewardPerTokenPaid[_account] = rewardPerToken;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.