@@ -5946,8 +5946,8 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
5946
5946
delegationManager.completeQueuedWithdrawal (withdrawal, tokens, receiveAsTokens);
5947
5947
}
5948
5948
5949
- /// @notice Verifies that when we complete a withdrawal as shares after a full slash, we revert
5950
- function test_revert_fullySlashed () public {
5949
+ /// @notice Verifies that when we complete a withdrawal as shares after a full slash, we clear the withdrawal
5950
+ function test_clearWithdrawal_fullySlashed () public {
5951
5951
// Register operator
5952
5952
_registerOperatorWithBaseDetails (defaultOperator);
5953
5953
_setOperatorMagnitude (defaultOperator, strategyMock, WAD);
@@ -5978,12 +5978,22 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
5978
5978
cheats.prank (address (allocationManagerMock));
5979
5979
delegationManager.slashOperatorShares (defaultOperator, strategyMock, WAD, 0 );
5980
5980
5981
- // Complete withdrawal as shares and assert that operator has no shares increased
5981
+ // Complete withdrawal as shares and check that withdrawal was cleared
5982
5982
cheats.roll (block .number + 1 );
5983
5983
IERC20 [] memory tokens = strategyMock.underlyingToken ().toArray ();
5984
- cheats.expectRevert (FullySlashed.selector );
5984
+
5985
+ bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot (withdrawal);
5986
+ assertTrue (delegationManager.pendingWithdrawals (withdrawalRoot), "withdrawal should be pending before completion " );
5987
+
5985
5988
cheats.prank (defaultStaker);
5986
5989
delegationManager.completeQueuedWithdrawal (withdrawal, tokens, false );
5990
+
5991
+ assertFalse (delegationManager.pendingWithdrawals (withdrawalRoot), "withdrawal should be cleared after completion " );
5992
+
5993
+ // Assert that no shares were added back
5994
+ assertEq (delegationManager.operatorShares (defaultOperator, strategyMock), 0 , "operator shares should remain 0 " );
5995
+ (uint256 [] memory withdrawableShares , ) = delegationManager.getWithdrawableShares (defaultStaker, strategyMock.toArray ());
5996
+ assertEq (withdrawableShares[0 ], 0 , "withdrawable shares should be 0 " );
5987
5997
}
5988
5998
5989
5999
/**
@@ -6631,22 +6641,18 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests
6631
6641
6632
6642
uint256 slashableSharesInQueueAfter = delegationManager.getSlashableSharesInQueue (defaultOperator, strategyMock);
6633
6643
6634
- // Complete withdrawal as tokens and assert that nothing is returned
6644
+ // Complete withdrawal as tokens and assert that nothing is returned and withdrawal is cleared
6635
6645
cheats.roll (block .number + 1 );
6636
6646
IERC20 [] memory tokens = strategyMock.underlyingToken ().toArray ();
6637
- cheats.expectCall (
6638
- address (strategyManagerMock),
6639
- abi.encodeWithSelector (
6640
- IShareManager.withdrawSharesAsTokens.selector ,
6641
- defaultStaker,
6642
- strategyMock,
6643
- strategyMock.underlyingToken (),
6644
- 0
6645
- )
6646
- );
6647
+
6648
+ bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot (withdrawal);
6649
+ assertTrue (delegationManager.pendingWithdrawals (withdrawalRoot), "withdrawal should be pending before completion " );
6650
+
6647
6651
cheats.prank (defaultStaker);
6648
6652
delegationManager.completeQueuedWithdrawal (withdrawal, tokens, true );
6649
6653
6654
+ assertFalse (delegationManager.pendingWithdrawals (withdrawalRoot), "withdrawal should be cleared after completion " );
6655
+
6650
6656
assertEq (
6651
6657
slashableSharesInQueue,
6652
6658
depositAmount,
0 commit comments