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

feat: add hook emergency installation #150

Closed
wants to merge 7 commits into from

Conversation

kopy-kat
Copy link

No description provided.

///< Mapping of selectors to their respective fallback handlers.
IHook hook;
///< Current hook module associated with this account.
mapping(address hook => uint256) emergencyUninstallTimelock;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we provide emergencyUninstallTimelock while installing hook now?
mapping makes me think multiple hooks associated with uninstall timelocks

Copy link
Author

Choose a reason for hiding this comment

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

so how it works is that you can initiate a timelock for a hook and when that timelock is expired you can uninstall the hook. It uses a mapping since you could initiate the timelock, then uninstall the hook normally, reinstall it and then still have the timelock counting down even though its a different hook now

Copy link
Contributor

@livingrockrises livingrockrises left a comment

Choose a reason for hiding this comment

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

review i

@livingrockrises
Copy link
Contributor

Also Todo: change the base to dev once other PRs are merged in dev.

@livingrockrises
Copy link
Contributor

also, these are fine?

function upgradeToAndCall(address newImplementation, bytes calldata data) public payable virtual override onlyEntryPointOrSelf withHook {

function _authorizeUpgrade(address newImplementation) internal virtual override(UUPSUpgradeable) onlyEntryPointOrSelf {}

@kopy-kat
Copy link
Author

yeah although _authorizeUpgrade is an internal function so dont think it needs the modifier

accountStorage.emergencyUninstallTimelock[hook] = block.timestamp;
emit EmergencyHookUninstallRequest(hook, block.timestamp);
} else if (block.timestamp >= hookTimelock + 3 * _EMERGENCY_TIMELOCK) {
// if the timelock has been left for too long, reset it
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the reason for this?
can we not just allow uninstall here?

Copy link
Author

Choose a reason for hiding this comment

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

yeah I was thinking through this and we could allow these timelocks to not expire. The main upside of this is that when you initiate a timelock and the waiting time (1 day) has elapsed, the account is in a state where the hook can always be instantly uninstalled, which kind of defeats the purpose of the timelock as a guarantee that uninstallation cannot be instant

Copy link
Contributor

@livingrockrises livingrockrises left a comment

Choose a reason for hiding this comment

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

review ii

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants