Omniscia vfat Audit

SickleMultisig Code Style Findings

SickleMultisig Code Style Findings

SMG-01C: Inefficient Evaluation of Atomic Signer Operation

TypeSeverityLocation
Gas OptimizationSickleMultisig.sol:
I-1: L367, L369
I-2: L375, L378

Description:

The SickleMultisig::_addSigner and SickleMultisig::_removeSigner functions will inefficiently invoke the SickleMultisig::isSigner function to evaluate whether the EnumerableSet operation would succeed (i.e. the addition and removal of an element respectively).

Example:

contracts/governance/SickleMultisig.sol
367if (isSigner(signer)) revert SignerAlreadyAdded();
368
369_signers.add(signer);

Recommendation:

We advise the return value of each EnumerableSet operation to be utilized instead, optimizing each function's gas cost.

Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):

The referenced signer inclusion and removal operations have been optimized as advised.

SMG-02C: Inefficient Layout of Storage

Description:

The Transaction data entry will contain three distinct bool entries to evaluate the state a transaction is in which is inefficient.

Example:

contracts/governance/SickleMultisig.sol
18struct Transaction {
19 // Calls to be executed in the transaction
20 Proposal proposal;
21 // Transaction state
22 bool exists;
23 bool executed;
24 bool cancelled;
25 // Settings nonce that the transaction was created with
26 uint256 settingsNonce;
27 // Signing state
28 uint256 signatures;
29 mapping(address => bool) signed;
30}

Recommendation:

We advise a single uint256 entry to be utilized instead whose states are represented via constant declarations, optimizing the gas cost involved in validating a transaction.

To note, this update would be compatible with the existing storage layout of the system.

Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):

The code was updated to utilize a single enum instead which incurs a slightly higher gas overhead than uint256 representations yet achieves the same purpose.

As such, we consider the original gas inefficiency addressed.