Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

s_owner must be immutable for low gas

Summary

The 'PasswordStore::s_owner' variable is unable to be changed, and must be immutable to low gas.

Vulnerability Details

'''solidity
contract PasswordStore {
error PasswordStore__NotOwner();

@> address private s_owner;
string private s_password;
'''
If a variable never changes, then reading from storage is less gas efficient. Using an immutable variable will enable the protocol to save gas on reading the 'PasswordStore::s_owner' variable.

Impact

Wastes gas.

Tools Used

-slither

  • foundry

Recommendations

Set s_owner variable to immutable
...diff

  • address private s_owner;

  • address private immutable s_owner;
    ...

Updates

Lead Judging Commences

inallhonesty Lead Judge
almost 2 years ago
inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Gas optimizations

Support

FAQs

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