Omniscia Evergon Labs Audit

WhitelistedStakersFacetStorage Code Style Findings

WhitelistedStakersFacetStorage Code Style Findings

WSS-01C: Inefficient Array Assignment

Description:

The referenced statements will copy the eligibleRoles_ array to the l.eligibleRolesPerCampaign[campaignId] data entry inefficiently.

Example:

packages/contracts/contracts/eligibilityFacets/stakersEligibility/whitelistedStakers/WhitelistedStakersFacetStorage.sol
103// Initialize dynamic l.eligibleRoles array
104l.eligibleRolesPerCampaign[campaignId] = new bytes32[](length);
105
106for (uint256 i; i < length; i++) {
107 l.eligibleRolesPerCampaign[campaignId][i] = eligibleRoles_[i];
108}

Recommendation:

We advise a direct assignment to be performed, overwriting existing data efficiently.

Alleviation (b64b659786cf3c84bea52feb3a69f546ba3601f0):

The roles are directly assigned as advised, optimizing the code's legibility.

WSS-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/eligibilityFacets/stakersEligibility/whitelistedStakers/WhitelistedStakersFacetStorage.sol
32/// @dev Unique identifier for the storage slot where the Layout struct is stored.
33bytes32 internal constant STORAGE_SLOT = keccak256("evergonlabs.Staking.storage.WhitelistedStakersFacetStorage");

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 (b64b659786cf3c84bea52feb3a69f546ba3601f0):

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

WSS-03C: Repetitive Value Literal

Description:

The linked value literal is repeated across the codebase multiple times.

Example:

packages/contracts/contracts/eligibilityFacets/stakersEligibility/whitelistedStakers/WhitelistedStakersFacetStorage.sol
88if (GeneralStorage.layout().campaignsInfo[campaignId].state != 1) {

Recommendation:

We advise it to be set to a constant variable instead, optimizing the legibility of the codebase.

In case the constant has already been declared, we advise it to be properly re-used across the code.

Alleviation (b64b659786cf3c84bea52feb3a69f546ba3601f0):

The referenced literal has been properly introduced as part of the GeneralStakingStorage declarations and specifically as an ON_CREATION state, addressing this exhibit.