Skip to content

Conversation

0xClandestine
Copy link
Member

@0xClandestine 0xClandestine commented May 22, 2025

Motivation:

Current implementation is broken by rebase tokens.

Modifications:

  • Rename SWR -> SlashEscrowFactory.
  • Add factory logic that deploys clones unique to their slash ID.

Result:

Funds will now be stored in clone contracts unique to their slash ID.

wip

wip

wip

wip
@0xClandestine 0xClandestine changed the base branch from main to release-dev/redistribution May 22, 2025 17:08
@0xClandestine 0xClandestine changed the title feat(draft): AllocationManager redistribution support (#1346) feat: escrow funds in unique clone contracts May 22, 2025
@0xClandestine 0xClandestine requested a review from ypatil12 May 22, 2025 18:04
@0xClandestine
Copy link
Member Author

targets #1355

@0xClandestine 0xClandestine merged commit 63629ef into release-dev/redistribution May 23, 2025
5 of 14 checks passed
@0xClandestine 0xClandestine deleted the feat/escrow-clones-2 branch May 23, 2025 15:31
0xClandestine added a commit that referenced this pull request May 27, 2025
**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.
ypatil12 pushed a commit that referenced this pull request May 28, 2025
**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format
ypatil12 pushed a commit that referenced this pull request May 28, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format
ypatil12 pushed a commit that referenced this pull request May 28, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format
ypatil12 pushed a commit that referenced this pull request May 28, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format
ypatil12 pushed a commit that referenced this pull request May 29, 2025
**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

feat: redistribution upgrade scripts

chore: remove added code

fix: epm paused status for sepolia

chore: format

fix: typo

Co-authored-by: bowenli86 <[email protected]>
ypatil12 pushed a commit that referenced this pull request May 29, 2025
**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

feat: redistribution upgrade scripts

chore: remove added code

fix: epm paused status for sepolia

chore: format

fix: typo

Co-authored-by: bowenli86 <[email protected]>
ypatil12 pushed a commit that referenced this pull request May 29, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format
ypatil12 pushed a commit that referenced this pull request May 29, 2025
**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

feat: redistribution upgrade scripts

chore: remove added code

fix: epm paused status for sepolia

chore: format

fix: typo

Co-authored-by: bowenli86 <[email protected]>
ypatil12 pushed a commit that referenced this pull request May 30, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format

chore: build

chore: update for clear

chore: format

chore: draft

chore: changelog

chore: ref elip-006

chore: org

chore: typo

chore: add links to changelog

chore: push

fix: compile
ypatil12 pushed a commit that referenced this pull request May 30, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format

chore: build

chore: update for clear

chore: format

chore: draft

chore: changelog

chore: ref elip-006

chore: org

chore: typo

chore: add links to changelog

chore: push

fix: compile
ypatil12 pushed a commit that referenced this pull request May 30, 2025
**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

feat: redistribution upgrade scripts

chore: remove added code

fix: epm paused status for sepolia

chore: format

fix: typo

Co-authored-by: bowenli86 <[email protected]>
ypatil12 pushed a commit that referenced this pull request May 30, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format

chore: build

chore: update for clear

chore: format

chore: draft

chore: changelog

chore: ref elip-006

chore: org

chore: typo

chore: add links to changelog

chore: push

fix: compile
ypatil12 pushed a commit that referenced this pull request May 30, 2025
**Motivation:**

Add support for redistributing slashed funds to specified recipients
instead of burning them, while optimizing code size and improving test
coverage.

**Modifications:**

Added a new redistribution system that allows AVSs to specify recipients
for slashed funds. Code optimizations were made to reduce codesize,
including consolidating repeated logic and a small
`PermissionControllerMixin` refactor.

**Result:**

Slashed funds can now be redirected to specified recipients instead of
being burned, with improved code efficiency and test coverage.

feat: simplify removeDepositShares in StrategyManager (#1373)

**Motivation:**

the _removeDepositShares() returns a bool which is not of any meaning.
simplify removeDepositShares in StrategyManager by removing that
returned value

**Modifications:**

simplify _removeDepositShares() by removing returned extra bool

**Result:**

_removeDepositShares() is simplified and binary size is reduced

feat: add `SlashingWithdrawalRouter` (#1358)

**Motivation:**

We want to hold slashed funds in escrow temporarily to maintain protocol
security (prevent malicious actors from draining the contracts).

**Modifications:**

- Add `SlashingWithdrawalRouter`.

**Result:**

The `SlashingWithdrawalRouter` contract is added for managing slashed
funds in the EigenLayer protocol. It provides a mechanism to handle the
burning or redistribution of slashed shares after a delay period,
ensuring proper handling of slashed funds while maintaining protocol
security.

---------

Co-authored-by: Yash Patil <[email protected]>

test(redistribution): add unit tests  (#1383)

**Motivation:**

We want to ensure `SlashingWithdrawalRouter` has appropriate unit test
coverage.

**Modifications:**

- Add more unit tests.

**Result:**

90% coverage.

refactor: remove `v` prefix from `SemVerMixin` (#1385)

**Motivation:**

Slashing was deployed with using a `v` prefix, thus we're simply going
to drop the prefix moving forward.

**Modifications:**

Prefix removed, and tests updated.

**Result:**

SemVerMixin no longer requires a `v` prefix.

feat: escrow funds in unique clone contracts (#1387)

**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.

fix: review issues (#1391)

**Motivation:**

We want to resolve any review issues that arise.

**Modifications:**

- Use larger of strategy or global delay: @non-fungible-nelson
- Fix storage overrides noted from `Deprecated_OwnableUpgradeable`
@wadealexc
- Use `EnumerableSet` instead of `EnumerableSetUpgradaeable` since it
doesn't contain storage
- Add missing event in `initialize()`.
- Prevent `address(0)` during `createRedistributableOperatorSets` for
event sanitation.
- Improve check legibility @wadealexc

**Result:**

Current review concerns have been addressed.

fix: storage checker (#1394)

**Motivation:**

Storage checker didn't have ALM added. Also we needed to fix the
deprecated ownable mixing.

**Modifications:**

Fix mixing to inherit from `ContextUpgradeable`. Add ALM to
storage-diff.json.

**Result:**

Correct storage checks.

---------

Co-authored-by: Yash Patil <[email protected]>

chore: use internal getters; update `isOperatorRedistributable` (#1401)

**Motivation:**

We want to use internal getters wherever possible for style.

**Modifications:**

- Use `getRedistributionRecipient` in `isOperatorRedistributable`
- Update `isOperatorRedistributable` to get all allocated/registered
sets and then check if slashable and redistributable set for each
- More comprehensive unit tests

**Result:**

Cleaner code + tests passing

chore: rename burnable -> burnOrRedistributable; fix storage gap; remove poc code (#1397)

**Motivation:**

Burn shares naming is confusing, since shares are burnOrRedistributable

**Modifications:**

- For the new withdrawal path, call it `burnOrRedistributable`, so
`burnOrRedistributableSharesIncreased` or
`burnOrRedistributableSharesDecreased`
- Bring back `burnableSharesDecreased` event for the legacy burn path
- Rename `_operatorSetBurnableShares` to `_burnOrRedistributableShares`
- Fix the storage gap, since `_burnOrRedistributableShares` is a mapping
pointing to an enumerable map, not an enumerable map
- Remove POC withdrawal queue code from the DM

**Result:**

Cleaner Redistribution code

chore: remove dm/alm code size optimizations (#1398)

**Motivation:**

We have several code size optimizations in the DM/ALM. These are not
needed anymore with the ownable deprecation. We can add in future
upgrade if we want.

**Modifications:**

Remove all internal `_check` and modifiers.

Make `slashOperatorShares` in the DM return to the original
non-arrayified method.

**Result:**

Smaller code diff for redistribution.

test: full coverage `SlashEscrowFactory` + `SlashEscrow` (#1403)

**Motivation:**

We want to ensure we have full coverage unit tests for
`SlashEscrowFactory` and `SlashEscrow` in preparation for audits.

**Modifications:**

- Adds checks for all view methods.

**Result:**

Brings coverage up to 100% for all branches/fns/etc.

chore: decrease dm diff further  (#1404)

**Motivation:**

We want to minimize the diff between slashing.

**Modifications:**

Revert calldata/memory types in DM.

**Result:**

Smaller diff

fix: enumerable map overwrite (#1399)

**Motivation:**

Currently, there's a bug in the `SM` where if you loop through the
burnable shares queue, you may not clear all due to swap and pop of an
Enumerable Map. Furthermore, we also are constrained by a token transfer
taking too much gas and blocking transfer out of funds.

**Modifications:**

- Iterate backwards on `decreaseBurnOrRedistributableShares `
- Overloaded `decreaseBurnableShares` with a version to pass in an
index. This function will escrow a single share (called by above too).
Now, we do not need a max strategy per opSet requirement
- Unit tests for both `increaseBurnOrRedistributableShares` and
`decreaseBurnOrRedistributableShares`
- Added the following introspection:
-- `getBurnOrRedistributableShares(operatorSet, slashId) returns
(Strategy[] Strats, uint256[] shares)
-- `getBurnOrRedistributableShares(operatorSet, slashId, strategy)
returns (shares)
-- `getBurnOrRedistributableCount(operaotrSet, slashed) returns (count)`

**Result:**

Correct code with unit tests

feat: simplify escrow delay; add convenience functions (#1406)

**Motivation:**

The escrow delay currently always you to complete escrows for a portion
of strategies if there exists a strategy with a larger delay. This makes
our codebase more complex. We also want to have a view function for
offchain cronjob that needs to be called only once.

**Modifications:**

- Update `releaseEscrow` to obey the maximum delay across all strategies
for a slash
- Add a `getBurnOrRedistributionDelay` view function
- Add a convenience view function `getPendingEscrows` for offchain burn
job. This returns all pending operatorSets, and their associated
redistribution status, slashIds, and completeBlocks
- Standardize `uint32` for delay everywhere
- Make `deploySlashEscrow` a public function

**Result:**

Simpler & correct code.

chore: update naming (#1408)

**Motivation:**

We use `burnOrRedistributable` everywhere. Let's just use escrow
instead. Much simpler.

**Modifications:**

`burnOrRedistributable -> escrow`.

**Result:**

Better readability.

---------

Co-authored-by: clandestine.eth <[email protected]>

fix: enumerable map ovewrite

chore: format

chore: address rebase issues

test: increase burnable shares

chore: add tests

feat: simplify escrow delay

chore: format

chore: clarify natspec

chore: fix typos

feat: add convenience view functions (#1407)

chore: remove commented code

chore: format

chore: format

chore: naming

docs: alm

docs: dm

docs: epm

docs: strateby ase

docs: sm

chore: interface

docs: sef

chore: fix test

chore: format

fix: fmt and build

chore: fix test

chore: format

chore: build

chore: update for clear

chore: format

chore: draft

chore: changelog

chore: ref elip-006

chore: org

chore: typo

chore: add links to changelog

chore: push

fix: compile
0xClandestine added a commit that referenced this pull request May 30, 2025
**Motivation:**

Current implementation is broken by rebase tokens.

**Modifications:**

- Rename SWR -> `SlashEscrowFactory`.
- Add factory logic that deploys clones unique to their slash ID.

**Result:**

Funds will now be stored in clone contracts unique to their slash ID.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants