Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstring for the gap variable #47

Open
elopio opened this issue Feb 12, 2019 · 2 comments
Open

Add docstring for the gap variable #47

elopio opened this issue Feb 12, 2019 · 2 comments

Comments

@elopio
Copy link
Member

@elopio elopio commented Feb 12, 2019

Contracts have an undocumented uint256[50] private ______gap;

This variable should be documented with a very clear explanation, because it's weird.

@adikancherla

This comment has been minimized.

Copy link

@adikancherla adikancherla commented May 19, 2019

What is this variable used for?

@nventuro

This comment has been minimized.

Copy link
Member

@nventuro nventuro commented May 24, 2019

@nevverlander Since OpenZeppelin contracts are used by inheritance, user-defined variables will be placed by the compiler after OpenZeppelin's ones. If, in a newer version, new variables are added by the library, the storage layouts would be incompatible, and an upgrade would not be possible.

The gap is a workaround to that issue: by leaving a 50-slot gap, we're able to increase the contract's storage by that amount (provided we also remove the same slots from the gap) with no clashing issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.