Omniscia Sova Network Audit
CloneableRoleManaged Code Style Findings
CloneableRoleManaged Code Style Findings
CRM-01C: Inefficient Logic Contract Import
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | CloneableRoleManaged.sol:L4, L35 |
Description:
The RoleManager contract imported in the CloneableRoleManaged implementation is utilized as an interface.
Example:
src/auth/CloneableRoleManaged.sol
4import {RoleManager} from "./RoleManager.sol";5import {LibRoleManaged} from "./LibRoleManaged.sol";6
7/**8 * @title CloneableRoleManaged9 * @notice Clone-compatible base contract for role-managed contracts in the Fountfi protocol10 * @dev Provides role checking functionality for contracts that will be deployed as clones11 */12abstract contract CloneableRoleManaged is LibRoleManaged {13 /*//////////////////////////////////////////////////////////////14 ERRORS15 //////////////////////////////////////////////////////////////*/16
17 error InvalidRoleManager();18
19 /*//////////////////////////////////////////////////////////////20 EVENTS21 //////////////////////////////////////////////////////////////*/22
23 event RoleManagerInitialized(address indexed roleManager);24
25 /*//////////////////////////////////////////////////////////////26 INITIALIZATION27 //////////////////////////////////////////////////////////////*/28
29 /**30 * @notice Initialize the role manager (for use with clones)31 * @param _roleManager Address of the role manager contract32 */33 function _initializeRoleManager(address _roleManager) internal {34 if (_roleManager == address(0)) revert InvalidRoleManager();35 roleManager = RoleManager(_roleManager);36 emit RoleManagerInitialized(_roleManager);37 }Recommendation:
We advise a proper interface to be defined for it and utilized by the CloneableRoleManaged contract, optimizing its bytecode size.
Alleviation (e4d6885477438291b0d3ca477fab7e088522967b):
The Sova Network team evaluated this exhibit and specified that they observed an increase in the generated bytecode size when importing an interface rather than a logic implementation.
We do not believe such a discrepancy should arise if the RoleManager is removed. Nevertheless, compilation discrepancies are difficult to precisely assess confidently due to varying compilation environments rendering this exhibit acknowledged.
