diff --git a/src/test/integration/IntegrationChecks.t.sol b/src/test/integration/IntegrationChecks.t.sol index b30d739fa..fef09682e 100644 --- a/src/test/integration/IntegrationChecks.t.sol +++ b/src/test/integration/IntegrationChecks.t.sol @@ -64,6 +64,7 @@ contract IntegrationCheckUtils is IntegrationBase { // ... check that each withdrawal was successfully enqueued, that the returned roots // match the hashes of each withdrawal, and that the staker and operator have // reduced shares. + assertEq(withdrawalRoots.length, 1, "check_QueuedWithdrawal_State: should only have 1 withdrawal root after queueing"); assert_AllWithdrawalsPending(withdrawalRoots, "check_QueuedWithdrawal_State: staker withdrawals should now be pending"); assert_ValidWithdrawalHashes(withdrawals, withdrawalRoots, diff --git a/src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol b/src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol index 0992631df..75a57af75 100644 --- a/src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol @@ -124,9 +124,10 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti // 4. Complete withdrawal as shares // Fast forward to when we can complete the withdrawal cheats.roll(block.number + delegationManager.withdrawalDelayBlocks()); - staker.completeWithdrawalAsShares(withdrawals[0]); - - check_Withdrawal_AsShares_Undelegated_State(staker, operator1, withdrawals[0], strategies, shares); + for (uint256 i = 0; i < withdrawals.length; ++i) { + staker.completeWithdrawalAsShares(withdrawals[i]); + check_Withdrawal_AsShares_Undelegated_State(staker, operator1, withdrawals[i], withdrawals[i].strategies, withdrawals[i].shares); + } // 5. Delegate to a new operator staker.delegateTo(operator2); @@ -207,8 +208,10 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti // 4. Complete withdrawal as shares // Fast forward to when we can complete the withdrawal cheats.roll(block.number + delegationManager.withdrawalDelayBlocks()); - staker.completeWithdrawalAsShares(withdrawals[0]); - check_Withdrawal_AsShares_Undelegated_State(staker, operator1, withdrawals[0], strategies, halfShares); + for (uint256 i = 0; i < withdrawals.length; ++i) { + staker.completeWithdrawalAsShares(withdrawals[i]); + check_Withdrawal_AsShares_Undelegated_State(staker, operator1, withdrawals[i], withdrawals[i].strategies, withdrawals[i].shares); + } // 5. Delegate to a new operator staker.delegateTo(operator2); @@ -292,8 +295,10 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti // 4. Complete withdrawal as shares // Fast forward to when we can complete the withdrawal cheats.roll(block.number + delegationManager.withdrawalDelayBlocks()); - staker.completeWithdrawalAsShares(withdrawals[0]); - check_Withdrawal_AsShares_Undelegated_State(staker, operator1, withdrawals[0], strategies, halfShares); + for (uint256 i = 0; i < withdrawals.length; ++i) { + staker.completeWithdrawalAsShares(withdrawals[i]); + check_Withdrawal_AsShares_Undelegated_State(staker, operator1, withdrawals[i], withdrawals[i].strategies, withdrawals[i].shares); + } // 5. Deposit into Strategies uint[] memory sharesAdded = _calculateExpectedShares(strategies, numTokensRemaining); @@ -359,12 +364,14 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); check_Undelegate_State(staker, operator1, withdrawals, withdrawalRoots, strategies, shares); - // 4. Complete withdrawal as shares + // 4. Complete withdrawal as tokens // Fast forward to when we can complete the withdrawal cheats.roll(block.number + delegationManager.withdrawalDelayBlocks()); - uint[] memory expectedTokens = _calculateExpectedTokens(withdrawals[0].strategies, withdrawals[0].shares); - IERC20[] memory tokens = staker.completeWithdrawalAsTokens(withdrawals[0]); - check_Withdrawal_AsTokens_State(staker, operator1, withdrawals[0], strategies, shares, tokens, expectedTokens); + for (uint256 i = 0; i < withdrawals.length; ++i) { + uint[] memory expectedTokens = _calculateExpectedTokens(withdrawals[i].strategies, withdrawals[i].shares); + IERC20[] memory tokens = staker.completeWithdrawalAsTokens(withdrawals[i]); + check_Withdrawal_AsTokens_State(staker, operator1, withdrawals[i], withdrawals[i].strategies, withdrawals[i].shares, tokens, expectedTokens); + } //5. Deposit into Strategies staker.depositIntoEigenlayer(strategies, tokenBalances); @@ -386,8 +393,8 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti // Complete withdrawals as tokens for (uint i = 0; i < withdrawals.length; i++) { - expectedTokens = _calculateExpectedTokens(withdrawals[i].strategies, withdrawals[i].shares); - tokens = staker.completeWithdrawalAsTokens(withdrawals[i]); + uint[] memory expectedTokens = _calculateExpectedTokens(withdrawals[i].strategies, withdrawals[i].shares); + IERC20[] memory tokens = staker.completeWithdrawalAsTokens(withdrawals[i]); check_Withdrawal_AsTokens_State(staker, operator2, withdrawals[i], strategies, shares, tokens, expectedTokens); } } @@ -426,12 +433,14 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); check_Undelegate_State(staker, operator1, withdrawals, withdrawalRoots, strategies, shares); - // 4. Complete withdrawal as shares + // 4. Complete withdrawal as Tokens // Fast forward to when we can complete the withdrawal cheats.roll(block.number + delegationManager.withdrawalDelayBlocks()); - uint[] memory expectedTokens = _calculateExpectedTokens(withdrawals[0].strategies, withdrawals[0].shares); - IERC20[] memory tokens = staker.completeWithdrawalAsTokens(withdrawals[0]); - check_Withdrawal_AsTokens_State(staker, operator1, withdrawals[0], strategies, shares, tokens, expectedTokens); + for (uint256 i = 0; i < withdrawals.length; ++i) { + uint[] memory expectedTokens = _calculateExpectedTokens(withdrawals[i].strategies, withdrawals[i].shares); + IERC20[] memory tokens = staker.completeWithdrawalAsTokens(withdrawals[i]); + check_Withdrawal_AsTokens_State(staker, operator1, withdrawals[i], withdrawals[i].strategies, withdrawals[i].shares, tokens, expectedTokens); + } //5. Deposit into Strategies staker.depositIntoEigenlayer(strategies, tokenBalances); @@ -453,7 +462,6 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti // Complete withdrawals as shares for (uint i = 0; i < withdrawals.length; i++) { - expectedTokens = _calculateExpectedTokens(withdrawals[i].strategies, withdrawals[i].shares); staker.completeWithdrawalAsShares(withdrawals[i]); check_Withdrawal_AsShares_State(staker, operator2, withdrawals[i], strategies, shares); }