Omniscia Olympus DAO Audit

Timelock Code Style Findings

Timelock Code Style Findings

TIM-01C: Redundant Implementation

TypeSeverityLocation
Language SpecificInformationalTimelock.sol:L53-L64

Description:

The sqrrt implementation present within the in-file declared SafeMath function is redundant and overly convoluted by wrapping each statement with its SafeMath equivalent, which at times is unnecessary such as when dividing with non-zero value literals.

Example:

contracts/governance/Timelock.sol
53function sqrrt(uint256 a) internal pure returns (uint c) {
54 if (a > 3) {
55 c = a;
56 uint b = add( div( a, 2), 1 );
57 while (b < c) {
58 c = b;
59 b = div( add( div( a, b ), b), 2 );
60 }
61 } else if (a != 0) {
62 c = 1;
63 }
64}

Recommendation:

We advise the implementation to be entirely omitted to also ensure that source code match analysis detects the Timelock contract as being an identical copy of Compound's implementation.

Alleviation:

The sqrrt function was safely omitted from the codebase.