Skip to content

Commit 33d8cf3

Browse files
committed
chore: rename burnable -> burnOrRedistributable
1 parent a5132ff commit 33d8cf3

File tree

10 files changed

+49
-42
lines changed

10 files changed

+49
-42
lines changed

src/contracts/core/DelegationManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ contract DelegationManager is
713713
// Emit event for operator shares being slashed
714714
emit OperatorSharesSlashed(operator, strategy, totalDepositSharesToBurn);
715715

716-
_getShareManager(strategy).increaseBurnableShares(operatorSet, slashId, strategy, totalDepositSharesToBurn);
716+
_getShareManager(strategy).increaseBurnOrRedistributableShares(operatorSet, slashId, strategy, totalDepositSharesToBurn);
717717

718718
return totalDepositSharesToBurn;
719719
}

src/contracts/core/SlashEscrowFactory.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
8989

9090
require(!_paused[operatorSet.key()][slashId], IPausable.CurrentlyPaused());
9191

92-
// Calling `decreaseBurnableShares` will transfer the underlying tokens to the `SlashEscrow`.
93-
// NOTE: While `decreaseBurnableShares` may have already been called, we call it again to ensure that the
92+
// Calling `decreaseBurnOrRedistributableShares` will transfer the underlying tokens to the `SlashEscrow`.
93+
// NOTE: While `decreaseBurnOrRedistributableShares` may have already been called, we call it again to ensure that the
9494
// underlying tokens are actually in escrow before processing and removing storage (which would otherwise prevent
9595
// the tokens from being released).
96-
strategyManager.decreaseBurnableShares(operatorSet, slashId);
96+
strategyManager.decreaseBurnOrRedistributableShares(operatorSet, slashId);
9797

9898
// Create storage pointers for readability.
9999
EnumerableSet.Bytes32Set storage pendingOperatorSets = _pendingOperatorSets;

src/contracts/core/StrategyManager.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,39 +147,39 @@ contract StrategyManager is
147147
}
148148

149149
/// @inheritdoc IShareManager
150-
function increaseBurnableShares(
150+
function increaseBurnOrRedistributableShares(
151151
OperatorSet calldata operatorSet,
152152
uint256 slashId,
153153
IStrategy strategy,
154154
uint256 sharesToBurn
155155
) external onlyDelegationManager nonReentrant {
156-
emit BurnOrRedistributableSharesIncreased(operatorSet, slashId, strategy, sharesToBurn);
157-
158156
EnumerableMap.AddressToUintMap storage operatorSetBurnableShares =
159-
_operatorSetBurnableShares[operatorSet.key()][slashId];
157+
_burnOrRedistributableShares[operatorSet.key()][slashId];
160158

161159
if (sharesToBurn != 0) {
162160
operatorSetBurnableShares.set(address(strategy), sharesToBurn);
163161

164162
// Notify the `SlashEscrowFactory` contract that it received underlying tokens to burn or redistribute.
165163
slashEscrowFactory.initiateSlashEscrow(operatorSet, slashId, strategy);
164+
165+
emit BurnOrRedistributableSharesIncreased(operatorSet, slashId, strategy, sharesToBurn);
166166
}
167167
}
168168

169169
/// @inheritdoc IStrategyManager
170-
function decreaseBurnableShares(OperatorSet calldata operatorSet, uint256 slashId) external nonReentrant {
171-
EnumerableMap.AddressToUintMap storage operatorSetBurnableShares =
172-
_operatorSetBurnableShares[operatorSet.key()][slashId];
170+
function decreaseBurnOrRedistributableShares(OperatorSet calldata operatorSet, uint256 slashId) external nonReentrant {
171+
EnumerableMap.AddressToUintMap storage burnOrRedistributableShares =
172+
_burnOrRedistributableShares[operatorSet.key()][slashId];
173173

174174
// Cache length to avoid sloads.
175-
uint256 length = operatorSetBurnableShares.length();
175+
uint256 length = burnOrRedistributableShares.length();
176176

177177
// Iterate over all strategies that have burnable shares.
178178
for (uint256 i = 0; i < length; ++i) {
179-
(address strategy, uint256 sharesToBurn) = operatorSetBurnableShares.at(i);
179+
(address strategy, uint256 sharesToBurn) = burnOrRedistributableShares.at(i);
180180

181181
// Remove the strategy from the operator set burnable shares.
182-
operatorSetBurnableShares.remove(address(strategy));
182+
burnOrRedistributableShares.remove(address(strategy));
183183

184184
// Withdraw the shares to the slash escrow.
185185
IStrategy(strategy).withdraw({
@@ -199,7 +199,7 @@ contract StrategyManager is
199199
) external nonReentrant {
200200
(, uint256 sharesToBurn) = EnumerableMap.tryGet(burnableShares, address(strategy));
201201
EnumerableMap.remove(burnableShares, address(strategy));
202-
emit BurnOrRedistributableSharesDecreased(OperatorSet(address(this), 0), 0, strategy, sharesToBurn);
202+
emit BurnableSharesDecreased(strategy, sharesToBurn);
203203

204204
// Burning acts like withdrawing, except that the destination is to the burn address.
205205
// If we have no shares to burn, we don't need to call the strategy.

src/contracts/core/StrategyManagerStorage.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ abstract contract StrategyManagerStorage is IStrategyManager {
7575
mapping(IStrategy strategy => bool) private __deprecated_thirdPartyTransfersForbidden;
7676

7777
/// @notice Returns the amount of `shares` that have been slashed on EigenLayer but not burned yet. Takes 3 storage slots.
78+
/// @dev After the redistribution upgrade, this storage variable is no longer used, and will be deprecated.
7879
EnumerableMap.AddressToUintMap internal burnableShares;
7980

80-
/// @notice Returns the amount of `shares` that have been slashed on EigenLayer but not burned yet. Takes 3 storage slots.
81-
mapping(bytes32 operatorSetKey => mapping(uint256 slashId => EnumerableMap.AddressToUintMap)) internal
82-
_operatorSetBurnableShares;
81+
/// @notice Returns the amount of `shares` that have been slashed on EigenLayer but not marked for burning or redistribution yet.
82+
mapping(bytes32 operatorSetKey => mapping(uint256 slashId => EnumerableMap.AddressToUintMap)) internal _burnOrRedistributableShares;
8383

8484
// Construction
8585

@@ -96,5 +96,5 @@ abstract contract StrategyManagerStorage is IStrategyManager {
9696
* variables without shifting down storage in the inheritance chain.
9797
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
9898
*/
99-
uint256[33] private __gap;
99+
uint256[35] private __gap;
100100
}

src/contracts/interfaces/IShareManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface IShareManager {
4747
* @param addedSharesToBurn The amount of added shares to burn.
4848
* @dev This function is only called by the DelegationManager when an operator is slashed.
4949
*/
50-
function increaseBurnableShares(
50+
function increaseBurnOrRedistributableShares(
5151
OperatorSet calldata operatorSet,
5252
uint256 slashId,
5353
IStrategy strategy,

src/contracts/interfaces/IStrategyManager.sol

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,21 @@ interface IStrategyManagerEvents {
4444
/// @notice Emitted when a strategy is removed from the approved list of strategies for deposit
4545
event StrategyRemovedFromDepositWhitelist(IStrategy strategy);
4646

47-
/// @notice Emitted when an operator is slashed and shares to be burned are increased
47+
/// @notice Emitted when an operator is slashed and shares to be burned or redistributed are increased
4848
event BurnOrRedistributableSharesIncreased(
4949
OperatorSet operatorSet, uint256 slashId, IStrategy strategy, uint256 shares
5050
);
5151

52-
/// @notice Emitted when shares are burned
52+
/// @notice Emitted when shares marked for burning or redistribution are decreased and transferred to the `SlashEscrow`
5353
event BurnOrRedistributableSharesDecreased(
5454
OperatorSet operatorSet, uint256 slashId, IStrategy strategy, uint256 shares
5555
);
56+
57+
/// @notice Emitted when shares are burnt
58+
/// @dev This event is only emitted in the pre-redistribution slash path
59+
event BurnableSharesDecreased(
60+
IStrategy strategy, uint256 shares
61+
);
5662
}
5763

5864
/**
@@ -123,6 +129,7 @@ interface IStrategyManager is IStrategyManagerErrors, IStrategyManagerEvents, IS
123129
* @notice Burns Strategy shares for the given strategy by calling into the strategy to transfer
124130
* to the default burn address.
125131
* @param strategy The strategy to burn shares in.
132+
* @dev This function will be deprecated in a release after redistribution
126133
*/
127134
function burnShares(
128135
IStrategy strategy
@@ -133,7 +140,7 @@ interface IStrategyManager is IStrategyManagerErrors, IStrategyManagerEvents, IS
133140
* @param operatorSet The operator set to burn shares in.
134141
* @param slashId The slash ID to burn shares in.
135142
*/
136-
function decreaseBurnableShares(OperatorSet calldata operatorSet, uint256 slashId) external;
143+
function decreaseBurnOrRedistributableShares(OperatorSet calldata operatorSet, uint256 slashId) external;
137144

138145
/**
139146
* @notice Owner-only function to change the `strategyWhitelister` address.

src/contracts/pods/EigenPodManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ contract EigenPodManager is
233233
}
234234

235235
/// @inheritdoc IShareManager
236-
function increaseBurnableShares(
236+
function increaseBurnOrRedistributableShares(
237237
OperatorSet calldata,
238238
uint256,
239239
IStrategy,

src/test/mocks/StrategyManagerMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ contract StrategyManagerMock is Test {
106106
return (existingShares, addedShares);
107107
}
108108

109-
function decreaseBurnableShares(IStrategy strategy, uint sharesToBurn) external {}
109+
function decreaseBurnOrRedistributableShares(IStrategy strategy, uint sharesToBurn) external {}
110110

111111
function _getStrategyIndex(address staker, IStrategy strategy) internal view returns (uint) {
112112
IStrategy[] memory strategies = strategiesToReturn[staker];

src/test/unit/EigenPodManagerUnit.t.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,20 +662,20 @@ contract EigenPodManagerUnitTests_BeaconChainETHBalanceUpdateTests is EigenPodMa
662662
}
663663
}
664664

665-
contract EigenPodManagerUnitTests_increaseBurnableShares is EigenPodManagerUnitTests {
665+
contract EigenPodManagerUnitTests_increaseBurnOrRedistributableShares is EigenPodManagerUnitTests {
666666
function testFuzz_onlyDelegationManager(address invalidCaller) public filterFuzzedAddressInputs(invalidCaller) {
667667
cheats.assume(invalidCaller != address(delegationManagerMock));
668668
cheats.prank(invalidCaller);
669669
cheats.expectRevert(IEigenPodManagerErrors.OnlyDelegationManager.selector);
670-
eigenPodManager.increaseBurnableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, 1 ether);
670+
eigenPodManager.increaseBurnOrRedistributableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, 1 ether);
671671
}
672672

673673
function testFuzz_singleDeposit(uint increasedBurnableShares) public {
674674
cheats.expectEmit(true, true, true, true, address(eigenPodManager));
675675
emit BurnableETHSharesIncreased(increasedBurnableShares);
676676

677677
cheats.prank(address(delegationManagerMock));
678-
eigenPodManager.increaseBurnableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, increasedBurnableShares);
678+
eigenPodManager.increaseBurnOrRedistributableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, increasedBurnableShares);
679679

680680
assertEq(eigenPodManager.burnableETHShares(), increasedBurnableShares, "Burnable shares not updated correctly");
681681
}
@@ -687,14 +687,14 @@ contract EigenPodManagerUnitTests_increaseBurnableShares is EigenPodManagerUnitT
687687
cheats.expectEmit(true, true, true, true, address(eigenPodManager));
688688
emit BurnableETHSharesIncreased(existingBurnableShares);
689689
cheats.prank(address(delegationManagerMock));
690-
eigenPodManager.increaseBurnableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, existingBurnableShares);
690+
eigenPodManager.increaseBurnOrRedistributableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, existingBurnableShares);
691691

692692
assertEq(eigenPodManager.burnableETHShares(), existingBurnableShares, "Burnable shares not setup correctly");
693693

694694
cheats.expectEmit(true, true, true, true, address(eigenPodManager));
695695
emit BurnableETHSharesIncreased(increasedBurnableShares);
696696
cheats.prank(address(delegationManagerMock));
697-
eigenPodManager.increaseBurnableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, increasedBurnableShares);
697+
eigenPodManager.increaseBurnOrRedistributableShares(OperatorSet(address(0), 0), 0, beaconChainETHStrategy, increasedBurnableShares);
698698

699699
assertEq(
700700
eigenPodManager.burnableETHShares(), existingBurnableShares + increasedBurnableShares, "Burnable shares not updated correctly"

src/test/unit/StrategyManagerUnit.t.sol

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,26 +1070,26 @@ contract StrategyManagerUnitTests_withdrawSharesAsTokens is StrategyManagerUnitT
10701070
}
10711071
}
10721072

1073-
contract StrategyManagerUnitTests_increaseBurnableShares is StrategyManagerUnitTests {
1073+
contract StrategyManagerUnitTests_increaseBurnOrRedistributableShares is StrategyManagerUnitTests {
10741074
function test_Revert_DelegationManagerModifier() external {
10751075
DelegationManagerMock invalidDelegationManager = new DelegationManagerMock();
10761076
cheats.prank(address(invalidDelegationManager));
10771077
cheats.expectRevert(IStrategyManagerErrors.OnlyDelegationManager.selector);
1078-
strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, dummyStrat, 1);
1078+
strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, dummyStrat, 1);
10791079
}
10801080

1081-
// function testFuzz_increaseBurnableShares(uint addedSharesToBurn) external {
1081+
// function testFuzz_increaseBurnOrRedistributableShares(uint addedSharesToBurn) external {
10821082
// IStrategy strategy = dummyStrat;
10831083
// cheats.expectEmit(true, true, true, true, address(strategyManager));
10841084
// emit BurnOrRedistributableSharesIncreased(defaultOperatorSet, defaultSlashId, strategy, addedSharesToBurn);
10851085
// cheats.prank(address(delegationManagerMock));
1086-
// strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, strategy, addedSharesToBurn);
1086+
// strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, strategy, addedSharesToBurn);
10871087
// assertEq(
10881088
// strategyManager.getBurnableShares(strategy), addedSharesToBurn, "strategyManager.burnableShares(strategy) != addedSharesToBurn"
10891089
// );
10901090
// }
10911091

1092-
// function testFuzz_increaseBurnableShares_existingShares(uint existingBurnableShares, uint addedSharesToBurn) external {
1092+
// function testFuzz_increaseBurnOrRedistributableShares_existingShares(uint existingBurnableShares, uint addedSharesToBurn) external {
10931093
// // preventing fuzz overflow, in practice StrategyBase has a 1e38 - 1 maxShares limit so this won't
10941094
// // be an issue on mainnet/testnet environments
10951095
// existingBurnableShares = bound(existingBurnableShares, 1, type(uint).max / 2);
@@ -1098,7 +1098,7 @@ contract StrategyManagerUnitTests_increaseBurnableShares is StrategyManagerUnitT
10981098
// cheats.prank(address(delegationManagerMock));
10991099
// cheats.expectEmit(true, true, true, true, address(strategyManager));
11001100
// emit BurnOrRedistributableSharesIncreased(defaultOperatorSet, defaultSlashId, strategy, existingBurnableShares);
1101-
// strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, strategy, existingBurnableShares);
1101+
// strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, strategy, existingBurnableShares);
11021102
// assertEq(
11031103
// strategyManager.getBurnableShares(strategy),
11041104
// existingBurnableShares,
@@ -1108,7 +1108,7 @@ contract StrategyManagerUnitTests_increaseBurnableShares is StrategyManagerUnitT
11081108
// cheats.prank(address(delegationManagerMock));
11091109
// cheats.expectEmit(true, true, true, true, address(strategyManager));
11101110
// emit BurnOrRedistributableSharesIncreased(defaultOperatorSet, defaultSlashId, strategy, addedSharesToBurn);
1111-
// strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, strategy, addedSharesToBurn);
1111+
// strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, strategy, addedSharesToBurn);
11121112

11131113
// assertEq(
11141114
// strategyManager.getBurnableShares(strategy),
@@ -1118,7 +1118,7 @@ contract StrategyManagerUnitTests_increaseBurnableShares is StrategyManagerUnitT
11181118
// }
11191119
}
11201120

1121-
contract StrategyManagerUnitTests_decreaseBurnableShares is StrategyManagerUnitTests {
1121+
contract StrategyManagerUnitTests_decreaseBurnOrRedistributableShares is StrategyManagerUnitTests {
11221122
// function testFuzz_SingleStrategyDeposited(address staker, uint depositAmount, uint sharesToBurn)
11231123
// external
11241124
// filterFuzzedAddressInputs(staker)
@@ -1134,7 +1134,7 @@ contract StrategyManagerUnitTests_decreaseBurnableShares is StrategyManagerUnitT
11341134
// cheats.prank(address(delegationManagerMock));
11351135
// cheats.expectEmit(true, true, true, true, address(strategyManager));
11361136
// emit BurnOrRedistributableSharesIncreased(defaultOperatorSet, defaultSlashId, strategy, sharesToBurn);
1137-
// strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, strategy, sharesToBurn);
1137+
// strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, strategy, sharesToBurn);
11381138

11391139
// uint strategyBalanceBefore = token.balanceOf(address(strategy));
11401140
// uint burnAddressBalanceBefore = token.balanceOf(strategyManager.DEFAULT_BURN_ADDRESS());
@@ -1171,7 +1171,7 @@ contract StrategyManagerUnitTests_decreaseBurnableShares is StrategyManagerUnitT
11711171
// cheats.prank(address(delegationManagerMock));
11721172
// cheats.expectEmit(true, true, true, true, address(strategyManager));
11731173
// emit BurnOrRedistributableSharesIncreased(defaultOperatorSet, defaultSlashId, strategy, sharesToBurn);
1174-
// strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, strategy, sharesToBurn);
1174+
// strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, strategy, sharesToBurn);
11751175

11761176
// // Now set token to be contract that reverts simulating an upgrade
11771177
// cheats.etch(address(token), address(revertToken).code);
@@ -1357,7 +1357,7 @@ contract StrategyManagerUnitTests_getStrategiesWithBurnableShares is StrategyMan
13571357

13581358
// // Add burnable shares
13591359
// cheats.prank(address(delegationManagerMock));
1360-
// strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, dummyStrat, sharesToAdd);
1360+
// strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, dummyStrat, sharesToAdd);
13611361

13621362
// // Get strategies with burnable shares
13631363
// (address[] memory strategies, uint[] memory shares) = strategyManager.getStrategiesWithBurnableShares();
@@ -1383,7 +1383,7 @@ contract StrategyManagerUnitTests_getStrategiesWithBurnableShares is StrategyMan
13831383
// if (sharesToAdd[i] > 0) {
13841384
// expectedLength++;
13851385
// cheats.prank(address(delegationManagerMock));
1386-
// strategyManager.increaseBurnableShares(defaultOperatorSet, defaultSlashId, strategies[i], sharesToAdd[i]);
1386+
// strategyManager.increaseBurnOrRedistributableShares(defaultOperatorSet, defaultSlashId, strategies[i], sharesToAdd[i]);
13871387
// }
13881388
// }
13891389

0 commit comments

Comments
 (0)