Skip to content

fix: add storage gaps to GraphTokenGateway and GraphTokenUpgradeable (C4 M-244) #739

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

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contracts/gateway/GraphTokenGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import "../governance/Managed.sol";
* @dev This includes everything that's shared between the L1 and L2 sides of the bridge.
*/
abstract contract GraphTokenGateway is GraphUpgradeable, Pausable, Managed, ITokenGateway {
// Storage gap added in case we need to add state variables to this contract
uint256[50] private __gap;

/**
* @dev Check if the caller is the Controller's governor or this contract's pause guardian.
*/
Expand Down
2 changes: 2 additions & 0 deletions contracts/l2/token/GraphTokenUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ contract GraphTokenUpgradeable is GraphUpgradeable, Governed, ERC20BurnableUpgra
bytes32 private DOMAIN_SEPARATOR;
mapping(address => bool) private _minters;
mapping(address => uint256) public nonces;
// Storage gap added in case we need to add state variables to this contract
uint256[47] private __gap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just keep the gap at 50 until an upgrade happens. But it is nothing critical

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I chose 47 so that for both contracts we use a standard number of total used slots, i.e. 50


// -- Events --

Expand Down