Skip to content

Commit

Permalink
Check recovery is configured in completeRecovery
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnGuilding committed Jun 18, 2024
1 parent 38d3e3c commit 56f5f2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/EmailRecoveryManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ contract EmailRecoveryManager is EmailAccountRecoveryNew, Initializable, IEmailR
RecoveryRequest memory recoveryRequest = recoveryRequests[account];

uint256 threshold = guardianConfigs[account].threshold;
if (threshold == 0) {
revert NoRecoveryConfigured();
}

if (recoveryRequest.currentWeight < threshold) {
revert NotEnoughApprovals();
}
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/IEmailRecoveryManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ interface IEmailRecoveryManager {
GuardianStatus guardianStatus, GuardianStatus expectedGuardianStatus
);
error InvalidAccountAddress();
error NoRecoveryConfigured();
error NotEnoughApprovals();
error DelayNotPassed();
error RecoveryRequestExpired();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ contract EmailRecoveryManager_Integration_Test is OwnableValidatorRecoveryBase {
instance.uninstallModule(MODULE_TYPE_EXECUTOR, recoveryModuleAddress, "");
vm.stopPrank();

// vm.expectRevert(IEmailRecoveryManager.InvalidAccountAddress.selector);
vm.expectRevert(IEmailRecoveryManager.NoRecoveryConfigured.selector);
emailRecoveryManager.completeRecovery(accountAddress, recoveryCalldata);
}

Expand Down

0 comments on commit 56f5f2f

Please sign in to comment.