Skip to content

Commit c547c37

Browse files
committed
fix: tests wip
1 parent b5ed8be commit c547c37

22 files changed

+2704
-221
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/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/StakeRegistry.sol

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/
55
import {IAVSDirectory } from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
66
import {OperatorSet} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
77
import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
8-
import {IServiceManager} from "./interfaces/IServiceManager.sol";
98

109
import {StakeRegistryStorage, IStrategy} from "./StakeRegistryStorage.sol";
1110

@@ -46,14 +45,12 @@ contract StakeRegistry is StakeRegistryStorage {
4645
ISlashingRegistryCoordinator _slashingRegistryCoordinator,
4746
IDelegationManager _delegationManager,
4847
IAVSDirectory _avsDirectory,
49-
IAllocationManager _allocationManager,
50-
IServiceManager _serviceManager
48+
IAllocationManager _allocationManager
5149
) StakeRegistryStorage(
5250
_slashingRegistryCoordinator,
5351
_delegationManager,
5452
_avsDirectory,
55-
_allocationManager,
56-
_serviceManager
53+
_allocationManager
5754
) {}
5855

5956
/*******************************************************************************

src/StakeRegistryStorage.sol

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pragma solidity ^0.8.27;
44
import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol";
55
import {IAVSDirectory} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
66
import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
7-
import {IServiceManager} from "./interfaces/IServiceManager.sol";
87
import {IStrategyManager, IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
98

109
import {ISlashingRegistryCoordinator} from "./interfaces/ISlashingRegistryCoordinator.sol";
@@ -33,9 +32,6 @@ abstract contract StakeRegistryStorage is IStakeRegistry {
3332
/// @notice the address of the AllocationManager for EigenLayer.
3433
IAllocationManager public immutable allocationManager;
3534

36-
/// @notice the address of the ServiceManager associtated with the stake registries
37-
IServiceManager public immutable serviceManager;
38-
3935
/// @notice the coordinator contract that this registry is associated with
4036
address public immutable registryCoordinator;
4137

@@ -68,13 +64,11 @@ abstract contract StakeRegistryStorage is IStakeRegistry {
6864
ISlashingRegistryCoordinator _slashingRegistryCoordinator,
6965
IDelegationManager _delegationManager,
7066
IAVSDirectory _avsDirectory,
71-
IAllocationManager _allocationManager,
72-
IServiceManager _serviceManager
67+
IAllocationManager _allocationManager
7368
) {
7469
registryCoordinator = address(_slashingRegistryCoordinator);
7570
delegation = _delegationManager;
7671
avsDirectory = _avsDirectory;
77-
serviceManager = _serviceManager;
7872
allocationManager = _allocationManager;
7973
}
8074

src/interfaces/ISlashingRegistryCoordinator.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface IRegistryCoordinatorErrors {
3636
* @title Interface for a contract that coordinates between various registries for an AVS.
3737
* @author Layr Labs, Inc.
3838
*/
39-
interface ISlashingRegistryCoordinator is IRegistryCoordinatorErrors{
39+
interface ISlashingRegistryCoordinator is IRegistryCoordinatorErrors {
4040
// EVENTS
4141

4242
event OperatorSetParamsUpdated(uint8 indexed quorumNumber, OperatorSetParam operatorSetParams);

test/ffi/BLSPubKeyCompendiumFFI.t.sol

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity ^0.8.27;
44
import "../../src/BLSApkRegistry.sol";
55
import "../ffi/util/G2Operations.sol";
66
import {IBLSApkRegistry} from "../../src/interfaces/IBLSApkRegistry.sol";
7+
import {ISlashingRegistryCoordinator} from "../../src/interfaces/ISlashingRegistryCoordinator.sol";
78

89
contract BLSApkRegistryFFITests is G2Operations {
910
using BN254 for BN254.G1Point;
@@ -12,7 +13,7 @@ contract BLSApkRegistryFFITests is G2Operations {
1213
Vm cheats = Vm(VM_ADDRESS);
1314

1415
BLSApkRegistry blsApkRegistry;
15-
IRegistryCoordinator registryCoordinator;
16+
ISlashingRegistryCoordinator registryCoordinator;
1617

1718
uint256 privKey;
1819
IBLSApkRegistry.PubkeyRegistrationParams pubkeyRegistrationParams;

test/harnesses/BLSApkRegistryHarness.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import "../../src/BLSApkRegistry.sol";
77
contract BLSApkRegistryHarness is BLSApkRegistry {
88

99
constructor(
10-
IRegistryCoordinator _registryCoordinator
11-
) BLSApkRegistry(_registryCoordinator) {}
10+
ISlashingRegistryCoordinator _slashingRegistryCoordinator
11+
) BLSApkRegistry(_slashingRegistryCoordinator) {}
1212

1313
function setBLSPublicKey(address account, BN254.G1Point memory pk) external {
1414

test/harnesses/StakeRegistryHarness.sol

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import "../../src/StakeRegistry.sol";
66
// wrapper around the StakeRegistry contract that exposes the internal functions for unit testing.
77
contract StakeRegistryHarness is StakeRegistry {
88
constructor(
9-
IRegistryCoordinator _registryCoordinator,
9+
ISlashingRegistryCoordinator _registryCoordinator,
1010
IDelegationManager _delegationManager,
1111
IAVSDirectory _avsDirectory,
12-
IAllocationManager _allocationManager,
13-
IServiceManager _serviceManager
14-
) StakeRegistry(_registryCoordinator, _delegationManager, _avsDirectory, _allocationManager, _serviceManager) {
12+
IAllocationManager _allocationManager
13+
) StakeRegistry(_registryCoordinator, _delegationManager, _avsDirectory, _allocationManager) {
1514
}
1615

1716
function recordOperatorStakeUpdate(bytes32 operatorId, uint8 quorumNumber, uint96 newStake) external returns(int256) {

test/integration/IntegrationBase.t.sol

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ abstract contract IntegrationBase is IntegrationConfig {
3030

3131
/// @dev Also checks that the user has NEVER_REGISTERED status
3232
function assert_HasNoOperatorInfo(User user, string memory err) internal {
33-
IRegistryCoordinator.OperatorInfo memory info = _getOperatorInfo(user);
33+
ISlashingRegistryCoordinator.OperatorInfo memory info = _getOperatorInfo(user);
3434

3535
assertEq(info.operatorId, bytes32(0), err);
36-
assertTrue(info.status == IRegistryCoordinator.OperatorStatus.NEVER_REGISTERED, err);
36+
assertTrue(info.status == ISlashingRegistryCoordinator.OperatorStatus.NEVER_REGISTERED, err);
3737
}
3838

3939
function assert_HasRegisteredStatus(User user, string memory err) internal {
40-
IRegistryCoordinator.OperatorStatus status = registryCoordinator.getOperatorStatus(address(user));
40+
ISlashingRegistryCoordinator.OperatorStatus status = registryCoordinator.getOperatorStatus(address(user));
4141

42-
assertTrue(status == IRegistryCoordinator.OperatorStatus.REGISTERED, err);
42+
assertTrue(status == ISlashingRegistryCoordinator.OperatorStatus.REGISTERED, err);
4343
}
4444

4545
function assert_HasDeregisteredStatus(User user, string memory err) internal {
46-
IRegistryCoordinator.OperatorStatus status = registryCoordinator.getOperatorStatus(address(user));
46+
ISlashingRegistryCoordinator.OperatorStatus status = registryCoordinator.getOperatorStatus(address(user));
4747

48-
assertTrue(status == IRegistryCoordinator.OperatorStatus.DEREGISTERED, err);
48+
assertTrue(status == ISlashingRegistryCoordinator.OperatorStatus.DEREGISTERED, err);
4949
}
5050

5151
function assert_EmptyQuorumBitmap(User user, string memory err) internal {
@@ -213,8 +213,8 @@ abstract contract IntegrationBase is IntegrationConfig {
213213
}
214214

215215
function assert_Snap_Unchanged_OperatorInfo(User user, string memory err) internal {
216-
IRegistryCoordinator.OperatorInfo memory curInfo = _getOperatorInfo(user);
217-
IRegistryCoordinator.OperatorInfo memory prevInfo = _getPrevOperatorInfo(user);
216+
ISlashingRegistryCoordinator.OperatorInfo memory curInfo = _getOperatorInfo(user);
217+
ISlashingRegistryCoordinator.OperatorInfo memory prevInfo = _getPrevOperatorInfo(user);
218218

219219
assertEq(prevInfo.operatorId, curInfo.operatorId, err);
220220
assertTrue(prevInfo.status == curInfo.status, err);
@@ -789,11 +789,11 @@ abstract contract IntegrationBase is IntegrationConfig {
789789

790790
/// RegistryCoordinator:
791791

792-
function _getOperatorInfo(User user) internal view returns (IRegistryCoordinator.OperatorInfo memory) {
792+
function _getOperatorInfo(User user) internal view returns (ISlashingRegistryCoordinator.OperatorInfo memory) {
793793
return registryCoordinator.getOperator(address(user));
794794
}
795795

796-
function _getPrevOperatorInfo(User user) internal timewarp() returns (IRegistryCoordinator.OperatorInfo memory) {
796+
function _getPrevOperatorInfo(User user) internal timewarp() returns (ISlashingRegistryCoordinator.OperatorInfo memory) {
797797
return _getOperatorInfo(user);
798798
}
799799

test/integration/IntegrationConfig.t.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ contract IntegrationConfig is IntegrationDeployer, G2Operations, Constants {
158158
emit log_named_uint("_configRand: number of quorums being initialized", quorumCount);
159159

160160
// Default OperatorSetParams for all quorums
161-
IRegistryCoordinator.OperatorSetParam memory operatorSet = IRegistryCoordinator.OperatorSetParam({
161+
ISlashingRegistryCoordinator.OperatorSetParam memory operatorSet = ISlashingRegistryCoordinator.OperatorSetParam({
162162
maxOperatorCount: MAX_OPERATOR_COUNT,
163163
kickBIPsOfOperatorStake: KICK_BIPS_OPERATOR_STAKE,
164164
kickBIPsOfTotalStake: KICK_BIPS_TOTAL_STAKE
@@ -304,7 +304,7 @@ contract IntegrationConfig is IntegrationDeployer, G2Operations, Constants {
304304
for (uint i = 0; i < churnQuorums.length; i++) {
305305
uint8 quorum = uint8(churnQuorums[i]);
306306

307-
IRegistryCoordinator.OperatorSetParam memory params
307+
ISlashingRegistryCoordinator.OperatorSetParam memory params
308308
= registryCoordinator.getOperatorSetParams(quorum);
309309

310310
// Sanity check - make sure we're at the operator cap
@@ -338,15 +338,15 @@ contract IntegrationConfig is IntegrationDeployer, G2Operations, Constants {
338338
/// From RegistryCoordinator._individualKickThreshold
339339
function _individualKickThreshold(
340340
uint96 operatorStake,
341-
IRegistryCoordinator.OperatorSetParam memory setParams
341+
ISlashingRegistryCoordinator.OperatorSetParam memory setParams
342342
) internal pure returns (uint96) {
343343
return operatorStake * setParams.kickBIPsOfOperatorStake / BIPS_DENOMINATOR;
344344
}
345345

346346
/// From RegistryCoordinator._totalKickThreshold
347347
function _totalKickThreshold(
348348
uint96 totalStake,
349-
IRegistryCoordinator.OperatorSetParam memory setParams
349+
ISlashingRegistryCoordinator.OperatorSetParam memory setParams
350350
) internal pure returns (uint96) {
351351
return totalStake * setParams.kickBIPsOfTotalStake / BIPS_DENOMINATOR;
352352
}
@@ -524,7 +524,7 @@ contract IntegrationConfig is IntegrationDeployer, G2Operations, Constants {
524524
* @dev Uses _randFillType to determine how many operators to register for a quorum initially
525525
* @return The number of operators to register
526526
*/
527-
function _randInitialOperators(IRegistryCoordinator.OperatorSetParam memory operatorSet) private returns (uint) {
527+
function _randInitialOperators(ISlashingRegistryCoordinator.OperatorSetParam memory operatorSet) private returns (uint) {
528528
uint fillTypeFlag = _randValue(fillTypeFlags);
529529

530530
if (fillTypeFlag == EMPTY) {

test/integration/IntegrationDeployer.t.sol

+6-10
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,16 @@ abstract contract IntegrationDeployer is Test, IUserDeployer {
332332
cheats.stopPrank();
333333

334334
StakeRegistry stakeRegistryImplementation = new StakeRegistry(
335-
IRegistryCoordinator(registryCoordinator), IDelegationManager(delegationManager), IAVSDirectory(avsDirectory), allocationManager, IServiceManager(serviceManager)
335+
ISlashingRegistryCoordinator(registryCoordinator), IDelegationManager(delegationManager), IAVSDirectory(avsDirectory), allocationManager
336336
);
337337
BLSApkRegistry blsApkRegistryImplementation =
338-
new BLSApkRegistry(IRegistryCoordinator(registryCoordinator));
338+
new BLSApkRegistry(ISlashingRegistryCoordinator(registryCoordinator));
339339
IndexRegistry indexRegistryImplementation =
340-
new IndexRegistry(IRegistryCoordinator(registryCoordinator));
340+
new IndexRegistry(ISlashingRegistryCoordinator(registryCoordinator));
341341
ServiceManagerMock serviceManagerImplementation = new ServiceManagerMock(
342342
IAVSDirectory(avsDirectory),
343343
rewardsCoordinator,
344-
IRegistryCoordinator(registryCoordinator),
344+
ISlashingRegistryCoordinator(registryCoordinator),
345345
stakeRegistry,
346346
permissionController
347347
);
@@ -380,16 +380,12 @@ abstract contract IntegrationDeployer is Test, IUserDeployer {
380380
TransparentUpgradeableProxy(payable(address(registryCoordinator))),
381381
address(registryCoordinatorImplementation),
382382
abi.encodeWithSelector(
383-
RegistryCoordinator.initialize.selector,
383+
SlashingRegistryCoordinator.initialize.selector,
384384
registryCoordinatorOwner,
385385
churnApprover,
386386
ejector,
387387
0, /*initialPausedStatus*/
388-
new IRegistryCoordinator.OperatorSetParam[](0),
389-
new uint96[](0),
390-
new IStakeRegistry.StrategyParams[][](0),
391-
quorumStakeTypes,
392-
slashableStakeQuorumLookAheadPeriods
388+
address(serviceManager) // _accountIdentifier
393389
)
394390
);
395391

test/integration/User.t.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,28 @@ contract User is Test {
152152
.plus(standardBitmap)
153153
.bitmapToBytesArray();
154154

155-
IRegistryCoordinator.OperatorKickParam[] memory kickParams
156-
= new IRegistryCoordinator.OperatorKickParam[](allQuorums.length);
155+
ISlashingRegistryCoordinator.OperatorKickParam[] memory kickParams
156+
= new ISlashingRegistryCoordinator.OperatorKickParam[](allQuorums.length);
157157

158158
// this constructs OperatorKickParam[] in ascending quorum order
159159
// (yikes)
160160
uint churnIdx;
161161
uint stdIdx;
162162
while (churnIdx + stdIdx < allQuorums.length) {
163163
if (churnIdx == churnQuorums.length) {
164-
kickParams[churnIdx + stdIdx] = IRegistryCoordinator.OperatorKickParam({
164+
kickParams[churnIdx + stdIdx] = ISlashingRegistryCoordinator.OperatorKickParam({
165165
quorumNumber: 0,
166166
operator: address(0)
167167
});
168168
stdIdx++;
169169
} else if (stdIdx == standardQuorums.length || churnQuorums[churnIdx] < standardQuorums[stdIdx]) {
170-
kickParams[churnIdx + stdIdx] = IRegistryCoordinator.OperatorKickParam({
170+
kickParams[churnIdx + stdIdx] = ISlashingRegistryCoordinator.OperatorKickParam({
171171
quorumNumber: uint8(churnQuorums[churnIdx]),
172172
operator: address(churnTargets[churnIdx])
173173
});
174174
churnIdx++;
175175
} else if (standardQuorums[stdIdx] < churnQuorums[churnIdx]) {
176-
kickParams[churnIdx + stdIdx] = IRegistryCoordinator.OperatorKickParam({
176+
kickParams[churnIdx + stdIdx] = ISlashingRegistryCoordinator.OperatorKickParam({
177177
quorumNumber: 0,
178178
operator: address(0)
179179
});

0 commit comments

Comments
 (0)