Omniscia Alliance Block Audit
MultiSigWalletFactory Code Style Findings
MultiSigWalletFactory Code Style Findings
MSF-01C: Data Location Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | MultiSigWalletFactory.sol:L33, L47 |
Description:
The linked functions are declared as external
and possess a memory
argument.
Example:
contracts/MultiSigWalletFactory.sol
33function deploy(address[] memory signers)34 external35 returns (address)36{37 MultiSigWallet multiSigWallet = new MultiSigWallet();38 emit MultiSigWalletDeployed(address(multiSigWallet), msg.sender);39 multiSigWallet.initialize(signers);40 return address(multiSigWallet);41
42}
Recommendation:
We advise the memory
argument to be set as calldata
greatly optimizing the gas cost of the functions.
Alleviation:
The optimization was applied to the deploy
function that remained within the contract.
MSF-02C: Variable Mutability Specifiers
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | MultiSigWalletFactory.sol:L21, L24 |
Description:
The contractCodeHash
variable is assigned to only once during the contract's constructor
.
Example:
contracts/MultiSigWalletFactory.sol
21bytes32 private contractCodeHash;22
23constructor() {24 contractCodeHash = keccak256(type(MultiSigWallet).creationCode);25}
Recommendation:
We advise it to be set as immutable
greatly optimizing the gas cost of wherever it is utilized. Additionally, we believe it can be set to constant
if the assignment is relocated to its declarations as the creationCode
and the keccak256
instruction can be pre-computed by the Solidity compiler.
Alleviation:
The contractCodeHash
variable no longer exists and as such this exhibit is no longer applicable.