Omniscia Evergon Labs Audit

PreStakeRewardDistributionFacetStorage Code Style Findings

PreStakeRewardDistributionFacetStorage Code Style Findings

PSD-01C: 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/rewardsDistribution/preStakeRewardDistribution/PreStakeRewardDistributionFacetStorage.sol
57/// @dev Unique identifier for the storage slot where the Layout struct is stored.
58bytes32 internal constant STORAGE_SLOT =
59 keccak256("evergonlabs.Staking.rewardDistribution.storage.PreStakeRewardDistributionFacetStorage");

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.

PSD-02C: Repetitive Invocations of Layout

TypeSeverityLocation
Gas OptimizationPreStakeRewardDistributionFacetStorage.sol:
I-1: L159, L160
I-2: L233, L234

Description:

The referenced statements will repetitively invoke the facet's layout storage pointer inefficiently.

Example:

packages/contracts/contracts/rewardsDistribution/preStakeRewardDistribution/PreStakeRewardDistributionFacetStorage.sol
233GeneralStorage.NftInfo storage nftInfo = GeneralStorage.layout().nftInfo[nftId];
234GeneralStorage.Campaign memory generalCampaignInfo = GeneralStorage.layout().campaignsInfo[campaignId];

Recommendation:

We advise it to be invoked once, stored to a local variable, and consequently re-used as many times as needed.

Alleviation (b64b659786cf3c84bea52feb3a69f546ba3601f0):

The repetitive invocations of the storage's layout have been optimized as advised.

PSD-03C: Repetitive Value Literal

Description:

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

Example:

packages/contracts/contracts/rewardsDistribution/preStakeRewardDistribution/PreStakeRewardDistributionFacetStorage.sol
106if (campaignsInfo.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.