Description: Several state variables in the codebase are not marked as constant
or immutable
despite being set only once. Using these modifiers can save gas as:
constant
variables are replaced by their value at compile time
immutable
variables are read from code instead of storage
The following instances were found:
In MultiSigWallet.sol
:
In LikeRegistry.sol
:
Impact:
Each storage read costs 2100 gas (cold access) or 100 gas (warm access)
Using constant
or immutable
can save significant gas:
constant
: No storage reads, value is embedded in bytecode
immutable
: Single PUSH32 operation (3 gas) instead of SLOAD (100+ gas)
Proof of Concept:
Deploy the following contract in Remix to see the gas difference:
Recommended Mitigation:
For MultiSigWallet.sol
:
For LikeRegistry.sol
:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.