DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

Gas Optimization Issue: Unused Custom Error and String-Based Revert

Summary

The NotEnoughApprovals error in MultiSig.sol is defined in the contract but is never used. Instead, the contract relies on a string-based revert message in require statements.

Vulnerability Details

The contract defines the custom error `NotEnoughApprovals, but is not used anywhere in the code. Instead, the following line uses a string-based error message:

require(txn.approvedByOwner1 && txn.approvedByOwner2, "Not enough approvals");

Using string-based error messages instead of custom errors increases gas costs because strings consume more storage and processing compared to custom errors.

Impact

  • Increased gas costs when reverting transactions due to inefficient error handling.

  • The presence of an unused error may indicate incomplete implementation or code redundancy.

Tools Used

  • Manual Review

Recommendations

Replace the string-based revert message with the NotEnoughApprovals custom error to optimize gas usage and improve contract readability

if (!(txn.approvedByOwner1 && txn.approvedByOwner2)) {
revert NotEnoughApprovals();
}
Updates

Appeal created

n0kto Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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