Skip to content

Commit 05abac6

Browse files
committed
refactor: slashing registry coordinator
refactor: registry coordinator refactor: remove sm calls fix: tests wip
1 parent 92b5347 commit 05abac6

38 files changed

+4065
-1463
lines changed

src/BLSApkRegistry.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.27;
33

44
import {BLSApkRegistryStorage} from "./BLSApkRegistryStorage.sol";
55

6-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
6+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
77

88
import {BN254} from "./libraries/BN254.sol";
99

@@ -18,8 +18,8 @@ contract BLSApkRegistry is BLSApkRegistryStorage {
1818

1919
/// @notice Sets the (immutable) `registryCoordinator` address
2020
constructor(
21-
IRegistryCoordinator _registryCoordinator
22-
) BLSApkRegistryStorage(_registryCoordinator) {}
21+
ISlashingRegistryCoordinator _slashingRegistryCoordinator
22+
) BLSApkRegistryStorage(_slashingRegistryCoordinator) {}
2323

2424
/*******************************************************************************
2525
EXTERNAL FUNCTIONS - REGISTRY COORDINATOR

src/BLSApkRegistryStorage.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.27;
33

44
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
5-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
5+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
66

77
import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
88

@@ -29,8 +29,8 @@ abstract contract BLSApkRegistryStorage is Initializable, IBLSApkRegistry {
2929
/// @notice maps quorumNumber => current aggregate pubkey of quorum
3030
mapping(uint8 => BN254.G1Point) public currentApk;
3131

32-
constructor(IRegistryCoordinator _registryCoordinator) {
33-
registryCoordinator = address(_registryCoordinator);
32+
constructor(ISlashingRegistryCoordinator _slashingRegistryCoordinator) {
33+
registryCoordinator = address(_slashingRegistryCoordinator);
3434
// disable initializers so that the implementation contract cannot be initialized
3535
_disableInitializers();
3636
}

src/BLSSignatureChecker.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.27;
33

44
import {IBLSSignatureChecker} from "./interfaces/IBLSSignatureChecker.sol";
5-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
5+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
66
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
77
import {IStakeRegistry, IDelegationManager} from "./interfaces/IStakeRegistry.sol";
88

@@ -23,7 +23,7 @@ contract BLSSignatureChecker is IBLSSignatureChecker {
2323
// gas cost of multiplying 2 pairings
2424
uint256 internal constant PAIRING_EQUALITY_CHECK_GAS = 120_000;
2525

26-
IRegistryCoordinator public immutable registryCoordinator;
26+
ISlashingRegistryCoordinator public immutable registryCoordinator;
2727
IStakeRegistry public immutable stakeRegistry;
2828
IBLSApkRegistry public immutable blsApkRegistry;
2929
IDelegationManager public immutable delegation;
@@ -35,7 +35,7 @@ contract BLSSignatureChecker is IBLSSignatureChecker {
3535
_;
3636
}
3737

38-
constructor(IRegistryCoordinator _registryCoordinator) {
38+
constructor(ISlashingRegistryCoordinator _registryCoordinator) {
3939
registryCoordinator = _registryCoordinator;
4040
stakeRegistry = _registryCoordinator.stakeRegistry();
4141
blsApkRegistry = _registryCoordinator.blsApkRegistry();

src/EjectionManager.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.27;
33

44
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
55
import {IEjectionManager} from "./interfaces/IEjectionManager.sol";
6-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
6+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
77
import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";
88

99
/**
@@ -19,7 +19,7 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable {
1919
uint8 internal constant MAX_QUORUM_COUNT = 192;
2020

2121
/// @notice the RegistryCoordinator contract that is the entry point for ejection
22-
IRegistryCoordinator public immutable registryCoordinator;
22+
ISlashingRegistryCoordinator public immutable registryCoordinator;
2323
/// @notice the StakeRegistry contract that keeps track of quorum stake
2424
IStakeRegistry public immutable stakeRegistry;
2525

@@ -32,7 +32,7 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable {
3232
mapping(uint8 => QuorumEjectionParams) public quorumEjectionParams;
3333

3434
constructor(
35-
IRegistryCoordinator _registryCoordinator,
35+
ISlashingRegistryCoordinator _registryCoordinator,
3636
IStakeRegistry _stakeRegistry
3737
) {
3838
registryCoordinator = _registryCoordinator;

src/IndexRegistry.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.27;
33

44
import {IndexRegistryStorage} from "./IndexRegistryStorage.sol";
5-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
5+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
66

77
/**
88
* @title A `Registry` that keeps track of an ordered list of operators for each quorum
@@ -18,8 +18,8 @@ contract IndexRegistry is IndexRegistryStorage {
1818

1919
/// @notice sets the (immutable) `registryCoordinator` address
2020
constructor(
21-
IRegistryCoordinator _registryCoordinator
22-
) IndexRegistryStorage(_registryCoordinator) {}
21+
ISlashingRegistryCoordinator _slashingRegistryCoordinator
22+
) IndexRegistryStorage(_slashingRegistryCoordinator) {}
2323

2424
/*******************************************************************************
2525
EXTERNAL FUNCTIONS - REGISTRY COORDINATOR

src/IndexRegistryStorage.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.27;
33

44
import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
55

6-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
6+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
77
import {IIndexRegistry} from "./interfaces/IIndexRegistry.sol";
88

99
/**
@@ -31,9 +31,9 @@ abstract contract IndexRegistryStorage is Initializable, IIndexRegistry {
3131
mapping(uint8 => QuorumUpdate[]) internal _operatorCountHistory;
3232

3333
constructor(
34-
IRegistryCoordinator _registryCoordinator
34+
ISlashingRegistryCoordinator _slashingRegistryCoordinator
3535
){
36-
registryCoordinator = address(_registryCoordinator);
36+
registryCoordinator = address(_slashingRegistryCoordinator);
3737
// disable initializers so that the implementation contract cannot be initialized
3838
_disableInitializers();
3939
}

src/OperatorStateRetriever.sol

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

4-
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
4+
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
55
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
66
import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";
77
import {IIndexRegistry} from "./interfaces/IIndexRegistry.sol";
@@ -40,7 +40,7 @@ contract OperatorStateRetriever {
4040
* was a part of at `blockNumber`, an ordered list of operators.
4141
*/
4242
function getOperatorState(
43-
IRegistryCoordinator registryCoordinator,
43+
ISlashingRegistryCoordinator registryCoordinator,
4444
bytes32 operatorId,
4545
uint32 blockNumber
4646
) external view returns (uint256, Operator[][] memory) {
@@ -64,7 +64,7 @@ contract OperatorStateRetriever {
6464
* @return 2d array of Operators. For each quorum, an ordered list of Operators
6565
*/
6666
function getOperatorState(
67-
IRegistryCoordinator registryCoordinator,
67+
ISlashingRegistryCoordinator registryCoordinator,
6868
bytes memory quorumNumbers,
6969
uint32 blockNumber
7070
) public view returns(Operator[][] memory) {
@@ -104,7 +104,7 @@ contract OperatorStateRetriever {
104104
* 4) the indices of the quorum apks for each of the provided quorums at the given blocknumber
105105
*/
106106
function getCheckSignaturesIndices(
107-
IRegistryCoordinator registryCoordinator,
107+
ISlashingRegistryCoordinator registryCoordinator,
108108
uint32 referenceBlockNumber,
109109
bytes calldata quorumNumbers,
110110
bytes32[] calldata nonSignerOperatorIds
@@ -169,7 +169,7 @@ contract OperatorStateRetriever {
169169
* @param blockNumber is the block number to get the quorumBitmaps for
170170
*/
171171
function getQuorumBitmapsAtBlockNumber(
172-
IRegistryCoordinator registryCoordinator,
172+
ISlashingRegistryCoordinator registryCoordinator,
173173
bytes32[] memory operatorIds,
174174
uint32 blockNumber
175175
) external view returns (uint256[] memory) {
@@ -188,7 +188,7 @@ contract OperatorStateRetriever {
188188
* @dev if an operator is not registered, the operatorId will be 0
189189
*/
190190
function getBatchOperatorId(
191-
IRegistryCoordinator registryCoordinator,
191+
ISlashingRegistryCoordinator registryCoordinator,
192192
address[] memory operators
193193
) external view returns (bytes32[] memory operatorIds) {
194194
operatorIds = new bytes32[](operators.length);
@@ -204,7 +204,7 @@ contract OperatorStateRetriever {
204204
* @dev if an operator is not registered, the operator address will be 0
205205
*/
206206
function getBatchOperatorFromId(
207-
IRegistryCoordinator registryCoordinator,
207+
ISlashingRegistryCoordinator registryCoordinator,
208208
bytes32[] memory operatorIds
209209
) external view returns (address[] memory operators) {
210210
operators = new address[](operatorIds.length);

0 commit comments

Comments
 (0)