feat: update eigenlayer contracts to v1.8.0 (#270)

## Summary
- sync `contracts/lib/eigenlayer-contracts` to tag
`v1.8.0-testnet-final` and refresh `EIGENLAYER.md` with the new commit
reference
- update local/test deployment flows to deploy the upstream
`EigenStrategy`, feed it into `AllocationManager`/`StrategyManager`, and
adopt the revised `EigenPod` constructor
- drop the obsolete `AllocationManagerMock` stub and replace its usage
with targeted `vm.mockCall` stubs that return `slashOperator` share data
- adjust slasher unit tests to match the new ABI so DataHaven stays
aligned with EigenLayer 1.8 semantics

## Testing
- forge build
- forge test
This commit is contained in:
Ahmad Kaouk 2025-11-04 16:30:18 +01:00 committed by GitHub
parent c7d73af4ca
commit 470f5fc916
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 832 additions and 486 deletions

View file

@ -34,14 +34,6 @@ jobs:
with:
version: v1.4.3
- name: Cache Foundry libraries
uses: actions/cache@v4
with:
path: contracts/lib
key: ${{ runner.os }}-foundry-libs-${{ hashFiles('contracts/.gitmodules') }}
restore-keys: |
${{ runner.os }}-foundry-libs-
- name: Cache Foundry build artifacts
uses: actions/cache@v4
with:

@ -1 +1 @@
Subproject commit d6c229b6a81b3ae2c5ef7788c328bcb6da37cb36
Subproject commit 7ecc83c7b180850531bc5b8b953a7340adeecd43

View file

@ -61,6 +61,7 @@ import {
IRewardsCoordinatorTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {EigenStrategy} from "eigenlayer-contracts/src/contracts/strategies/EigenStrategy.sol";
import {PauserRegistry} from "eigenlayer-contracts/src/contracts/permissions/PauserRegistry.sol";
import {EigenPod} from "eigenlayer-contracts/src/contracts/pods/EigenPod.sol";
import {EigenPodManager} from "eigenlayer-contracts/src/contracts/pods/EigenPodManager.sol";
@ -92,6 +93,7 @@ contract DeployLocal is DeployBase {
EigenPod public eigenPodImplementation;
StrategyBaseTVLLimits public baseStrategyImplementation;
StrategyInfo[] public deployedStrategies;
IStrategy public eigenStrategy;
// EigenLayer required semver
string public constant SEMVER = "v1.0.0";
@ -135,15 +137,18 @@ contract DeployLocal is DeployBase {
_deployProxies(proxyAdmin);
Logging.logStep("Initial proxies deployed successfully");
vm.broadcast(_deployerPrivateKey);
eigenStrategy =
IStrategy(address(new EigenStrategy(strategyManager, pauserRegistry, SEMVER)));
Logging.logContractDeployed("EigenStrategy", address(eigenStrategy));
// Setup ETH2 deposit contract for EigenPod functionality
ethPOSDeposit = IETHPOSDeposit(getETHPOSDepositAddress());
Logging.logContractDeployed("ETHPOSDeposit", address(ethPOSDeposit));
// Deploy EigenPod implementation and beacon
vm.broadcast(_deployerPrivateKey);
eigenPodImplementation = new EigenPod(
ethPOSDeposit, eigenPodManager, eigenLayerConfig.beaconChainGenesisTimestamp, SEMVER
);
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, SEMVER);
vm.broadcast(_deployerPrivateKey);
eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
Logging.logContractDeployed("EigenPod Implementation", address(eigenPodImplementation));
@ -231,6 +236,7 @@ contract DeployLocal is DeployBase {
Logging.logContractDeployed("EigenPodBeacon", address(eigenPodBeacon));
Logging.logContractDeployed("RewardsCoordinator", address(rewardsCoordinator));
Logging.logContractDeployed("AllocationManager", address(allocationManager));
Logging.logContractDeployed("EigenStrategy", address(eigenStrategy));
Logging.logContractDeployed("PermissionController", address(permissionController));
Logging.logContractDeployed("ETHPOSDeposit", address(ethPOSDeposit));
@ -437,7 +443,8 @@ contract DeployLocal is DeployBase {
);
vm.broadcast(_deployerPrivateKey);
strategyManagerImplementation = new StrategyManager(delegation, pauserRegistry, SEMVER);
strategyManagerImplementation =
new StrategyManager(allocationManager, delegation, pauserRegistry, SEMVER);
Logging.logContractDeployed(
"StrategyManager Implementation", address(strategyManagerImplementation)
);
@ -478,6 +485,7 @@ contract DeployLocal is DeployBase {
vm.broadcast(_deployerPrivateKey);
allocationManagerImplementation = new AllocationManager(
delegation,
eigenStrategy,
pauserRegistry,
permissionController,
config.deallocationDelay,
@ -500,25 +508,15 @@ contract DeployLocal is DeployBase {
ProxyAdmin proxyAdmin
) internal {
// Initialize DelegationManager
{
IStrategy[] memory strategies;
uint256[] memory withdrawalDelayBlocks;
vm.broadcast(_deployerPrivateKey);
proxyAdmin.upgradeAndCall(
ITransparentUpgradeableProxy(payable(address(delegation))),
address(delegationImplementation),
abi.encodeWithSelector(
DelegationManager.initialize.selector,
config.executorMultisig,
config.delegationInitPausedStatus,
config.delegationWithdrawalDelayBlocks,
strategies,
withdrawalDelayBlocks
)
);
Logging.logStep("DelegationManager initialized");
}
vm.broadcast(_deployerPrivateKey);
proxyAdmin.upgradeAndCall(
ITransparentUpgradeableProxy(payable(address(delegation))),
address(delegationImplementation),
abi.encodeWithSelector(
DelegationManager.initialize.selector, config.delegationInitPausedStatus
)
);
Logging.logStep("DelegationManager initialized");
// Initialize StrategyManager
vm.broadcast(_deployerPrivateKey);
@ -582,9 +580,7 @@ contract DeployLocal is DeployBase {
ITransparentUpgradeableProxy(payable(address(allocationManager))),
address(allocationManagerImplementation),
abi.encodeWithSelector(
AllocationManager.initialize.selector,
config.executorMultisig,
config.allocationManagerInitPausedStatus
AllocationManager.initialize.selector, config.allocationManagerInitPausedStatus
)
);
Logging.logStep("AllocationManager initialized");

View file

@ -479,10 +479,10 @@ contract ServiceManagerRewardsRegistryTest is AVSDeployer {
vm.prank(operatorAddress);
vm.expectRevert(abi.encodeWithSelector(IRewardsRegistryErrors.ArrayLengthMismatch.selector));
uint256[] memory numberOfLeaves = new uint256[](3);
numberOfLeaves[0] = 2;
numberOfLeaves[1] = 2;
numberOfLeaves[2] = 2;
uint256[] memory numLeaves = new uint256[](3);
numLeaves[0] = 2;
numLeaves[1] = 2;
numLeaves[2] = 2;
uint256[] memory leafIndices = new uint256[](3);
leafIndices[0] = 0;
@ -490,7 +490,7 @@ contract ServiceManagerRewardsRegistryTest is AVSDeployer {
leafIndices[2] = 0;
serviceManager.claimOperatorRewardsBatch(
operatorSetId, rootIndices, points, numberOfLeaves, leafIndices, proofs
operatorSetId, rootIndices, points, numLeaves, leafIndices, proofs
);
}
@ -530,16 +530,16 @@ contract ServiceManagerRewardsRegistryTest is AVSDeployer {
abi.encodeWithSelector(IRewardsRegistryErrors.RewardsAlreadyClaimedForIndex.selector)
);
uint256[] memory numberOfLeaves = new uint256[](2);
numberOfLeaves[0] = 2;
numberOfLeaves[1] = 2;
uint256[] memory numLeaves = new uint256[](2);
numLeaves[0] = 2;
numLeaves[1] = 2;
uint256[] memory leafIndices = new uint256[](2);
leafIndices[0] = 0;
leafIndices[1] = 0;
serviceManager.claimOperatorRewardsBatch(
operatorSetId, rootIndices, points, numberOfLeaves, leafIndices, proofs
operatorSetId, rootIndices, points, numLeaves, leafIndices, proofs
);
}
@ -556,12 +556,12 @@ contract ServiceManagerRewardsRegistryTest is AVSDeployer {
uint256 initialBalance = operatorAddress.balance;
uint256[] memory numberOfLeaves = new uint256[](0);
uint256[] memory numLeaves = new uint256[](0);
uint256[] memory leafIndices = new uint256[](0);
vm.prank(operatorAddress);
serviceManager.claimOperatorRewardsBatch(
operatorSetId, rootIndices, points, numberOfLeaves, leafIndices, proofs
operatorSetId, rootIndices, points, numLeaves, leafIndices, proofs
);
// Balance should remain unchanged

View file

@ -84,12 +84,13 @@ contract SlasherBaseTest is AVSDeployer {
});
// Mock the allocationManager.slashOperator call
uint256[] memory slashedShares = new uint256[](strategies.length);
vm.mockCall(
address(allocationManager),
abi.encodeWithSelector(
IAllocationManager.slashOperator.selector, serviceManager.avs(), params
),
abi.encode()
abi.encode(uint256(0), slashedShares)
);
uint256 requestId = 5;
@ -136,12 +137,13 @@ contract SlasherBaseTest is AVSDeployer {
});
// Mock the allocationManager.slashOperator call
uint256[] memory slashedShares = new uint256[](strategies.length);
vm.mockCall(
address(allocationManager),
abi.encodeWithSelector(
IAllocationManager.slashOperator.selector, serviceManager.avs(), params
),
abi.encode()
abi.encode(uint256(0), slashedShares)
);
uint256 requestId = 2;
@ -175,12 +177,13 @@ contract SlasherBaseTest is AVSDeployer {
});
// Mock the allocationManager.slashOperator call
uint256[] memory slashedShares = new uint256[](strategies.length);
vm.mockCall(
address(allocationManager),
abi.encodeWithSelector(
IAllocationManager.slashOperator.selector, serviceManager.avs(), params
),
abi.encode()
abi.encode(uint256(0), slashedShares)
);
uint256 requestId = 3;

View file

@ -230,12 +230,13 @@ contract VetoableSlasherTest is AVSDeployer {
IAllocationManagerTypes.SlashingParams memory params;
(params,,) = _getSlashingRequest(requestId);
uint256[] memory slashedShares = new uint256[](params.strategies.length);
vm.mockCall(
address(allocationManager),
abi.encodeWithSelector(
IAllocationManager.slashOperator.selector, serviceManager.avs(), params
),
abi.encode()
abi.encode(uint256(0), slashedShares)
);
// Fast forward past veto period
@ -324,12 +325,13 @@ contract VetoableSlasherTest is AVSDeployer {
vetoableSlasher.cancelSlashingRequest(requestId1);
// Setup the mock for slashing the second request
uint256[] memory slashedShares = new uint256[](params2.strategies.length);
vm.mockCall(
address(allocationManager),
abi.encodeWithSelector(
IAllocationManager.slashOperator.selector, serviceManager.avs(), params2
),
abi.encode()
abi.encode(uint256(0), slashedShares)
);
// Fast forward past veto period

View file

@ -1,190 +0,0 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import {
IAllocationManager,
OperatorSet
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol";
contract AllocationManagerIntermediate is IAllocationManager {
function initialize(
address initialOwner,
uint256 initialPausedStatus
) external virtual {}
function slashOperator(
address avs,
SlashingParams calldata params
) external virtual {}
function modifyAllocations(
address operator,
AllocateParams[] calldata params
) external virtual {}
function clearDeallocationQueue(
address operator,
IStrategy[] calldata strategies,
uint16[] calldata numToClear
) external virtual {}
function registerForOperatorSets(
address operator,
RegisterParams calldata params
) external virtual {}
function deregisterFromOperatorSets(
DeregisterParams calldata params
) external virtual {}
function setAllocationDelay(
address operator,
uint32 delay
) external virtual {}
function setAVSRegistrar(
address avs,
IAVSRegistrar registrar
) external virtual {}
function updateAVSMetadataURI(
address avs,
string calldata metadataURI
) external virtual {}
function createOperatorSets(
address avs,
CreateSetParams[] calldata params
) external virtual {}
function addStrategiesToOperatorSet(
address avs,
uint32 operatorSetId,
IStrategy[] calldata strategies
) external virtual {}
function removeStrategiesFromOperatorSet(
address avs,
uint32 operatorSetId,
IStrategy[] calldata strategies
) external virtual {}
function getOperatorSetCount(
address avs
) external view virtual returns (uint256) {}
function getAllocatedSets(
address operator
) external view virtual returns (OperatorSet[] memory) {}
function getAllocatedStrategies(
address operator,
OperatorSet memory operatorSet
) external view virtual returns (IStrategy[] memory) {}
function getAllocation(
address operator,
OperatorSet memory operatorSet,
IStrategy strategy
) external view virtual returns (Allocation memory) {}
function getAllocations(
address[] memory operators,
OperatorSet memory operatorSet,
IStrategy strategy
) external view virtual returns (Allocation[] memory) {}
function getStrategyAllocations(
address operator,
IStrategy strategy
) external view virtual returns (OperatorSet[] memory, Allocation[] memory) {}
function getAllocatableMagnitude(
address operator,
IStrategy strategy
) external view virtual returns (uint64) {}
function getMaxMagnitude(
address operator,
IStrategy strategy
) external view virtual returns (uint64) {}
function getMaxMagnitudes(
address operator,
IStrategy[] calldata strategies
) external view virtual returns (uint64[] memory) {}
function getMaxMagnitudes(
address[] calldata operators,
IStrategy strategy
) external view virtual returns (uint64[] memory) {}
function getMaxMagnitudesAtBlock(
address operator,
IStrategy[] calldata strategies,
uint32 blockNumber
) external view virtual returns (uint64[] memory) {}
function getAllocationDelay(
address operator
) external view virtual returns (bool isSet, uint32 delay) {}
function getRegisteredSets(
address operator
) external view virtual returns (OperatorSet[] memory operatorSets) {}
function isOperatorSet(
OperatorSet memory operatorSet
) external view virtual returns (bool) {}
function getMembers(
OperatorSet memory operatorSet
) external view virtual returns (address[] memory operators) {}
function getMemberCount(
OperatorSet memory operatorSet
) external view virtual returns (uint256) {}
function getAVSRegistrar(
address avs
) external view virtual returns (IAVSRegistrar) {}
function getStrategiesInOperatorSet(
OperatorSet memory operatorSet
) external view virtual returns (IStrategy[] memory strategies) {}
function getMinimumSlashableStake(
OperatorSet memory operatorSet,
address[] memory operators,
IStrategy[] memory strategies,
uint32 futureBlock
) external view virtual returns (uint256[][] memory slashableStake) {}
function isMemberOfOperatorSet(
address operator,
OperatorSet memory operatorSet
) external view virtual returns (bool) {}
function version() external view override returns (string memory) {}
function getEncumberedMagnitude(
address operator,
IStrategy strategy
) external view override returns (uint64) {}
function getAllocatedStake(
OperatorSet memory operatorSet,
address[] memory operators,
IStrategy[] memory strategies
) external view override returns (uint256[][] memory slashableStake) {}
function isOperatorSlashable(
address operator,
OperatorSet memory operatorSet
) external view override returns (bool) {}
}
contract AllocationManagerMock is AllocationManagerIntermediate {}

View file

@ -24,6 +24,7 @@ import {
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {EmptyContract} from "eigenlayer-contracts/src/test/mocks/EmptyContract.sol";
import {StrategyBase} from "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol";
import {EigenStrategy} from "eigenlayer-contracts/src/contracts/strategies/EigenStrategy.sol";
import {EigenPodManagerMock} from "eigenlayer-contracts/src/test/mocks/EigenPodManagerMock.sol";
import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol";
import {IEigenPodManager} from "eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol";
@ -36,7 +37,6 @@ import {DataHavenServiceManager} from "../../src/DataHavenServiceManager.sol";
// Mocks
import {RewardsCoordinatorMock} from "../mocks/RewardsCoordinatorMock.sol";
import {PermissionControllerMock} from "../mocks/PermissionControllerMock.sol";
import {AllocationManagerMock} from "../mocks/AllocationManagerMock.sol";
import {DelegationManager} from "eigenlayer-contracts/src/contracts/core/DelegationManager.sol";
import "forge-std/Test.sol";
@ -71,6 +71,7 @@ contract AVSDeployer is Test {
EigenPodManagerMock public eigenPodManagerMock;
AllocationManager public allocationManager;
AllocationManager public allocationManagerImplementation;
IStrategy public eigenStrategy;
RewardsCoordinator public rewardsCoordinator;
RewardsCoordinator public rewardsCoordinatorImplementation;
RewardsCoordinatorMock public rewardsCoordinatorMock;
@ -143,6 +144,12 @@ contract AVSDeployer is Test {
console.log("AllocationManager and StrategyManager proxy contracts deployed");
cheats.prank(regularDeployer);
eigenStrategy =
IStrategy(address(new EigenStrategy(strategyManager, pauserRegistry, "v-mock")));
console.log("EigenStrategy deployed");
// Deploying DelegationManager implementation and its proxy.
cheats.prank(regularDeployer);
delegationManagerImplementation = new DelegationManager(
@ -166,6 +173,7 @@ contract AVSDeployer is Test {
cheats.prank(regularDeployer);
allocationManagerImplementation = new AllocationManager(
delegationManager,
eigenStrategy,
pauserRegistry,
permissionControllerMock,
uint32(7 days), // DEALLOCATION_DELAY
@ -183,7 +191,7 @@ contract AVSDeployer is Test {
// Deploying StrategyManager implementation and its proxy.
cheats.prank(regularDeployer);
strategyManagerImplementation =
new StrategyManager(delegationManager, pauserRegistry, "v-mock");
new StrategyManager(allocationManager, delegationManager, pauserRegistry, "v-mock");
cheats.prank(proxyAdminOwner);
uint256 allUnpaused = 0;
proxyAdmin.upgradeAndCall(

File diff suppressed because it is too large Load diff