diff --git a/lib/eigenlayer-contracts b/lib/eigenlayer-contracts index 47f12320..fef6471e 160000 --- a/lib/eigenlayer-contracts +++ b/lib/eigenlayer-contracts @@ -1 +1 @@ -Subproject commit 47f123204c9cde6c714ada5fb5077695c21e5991 +Subproject commit fef6471e7cacb8a61daa30f06c06783dc2759ba5 diff --git a/test/integration/mocks/BeaconChainOracleMock.t.sol b/test/integration/mocks/BeaconChainOracleMock.t.sol deleted file mode 100644 index fadb7555..00000000 --- a/test/integration/mocks/BeaconChainOracleMock.t.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; - -import "eigenlayer-contracts/src/contracts/interfaces/IBeaconChainOracle.sol"; - -// NOTE: There's a copy of this file in the core repo, but importing that was causing -// the compiler to complain for an unfathomable reason. Apparently reimplementing it -// here fixes the issue. -contract BeaconChainOracleMock is IBeaconChainOracle { - - mapping(uint64 => bytes32) blockRoots; - - function timestampToBlockRoot(uint timestamp) public view returns (bytes32) { - return blockRoots[uint64(timestamp)]; - } - - function setBlockRoot(uint64 timestamp, bytes32 blockRoot) public { - blockRoots[timestamp] = blockRoot; - } -} \ No newline at end of file diff --git a/test/mocks/AVSDirectoryMock.sol b/test/mocks/AVSDirectoryMock.sol index ba7e3e82..5037d4a5 100644 --- a/test/mocks/AVSDirectoryMock.sol +++ b/test/mocks/AVSDirectoryMock.sol @@ -1,45 +1,24 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; +pragma solidity ^0.8.12; import {IAVSDirectory, ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol"; contract AVSDirectoryMock is IAVSDirectory { - /** - * @notice Called by an avs to register an operator with the avs. - * @param operator The address of the operator to register. - * @param operatorSignature The signature, salt, and expiry of the operator's signature. - */ + mapping(address => mapping(bytes32 => bool)) public operatorSaltIsSpentMapping; + function registerOperatorToAVS( address operator, ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature ) external {} - /** - * @notice Called by an avs to deregister an operator with the avs. - * @param operator The address of the operator to deregister. - */ function deregisterOperatorFromAVS(address operator) external {} - /** - * @notice Called by an AVS to emit an `AVSMetadataURIUpdated` event indicating the information has updated. - * @param metadataURI The URI for metadata associated with an AVS - * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `AVSMetadataURIUpdated` event - */ function updateAVSMetadataURI(string calldata metadataURI) external {} - /** - * @notice Returns whether or not the salt has already been used by the operator. - * @dev Salts is used in the `registerOperatorToAVS` function. - */ - function operatorSaltIsSpent(address operator, bytes32 salt) external view returns (bool) {} - - /** - * @notice Calculates the digest hash to be signed by an operator to register with an AVS - * @param operator The account registering as an operator - * @param avs The AVS the operator is registering to - * @param salt A unique and single use value associated with the approver signature. - * @param expiry Time after which the approver's signature becomes invalid - */ + function operatorSaltIsSpent(address operator, bytes32 salt) external view returns (bool) { + return operatorSaltIsSpentMapping[operator][salt]; + } + function calculateOperatorAVSRegistrationDigestHash( address operator, address avs, @@ -47,6 +26,9 @@ contract AVSDirectoryMock is IAVSDirectory { uint256 expiry ) external view returns (bytes32) {} - /// @notice The EIP-712 typehash for the Registration struct used by the contract function OPERATOR_AVS_REGISTRATION_TYPEHASH() external view returns (bytes32) {} -} + + function cancelSalt(bytes32 salt) external {} + + function domainSeparator() external view returns (bytes32) {} +} \ No newline at end of file diff --git a/test/mocks/DelegationMock.sol b/test/mocks/DelegationMock.sol index 1591e90e..e10e82d2 100644 --- a/test/mocks/DelegationMock.sol +++ b/test/mocks/DelegationMock.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity =0.8.12; +pragma solidity ^0.8.12; -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol"; +import "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol"; import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol"; import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol"; @@ -12,6 +13,12 @@ contract DelegationMock is IDelegationManager { mapping(address => bool) public isOperator; mapping(address => mapping(IStrategy => uint256)) public operatorShares; + function getDelegatableShares(address staker) external view returns (IStrategy[] memory, uint256[] memory) {} + + function setMinWithdrawalDelayBlocks(uint256 newMinWithdrawalDelayBlocks) external {} + + function setStrategyWithdrawalDelayBlocks(IStrategy[] calldata strategies, uint256[] calldata withdrawalDelayBlocks) external {} + function setIsOperator(address operator, bool _isOperatorReturnValue) external { isOperator[operator] = _isOperatorReturnValue; } @@ -58,21 +65,13 @@ contract DelegationMock is IDelegationManager { function operatorDetails(address operator) external pure returns (OperatorDetails memory) { OperatorDetails memory returnValue = OperatorDetails({ - __deprecated_earningsReceiver: operator, + __deprecated_earningsReceiver: operator, delegationApprover: operator, stakerOptOutWindowBlocks: 0 }); return returnValue; } - function beaconChainETHStrategy() external pure returns (IStrategy) { - return IStrategy(address(0)); - } - - function earningsReceiver(address operator) external pure returns (address) { - return operator; - } - function delegationApprover(address operator) external pure returns (address) { return operator; } @@ -81,15 +80,18 @@ contract DelegationMock is IDelegationManager { return 0; } - function minWithdrawalDelayBlocks() external view returns (uint256) { - return 50400; + function minWithdrawalDelayBlocks() external pure returns (uint256) { + return 0; } + /// @notice return address of the beaconChainETHStrategy + function beaconChainETHStrategy() external view returns (IStrategy) {} + /** * @notice Minimum delay enforced by this contract per Strategy for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner, * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced). */ - function strategyWithdrawalDelayBlocks(IStrategy /*strategy*/) external view returns (uint256) { + function strategyWithdrawalDelayBlocks(IStrategy /*strategy*/) external pure returns (uint256) { return 0; } @@ -98,14 +100,14 @@ contract DelegationMock is IDelegationManager { IStrategy[] memory strategies ) external view returns (uint256[] memory) { uint256[] memory shares = new uint256[](strategies.length); - for (uint256 i = 0; i < strategies.length; ++i) { + for (uint256 i = 0; i < strategies.length; i++) { shares[i] = operatorShares[operator][strategies[i]]; } return shares; } - function getWithdrawalDelay(IStrategy[] calldata /*strategies*/) public view returns (uint256) { - return 0; + function getWithdrawalDelay(IStrategy[] calldata /*strategies*/) public pure returns (uint256) { + return type(uint256).max; } function isDelegated(address staker) external view returns (bool) { @@ -147,14 +149,20 @@ contract DelegationMock is IDelegationManager { function DELEGATION_APPROVAL_TYPEHASH() external view returns (bytes32) {} - function domainSeparator() external view returns (bytes32) {} + function OPERATOR_AVS_REGISTRATION_TYPEHASH() external view returns (bytes32) {} function cumulativeWithdrawalsQueued(address staker) external view returns (uint256) {} function calculateWithdrawalRoot(Withdrawal memory withdrawal) external pure returns (bytes32) {} + function registerOperatorToAVS(address operator, ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature) external {} + + function deregisterOperatorFromAVS(address operator) external {} + function operatorSaltIsSpent(address avs, bytes32 salt) external view returns (bool) {} + function domainSeparator() external view returns (bytes32) {} + function queueWithdrawals( QueuedWithdrawalParams[] calldata queuedWithdrawalParams ) external returns (bytes32[] memory) {} diff --git a/test/mocks/ECDSAServiceManagerMock.sol b/test/mocks/ECDSAServiceManagerMock.sol new file mode 100644 index 00000000..528270ae --- /dev/null +++ b/test/mocks/ECDSAServiceManagerMock.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.12; + +import "../../src/unaudited/ECDSAServiceManagerBase.sol"; + +contract ECDSAServiceManagerMock is ECDSAServiceManagerBase { + constructor( + address _avsDirectory, + address _stakeRegistry, + address _rewardsCoordinator, + address _delegationManager + ) + ECDSAServiceManagerBase(_avsDirectory, _stakeRegistry, _rewardsCoordinator, _delegationManager) + {} + + function initialize( + address initialOwner, + address rewardsInitiator + ) public virtual initializer { + __ServiceManagerBase_init(initialOwner, rewardsInitiator); + } +} diff --git a/test/mocks/ECDSAStakeRegistryMock.sol b/test/mocks/ECDSAStakeRegistryMock.sol new file mode 100644 index 00000000..7ad6043e --- /dev/null +++ b/test/mocks/ECDSAStakeRegistryMock.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.12; + +import "../../src/unaudited/ECDSAStakeRegistry.sol"; + +/** + * @title Mock for ECDSAStakeRegistry + * @dev This contract is a mock implementation of the ECDSAStakeRegistry for testing purposes. + */ +contract ECDSAStakeRegistryMock is ECDSAStakeRegistry { + + constructor(IDelegationManager _delegationManager) ECDSAStakeRegistry(_delegationManager) { + } +} diff --git a/test/mocks/RegistryCoordinatorMock.sol b/test/mocks/RegistryCoordinatorMock.sol index 938427af..f2cd05bc 100644 --- a/test/mocks/RegistryCoordinatorMock.sol +++ b/test/mocks/RegistryCoordinatorMock.sol @@ -68,4 +68,6 @@ contract RegistryCoordinatorMock is IRegistryCoordinator { function quorumUpdateBlockNumber(uint8 quorumNumber) external view returns (uint256) {} function owner() external view returns (address) {} + + function updateSocket(string memory socket) external {} } diff --git a/test/mocks/RewardsCoordinatorMock.sol b/test/mocks/RewardsCoordinatorMock.sol index a18d281e..ca18e31e 100644 --- a/test/mocks/RewardsCoordinatorMock.sol +++ b/test/mocks/RewardsCoordinatorMock.sol @@ -23,50 +23,117 @@ contract RewardsCoordinatorMock is IRewardsCoordinator { function claimerFor(address earner) external view returns (address) {} - function cumulativeClaimed(address claimer, IERC20 token) external view returns (uint256) {} + function cumulativeClaimed( + address claimer, + IERC20 token + ) external view returns (uint256) {} - function globalOperatorCommissionBips() external view returns (uint16) {} + function defaultOperatorSplitBips() external view returns (uint16) {} - function operatorCommissionBips(address operator, address avs) external view returns (uint16) {} + function calculateEarnerLeafHash( + EarnerTreeMerkleLeaf calldata leaf + ) external pure returns (bytes32) {} - function calculateEarnerLeafHash(EarnerTreeMerkleLeaf calldata leaf) external pure returns (bytes32) {} + function calculateTokenLeafHash( + TokenTreeMerkleLeaf calldata leaf + ) external pure returns (bytes32) {} - function calculateTokenLeafHash(TokenTreeMerkleLeaf calldata leaf) external pure returns (bytes32) {} + function checkClaim( + RewardsMerkleClaim calldata claim + ) external view returns (bool) {} - function checkClaim(RewardsMerkleClaim calldata claim) external view returns (bool) {} + function currRewardsCalculationEndTimestamp() + external + view + returns (uint32) + {} - function currRewardsCalculationEndTimestamp() external view returns (uint32) {} + function getDistributionRootsLength() external view returns (uint256) {} - function getRootIndexFromHash(bytes32 rootHash) external view returns (uint32) {} + function getDistributionRootAtIndex( + uint256 index + ) external view returns (DistributionRoot memory) {} - function getDistributionRootsLength() external view returns (uint256) {} + function getCurrentDistributionRoot() + external + view + returns (DistributionRoot memory) + {} + + function getCurrentClaimableDistributionRoot() + external + view + returns (DistributionRoot memory) + {} + + function getRootIndexFromHash( + bytes32 rootHash + ) external view returns (uint32) {} + + function domainSeparator() external view returns (bytes32) {} + + function getOperatorAVSSplit( + address operator, + address avs + ) external view returns (uint16) {} - /// EXTERNAL FUNCTIONS /// + function getOperatorPISplit( + address operator + ) external view returns (uint16) {} + + function createAVSRewardsSubmission( + RewardsSubmission[] calldata rewardsSubmissions + ) external {} + + function createRewardsForAllSubmission( + RewardsSubmission[] calldata rewardsSubmission + ) external {} + + function createRewardsForAllEarners( + RewardsSubmission[] calldata rewardsSubmissions + ) external {} - function createAVSRewardsSubmission(RewardsSubmission[] calldata rewardsSubmissions) external {} + function createOperatorDirectedAVSRewardsSubmission( + address avs, + OperatorDirectedRewardsSubmission[] + calldata operatorDirectedRewardsSubmissions + ) external {} - function createRewardsForAllSubmission(RewardsSubmission[] calldata rewardsSubmission) external {} + function processClaim( + RewardsMerkleClaim calldata claim, + address recipient + ) external {} - function processClaim(RewardsMerkleClaim calldata claim, address recipient) external {} + function processClaims( + RewardsMerkleClaim[] calldata claims, + address recipient + ) external {} function submitRoot( bytes32 root, uint32 rewardsCalculationEndTimestamp ) external {} - function setRewardsUpdater(address _rewardsUpdater) external {} + function disableRoot(uint32 rootIndex) external {} + + function setClaimerFor(address claimer) external {} function setActivationDelay(uint32 _activationDelay) external {} - function setGlobalOperatorCommission(uint16 _globalCommissionBips) external {} + function setDefaultOperatorSplit(uint16 split) external {} - function setClaimerFor(address claimer) external {} + function setRewardsUpdater(address _rewardsUpdater) external {} + + function setRewardsForAllSubmitter( + address _submitter, + bool _newValue + ) external {} + + function setOperatorAVSSplit( + address operator, + address avs, + uint16 split + ) external {} - /** - * @notice Sets the permissioned `payAllForRangeSubmitter` address which can submit payAllForRange - * @dev Only callable by the contract owner - * @param _submitter The address of the payAllForRangeSubmitter - * @param _newValue The new value for isPayAllForRangeSubmitter - */ - function setRewardsForAllSubmitter(address _submitter, bool _newValue) external {} -} \ No newline at end of file + function setOperatorPISplit(address operator, uint16 split) external {} +}