Skip to content

Commit

Permalink
feat: change event names
Browse files Browse the repository at this point in the history
feat: update doc

fix: compile

test: AllocationManager progress

fix: tests progress

add Strategy <> OperatorSet mapping in storage, and APIs and events (#814)

* feat: add strategy to operator set mapping with corresponding functions and events

* fix: update

* fix: remove pagination of getStrategiesInOperatorSet

* fix: update

* fix: compiles

* fix: add checks

* fix: address -> IStrategy

* fix: storage gap

---------

Co-authored-by: gpsanant <gpsanant@gmail.com>

Slashing: DM Happy Path Test Cases (#815)

* test: basic dm tests

* test: start on share increase/decrease delegated shares tests

* test: add DM unit tests passing except queue/complete

* test: undelegate tests

* test: queue withdrawals

* test: completed DM happy path test cases

* fix: compilation, rebase errors

* chore: format

Add view funcs (#816)

* fix: add new view funcs

* fix: update docs

test: fix avsD tests (#817)

chore: format

fix: from scratch deploy

feat: add shares to slashing event

Slashing: Modify Allocations Happy Path Tests (#821)

* refactor: add test contract per func

* test: modify allocations

* chore: format

slashing: allocation delay happy path tests (#822)

feat: wadSlashed (#820)

Slashing: Clear Modification Queue Happy Path Tests (#823)

test: basic allocation tests (#824)

feat: inheritdoc

refactor: alm test cleanup

test: multiple allocations, only one slashed

test: one pending alloc, slash

test: revert bound refactor so tests pass

Slashing: Add additional happy path AM test cases (#828)

* test: happy path AM tests

* chore: format

Slashing: Get all tests passing (#829)

* test: all tests passing

* fix: mainnet integration test comment out

Fix misset storage gaps (#831)

* fix: misset storage gaps from #814

* fix: update gap to account for previous refactor

fix: update coverage yml name (#833)

Fix: Single Deallocation Queue (#827)

* test: base regression

* test: regression

* fix: remove console

* test: logs

* test: add actual regression

* fix: use a single deallocation queue

* fix: comments

* refactor: use deallocation queue everywhere

* fix: address test comments

* fix: test comment

Feat: Update legacy withdrawal timestamp param to legacy withdrawal check (#836)

* fix: make comment on timestamp clearer

* chore: format

Feat: Public Devnet Deploy (#838)

* feat: slashing public devnet

* fix: filepath

* test: validation

* fix: add test

* fix: test
  • Loading branch information
gpsanant authored and ypatil12 committed Oct 17, 2024
1 parent b88286e commit 41a9956
Show file tree
Hide file tree
Showing 48 changed files with 6,919 additions and 2,989 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

run-tests:
run-coverage:
needs: prepare
runs-on: ubuntu-latest
strategy:
Expand Down
56 changes: 35 additions & 21 deletions docs/release/slashing/AllocationManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ The AllocationManager contract manages the allocation and reallocation of operat
- `ALLOCATION_CONFIGURATION_DELAY`: The delay in seconds before allocations take effect.
- Mainnet: `21 days`. Very TBD
- Testnet: `1 hour`. Very TBD
- Public Devnet: `10 minutes`
- `DEALLOCATION_DELAY`: The delay in seconds before deallocations take effect.
- Mainnet: `17.5 days`. Slightly TBD
- Testnet: `3 days`. Very TBD
- Public Devnet: `1 days`

## `setAllocationDelay`

Expand Down Expand Up @@ -81,52 +83,64 @@ Any _allocations_ (i.e. increases in the proportion of slashable stake allocated

Any _deallocations_ (i.e. decreases in the proportion of slashable stake allocated to an AVS) take after `DEALLOCATION_DELAY` seconds. This enables AVSs enough time to update their view of stakes to the new proportions and have any tasks created against previous stakes to expire.

## `clearPendingModifications`
## `clearDeallocationQueue`

```solidity
/**
* @notice This function takes a list of strategies and adds all completable modifications for each strategy,
* @notice This function takes a list of strategies and adds all completable deallocations for each strategy,
* updating the encumberedMagnitude of the operator as needed.
*
* @param operator address to complete modifications for
* @param strategies a list of strategies to complete modifications for
* @param numToClear a list of number of pending modifications to complete for each strategy
* @param operator address to complete deallocations for
* @param strategies a list of strategies to complete deallocations for
* @param numToComplete a list of number of pending deallocations to complete for each strategy
*
* @dev can be called permissionlessly by anyone
*/
function clearModificationQueue(
function clearDeallocationQueue(
address operator,
IStrategy[] calldata strategies,
uint16[] calldata numToClear
uint16[] calldata numToComplete
) external;
```

This function is used to complete pending modifications for a list of strategies for an operator. The function takes a list of strategies and the number of pending modifications to complete for each strategy. For each strategy, the function completes a modification if its effect timestamp has passed.

Completing an allocation doesn't have any material change to the protocol other than cleaning up some state and increasing code readability.
This function is used to complete pending deallocations for a list of strategies for an operator. The function takes a list of strategies and the number of pending deallocations to complete for each strategy. For each strategy, the function completes a modification if its effect timestamp has passed.

Completing a deallocation decreases the encumbered magnitude for the strategy, allowing them to make allocations with that magnitude. Encumbered magnitude must be decreased only upon completion because pending deallocations can be slashed before they are completable.

## `slashOperator`

```solidity
/**
* @notice Called by an AVS to slash an operator for given operatorSetId, list of strategies, and bipsToSlash.
* @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 wadToSlash 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 wadToSlash;
string description;
}
/**
* @notice Called by an AVS to slash an operator for given operatorSetId, list of strategies, and wadToSlash.
* For each given (operator, operatorSetId, strategy) tuple, bipsToSlash
* bips of the operatorSet's slashable stake allocation will be slashed
*
* @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 wadToSlash the parts in 1e18 to slash, this will be proportional to the
* @param description the description of the slashing provided by the AVS for legibility
* operator's slashable stake allocation for the operatorSet
* @param description the description of the slashing provided by the AVS for legibility
*/
function slashOperator(
address operator,
uint32 operatorSetId,
IStrategy[] calldata strategies,
uint256 wadToSlash
SlashingParams calldata params
) external
```

Expand All @@ -143,21 +157,21 @@ Slashing updates storage in a way that instantly updates all view functions to r
```solidity
/**
* @notice returns the minimum operatorShares and the slashableOperatorShares for an operator, list of strategies,
* and an operatorSet before a given timestamp
* @param operator the operator to get the shares for
* and an operatorSet before a given timestamp. This is used to get the shares to weight operators by given ones slashing window.
* @param operatorSet the operatorSet to get the shares for
* @param operators the operators to get the shares for
* @param strategies the strategies to get the shares for
* @param beforeTimestamp the timestamp to get the shares at
*/
function getMinDelegatedAndSlashableOperatorShares(
address operator,
OperatorSet calldata operatorSet,
address[] calldata operators,
IStrategy[] calldata strategies,
uint32 beforeTimestamp
) external view returns (uint256[] memory, uint256[] memory);
) external view returns (uint256[][] memory, uint256[][] memory)
```

This function returns the minimum operator shares and the slashable operator shares for an operator, list of strategies, and an operator set before a given timestamp. This is used by AVSs to pessimistically estimate the operator's slashable stake allocation for a given strategy and operator set within their slashability windows.
This function returns the minimum operator shares and the slashable operator shares for an operator, list of strategies, and an operator set before a given timestamp. This is used by AVSs to pessimistically estimate the operator's slashable stake allocation for a given strategy and operator set within their slashability windows. If an AVS calls this function every week and creates tasks that are slashable for a week after they're created, then `beforeTimestamp` should be 2 weeks in the future to account for the latest task that may be created against stale stakes. More on this in new docs soon.

### Additional View Functions

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"multisig_addresses": {
"operationsMultisig": "0xBB37b72F67A410B76Ce9b9aF9e37aa561B1C5B07",
"communityMultisig": "0xBB37b72F67A410B76Ce9b9aF9e37aa561B1C5B07",
"pauserMultisig": "0xBB37b72F67A410B76Ce9b9aF9e37aa561B1C5B07",
"executorMultisig": "0xBB37b72F67A410B76Ce9b9aF9e37aa561B1C5B07",
"timelock": "0xBB37b72F67A410B76Ce9b9aF9e37aa561B1C5B07"
},
"strategyManager": {
"init_paused_status": 0,
"init_withdrawal_delay_blocks": 1
},
"eigenPod": {
"PARTIAL_WITHDRAWAL_FRAUD_PROOF_PERIOD_BLOCKS": 1,
"MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR": "32000000000"
},
"eigenPodManager": {
"init_paused_status": 115792089237316195423570985008687907853269984665640564039457584007913129639935
},
"slasher": {
"init_paused_status": 0
},
"delegation": {
"init_paused_status": 0,
"init_withdrawal_delay_blocks": 1
},
"rewardsCoordinator": {
"init_paused_status": 115792089237316195423570985008687907853269984665640564039457584007913129639935,
"CALCULATION_INTERVAL_SECONDS": 604800,
"MAX_REWARDS_DURATION": 6048000,
"MAX_RETROACTIVE_LENGTH": 7776000,
"MAX_FUTURE_LENGTH": 2592000,
"GENESIS_REWARDS_TIMESTAMP": 1710979200,
"rewards_updater_address": "0xBB37b72F67A410B76Ce9b9aF9e37aa561B1C5B07",
"activation_delay": 7200,
"calculation_interval_seconds": 604800,
"global_operator_commission_bips": 1000,
"OPERATOR_SET_GENESIS_REWARDS_TIMESTAMP": 1720656000,
"OPERATOR_SET_MAX_RETROACTIVE_LENGTH": 2592000
},
"allocationManager": {
"init_paused_status": 0,
"DEALLOCATION_DELAY": 86400,
"ALLOCATION_CONFIGURATION_DELAY": 600
},
"ethPOSDepositAddress": "0x4242424242424242424242424242424242424242"
}
2 changes: 1 addition & 1 deletion script/configs/local/deploy_from_scratch.anvil.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"allocationManager": {
"init_paused_status": 0,
"DEALLOCATION_DELAY": 900,
"ALLOCATION_DELAY_CONFIGURATION_DELAY": 1200
"ALLOCATION_CONFIGURATION_DELAY": 1200
},
"ethPOSDepositAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa"
}
Loading

0 comments on commit 41a9956

Please sign in to comment.