Skip to main content

Implement Slashing

important

Before proceeding, review the Slashing Concept content and Unique Stake Allocation & Deallocation ELIP-002 for detailed information on slashing.

The AllocationManager provides the interface for the slashing function.

    /**
* @notice Called by an AVS to slash an operator in a given operator set
*/

function slashOperator(
address avs,
SlashingParams calldata params
) external;

/**
* @notice Struct containing parameters to slashing
* @param operator the address to slash
* @param operatorSetId the ID of the operatorSet the operator is being slashed on behalf of
* @param strategies the set of strategies to slash
* @param wadsToSlash the parts in 1e18 to slash, this will be proportional to the operator's
* slashable stake allocation for the operatorSet
* @param description the description of the slashing provided by the AVS for legibility
*/
struct SlashingParams {
address operator;
uint32 operatorSetId;
IStrategy[] strategies;
uint256[] wadsToSlash;
string description;
}

To implement slashing, AVSs specify:

For example, in the wadsToSlash parameter:

  • 8% slash is represented as 8e16, or 80000000000000000.
  • 25% slash is represented as 2.5e17 or 250000000000000000.

The indexes in the two arrays must match across strategies and wadsToSlash.

All Strategies supplied must be configured as part of the Operator Set. For all Strategies specified, the Operator’s allocations to that Operator Set are slashed by the corresponding proportion while maintaining their nominal allocations to all other Operator Sets. Maintaining nominal allocations is achieved by subtracting the allocated magnitude from both the specified Operator Set, and the Operator’s Total Magnitude.

Slashing proportionally reduces funds of all Stakers of the given Strategies that are delegated to the Operator, including funds in queued deallocations and withdrawals (that haven’t passed WITHDRAWAL_DELAY). Operator delegation is decreased directly in the DelegationManager in each Strategy. Changes are propagated to Staker withdrawals and view functions by referring to their delegated Operator’s Total Magnitude.

When a slashing occurs, one event is emitted onchain for each slashing. Emitted details identify the Operator slashed, in what Operator Set, and across which Strategies, with fields for the proportion slashed and meta-data.

/// @notice Emitted when an operator is slashed by an operator set for a strategy
/// `wadSlashed` is the proportion of the operator's total delegated stake that was slashed
event OperatorSlashed(
address operator, OperatorSet operatorSet, IStrategy[] strategies, uint256[] wadSlashed, string description
);

Example

The allocated magnitudes are:

MagnitudeProportionEIGEN
AVS_1_EIGEN2,00020%40
AVS_2_EIGEN2,50025%50
EigenDA_EIGEN2,00020%40
Non-slashable3,50035%70
Total10,000100%200

AVS_1 slashes the Operator for a 50% reduction (5e17 in wads) in the Operator Set AVS_1_EIGEN:

MagnitudeProportionEIGEN
AVS_1_EIGEN1,00011%20
AVS_2_EIGEN2,50028%50
EigenDA_EIGEN2,00022%40
Non-slashable3,50039%70
Total9000100%180

Slashing by one Operator Set does not affect the magnitudes of EIGEN allocated to other Operator Sets. The interactions between Staker, Operator, AVS, and core contracts are represented in the sequence diagram.

Sequence Representation of a Slashing
Figure: Sequence Representation of a Slashing