Skip to content

Commit

Permalink
remove challengers
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk committed Apr 25, 2024
1 parent 0488bc5 commit f737489
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
17 changes: 17 additions & 0 deletions solidity/contracts/avs/HyperlaneServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ contract HyperlaneServiceManager is ECDSAServiceManagerBase {
function deregisterOperatorFromAVS(
address operator
) public virtual override onlyStakeRegistry {
address[] memory challengers = enrolledChallengers[operator].keys();
for (uint256 i = 0; i < challengers.length; i++) {
IRemoteChallenger challenger = IRemoteChallenger(challengers[i]);
Enrollment memory enrollment = enrolledChallengers[operator].get(
challengers[i]
);
require(
enrollment.status != EnrollmentStatus.ENROLLED,
string(
abi.encodePacked(
"HyperlaneServiceManager: Operator still enrolled in challenger",
challengers[i]
)
)
);
enrolledChallengers[operator].remove(challengers[i]);
}
elAvsDirectory.deregisterOperatorFromAVS(operator);
}

Expand Down
3 changes: 1 addition & 2 deletions solidity/contracts/libs/EnumerableMapEnrollment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import {TypeCasts} from "./TypeCasts.sol";

enum EnrollmentStatus {
ENROLLED,
PENDING_UNENROLLMENT,
UNENROLLED
PENDING_UNENROLLMENT
}

struct Enrollment {
Expand Down

0 comments on commit f737489

Please sign in to comment.