DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: low
Valid

Storage location suggested by EIP 7201 not used

Summary

The file Referraland CustomReferraldoesn't use storage location suggested by EIP 7201 and hence they are not eip compliant.

Vulnerability Details

Quoting from eip 7201, the rationale for selecting storage location is:

https://eips.ethereum.org/EIPS/eip-7201

A requirement for the root is that it shouldn’t overlap with any storage
location that would be part of the standard storage tree used by Solidity and
Vyper (root = 0), nor should it be part of the storage tree derived from any other
namespace (another root). This is so that multiple namespaces may be used alongside each
other and alongside the standard storage layout, either deliberately or accidentally,
without colliding. The term keccak256(id) - 1 in the formula is chosen as a location
that is unused by Solidity, but this is not used as the final location because namespaces
can be larger than 1 slot and would extend into keccak256(id) + n, which is potentially used
by Solidity. A second hash is added to prevent this and guarantee that namespaces are completely
disjoint from standard storage, assuming keccak256 collision resistance and that arrays are not
unreasonably large.

However, in Referraland CustomReferraldoesn't adhere to location mentioned in the eip.

https://github.com/Cyfrin/2024-07-zaros/blob/d687fe96bb7ace8652778797052a38763fbcbb1b/src/perpetuals/leaves/Referral.sol#L8

https://github.com/Cyfrin/2024-07-zaros/blob/d687fe96bb7ace8652778797052a38763fbcbb1b/src/perpetuals/leaves/CustomReferralConfiguration.sol#L5

Impact

Possibility of storage collision

Tools Used

Manual

Recommendations

Use the storage location layout suggested by eip 7201 and used in other files.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Storage computation formula of ERC7201 is not followed. ERC7201 non compliance.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!