Omniscia Evergon Labs Audit

Erc1155FractionFacetStorage Code Style Findings

Erc1155FractionFacetStorage Code Style Findings

EFS-01C: Inconsistent State Definitions

Description:

The created state ID is considered to be a value of 1 yet the code increments the currentState as if it is meant to be dynamic.

Example:

packages/contracts/contracts/internalFacets/createFractionsPhaseFacets/fractionFacets/erc1155/Erc1155FractionFacetStorage.sol
90function updateState(address fractionAddress) internal {
91 GeneralStorage.Layout storage generalStorage = GeneralStorage.layout();
92
93 uint256 campaignId = ++generalStorage.currentId;
94 generalStorage.infoForId[campaignId].fractionsContract = fractionAddress;
95 // generalStorage.infoForId[campaignId].fractionTypeCode = 3;
96
97 // We progress from state 0 (NON_EXISTENT) to state 1 (CREATED) for this ID
98 uint256 currentState = IStateFacet(address(this)).getStateOfId(campaignId);
99 IStateFacet(address(this)).changeState(campaignId, currentState, currentState + 1);
100}

Recommendation:

We advise the system to either utilize reserved state IDs similarly to buy-back and post-receive states or to mandate that the end-state is 1 in all cases.

Alleviation (71cda4ccfdcfa25fb96a4565f1f8143b350dd246):

A constant based campaign state is now configured whenever Erc1155FractionFacetStorage::_updateState is invoked, addressing this exhibit.

EFS-02C: Non-Standard Storage Slot Definition

Description:

The referenced declaration will define a storage slot for use by a facet of the system's main EIP-2535 Diamond, however, the way it is declared does not adhere to the latest standards.

Example:

packages/contracts/contracts/internalFacets/createFractionsPhaseFacets/fractionFacets/erc1155/Erc1155FractionFacetStorage.sol
29bytes32 internal constant STORAGE_SLOT = keccak256("Evergonlabs.Tmi-Tokenizer.storage.Erc1155FractionFacetStorage");

Recommendation:

We advise the EIP-7201 name-spaced layout approach to be adhered to similarly to OpenZeppelin and other relevant standard libraries, ensuring consistency among the ecosystem's widely utilized libraries and conforming to the latest standards.

Alleviation (71cda4ccfdcfa25fb96a4565f1f8143b350dd246):

The referenced slot definition has been updated to its standardized EIP-7201 representation, addressing this exhibit.