Skip to content

Commit 6c1eeb2

Browse files
authored
fix: update references from registry coordinator to new slashing registry coordinator (#384)
* update references from old registryCoordinator to new slashingRegistryCoordinator in SocketRegistry * update references from old registryCoordinator to new slashingRegistryCoordinator in EjectionManager * fix: forge fmt * fix: update IEjectionManager to use new SlashingRegistryCoordinator * fix: update error string in SocketRegistry unit test
1 parent f004f83 commit 6c1eeb2

6 files changed

+34
-31
lines changed

src/EjectionManager.sol

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/Ownabl
55
import {
66
EjectionManagerStorage,
77
IEjectionManager,
8-
IRegistryCoordinator,
8+
ISlashingRegistryCoordinator,
99
IStakeRegistry
1010
} from "./EjectionManagerStorage.sol";
1111

1212
// TODO: double check order of inheritance since we separated storage from logic...
1313

1414
/**
15-
* @title Used for automated ejection of operators from the RegistryCoordinator under a ratelimit
15+
* @title Used for automated ejection of operators from the SlashingRegistryCoordinator under a ratelimit
1616
* @author Layr Labs, Inc.
1717
*/
1818
contract EjectionManager is OwnableUpgradeable, EjectionManagerStorage {
1919
constructor(
20-
IRegistryCoordinator _registryCoordinator,
20+
ISlashingRegistryCoordinator _slashingRegistryCoordinator,
2121
IStakeRegistry _stakeRegistry
22-
) EjectionManagerStorage(_registryCoordinator, _stakeRegistry) {
22+
) EjectionManagerStorage(_slashingRegistryCoordinator, _stakeRegistry) {
2323
_disableInitializers();
2424
}
2525

@@ -67,8 +67,8 @@ contract EjectionManager is OwnableUpgradeable, EjectionManagerStorage {
6767
stakeForEjection += operatorStake;
6868
++ejectedOperators;
6969

70-
registryCoordinator.ejectOperator(
71-
registryCoordinator.getOperatorFromId(operatorIds[i][j]),
70+
slashingRegistryCoordinator.ejectOperator(
71+
slashingRegistryCoordinator.getOperatorFromId(operatorIds[i][j]),
7272
abi.encodePacked(quorumNumber)
7373
);
7474

@@ -80,8 +80,8 @@ contract EjectionManager is OwnableUpgradeable, EjectionManagerStorage {
8080
stakeForEjection += operatorStake;
8181
++ejectedOperators;
8282

83-
registryCoordinator.ejectOperator(
84-
registryCoordinator.getOperatorFromId(operatorIds[i][j]),
83+
slashingRegistryCoordinator.ejectOperator(
84+
slashingRegistryCoordinator.getOperatorFromId(operatorIds[i][j]),
8585
abi.encodePacked(quorumNumber)
8686
);
8787

src/EjectionManagerStorage.sol

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.27;
33

4-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
4+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
55
import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";
66
import {IEjectionManager} from "./interfaces/IEjectionManager.sol";
77

@@ -12,7 +12,7 @@ abstract contract EjectionManagerStorage is IEjectionManager {
1212
uint8 internal constant MAX_QUORUM_COUNT = 192;
1313

1414
/// @inheritdoc IEjectionManager
15-
IRegistryCoordinator public immutable registryCoordinator;
15+
ISlashingRegistryCoordinator public immutable slashingRegistryCoordinator;
1616
/// @inheritdoc IEjectionManager
1717
IStakeRegistry public immutable stakeRegistry;
1818

@@ -23,8 +23,11 @@ abstract contract EjectionManagerStorage is IEjectionManager {
2323
/// @inheritdoc IEjectionManager
2424
mapping(uint8 => QuorumEjectionParams) public quorumEjectionParams;
2525

26-
constructor(IRegistryCoordinator _registryCoordinator, IStakeRegistry _stakeRegistry) {
27-
registryCoordinator = _registryCoordinator;
26+
constructor(
27+
ISlashingRegistryCoordinator _slashingRegistryCoordinator,
28+
IStakeRegistry _stakeRegistry
29+
) {
30+
slashingRegistryCoordinator = _slashingRegistryCoordinator;
2831
stakeRegistry = _stakeRegistry;
2932
}
3033

src/SocketRegistry.sol

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: BUSL-1.1
22
pragma solidity ^0.8.12;
33

4-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
4+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
55
import {ISocketRegistry} from "./interfaces/ISocketRegistry.sol";
66
import {SocketRegistryStorage} from "./SocketRegistryStorage.sol";
77

@@ -11,32 +11,32 @@ import {SocketRegistryStorage} from "./SocketRegistryStorage.sol";
1111
*/
1212
contract SocketRegistry is ISocketRegistry, SocketRegistryStorage {
1313
/// @notice A modifier that only allows the RegistryCoordinator to call a function
14-
modifier onlyRegistryCoordinator() {
14+
modifier onlySlashingRegistryCoordinator() {
1515
require(
16-
msg.sender == address(registryCoordinator),
17-
"SocketRegistry.onlyRegistryCoordinator: caller is not the RegistryCoordinator"
16+
msg.sender == address(slashingRegistryCoordinator),
17+
"SocketRegistry.onlySlashingRegistryCoordinator: caller is not the SlashingRegistryCoordinator"
1818
);
1919
_;
2020
}
2121

22-
/// @notice A modifier that only allows the owner of the RegistryCoordinator to call a function
22+
/// @notice A modifier that only allows the owner of the SlashingRegistryCoordinator to call a function
2323
modifier onlyCoordinatorOwner() {
2424
require(
25-
msg.sender == IRegistryCoordinator(registryCoordinator).owner(),
26-
"SocketRegistry.onlyCoordinatorOwner: caller is not the owner of the registryCoordinator"
25+
msg.sender == ISlashingRegistryCoordinator(slashingRegistryCoordinator).owner(),
26+
"SocketRegistry.onlyCoordinatorOwner: caller is not the owner of the slashingRegistryCoordinator"
2727
);
2828
_;
2929
}
3030

3131
constructor(
32-
IRegistryCoordinator _registryCoordinator
33-
) SocketRegistryStorage(address(_registryCoordinator)) {}
32+
ISlashingRegistryCoordinator _slashingRegistryCoordinator
33+
) SocketRegistryStorage(address(_slashingRegistryCoordinator)) {}
3434

3535
/// @notice sets the socket for an operator only callable by the RegistryCoordinator
3636
function setOperatorSocket(
3737
bytes32 _operatorId,
3838
string memory _socket
39-
) external onlyRegistryCoordinator {
39+
) external onlySlashingRegistryCoordinator {
4040
operatorIdToSocket[_operatorId] = _socket;
4141
}
4242

src/SocketRegistryStorage.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ pragma solidity ^0.8.12;
77
*/
88
contract SocketRegistryStorage {
99
/// @notice The address of the RegistryCoordinator
10-
address public immutable registryCoordinator;
10+
address public immutable slashingRegistryCoordinator;
1111

1212
/// @notice A mapping from operator IDs to their sockets
1313
mapping(bytes32 => string) public operatorIdToSocket;
1414

1515
constructor(
16-
address _registryCoordinator
16+
address _slashingRegistryCoordinator
1717
) {
18-
registryCoordinator = _registryCoordinator;
18+
slashingRegistryCoordinator = _slashingRegistryCoordinator;
1919
}
2020

2121
uint256[48] private __GAP;

src/interfaces/IEjectionManager.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.27;
33

4-
import {IRegistryCoordinator} from "./IRegistryCoordinator.sol";
4+
import {ISlashingRegistryCoordinator} from "./ISlashingRegistryCoordinator.sol";
55
import {IStakeRegistry} from "./IStakeRegistry.sol";
66

77
interface IEjectionManagerErrors {
@@ -66,11 +66,11 @@ interface IEjectionManager is IEjectionManagerErrors, IEjectionManagerEvents {
6666
/* STATE */
6767

6868
/*
69-
* @notice Returns the address of the registry coordinator contract.
70-
* @return The address of the registry coordinator.
69+
* @notice Returns the address of the slashing registry coordinator contract.
70+
* @return The address of the slashing registry coordinator.
7171
* @dev This value is immutable and set during contract construction.
7272
*/
73-
function registryCoordinator() external view returns (IRegistryCoordinator);
73+
function slashingRegistryCoordinator() external view returns (ISlashingRegistryCoordinator);
7474

7575
/*
7676
* @notice Returns the address of the stake registry contract.

test/unit/SocketRegistryUnit.t.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ contract SocketRegistryUnitTests is MockAVSDeployer {
1717
assertEq(socketRegistry.getOperatorSocket(defaultOperatorId), "testSocket");
1818
}
1919

20-
function test_setOperatorSocket_revert_notRegistryCoordinator() public {
20+
function test_setOperatorSocket_revert_notSlashingRegistryCoordinator() public {
2121
vm.startPrank(address(0));
2222
vm.expectRevert(
23-
"SocketRegistry.onlyRegistryCoordinator: caller is not the RegistryCoordinator"
23+
"SocketRegistry.onlySlashingRegistryCoordinator: caller is not the SlashingRegistryCoordinator"
2424
);
2525
socketRegistry.setOperatorSocket(defaultOperatorId, "testSocket");
2626
}

0 commit comments

Comments
 (0)