-
Notifications
You must be signed in to change notification settings - Fork 958
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
Feature: Enhance 1.4.1 contract checks for support proxy contract #683
Conversation
Pull Request Test Coverage Report for Build 6610678646
💛 - Coveralls |
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.
Code looks good to me, as for the rationale, is it just we don't want to accidentally run this migration on a proxy contract that isn't the standard Safe proxy contract (and overwrite some important storage that the proxy contract uses for other things)?
Yes and no. A correct proxy implementation should use something other than this storage slot because things may break. In this case, it's more about running a migration transaction without migrating anything. For version 1.5.0, though, it gets more critical because the guard interface changes there to add a module transaction check. The contract also implements migration methods for such cases (upgrade singleton together with a guard), so it was needed to avoid an issue where the singleton stays the same, but the guard updates. See #652 (comment) |
@@ -49,9 +60,7 @@ contract Safe130To141Migration is SafeStorage { | |||
* @notice Migrate to Safe 1.4.1 Singleton (L1) at `SAFE_141_SINGLETON` | |||
* @dev This function should only be called via a delegatecall to perform the upgrade. | |||
*/ | |||
function migrate() public { | |||
require(address(this) != MIGRATION_SINGLETON, "Migration should only be called via delegatecall"); |
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.
AFAIU, this can be removed because isContract(singleton)
implies that this was called through a DELEGATECALL
(since this contract doesn't set storage itself).
If that is the case, shouldn't address public immutable MIGRATION_SINGLETON
be removed as it is no longer used?
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.
Also, on a general note, is it OK to have this kind of check be "implicit" or should it be more explicit (at the cost of a small amount of additional gas)?
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.
If that is the case, shouldn't address public immutable MIGRATION_SINGLETON be removed as it is no longer used?
Good catch, thanks. I will remove it
Also, on a general note, is it OK to have this kind of check be "implicit" or should it be more explicit (at the cost of a small amount of additional gas)?
I think it's OK to have an implicit check if it's explicitly mentioned somewhere. I will try to improve the documentation.
6f6e70c
to
bd26f51
Compare
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.
Thanks! LGTM.
…ration-enhancements Feature: Enhance 1.4.1 contract checks for support proxy contract
This PR: