Omniscia Sova Network Audit

RoleManaged Code Style Findings

RoleManaged Code Style Findings

RMD-01C: Inefficient Logic Contract Import

Description:

The RoleManager contract imported in the RoleManaged implementation is utilized as an interface.

Example:

src/auth/RoleManaged.sol
4import {RoleManager} from "./RoleManager.sol";
5import {LibRoleManaged} from "./LibRoleManaged.sol";
6
7/**
8 * @title RoleManaged
9 * @notice Base contract for role-managed contracts in the Fountfi protocol
10 * @dev Provides role checking functionality for contracts
11 */
12abstract contract RoleManaged is LibRoleManaged {
13 /*//////////////////////////////////////////////////////////////
14 ERRORS
15 //////////////////////////////////////////////////////////////*/
16
17 error InvalidRoleManager();
18
19 /*//////////////////////////////////////////////////////////////
20 CONSTRUCTOR
21 //////////////////////////////////////////////////////////////*/
22
23 /**
24 * @notice Constructor
25 * @param _roleManager Address of the role manager contract
26 */
27 constructor(address _roleManager) {
28 if (_roleManager == address(0)) revert InvalidRoleManager();
29
30 roleManager = RoleManager(_roleManager);
31 }

Recommendation:

We advise a proper interface to be defined for it and utilized by the RoleManaged 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.