Skip to content

Commit 619e67e

Browse files
committed
test: address additional comments; all tests passing
1 parent 282d411 commit 619e67e

File tree

5 files changed

+178
-327
lines changed

5 files changed

+178
-327
lines changed

src/test/integration/User.t.sol

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,19 @@ contract User is Test {
124124
}
125125

126126
/// @dev Undelegate from operator
127-
function undelegate() public createSnapshot virtual returns(Withdrawal[] memory){
128-
IDelegationManager.Withdrawal[] memory withdrawal = [_getExpectedWithdrawalStruct()];
127+
function undelegate() public createSnapshot virtual returns(IDelegationManager.Withdrawal[] memory){
128+
IDelegationManager.Withdrawal[] memory withdrawal = new IDelegationManager.Withdrawal[](1);
129+
withdrawal[0] = _getExpectedWithdrawalStructForStaker(address(this));
129130
delegationManager.undelegate(address(this));
130-
return withdrawals;
131+
return withdrawal;
131132
}
132133

133134
/// @dev Force undelegate staker
134-
function forceUndelegate(User staker) public createSnapshot virtual returns(Withdrawal[] memory){
135-
IDelegationManager.Withdrawal[] memory withdrawal = [_getExpectedWithdrawalStruct()];
136-
return delegationManager.undelegate(address(staker));
137-
return withdrawl;
135+
function forceUndelegate(User staker) public createSnapshot virtual returns(IDelegationManager.Withdrawal[] memory){
136+
IDelegationManager.Withdrawal[] memory withdrawal = new IDelegationManager.Withdrawal[](1);
137+
withdrawal[0] = _getExpectedWithdrawalStructForStaker(address(staker));
138+
delegationManager.undelegate(address(staker));
139+
return withdrawal;
138140
}
139141

140142
/// @dev Queues a single withdrawal for every share and strategy pair
@@ -231,15 +233,15 @@ contract User is Test {
231233
}
232234

233235
/// @notice Assumes staker and withdrawer are the same and that all strategies and shares are withdrawn
234-
function _getExpectedWithdrawalStruct(User staker) internal view returns (IDelegationManager.Withdrawal memory) {
236+
function _getExpectedWithdrawalStructForStaker(address staker) internal view returns (IDelegationManager.Withdrawal memory) {
235237
(IStrategy[] memory strategies, uint[] memory shares)
236-
= delegationManager.getDelegatableShares(address(staker));
238+
= delegationManager.getDelegatableShares(staker);
237239

238240
return IDelegationManager.Withdrawal({
239-
staker: address(staker),
240-
delegatedTo: delegationManager.delegatedTo(address(staker)),
241-
withdrawer: address(staker),
242-
nonce: delegationManager.cumulativeWithdrawalsQueued(address(staker)),
241+
staker: staker,
242+
delegatedTo: delegationManager.delegatedTo(staker),
243+
withdrawer: staker,
244+
nonce: delegationManager.cumulativeWithdrawalsQueued(staker),
243245
startBlock: uint32(block.number),
244246
strategies: strategies,
245247
shares: shares

0 commit comments

Comments
 (0)