ISlasher
Author: Layr Labs, Inc.
Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
See the Slasher
contract itself for implementation details.
Functions
optIntoSlashing
Gives the contractAddress
permission to slash the funds of the caller.
Typically, this function must be called prior to registering for a middleware.
freezeOperator
Used for 'slashing' a certain operator.
Technically the operator is 'frozen' (hence the name of this function), and then subject to slashing pending a decision by a human-in-the-loop.
The operator must have previously given the caller (which should be a contract) the ability to slash them, through a call to optIntoSlashing
.
Parameters
Name | Type | Description |
---|---|---|
|
| The operator to be frozen. |
resetFrozenStatus
Removes the 'frozen' status from each of the frozenAddresses
Callable only by the contract owner (i.e. governance).
recordFirstStakeUpdate
this function is a called by middlewares during an operator's registration to make sure the operator's stake at registration is slashable until serveUntil
adds the middleware's slashing contract to the operator's linked list
Parameters
Name | Type | Description |
---|---|---|
|
| the operator whose stake update is being recorded |
|
| the block until which the operator's stake at the current block is slashable |
recordStakeUpdate
this function is a called by middlewares during a stake update for an operator (perhaps to free pending withdrawals) to make sure the operator's stake at updateBlock is slashable until serveUntil
insertAfter should be calculated offchain before making the transaction that calls this. this is subject to race conditions, but it is anticipated to be rare and not detrimental.
Parameters
Name | Type | Description |
---|---|---|
|
| the operator whose stake update is being recorded |
|
| the block for which the stake update is being recorded |
|
| the block until which the operator's stake at updateBlock is slashable |
|
| the element of the operators linked list that the currently updating middleware should be inserted after |
recordLastStakeUpdateAndRevokeSlashingAbility
this function is a called by middlewares during an operator's deregistration to make sure the operator's stake at deregistration is slashable until serveUntil
removes the middleware's slashing contract to the operator's linked list and revokes the middleware's (i.e. caller's) ability to slash operator
once serveUntil
is reached
Parameters
Name | Type | Description |
---|---|---|
|
| the operator whose stake update is being recorded |
|
| the block until which the operator's stake at the current block is slashable |
strategyManager
The StrategyManager contract of EigenLayer
delegation
The DelegationManager contract of EigenLayer
isFrozen
Used to determine whether staker
is actively 'frozen'. If a staker is frozen, then they are potentially subject to slashing of their funds, and cannot cannot deposit or withdraw from the strategyManager until the slashing process is completed and the staker's status is reset (to 'unfrozen').
Parameters
Name | Type | Description |
---|---|---|
|
| The staker of interest. |
Returns
Name | Type | Description |
---|---|---|
|
| Returns 'true' if |
canSlash
Returns true if slashingContract
is currently allowed to slash toBeSlashed
.
contractCanSlashOperatorUntilBlock
Returns the block until which serviceContract
is allowed to slash the operator
.
latestUpdateBlock
Returns the block at which the serviceContract
last updated its view of the operator
's stake
getCorrectValueForInsertAfter
A search routine for finding the correct input value of insertAfter
to recordStakeUpdate
/ _updateMiddlewareList
.
canWithdraw
Returns 'true' if operator
can currently complete a withdrawal started at the withdrawalStartBlock
, with middlewareTimesIndex
used to specify the index of a MiddlewareTimes
struct in the operator's list (i.e. an index in operatorToMiddlewareTimes[operator]
). The specified struct is consulted as proof of the operator
's ability (or lack thereof) to complete the withdrawal. This function will return 'false' if the operator cannot currently complete a withdrawal started at the withdrawalStartBlock
, or in the event that an incorrect middlewareTimesIndex
is supplied, even if one or more correct inputs exist.
The correct middlewareTimesIndex
input should be computable off-chain.
Parameters
Name | Type | Description |
---|---|---|
|
| Either the operator who queued the withdrawal themselves, or if the withdrawing party is a staker who delegated to an operator, this address is the operator who the staker was delegated to at the time of the |
|
| The block number at which the withdrawal was initiated. |
|
| Indicates an index in |
operatorToMiddlewareTimes
operator => [ ( the least recent update block of all of the middlewares it's serving/served, latest time that the stake bonded at that update needed to serve until ) ]
middlewareTimesLength
Getter function for fetching operatorToMiddlewareTimes[operator].length
getMiddlewareTimesIndexStalestUpdateBlock
Getter function for fetching operatorToMiddlewareTimes[operator][index].stalestUpdateBlock
.
getMiddlewareTimesIndexServeUntilBlock
Getter function for fetching operatorToMiddlewareTimes[operator][index].latestServeUntil
.
operatorWhitelistedContractsLinkedListSize
Getter function for fetching _operatorToWhitelistedContractsByUpdate[operator].size
.
operatorWhitelistedContractsLinkedListEntry
Getter function for fetching a single node in the operator's linked list (_operatorToWhitelistedContractsByUpdate[operator]
).
Events
MiddlewareTimesAdded
Emitted when a middleware times is added to operator
's array.
OptedIntoSlashing
Emitted when operator
begins to allow contractAddress
to slash them.
SlashingAbilityRevoked
Emitted when contractAddress
signals that it will no longer be able to slash operator
after the contractCanSlashOperatorUntilBlock
.
OperatorFrozen
Emitted when slashingContract
'freezes' the slashedOperator
.
The slashingContract
must have permission to slash the slashedOperator
, i.e. canSlash(slasherOperator, slashingContract)
must return 'true'.
FrozenStatusReset
Emitted when previouslySlashedAddress
is 'unfrozen', allowing them to again move deposited funds within EigenLayer.
Structs
MiddlewareTimes
struct used to store information about the current state of an operator's obligations to middlewares they are serving
MiddlewareDetails
struct used to store details relevant to a single middleware that an operator has opted-in to serving
Last updated