From a323526feaf9e07cbfbb0873623b160cbde4dfa4 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:43:39 -0700 Subject: [PATCH 1/9] feat: Add Emergency Functions Natspec Section Header --- src/IdentityManagerV2.sol | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index b628708..707c096 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -599,4 +599,9 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { stats.activeVerifications--; } } + + /////////////////////////////////////////////////////////////////////////////// + /// EMERGENCY FUNCTIONS /// + /////////////////////////////////////////////////////////////////////////////// + } From bbf94a487b0dd8f0b0f19162566098ae5a22d9a8 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:44:02 -0700 Subject: [PATCH 2/9] feat: Add pause Admin Function --- src/IdentityManagerV2.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index 707c096..1961d16 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -604,4 +604,7 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { /// EMERGENCY FUNCTIONS /// /////////////////////////////////////////////////////////////////////////////// + function pause() external onlyRole(EMERGENCY_ROLE) { + _pause(); + } } From 60eeed58a6e23e251ffe08e853ec59d47a030300 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:44:16 -0700 Subject: [PATCH 3/9] feat: Add pause Admin Function Natspec Comment --- src/IdentityManagerV2.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index 1961d16..f0337bc 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -604,6 +604,9 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { /// EMERGENCY FUNCTIONS /// /////////////////////////////////////////////////////////////////////////////// + /** + * @notice Emergency pause function + */ function pause() external onlyRole(EMERGENCY_ROLE) { _pause(); } From b4d95dea46d51f0d2f59ada5b66f42d95c648a70 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:44:30 -0700 Subject: [PATCH 4/9] feat: Add unpause Admin Function --- src/IdentityManagerV2.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index f0337bc..b909048 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -610,4 +610,8 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { function pause() external onlyRole(EMERGENCY_ROLE) { _pause(); } + + function unpause() external onlyRole(EMERGENCY_ROLE) { + _unpause(); + } } From feffd11951f466975eae280e6d9bf8a818e10c5c Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:44:46 -0700 Subject: [PATCH 5/9] feat: Add unpause Admin Function Natspec Comments --- src/IdentityManagerV2.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index b909048..0046ea2 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -611,6 +611,9 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { _pause(); } + /** + * @notice Emergency unpause function + */ function unpause() external onlyRole(EMERGENCY_ROLE) { _unpause(); } From bdda97137b3b6ed414aa3b3298770a37e35828a2 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:45:19 -0700 Subject: [PATCH 6/9] feat: Add function cleanupExpiredVerifications(address[] calldata users) external { --- src/IdentityManagerV2.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index 0046ea2..a9fc147 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -617,4 +617,23 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { function unpause() external onlyRole(EMERGENCY_ROLE) { _unpause(); } + + function cleanupExpiredVerifications(address[] calldata users) external { + for (uint256 i = 0; i < users.length && i < MAX_BATCH_SIZE;) { + if (isVerificationExpired(users[i])) { + UserVerification storage verification = userVerifications[users[i]]; + UserType userType = verification.userType; + + _removeFromVerifiedUsers(users[i]); + _removeFromUsersByType(users[i], userType); + + stats.activeVerifications--; + stats.expiredVerifications++; + + delete userVerifications[users[i]]; + emit VerificationExpired(users[i]); + } + unchecked { ++i; } + } + } } From 10a9414672e995e6619d7b6f6b79865b61f53818 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:46:13 -0700 Subject: [PATCH 7/9] feat: Update cleanupExpiredVerifications Admin Function Logic --- src/IdentityManagerV2.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index a9fc147..2206fdd 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -631,7 +631,7 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { stats.expiredVerifications++; delete userVerifications[users[i]]; - emit VerificationExpired(users[i]); + emit VerificationExpire(users[i]); } unchecked { ++i; } } From bbbb6a994d97289d84f27101dc907d7bc61d51e4 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:46:51 -0700 Subject: [PATCH 8/9] feat: Add cleanupExpiredVerifications Admin Function Natspec Comment --- src/IdentityManagerV2.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index 2206fdd..6805dfb 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -618,6 +618,9 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { _unpause(); } + /** + * @notice Clean up expired verifications (anyone can call) + */ function cleanupExpiredVerifications(address[] calldata users) external { for (uint256 i = 0; i < users.length && i < MAX_BATCH_SIZE;) { if (isVerificationExpired(users[i])) { From e9ed8acaf1c12c4be35442038b83e62c766b4843 Mon Sep 17 00:00:00 2001 From: tyranis0x01 Date: Sat, 27 Sep 2025 13:47:03 -0700 Subject: [PATCH 9/9] feat: forge fmt --- src/IdentityManagerV2.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/IdentityManagerV2.sol b/src/IdentityManagerV2.sol index 6805dfb..45fd7a9 100644 --- a/src/IdentityManagerV2.sol +++ b/src/IdentityManagerV2.sol @@ -629,14 +629,16 @@ contract IdentityManagerV2 is AccessControl, ReentrancyGuard, Pausable { _removeFromVerifiedUsers(users[i]); _removeFromUsersByType(users[i], userType); - + stats.activeVerifications--; stats.expiredVerifications++; - + delete userVerifications[users[i]]; emit VerificationExpire(users[i]); } - unchecked { ++i; } + unchecked { + ++i; + } } } }