|
| 1 | +## VetoableSlasher |
| 2 | + |
| 3 | +| File | Type | Proxy | |
| 4 | +| -------- | -------- | -------- | |
| 5 | +| [`VetoableSlasher.sol`](../src/VetoableSlasher.sol) | Implementation | No | |
| 6 | + |
| 7 | +The `VetoableSlasher` is a concrete implementation of the [`SlasherBase`](./SlasherBase.md) contract that adds a veto mechanism to the slashing process. This implementation introduces a waiting period during which a designated veto committee can cancel slashing requests before they are executed. This slasher implementation is recommended for AVSs to use as their systems matures, to account for slashing faults that arise from subjective conditions or non-malicious reasons such as a software bug. As the AVSs matures and the slashing conditions become well defined, the instant slasher may be a suitable contract. It is reccomended to have your veto comittee to be comprised of a set of diverse subject matter experts. |
| 8 | + |
| 9 | +*As of current implementation*: |
| 10 | +* Slashing requests are queued and can only be fulfilled after a configurable veto window has passed |
| 11 | +* A designated veto committee can cancel slashing requests during the veto window |
| 12 | +* Slashing requests have a status that tracks their lifecycle: Requested, Cancelled, or Completed |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +### Core Functionality |
| 17 | + |
| 18 | +#### `queueSlashingRequest` |
| 19 | +```solidity |
| 20 | +function queueSlashingRequest( |
| 21 | + IAllocationManager.SlashingParams calldata params |
| 22 | +) |
| 23 | + external |
| 24 | + virtual |
| 25 | + override |
| 26 | + onlySlasher |
| 27 | +``` |
| 28 | +Creates and queues a new slashing request that will be executable after the veto window has passed. |
| 29 | + |
| 30 | +*Entry Points*: |
| 31 | +* External calls from the authorized slasher |
| 32 | + |
| 33 | +*Effects*: |
| 34 | +* Assigns a unique ID to the slashing request |
| 35 | +* Creates a new slashing request with the provided parameters |
| 36 | +* Sets the request status to `Requested` |
| 37 | +* Stores the current block number as the request block |
| 38 | +* Emits a `SlashingRequested` event |
| 39 | + |
| 40 | +*Requirements*: |
| 41 | +* Caller MUST be the authorized slasher (enforced by `onlySlasher` modifier) |
| 42 | +* Slashing parameters must be valid |
| 43 | + |
| 44 | +#### `cancelSlashingRequest` |
| 45 | +```solidity |
| 46 | +function cancelSlashingRequest( |
| 47 | + uint256 requestId |
| 48 | +) |
| 49 | + external |
| 50 | + virtual |
| 51 | + override |
| 52 | + onlyVetoCommittee |
| 53 | +``` |
| 54 | +Allows the veto committee to cancel a pending slashing request within the veto window. |
| 55 | + |
| 56 | +*Entry Points*: |
| 57 | +* External calls from the veto committee |
| 58 | + |
| 59 | +*Effects*: |
| 60 | +* Changes the request status from `Requested` to `Cancelled` |
| 61 | +* Emits a `SlashingRequestCancelled` event |
| 62 | + |
| 63 | +*Requirements*: |
| 64 | +* Caller MUST be the veto committee (enforced by `onlyVetoCommittee` modifier) |
| 65 | +* The request MUST be in the `Requested` status |
| 66 | +* The current block number MUST be less than the request block plus the veto window |
| 67 | + |
| 68 | +#### `fulfillSlashingRequest` |
| 69 | +```solidity |
| 70 | +function fulfillSlashingRequest( |
| 71 | + uint256 requestId |
| 72 | +) |
| 73 | + external |
| 74 | + virtual |
| 75 | + override |
| 76 | + onlySlasher |
| 77 | +``` |
| 78 | +Executes a slashing request after the veto window has passed, if it has not been cancelled. |
| 79 | + |
| 80 | +*Entry Points*: |
| 81 | +* External calls from the authorized slasher |
| 82 | + |
| 83 | +*Effects*: |
| 84 | +* Changes the request status from `Requested` to `Completed` |
| 85 | +* Calls the internal `_fulfillSlashingRequest` function to execute the slashing action |
| 86 | + |
| 87 | +*Requirements*: |
| 88 | +* Caller MUST be the authorized slasher (enforced by `onlySlasher` modifier) |
| 89 | +* The request MUST be in the `Requested` status |
| 90 | +* The veto window MUST have passed (current block number >= request block + veto window) |
| 91 | + |
| 92 | +### Modifiers |
| 93 | + |
| 94 | +#### `onlyVetoCommittee` |
| 95 | +```solidity |
| 96 | +modifier onlyVetoCommittee() |
| 97 | +``` |
| 98 | +Ensures that only the veto committee can call certain functions. |
| 99 | + |
| 100 | +*Effects*: |
| 101 | +* Calls `_checkVetoCommittee` to verify that the caller is the veto committee |
| 102 | +* Allows the function execution to proceed if the check passes |
0 commit comments