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

Incorrect Import Path for IDataStore Interface

[M-02] Incorrect Import Path for IDataStore Interface

Description

The PerpetualVault contract uses an incorrect import path for the IDataStore interface. While the contract compiles successfully, this could lead to interface mismatch issues and potential runtime errors if the wrong interface version is used.

Impact

MEDIUM - Potential runtime errors

  • Could call wrong interface methods

  • May miss critical interface updates

  • Potential for silent failures

  • Affects contract upgradability

Proof of Concept

Current implementation:

// PerpetualVault.sol
import "../interfaces/gmx/IDataStore.sol"; // Incorrect path
contract PerpetualVault {
IDataStore public dataStore;
function someFunction() external {
// Could call wrong interface method
dataStore.getUint(bytes32(0));
}
}

The correct path should be:

import "@gammaprotocol/interfaces/IDataStore.sol"; // Correct path

Root Cause

The issue stems from:

  1. Incorrect relative path in imports

  2. Missing package reference

  3. No version control on interface imports

Recommendations

Short Term

  1. Update import paths to use correct package references:

// Use explicit package imports
import "@gammaprotocol/interfaces/IDataStore.sol";

Long Term

  1. Implement strict interface versioning

  2. Add compile-time interface checks

  3. Consider using Interface Registry pattern

  4. Add automated import path verification in CI

Risk Assessment

Impact Analysis

  • Technical: Medium (interface mismatch)

  • Scope: Core contract functionality

  • Complexity: Low (configuration issue)

Affected Components

  • Contract imports

  • Interface definitions

  • Contract upgrades

  • Protocol integrations

Timeline

  • Found: February 20, 2025

  • Reported: February 21, 2025

  • Fixed: Pending

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.