DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Lack of names imports increases gas cost due to increased byte code size


Summary

Relying on full imports is not recommended. This import method introduces unnecessary dependencies, which may increase bytecode size and lead to gas inefficiencies. Full imports can also introduce extended attack vectors by including functions that may not be necessary for the contract. In addition to expanding the attack surface, they can also pollute the namespace, potentially causing unexpected behavior.

Vulnerability Details

Upon reviewing the contracts, the following full imports were identified:

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

Impact

  • Increased gas costs due to unnecessary dependencies.

  • Expanded attack surface, increasing potential security risks.

Recommendations

Use named imports to include only the necessary components:

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";

This approach enhances security, reduces bytecode size, and optimizes gas costs.

Updates

Lead Judging Commences

n0kto Lead Judge 5 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 likelihood 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.