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

Non-Immutable State Variables [Gas Inefficiency]

Summary

Several state variables that should be immutable are declared as regular state variables, leading to unnecessary storage reads.

Vulnerability Details

The following variables should be marked as immutable:

In PerpetualVault:

uint256 public governanceFee;
uint256 public leverage;

In VaultReader:

address public orderHandler;
IDataStore public dataStore;
address public orderVault;
IGmxReader public gmxReader;
address public referralStorage;

These values are set once in the constructor and never changed, making them perfect candidates for immutable variables.

Impact

  • Increased gas costs for reading state variables

  • Unnecessary storage operations

  • Higher transaction costs for users

Recommendations

Mark appropriate variables as immutable:

In PerpetualVault

uint256 public immutable governanceFee;
uint256 public immutable leverage;

In VaultReader

address public immutable orderHandler;
IDataStore public immutable dataStore;
address public immutable orderVault;
IGmxReader public immutable gmxReader;
address public immutable referralStorage;
Updates

Lead Judging Commences

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

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

Give us feedback!