Omniscia Euler Finance Audit
Governance Code Style Findings
Governance Code Style Findings
GEC-01C: Inefficient Negation of Conditional
Type | Severity | Location |
---|---|---|
Gas Optimization | Governance.sol:L207 |
Description:
The referenced if
clause will evaluate a comparative conditional and negate it which is inefficient.
Example:
207if (!(newLTVAmount < origLTV.getLTV(LTVType.LIQUIDATION)) && rampDuration > 0) revert E_LTVRamp();
Recommendation:
We advise the negation to be reflected in the comparator itself, adjusting the <
comparator to >=
so as to optimize the statement by one negation.
Alleviation (fb2dd77a6ff9b7f710edb48e7eb5437e0db4fc1a):
The inefficient negation has been properly assimilated into the conditional itself, optimizing its cost.
GEC-02C: Potentially Misleading Variable Naming
Type | Severity | Location |
---|---|---|
Code Style | Governance.sol:L23, L24, L281 |
Description:
The GUARANTEED_INTEREST_FEE
-prefixed minimum and maximum values, despite what their names imply, are not guaranteed and may be exceeded or subceeded if the newly configured interest fee is approved by the IProtocolConfig
implementation.
Example:
275function setInterestFee(uint16 newInterestFee) public virtual nonReentrant governorOnly {276 // Update vault to apply the current interest fee to the pending interest277 VaultCache memory vaultCache = updateVault();278 logVaultStatus(vaultCache, vaultStorage.interestRate);279
280 // Interest fees in guaranteed range are always allowed, otherwise ask protocolConfig281 if (newInterestFee < GUARANTEED_INTEREST_FEE_MIN || newInterestFee > GUARANTEED_INTEREST_FEE_MAX) {282 if (!protocolConfig.isValidInterestFee(address(this), newInterestFee)) revert E_BadFee();283 }284
285 vaultStorage.interestFee = newInterestFee.toConfigAmount();286
287 emit GovSetInterestFee(newInterestFee);288}
Recommendation:
We advise the names to be adjusted, properly highlighting that they are the governor limitations rather than the protocol limitations.
Alleviation (fb2dd77a6ff9b7f710edb48e7eb5437e0db4fc1a):
The Euler Finance team acknowledged that identifying a descriptive variable name for the referenced constant
declarations is difficult, and opted to retain the existing naming convention while introducing annotation as to why they consider it valid.
We concur with the Euler Finance team's assessment, and consider the introduced comments to be sufficient in elaborating on each variable given that they are only internally exposed.
GEC-03C: Redundant Parenthesis Statement
Type | Severity | Location |
---|---|---|
Code Style | Governance.sol:L114 |
Description:
The referenced statement is redundantly wrapped in parenthesis (()
).
Example:
114return (vaultStorage.configFlags.toUint32());
Recommendation:
We advise them to be safely omitted, increasing the legibility of the codebase.
Alleviation (fb2dd77a6ff9b7f710edb48e7eb5437e0db4fc1a):
The redundant parenthesis statement has been safely omitted as advised, optimizing the code's legibility.