DatingDapp

AI First Flight #6
Beginner FriendlyFoundrySolidityNFT
EXP
View results
Submission Details
Impact: low
Likelihood: high
Invalid

Unused Custom Error `NotEnoughApprovals` in `MultiSigWallet`

Unused Custom Error NotEnoughApprovals in MultiSigWallet


Description

MultiSigWallet declares a custom error:

error NotEnoughApprovals();

but the approval check in executeTransaction() uses a string-based require instead:

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

As a result, NotEnoughApprovals is dead code. This creates inconsistency in error handling style and slightly increases maintenance overhead.


Risk

Likelihood: High

The issue is present unconditionally in the current source code.

Impact: Low

No direct security compromise is introduced. The impact is limited to code quality, consistency, and minor gas/readability inefficiency.


Proof of Concept

Static check shows declaration without usage:

rg -n "NotEnoughApprovals|Not enough approvals" src/MultiSig.sol

Expected output pattern:

src/MultiSig.sol:7:error NotEnoughApprovals();
src/MultiSig.sol:72:require(txn.approvedByOwner1 && txn.approvedByOwner2, "Not enough approvals");

This confirms the custom error exists but is never used.


Recommended Mitigation

Use the custom error in the approval check for consistency and lower revert-cost footprint:

- require(txn.approvedByOwner1 && txn.approvedByOwner2, "Not enough approvals");
+ if (!(txn.approvedByOwner1 && txn.approvedByOwner2)) revert NotEnoughApprovals();

If string-based errors are preferred project-wide, remove the unused custom error declaration instead.

Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 5 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!