Skip to content

Commit

Permalink
Adding custom error
Browse files Browse the repository at this point in the history
  • Loading branch information
eloi010 committed Nov 16, 2023
1 parent eab4a95 commit 075df67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions contracts/core/recoverable/RecoverableOpenfortAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ contract RecoverableOpenfortAccount is BaseOpenfortAccount, Ownable2StepUpgradea
*/
function completeRecovery(bytes[] calldata _signatures) external {
_requireRecovery(true);
require(uint64(block.timestamp) > recoveryDetails.executeAfter, "Ongoing recovery period");
if (recoveryDetails.executeAfter > uint64(block.timestamp)) revert OngoingRecovery();

require(recoveryDetails.guardiansRequired > 0, "No guardians set on wallet");
if (recoveryDetails.guardiansRequired != _signatures.length) revert InvalidSignatureAmount();
Expand All @@ -390,8 +390,6 @@ contract RecoverableOpenfortAccount is BaseOpenfortAccount, Ownable2StepUpgradea
address recoveryOwner = recoveryDetails.recoveryAddress;
delete recoveryDetails;

// End sessions here?

_transferOwnership(recoveryOwner);
_setLock(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ contract RecoverableOpenfortAccountTest is Test {
assertEq(recoverableOpenfortAccount.isLocked(), true);

// The recovery time period has not passed. The user should wait to recover.
vm.expectRevert("Ongoing recovery period");
vm.expectRevert(OngoingRecovery.selector);
bytes[] memory signatures = new bytes[](1);
recoverableOpenfortAccount.completeRecovery(signatures);

Expand Down

0 comments on commit 075df67

Please sign in to comment.