diff --git a/lib/eigenlayer-contracts b/lib/eigenlayer-contracts index a31a2f3b..426f461c 160000 --- a/lib/eigenlayer-contracts +++ b/lib/eigenlayer-contracts @@ -1 +1 @@ -Subproject commit a31a2f3b226faee8a06b8664dd3b16ff95c01071 +Subproject commit 426f461c59b4f0e16f8becdffd747075edcaded8 diff --git a/test/integration/CoreRegistration.t.sol b/test/integration/CoreRegistration.t.sol index c655b4e2..d1d1d161 100644 --- a/test/integration/CoreRegistration.t.sol +++ b/test/integration/CoreRegistration.t.sol @@ -97,7 +97,7 @@ contract Test_CoreRegistration is MockAVSDeployer { cheats.prank(operator); delegationManager.registerAsOperator( IDelegationManager.OperatorDetails({ - earningsReceiver: operator, + __deprecated_earningsReceiver: operator, delegationApprover: address(0), stakerOptOutWindowBlocks: 0 }), diff --git a/test/integration/IntegrationDeployer.t.sol b/test/integration/IntegrationDeployer.t.sol index a80bfedb..e8d74673 100644 --- a/test/integration/IntegrationDeployer.t.sol +++ b/test/integration/IntegrationDeployer.t.sol @@ -19,7 +19,6 @@ import "eigenlayer-contracts/src/contracts/core/AVSDirectory.sol"; import "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol"; import "eigenlayer-contracts/src/contracts/pods/EigenPodManager.sol"; import "eigenlayer-contracts/src/contracts/pods/EigenPod.sol"; -import "eigenlayer-contracts/src/contracts/pods/DelayedWithdrawalRouter.sol"; import "eigenlayer-contracts/src/contracts/permissions/PauserRegistry.sol"; import "eigenlayer-contracts/src/test/mocks/ETHDepositMock.sol"; // import "eigenlayer-contracts/src/test/integration/mocks/BeaconChainOracleMock.t.sol"; @@ -56,7 +55,6 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { Slasher slasher; IBeacon eigenPodBeacon; EigenPod pod; - DelayedWithdrawalRouter delayedWithdrawalRouter; ETHPOSDepositMock ethPOSDeposit; BeaconChainOracleMock beaconChainOracle; @@ -125,9 +123,6 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { eigenPodManager = EigenPodManager( address(new TransparentUpgradeableProxy(address(emptyContract), address(proxyAdmin), "")) ); - delayedWithdrawalRouter = DelayedWithdrawalRouter( - address(new TransparentUpgradeableProxy(address(emptyContract), address(proxyAdmin), "")) - ); avsDirectory = AVSDirectory( address(new TransparentUpgradeableProxy(address(emptyContract), address(proxyAdmin), "")) ); @@ -135,10 +130,8 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { // Deploy EigenPod Contracts pod = new EigenPod( ethPOSDeposit, - delayedWithdrawalRouter, eigenPodManager, - MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR, - 0 + MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR ); eigenPodBeacon = new UpgradeableBeacon(address(pod)); @@ -154,7 +147,6 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { slasher, delegationManager ); - DelayedWithdrawalRouter delayedWithdrawalRouterImplementation = new DelayedWithdrawalRouter(eigenPodManager); AVSDirectory avsDirectoryImplemntation = new AVSDirectory(delegationManager); // Third, upgrade the proxy contracts to point to the implementations @@ -210,18 +202,6 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { 0 // initialPausedStatus ) ); - // Delayed Withdrawal Router - proxyAdmin.upgradeAndCall( - TransparentUpgradeableProxy(payable(address(delayedWithdrawalRouter))), - address(delayedWithdrawalRouterImplementation), - abi.encodeWithSelector( - DelayedWithdrawalRouter.initialize.selector, - eigenLayerReputedMultisig, // initialOwner - pauserRegistry, - 0, // initialPausedStatus - minWithdrawalDelayBlocks - ) - ); // AVSDirectory proxyAdmin.upgradeAndCall( TransparentUpgradeableProxy(payable(address(avsDirectory))), @@ -305,7 +285,7 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { TransparentUpgradeableProxy(payable(address(stakeRegistry))), address(stakeRegistryImplementation) ); - + proxyAdmin.upgrade( TransparentUpgradeableProxy(payable(address(blsApkRegistry))), address(blsApkRegistryImplementation) @@ -346,7 +326,7 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { /// @dev Deploy a strategy and its underlying token, push to global lists of tokens/strategies, and whitelist /// strategy in strategyManager function _newStrategyAndToken(string memory tokenName, string memory tokenSymbol, uint initialSupply, address owner) internal { - IERC20 underlyingToken = new ERC20PresetFixedSupply(tokenName, tokenSymbol, initialSupply, owner); + IERC20 underlyingToken = new ERC20PresetFixedSupply(tokenName, tokenSymbol, initialSupply, owner); StrategyBase strategy = StrategyBase( address( new TransparentUpgradeableProxy( diff --git a/test/integration/User.t.sol b/test/integration/User.t.sol index ef6557e5..f809e3b4 100644 --- a/test/integration/User.t.sol +++ b/test/integration/User.t.sol @@ -56,7 +56,7 @@ contract User is Test { BLSApkRegistry blsApkRegistry; StakeRegistry stakeRegistry; IndexRegistry indexRegistry; - + TimeMachine timeMachine; uint churnApproverPrivateKey; @@ -145,12 +145,12 @@ contract User is Test { assertEq(churnQuorums.length, churnTargets.length, "User.registerOperatorWithChurn: input length mismatch"); assertTrue(churnBitmap.noBitsInCommon(standardBitmap), "User.registerOperatorWithChurn: input quorums have common bits"); - bytes memory allQuorums = + bytes memory allQuorums = churnBitmap .plus(standardBitmap) .bitmapToBytesArray(); - IRegistryCoordinator.OperatorKickParam[] memory kickParams + IRegistryCoordinator.OperatorKickParam[] memory kickParams = new IRegistryCoordinator.OperatorKickParam[](allQuorums.length); // this constructs OperatorKickParam[] in ascending quorum order @@ -242,7 +242,7 @@ contract User is Test { _log("registerAsOperator (core)"); IDelegationManager.OperatorDetails memory details = IDelegationManager.OperatorDetails({ - earningsReceiver: address(this), + __deprecated_earningsReceiver: address(this), delegationApprover: address(0), stakerOptOutWindowBlocks: 0 }); @@ -327,14 +327,14 @@ contract User is Test { emit log_named_string(string.concat(NAME, ".", s), quorums.toString()); } - // Operator0.registerOperatorWithChurn + // Operator0.registerOperatorWithChurn // - standardQuorums: 0x00010203... // - churnQuorums: 0x0405... // - churnTargets: Operator1, Operator2, ... function _logChurn( - string memory s, - bytes memory churnQuorums, - User[] memory churnTargets, + string memory s, + bytes memory churnQuorums, + User[] memory churnTargets, bytes memory standardQuorums ) internal virtual { emit log(string.concat(NAME, ".", s)); @@ -366,7 +366,7 @@ contract User_AltMethods is User { _; } - constructor(string memory name, uint _privKey, IBLSApkRegistry.PubkeyRegistrationParams memory _pubkeyParams) + constructor(string memory name, uint _privKey, IBLSApkRegistry.PubkeyRegistrationParams memory _pubkeyParams) User(name, _privKey, _pubkeyParams) {} /// @dev Rather than calling deregisterOperator, this pranks the ejector and calls @@ -400,6 +400,6 @@ contract User_AltMethods is User { Sort.sort(operatorsPerQuorum[i]); } - registryCoordinator.updateOperatorsForQuorum(operatorsPerQuorum, allQuorums); + registryCoordinator.updateOperatorsForQuorum(operatorsPerQuorum, allQuorums); } } diff --git a/test/integration/mocks/BeaconChainOracleMock.t.sol b/test/integration/mocks/BeaconChainOracleMock.t.sol index dabd6b6a..a841fa7f 100644 --- a/test/integration/mocks/BeaconChainOracleMock.t.sol +++ b/test/integration/mocks/BeaconChainOracleMock.t.sol @@ -1,20 +1,63 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.12; -import "eigenlayer-contracts/src/contracts/interfaces/IBeaconChainOracle.sol"; +import "eigenlayer-contracts/src/test/integration/deprecatedInterfaces/mainnet/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 { +contract BeaconChainOracleMock is IBeaconChainOracle_DeprecatedM1 { + mapping(uint64 => bytes32) blockRoots; - mapping(uint64 => bytes32) blockRoots; + function timestampToBlockRoot(uint timestamp) public view returns (bytes32) { + return blockRoots[uint64(timestamp)]; + } - function timestampToBlockRoot(uint timestamp) public view returns (bytes32) { - return blockRoots[uint64(timestamp)]; - } + function setBlockRoot(uint64 timestamp, bytes32 blockRoot) public { + blockRoots[timestamp] = blockRoot; + } - function setBlockRoot(uint64 timestamp, bytes32 blockRoot) public { - blockRoots[timestamp] = blockRoot; - } + function latestConfirmedOracleBlockNumber() + external + view + override + returns (uint64) + {} + + function beaconStateRootAtBlockNumber( + uint64 blockNumber + ) external view override returns (bytes32) {} + + function isOracleSigner( + address _oracleSigner + ) external view override returns (bool) {} + + function hasVoted( + uint64 blockNumber, + address oracleSigner + ) external view override returns (bool) {} + + function stateRootVotes( + uint64 blockNumber, + bytes32 stateRoot + ) external view override returns (uint256) {} + + function totalOracleSigners() external view override returns (uint256) {} + + function threshold() external view override returns (uint256) {} + + function setThreshold(uint256 _threshold) external override {} + + function addOracleSigners( + address[] memory _oracleSigners + ) external override {} + + function removeOracleSigners( + address[] memory _oracleSigners + ) external override {} + + function voteForBeaconChainStateRoot( + uint64 blockNumber, + bytes32 stateRoot + ) external override {} } diff --git a/test/mocks/AVSDirectoryMock.sol b/test/mocks/AVSDirectoryMock.sol index 813e913a..9d9f1b79 100644 --- a/test/mocks/AVSDirectoryMock.sol +++ b/test/mocks/AVSDirectoryMock.sol @@ -49,4 +49,8 @@ contract AVSDirectoryMock is IAVSDirectory { /// @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) {} +} diff --git a/test/mocks/DelegationMock.sol b/test/mocks/DelegationMock.sol index f8a9915e..491f0f10 100644 --- a/test/mocks/DelegationMock.sol +++ b/test/mocks/DelegationMock.sol @@ -24,7 +24,7 @@ contract DelegationMock is IDelegationManager { mapping (address => address) public delegatedTo; function registerAsOperator(OperatorDetails calldata /*registeringOperatorDetails*/, string calldata /*metadataURI*/) external pure {} - + function updateOperatorMetadataURI(string calldata /*metadataURI*/) external pure {} function updateAVSMetadataURI(string calldata /*metadataURI*/) external pure {} @@ -58,7 +58,7 @@ contract DelegationMock is IDelegationManager { function operatorDetails(address operator) external pure returns (OperatorDetails memory) { OperatorDetails memory returnValue = OperatorDetails({ - earningsReceiver: operator, + __deprecated_earningsReceiver: operator, delegationApprover: operator, stakerOptOutWindowBlocks: 0 }); @@ -169,8 +169,8 @@ contract DelegationMock is IDelegationManager { bool[] calldata receiveAsTokens ) external {} - function migrateQueuedWithdrawals(IStrategyManager.DeprecatedStruct_QueuedWithdrawal[] memory withdrawalsToQueue) external {} - + // function migrateQueuedWithdrawals(IStrategyManager.DeprecatedStruct_QueuedWithdrawal[] memory withdrawalsToQueue) external {} + // onlyDelegationManager functions in StrategyManager function addShares( IStrategyManager strategyManager, @@ -200,4 +200,20 @@ contract DelegationMock is IDelegationManager { ) external { strategyManager.withdrawSharesAsTokens(recipient, strategy, shares, token); } + + function getDelegatableShares(address staker) external view returns (IStrategy[] memory, uint256[] memory) { + IStrategy[] memory strategies; + uint256[] memory shares; + return (strategies, shares); + } + + function beaconChainETHStrategy() external view returns (IStrategy) { + return IStrategy(address(0)); + } + + function setMinWithdrawalDelayBlocks(uint256 newMinWithdrawalDelayBlocks) external { + } + + function setStrategyWithdrawalDelayBlocks(IStrategy[] calldata strategies, uint256[] calldata withdrawalDelayBlocks) external { + } } diff --git a/test/unit/BLSApkRegistryUnit.t.sol b/test/unit/BLSApkRegistryUnit.t.sol index a61d4f7d..4b3c1f1d 100644 --- a/test/unit/BLSApkRegistryUnit.t.sol +++ b/test/unit/BLSApkRegistryUnit.t.sol @@ -336,7 +336,7 @@ contract BLSApkRegistryUnitTests_registerBLSPublicKey is BLSApkRegistryUnitTests pubkeyRegistrationParams.pubkeyRegistrationSignature = _signMessage(operator); cheats.startPrank(address(registryCoordinator)); - blsApkRegistry.registerBLSPublicKey(operator, pubkeyRegistrationParams, messageHash); + blsApkRegistry.registerBLSPublicKey(operator, pubkeyRegistrationParams, messageHash); cheats.expectRevert("BLSApkRegistry.registerBLSPublicKey: public key already registered"); blsApkRegistry.registerBLSPublicKey(operator2, pubkeyRegistrationParams, messageHash); @@ -800,8 +800,8 @@ contract BLSApkRegistryUnitTests_quorumApkUpdates is BLSApkRegistryUnitTests { uint256 blockGap, uint256 randSeed ) external { - cheats.assume(numRegistrants > 0 && numRegistrants < 100); - cheats.assume(blockGap < 100); + numRegistrants = bound(numRegistrants, 1, 99); + blockGap = bound(blockGap, 0, 99); bytes memory quorumNumbers = new bytes(1); quorumNumbers[0] = bytes1(defaultQuorumNumber); @@ -850,12 +850,12 @@ contract BLSApkRegistryUnitTests_quorumApkUpdates is BLSApkRegistryUnitTests { * and checking the correct revert messages are emitted for wrong blocknumber inputs */ function testFuzz_quorumApkUpdates_IncorrectBlockNumber( - uint256 numRegistrants, + uint32 numRegistrants, uint32 indexToCheck, uint32 wrongBlockNumber, uint256 randSeed ) external { - cheats.assume(numRegistrants > 0 && numRegistrants < 100); + numRegistrants = uint32(bound(numRegistrants, 1, 99)); cheats.assume(indexToCheck < numRegistrants - 1); bytes memory quorumNumbers = new bytes(1); quorumNumbers[0] = bytes1(defaultQuorumNumber); diff --git a/test/utils/MockAVSDeployer.sol b/test/utils/MockAVSDeployer.sol index 631a74b7..4f78f3dc 100644 --- a/test/utils/MockAVSDeployer.sol +++ b/test/utils/MockAVSDeployer.sol @@ -138,7 +138,7 @@ contract MockAVSDeployer is Test { delegationMock = new DelegationMock(); avsDirectoryMock = new AVSDirectoryMock(); - eigenPodManagerMock = new EigenPodManagerMock(); + eigenPodManagerMock = new EigenPodManagerMock(pauserRegistry); strategyManagerMock = new StrategyManagerMock(); slasherImplementation = new Slasher(strategyManagerMock, delegationMock); slasher = Slasher(