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
18
18
import {RegistryCoordinatorStorage} from "./RegistryCoordinatorStorage.sol " ;
19
19
20
20
/**
21
- * @title A `RegistryCoordinator` that has three registries:
21
+ * @title A `RegistryCoordinator` that has four registries:
22
22
* 1) a `StakeRegistry` that keeps track of operators' stakes
23
23
* 2) a `BLSApkRegistry` that keeps track of operators' BLS public keys and aggregate BLS public keys for each quorum
24
24
* 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)
25
26
*
26
27
* @author Layr Labs, Inc.
27
28
*/
Original file line number Diff line number Diff line change @@ -29,10 +29,11 @@ import {Pausable} from "eigenlayer-contracts/src/contracts/permissions/Pausable.
29
29
import {SlashingRegistryCoordinatorStorage} from "./SlashingRegistryCoordinatorStorage.sol " ;
30
30
31
31
/**
32
- * @title A `RegistryCoordinator` that has three registries:
32
+ * @title A `RegistryCoordinator` that has four registries:
33
33
* 1) a `StakeRegistry` that keeps track of operators' stakes
34
34
* 2) a `BLSApkRegistry` that keeps track of operators' BLS public keys and aggregate BLS public keys for each quorum
35
35
* 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)
36
37
*
37
38
* @author Layr Labs, Inc.
38
39
*/
@@ -104,10 +105,12 @@ contract SlashingRegistryCoordinator is
104
105
_setPausedStatus (_initialPausedStatus);
105
106
_setEjector (_ejector);
106
107
_setAccountIdentifier (_accountIdentifier);
108
+
107
109
// Add registry contracts to the registries array
108
110
registries.push (address (stakeRegistry));
109
111
registries.push (address (blsApkRegistry));
110
112
registries.push (address (indexRegistry));
113
+ registries.push (address (socketRegistry));
111
114
}
112
115
113
116
/// @inheritdoc ISlashingRegistryCoordinator
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ abstract contract SlashingRegistryCoordinatorStorage is ISlashingRegistryCoordin
41
41
/// @notice The maximum number of quorums this contract supports
42
42
uint8 internal constant MAX_QUORUM_COUNT = 192 ;
43
43
44
- /// @notice
44
+ /// @notice the Socket Registry contract that will keep track of operators' sockets (arbitrary strings)
45
45
ISocketRegistry public immutable socketRegistry;
46
46
/// @notice the BLS Aggregate Pubkey Registry contract that will keep track of operators' aggregate BLS public keys per quorum
47
47
IBLSApkRegistry public immutable blsApkRegistry;
Original file line number Diff line number Diff line change @@ -7,30 +7,21 @@ import {SocketRegistryStorage} from "./SocketRegistryStorage.sol";
7
7
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol " ;
8
8
9
9
/**
10
- * @title A `Registry` that keeps track of operator sockets.
10
+ * @title A `Registry` that keeps track of operator sockets (arbitrary strings) .
11
11
* @author Layr Labs, Inc.
12
12
*/
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
15
15
modifier onlySlashingRegistryCoordinator () {
16
16
require (msg .sender == slashingRegistryCoordinator, OnlySlashingRegistryCoordinator ());
17
17
_;
18
18
}
19
19
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
-
29
20
constructor (
30
21
ISlashingRegistryCoordinator _slashingRegistryCoordinator
31
22
) SocketRegistryStorage (address (_slashingRegistryCoordinator)) {}
32
23
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
34
25
function setOperatorSocket (
35
26
bytes32 _operatorId ,
36
27
string memory _socket
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: BUSL-1.1
2
2
pragma solidity ^ 0.8.12 ;
3
3
4
+ import {ISocketRegistry} from "./interfaces/ISocketRegistry.sol " ;
5
+
4
6
/**
5
- * @title Storage contract for SocketRegistry
7
+ * @title Storage variables for the ` SocketRegistry` contract.
6
8
* @author Layr Labs, Inc.
7
9
*/
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
10
18
address public immutable slashingRegistryCoordinator;
19
+
20
+ /**
21
+ *
22
+ * STATE
23
+ *
24
+ */
11
25
12
26
/// @notice A mapping from operator IDs to their sockets
13
27
mapping (bytes32 => string ) public operatorIdToSocket;
@@ -18,5 +32,5 @@ contract SocketRegistryStorage {
18
32
slashingRegistryCoordinator = _slashingRegistryCoordinator;
19
33
}
20
34
21
- uint256 [48 ] private __GAP;
35
+ uint256 [49 ] private __GAP;
22
36
}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {IAllocationManager} from
10
10
import {IBLSApkRegistry} from "./IBLSApkRegistry.sol " ;
11
11
import {IStakeRegistry, IStakeRegistryTypes} from "./IStakeRegistry.sol " ;
12
12
import {IIndexRegistry} from "./IIndexRegistry.sol " ;
13
+ import {ISocketRegistry} from "./ISocketRegistry.sol " ;
13
14
import {BN254} from "../libraries/BN254.sol " ;
14
15
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol " ;
15
16
@@ -231,6 +232,12 @@ interface ISlashingRegistryCoordinator is
231
232
* @dev This is only relevant for Slashing AVSs
232
233
*/
233
234
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);
234
241
235
242
/// STORAGE
236
243
Original file line number Diff line number Diff line change 1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: BUSL-1.1
2
2
pragma solidity ^ 0.8.0 ;
3
3
4
4
interface ISocketRegistryErrors {
5
- /// @notice Thrown when the caller is not the owner of the SlashingRegistryCoordinator
6
- error OnlySlashingRegistryCoordinatorOwner ();
7
5
/// @notice Thrown when the caller is not the SlashingRegistryCoordinator
8
6
error OnlySlashingRegistryCoordinator ();
9
7
}
10
8
11
9
interface 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
+ */
13
16
function setOperatorSocket (bytes32 _operatorId , string memory _socket ) external ;
14
17
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
+ */
16
23
function getOperatorSocket (
17
24
bytes32 _operatorId
18
25
) external view returns (string memory );
Original file line number Diff line number Diff line change @@ -15,26 +15,13 @@ contract MockSocketRegistry is SocketRegistry {
15
15
constructor (
16
16
ISlashingRegistryCoordinator _slashingRegistryCoordinator
17
17
) SocketRegistry (_slashingRegistryCoordinator) {}
18
-
19
- function onlyCoordinatorOwnerFn () external view onlyCoordinatorOwner {}
20
18
}
21
19
22
20
contract SocketRegistryUnitTests is MockAVSDeployer {
23
21
function setUp () public virtual {
24
22
_deployMockEigenLayerAndAVS ();
25
23
}
26
24
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
-
38
25
function test_setOperatorSocket () public {
39
26
vm.startPrank (address (registryCoordinator));
40
27
socketRegistry.setOperatorSocket (defaultOperatorId, "testSocket " );
You can’t perform that action at this time.
0 commit comments