20,000 USDC
View results
Submission Details
Severity: gas
Valid

Redundant if check

Summary

There is a redundant if check slightly increasing the gas price

Vulnerability Details

In Staking.sol the update function checks if there are accumulated rewards. This if statement checks if the difference between the current balance and the recorded balance is greater than 0. This check is redundant because of the previous if statement that makes sure that _balance will be greater than balance, therefore diff will always be greater than 0.

Impact

The unnecessary if statement spends slightly more gas than needed. It also clutters the code.

Tools Used

Manual review

Recommendations

Remove the redundant if statement

Support

FAQs

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