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

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

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

pcarranzav
Copy link
Member

@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Base: 91.58% // Head: 91.58% // No change to project coverage 👍

Coverage data is based on head (fa52952) compared to base (2dfacb6).
Patch has no changes to coverable lines.

Additional details and impacted files
@@                    Coverage Diff                     @@
##           pcv/700-699-n01-gas-check     #739   +/-   ##
==========================================================
  Coverage                      91.58%   91.58%           
==========================================================
  Files                             42       42           
  Lines                           1996     1996           
  Branches                         356      356           
==========================================================
  Hits                            1828     1828           
  Misses                           168      168           
Flag Coverage Δ
unittests 91.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
contracts/gateway/GraphTokenGateway.sol 100.00% <ø> (ø)
contracts/l2/token/GraphTokenUpgradeable.sol 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -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

Base automatically changed from pcv/700-699-n01-gas-check to pcv/l2-bridge November 10, 2022 10:55
@trust1995
Copy link

trust1995 commented Nov 21, 2022

Consider futureproofing and lining up the Managed.sol to be a 50 slot contract as well.
Same goes for Pausable, Governed contracts.
Without adding a [50] __gap slot for each base contract, that component will not be upgradeable.

@pcarranzav
Copy link
Member Author

Consider futureproofing and lining up the Managed.sol to be a 50 slot contract as well.
Same goes for Pausable, Governed contracts.
Without adding a [50] __gap slot for each base contract, that component will not be upgradeable.

It's a good call, but those other contracts are used by several protocol contracts that are already deployed, so adding a storage gap would break updates in all of those. Luckily the scope for Managed, Pausable and Governed is limited and the behavior is well-defined, so we don't expect to need to add any storage variables to those.

@pcarranzav pcarranzav merged commit fa52952 into pcv/l2-bridge Nov 23, 2022
@pcarranzav pcarranzav deleted the pcv/c4-699-m244-gaps branch November 23, 2022 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants