Skip to content

Commit a1a3777

Browse files
committed
fix: integration tests
1 parent 47b560d commit a1a3777

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

test/integration/IntegrationDeployer.t.sol

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ abstract contract IntegrationDeployer is Test, IUserDeployer {
195195
new StrategyManager(delegationManager, pauserRegistry);
196196
EigenPodManager eigenPodManagerImplementation =
197197
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegationManager, pauserRegistry);
198-
console.log("HERE Impl");
199198
AVSDirectory avsDirectoryImplementation =
200199
new AVSDirectory(delegationManager, pauserRegistry);
201200

@@ -405,6 +404,60 @@ abstract contract IntegrationDeployer is Test, IUserDeployer {
405404
);
406405

407406
operatorStateRetriever = new OperatorStateRetriever();
407+
408+
// Setup UAM Permissions
409+
cheats.startPrank(serviceManager.owner());
410+
// 1. set AVS registrar
411+
serviceManager.setAppointee({
412+
appointee: serviceManager.owner(),
413+
target: address(allocationManager),
414+
selector: IAllocationManager.setAVSRegistrar.selector
415+
});
416+
// 2. create operator sets
417+
serviceManager.setAppointee({
418+
appointee: address(registryCoordinator),
419+
target: address(allocationManager),
420+
selector: IAllocationManager.createOperatorSets.selector
421+
});
422+
// 3. deregister operator from operator sets
423+
serviceManager.setAppointee({
424+
appointee: address(registryCoordinator),
425+
target: address(allocationManager),
426+
selector: IAllocationManager.deregisterFromOperatorSets.selector
427+
});
428+
// 4. add strategies to operator sets
429+
serviceManager.setAppointee({
430+
appointee: address(registryCoordinator),
431+
target: address(stakeRegistry),
432+
selector: IAllocationManager.addStrategiesToOperatorSet.selector
433+
});
434+
// 5. remove strategies from operator sets
435+
serviceManager.setAppointee({
436+
appointee: address(registryCoordinator),
437+
target: address(stakeRegistry),
438+
selector: IAllocationManager.removeStrategiesFromOperatorSet.selector
439+
});
440+
cheats.stopPrank();
441+
442+
_setIsOperatorSetAVS(false);
443+
}
444+
445+
/// @notice Overwrite RegistryCoordinator.isOperatorSetAVS to false since by default
446+
/// RegistryCoordinator is deployed and intitialized with isOperatorSetAVS set to true
447+
/// This is to enable testing of RegistryCoordinator in non operator set mode.
448+
function _setIsOperatorSetAVS(bool isOperatorSetAVS) internal {
449+
// 1. First read the current value of the entire slot
450+
// which holds isOperatorSetAVS and accountIdentifier
451+
bytes32 currentSlot = cheats.load(address(registryCoordinator), bytes32(uint256(161)));
452+
453+
// 2. Clear only the first byte (isOperatorSetAVS) 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 isOperatorSetAVS to false)
457+
bytes32 newSlot = (currentSlot & ~bytes32(uint256(0xff))) | bytes32(uint256(isOperatorSetAVS ? 0x01 : 0x00));
458+
459+
// 3. Store the modified slot
460+
cheats.store(address(registryCoordinator), bytes32(uint256(161)), newSlot);
408461
}
409462

410463
/// @dev Deploy a strategy and its underlying token, push to global lists of tokens/strategies, and whitelist

test/utils/MockAVSDeployer.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ contract MockAVSDeployer is Test {
359359
vm.label(address(allocationManagerImplementation), "AllocationManagerImplementation");
360360
}
361361

362-
/// @notice Overwrite RegistryCoorduinator.isOperatorSetAVS to false since by default
362+
/// @notice Overwrite RegistryCoordinator.isOperatorSetAVS to false since by default
363363
/// RegistryCoordinator is deployed and intitialized with isOperatorSetAVS set to true
364364
/// This is to enable testing of RegistryCoordinator in non operator set mode.
365365
function _setIsOperatorSetAVS(bool isOperatorSetAVS) internal {

0 commit comments

Comments
 (0)