Skip to content

Commit 47b560d

Browse files
committed
refactor: slashing registry coordinator
refactor: registry coordinator refactor: remove sm calls fix: tests wip
1 parent 7e8aeff commit 47b560d

38 files changed

+4290
-2033
lines changed

src/BLSApkRegistry.sol

Lines changed: 3 additions & 3 deletions
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
*

src/BLSApkRegistryStorage.sol

Lines changed: 3 additions & 5 deletions
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

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

33-
constructor(
34-
IRegistryCoordinator _registryCoordinator
35-
) {
36-
registryCoordinator = address(_registryCoordinator);
33+
constructor(ISlashingRegistryCoordinator _slashingRegistryCoordinator) {
34+
registryCoordinator = address(_slashingRegistryCoordinator);
3735
// disable initializers so that the implementation contract cannot be initialized
3836
_disableInitializers();
3937
}

src/BLSSignatureChecker.sol

Lines changed: 3 additions & 5 deletions
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,9 +35,7 @@ contract BLSSignatureChecker is IBLSSignatureChecker {
3535
_;
3636
}
3737

38-
constructor(
39-
IRegistryCoordinator _registryCoordinator
40-
) {
38+
constructor(ISlashingRegistryCoordinator _registryCoordinator) {
4139
registryCoordinator = _registryCoordinator;
4240
stakeRegistry = _registryCoordinator.stakeRegistry();
4341
blsApkRegistry = _registryCoordinator.blsApkRegistry();

src/EjectionManager.sol

Lines changed: 6 additions & 3 deletions
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
/**
@@ -18,7 +18,7 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable {
1818
uint8 internal constant MAX_QUORUM_COUNT = 192;
1919

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

@@ -30,7 +30,10 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable {
3030
/// @notice Ratelimit parameters for each quorum
3131
mapping(uint8 => QuorumEjectionParams) public quorumEjectionParams;
3232

33-
constructor(IRegistryCoordinator _registryCoordinator, IStakeRegistry _stakeRegistry) {
33+
constructor(
34+
ISlashingRegistryCoordinator _registryCoordinator,
35+
IStakeRegistry _stakeRegistry
36+
) {
3437
registryCoordinator = _registryCoordinator;
3538
stakeRegistry = _stakeRegistry;
3639

src/IndexRegistry.sol

Lines changed: 3 additions & 3 deletions
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
@@ -17,8 +17,8 @@ contract IndexRegistry is IndexRegistryStorage {
1717

1818
/// @notice sets the (immutable) `registryCoordinator` address
1919
constructor(
20-
IRegistryCoordinator _registryCoordinator
21-
) IndexRegistryStorage(_registryCoordinator) {}
20+
ISlashingRegistryCoordinator _slashingRegistryCoordinator
21+
) IndexRegistryStorage(_slashingRegistryCoordinator) {}
2222

2323
/**
2424
*

src/IndexRegistryStorage.sol

Lines changed: 4 additions & 4 deletions
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
/**
@@ -30,9 +30,9 @@ abstract contract IndexRegistryStorage is Initializable, IIndexRegistry {
3030
mapping(uint8 => QuorumUpdate[]) internal _operatorCountHistory;
3131

3232
constructor(
33-
IRegistryCoordinator _registryCoordinator
34-
) {
35-
registryCoordinator = address(_registryCoordinator);
33+
ISlashingRegistryCoordinator _slashingRegistryCoordinator
34+
){
35+
registryCoordinator = address(_slashingRegistryCoordinator);
3636
// disable initializers so that the implementation contract cannot be initialized
3737
_disableInitializers();
3838
}

src/OperatorStateRetriever.sol

Lines changed: 7 additions & 7 deletions
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) {
@@ -66,7 +66,7 @@ contract OperatorStateRetriever {
6666
* @return 2d array of Operators. For each quorum, an ordered list of Operators
6767
*/
6868
function getOperatorState(
69-
IRegistryCoordinator registryCoordinator,
69+
ISlashingRegistryCoordinator registryCoordinator,
7070
bytes memory quorumNumbers,
7171
uint32 blockNumber
7272
) public view returns (Operator[][] memory) {
@@ -109,7 +109,7 @@ contract OperatorStateRetriever {
109109
* 4) the indices of the quorum apks for each of the provided quorums at the given blocknumber
110110
*/
111111
function getCheckSignaturesIndices(
112-
IRegistryCoordinator registryCoordinator,
112+
ISlashingRegistryCoordinator registryCoordinator,
113113
uint32 referenceBlockNumber,
114114
bytes calldata quorumNumbers,
115115
bytes32[] calldata nonSignerOperatorIds
@@ -185,7 +185,7 @@ contract OperatorStateRetriever {
185185
* @param blockNumber is the block number to get the quorumBitmaps for
186186
*/
187187
function getQuorumBitmapsAtBlockNumber(
188-
IRegistryCoordinator registryCoordinator,
188+
ISlashingRegistryCoordinator registryCoordinator,
189189
bytes32[] memory operatorIds,
190190
uint32 blockNumber
191191
) external view returns (uint256[] memory) {
@@ -207,7 +207,7 @@ contract OperatorStateRetriever {
207207
* @dev if an operator is not registered, the operatorId will be 0
208208
*/
209209
function getBatchOperatorId(
210-
IRegistryCoordinator registryCoordinator,
210+
ISlashingRegistryCoordinator registryCoordinator,
211211
address[] memory operators
212212
) external view returns (bytes32[] memory operatorIds) {
213213
operatorIds = new bytes32[](operators.length);
@@ -223,7 +223,7 @@ contract OperatorStateRetriever {
223223
* @dev if an operator is not registered, the operator address will be 0
224224
*/
225225
function getBatchOperatorFromId(
226-
IRegistryCoordinator registryCoordinator,
226+
ISlashingRegistryCoordinator registryCoordinator,
227227
bytes32[] memory operatorIds
228228
) external view returns (address[] memory operators) {
229229
operators = new address[](operatorIds.length);

0 commit comments

Comments
 (0)