Skip to content

Commit 8b269dc

Browse files
committed
fix: tests
1 parent 7f89acc commit 8b269dc

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

test/harnesses/RegistryCoordinatorHarness.t.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,12 @@ contract RegistryCoordinatorHarness is RegistryCoordinator, Test {
6666
function _updateOperatorBitmapExternal(bytes32 operatorId, uint192 quorumBitmap) external {
6767
_updateOperatorBitmap(operatorId, quorumBitmap);
6868
}
69+
70+
function setOperatorSetsEnabled(bool enabled) external {
71+
operatorSetsEnabled = enabled;
72+
}
73+
74+
function setM2QuorumsDisabled(bool disabled) external {
75+
m2QuorumsDisabled = disabled;
76+
}
6977
}

test/integration/IntegrationDeployer.t.sol

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -439,27 +439,37 @@ abstract contract IntegrationDeployer is Test, IUserDeployer {
439439
});
440440
cheats.stopPrank();
441441

442-
_setoperatorSetsEnabled(false);
442+
_setOperatorSetsEnabled(false);
443+
_setM2QuorumsDisabled(false);
443444
}
444445

445-
/// @notice Overwrite RegistryCoordinator.operatorSetsEnabled to false since by default
446-
/// RegistryCoordinator is deployed and intitialized with operatorSetsEnabled set to true
447-
/// This is to enable testing of RegistryCoordinator in non operator set mode.
448-
function _setoperatorSetsEnabled(bool operatorSetsEnabled) internal {
446+
/// @notice Overwrite RegistryCoordinator.operatorSetsEnabled to the specified value.
447+
/// This is to enable testing of RegistryCoordinator in non-operator set mode.
448+
function _setOperatorSetsEnabled(bool operatorSetsEnabled) internal {
449449
// 1. First read the current value of the entire slot
450-
// which holds operatorSetsEnabled and accountIdentifier
450+
// which holds operatorSetsEnabled, m2QuorumsDisabled, and accountIdentifier
451451
bytes32 currentSlot = cheats.load(address(registryCoordinator), bytes32(uint256(161)));
452452

453-
// 2. Clear only the first byte (operatorSetsEnabled) while keeping the rest (accountIdentifier)
454-
// We can do this by:
455-
// i. Masking out the first byte of the current slot (keep accountIdentifier)
456-
// ii. OR it with 0 in the first byte position (set operatorSetsEnabled to false)
453+
// 2. Clear only the first byte (operatorSetsEnabled) while keeping the rest
457454
bytes32 newSlot = (currentSlot & ~bytes32(uint256(0xff))) | bytes32(uint256(operatorSetsEnabled ? 0x01 : 0x00));
458455

459456
// 3. Store the modified slot
460457
cheats.store(address(registryCoordinator), bytes32(uint256(161)), newSlot);
461458
}
462459

460+
/// @notice Overwrite RegistryCoordinator.m2QuorumsDisabled to the specified value.
461+
function _setM2QuorumsDisabled(bool m2QuorumsDisabled) internal {
462+
// 1. First read the current value of the entire slot
463+
// which holds operatorSetsEnabled, m2QuorumsDisabled, and accountIdentifier
464+
bytes32 currentSlot = cheats.load(address(registryCoordinator), bytes32(uint256(161)));
465+
466+
// 2. Clear only the second byte (m2QuorumsDisabled) while keeping the rest
467+
bytes32 newSlot = (currentSlot & ~bytes32(uint256(0xff) << 8)) | bytes32(uint256(m2QuorumsDisabled ? 0x01 : 0x00) << 8);
468+
469+
// 3. Store the modified slot
470+
cheats.store(address(registryCoordinator), bytes32(uint256(161)), newSlot);
471+
}
472+
463473
/// @dev Deploy a strategy and its underlying token, push to global lists of tokens/strategies, and whitelist
464474
/// strategy in strategyManager
465475
function _newStrategyAndToken(

test/utils/MockAVSDeployer.sol

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ contract MockAVSDeployer is Test {
331331

332332
operatorStateRetriever = new OperatorStateRetriever();
333333

334-
_setoperatorSetsEnabled(false);
334+
registryCoordinator.setOperatorSetsEnabled(false);
335+
registryCoordinator.setM2QuorumsDisabled(false);
335336
}
336337

337338
function _labelContracts() internal {
@@ -359,24 +360,6 @@ contract MockAVSDeployer is Test {
359360
vm.label(address(allocationManagerImplementation), "AllocationManagerImplementation");
360361
}
361362

362-
/// @notice Overwrite RegistryCoordinator.operatorSetsEnabled to false since by default
363-
/// RegistryCoordinator is deployed and intitialized with operatorSetsEnabled set to true
364-
/// This is to enable testing of RegistryCoordinator in non operator set mode.
365-
function _setoperatorSetsEnabled(bool operatorSetsEnabled) internal {
366-
// 1. First read the current value of the entire slot
367-
// which holds operatorSetsEnabled and accountIdentifier
368-
bytes32 currentSlot = cheats.load(address(registryCoordinator), bytes32(uint256(161)));
369-
370-
// 2. Clear only the first byte (operatorSetsEnabled) while keeping the rest (accountIdentifier)
371-
// We can do this by:
372-
// i. Masking out the first byte of the current slot (keep accountIdentifier)
373-
// ii. OR it with 0 in the first byte position (set operatorSetsEnabled to false)
374-
bytes32 newSlot = (currentSlot & ~bytes32(uint256(0xff))) | bytes32(uint256(operatorSetsEnabled ? 0x01 : 0x00));
375-
376-
// 3. Store the modified slot
377-
cheats.store(address(registryCoordinator), bytes32(uint256(161)), newSlot);
378-
}
379-
380363
/**
381364
* @notice registers operator with coordinator
382365
*/

0 commit comments

Comments
 (0)