Skip to content

Commit

Permalink
refactor: remove max strats list (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatil12 committed Jan 28, 2025
1 parent 8698614 commit fcf6e0b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 49 deletions.
7 changes: 0 additions & 7 deletions src/contracts/core/AllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,6 @@ contract AllocationManager is
/// @inheritdoc IAllocationManager
function createOperatorSets(address avs, CreateSetParams[] calldata params) external checkCanCall(avs) {
for (uint256 i = 0; i < params.length; i++) {
require(params[i].strategies.length <= MAX_OPERATOR_SET_STRATEGY_LIST_LENGTH, MaxStrategiesExceeded());

OperatorSet memory operatorSet = OperatorSet(avs, params[i].operatorSetId);

// Create the operator set, ensuring it does not already exist
Expand All @@ -356,11 +354,6 @@ contract AllocationManager is
OperatorSet memory operatorSet = OperatorSet(avs, operatorSetId);
bytes32 operatorSetKey = operatorSet.key();

require(
_operatorSetStrategies[operatorSetKey].length() + strategies.length <= MAX_OPERATOR_SET_STRATEGY_LIST_LENGTH,
MaxStrategiesExceeded()
);

require(_operatorSets[avs].contains(operatorSet.id), InvalidOperatorSet());

for (uint256 i = 0; i < strategies.length; i++) {
Expand Down
4 changes: 0 additions & 4 deletions src/contracts/core/AllocationManagerStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ abstract contract AllocationManagerStorage is IAllocationManager {
/// @dev Index for flag that pauses operator register/deregister to operator sets when set.
uint8 internal constant PAUSED_OPERATOR_SET_REGISTRATION_AND_DEREGISTRATION = 2;

/// @dev Returns the maximum number of strategies an operator set can support.
/// NOTE: 32 LST strategies + 1 beacon chain ETH strategy = 33 total strategies.
uint8 internal constant MAX_OPERATOR_SET_STRATEGY_LIST_LENGTH = 33;

// Immutables

/// @notice The DelegationManager contract for EigenLayer
Expand Down
2 changes: 0 additions & 2 deletions src/contracts/interfaces/IAllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ interface IAllocationManagerErrors {
error InvalidWadToSlash();
/// @dev Thrown when two array parameters have mismatching lengths.
error InputArrayLengthMismatch();
/// @dev Thrown when creating an operator set with more than max strategies.
error MaxStrategiesExceeded();

/// Caller

Expand Down
36 changes: 0 additions & 36 deletions src/test/unit/AllocationManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ contract AllocationManagerUnitTests is EigenLayerUnitTestSetup, IAllocationManag
uint256 internal constant FUZZ_MAX_STRATS = 8;
uint256 internal constant FUZZ_MAX_OP_SETS = 8;

uint8 internal constant MAX_OPERATOR_SET_STRATEGY_LIST_LENGTH = 33;
uint8 internal constant PAUSED_MODIFY_ALLOCATIONS = 0;
uint8 internal constant PAUSED_OPERATOR_SLASHING = 1;
uint8 internal constant PAUSED_OPERATOR_SET_REGISTRATION_AND_DEREGISTRATION = 2;
Expand Down Expand Up @@ -3481,29 +3480,6 @@ contract AllocationManagerUnitTests_addStrategiesToOperatorSet is AllocationMana
allocationManager.addStrategiesToOperatorSet(defaultAVS, defaultOperatorSet.id, defaultStrategies);
}

function test_addStrategiesToOperatorSet_MaxStrategiesExceeded() public {
cheats.startPrank(defaultAVS);
cheats.expectRevert(MaxStrategiesExceeded.selector);
allocationManager.addStrategiesToOperatorSet(
defaultAVS, defaultOperatorSet.id, new IStrategy[](MAX_OPERATOR_SET_STRATEGY_LIST_LENGTH + 1)
);

for (uint256 i; i < MAX_OPERATOR_SET_STRATEGY_LIST_LENGTH - 1; ++i) {
allocationManager.addStrategiesToOperatorSet(
defaultAVS,
defaultOperatorSet.id,
IStrategy(cheats.randomAddress()).toArray()
);
}

cheats.expectRevert(MaxStrategiesExceeded.selector);
allocationManager.addStrategiesToOperatorSet(
defaultAVS,
defaultOperatorSet.id,
IStrategy(cheats.randomAddress()).toArray()
);
}

function testFuzz_addStrategiesToOperatorSet_Correctness(
Randomness r
) public rand(r) {
Expand Down Expand Up @@ -3582,18 +3558,6 @@ contract AllocationManagerUnitTests_createOperatorSets is AllocationManagerUnitT
allocationManager.createOperatorSets(defaultAVS, CreateSetParams(defaultOperatorSet.id, defaultStrategies).toArray());
}

function testRevert_createOperatorSets_MaxStrategiesExceeded() public {
cheats.prank(defaultAVS);
cheats.expectRevert(MaxStrategiesExceeded.selector);
allocationManager.createOperatorSets(
defaultAVS,
CreateSetParams(
defaultOperatorSet.id,
new IStrategy[](MAX_OPERATOR_SET_STRATEGY_LIST_LENGTH + 1)
).toArray()
);
}

function testFuzz_createOperatorSets_Correctness(
Randomness r
) public rand(r) {
Expand Down

0 comments on commit fcf6e0b

Please sign in to comment.