Skip to content

Commit

Permalink
fix: move stuff around
Browse files Browse the repository at this point in the history
  • Loading branch information
ly0va committed Dec 9, 2024
1 parent 8c1cbb7 commit c3d2f8e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/validators/SessionKeyValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ contract SessionKeyValidator is IValidationHook, IModuleValidator {
}

function disable() external {
// Here we have to revoke all keys, so that if the module
// is installed again later, there will be no active sessions from the past.
// Problem: if there are too many keys, this will run out of gas.
// Solution: before uninstalling, require that all keys are revoked manually.
require(sessionCounter[msg.sender] == 0, "Revoke all keys first");

// Check module and hook independently so it's not stuck in a bad state
if (_isHookInitialized(msg.sender)) {
// Here we have to revoke all keys, so that if the module
// is installed again later, there will be no active sessions from the past.
// Problem: if there are too many keys, this will run out of gas.
// Solution: before uninstalling, require that all keys are revoked manually.
require(sessionCounter[msg.sender] == 0, "Revoke all keys first");
IHookManager(msg.sender).removeHook(address(this), true);
}

// Check module and hook independently so it's not stuck in a bad state
if (_isModuleInitialized(msg.sender)) {
IValidatorManager(msg.sender).removeModuleValidator(address(this));
}
Expand Down

0 comments on commit c3d2f8e

Please sign in to comment.