DittoETH

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

Use `require` instead of `assert`

Summary

Use require instead of assert

Vulnerability Details

Prior to solidity version 0.8.0, hitting an assert consumes the remainder of the transaction's available gas rather than returning it, as require()/revert() do. assert() should be avoided even past solidity version 0.8.0 as its documentation states that The assert function creates an error of type Panic(uint256). ... Properly functioning code should never create a Panic, not even on invalid external input. If this happens, then there is a bug in your contract which you should fix.

Proof Of Concept

File:2023-09-ditto/contracts/libraries/LibAsset.sol
16: assert(tokenContract.balanceOf(msg.sender) < walletBalance);

Context:-

LibAsset.sol#L16

File:2023-09-ditto/contracts/facets/MarginCallSecondaryFacet.sol
87: assert(tokenContract.balanceOf(msg.sender) < walletBalance);

Context:-

MarginCallSecondaryFacet.sol#L87

File:2023-09-ditto/contracts/bridges/BridgeReth.sol
106: assert(sent);

Context:-

BridgeReth.sol#L106

Tools Used

Manual review

Recommendations

Use require()

Updates

Lead Judging Commences

0xnevi Lead Judge
almost 2 years ago
0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Gas optimizations

Support

FAQs

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