DeFiHardhat
35,000 USDC
View results
Submission Details
Severity: low
Invalid

```try/catch``` blocks without adequate gas can fail

Summary

The try/catch blocks are used inside several the functions (LibWillMinting::initializeOracle, LibChainlinkOracle::getPrice, LibUniswapOracle::consult, LibWell::getTwaReservesFromBeanstalkPump) without ensuring sufficient gas for the operations within the try block. try/catch blocks are used to handle exceptions without halting the entire transaction. If the gas supplied to these operations is insufficient, the call within the try block may revert, leading the catch block to execute. This situation can cause unexpected behaviors.

Impact

When a smart contract uses a try/catch block to handle exceptions or to attempt operations that may fail, it's important to consider the gas implications. A try/catch block allows a contract to attempt an operation (in the try block) and to catch failures (in the catch block) without causing the entire transaction to revert. However, if the gas provided to the try block operation is insufficient, the operation can fail due to an "out of gas" error. This failure mode isn't what the devs intended when catching exceptions (the intention was to catch and handle specific contract-related errors rather than generic execution issues like out of gas). This unforeseen situation can cause unexpected behaviors.

Tools Used

Manual review.

Recommendations

Ensure sufficient gas is supplied when using the try/catch block.

Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Too generic
Assigned finding tags:

Informational/Invalid

kiteweb3 Submitter
about 1 year ago
giovannidisiena Lead Judge
about 1 year ago
giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Too generic
Assigned finding tags:

Informational/Invalid

Support

FAQs

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