Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions script/tasks/register_operator_to_operatorSet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import "forge-std/Test.sol";

// Define dummy AVSRegistrar contract to prevent revert
contract AVSRegistrar is IAVSRegistrar {
function registerOperator(address operator, uint32[] calldata operatorSetIds, bytes calldata data) external {}
function deregisterOperator(address operator, uint32[] calldata operatorSetIds) external {}
function registerOperator(address operator, address avs, uint32[] calldata operatorSetIds, bytes calldata data) external {}
function deregisterOperator(address operator, address avs, uint32[] calldata operatorSetIds) external {}
fallback () external {}
}

Expand Down
5 changes: 3 additions & 2 deletions src/contracts/core/AllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ contract AllocationManager is
}

// Call the AVS to complete registration. If the AVS reverts, registration will fail.
getAVSRegistrar(params.avs).registerOperator(operator, params.operatorSetIds, params.data);
getAVSRegistrar(params.avs).registerOperator(operator, params.avs, params.operatorSetIds, params.data);
}

/// @inheritdoc IAllocationManager
Expand Down Expand Up @@ -304,7 +304,8 @@ contract AllocationManager is

// Call the AVS to complete deregistration. Even if the AVS reverts, the operator is
// considered deregistered
try getAVSRegistrar(params.avs).deregisterOperator(params.operator, params.operatorSetIds) {} catch {}
try getAVSRegistrar(params.avs).deregisterOperator(params.operator, params.avs, params.operatorSetIds) {}
catch {}
}

/// @inheritdoc IAllocationManager
Expand Down
11 changes: 9 additions & 2 deletions src/contracts/interfaces/IAVSRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@ interface IAVSRegistrar {
* for one or more operator sets. This method should revert if registration
* is unsuccessful.
* @param operator the registering operator
* @param avs the address of the AVS this operator set belongs to
* @param operatorSetIds the list of operator set ids being registered for
* @param data arbitrary data the operator can provide as part of registration
*/
function registerOperator(address operator, uint32[] calldata operatorSetIds, bytes calldata data) external;
function registerOperator(
address operator,
address avs,
uint32[] calldata operatorSetIds,
bytes calldata data
) external;

/**
* @notice Called by the AllocationManager when an operator is deregistered from
* one or more operator sets. If this method reverts, it is ignored.
* @param operator the deregistering operator
* @param avs the address of the AVS this operator set belongs to
* @param operatorSetIds the list of operator set ids being deregistered from
*/
function deregisterOperator(address operator, uint32[] calldata operatorSetIds) external;
function deregisterOperator(address operator, address avs, uint32[] calldata operatorSetIds) external;
}
7 changes: 6 additions & 1 deletion src/test/integration/users/AVS.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,16 @@ contract AVS is Logger, IAllocationManagerTypes, IAVSRegistrar {

function registerOperator(
address operator,
address avs,
uint32[] calldata operatorSetIds,
bytes calldata data
) external override {}

function deregisterOperator(address operator, uint32[] calldata operatorSetIds) external override {}
function deregisterOperator(
address operator,
address avs,
uint32[] calldata operatorSetIds
) external override {}

/// -----------------------------------------------------------------------
/// Internal Helpers
Expand Down
4 changes: 2 additions & 2 deletions src/test/unit/AllocationManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3609,7 +3609,7 @@ contract AllocationManagerUnitTests_registerForOperatorSets is AllocationManager
}

cheats.expectCall(
defaultAVS, abi.encodeWithSelector(IAVSRegistrar.registerOperator.selector, operator, operatorSetIds, "")
defaultAVS, abi.encodeWithSelector(IAVSRegistrar.registerOperator.selector, operator, defaultAVS, operatorSetIds, "")
);

cheats.prank(operator);
Expand Down Expand Up @@ -3710,7 +3710,7 @@ contract AllocationManagerUnitTests_deregisterFromOperatorSets is AllocationMana
}

cheats.expectCall(
defaultAVS, abi.encodeWithSelector(IAVSRegistrar.deregisterOperator.selector, operator, operatorSetIds)
defaultAVS, abi.encodeWithSelector(IAVSRegistrar.deregisterOperator.selector, operator, defaultAVS, operatorSetIds)
);

bool callFromAVS = r.Boolean();
Expand Down
Loading