diff --git a/src/BLSSignatureChecker.sol b/src/BLSSignatureChecker.sol index d0469d93..accbba81 100644 --- a/src/BLSSignatureChecker.sol +++ b/src/BLSSignatureChecker.sol @@ -4,7 +4,7 @@ pragma solidity =0.8.12; import {IBLSSignatureChecker} from "src/interfaces/IBLSSignatureChecker.sol"; import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; import {IBLSApkRegistry} from "src/interfaces/IBLSApkRegistry.sol"; -import {IStakeRegistry, IDelegationManager, IServiceManager} from "src/interfaces/IStakeRegistry.sol"; +import {IStakeRegistry, IDelegationManager} from "src/interfaces/IStakeRegistry.sol"; import {BitmapUtils} from "src/libraries/BitmapUtils.sol"; import {BN254} from "src/libraries/BN254.sol"; @@ -27,12 +27,11 @@ contract BLSSignatureChecker is IBLSSignatureChecker { IStakeRegistry public immutable stakeRegistry; IBLSApkRegistry public immutable blsApkRegistry; IDelegationManager public immutable delegation; - IServiceManager public immutable serviceManager; /// @notice If true, check the staleness of the operator stakes and that its within the delegation withdrawalDelayBlocks window. bool public staleStakesForbidden; - modifier onlyServiceManagerOwner { - require(msg.sender == serviceManager.owner(), "BLSSignatureChecker.onlyServiceManagerOwner: caller is not the service manager owner"); + modifier onlyCoordinatorOwner() { + require(msg.sender == registryCoordinator.owner(), "BLSSignatureChecker.onlyCoordinatorOwner: caller is not the owner of the registryCoordinator"); _; } @@ -41,10 +40,20 @@ contract BLSSignatureChecker is IBLSSignatureChecker { stakeRegistry = _registryCoordinator.stakeRegistry(); blsApkRegistry = _registryCoordinator.blsApkRegistry(); delegation = stakeRegistry.delegation(); - serviceManager = stakeRegistry.serviceManager(); + staleStakesForbidden = true; } + /** + * RegistryCoordinator owner can either enforce or not that operator stakes are staler + * than the delegation.withdrawalDelayBlocks() window. + * @param value to toggle staleStakesForbidden + */ + function setStaleStakesForbidden(bool value) external onlyCoordinatorOwner { + staleStakesForbidden = value; + emit StaleStakesForbiddenUpdate(value); + } + /** * @notice This function is called by disperser when it has aggregated all the signatures of the operators * that are part of the quorum for a particular taskNumber and is asserting them into onchain. The function @@ -220,14 +229,4 @@ contract BLSSignatureChecker is IBLSSignatureChecker { PAIRING_EQUALITY_CHECK_GAS ); } - - /** - * ServiceManager owner can either enforce or not that operator stakes are staler - * than the delegation.withdrawalDelayBlocks() window. - * @param value to toggle staleStakesForbidden - */ - function setStaleStakesForbidden(bool value) external onlyServiceManagerOwner { - staleStakesForbidden = value; - emit StaleStakesForbiddenUpdate(value); - } } diff --git a/src/RegistryCoordinator.sol b/src/RegistryCoordinator.sol index def0c7ce..af5de04b 100644 --- a/src/RegistryCoordinator.sol +++ b/src/RegistryCoordinator.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity =0.8.12; +import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol"; import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; @@ -12,7 +13,6 @@ import {ISlasher} from "eigenlayer-contracts/src/contracts/interfaces/ISlasher.s import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol"; import {IBLSApkRegistry} from "src/interfaces/IBLSApkRegistry.sol"; -import {IServiceManager} from "src/interfaces/IServiceManager.sol"; import {ISocketUpdater} from "src/interfaces/ISocketUpdater.sol"; import {IStakeRegistry} from "src/interfaces/IStakeRegistry.sol"; import {IIndexRegistry} from "src/interfaces/IIndexRegistry.sol"; @@ -28,7 +28,15 @@ import {BN254} from "src/libraries/BN254.sol"; * * @author Layr Labs, Inc. */ -contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISocketUpdater, ISignatureUtils, Pausable { +contract RegistryCoordinator is + EIP712, + Initializable, + Pausable, + OwnableUpgradeable, + IRegistryCoordinator, + ISocketUpdater, + ISignatureUtils +{ using BitmapUtils for *; using BN254 for BN254.G1Point; @@ -52,8 +60,6 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo /// @notice the EigenLayer Slasher ISlasher public immutable slasher; - /// @notice the Service Manager for the service that this contract is coordinating - IServiceManager public immutable serviceManager; /// @notice the BLS Aggregate Pubkey Registry contract that will keep track of operators' aggregate BLS public keys per quorum IBLSApkRegistry public immutable blsApkRegistry; /// @notice the Stake Registry contract that will keep track of operators' stakes @@ -82,11 +88,6 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo /// @notice the address of the entity allowed to eject operators from the AVS address public ejector; - modifier onlyServiceManagerOwner { - require(msg.sender == serviceManager.owner(), "RegistryCoordinator.onlyServiceManagerOwner: caller is not the service manager owner"); - _; - } - modifier onlyEjector { require(msg.sender == ejector, "RegistryCoordinator.onlyEjector: caller is not the ejector"); _; @@ -102,19 +103,20 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo constructor( ISlasher _slasher, - IServiceManager _serviceManager, IStakeRegistry _stakeRegistry, IBLSApkRegistry _blsApkRegistry, IIndexRegistry _indexRegistry ) EIP712("AVSRegistryCoordinator", "v0.0.1") { slasher = _slasher; - serviceManager = _serviceManager; stakeRegistry = _stakeRegistry; blsApkRegistry = _blsApkRegistry; indexRegistry = _indexRegistry; + + _disableInitializers(); } function initialize( + address _initialOwner, address _churnApprover, address _ejector, IPauserRegistry _pauserRegistry, @@ -129,6 +131,7 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo ); // Initialize roles + _transferOwnership(_initialOwner); _initializePauser(_pauserRegistry, _initialPausedStatus); _setChurnApprover(_churnApprover); _setEjector(_ejector); @@ -377,7 +380,7 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo } /******************************************************************************* - EXTERNAL FUNCTIONS - SERVICE MANAGER OWNER + EXTERNAL FUNCTIONS - OWNER *******************************************************************************/ /** @@ -387,7 +390,7 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo OperatorSetParam memory operatorSetParams, uint96 minimumStake, IStakeRegistry.StrategyParams[] memory strategyParams - ) external virtual onlyServiceManagerOwner { + ) external virtual onlyOwner { _createQuorum(operatorSetParams, minimumStake, strategyParams); } @@ -395,30 +398,30 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo * @notice Updates a quorum's OperatorSetParams * @param quorumNumber is the quorum number to set the maximum number of operators for * @param operatorSetParams is the parameters of the operator set for the `quorumNumber` - * @dev only callable by the service manager owner + * @dev only callable by the owner */ function setOperatorSetParams( uint8 quorumNumber, OperatorSetParam memory operatorSetParams - ) external onlyServiceManagerOwner quorumExists(quorumNumber) { + ) external onlyOwner quorumExists(quorumNumber) { _setOperatorSetParams(quorumNumber, operatorSetParams); } /** * @notice Sets the churnApprover * @param _churnApprover is the address of the churnApprover - * @dev only callable by the service manager owner + * @dev only callable by the owner */ - function setChurnApprover(address _churnApprover) external onlyServiceManagerOwner { + function setChurnApprover(address _churnApprover) external onlyOwner { _setChurnApprover(_churnApprover); } /** * @notice Sets the ejector * @param _ejector is the address of the ejector - * @dev only callable by the service manager owner + * @dev only callable by the owner */ - function setEjector(address _ejector) external onlyServiceManagerOwner { + function setEjector(address _ejector) external onlyOwner { _setEjector(_ejector); } @@ -832,6 +835,7 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo return _hashTypedDataV4(keccak256(abi.encode(OPERATOR_CHURN_APPROVAL_TYPEHASH, registeringOperatorId, operatorKickParams, salt, expiry))); } +<<<<<<< HEAD /** * @notice Returns the message hash that an operator must sign to register their BLS public key. * @param operator is the address of the operator registering their BLS public key @@ -842,5 +846,15 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo keccak256(abi.encode(PUBKEY_REGISTRATION_TYPEHASH, operator)) ) ); +======= + /// @dev need to override function here since its defined in both these contracts + function owner() + public + view + override(OwnableUpgradeable, IRegistryCoordinator) + returns (address) + { + return OwnableUpgradeable.owner(); +>>>>>>> ecf7849 (chore: remove ServiceManagerBase and add RegistryCoordinator owner (#98)) } } diff --git a/src/ServiceManagerBase.sol b/src/ServiceManagerBase.sol deleted file mode 100644 index 6537b7ee..00000000 --- a/src/ServiceManagerBase.sol +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.9; - -import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol"; -import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol"; - -import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol"; -import {ISlasher} from "eigenlayer-contracts/src/contracts/interfaces/ISlasher.sol"; -import {Pausable} from "eigenlayer-contracts/src/contracts/permissions/Pausable.sol"; - -import {BLSSignatureChecker} from "src/BLSSignatureChecker.sol"; - -import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; -import {IServiceManager} from "src/interfaces/IServiceManager.sol"; - -/** - * @title Base implementation of `IServiceManager` interface, designed to be inherited from by more complex ServiceManagers. - * @author Layr Labs, Inc. - * @notice This contract is used for: - * - proxying calls to the Slasher contract - * - implementing the two most important functionalities of a ServiceManager: - * - freezing operators as the result of various "challenges" - * - defining the latestServeUntilBlock which is used by the Slasher to determine whether a withdrawal can be completed - */ -abstract contract ServiceManagerBase is - IServiceManager, - Initializable, - OwnableUpgradeable, - BLSSignatureChecker, - Pausable -{ - /// @notice Called in the event of challenge resolution, in order to forward a call to the Slasher, which 'freezes' the `operator`. - /// @dev This function should contain slashing logic, to make sure operators are not needlessly being slashed - // hence it is marked as virtual and must be implemented in each avs' respective service manager contract - function freezeOperator(address operatorAddr) external virtual; - - ISlasher public immutable slasher; - - /// @notice when applied to a function, ensures that the function is only callable by the `registryCoordinator`. - modifier onlyRegistryCoordinator() { - require( - msg.sender == address(registryCoordinator), - "onlyRegistryCoordinator: not from registry coordinator" - ); - _; - } - - /// @notice when applied to a function, ensures that the function is only callable by the `registryCoordinator`. - /// or by StakeRegistry - modifier onlyRegistryCoordinatorOrStakeRegistry() { - require( - (msg.sender == address(registryCoordinator)) || - (msg.sender == - address( - IRegistryCoordinator( - address(registryCoordinator) - ).stakeRegistry() - )), - "onlyRegistryCoordinatorOrStakeRegistry: not from registry coordinator or stake registry" - ); - _; - } - - constructor( - IRegistryCoordinator _registryCoordinator, - ISlasher _slasher - ) BLSSignatureChecker(_registryCoordinator) { - slasher = _slasher; - _disableInitializers(); - } - - function initialize( - IPauserRegistry _pauserRegistry, - address initialOwner - ) public initializer { - _initializePauser(_pauserRegistry, UNPAUSE_ALL); - _transferOwnership(initialOwner); - } - - // VIEW FUNCTIONS - - /// @dev need to override function here since its defined in both these contracts - function owner() - public - view - override(OwnableUpgradeable, IServiceManager) - returns (address) - { - return OwnableUpgradeable.owner(); - } -} diff --git a/src/StakeRegistry.sol b/src/StakeRegistry.sol index da2d04ee..c4bca769 100644 --- a/src/StakeRegistry.sol +++ b/src/StakeRegistry.sol @@ -6,7 +6,6 @@ import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/ import {StakeRegistryStorage} from "src/StakeRegistryStorage.sol"; import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; -import {IServiceManager} from "src/interfaces/IServiceManager.sol"; import {IStakeRegistry} from "src/interfaces/IStakeRegistry.sol"; import {BitmapUtils} from "src/libraries/BitmapUtils.sol"; @@ -30,8 +29,8 @@ contract StakeRegistry is StakeRegistryStorage { _; } - modifier onlyServiceManagerOwner() { - require(msg.sender == serviceManager.owner(), "StakeRegistry.onlyServiceManagerOwner: caller is not the owner of the serviceManager"); + modifier onlyCoordinatorOwner() { + require(msg.sender == registryCoordinator.owner(), "StakeRegistry.onlyCoordinatorOwner: caller is not the owner of the registryCoordinator"); _; } @@ -42,9 +41,8 @@ contract StakeRegistry is StakeRegistryStorage { constructor( IRegistryCoordinator _registryCoordinator, - IDelegationManager _delegationManager, - IServiceManager _serviceManager - ) StakeRegistryStorage(_registryCoordinator, _delegationManager, _serviceManager) {} + IDelegationManager _delegationManager + ) StakeRegistryStorage(_registryCoordinator, _delegationManager) {} /******************************************************************************* EXTERNAL FUNCTIONS - REGISTRY COORDINATOR @@ -208,7 +206,7 @@ contract StakeRegistry is StakeRegistryStorage { function setMinimumStakeForQuorum( uint8 quorumNumber, uint96 minimumStake - ) public virtual onlyServiceManagerOwner quorumExists(quorumNumber) { + ) public virtual onlyCoordinatorOwner quorumExists(quorumNumber) { _setMinimumStakeForQuorum(quorumNumber, minimumStake); } @@ -221,7 +219,7 @@ contract StakeRegistry is StakeRegistryStorage { function addStrategies( uint8 quorumNumber, StrategyParams[] memory _strategyParams - ) public virtual onlyServiceManagerOwner quorumExists(quorumNumber) { + ) public virtual onlyCoordinatorOwner quorumExists(quorumNumber) { _addStrategyParams(quorumNumber, _strategyParams); } @@ -233,7 +231,7 @@ contract StakeRegistry is StakeRegistryStorage { function removeStrategies( uint8 quorumNumber, uint256[] memory indicesToRemove - ) public virtual onlyServiceManagerOwner quorumExists(quorumNumber) { + ) public virtual onlyCoordinatorOwner quorumExists(quorumNumber) { uint256 toRemoveLength = indicesToRemove.length; require(toRemoveLength > 0, "StakeRegistry.removeStrategies: no indices to remove provided"); @@ -259,7 +257,7 @@ contract StakeRegistry is StakeRegistryStorage { uint8 quorumNumber, uint256[] calldata strategyIndices, uint96[] calldata newMultipliers - ) public virtual onlyServiceManagerOwner quorumExists(quorumNumber) { + ) public virtual onlyCoordinatorOwner quorumExists(quorumNumber) { uint256 numStrats = strategyIndices.length; require(numStrats > 0, "StakeRegistry.modifyStrategyParams: no strategy indices provided"); require(newMultipliers.length == numStrats, "StakeRegistry.modifyStrategyParams: input length mismatch"); diff --git a/src/StakeRegistryStorage.sol b/src/StakeRegistryStorage.sol index 2d08d8ce..81b4ba42 100644 --- a/src/StakeRegistryStorage.sol +++ b/src/StakeRegistryStorage.sol @@ -5,7 +5,6 @@ import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/ import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol"; import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; -import {IServiceManager} from "src/interfaces/IServiceManager.sol"; import {IStakeRegistry} from "src/interfaces/IStakeRegistry.sol"; /** @@ -25,9 +24,6 @@ abstract contract StakeRegistryStorage is IStakeRegistry { /// @notice The address of the Delegation contract for EigenLayer. IDelegationManager public immutable delegation; - /// @notice The ServiceManager contract for this middleware, where tasks are created / initiated. - IServiceManager public immutable serviceManager; - /// @notice the coordinator contract that this registry is associated with IRegistryCoordinator public immutable registryCoordinator; @@ -49,12 +45,10 @@ abstract contract StakeRegistryStorage is IStakeRegistry { constructor( IRegistryCoordinator _registryCoordinator, - IDelegationManager _delegationManager, - IServiceManager _serviceManager + IDelegationManager _delegationManager ) { registryCoordinator = _registryCoordinator; delegation = _delegationManager; - serviceManager = _serviceManager; } // storage gap for upgradeability diff --git a/src/interfaces/IBLSRegistry.sol b/src/interfaces/IBLSRegistry.sol deleted file mode 100644 index 7e712471..00000000 --- a/src/interfaces/IBLSRegistry.sol +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity >=0.5.0; - -import {IQuorumRegistry} from "./IQuorumRegistry.sol"; -import {BN254} from "../libraries/BN254.sol"; - -/** - * @title Minimal interface extension to `IQuorumRegistry`. - * @author Layr Labs, Inc. - * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service - * @notice Adds BLS-specific functions to the base interface. - */ -interface IBLSRegistry is IQuorumRegistry { - /// @notice Data structure used to track the history of the Aggregate Public Key of all operators - struct ApkUpdate { - // keccak256(apk_x0, apk_x1, apk_y0, apk_y1) - bytes32 apkHash; - // block number at which the update occurred - uint32 blockNumber; - } - - // EVENTS - /** - * @notice Emitted upon the registration of a new operator for the middleware - * @param operator Address of the new operator - * @param pkHash The keccak256 hash of the operator's public key - * @param pk The operator's public key itself - * @param apkHashIndex The index of the latest (i.e. the new) APK update - * @param apkHash The keccak256 hash of the new Aggregate Public Key - */ - event Registration( - address indexed operator, - bytes32 pkHash, - BN254.G1Point pk, - uint32 apkHashIndex, - bytes32 apkHash, - string socket - ); - - /// @notice Emitted when the `operatorWhitelister` role is transferred. - event OperatorWhitelisterTransferred(address previousAddress, address newAddress); - - /** - * @notice get hash of a historical aggregated public key corresponding to a given index; - * called by checkSignatures in BLSSignatureChecker.sol. - */ - function getCorrectApkHash(uint256 index, uint32 blockNumber) external returns (bytes32); - - /// @notice returns the `ApkUpdate` struct at `index` in the list of APK updates - function apkUpdates(uint256 index) external view returns (ApkUpdate memory); - - /// @notice returns the APK hash that resulted from the `index`th APK update - function apkHashes(uint256 index) external view returns (bytes32); - - /// @notice returns the block number at which the `index`th APK update occurred - function apkUpdateBlockNumbers(uint256 index) external view returns (uint32); - - function operatorWhitelister() external view returns (address); - - function operatorWhitelistEnabled() external view returns (bool); - - function whitelisted(address) external view returns (bool); - - function setOperatorWhitelistStatus(bool _operatorWhitelistEnabled) external; - - function addToOperatorWhitelist(address[] calldata) external; - - function removeFromWhitelist(address[] calldata operators) external; -} diff --git a/src/interfaces/IBLSSignatureChecker.sol b/src/interfaces/IBLSSignatureChecker.sol index ffc73a7b..ac63096c 100644 --- a/src/interfaces/IBLSSignatureChecker.sol +++ b/src/interfaces/IBLSSignatureChecker.sol @@ -3,7 +3,7 @@ pragma solidity =0.8.12; import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; import {IBLSApkRegistry} from "src/interfaces/IBLSApkRegistry.sol"; -import {IStakeRegistry, IDelegationManager, IServiceManager} from "src/interfaces/IStakeRegistry.sol"; +import {IStakeRegistry, IDelegationManager} from "src/interfaces/IStakeRegistry.sol"; import {BN254} from "src/libraries/BN254.sol"; @@ -41,7 +41,7 @@ interface IBLSSignatureChecker { // EVENTS - /// @notice Emitted when `staleStakesForbiddenUpdate` is set. Value only set by serviceManagerOwner. + /// @notice Emitted when `staleStakesForbiddenUpdate` is set event StaleStakesForbiddenUpdate(bool value); // CONSTANTS & IMMUTABLES @@ -50,7 +50,6 @@ interface IBLSSignatureChecker { function stakeRegistry() external view returns (IStakeRegistry); function blsApkRegistry() external view returns (IBLSApkRegistry); function delegation() external view returns (IDelegationManager); - function serviceManager() external view returns (IServiceManager); /** * @notice This function is called by disperser when it has aggregated all the signatures of the operators diff --git a/src/interfaces/IQuorumRegistry.sol b/src/interfaces/IQuorumRegistry.sol deleted file mode 100644 index 21c10dee..00000000 --- a/src/interfaces/IQuorumRegistry.sol +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity >=0.5.0; - -import {IRegistry} from "./IRegistry.sol"; - -/** - * @title Interface for a `Registry`-type contract that uses either 1 or 2 quorums. - * @author Layr Labs, Inc. - * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service - * @notice This contract does not currently support n-quorums where n >= 3. - * Note in particular the presence of only `firstQuorumStake` and `secondQuorumStake` in the `OperatorStake` struct. - */ -interface IQuorumRegistry is IRegistry { - // DATA STRUCTURES - enum Status { - // default is inactive - INACTIVE, - ACTIVE - } - - /** - * @notice Data structure for storing info on operators to be used for: - * - sending data by the sequencer - * - payment and associated challenges - */ - struct Operator { - // hash of pubkey of the operator - bytes32 pubkeyHash; - // start taskNumber from which the operator has been registered - uint32 fromTaskNumber; - // indicates whether the operator is actively registered for serving the middleware or not - Status status; - } - - // struct used to give definitive ordering to operators at each blockNumber - struct OperatorIndex { - // blockNumber number at which operator index changed - // note that the operator's index is different *for this block number*, i.e. the *new* index is *inclusive* of this value - uint32 toBlockNumber; - // index of the operator in array of operators, or the total number of operators if in the 'totalOperatorsHistory' - uint32 index; - } - - /// @notice struct used to store the stakes of an individual operator or the sum of all operators' stakes, for storage - struct OperatorStake { - // the block number at which the stake amounts were updated and stored - uint32 updateBlockNumber; - // the block number at which the *next update* occurred. - /// @notice This entry has the value **0** until another update takes place. - uint32 nextUpdateBlockNumber; - // stake weight for the first quorum - uint96 firstQuorumStake; - // stake weight for the second quorum. Will always be zero in the event that only one quorum is used - uint96 secondQuorumStake; - } - - function getLengthOfTotalStakeHistory() external view returns (uint256); - - /** - * @notice Returns the `index`-th entry in the dynamic array of total stake, `totalStakeHistory`. - * @dev Function will revert in the event that `index` is out-of-bounds. - */ - function getTotalStakeFromIndex(uint256 index) external view returns (OperatorStake memory); - - /// @notice Returns the stored pubkeyHash for the specified `operator`. - function getOperatorPubkeyHash(address operator) external view returns (bytes32); - - /// @notice Returns task number from when `operator` has been registered. - function getFromTaskNumberForOperator(address operator) external view returns (uint32); - - /** - * @notice Returns the stake weight corresponding to `pubkeyHash`, at the - * `index`-th entry in the `pubkeyHashToStakeHistory[pubkeyHash]` array. - * @param pubkeyHash Hash of the public key of the operator of interest. - * @param index Array index for lookup, within the dynamic array `pubkeyHashToStakeHistory[pubkeyHash]`. - * @dev Function will revert if `index` is out-of-bounds. - */ - function getStakeFromPubkeyHashAndIndex( - bytes32 pubkeyHash, - uint256 index - ) external view returns (OperatorStake memory); - - /** - * @notice Checks that the `operator` was active at the `blockNumber`, using the specified `stakeHistoryIndex` as proof. - * @param operator is the operator of interest - * @param blockNumber is the block number of interest - * @param stakeHistoryIndex specifies an index in `pubkeyHashToStakeHistory[pubkeyHash]`, where `pubkeyHash` is looked up - * in `registry[operator].pubkeyHash` - * @return 'true' if it is successfully proven that the `operator` was active at the `blockNumber`, and 'false' otherwise - * @dev In order for this function to return 'true', the inputs must satisfy all of the following list: - * 1) `pubkeyHashToStakeHistory[pubkeyHash][index].updateBlockNumber <= blockNumber` - * 2) `pubkeyHashToStakeHistory[pubkeyHash][index].nextUpdateBlockNumber` must be either `0` (signifying no next update) or - * is must be strictly greater than `blockNumber` - * 3) `pubkeyHashToStakeHistory[pubkeyHash][index].firstQuorumStake > 0` - * or `pubkeyHashToStakeHistory[pubkeyHash][index].secondQuorumStake > 0`, i.e. the operator had nonzero stake - * @dev Note that a return value of 'false' does not guarantee that the `operator` was inactive at `blockNumber`, since a - * bad `stakeHistoryIndex` can be supplied in order to obtain a response of 'false'. - */ - function checkOperatorActiveAtBlockNumber( - address operator, - uint256 blockNumber, - uint256 stakeHistoryIndex - ) external view returns (bool); - - /** - * @notice Checks that the `operator` was inactive at the `blockNumber`, using the specified `stakeHistoryIndex` as proof. - * @param operator is the operator of interest - * @param blockNumber is the block number of interest - * @param stakeHistoryIndex specifies an index in `pubkeyHashToStakeHistory[pubkeyHash]`, where `pubkeyHash` is looked up - * in `registry[operator].pubkeyHash` - * @return 'true' if it is successfully proven that the `operator` was inactive at the `blockNumber`, and 'false' otherwise - * @dev In order for this function to return 'true', the inputs must satisfy all of the following list: - * 1) `pubkeyHashToStakeHistory[pubkeyHash][index].updateBlockNumber <= blockNumber` - * 2) `pubkeyHashToStakeHistory[pubkeyHash][index].nextUpdateBlockNumber` must be either `0` (signifying no next update) or - * is must be strictly greater than `blockNumber` - * 3) `pubkeyHashToStakeHistory[pubkeyHash][index].firstQuorumStake > 0` - * or `pubkeyHashToStakeHistory[pubkeyHash][index].secondQuorumStake > 0`, i.e. the operator had nonzero stake - * @dev Note that a return value of 'false' does not guarantee that the `operator` was active at `blockNumber`, since a - * bad `stakeHistoryIndex` can be supplied in order to obtain a response of 'false'. - */ - function checkOperatorInactiveAtBlockNumber( - address operator, - uint256 blockNumber, - uint256 stakeHistoryIndex - ) external view returns (bool); - - /** - * @notice Looks up the `operator`'s index in the dynamic array `operatorList` at the specified `blockNumber`. - * @param index Used to specify the entry within the dynamic array `pubkeyHashToIndexHistory[pubkeyHash]` to - * read data from, where `pubkeyHash` is looked up from `operator`'s registration info - * @param blockNumber Is the desired block number at which we wish to query the operator's position in the `operatorList` array - * @dev Function will revert in the event that the specified `index` input does not identify the appropriate entry in the - * array `pubkeyHashToIndexHistory[pubkeyHash]` to pull the info from. - */ - function getOperatorIndex(address operator, uint32 blockNumber, uint32 index) external view returns (uint32); - - /** - * @notice Looks up the number of total operators at the specified `blockNumber`. - * @param index Input used to specify the entry within the dynamic array `totalOperatorsHistory` to read data from. - * @dev This function will revert if the provided `index` is out of bounds. - */ - function getTotalOperators(uint32 blockNumber, uint32 index) external view returns (uint32); - - /// @notice Returns the current number of operators of this service. - function numOperators() external view returns (uint32); - - /** - * @notice Returns the most recent stake weights for the `operator` - * @dev Function returns weights of **0** in the event that the operator has no stake history - */ - function operatorStakes(address operator) external view returns (uint96, uint96); - - /// @notice Returns the stake amounts from the latest entry in `totalStakeHistory`. - function totalStake() external view returns (uint96, uint96); -} diff --git a/src/interfaces/IRegistryCoordinator.sol b/src/interfaces/IRegistryCoordinator.sol index bd6fecd3..ccbd8a86 100644 --- a/src/interfaces/IRegistryCoordinator.sol +++ b/src/interfaces/IRegistryCoordinator.sol @@ -140,4 +140,7 @@ interface IRegistryCoordinator { /// @notice returns the blocknumber the quorum was last updated all at once for all operators function quorumUpdateBlockNumber(uint8 quorumNumber) external view returns (uint256); + + /// @notice The owner of the registry coordinator + function owner() external view returns (address); } diff --git a/src/interfaces/IServiceManager.sol b/src/interfaces/IServiceManager.sol deleted file mode 100644 index 1dc4fe72..00000000 --- a/src/interfaces/IServiceManager.sol +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity >=0.5.0; - -import {ISlasher} from "eigenlayer-contracts/src/contracts/interfaces/ISlasher.sol"; - -/** - * @title Interface for a `ServiceManager`-type contract. - * @author Layr Labs, Inc. - * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service - */ -interface IServiceManager { - - // ServiceManager proxies to the slasher - function slasher() external view returns (ISlasher); - - /// @notice function that causes the ServiceManager to freeze the operator on EigenLayer, through a call to the Slasher contract - /// @dev this function should contain slashing logic to make sure operators are not needlessly being slashed - /// THIS IS ONLY A TEMPORARY PLACE HOLDER UNTIL SLASHING IS FULLY IMPLEMENTED - function freezeOperator(address operator) external; - - /// @notice required since the registry contract will call this function to permission its upgrades to be done by the same owner as the service manager - function owner() external view returns (address); -} diff --git a/src/interfaces/IStakeRegistry.sol b/src/interfaces/IStakeRegistry.sol index 63a16b9a..51196a2f 100644 --- a/src/interfaces/IStakeRegistry.sol +++ b/src/interfaces/IStakeRegistry.sol @@ -4,7 +4,6 @@ pragma solidity =0.8.12; import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol"; import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol"; -import {IServiceManager} from "./IServiceManager.sol"; import {IRegistry} from "./IRegistry.sol"; /** @@ -125,9 +124,6 @@ interface IStakeRegistry is IRegistry { /// @notice Returns the EigenLayer delegation manager contract. function delegation() external view returns (IDelegationManager); - /// @notice Returns the AVS service manager contract. - function serviceManager() external view returns (IServiceManager); - /// @notice In order to register for a quorum i, an operator must have at least `minimumStakeForQuorum[i]` function minimumStakeForQuorum(uint256 quorumNumber) external view returns (uint96); diff --git a/test/harnesses/RegistryCoordinatorHarness.sol b/test/harnesses/RegistryCoordinatorHarness.sol index 9816a332..eff9bead 100644 --- a/test/harnesses/RegistryCoordinatorHarness.sol +++ b/test/harnesses/RegistryCoordinatorHarness.sol @@ -7,11 +7,11 @@ import "src/RegistryCoordinator.sol"; contract RegistryCoordinatorHarness is RegistryCoordinator { constructor( ISlasher _slasher, - IServiceManager _serviceManager, IStakeRegistry _stakeRegistry, IBLSApkRegistry _blsApkRegistry, IIndexRegistry _indexRegistry - ) RegistryCoordinator(_slasher, _serviceManager, _stakeRegistry, _blsApkRegistry, _indexRegistry) { + ) RegistryCoordinator(_slasher, _stakeRegistry, _blsApkRegistry, _indexRegistry) { + _transferOwnership(msg.sender); } function setQuorumCount(uint8 count) external { diff --git a/test/harnesses/StakeRegistryHarness.sol b/test/harnesses/StakeRegistryHarness.sol index ece3feee..96f529ba 100644 --- a/test/harnesses/StakeRegistryHarness.sol +++ b/test/harnesses/StakeRegistryHarness.sol @@ -9,9 +9,8 @@ contract StakeRegistryHarness is StakeRegistry { constructor( IRegistryCoordinator _registryCoordinator, - IDelegationManager _delegationManager, - IServiceManager _serviceManager - ) StakeRegistry(_registryCoordinator, _delegationManager, _serviceManager) { + IDelegationManager _delegationManager + ) StakeRegistry(_registryCoordinator, _delegationManager) { } function recordOperatorStakeUpdate(bytes32 operatorId, uint8 quorumNumber, uint96 newStake) external returns(int256) { diff --git a/test/mocks/RegistryCoordinatorMock.sol b/test/mocks/RegistryCoordinatorMock.sol index 89e4feee..f6ca981d 100644 --- a/test/mocks/RegistryCoordinatorMock.sol +++ b/test/mocks/RegistryCoordinatorMock.sol @@ -60,4 +60,6 @@ contract RegistryCoordinatorMock is IRegistryCoordinator { function deregisterOperator(bytes calldata quorumNumbers, bytes calldata) external {} function quorumUpdateBlockNumber(uint8 quorumNumber) external view returns (uint256) {} + + function owner() external view returns (address) {} } diff --git a/test/mocks/ServiceManagerMock.sol b/test/mocks/ServiceManagerMock.sol deleted file mode 100644 index 2f87e8f0..00000000 --- a/test/mocks/ServiceManagerMock.sol +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; - -import "../../src/interfaces/IServiceManager.sol"; -import "eigenlayer-contracts/src/contracts/interfaces/ISlasher.sol"; - -contract ServiceManagerMock is IServiceManager{ - address public owner; - ISlasher public slasher; - - constructor(ISlasher _slasher) { - owner = msg.sender; - slasher = _slasher; - - } - - /// @notice Permissioned function that causes the ServiceManager to freeze the operator on EigenLayer, through a call to the Slasher contract - function freezeOperator(address operator) external { - slasher.freezeOperator(operator); - } - - function paymentChallengeToken() external pure returns (IERC20) { - return IERC20(address(0)); - } - - /// @notice Returns the `latestServeUntilBlock` until which operators must serve. - function latestServeUntilBlock() external pure returns (uint32) { - return type(uint32).max; - } -} diff --git a/test/mocks/StakeRegistryMock.sol b/test/mocks/StakeRegistryMock.sol index 8088f2d1..a092944c 100644 --- a/test/mocks/StakeRegistryMock.sol +++ b/test/mocks/StakeRegistryMock.sol @@ -78,7 +78,6 @@ contract StakeRegistryMock is IStakeRegistry { ) external {} function delegation() external view returns (IDelegationManager) {} - function serviceManager() external view returns (IServiceManager) {} function WEIGHTING_DIVISOR() external pure returns (uint256) {} diff --git a/test/unit/RegistryCoordinatorUnit.t.sol b/test/unit/RegistryCoordinatorUnit.t.sol index cda318cb..bc398ff5 100644 --- a/test/unit/RegistryCoordinatorUnit.t.sol +++ b/test/unit/RegistryCoordinatorUnit.t.sol @@ -59,6 +59,7 @@ contract RegistryCoordinatorUnit is MockAVSDeployer { // make sure the contract intializers are disabled cheats.expectRevert(bytes("Initializable: contract is already initialized")); registryCoordinator.initialize( + registryCoordinatorOwner, churnApprover, ejector, pauserRegistry, @@ -69,44 +70,44 @@ contract RegistryCoordinatorUnit is MockAVSDeployer { ); } - function testSetOperatorSetParams_NotServiceManagerOwner_Reverts() public { - cheats.expectRevert("RegistryCoordinator.onlyServiceManagerOwner: caller is not the service manager owner"); + function testSetOperatorSetParams_NotOwner_Reverts() public { + cheats.expectRevert("Ownable: caller is not the owner"); cheats.prank(defaultOperator); registryCoordinator.setOperatorSetParams(0, operatorSetParams[0]); } function testSetOperatorSetParams_Valid() public { - cheats.prank(serviceManagerOwner); + cheats.prank(registryCoordinatorOwner); cheats.expectEmit(true, true, true, true, address(registryCoordinator)); emit OperatorSetParamsUpdated(0, operatorSetParams[1]); registryCoordinator.setOperatorSetParams(0, operatorSetParams[1]); } - function testSetChurnApprover_NotServiceManagerOwner_Reverts() public { + function testSetChurnApprover_NotOwner_Reverts() public { address newChurnApprover = address(uint160(uint256(keccak256("newChurnApprover")))); - cheats.expectRevert("RegistryCoordinator.onlyServiceManagerOwner: caller is not the service manager owner"); + cheats.expectRevert("Ownable: caller is not the owner"); cheats.prank(defaultOperator); registryCoordinator.setChurnApprover(newChurnApprover); } function testSetChurnApprover_Valid() public { address newChurnApprover = address(uint160(uint256(keccak256("newChurnApprover")))); - cheats.prank(serviceManagerOwner); + cheats.prank(registryCoordinatorOwner); cheats.expectEmit(true, true, true, true, address(registryCoordinator)); emit ChurnApproverUpdated(churnApprover, newChurnApprover); registryCoordinator.setChurnApprover(newChurnApprover); } - function testSetEjector_NotServiceManagerOwner_Reverts() public { + function testSetEjector_NotOwner_Reverts() public { address newEjector = address(uint160(uint256(keccak256("newEjector")))); - cheats.expectRevert("RegistryCoordinator.onlyServiceManagerOwner: caller is not the service manager owner"); + cheats.expectRevert("Ownable: caller is not the owner"); cheats.prank(defaultOperator); registryCoordinator.setEjector(newEjector); } function testSetEjector_Valid() public { address newEjector = address(uint160(uint256(keccak256("newEjector")))); - cheats.prank(serviceManagerOwner); + cheats.prank(registryCoordinatorOwner); cheats.expectEmit(true, true, true, true, address(registryCoordinator)); emit EjectorUpdated(ejector, newEjector); registryCoordinator.setEjector(newEjector); diff --git a/test/unit/StakeRegistryUnit.t.sol b/test/unit/StakeRegistryUnit.t.sol index 2232f0e0..e6bd3c6a 100644 --- a/test/unit/StakeRegistryUnit.t.sol +++ b/test/unit/StakeRegistryUnit.t.sol @@ -11,7 +11,6 @@ import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IS import {ISlasher} from "eigenlayer-contracts/src/contracts/interfaces/ISlasher.sol"; import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol"; import {IStakeRegistry} from "src/interfaces/IStakeRegistry.sol"; -import {IServiceManager} from "src/interfaces/IServiceManager.sol"; import {IIndexRegistry} from "src/interfaces/IIndexRegistry.sol"; import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; import {IBLSApkRegistry} from "src/interfaces/IBLSApkRegistry.sol"; @@ -20,7 +19,6 @@ import {BitmapUtils} from "eigenlayer-contracts/src/contracts/libraries/BitmapUt import {StrategyManagerMock} from "eigenlayer-contracts/src/test/mocks/StrategyManagerMock.sol"; import {EigenPodManagerMock} from "eigenlayer-contracts/src/test/mocks/EigenPodManagerMock.sol"; -import {ServiceManagerMock} from "test/mocks/ServiceManagerMock.sol"; import {OwnableMock} from "eigenlayer-contracts/src/test/mocks/OwnableMock.sol"; import {DelegationManagerMock} from "eigenlayer-contracts/src/test/mocks/DelegationManagerMock.sol"; import {SlasherMock} from "eigenlayer-contracts/src/test/mocks/SlasherMock.sol"; @@ -44,12 +42,11 @@ contract StakeRegistryUnitTests is Test { StakeRegistryHarness public stakeRegistry; RegistryCoordinatorHarness public registryCoordinator; - ServiceManagerMock public serviceManagerMock; StrategyManagerMock public strategyManagerMock; DelegationManagerMock public delegationMock; EigenPodManagerMock public eigenPodManagerMock; - address public serviceManagerOwner = address(uint160(uint256(keccak256("serviceManagerOwner")))); + address public registryCoordinatorOwner = address(uint160(uint256(keccak256("registryCoordinatorOwner")))); address public pauser = address(uint160(uint256(keccak256("pauser")))); address public unpauser = address(uint160(uint256(keccak256("unpauser")))); address public apkRegistry = address(uint160(uint256(keccak256("apkRegistry")))); @@ -104,21 +101,17 @@ contract StakeRegistryUnitTests is Test { slasher ); + cheats.startPrank(registryCoordinatorOwner); registryCoordinator = new RegistryCoordinatorHarness( slasher, - serviceManagerMock, stakeRegistry, IBLSApkRegistry(apkRegistry), IIndexRegistry(indexRegistry) ); - cheats.startPrank(serviceManagerOwner); - // make the serviceManagerOwner the owner of the serviceManager contract - serviceManagerMock = new ServiceManagerMock(slasher); stakeRegistryImplementation = new StakeRegistryHarness( IRegistryCoordinator(address(registryCoordinator)), - delegationMock, - IServiceManager(address(serviceManagerMock)) + delegationMock ); stakeRegistry = StakeRegistryHarness( @@ -149,8 +142,8 @@ contract StakeRegistryUnitTests is Test { registryCoordinator.setQuorumCount(maxQuorumsToRegisterFor); } - function testSetMinimumStakeForQuorum_NotFromServiceManager_Reverts() public { - cheats.expectRevert("StakeRegistry.onlyServiceManagerOwner: caller is not the owner of the serviceManager"); + function testSetMinimumStakeForQuorum_NotFromCoordinatorOwner_Reverts() public { + cheats.expectRevert("StakeRegistry.onlyCoordinatorOwner: caller is not the owner of the registryCoordinator"); stakeRegistry.setMinimumStakeForQuorum(defaultQuorumNumber, 0); } @@ -159,7 +152,7 @@ contract StakeRegistryUnitTests is Test { cheats.assume(initializedQuorums[quorumNumber]); // set the minimum stake for quorum - cheats.prank(serviceManagerOwner); + cheats.prank(registryCoordinatorOwner); stakeRegistry.setMinimumStakeForQuorum(quorumNumber, minimumStakeForQuorum); // make sure the minimum stake for quorum is as expected diff --git a/test/unit/VoteWeigherBaseUnit.t.sol b/test/unit/VoteWeigherBaseUnit.t.sol index 23db3a5f..0b415ab8 100644 --- a/test/unit/VoteWeigherBaseUnit.t.sol +++ b/test/unit/VoteWeigherBaseUnit.t.sol @@ -10,11 +10,14 @@ import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy import {IEigenPodManager} from "eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol"; import {ISlasher} from "eigenlayer-contracts/src/contracts/interfaces/ISlasher.sol"; <<<<<<< HEAD +<<<<<<< HEAD import {IServiceManager} from "../../src/interfaces/IServiceManager.sol"; import {IVoteWeigher} from "../../src/interfaces/IVoteWeigher.sol"; import {StakeRegistry} from "../../src/StakeRegistry.sol"; ======= import {IServiceManager} from "src/interfaces/IServiceManager.sol"; +======= +>>>>>>> ecf7849 (chore: remove ServiceManagerBase and add RegistryCoordinator owner (#98)) import {IStakeRegistry} from "src/interfaces/IStakeRegistry.sol"; import {StakeRegistry} from "src/StakeRegistry.sol"; >>>>>>> 12b09de (fix: fix compilation issues and tests) @@ -31,8 +34,7 @@ contract VoteWeigherBaseUnitTests is Test { ProxyAdmin public proxyAdmin; PauserRegistry public pauserRegistry; - address serviceManagerOwner; - IServiceManager public serviceManager; + address public registryCoordinatorOwner = address(uint160(uint256(keccak256("registryCoordinatorOwner")))); DelegationManagerMock delegationMock; RegistryCoordinatorMock registryCoordinatorMock; @@ -76,14 +78,12 @@ contract VoteWeigherBaseUnitTests is Test { pausers[0] = pauser; pauserRegistry = new PauserRegistry(pausers, unpauser); + cheats.prank(registryCoordinatorOwner); registryCoordinatorMock = new RegistryCoordinatorMock(); - delegationMock = new DelegationManagerMock(); - // make the serviceManagerOwner the owner of the serviceManager contract - cheats.prank(serviceManagerOwner); - serviceManager = IServiceManager(address(new OwnableMock())); + delegationMock = new DelegationManagerMock(); - voteWeigherImplementation = new StakeRegistry(registryCoordinatorMock, delegationMock, serviceManager); + voteWeigherImplementation = new StakeRegistry(registryCoordinatorMock, delegationMock); voteWeigher = StakeRegistry(address(new TransparentUpgradeableProxy(address(voteWeigherImplementation), address(proxyAdmin), ""))); @@ -93,7 +93,6 @@ contract VoteWeigherBaseUnitTests is Test { function testCorrectConstructionParameters() public { assertEq(address(voteWeigherImplementation.registryCoordinator()), address(registryCoordinatorMock)); assertEq(address(voteWeigherImplementation.delegation()), address(delegationMock)); - assertEq(address(voteWeigherImplementation.serviceManager()), address(serviceManager)); } /// TODO - migrate tests to registry coordinator diff --git a/test/utils/MockAVSDeployer.sol b/test/utils/MockAVSDeployer.sol index 89fac517..5e6b9cb5 100644 --- a/test/utils/MockAVSDeployer.sol +++ b/test/utils/MockAVSDeployer.sol @@ -18,7 +18,6 @@ import {RegistryCoordinatorHarness} from "test/harnesses/RegistryCoordinatorHarn import {BLSApkRegistry} from "src/BLSApkRegistry.sol"; import {StakeRegistry} from "src/StakeRegistry.sol"; import {IndexRegistry} from "src/IndexRegistry.sol"; -import {IServiceManager} from "src/interfaces/IServiceManager.sol"; import {IBLSApkRegistry} from "src/interfaces/IBLSApkRegistry.sol"; import {IStakeRegistry} from "src/interfaces/IStakeRegistry.sol"; import {IIndexRegistry} from "src/interfaces/IIndexRegistry.sol"; @@ -27,7 +26,11 @@ import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol"; import {StrategyManagerMock} from "eigenlayer-contracts/src/test/mocks/StrategyManagerMock.sol"; import {EigenPodManagerMock} from "eigenlayer-contracts/src/test/mocks/EigenPodManagerMock.sol"; +<<<<<<< HEAD import {ServiceManagerMock} from "test/mocks/ServiceManagerMock.sol"; +======= +import {OwnableMock} from "eigenlayer-contracts/src/test/mocks/OwnableMock.sol"; +>>>>>>> ecf7849 (chore: remove ServiceManagerBase and add RegistryCoordinator owner (#98)) import {DelegationManagerMock} from "eigenlayer-contracts/src/test/mocks/DelegationManagerMock.sol"; import {BLSApkRegistryHarness} from "test/harnesses/BLSApkRegistryHarness.sol"; import {EmptyContract} from "eigenlayer-contracts/src/test/mocks/EmptyContract.sol"; @@ -60,13 +63,12 @@ contract MockAVSDeployer is Test { BLSApkRegistryHarness public blsApkRegistry; IIndexRegistry public indexRegistry; - ServiceManagerMock public serviceManagerMock; StrategyManagerMock public strategyManagerMock; DelegationManagerMock public delegationMock; EigenPodManagerMock public eigenPodManagerMock; address public proxyAdminOwner = address(uint160(uint256(keccak256("proxyAdminOwner")))); - address public serviceManagerOwner = address(uint160(uint256(keccak256("serviceManagerOwner")))); + address public registryCoordinatorOwner = address(uint160(uint256(keccak256("registryCoordinatorOwner")))); address public pauser = address(uint160(uint256(keccak256("pauser")))); address public unpauser = address(uint160(uint256(keccak256("unpauser")))); @@ -144,9 +146,7 @@ contract MockAVSDeployer is Test { ); cheats.stopPrank(); - cheats.startPrank(serviceManagerOwner); - // make the serviceManagerOwner the owner of the serviceManager contract - serviceManagerMock = new ServiceManagerMock(slasher); + cheats.startPrank(registryCoordinatorOwner); registryCoordinator = RegistryCoordinatorHarness(address( new TransparentUpgradeableProxy( address(emptyContract), @@ -191,8 +191,7 @@ contract MockAVSDeployer is Test { stakeRegistryImplementation = new StakeRegistryHarness( IRegistryCoordinator(registryCoordinator), - delegationMock, - IServiceManager(address(serviceManagerMock)) + delegationMock ); proxyAdmin.upgrade( @@ -240,7 +239,6 @@ contract MockAVSDeployer is Test { registryCoordinatorImplementation = new RegistryCoordinatorHarness( slasher, - serviceManagerMock, stakeRegistry, blsApkRegistry, indexRegistry @@ -261,6 +259,7 @@ contract MockAVSDeployer is Test { address(registryCoordinatorImplementation), abi.encodeWithSelector( RegistryCoordinator.initialize.selector, + registryCoordinatorOwner, churnApprover, ejector, pauserRegistry,