Skip to content

Commit 589cf19

Browse files
authored
Merge branch 'dev' into jaxxjj/ecdsa-stake-registry
2 parents fe83672 + 372b072 commit 589cf19

File tree

4 files changed

+631
-1
lines changed

4 files changed

+631
-1
lines changed

test/events/IStakeRegistryEvents.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ interface IStakeRegistryEvents {
1818
event StrategyMultiplierUpdated(
1919
uint8 indexed quorumNumber, IStrategy strategy, uint256 multiplier
2020
);
21+
/// @notice Emitted when the look ahead period for checking operator shares is updated.
22+
event LookAheadPeriodChanged(uint32 oldLookAheadBlocks, uint32 newLookAheadBlocks);
2123
}

test/unit/IndexRegistryUnit.t.sol

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,42 @@ contract IndexRegistryUnitTests_configAndGetters is IndexRegistryUnitTests {
388388
cheats.expectRevert();
389389
indexRegistry.getOperatorListAtBlockNumber(quorumNumber, 0);
390390
}
391+
392+
function test_getQuorumUpdateAtIndex() public {
393+
uint8 quorumNumber = nextQuorum;
394+
_initializeQuorum();
395+
396+
uint32 blockNum = uint32(block.number);
397+
398+
// Roll forward to force update
399+
vm.roll(block.number + 1);
400+
401+
// Check quorum update at index 0
402+
IIndexRegistry.QuorumUpdate memory quorumUpdate =
403+
indexRegistry.getQuorumUpdateAtIndex(quorumNumber, 0);
404+
assertEq(quorumUpdate.numOperators, 0, "numOperators not 0");
405+
assertEq(quorumUpdate.fromBlockNumber, blockNum, "fromBlockNumber not correct");
406+
407+
// Register operator
408+
(, bytes32 operatorId) = _selectNewOperator();
409+
_registerOperatorSingleQuorum(operatorId, quorumNumber);
410+
411+
// Check quorum update at index 1
412+
quorumUpdate = indexRegistry.getQuorumUpdateAtIndex(quorumNumber, 1);
413+
assertEq(quorumUpdate.numOperators, 1, "numOperators not 1");
414+
assertEq(quorumUpdate.fromBlockNumber, block.number, "fromBlockNumber not correct");
415+
416+
// Roll forward to force update
417+
vm.roll(block.number + 1);
418+
419+
// Deregister
420+
_deregisterOperatorSingleQuorum(operatorId, quorumNumber);
421+
422+
// Check quorum update at index 2
423+
quorumUpdate = indexRegistry.getQuorumUpdateAtIndex(quorumNumber, 2);
424+
assertEq(quorumUpdate.numOperators, 0, "numOperators not 0");
425+
assertEq(quorumUpdate.fromBlockNumber, block.number, "fromBlockNumber not correct");
426+
}
391427
}
392428

393429
contract IndexRegistryUnitTests_registerOperator is IndexRegistryUnitTests {

test/unit/ServiceManagerBase.t.sol

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
55
import {
66
RewardsCoordinator,
77
IRewardsCoordinator,
8+
IRewardsCoordinatorEvents,
89
IRewardsCoordinatorTypes,
910
IERC20
1011
} from "eigenlayer-contracts/src/contracts/core/RewardsCoordinator.sol";
@@ -928,4 +929,39 @@ contract ServiceManagerBase_UnitTests is MockAVSDeployer, IServiceManagerBaseEve
928929
cheats.expectRevert(IServiceManagerErrors.OnlyRegistryCoordinator.selector);
929930
serviceManager.deregisterOperatorFromOperatorSets(operator, operatorSetIds);
930931
}
932+
933+
function testFuzz_setClaimerFor_revert_notOwner(
934+
address claimer,
935+
address caller
936+
) public filterFuzzedAddressInputs(claimer) filterFuzzedAddressInputs(caller) {
937+
cheats.assume(caller != serviceManagerOwner);
938+
939+
cheats.expectRevert("Ownable: caller is not the owner");
940+
cheats.prank(caller);
941+
serviceManager.setClaimerFor(claimer);
942+
}
943+
944+
function testFuzz_setClaimerFor_upateClaimer(
945+
address claimer
946+
) public filterFuzzedAddressInputs(claimer) {
947+
cheats.prank(serviceManagerOwner);
948+
serviceManager.setClaimerFor(claimer);
949+
assertEq(
950+
claimer, rewardsCoordinator.claimerFor(address(serviceManager)), "claimer not updated"
951+
);
952+
}
953+
954+
function testFuzz_setClaimerFor_emitEvent(
955+
address claimer
956+
) public filterFuzzedAddressInputs(claimer) {
957+
// Retrieve previous claimer.
958+
address prevClaimer = rewardsCoordinator.claimerFor(address(serviceManager));
959+
960+
// Expect an event on the RewardCoordinator.
961+
cheats.expectEmit(true, true, true, true);
962+
emit IRewardsCoordinatorEvents.ClaimerForSet(address(serviceManager), prevClaimer, claimer);
963+
964+
cheats.prank(serviceManagerOwner);
965+
serviceManager.setClaimerFor(claimer);
966+
}
931967
}

0 commit comments

Comments
 (0)