hats-finance / Metrom-0xfdfc6d4ac5807d7460da20a3a1c0c84ef2b9c5a2

Smart contracts for the Metrom project.
GNU General Public License v3.0
0 stars 0 forks source link

Upgradable contracts should have a __gap variable #25

Open hats-bug-reporter[bot] opened 6 months ago

hats-bug-reporter[bot] commented 6 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0x8b8b1f5a83a884203e202d43e55b44f7399a774dd193897c6e98a017b51f251e Severity: low

Description: Description\ This is a array to reserve spece for future state varaibles to be placed after the exisiting ones within the contract. This is to ensure the team can add new state variables without compromising compatibility.

Attachments

  1. Proof of Concept (PoC) File

['30']

30: contract Metrom is IMetrom, UUPSUpgradeable 
luzzif commented 6 months ago

I saw this used in those cases where inheritance is a factor. So if you have multiple contracts that are in an inheritance chain you can use the gap variable to make it possible to add state variables to an intermediate contract without issues, but in this case we're talking about one single contract that only inherits from OZ Upgradeable contracts, so assuming care is taken in placing new state variables at the end of the previous one, no overwriting should happen.