-
Notifications
You must be signed in to change notification settings - Fork 75
Refactor SpokePool inheritance structure #53
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
Conversation
contracts/SpokePool.sol
Outdated
| bool enabled | ||
| ) internal { | ||
| ) public override onlyAdmin nonReentrant { | ||
| _requireAdminSender(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why call both _requireAdminSender() and use the onlyAdmin modifier aren't these redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! That's a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
contracts/SpokePool.sol
Outdated
|
|
||
| function _setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) internal { | ||
| function setDepositQuoteTimeBuffer(uint32 _depositQuoteTimeBuffer) public override onlyAdmin nonReentrant { | ||
| _requireAdminSender(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
contracts/SpokePool.sol
Outdated
| // Once this method is executed and a distribution root is stored in this contract, then `distributeRootBundle` | ||
| // can be called to execute each leaf in the root. | ||
| function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) public override onlyAdmin nonReentrant { | ||
| _requireAdminSender(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
nicholaspai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like this pattern but I think you have some redundant calls
Agreed. Thank you for pointing these out. I originally was just going to do a method call, then I moved to a modifier. Forgot to clean up the old calls. |
This change is mostly just simplifying. It allows the same logic to be performed but with fewer overridden methods in each SpokePool implementation and more of the implementation work done in the base class. There is also a unified modifier that all SpokePool implementations should use to gate admin functions:
onlyAdmin.