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

Redundant check for transfer success

Summary

Inside the _burnDSC method, DSCEngine contract checks for success of transferFrom call and reverts if it is false:

bool success = i_dsc.transferFrom(dscFrom, address(this), amountDscToBurn);
// This conditional is hypothtically unreachable
if (!success) {
revert DSCEngine__TransferFailed();
}

However, if the transferFrom method will not succeed, it will revert. In other case it will always return true. Therefore this check is redundant and can be removed for gas optimization.

Vulnerability Details

n/a

Impact

Unnecessary gas consumption

Tools Used

Manual review

Recommendations

Remove the success check

Support

FAQs

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