Liquid Staking

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

There's no explicit check for zero amount in the `StakingPool::burn` function.

Relevant GitHub Links

https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/core/StakingPool.sol#L423

Summary

The StakingPool::burn function can be called with a zero amount.

Vulnerability Details

When burning the senders liquid staking tokens with the StakingPool::burn function, no restriction was be made about the zero amount so the Burn event will still be emitted, even if no actual burning occurred, which creates confusion and consumes gas unnecessarily:

function burn(uint256 _amount) external {
// @audit missing prevent zero-value transfers
_burn(msg.sender, _amount);
emit Burn(msg.sender, _amount);
}

Impact

- Gas Usage: The function will still consume gas even for zero burns.

- Event Emission: Emitting an event for a zero burn might be unnecessary and could potentially lead to confusion in off-chain systems monitoring these events.

Tools Used

Manual analysis.

Recommendations

function burn(uint256 _amount) external {
+ require(_amount > 0, "Burn amount must be greater than zero");
_burn(msg.sender, _amount);
emit Burn(msg.sender, _amount);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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