2

I have read about adding Storage gaps at the end of Base Upgradeable Contracts for reserving storage slots. More detailed explaination in Openzeppelin Docs here.

But what is the exact amount of storage gap to be added in the base contracts?

At some contracts it is uint256[49] __gap; Sometimes, it is uint256[45] __gap; as seen at Openzeppelin Contracts Upgradeable Sometimes 50 slots.

What is the optimum number?

2
  • There is no optimal number. You take some slots you think you are going to need. ~50 slots should be enough for everyone. Apr 5 at 8:00
  • Thank You for your answer! Implementing 50 slots henceforth! Apr 7 at 5:48

1 Answer 1

3

There is no optimal number as the use of storage gaps is just a convention.

I would suggest you use 50 as in the majority of the examples, but this is really up to you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.