22pragma solidity ^ 0.8.27 ;
33
44import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol " ;
5- import {IAllocationManager} from
6- "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol " ;
5+ import {
6+ IAllocationManager,
7+ OperatorSet
8+ } from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol " ;
9+ import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol " ;
710import {SlasherBase} from "./base/SlasherBase.sol " ;
811import {ISlashingRegistryCoordinator} from "../interfaces/ISlashingRegistryCoordinator.sol " ;
912import {IVetoableSlasher, IVetoableSlasherTypes} from "../interfaces/IVetoableSlasher.sol " ;
@@ -29,11 +32,12 @@ contract VetoableSlasher is IVetoableSlasher, SlasherBase {
2932
3033 constructor (
3134 IAllocationManager _allocationManager ,
35+ IStrategyManager _strategyManager ,
3236 ISlashingRegistryCoordinator _slashingRegistryCoordinator ,
3337 address _slasher ,
3438 address _vetoCommittee ,
3539 uint32 _vetoWindowBlocks
36- ) SlasherBase (_allocationManager, _slashingRegistryCoordinator, _slasher) {
40+ ) SlasherBase (_allocationManager, _strategyManager, _slashingRegistryCoordinator, _slasher) {
3741 vetoWindowBlocks = _vetoWindowBlocks;
3842 vetoCommittee = _vetoCommittee;
3943 }
@@ -47,72 +51,82 @@ contract VetoableSlasher is IVetoableSlasher, SlasherBase {
4751
4852 /// @inheritdoc IVetoableSlasher
4953 function cancelSlashingRequest (
50- uint256 requestId
54+ uint256 slashId
5155 ) external virtual override onlyVetoCommittee {
52- _cancelSlashingRequest (requestId );
56+ _cancelSlashingRequest (slashId );
5357 }
5458
5559 /// @inheritdoc IVetoableSlasher
5660 function fulfillSlashingRequest (
57- uint256 requestId
61+ uint256 slashId
5862 ) external virtual override onlySlasher {
59- _fulfillSlashingRequestAndMarkAsCompleted (requestId);
63+ IVetoableSlasherTypes.VetoableSlashingRequest storage request = slashingRequests[slashId];
64+ _markAsCompleted (request);
65+ _fulfillSlashingRequest (request.params);
66+ }
67+
68+ /// @inheritdoc IVetoableSlasher
69+ function fulfillSlashingRequestAndBurnOrRedistribute (
70+ uint256 slashId
71+ ) external virtual override onlySlasher {
72+ IVetoableSlasherTypes.VetoableSlashingRequest storage request = slashingRequests[slashId];
73+ _markAsCompleted (request);
74+ _fulfillSlashingRequestAndBurnOrRedistribute (request.params);
6075 }
6176
6277 /// @notice Internal function to create and store a new slashing request
6378 /// @param params Parameters defining the slashing request
6479 function _queueSlashingRequest (
6580 IAllocationManager.SlashingParams memory params
6681 ) internal virtual {
67- uint256 requestId = nextRequestId++ ;
68- slashingRequests[requestId] = IVetoableSlasherTypes.VetoableSlashingRequest ({
82+ uint256 nextSlashId = allocationManager.getSlashCount (
83+ OperatorSet ({avs: slashingRegistryCoordinator.avs (), id: params.operatorSetId})
84+ );
85+ slashingRequests[nextSlashId] = IVetoableSlasherTypes.VetoableSlashingRequest ({
6986 params: params,
7087 requestBlock: block .number ,
7188 status: IVetoableSlasherTypes.SlashingStatus.Requested
7289 });
7390
7491 emit SlashingRequested (
75- requestId, params.operator, params.operatorSetId, params.wadsToSlash, params.description
92+ nextSlashId,
93+ params.operator,
94+ params.operatorSetId,
95+ params.wadsToSlash,
96+ params.description
7697 );
7798 }
7899
79100 /// @notice Internal function to mark a slashing request as cancelled
80- /// @param requestId The ID of the slashing request to cancel
101+ /// @param slashId The ID of the slashing request to cancel
81102 function _cancelSlashingRequest (
82- uint256 requestId
103+ uint256 slashId
83104 ) internal virtual {
84105 require (
85- block .number < slashingRequests[requestId ].requestBlock + vetoWindowBlocks,
106+ block .number < slashingRequests[slashId ].requestBlock + vetoWindowBlocks,
86107 VetoPeriodPassed ()
87108 );
88109 require (
89- slashingRequests[requestId ].status == IVetoableSlasherTypes.SlashingStatus.Requested,
110+ slashingRequests[slashId ].status == IVetoableSlasherTypes.SlashingStatus.Requested,
90111 SlashingRequestNotRequested ()
91112 );
92113
93- slashingRequests[requestId ].status = IVetoableSlasherTypes.SlashingStatus.Cancelled;
94- emit SlashingRequestCancelled (requestId );
114+ slashingRequests[slashId ].status = IVetoableSlasherTypes.SlashingStatus.Cancelled;
115+ emit SlashingRequestCancelled (slashId );
95116 }
96117
97- /// @notice Internal function to fulfill a slashing request and mark it as completed
98- /// @param requestId The ID of the slashing request to fulfill
99- function _fulfillSlashingRequestAndMarkAsCompleted (
100- uint256 requestId
118+ /// @notice Internal function to mark a slashing request as completed
119+ /// @param request The request to mark as completed
120+ function _markAsCompleted (
121+ IVetoableSlasherTypes.VetoableSlashingRequest storage request
101122 ) internal virtual {
102- IVetoableSlasherTypes.VetoableSlashingRequest storage request = slashingRequests[requestId];
103123 require (block .number >= request.requestBlock + vetoWindowBlocks, VetoPeriodNotPassed ());
104124 require (
105125 request.status == IVetoableSlasherTypes.SlashingStatus.Requested,
106126 SlashingRequestIsCancelled ()
107127 );
108128
109129 request.status = IVetoableSlasherTypes.SlashingStatus.Completed;
110-
111- _fulfillSlashingRequest (requestId, request.params);
112-
113- address [] memory operators = new address [](1 );
114- operators[0 ] = request.params.operator;
115- slashingRegistryCoordinator.updateOperators (operators);
116130 }
117131
118132 /// @notice Internal function to verify if an account is the veto committee
0 commit comments