Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Invalid

Variable assigned initial value in upgradeable contract can break future upgrades

Summary

A variable in the StabilityPool contract is assigned an initial value within the contract scope while the contract is intended to be upgradeable which will be problematic in future upgrades.

Vulnerability Details

The StabilityPool contract inherits from multiple OZ upgradeable contracts with intent to be upgradeable:

contract StabilityPool is IStabilityPool, Initializable, ReentrancyGuard, OwnableUpgradeable, PausableUpgradeable

But in the scope of the contract, the index variable is assigned an initial value. According to OZ's guidelines for writing upgradeable contracts, this should not be done since:

"This is equivalent to setting these values in the constructor, and as such, will not work for upgradeable contracts. Make sure that all initial values are set in an initializer function as shown below; otherwise, any upgradeable instances will not have these fields set."

Impact

Assigning an initial value to the index storage variable is against OZ's guidelines for writing upgradeable contracts and can create problems for the protocol in the future.

Tools Used

Manual Review

Recommendations

Assign the value in the initializer instead.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!