DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: low
Invalid

Require Should Used Instead of Assert

Require Should Used Instead of Assert

  • Severity: Low

  • Confidence: High

Description

Solidity has two error handling functions: require() and assert(). require() is used for validating user input and other conditions that must be met for the code to execute successfully. When a require() statement fails, the transaction is reverted and gas is consumed. assert() is used for checking internal errors in the code, and when it fails, all gas is consumed and the transaction is reverted. However, assert() is discouraged as it can cause serious problems, such as wasted gas and denial of service attacks. Therefore, it's recommended to use require() instead of assert() in most cases.

There are 2 instances of this issue:

File: contracts/bridges/BridgeReth.sol
106 assert(sent)

use require instead

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/bridges/BridgeReth.sol#L106

File: contracts/facets/MarginCallSecondaryFacet.sol
87 assert(tokenContract.balanceOf(msg.sender) < walletBalance)

use require instead

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/MarginCallSecondaryFacet.sol#L87

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Gas optimizations

Support

FAQs

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