@@ -1806,7 +1806,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests
18061806 // Update the slasher
18071807 address appointee1 = address (0x1 );
18081808 cheats.prank (defaultAVS);
1809- allocationManager.setSlasher (defaultOperatorSet, appointee1);
1809+ allocationManager.updateSlasher (defaultOperatorSet, appointee1);
18101810
18111811 // Warp to just before the effect block of the slasher - fail to slash
18121812 cheats.roll (block .number + ALLOCATION_CONFIGURATION_DELAY);
@@ -4224,9 +4224,9 @@ contract AllocationManagerUnitTests_createRedistributingOperatorSetsV2 is Alloca
42244224 }
42254225}
42264226
4227- contract AllocationManagerUnitTests_SetSlasher is AllocationManagerUnitTests , IPermissionControllerErrors {
4227+ contract AllocationManagerUnitTests_updateSlasher is AllocationManagerUnitTests , IPermissionControllerErrors {
42284228 /// -----------------------------------------------------------------------
4229- /// setSlasher () + getSlasher() + getPendingSlasher()
4229+ /// updateSlasher () + getSlasher() + getPendingSlasher()
42304230 /// -----------------------------------------------------------------------
42314231
42324232 /// @dev Thrown when the caller is not allowed to call a function on behalf of an account.
@@ -4242,13 +4242,36 @@ contract AllocationManagerUnitTests_SetSlasher is AllocationManagerUnitTests, IP
42424242
42434243 cheats.prank (caller);
42444244 cheats.expectRevert (InvalidPermissions.selector );
4245- allocationManager.setSlasher (defaultOperatorSet, r.Address ());
4245+ allocationManager.updateSlasher (defaultOperatorSet, r.Address ());
4246+ }
4247+
4248+ function test_revert_invalidOperatorSet () public {
4249+ cheats.prank (defaultAVS);
4250+ cheats.expectRevert (InvalidOperatorSet.selector );
4251+ allocationManager.updateSlasher (OperatorSet (defaultAVS, 1 ), defaultAVS);
4252+ }
4253+
4254+ function test_revert_slasherNotSet () public {
4255+ cheats.prank (defaultAVS);
4256+
4257+ // Zero out the slasher address
4258+ allocationManager.setSlasherToZero (defaultOperatorSet);
4259+
4260+ cheats.prank (defaultAVS);
4261+ cheats.expectRevert (SlasherNotSet.selector );
4262+ allocationManager.updateSlasher (defaultOperatorSet, defaultAVS);
4263+ }
4264+
4265+ function test_revert_slasherZeroAddress () public {
4266+ cheats.prank (defaultAVS);
4267+ cheats.expectRevert (IPausable.InputAddressZero.selector );
4268+ allocationManager.updateSlasher (defaultOperatorSet, address (0 ));
42464269 }
42474270
42484271 function test_slasher_boundary (Randomness r ) public rand (r) {
42494272 address slasher = r.Address ();
42504273 cheats.prank (defaultAVS);
4251- allocationManager.setSlasher (defaultOperatorSet, slasher);
4274+ allocationManager.updateSlasher (defaultOperatorSet, slasher);
42524275 uint32 effectBlock = uint32 (block .number + ALLOCATION_CONFIGURATION_DELAY + 1 );
42534276
42544277 // Warp to the allocation config delay - the slasher should still be the defaultAVS and the pending slasher should be the new slasher
@@ -4266,15 +4289,15 @@ contract AllocationManagerUnitTests_SetSlasher is AllocationManagerUnitTests, IP
42664289 assertEq (returnedEffectBlock, 0 , "effect block should be 0 " );
42674290 }
42684291
4269- function testFuzz_setSlasher (Randomness r ) public rand (r) {
4292+ function testFuzz_updateSlasher (Randomness r ) public rand (r) {
42704293 address slasher = r.Address ();
42714294
42724295 // Set slasher
42734296 cheats.expectEmit (true , true , true , true , address (allocationManager));
42744297 uint32 effectBlock = uint32 (block .number + ALLOCATION_CONFIGURATION_DELAY + 1 );
42754298 emit SlasherUpdated (defaultOperatorSet, slasher, effectBlock);
42764299 cheats.prank (defaultAVS);
4277- allocationManager.setSlasher (defaultOperatorSet, slasher);
4300+ allocationManager.updateSlasher (defaultOperatorSet, slasher);
42784301
42794302 // Check values after set
42804303 (address returnedSlasher ) = allocationManager.getSlasher (defaultOperatorSet);
@@ -4294,13 +4317,13 @@ contract AllocationManagerUnitTests_SetSlasher is AllocationManagerUnitTests, IP
42944317 assertEq (returnedEffectBlock, 0 , "effect block should be 0 " );
42954318 }
42964319
4297- function test_fuzz_setSlasher_multipleTimesWithinConfigurationDelay (Randomness r ) public rand (r) {
4320+ function test_fuzz_updateSlasher_multipleTimesWithinConfigurationDelay (Randomness r ) public rand (r) {
42984321 address firstSlasher = r.Address ();
42994322 address secondSlasher = r.Address ();
43004323
43014324 // Set slasher
43024325 cheats.prank (defaultAVS);
4303- allocationManager.setSlasher (defaultOperatorSet, firstSlasher);
4326+ allocationManager.updateSlasher (defaultOperatorSet, firstSlasher);
43044327 (address pendingSlasher ,) = allocationManager.getPendingSlasher (defaultOperatorSet);
43054328 assertEq (pendingSlasher, firstSlasher, "pending slasher should be the first slasher " );
43064329
@@ -4312,7 +4335,7 @@ contract AllocationManagerUnitTests_SetSlasher is AllocationManagerUnitTests, IP
43124335 uint32 secondSlasherEffectBlock = uint32 (block .number + ALLOCATION_CONFIGURATION_DELAY + 1 );
43134336 emit SlasherUpdated (defaultOperatorSet, secondSlasher, secondSlasherEffectBlock);
43144337 cheats.prank (defaultAVS);
4315- allocationManager.setSlasher (defaultOperatorSet, secondSlasher);
4338+ allocationManager.updateSlasher (defaultOperatorSet, secondSlasher);
43164339
43174340 // Warp to effect block of first slasher
43184341 cheats.roll (block .number + 1 );
@@ -4336,14 +4359,14 @@ contract AllocationManagerUnitTests_SetSlasher is AllocationManagerUnitTests, IP
43364359
43374360 // Set Slasher
43384361 cheats.prank (defaultAVS);
4339- allocationManager.setSlasher (defaultOperatorSet, firstSlasher);
4362+ allocationManager.updateSlasher (defaultOperatorSet, firstSlasher);
43404363
43414364 // Warp to effect block of first slasher
43424365 cheats.roll (block .number + ALLOCATION_CONFIGURATION_DELAY + 1 );
43434366
43444367 // Set slasher again
43454368 cheats.prank (defaultAVS);
4346- allocationManager.setSlasher (defaultOperatorSet, secondSlasher);
4369+ allocationManager.updateSlasher (defaultOperatorSet, secondSlasher);
43474370
43484371 // Assert that first slasher is the current slasher
43494372 (address returnedSlasher ) = allocationManager.getSlasher (defaultOperatorSet);
@@ -4374,7 +4397,7 @@ contract AllocationManagerUnitTests_migrateSlashers is AllocationManagerUnitTest
43744397
43754398 // Manually set the slasher of the defaultAVS to be address(0)
43764399 // Given that the slasher is already set to the defaultAVS, we need to manually update so that the `migrateSlashers` function will not noop
4377- allocationManager.setSlasherZero (defaultOperatorSet);
4400+ allocationManager.setSlasherToZero (defaultOperatorSet);
43784401 }
43794402
43804403 function test_noop_invalidOperatorSet () public {
@@ -4492,28 +4515,6 @@ contract AllocationManagerUnitTests_migrateSlashers is AllocationManagerUnitTest
44924515 _assertNothingPending (defaultOperatorSet);
44934516 }
44944517
4495- /**
4496- * @notice Test for when an AVS sets the slasher first and then a migration occurs
4497- * @dev This is a known race condition. Migration will take precedence over setting a slasher
4498- * via `setSlasher`. The operatorSet should wait until the migration is complete before setting a slasher.
4499- */
4500- function test_setSlasher_migrate () public {
4501- // Set the slasher
4502- cheats.prank (defaultAVS);
4503- allocationManager.setSlasher (defaultOperatorSet, appointee1);
4504-
4505- // Set the slasher in the permission controller
4506- cheats.prank (defaultAVS);
4507- permissionController.setAppointee (defaultAVS, appointee2, address (allocationManager), allocationManager.slashOperator.selector );
4508-
4509- // Migrate the slasher
4510- allocationManager.migrateSlashers (defaultOperatorSet.toArray ());
4511-
4512- // The slasher should be set to the second appointee
4513- assertEq (allocationManager.getSlasher (defaultOperatorSet), appointee2, "slasher should be the second appointee " );
4514- _assertNothingPending (defaultOperatorSet);
4515- }
4516-
45174518 function testFuzz_migrateSlashers_Correctness (Randomness r ) public rand (r) {
45184519 address avs = r.Address ();
45194520 uint numOpSets = r.Uint256 (1 , FUZZ_MAX_OP_SETS);
@@ -4536,7 +4537,7 @@ contract AllocationManagerUnitTests_migrateSlashers is AllocationManagerUnitTest
45364537
45374538 // Set slashers to zero address on all previously create opSets so we can migrate them
45384539 for (uint i = 0 ; i < numOpSets; ++ i) {
4539- allocationManager.setSlasherZero (operatorSets[i]);
4540+ allocationManager.setSlasherToZero (operatorSets[i]);
45404541 }
45414542
45424543 // Expect event emits
0 commit comments