Thunder Loan

AI First Flight #7
Beginner FriendlyFoundryDeFiOracle
EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Dead error ThunderLoan__ExhangeRateCanOnlyIncrease declared but never used

Dead Error ThunderLoan__ExhangeRateCanOnlyIncrease Declared but Never Used

Description

  • Smart contracts should be free of dead code to reduce bytecode size and improve maintainability.

  • ThunderLoan.sol declares the custom error ThunderLoan__ExhangeRateCanOnlyIncrease, but it is never referenced or thrown anywhere in the contract.

// ThunderLoan.sol:26
@> error ThunderLoan__ExhangeRateCanOnlyIncrease(uint256 oldExchangeRate, uint256 newExchangeRate);

Risk

Likelihood:

  • Constant static condition in bytecode.

  • Affects all compiled instances of the contract.

Impact:

  • Code pollution and minor unnecessary deployment gas overhead.

  • Auditor and developer confusion.

Proof of Concept

The exploit operates through the following steps:

  1. Search all files in src/ for ThunderLoan__ExhangeRateCanOnlyIncrease.

  2. Notice the error is defined in ThunderLoan.sol line 26 but has zero references.

function test_deadErrorUnused() public pure {
bytes4 selector = ThunderLoan.ThunderLoan__ExhangeRateCanOnlyIncrease.selector;
assertTrue(selector != bytes4(0));
}

Recommended Mitigation

Remove the unused error definition from ThunderLoan.sol.

- error ThunderLoan__ExhangeRateCanOnlyIncrease(uint256 oldExchangeRate, uint256 newExchangeRate);
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 1 hour 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!