Skip to content

Commit

Permalink
test: get alm tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Nov 1, 2024
1 parent 39f0f3a commit 6326e01
Show file tree
Hide file tree
Showing 6 changed files with 560 additions and 475 deletions.
9 changes: 8 additions & 1 deletion src/contracts/core/AllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ contract AllocationManager is
OperatorSet memory operatorSet = OperatorSet(msg.sender, params.operatorSetId);
bool isRegistered = _isRegistered(params.operator, operatorSet);
require(_operatorSets[operatorSet.avs].contains(operatorSet.id), InvalidOperatorSet());
require(isRegistered, InvalidOperator());
require(isRegistered, NotMemberOfSet());

uint256 length = _operatorSetStrategies[operatorSet.key()].length();
IStrategy[] memory strategiesSlashed = new IStrategy[](length);
Expand Down Expand Up @@ -691,6 +691,13 @@ contract AllocationManager is
return operatorSets;
}

/// @inheritdoc IAllocationManager
function isOperatorSet(
OperatorSet memory operatorSet
) external view returns (bool) {
return _operatorSets[operatorSet.avs].contains(operatorSet.id);
}

/// @inheritdoc IAllocationManager
function getMembers(
OperatorSet memory operatorSet
Expand Down
9 changes: 8 additions & 1 deletion src/contracts/interfaces/IAllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface IAllocationManagerErrors {
error OperatorNotSlashable();
/// @dev Thrown when trying to add an operator to a set they are already a member of
error AlreadyMemberOfSet();
/// @dev Thrown when trying to remove an operator from a set they are not a member of
/// @dev Thrown when trying to slash/remove an operator from a set they are not a member of
error NotMemberOfSet();

/// Operator Set Status
Expand Down Expand Up @@ -464,6 +464,13 @@ interface IAllocationManager is ISignatureUtils, IAllocationManagerErrors, IAllo
address operator
) external view returns (OperatorSet[] memory operatorSets);

/**
* @notice Returns whether the operator set exists
*/
function isOperatorSet(
OperatorSet memory operatorSet
) external view returns (bool);

/**
* @notice Returns all the operators registered to an operator set
* @param operatorSet The operatorSet to query.
Expand Down
2 changes: 1 addition & 1 deletion src/test/DevnetLifecycle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ contract Devnet_Lifecycle_Test is Test {

allocationManager.registerForOperatorSets(IAllocationManagerTypes.RegisterParams(avs, operatorSetIds, ""));

// assertEq(allocationManager.getMemberAtIndex(OperatorSet(avs, operatorSetId), 0), operator);
assertEq(allocationManager.getMembers(OperatorSet(avs, operatorSetId))[0], operator);
}

function _setMagnitude() public {
Expand Down
6 changes: 6 additions & 0 deletions src/test/mocks/MockAVSRegistrar.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

contract MockAVSRegistrar {
fallback () external {}
}
Loading

0 comments on commit 6326e01

Please sign in to comment.