BriVault

First Flight #52
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

State variable should be marked immutable to prevent modification and save gas.

Root + Impact

State variable should be immutable or constant which are not changed.

Description

The contract briVault defines a variable that is intended to remain constant throughout the lifetime of the contract, but it is not marked as immutable or constant.


This allows the variable to be modified (intentionally or accidentally) through future function calls, which can change the contract behavior or increase the attack surface.
Additionally, it leads to extra storage costs since the value is stored in storage instead of bytecode.

Risk

Impact:

This state variable take alot of gas because only they are not immutable or constant.

Recommended Mitigation

- uint256 public participationFeeBsp;
+ uint256 public immutable participationFeeBsp;
- address private participationFeeAddress;
+ address private immutable participationFeeAddress;
- uint256 public eventStartDate;
+ uint256 public immutable eventStartDate;
- uint256 public eventEndDate;
+ uint256 public immutable eventEndDate;
- uint256 public stakedAmount;
+ uint256 public constant stakedAmount;
- uint256 public totalAssetsShares;
+ uint256 public constant totalAssetsShares;
- uint256 public minimumAmount;
+ uint256 public immutable minimumAmount;
Updates

Appeal created

bube Lead Judge 21 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Gas optimizations

Gas optimizations are invalid according to the CodeHawks documentation.

Support

FAQs

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

Give us feedback!