Omniscia 0xPhase Audit
BalancerBase Static Analysis Findings
BalancerBase Static Analysis Findings
BBE-01S: Ineffectual Usage of Safe Arithmetics
Type | Severity | Location |
---|---|---|
Language Specific | BalancerBase.sol:L118, L123, L137 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require
checks or if-else
constructs.
Example:
balancer/diamond/BalancerBase.sol
115uint256 time = _getTime();116
117uint256 start = MathLib.max(118 time - BalancerConstants.APR_DURATION,119 yield.start120);121
122uint256 update = MathLib.max(123 time - BalancerConstants.APR_DURATION,124 yield.lastUpdate125);
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:
All referenced calculations are now safely performed within unchecked
code blocks optimizing their gas cost.