Skip to content

Commit

Permalink
chore: forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
8sunyuan committed Jan 24, 2025
1 parent 66fe71a commit 7f89acc
Show file tree
Hide file tree
Showing 18 changed files with 307 additions and 198 deletions.
4 changes: 3 additions & 1 deletion src/BLSApkRegistryStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ abstract contract BLSApkRegistryStorage is Initializable, IBLSApkRegistry {
/// @notice maps quorumNumber => current aggregate pubkey of quorum
mapping(uint8 => BN254.G1Point) public currentApk;

constructor(ISlashingRegistryCoordinator _slashingRegistryCoordinator) {
constructor(
ISlashingRegistryCoordinator _slashingRegistryCoordinator
) {
registryCoordinator = address(_slashingRegistryCoordinator);
// disable initializers so that the implementation contract cannot be initialized
_disableInitializers();
Expand Down
4 changes: 3 additions & 1 deletion src/BLSSignatureChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ contract BLSSignatureChecker is IBLSSignatureChecker {
_;
}

constructor(ISlashingRegistryCoordinator _registryCoordinator) {
constructor(
ISlashingRegistryCoordinator _registryCoordinator
) {
registryCoordinator = _registryCoordinator;
stakeRegistry = _registryCoordinator.stakeRegistry();
blsApkRegistry = _registryCoordinator.blsApkRegistry();
Expand Down
5 changes: 1 addition & 4 deletions src/EjectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ contract EjectionManager is IEjectionManager, OwnableUpgradeable {
/// @notice Ratelimit parameters for each quorum
mapping(uint8 => QuorumEjectionParams) public quorumEjectionParams;

constructor(
ISlashingRegistryCoordinator _registryCoordinator,
IStakeRegistry _stakeRegistry
) {
constructor(ISlashingRegistryCoordinator _registryCoordinator, IStakeRegistry _stakeRegistry) {
registryCoordinator = _registryCoordinator;
stakeRegistry = _stakeRegistry;

Expand Down
2 changes: 1 addition & 1 deletion src/IndexRegistryStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract contract IndexRegistryStorage is Initializable, IIndexRegistry {

constructor(
ISlashingRegistryCoordinator _slashingRegistryCoordinator
){
) {
registryCoordinator = address(_slashingRegistryCoordinator);
// disable initializers so that the implementation contract cannot be initialized
_disableInitializers();
Expand Down
21 changes: 16 additions & 5 deletions src/RegistryCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
pragma solidity ^0.8.27;

import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol";
import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";
import {IIndexRegistry} from "./interfaces/IIndexRegistry.sol";
Expand Down Expand Up @@ -145,7 +146,10 @@ contract RegistryCoordinator is SlashingRegistryCoordinator, IRegistryCoordinato
) external onlyWhenNotPaused(PAUSED_DEREGISTER_OPERATOR) {
// Check that the quorum numbers are M2 quorums
for (uint256 i = 0; i < quorumNumbers.length; i++) {
require(!operatorSetsEnabled || _isM2Quorum(uint8(quorumNumbers[i])), OperatorSetsAlreadyEnabled());
require(
!operatorSetsEnabled || _isM2Quorum(uint8(quorumNumbers[i])),
OperatorSetsAlreadyEnabled()
);
}
_deregisterOperator({operator: msg.sender, quorumNumbers: quorumNumbers});
}
Expand Down Expand Up @@ -173,7 +177,12 @@ contract RegistryCoordinator is SlashingRegistryCoordinator, IRegistryCoordinato
}

/// @dev Hook to allow for any post-deregister logic
function _afterDeregisterOperator(address operator, bytes32 operatorId, bytes memory quorumNumbers, uint192 newBitmap) internal virtual override {
function _afterDeregisterOperator(
address operator,
bytes32 operatorId,
bytes memory quorumNumbers,
uint192 newBitmap
) internal virtual override {
uint256 operatorM2QuorumBitmap = newBitmap.minus(M2quorumBitmap);
// If the operator is no longer registered for any M2 quorums, update their status and deregister
// them from the AVS via the EigenLayer core contracts
Expand All @@ -184,9 +193,11 @@ contract RegistryCoordinator is SlashingRegistryCoordinator, IRegistryCoordinato

/// @dev Returns a bitmap with all bits set up to `quorumCount`. Used for bit-masking quorum numbers
/// and differentiating between operator sets and M2 quorums
function _getQuorumBitmap(uint256 quorumCount) internal pure returns (uint256) {
function _getQuorumBitmap(
uint256 quorumCount
) internal pure returns (uint256) {
// This creates a number where all bits up to quorumCount are set to 1
// For example:
// For example:
// quorumCount = 3 -> 0111 (7 in decimal)
// quorumCount = 5 -> 011111 (31 in decimal)
// This is a safe operation since we limit MAX_QUORUM_COUNT to 192
Expand Down
23 changes: 14 additions & 9 deletions src/ServiceManagerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import {IAVSDirectory} from "eigenlayer-contracts/src/contracts/interfaces/IAVSD
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IAllocationManager, IAllocationManagerTypes} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IPermissionController} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {
IAllocationManager,
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";

Expand Down Expand Up @@ -73,11 +76,10 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
}

/// @inheritdoc IServiceManager
function addPendingAdmin(address admin) external onlyOwner {
_permissionController.addPendingAdmin({
account: address(this),
admin: admin
});
function addPendingAdmin(
address admin
) external onlyOwner {
_permissionController.addPendingAdmin({account: address(this), admin: admin});
}

/// @inheritdoc IServiceManager
Expand Down Expand Up @@ -181,7 +183,10 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
_avsDirectory.deregisterOperatorFromAVS(operator);
}

function deregisterOperatorFromOperatorSets(address operator, uint32[] memory operatorSetIds) public virtual onlyRegistryCoordinator {
function deregisterOperatorFromOperatorSets(
address operator,
uint32[] memory operatorSetIds
) public virtual onlyRegistryCoordinator {
IAllocationManager.DeregisterParams memory params = IAllocationManagerTypes.DeregisterParams({
operator: operator,
avs: address(this),
Expand Down
12 changes: 8 additions & 4 deletions src/ServiceManagerBaseStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordi
import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";

import {IAVSDirectory} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IRewardsCoordinator} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IPermissionController} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";

/**
* @title Storage variables for the `ServiceManagerBase` contract.
Expand Down
Loading

0 comments on commit 7f89acc

Please sign in to comment.