Skip to content

Commit

Permalink
fix: Add check for already initialized guardian
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgonzalezra committed May 20, 2024
1 parent 89967b4 commit b8e2cbd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SimpleGuardianModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ abstract contract SimpleGuardianModule {
error InvalidGuardianSignature();
error NotGuardian();
error InvalidNonce();
error GuardianAlreadyInitialized();

address public guardian;
mapping(address => uint256) private _nonces;
Expand All @@ -37,7 +38,9 @@ abstract contract SimpleGuardianModule {
}

function initGuardian(address newGuardian) external {
require(guardian == address(0));
if (guardian != address(0)) {
revert GuardianAlreadyInitialized();
}
_updateGuardian(newGuardian);
}

Expand Down

0 comments on commit b8e2cbd

Please sign in to comment.