Omniscia Steer Protocol Audit
AlgebraBaseLiquidityManager Code Style Findings
AlgebraBaseLiquidityManager Code Style Findings
ABL-01C: Generic Typographic Mistakes
Type | Severity | Location |
---|---|---|
Code Style | AlgebraBaseLiquidityManager.sol:L85, L200, L211, L348, L550, L556 |
Description:
The referenced lines contain typographical mistakes (i.e. private
variable without an underscore prefix) or generic documentational errors (i.e. copy-paste) that should be corrected.
Example:
85/// @notice Address of Uniswap V3 pool
Recommendation:
We advise them to be corrected enhancing the legibility of the codebase.
Alleviation (0c3f85c7c11805ac412fe291f5681bef26da7244):
All referenced typographic mistakes have been corrected, addressing this exhibit.
ABL-02C: Ineffectual Usage of Safe Arithmetics
Type | Severity | Location |
---|---|---|
Language Specific | AlgebraBaseLiquidityManager.sol:L508, L509, L558 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require
checks or if-else
constructs.
Example:
503require(cross > 0, "C");504
505// Round up amounts506// cross - 1 can be unchecked since above we require cross != 0507// total1 and total0 are also both > 0508amount0Used = ((cross - 1) / total1) + 1;509amount1Used = ((cross - 1) / total0) + 1;
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 (0c3f85c7c11805ac412fe291f5681bef26da7244):
The contract has regressed its pragma
version to 0.7.6
thereby indirectly performing the referenced calculations utilizing unsafe arithmetics.
ABL-03C: Inefficient Data Type
Type | Severity | Location |
---|---|---|
Gas Optimization | AlgebraBaseLiquidityManager.sol:L96, L544 |
Description:
The twapInterval
variable within AlgebraBaseLiquidityManager
is set as an int56
variable improperly as it is mandated to always be positive by the AlgebraBaseLiquidityManager::initialize
function and is always cast to a uint32
variable by the AlgebraBaseLiquidityManager::_checkVolatility
function.
Example:
544uint32 _twapInterval = uint32(uint56(twapInterval));
Recommendation:
We advise it to be set to a uint32
variable, optimizing the code's gas cost and code style.
Alleviation (0c3f85c7c11805ac412fe291f5681bef26da7244):
The variable's data type has been properly reduced in accuracy, optimizing its usage and addressing this exhibit.
ABL-04C: Inexistent Error Messages
Type | Severity | Location |
---|---|---|
Code Style | AlgebraBaseLiquidityManager.sol:L165, L191, L192, L206, L217, L249-L254, L328, L329, L341, L414 |
Description:
The linked require
checks have no error messages explicitly defined.
Example:
165require(shares > 0);
Recommendation:
We advise each to be set so to increase the legibility of the codebase and aid in validating the require
checks' conditions.
Alleviation (0c3f85c7c11805ac412fe291f5681bef26da7244):
The Steer Protocol team evaluated this exhibit and opted to not introduce error messages so as to free up available bytecode space for other adaptations to the code as the contract is approaching its size limit.
Given that it is not practically possible to introduce these explicit errors due to size constraints, we consider this exhibit addressed.
ABL-05C: Inexplicable Value Literals
Type | Severity | Location |
---|---|---|
Code Style | AlgebraBaseLiquidityManager.sol:L328, L329 |
Description:
The referenced configurational limitations are inexplicable as they contain no documentation and represent seemingly arbitrary values.
Example:
328require(_maxTickChange > 9 && _maxTickChange < 2001);329require(_twapInterval > 5 && _twapInterval < 600);
Recommendation:
We advise them to be properly documented and preferably relocated to contract-level constant
variables that contain these annotations, greatly increasing the legibility of the codebase.
Alleviation (0c3f85c7c1):
The Steer Protocol team has stated that they do not wish to introduce constant
declarations to the contract in fear of increasing its bytecode size.
All variables declared as constant
are compilation artefacts and do not affect the contract's bytecode size. Additionally, the literal-based limitations imposed on the configurational _twapInterval
and _maxTickChange
variables remain undocumented, rendering this exhibit acknowledged.
Alleviation (b1b5eabd4d):
The referenced value literals have been adequately relocated to contract-level constant
declarations, however, their documentation remains subpar. We consider this exhibit acknowledged safely based on the fact that the Steer Protocol team has adequately vetted the values they have specified for them.