GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Bug Report: Optimize owner with immutable for Gas Savings in GivingThanks.sol

Summary:
The owner variable in GivingThanks.sol is declared as a public state variable. Since this value is set only once during contract deployment and is not intended to change thereafter, it can be marked as immutable to save gas costs associated with storage. By using immutable, the value is set only during the constructor, reducing gas costs for accessing the ownervariable.

Vulnerability Details:
No Vulnerability. Gas Report

Impact:
Low Impact: The impact is primarily related to gas optimization. By making the owner variable immutable, gas costs for reading the owner address will be reduced. This is especially useful in contracts with frequent interactions, where saving on gas can lead to overall cost reductions. The functionality of the contract is not affected, as the owner is not intended to be changed after deployment.

Tools Used:

  • Manual code review

Recommendations:

It is recommended to mark the owner variable as immutable since it is only set once during contract deployment and does not change afterward. This can be achieved by using the immutable keyword.

address public immutable owner; // Changed to immutable
Updates

Lead Judging Commences

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