Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Invalid

Duplicate Imports `Errors.sol` File Lead to Compilation Issue and Unnecessary Gas Consumption

Summary

The CurveAdapter.sol, UniswapV2Adapter.sol and UniswapV3Adapter.sol contracts contain a duplicate import statement for the Errors.sol file. This redundancy can lead to compilation warnings, unnecessary gas consumption, and potential issues with code clarity. It's important to remove the duplicate import and ensure proper import practices across all contracts.

Vulnerability Details

The Errors.sol file is imported twice in CurveAdapter.sol, UniswapV2Adapter.sol and UniswapV3Adapter.sol, which is unnecessary and can cause compilation issues or warnings.

src/utils/dex-adapters/CurveAdapter.sol#L5-L9

src/utils/dex-adapters/UniswapV2Adapter.sol#L5-L11

src/utils/dex-adapters/UniswapV3Adapter.sol#L5-L10

// @audit First import
import { Errors } from "@zaros/utils/Errors.sol";
import { SwapExactInputSinglePayload, SwapExactInputPayload } from "@zaros/utils/interfaces/IDexAdapter.sol";
import { ICurveSwapRouter } from "@zaros/utils/interfaces/ICurveSwapRouter.sol";
import { BaseAdapter } from "@zaros/utils/dex-adapters/BaseAdapter.sol";
// @audit Duplicate import
import { Errors } from "@zaros/utils/Errors.sol";

Impact

  1. Compilation Warnings: Redundant imports can trigger unnecessary warnings during the compilation process, which can clutter the build output and potentially lead to confusion.

  2. Increased Gas Consumption: Duplicate imports do not add any functionality but may increase the overall gas cost due to the redundancy.

  3. Reduced Code Readability: Repetitive code decreases clarity and maintainability, making the contract harder to read and understand.

  4. Potential Naming Conflicts: Repeated imports may result in naming conflicts or ambiguity, especially if different versions of the same contract are imported elsewhere.

Tools Used

Manual Code Review

Recommendations

It is recommended to remove duplicate import and delete the redundant import of Errors.sol to ensure cleaner and more efficient code.

Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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