Skip to content

Commit

Permalink
refactor: registry coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
8sunyuan committed Jan 21, 2025
1 parent 92b5347 commit 6169d4c
Show file tree
Hide file tree
Showing 14 changed files with 1,357 additions and 1,273 deletions.
6 changes: 3 additions & 3 deletions src/BLSSignatureChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.27;

import {IBLSSignatureChecker} from "./interfaces/IBLSSignatureChecker.sol";
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
import {IStakeRegistry, IDelegationManager} from "./interfaces/IStakeRegistry.sol";

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

IRegistryCoordinator public immutable registryCoordinator;
ISlashingRegistryCoordinator public immutable registryCoordinator;
IStakeRegistry public immutable stakeRegistry;
IBLSApkRegistry public immutable blsApkRegistry;
IDelegationManager public immutable delegation;
Expand All @@ -35,7 +35,7 @@ contract BLSSignatureChecker is IBLSSignatureChecker {
_;
}

constructor(IRegistryCoordinator _registryCoordinator) {
constructor(ISlashingRegistryCoordinator _registryCoordinator) {
registryCoordinator = _registryCoordinator;
stakeRegistry = _registryCoordinator.stakeRegistry();
blsApkRegistry = _registryCoordinator.blsApkRegistry();
Expand Down
6 changes: 3 additions & 3 deletions src/EjectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.27;

import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import {IEjectionManager} from "./interfaces/IEjectionManager.sol";
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";

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

/// @notice the RegistryCoordinator contract that is the entry point for ejection
IRegistryCoordinator public immutable registryCoordinator;
ISlashingRegistryCoordinator public immutable registryCoordinator;
/// @notice the StakeRegistry contract that keeps track of quorum stake
IStakeRegistry public immutable stakeRegistry;

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

constructor(
IRegistryCoordinator _registryCoordinator,
ISlashingRegistryCoordinator _registryCoordinator,
IStakeRegistry _stakeRegistry
) {
registryCoordinator = _registryCoordinator;
Expand Down
14 changes: 7 additions & 7 deletions src/OperatorStateRetriever.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";
import {IIndexRegistry} from "./interfaces/IIndexRegistry.sol";
Expand Down Expand Up @@ -40,7 +40,7 @@ contract OperatorStateRetriever {
* was a part of at `blockNumber`, an ordered list of operators.
*/
function getOperatorState(
IRegistryCoordinator registryCoordinator,
ISlashingRegistryCoordinator registryCoordinator,
bytes32 operatorId,
uint32 blockNumber
) external view returns (uint256, Operator[][] memory) {
Expand All @@ -64,7 +64,7 @@ contract OperatorStateRetriever {
* @return 2d array of Operators. For each quorum, an ordered list of Operators
*/
function getOperatorState(
IRegistryCoordinator registryCoordinator,
ISlashingRegistryCoordinator registryCoordinator,
bytes memory quorumNumbers,
uint32 blockNumber
) public view returns(Operator[][] memory) {
Expand Down Expand Up @@ -104,7 +104,7 @@ contract OperatorStateRetriever {
* 4) the indices of the quorum apks for each of the provided quorums at the given blocknumber
*/
function getCheckSignaturesIndices(
IRegistryCoordinator registryCoordinator,
ISlashingRegistryCoordinator registryCoordinator,
uint32 referenceBlockNumber,
bytes calldata quorumNumbers,
bytes32[] calldata nonSignerOperatorIds
Expand Down Expand Up @@ -169,7 +169,7 @@ contract OperatorStateRetriever {
* @param blockNumber is the block number to get the quorumBitmaps for
*/
function getQuorumBitmapsAtBlockNumber(
IRegistryCoordinator registryCoordinator,
ISlashingRegistryCoordinator registryCoordinator,
bytes32[] memory operatorIds,
uint32 blockNumber
) external view returns (uint256[] memory) {
Expand All @@ -188,7 +188,7 @@ contract OperatorStateRetriever {
* @dev if an operator is not registered, the operatorId will be 0
*/
function getBatchOperatorId(
IRegistryCoordinator registryCoordinator,
ISlashingRegistryCoordinator registryCoordinator,
address[] memory operators
) external view returns (bytes32[] memory operatorIds) {
operatorIds = new bytes32[](operators.length);
Expand All @@ -204,7 +204,7 @@ contract OperatorStateRetriever {
* @dev if an operator is not registered, the operator address will be 0
*/
function getBatchOperatorFromId(
IRegistryCoordinator registryCoordinator,
ISlashingRegistryCoordinator registryCoordinator,
bytes32[] memory operatorIds
) external view returns (address[] memory operators) {
operators = new address[](operatorIds.length);
Expand Down
Loading

0 comments on commit 6169d4c

Please sign in to comment.