code-423n4 / 2022-01-insure-findings

2 stars 0 forks source link

Gas: Consider making variables that aren't updated outside the constructor as `immutable` #72

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

Dravee

Vulnerability details

Impact

The compiler won't reserve a storage slot for immutable variables

Proof of Concept

The following variables are initialized in the contract's constructor and can't get updated after:

Factory.sol:registry
Factory.sol:ownership
Parameters:ownership
BondingPremium:ownership
Registry:ownership
Vault:ownership

Tools Used

VS Code

Recommended Mitigation Steps

Make these variables immutable

oishun1112 commented 2 years ago

address token can be immutable as well

34