Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update docs for slashing #709

Open
wants to merge 10 commits into
base: add-docs-2
Choose a base branch
from
Open

docs: update docs for slashing #709

wants to merge 10 commits into from

Conversation

8sunyuan
Copy link
Collaborator

@8sunyuan 8sunyuan commented Aug 26, 2024

Tentative plan is to include OperatorSets and Slashing releases as one combined release. This PR is for updating docs to latest interfaces and combining files

INCOMPLETE:
middleware ServiceManagerBase with migration functions

* @return slashableBips the slashable bips of the given strategy owned by
* the given OperatorSet for the given operator and timestamp
*/
function getSlashableBips(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo we should just return parts per 1e18 that the AVS is allowed to slash. rounding with bips just too sketch

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverts if

1. The `operatorSignature` is invalid or `msg.sender` is not the `operator`
2. The sum of all magnitude allocations for a IStrategy is greater than the free magnitude that is available to allocate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make sure all the revert conditions are here? should add

any of the operatorSets do not exist in the AVSD

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @param registered whether the operator is registered with the operator set
* @param lastDeregisteredTimestamp the timestamp at which the operator was last deregistered
*/
struct OperatorSetRegistrationStatus {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to operator-sets.md imo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


### modifyAllocations

Operators call this to set the proportions of slashable stake allocated to a list of operatorSets for a set of strategies. Depending on what the new magnitude/proportion and current magnitude value is configured to, this will either create a pending allocation or deallocation. Allocations by default have a delay of 21 days but can be one-time configured by an operator. Deallocation delays all have a built-in delay of 17.5 days until they can be "completed". There is a "completing" second step to deallocations that must take place to account for the fact that deallocations are still susceptible to slashing by the operatorSet up until the completeableTimestamp for the deallocation has passed. Pending allocations on the other hand are not slashable (referring to the added increase in magnitude).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to mention completion imo. just say that after allocation/deallocation delays have passed they automatically take effect.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1. if a `MagnitudeAllocation` results in a value greater than the current magnitude, `MagnitudeAllocated` is emitted for the given (operator, IStrategy, operatorSet)
2. if a `MagnitudeAllocation` results in a value less than the current magnitude,
`MagnitudeDeallocated` is emitted for the given (operator, IStrategy, operatorSet)
3.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks messed up

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

25d410d
Take 2?


### modifyAllocations

Operators call this to set the proportions of slashable stake allocated to a list of operatorSets for a set of strategies. Depending on what the new magnitude/proportion and current magnitude value is configured to, this will either create a pending allocation or deallocation. Allocations by default have a delay of 21 days but can be one-time configured by an operator. Deallocation delays all have a built-in delay of 17.5 days until they can be "completed". There is a "completing" second step to deallocations that must take place to account for the fact that deallocations are still susceptible to slashing by the operatorSet up until the completeableTimestamp for the deallocation has passed. Pending allocations on the other hand are not slashable (referring to the added increase in magnitude).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be no default allocation delay. configutation is blocking allcoation modification.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are going with configurable delays but I specified here that a initial delay is required to call modifyAllocations

8sunyuan and others added 5 commits August 28, 2024 10:25
Copy link

Reading tracefile ./lcov.info.pruned
                                             |Lines      |Functions|Branches  
Filename                                       |Rate    Num|Rate  Num|Rate   Num
================================================================================
[src/contracts/]
core/AVSDirectory.sol                          |92.6%    54| 100%  15|    -    0
core/DelegationManager.sol                     |96.5%   198|92.3%  39|    -    0
core/RewardsCoordinator.sol                    |92.4%   119|84.4%  32|    -    0
core/StrategyManager.sol                       |97.6%    83| 100%  24|    -    0
libraries/BeaconChainProofs.sol                |94.7%    38|91.7%  12|    -    0
libraries/BytesLib.sol                         | 2.6%   156| 7.1%  14|    -    0
libraries/EIP1271SignatureUtils.sol            | 100%     3| 100%   1|    -    0
libraries/Endian.sol                           | 100%     2| 100%   1|    -    0
libraries/Merkle.sol                           | 100%    38| 100%   5|    -    0
libraries/StructuredLinkedList.sol             | 0.0%    45| 0.0%  19|    -    0
permissions/Pausable.sol                       |95.7%    23|90.9%  11|    -    0
permissions/PauserRegistry.sol                 | 100%    12| 100%   6|    -    0
pods/DelayedWithdrawalRouter.sol               |98.3%    59|92.9%  14|    -    0
pods/EigenPod.sol                              | 100%   145| 100%  33|    -    0
pods/EigenPodManager.sol                       | 100%    84|94.7%  19|    -    0
strategies/EigenStrategy.sol                   | 0.0%    10| 0.0%   5|    -    0
strategies/StrategyBase.sol                    |89.7%    39|77.8%  18|    -    0
strategies/StrategyBaseTVLLimits.sol           | 100%    12| 100%   6|    -    0
token/BackingEigen.sol                         |80.0%    25|60.0%  10|    -    0
token/Eigen.sol                                |43.6%    39|58.3%  12|    -    0
utils/UpgradeableSignatureCheckingUtils.sol    | 0.0%     6| 0.0%   4|    -    0
================================================================================
                                       Total:|77.3%  1190|78.0% 300|    -    0

2 similar comments
Copy link

Reading tracefile ./lcov.info.pruned
                                             |Lines      |Functions|Branches  
Filename                                       |Rate    Num|Rate  Num|Rate   Num
================================================================================
[src/contracts/]
core/AVSDirectory.sol                          |92.6%    54| 100%  15|    -    0
core/DelegationManager.sol                     |96.5%   198|92.3%  39|    -    0
core/RewardsCoordinator.sol                    |92.4%   119|84.4%  32|    -    0
core/StrategyManager.sol                       |97.6%    83| 100%  24|    -    0
libraries/BeaconChainProofs.sol                |94.7%    38|91.7%  12|    -    0
libraries/BytesLib.sol                         | 2.6%   156| 7.1%  14|    -    0
libraries/EIP1271SignatureUtils.sol            | 100%     3| 100%   1|    -    0
libraries/Endian.sol                           | 100%     2| 100%   1|    -    0
libraries/Merkle.sol                           | 100%    38| 100%   5|    -    0
libraries/StructuredLinkedList.sol             | 0.0%    45| 0.0%  19|    -    0
permissions/Pausable.sol                       |95.7%    23|90.9%  11|    -    0
permissions/PauserRegistry.sol                 | 100%    12| 100%   6|    -    0
pods/DelayedWithdrawalRouter.sol               |98.3%    59|92.9%  14|    -    0
pods/EigenPod.sol                              | 100%   145| 100%  33|    -    0
pods/EigenPodManager.sol                       | 100%    84|94.7%  19|    -    0
strategies/EigenStrategy.sol                   | 0.0%    10| 0.0%   5|    -    0
strategies/StrategyBase.sol                    |89.7%    39|77.8%  18|    -    0
strategies/StrategyBaseTVLLimits.sol           | 100%    12| 100%   6|    -    0
token/BackingEigen.sol                         |80.0%    25|60.0%  10|    -    0
token/Eigen.sol                                |43.6%    39|58.3%  12|    -    0
utils/UpgradeableSignatureCheckingUtils.sol    | 0.0%     6| 0.0%   4|    -    0
================================================================================
                                       Total:|77.3%  1190|78.0% 300|    -    0

Copy link

Reading tracefile ./lcov.info.pruned
                                             |Lines      |Functions|Branches  
Filename                                       |Rate    Num|Rate  Num|Rate   Num
================================================================================
[src/contracts/]
core/AVSDirectory.sol                          |92.6%    54| 100%  15|    -    0
core/DelegationManager.sol                     |96.5%   198|92.3%  39|    -    0
core/RewardsCoordinator.sol                    |92.4%   119|84.4%  32|    -    0
core/StrategyManager.sol                       |97.6%    83| 100%  24|    -    0
libraries/BeaconChainProofs.sol                |94.7%    38|91.7%  12|    -    0
libraries/BytesLib.sol                         | 2.6%   156| 7.1%  14|    -    0
libraries/EIP1271SignatureUtils.sol            | 100%     3| 100%   1|    -    0
libraries/Endian.sol                           | 100%     2| 100%   1|    -    0
libraries/Merkle.sol                           | 100%    38| 100%   5|    -    0
libraries/StructuredLinkedList.sol             | 0.0%    45| 0.0%  19|    -    0
permissions/Pausable.sol                       |95.7%    23|90.9%  11|    -    0
permissions/PauserRegistry.sol                 | 100%    12| 100%   6|    -    0
pods/DelayedWithdrawalRouter.sol               |98.3%    59|92.9%  14|    -    0
pods/EigenPod.sol                              | 100%   145| 100%  33|    -    0
pods/EigenPodManager.sol                       | 100%    84|94.7%  19|    -    0
strategies/EigenStrategy.sol                   | 0.0%    10| 0.0%   5|    -    0
strategies/StrategyBase.sol                    |89.7%    39|77.8%  18|    -    0
strategies/StrategyBaseTVLLimits.sol           | 100%    12| 100%   6|    -    0
token/BackingEigen.sol                         |80.0%    25|60.0%  10|    -    0
token/Eigen.sol                                |43.6%    39|58.3%  12|    -    0
utils/UpgradeableSignatureCheckingUtils.sol    | 0.0%     6| 0.0%   4|    -    0
================================================================================
                                       Total:|77.3%  1190|78.0% 300|    -    0

gpsanant
gpsanant previously approved these changes Aug 28, 2024
gpsanant
gpsanant previously approved these changes Aug 28, 2024
Copy link

Reading tracefile ./lcov.info.pruned
                                             |Lines      |Functions|Branches  
Filename                                       |Rate    Num|Rate  Num|Rate   Num
================================================================================
[src/contracts/]
core/AVSDirectory.sol                          |92.6%    54| 100%  15|    -    0
core/DelegationManager.sol                     |96.5%   198|92.3%  39|    -    0
core/RewardsCoordinator.sol                    |92.4%   119|84.4%  32|    -    0
core/StrategyManager.sol                       |97.6%    83| 100%  24|    -    0
libraries/BeaconChainProofs.sol                |94.7%    38|91.7%  12|    -    0
libraries/BytesLib.sol                         | 2.6%   156| 7.1%  14|    -    0
libraries/EIP1271SignatureUtils.sol            | 100%     3| 100%   1|    -    0
libraries/Endian.sol                           | 100%     2| 100%   1|    -    0
libraries/Merkle.sol                           | 100%    38| 100%   5|    -    0
libraries/StructuredLinkedList.sol             | 0.0%    45| 0.0%  19|    -    0
permissions/Pausable.sol                       |95.7%    23|90.9%  11|    -    0
permissions/PauserRegistry.sol                 | 100%    12| 100%   6|    -    0
pods/DelayedWithdrawalRouter.sol               |98.3%    59|92.9%  14|    -    0
pods/EigenPod.sol                              | 100%   145| 100%  33|    -    0
pods/EigenPodManager.sol                       | 100%    84|94.7%  19|    -    0
strategies/EigenStrategy.sol                   | 0.0%    10| 0.0%   5|    -    0
strategies/StrategyBase.sol                    |89.7%    39|77.8%  18|    -    0
strategies/StrategyBaseTVLLimits.sol           | 100%    12| 100%   6|    -    0
token/BackingEigen.sol                         |80.0%    25|60.0%  10|    -    0
token/Eigen.sol                                |43.6%    39|58.3%  12|    -    0
utils/UpgradeableSignatureCheckingUtils.sol    | 0.0%     6| 0.0%   4|    -    0
================================================================================
                                       Total:|77.3%  1190|78.0% 300|    -    0

#### **finalizeMigration**

Only callable by ServiceManager contract owner, this will mark the AVS ServiceManager contract as fully migrated and prevents any future calls to `migrateToOperatorSets`.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert

Reverts If:

Copy link

Reading tracefile ./lcov.info.pruned
                                             |Lines      |Functions|Branches  
Filename                                       |Rate    Num|Rate  Num|Rate   Num
================================================================================
[src/contracts/]
core/AVSDirectory.sol                          |92.6%    54| 100%  15|    -    0
core/DelegationManager.sol                     |96.5%   198|92.3%  39|    -    0
core/RewardsCoordinator.sol                    |92.4%   119|84.4%  32|    -    0
core/StrategyManager.sol                       |97.6%    83| 100%  24|    -    0
libraries/BeaconChainProofs.sol                |94.7%    38|91.7%  12|    -    0
libraries/BytesLib.sol                         | 2.6%   156| 7.1%  14|    -    0
libraries/EIP1271SignatureUtils.sol            | 100%     3| 100%   1|    -    0
libraries/Endian.sol                           | 100%     2| 100%   1|    -    0
libraries/Merkle.sol                           | 100%    38| 100%   5|    -    0
libraries/StructuredLinkedList.sol             | 0.0%    45| 0.0%  19|    -    0
permissions/Pausable.sol                       |95.7%    23|90.9%  11|    -    0
permissions/PauserRegistry.sol                 | 100%    12| 100%   6|    -    0
pods/DelayedWithdrawalRouter.sol               |98.3%    59|92.9%  14|    -    0
pods/EigenPod.sol                              | 100%   145| 100%  33|    -    0
pods/EigenPodManager.sol                       | 100%    84|94.7%  19|    -    0
strategies/EigenStrategy.sol                   | 0.0%    10| 0.0%   5|    -    0
strategies/StrategyBase.sol                    |89.7%    39|77.8%  18|    -    0
strategies/StrategyBaseTVLLimits.sol           | 100%    12| 100%   6|    -    0
token/BackingEigen.sol                         |80.0%    25|60.0%  10|    -    0
token/Eigen.sol                                |43.6%    39|58.3%  12|    -    0
utils/UpgradeableSignatureCheckingUtils.sol    | 0.0%     6| 0.0%   4|    -    0
================================================================================
                                       Total:|77.3%  1190|78.0% 300|    -    0

* @param isSet whether the allocation delay is set. Can only be configured one time for each operator
* @param allocationDelay the delay in seconds for the operator's allocations
*/
struct AllocationDelayDetails {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add todo to add this to DM docs

@@ -63,12 +53,16 @@ interface IAVSDirectory {
/// EXTERNAL - STATE MODIFYING

/**
* @notice Modifies the proportions of slashable stake allocated to a list of operatorSets for a set of strategies
* @notice Modifies the propotions of slashable stake allocated to a list of operatorSets for a set of strategies
* This will revert if the operator has never set their allocationDelay before.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dev this

* @dev Updates freeMagnitude for the updated strategies
* @dev Must be called by the operator or with a valid operator signature
* @dev For each allocation, allocation.operatorSets MUST be ordered in ascending order according to the
* encoding of the operatorSet. This is to prevent duplicate operatorSets being passed in. The easiest way to ensure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ew, this is kind of gross to handle offchain, @shrimalmadhur what would you prefer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also have to think about LRT or every other client using this directly. I think this should be baked in solidity if possible - otherwise every other thing built on top has to think about it.

@@ -150,11 +146,11 @@ interface IAVSDirectory {

### modifyAllocations

Operators call this to set the proportions of slashable stake allocated to a list of operatorSets for a set of strategies. Depending on what the new magnitude/proportion and current magnitude value is configured to, this will either create a pending allocation or deallocation. Allocations by default have a delay of 21 days but can be one-time configured by an operator. Deallocation delays all have a built-in delay of 17.5 days until they can be "completed". There is a "completing" second step to deallocations that must take place to account for the fact that deallocations are still susceptible to slashing by the operatorSet up until the completeableTimestamp for the deallocation has passed. Pending allocations on the other hand are not slashable (referring to the added increase in magnitude).
Operators call this to set the proportions of slashable stake allocated to a list of operatorSets for a set of strategies. Depending on what the new magnitude/proportion and current magnitude value is configured to, this will either create a pending allocation or deallocation. Allocation delays can be configured by operators but setting a new value itself has a delay of 21 days. Deallocation delays all have a built-in delay of 17.5 days until they take effect. Deallocations are still susceptible to slashing by the operatorSet up until they take effect. Pending allocations on the other hand are not slashable (referring to the added increase in magnitude).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really want a 21 day delay on the first setting?

Copy link
Contributor

@gpsanant gpsanant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine for now, few protocol questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants