Skip to content

[CODE QUALITY] Unused Storage Variable in RollupCore.sol #18145

@evmparser

Description

@evmparser

Summary

The RollupCore.sol contract declares a private storage variable gap that is never used, leading to confusing code and wasted deployment gas.

Severity

LOW - Code quality issue, no direct security impact

Location

  • File: l1-contracts/src/core/RollupCore.sol
  • Line: Approximately line 283

Description

The contract declares an unused storage variable:

/**
 * @dev Storage gap to ensure checkBlob is in its own storage slot
 */
uint256 private gap = 0; // This variable is declared but never read or written to.

Issues

  1. Unused Variable: The gap variable is never accessed anywhere in the contract
  2. Unclear Intent: The comment suggests it's for storage layout management, but a single uint256 doesn't create a meaningful gap
  3. Gas Waste: Initializing this variable costs gas on deployment with no benefit
  4. Code Smell: May indicate incomplete implementation of an upgradeability pattern

Impact

  • Minor gas waste on deployment
  • Code confusion for developers and auditors
  • Potential misunderstanding of storage layout intentions

Recommendation

Option 1: If storage gap is needed for upgradeability, implement it properly:

// Reserve 50 storage slots for future upgrades
uint256[50] private __gap;

Option 2: If not needed, remove the variable entirely:

// Remove the unused gap variable and its comment

Option 3: If it's specifically for checkBlob alignment, add a comment explaining why and ensure it's actually achieving the intended layout.

Additional Context

Proper storage gaps are typically implemented as arrays (e.g., uint256[50]) in upgradeable contracts following the OpenZeppelin pattern. A single unused variable doesn't serve this purpose effectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions