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

s_owner not being set to immutable, therefore wastes gas

Summary

The PasswordStore::s_owner variable is unable to be changed, therefore it should be immutable to save gas.

Vulnerability Details

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, and instead we should read from the bytecode. 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 to immutable.

- address private s_owner;
+ address private immutable i_owner;
Updates

Lead Judging Commences

inallhonesty Lead Judge
almost 2 years ago
inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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