File tree Expand file tree Collapse file tree 8 files changed +48
-38
lines changed
Expand file tree Collapse file tree 8 files changed +48
-38
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/Ownabl
1818import {RegistryCoordinatorStorage} from "./RegistryCoordinatorStorage.sol " ;
1919
2020/**
21- * @title A `RegistryCoordinator` that has three registries:
21+ * @title A `RegistryCoordinator` that has four registries:
2222 * 1) a `StakeRegistry` that keeps track of operators' stakes
2323 * 2) a `BLSApkRegistry` that keeps track of operators' BLS public keys and aggregate BLS public keys for each quorum
2424 * 3) an `IndexRegistry` that keeps track of an ordered list of operators for each quorum
25+ * 4) a `SocketRegistry` that keeps track of operators' sockets (arbitrary strings)
2526 *
2627 * @author Layr Labs, Inc.
2728 */
Original file line number Diff line number Diff line change @@ -29,10 +29,11 @@ import {Pausable} from "eigenlayer-contracts/src/contracts/permissions/Pausable.
2929import {SlashingRegistryCoordinatorStorage} from "./SlashingRegistryCoordinatorStorage.sol " ;
3030
3131/**
32- * @title A `RegistryCoordinator` that has three registries:
32+ * @title A `RegistryCoordinator` that has four registries:
3333 * 1) a `StakeRegistry` that keeps track of operators' stakes
3434 * 2) a `BLSApkRegistry` that keeps track of operators' BLS public keys and aggregate BLS public keys for each quorum
3535 * 3) an `IndexRegistry` that keeps track of an ordered list of operators for each quorum
36+ * 4) a `SocketRegistry` that keeps track of operators' sockets (arbitrary strings)
3637 *
3738 * @author Layr Labs, Inc.
3839 */
@@ -104,10 +105,12 @@ contract SlashingRegistryCoordinator is
104105 _setPausedStatus (_initialPausedStatus);
105106 _setEjector (_ejector);
106107 _setAccountIdentifier (_accountIdentifier);
108+
107109 // Add registry contracts to the registries array
108110 registries.push (address (stakeRegistry));
109111 registries.push (address (blsApkRegistry));
110112 registries.push (address (indexRegistry));
113+ registries.push (address (socketRegistry));
111114 }
112115
113116 /// @inheritdoc ISlashingRegistryCoordinator
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ abstract contract SlashingRegistryCoordinatorStorage is ISlashingRegistryCoordin
4141 /// @notice The maximum number of quorums this contract supports
4242 uint8 internal constant MAX_QUORUM_COUNT = 192 ;
4343
44- /// @notice
44+ /// @notice the Socket Registry contract that will keep track of operators' sockets (arbitrary strings)
4545 ISocketRegistry public immutable socketRegistry;
4646 /// @notice the BLS Aggregate Pubkey Registry contract that will keep track of operators' aggregate BLS public keys per quorum
4747 IBLSApkRegistry public immutable blsApkRegistry;
Original file line number Diff line number Diff line change @@ -7,30 +7,21 @@ import {SocketRegistryStorage} from "./SocketRegistryStorage.sol";
77import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol " ;
88
99/**
10- * @title A `Registry` that keeps track of operator sockets.
10+ * @title A `Registry` that keeps track of operator sockets (arbitrary strings) .
1111 * @author Layr Labs, Inc.
1212 */
13- contract SocketRegistry is ISocketRegistry , SocketRegistryStorage {
14- /// @notice A modifier that only allows the RegistryCoordinator to call a function
13+ contract SocketRegistry is SocketRegistryStorage {
14+ /// @notice A modifier that only allows the SlashingRegistryCoordinator to call a function
1515 modifier onlySlashingRegistryCoordinator () {
1616 require (msg .sender == slashingRegistryCoordinator, OnlySlashingRegistryCoordinator ());
1717 _;
1818 }
1919
20- /// @notice A modifier that only allows the owner of the SlashingRegistryCoordinator to call a function
21- modifier onlyCoordinatorOwner () {
22- require (
23- msg .sender == Ownable (slashingRegistryCoordinator).owner (),
24- OnlySlashingRegistryCoordinatorOwner ()
25- );
26- _;
27- }
28-
2920 constructor (
3021 ISlashingRegistryCoordinator _slashingRegistryCoordinator
3122 ) SocketRegistryStorage (address (_slashingRegistryCoordinator)) {}
3223
33- /// @notice sets the socket for an operator only callable by the RegistryCoordinator
24+ /// @notice sets the socket for an operator only callable by the SlashingRegistryCoordinator
3425 function setOperatorSocket (
3526 bytes32 _operatorId ,
3627 string memory _socket
Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: BUSL-1.1
22pragma solidity ^ 0.8.12 ;
33
4+ import {ISocketRegistry} from "./interfaces/ISocketRegistry.sol " ;
5+
46/**
5- * @title Storage contract for SocketRegistry
7+ * @title Storage variables for the ` SocketRegistry` contract.
68 * @author Layr Labs, Inc.
79 */
8- contract SocketRegistryStorage {
9- /// @notice The address of the RegistryCoordinator
10+ abstract contract SocketRegistryStorage is ISocketRegistry {
11+ /**
12+ *
13+ * CONSTANTS AND IMMUTABLES
14+ *
15+ */
16+
17+ /// @notice The address of the SlashingRegistryCoordinator
1018 address public immutable slashingRegistryCoordinator;
19+
20+ /**
21+ *
22+ * STATE
23+ *
24+ */
1125
1226 /// @notice A mapping from operator IDs to their sockets
1327 mapping (bytes32 => string ) public operatorIdToSocket;
@@ -18,5 +32,5 @@ contract SocketRegistryStorage {
1832 slashingRegistryCoordinator = _slashingRegistryCoordinator;
1933 }
2034
21- uint256 [48 ] private __GAP;
35+ uint256 [49 ] private __GAP;
2236}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {IAllocationManager} from
1010import {IBLSApkRegistry} from "./IBLSApkRegistry.sol " ;
1111import {IStakeRegistry, IStakeRegistryTypes} from "./IStakeRegistry.sol " ;
1212import {IIndexRegistry} from "./IIndexRegistry.sol " ;
13+ import {ISocketRegistry} from "./ISocketRegistry.sol " ;
1314import {BN254} from "../libraries/BN254.sol " ;
1415import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol " ;
1516
@@ -231,6 +232,12 @@ interface ISlashingRegistryCoordinator is
231232 * @dev This is only relevant for Slashing AVSs
232233 */
233234 function allocationManager () external view returns (IAllocationManager);
235+
236+ /**
237+ * @notice Reference to the SocketRegistry contract.
238+ * @return The SocketRegistry contract interface.
239+ */
240+ function socketRegistry () external view returns (ISocketRegistry);
234241
235242 /// STORAGE
236243
Original file line number Diff line number Diff line change 1- // SPDX-License-Identifier: MIT
1+ // SPDX-License-Identifier: BUSL-1.1
22pragma solidity ^ 0.8.0 ;
33
44interface ISocketRegistryErrors {
5- /// @notice Thrown when the caller is not the owner of the SlashingRegistryCoordinator
6- error OnlySlashingRegistryCoordinatorOwner ();
75 /// @notice Thrown when the caller is not the SlashingRegistryCoordinator
86 error OnlySlashingRegistryCoordinator ();
97}
108
119interface ISocketRegistry is ISocketRegistryErrors {
12- /// @notice sets the socket for an operator only callable by the RegistryCoordinator
10+ /**
11+ * @notice Sets the socket for an operator.
12+ * @param _operatorId The id of the operator to set the socket for.
13+ * @param _socket The socket (any arbitrary string as deemed useful by an AVS) to set.
14+ * @dev Only callable by the SlashingRegistryCoordinator.
15+ */
1316 function setOperatorSocket (bytes32 _operatorId , string memory _socket ) external ;
1417
15- /// @notice gets the stored socket for an operator
18+ /**
19+ * @notice Gets the stored socket for an operator.
20+ * @param _operatorId The id of the operator to query.
21+ * @return The stored socket associated with the operator.
22+ */
1623 function getOperatorSocket (
1724 bytes32 _operatorId
1825 ) external view returns (string memory );
Original file line number Diff line number Diff line change @@ -15,26 +15,13 @@ contract MockSocketRegistry is SocketRegistry {
1515 constructor (
1616 ISlashingRegistryCoordinator _slashingRegistryCoordinator
1717 ) SocketRegistry (_slashingRegistryCoordinator) {}
18-
19- function onlyCoordinatorOwnerFn () external view onlyCoordinatorOwner {}
2018}
2119
2220contract SocketRegistryUnitTests is MockAVSDeployer {
2321 function setUp () public virtual {
2422 _deployMockEigenLayerAndAVS ();
2523 }
2624
27- function testFuzz_revert_onlyCoordinatorOwner (
28- address caller
29- ) public {
30- MockSocketRegistry _socketRegistry = new MockSocketRegistry (registryCoordinator);
31-
32- vm.prank (caller);
33- vm.assume (caller != IOwnable (address (registryCoordinator)).owner ());
34- vm.expectRevert (ISocketRegistryErrors.OnlySlashingRegistryCoordinatorOwner.selector );
35- _socketRegistry.onlyCoordinatorOwnerFn ();
36- }
37-
3825 function test_setOperatorSocket () public {
3926 vm.startPrank (address (registryCoordinator));
4027 socketRegistry.setOperatorSocket (defaultOperatorId, "testSocket " );
You can’t perform that action at this time.
0 commit comments