Omniscia Steer Protocol Audit
PluginV1 Code Style Findings
PluginV1 Code Style Findings
PV1-01C: Duplicate Validation of Initialization
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | PluginV1.sol:L380, L381 |
Description:
The PluginV1::initialize function will prevent initialization via two distinct conditionals; one imposed in the Initializable::initializer implementation and one via a direct require check in the PluginV1::initialize function.
Example:
375function initialize(376 address,377 address _orchestrator,378 address _steer,379 bytes memory _params380) external initializer {381 require(!isInitialized, "AI");Recommendation:
We advise the latter to be omitted, optimizing the code's gas cost.
Alleviation:
The redundant isInitialized validation and concept has been omitted as advised.
PV1-02C: Generic Typographic Mistake
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | PluginV1.sol:L423 |
Description:
The referenced line contains a typographical mistake (i.e. private variable without an underscore prefix, a non-snake_case module) or generic documentational error (i.e. copy-paste) that should be corrected.
Example:
423maximumUsedPercent = params.maximumUsedPercent;Recommendation:
We advise this to be done so to enhance the legibility of the codebase.
Alleviation:
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
PV1-03C: Inefficient Signature Encodings
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | PluginV1.sol: • I-1: L281 • I-2: L541 • I-3: L731-L743 • I-4: L793-L800 • I-5: L829-L831 • I-6: L841-L843 |
Description:
The referenced statements employ the abi.encodeWithSignature function even though the function names are known during compilation time.
Example:
281(bool success,) = address(this).call(abi.encodeWithSignature("_handleSwapLogic()"));Recommendation:
We advise all statements to be replaced with the abi.encodeWithSelector function instead, utilizing the properly computed bytes4 selectors of each function by importing an interface and using the selector syntax (i.e. IERC20.transferFrom.selector).
Alleviation:
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
PV1-04C: Inexistent Error Messages
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | PluginV1.sol: • I-1: L235 • I-2: L236 • I-3: L289 • I-4: L420 • I-5: L428 • I-6: L466 • I-7: L510 • I-8: L512 • I-9: L527 • I-10: L528 • I-11: L641 • I-12: L659 • I-13: L664 • I-14: L789 • I-15: L825 • I-16: L863 • I-17: L881 • I-18: L882 • I-19: L889 • I-20: L890 |
Description:
The linked require checks have no error messages explicitly defined.
Example:
235require(!timepoints[startIndex].initialized); // if not initialized, then all subsequent ones tooRecommendation:
We advise each to be set so to increase the legibility of the codebase and aid in validating the require checks' conditions.
Alleviation:
All referenced require checks have been converted to if-revert checks with explicit error declarations, addressing this exhibit.
PV1-05C: Misleading Function Name
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | PluginV1.sol:L280 |
Description:
The PluginV1::_writeTimepointAndUpdateFee function, contrary to what its name implies, will solely write a timepoint and will not update any fees.
Example:
275function beforeSwap(address, address, bool, int256, uint160, bool, bytes calldata)276 external277 onlyPool278 returns (bytes4, uint24, uint24)279{280 _writeTimepointAndUpdateFee();281 (bool success,) = address(this).call(abi.encodeWithSignature("_handleSwapLogic()"));282 if (!success) {283 emit LogicExecutionFailed("Swap Logic Execution Failed", abi.encodePacked(msg.data));284 }285 return (IAlgebraPlugin.beforeSwap.selector, 0, 0);286}Recommendation:
We advise the function to be aptly renamed, ensuring it properly represents its contents.
Alleviation:
The function was aptly renamed to indicate it simply writes a timepoint, addressing this exhibit.
PV1-06C: Redundant Distinction of Conditionals
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | PluginV1.sol:L305, L308 |
Description:
The referenced conditionals will execute the same statements if they evaluate to true.
Example:
305if (!isTendNeeded) {306 // When tend is not needed307 rebalance(liquidities, _pos, isSwapNeeded);308} else if (!isSwapNeeded) {309 rebalance(liquidities, _pos, isSwapNeeded);310}Recommendation:
We advise them to be combined into a single conditional, optimizing the code's gas cost.
Alleviation:
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
PV1-07C: Repeated Constant Declarations
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | PluginV1.sol:L60, L64 |
Description:
The referenced constant declarations point to the same underlying value.
Example:
60uint256 internal constant DIVISOR = 100_00;61/// @dev maximum value that can be passed in total weight parameter of tend62uint256 internal constant TOTAL_WEIGHT_MAX = 100_00;63
64uint256 internal constant DIVISOR100 = 100;Recommendation:
We advise a single constant to be utilized in their place.
Alleviation:
Both declarations have been omitted in favour of a single constant, addressing this exhibit.
PV1-08C: Unresolved TODO Comment
| Type | Severity | Location |
|---|---|---|
| Standard Conformity | ![]() | PluginV1.sol:L121 |
Description:
The referenced helper contract is presently inaccessible due to pointing to an incorrect address.
Example:
121address internal constant helper = 0x0000000000000000000000000000000000000050;Recommendation:
We advise the proper address to be utilized here after the conclusion of the audit report to ensure the PluginV1 contract behaves as expected.
Alleviation:
The Steer Protocol team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
PV1-09C: Unused Contract Constants
Description:
The referenced constant declarations remain unused.
Example:
49/// @notice Fee info50/// @dev Fee rates, each multiplied by 10,00051/// (a TOTAL_FEE of 100 means a 1% cut of total uniswap fees)52/// @dev Total fraction of fees not going towards LPs, multiplied by 10,00053uint256 public constant TOTAL_FEE = 15_00;54/// @dev Total fraction of fees going towards Steer (as opposed to going towards strategist)55uint256 public constant STEER_FRACTION_OF_FEE = 66_67;56/// @dev Total fraction of fees going towards strategies57uint256 public constant STRATEGIST_FRACTION_OF_FEE = 33_33;58uint256 internal constant FEE_DIVISOR = 100_00;59uint256 internal constant ONE_MINUS_FEE = FEE_DIVISOR - TOTAL_FEE;60uint256 internal constant DIVISOR = 100_00;61/// @dev maximum value that can be passed in total weight parameter of tend62uint256 internal constant TOTAL_WEIGHT_MAX = 100_00;63
64uint256 internal constant DIVISOR100 = 100;65
66uint256 internal constant FIVE = 5;67
68/// @dev first deposit should mint MIN_SHARES or greater number of shares69uint256 internal constant MIN_SHARES = 1_000_000;Recommendation:
We advise them to be omitted, optimizing the code's syntax.
Alleviation:
All unused constant declarations have been omitted as advised.
