Omniscia Evergon Labs Audit
TwoBorderTimeFacet Code Style Findings
TwoBorderTimeFacet Code Style Findings
TBT-01C: Redundant Initialization Mechanism
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | TwoBorderTimeFacet.sol:L24-L30 |
Description:
The TwoBorderTimeFacet::initPurchaseTimeFacet function will execute the usual code for initializing a facet in an authorized manner, however, the actual TwoBorderTimeFacetStorage contract does not have any initialization code.
Example:
packages/contracts/contracts/internalFacets/purchasePhaseFacets/purchaseTimeFacets/twoBorderTime/TwoBorderTimeFacet.sol
24function initPurchaseTimeFacet(bytes calldata initPurchaseTimeData) external onlyExternalDelegateCall {25 address account = ERC2771RecipientStorage.layout()._msgSender();26 if (!AccessControlFacetStorage.layout().hasRole(AccessControlFacetStorage.ADMIN_ROLE, account))27 revert UnauthorizedInitialization(account);28
29 TwoBorderTimeFacetStorage.layout().initPurchaseTimeFacet(initPurchaseTimeData);30}Recommendation:
We advise either the initialization mechanism to be omitted from the TwoBorderTimeFacetStorage contract and the local function to not perform any statement or the same pattern to be replicated across other empty-initialization facets to ensure consistency in the codebase.
Alleviation (71cda4ccfdcfa25fb96a4565f1f8143b350dd246):
The redundant initialization mechanism has been omitted as advised, optimizing the code's gas cost.
