Skip to content

Commit fb0b902

Browse files
wadealexcypatil12
authored andcommitted
refactor: final slashing cleanup (#982)
* chore: clean comments and naming in dm * refactor: simplify undelegate method * feat: removed 0 address check because 0 stakers cant be delegated * feat: condensed non-staker caller logic * refactor: remove unnecessary check * feat: use checks-effects-interactions when completing withdrawals * feat: remove implicit public method for queuedWithdrawals and impl dedicated getter * feat: deprecate withdrawer field * chore: make bindings and clean compile errors * refactor: redelegate reuses delegateTo and undelegate * fix: broken integration test * docs: update to reflect deprecated field * feat: add getter for stakers withdrawal roots
1 parent 26f63a0 commit fb0b902

File tree

5 files changed

+40
-75
lines changed

5 files changed

+40
-75
lines changed

src/contracts/core/DelegationManager.sol

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ contract DelegationManager is
129129
address operator,
130130
SignatureWithExpiry memory approverSignatureAndExpiry,
131131
bytes32 approverSalt
132+
<<<<<<< HEAD
132133
) public nonReentrant {
134+
=======
135+
) public {
136+
>>>>>>> 337b1b66 (refactor: final slashing cleanup (#982))
133137
require(!isDelegated(msg.sender), ActivelyDelegated());
134138
require(isOperator(operator), OperatorNotRegistered());
135139

@@ -148,7 +152,11 @@ contract DelegationManager is
148152
/// @inheritdoc IDelegationManager
149153
function undelegate(
150154
address staker
155+
<<<<<<< HEAD
151156
) public nonReentrant returns (bytes32[] memory withdrawalRoots) {
157+
=======
158+
) public returns (bytes32[] memory withdrawalRoots) {
159+
>>>>>>> 337b1b66 (refactor: final slashing cleanup (#982))
152160
// Check that the `staker` can undelegate
153161
require(isDelegated(staker), NotActivelyDelegated());
154162
require(!isOperator(staker), OperatorsCannotUndelegate());
@@ -569,7 +577,11 @@ contract DelegationManager is
569577
// Remove the withdrawal from the queue. Note that for legacy withdrawals, the removals
570578
// from `_stakerQueuedWithdrawalRoots` and `queuedWithdrawals` will no-op.
571579
_stakerQueuedWithdrawalRoots[withdrawal.staker].remove(withdrawalRoot);
580+
<<<<<<< HEAD
572581
delete _queuedWithdrawals[withdrawalRoot];
582+
=======
583+
delete queuedWithdrawals[withdrawalRoot];
584+
>>>>>>> 337b1b66 (refactor: final slashing cleanup (#982))
573585
delete pendingWithdrawals[withdrawalRoot];
574586
emit SlashingWithdrawalCompleted(withdrawalRoot);
575587

@@ -977,6 +989,13 @@ contract DelegationManager is
977989
(withdrawal, shares) = _getSharesByWithdrawalRoot(withdrawalRoot);
978990
}
979991

992+
/// @inheritdoc IDelegationManager
993+
function getQueuedWithdrawal(
994+
bytes32 withdrawalRoot
995+
) external view returns (Withdrawal memory) {
996+
return queuedWithdrawals[withdrawalRoot];
997+
}
998+
980999
/// @inheritdoc IDelegationManager
9811000
function getQueuedWithdrawals(
9821001
address staker

src/test/integration/tests/Deposit_Delegate_Allocate.t.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils {
164164
// 1. Deposit Into Strategies
165165
staker.depositIntoEigenlayer(strategies, tokenBalances);
166166
uint256[] memory shares = _calculateExpectedShares(strategies, tokenBalances);
167+
// TODO - post-deposit and post-delegate checks?
167168

168169
// 2. Delegate to an operator
169170
staker.delegateTo(operator);

src/test/integration/tests/eigenpod/EigenPod_Slashing_Migration.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ contract Integration_EigenPod_Slashing_Migration is IntegrationCheckUtils, Eigen
3333
// Initialize state
3434
(User staker, ,) = _newRandomStaker();
3535

36-
(uint40[] memory validators, uint64 beaconBalanceGwei) = staker.startValidators();
36+
(uint40[] memory validators, ) = staker.startValidators();
3737
beaconChain.advanceEpoch_NoRewards();
3838

3939
// 1. Verify validators' withdrawal credentials

src/test/integration/users/User.t.sol

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,6 @@ contract User is Logger, IDelegationManagerTypes, IAllocationManagerTypes {
679679
);
680680

681681
uint256 scaledShares = dsf.scaleForQueueWithdrawal(depositShares[i]);
682-
<<<<<<< HEAD
683-
=======
684-
685-
if (strategies[i] == beaconChainETHStrategy) {
686-
scaledShares -= scaledShares % 1 gwei;
687-
}
688-
>>>>>>> 7e54c342 (refactor: scaled shares accounting (#975))
689682

690683
expectedWithdrawals[i] = Withdrawal({
691684
staker: staker,

0 commit comments

Comments
 (0)