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
1 change: 1 addition & 0 deletions script/tasks/register_operator_to_operatorSet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "forge-std/Test.sol";
contract AVSRegistrar is IAVSRegistrar {
function registerOperator(address operator, uint32[] calldata operatorSetIds, bytes calldata data) external {}
function deregisterOperator(address operator, uint32[] calldata operatorSetIds) external {}
function avs() external view returns (address) {}
fallback () external {}
}

Expand Down
3 changes: 3 additions & 0 deletions src/contracts/core/AllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ contract AllocationManager is

/// @inheritdoc IAllocationManager
function setAVSRegistrar(address avs, IAVSRegistrar registrar) external checkCanCall(avs) {
// Check that the registrar is correctly configured to prevent an AVSRegistrar contract
// from being used with the wrong AVS
require(registrar.avs() == avs, InvalidAVSRegistrar());
_avsRegistrar[avs] = registrar;
emit AVSRegistrarSet(avs, getAVSRegistrar(avs));
}
Expand Down
7 changes: 7 additions & 0 deletions src/contracts/interfaces/IAVSRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ interface IAVSRegistrar {
* @param operatorSetIds the list of operator set ids being deregistered from
*/
function deregisterOperator(address operator, uint32[] calldata operatorSetIds) external;

/**
* @notice Returns the account identifier address of the AVS. This should be the
* the same address as the AVS's UAM account identifier address.
* @return address of the AVS
*/
function avs() external view returns (address);
}
3 changes: 3 additions & 0 deletions src/contracts/interfaces/IAllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ interface IAllocationManagerErrors {
error InvalidWadToSlash();
/// @dev Thrown when two array parameters have mismatching lengths.
error InputArrayLengthMismatch();
/// @dev Thrown when the AVSRegistrar is not correctly configured to prevent an AVSRegistrar contract
/// from being used with the wrong AVS
error InvalidAVSRegistrar();

/// Caller

Expand Down
4 changes: 4 additions & 0 deletions src/test/integration/users/AVS.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ contract AVS is Logger, IAllocationManagerTypes, IAVSRegistrar {
return _NAME;
}

function avs() external view override returns (address) {
return address(this);
}

/// -----------------------------------------------------------------------
/// AllocationManager
/// -----------------------------------------------------------------------
Expand Down
Loading