diff --git a/contracts/src/core/MachServiceManager.sol b/contracts/src/core/MachServiceManager.sol index b5d182a..7d5a902 100644 --- a/contracts/src/core/MachServiceManager.sol +++ b/contracts/src/core/MachServiceManager.sol @@ -29,7 +29,8 @@ import { InvalidStartIndex, InsufficientThresholdPercentages, InvalidSender, - InvalidQuorumParam + InvalidQuorumParam, + AlreadyAdded } from "../error/Errors.sol"; import {IMachServiceManager} from "../interfaces/IMachServiceManager.sol"; @@ -165,6 +166,9 @@ contract MachServiceManager is if (allowlistEnabled && !allowlist[operator]) { revert NotInAllowlist(); } + // Stake requirement for quorum is checked in StakeRegistry.sol + // https://github.com/Layr-Labs/eigenlayer-middleware/blob/dev/src/RegistryCoordinator.sol#L488 + // https://github.com/Layr-Labs/eigenlayer-middleware/blob/dev/src/StakeRegistry.sol#L84 _avsDirectory.registerOperatorToAVS(operator, operatorSignature); // we don't check if this operator has registered or not as AVSDirectory has such checking already _operators.add(operator); @@ -243,7 +247,10 @@ contract MachServiceManager is } // store alert - _messageHashes.add(alertHeader.messageHash); + bool success = _messageHashes.add(alertHeader.messageHash); + if (!success) { + revert AlreadyAdded(); + } emit AlertConfirmed(hashedHeader, alertHeader.messageHash); } diff --git a/contracts/src/error/Errors.sol b/contracts/src/error/Errors.sol index b7d5046..596d169 100644 --- a/contracts/src/error/Errors.sol +++ b/contracts/src/error/Errors.sol @@ -11,6 +11,7 @@ error InsufficientThresholdPercentages(); error InvalidQuorumParam(); error AlreadyInAllowlist(); error NotInAllowlist(); +error AlreadyAdded(); // Common error AlreadyInitialized();