Omniscia 0xPhase Audit

VaultBase Code Style Findings

VaultBase Code Style Findings

VBE-01C: Ineffectual Usage of Safe Arithmetics

TypeSeverityLocation
Language SpecificVaultBase.sol:L193, L202, L252

Description:

The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.

Example:

vault/diamond/VaultBase.sol
192if (deposit > targetDeposit) {
193 uint256 amount = deposit - targetDeposit;

Recommendation:

Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.

Alleviation (3dd3d7bf0c):

The two out of the three unchecked code blocks advised have been expanded beyond their original scope to include calculations on the info.deposit member which may be unsafe. We advise them to only perform the highlighted calculation in an unchecked code block, ensuring that the recommended optimization is safely applied.

Alleviation (19668501f8):

The unchecked code blocks were revised to solely perform the subtractions which are guaranteed to be safe, addressing this exhibit in full.