DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

Gas Optimization: Use Immutable Variables for Owner Addresses

Summary

The contract MultiSig.sol declares owner1 and owner2 as regular state variables, but they are only assigned once in the constructor. Changing them to immutable will improve gas efficiency.

Vulnerability Details

The variables owner1 and owner2 are set only once during contract deployment. Since these values never change after deployment, declaring them as immutable reduces gas costs when accessing them, as immutable variables are stored in bytecode instead of storage.

Impact

  • Reduces gas costs when reading owner1 and owner2.

  • Optimizes contract storage by avoiding unnecessary state variable storage slots.

Tools Used

  • Manual Review

Recommendations

Change owner1 and owner2 to immutable for gas efficiency:

address public immutable owner1;
address public immutable owner2;

This ensures that they remain unchanged while optimizing gas usage during contract execution.

Updates

Appeal created

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