DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: low
Invalid

CEI (Checks-Effects-Interactions) Pattern Not Implemented

Summary

The StrategyOp::_swapUnderlyingToAsset function is an internal function invoked by the claimAndSwap function. Currently, _swapUnderlyingToAsset performs a check to verify if the contract has sufficient underlying balance before proceeding with the swap or claim. If the required balance is unavailable, the transaction reverts. This issue could be mitigated if the balance check were performed directly in the claimAndSwap function, preventing unnecessary reverts.

Impact

If the claimAndSwap function calls _swapUnderlyingToAsset and the transaction reverts due to insufficient underlying balance, it results in higher gas costs. Performing the balance check earlier, within the claimAndSwap function, would avoid unnecessary execution and reduce gas consumption.

Tools Used

Manual review.

Recommendations

Move the balance check currently in _swapUnderlyingToAsset to the claimAndSwap function. This approach adheres to the Checks-Effects-Interactions (CEI) pattern and minimizes the likelihood of unnecessary reverts, reducing gas costs and improving overall efficiency.

Updates

Appeal created

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 5 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.