From b8e2cbd08a091756a5364743fe825012551f8787 Mon Sep 17 00:00:00 2001 From: Joaquin Gonzalez Date: Mon, 20 May 2024 17:15:17 -0300 Subject: [PATCH] fix: Add check for already initialized guardian --- src/SimpleGuardianModule.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SimpleGuardianModule.sol b/src/SimpleGuardianModule.sol index 5b7a9f2..a9aef0b 100644 --- a/src/SimpleGuardianModule.sol +++ b/src/SimpleGuardianModule.sol @@ -18,6 +18,7 @@ abstract contract SimpleGuardianModule { error InvalidGuardianSignature(); error NotGuardian(); error InvalidNonce(); + error GuardianAlreadyInitialized(); address public guardian; mapping(address => uint256) private _nonces; @@ -37,7 +38,9 @@ abstract contract SimpleGuardianModule { } function initGuardian(address newGuardian) external { - require(guardian == address(0)); + if (guardian != address(0)) { + revert GuardianAlreadyInitialized(); + } _updateGuardian(newGuardian); }