Skip to content

Commit

Permalink
test: remove commented test
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatil12 committed Dec 4, 2023
1 parent 917aa89 commit c4b62f8
Showing 1 changed file with 69 additions and 69 deletions.
138 changes: 69 additions & 69 deletions src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,75 +80,75 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti
}
}

// function testFuzz_deposit_delegate_reDelegate_completeLastWithdrawalAsShares(uint24 _random) public {
// // When new Users are created, they will choose a random configuration from these params:
// _configRand({
// _randomSeed: _random,
// _assetTypes: HOLDS_LST | HOLDS_ETH | HOLDS_ALL,
// _userTypes: DEFAULT | ALT_METHODS
// });

// /// 0. Create an operator and a staker with:
// // - some nonzero underlying token balances
// // - corresponding to a random number of strategies
// //
// // ... check that the staker has no deleagatable shares and isn't delegated

// (
// User staker,
// IStrategy[] memory strategies,
// uint[] memory tokenBalances
// ) = _newRandomStaker();
// (User operator1, ,) = _newRandomOperator();
// (User operator2, ,) = _newRandomOperator();
// uint[] memory shares = _calculateExpectedShares(strategies, tokenBalances);

// assert_HasNoDelegatableShares(staker, "staker should not have delegatable shares before depositing");
// assertFalse(delegationManager.isDelegated(address(staker)), "staker should not be delegated");

// /// 1. Deposit Into Strategies
// staker.depositIntoEigenlayer(strategies, tokenBalances);
// check_Deposit_State(staker, strategies, shares);

// // 2. Delegate to an operator
// staker.delegateTo(operator1);
// check_Delegation_State(staker, operator1, strategies, shares);

// // 3. Undelegate from an operator
// IDelegationManager.Withdrawal[] memory withdrawals = staker.undelegate();
// bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals);
// check_Undelegate_State(staker, operator1, withdrawals, withdrawalRoots, strategies, shares);

// // 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);

// // 5. Delegate to a new operator
// staker.delegateTo(operator2);
// check_Delegation_State(staker, operator2, strategies, shares);
// assertNotEq(address(operator1), delegationManager.delegatedTo(address(staker)), "staker should not be delegated to operator1");

// // 6. Queue Withdrawal
// withdrawals = staker.queueWithdrawals(strategies, shares);
// withdrawalRoots = _getWithdrawalHashes(withdrawals);
// check_QueuedWithdrawal_State(staker, operator2, strategies, shares, withdrawals, withdrawalRoots);

// // 7. Complete withdrawal
// // Fast forward to when we can complete the withdrawal
// cheats.roll(block.number + delegationManager.withdrawalDelayBlocks());

// // Complete all but last withdrawal as tokens
// for (uint i = 0; i < withdrawals.length - 1; i++) {
// staker.completeWithdrawalAsTokens(withdrawals[i]);
// }

// // Complete last withdrawal as shares
// staker.completeWithdrawalAsTokens(withdrawals[withdrawals.length - 1]);
// check_Withdrawal_AsTokens_State(staker, operator2, withdrawals[withdrawals.length - 1], strategies, shares);
// }
function testFuzz_deposit_delegate_reDelegate_completeLastWithdrawalAsShares(uint24 _random) public {
// When new Users are created, they will choose a random configuration from these params:
_configRand({
_randomSeed: _random,
_assetTypes: HOLDS_LST | HOLDS_ETH | HOLDS_ALL,
_userTypes: DEFAULT | ALT_METHODS
});

/// 0. Create an operator and a staker with:
// - some nonzero underlying token balances
// - corresponding to a random number of strategies
//
// ... check that the staker has no deleagatable shares and isn't delegated

(
User staker,
IStrategy[] memory strategies,
uint[] memory tokenBalances
) = _newRandomStaker();
(User operator1, ,) = _newRandomOperator();
(User operator2, ,) = _newRandomOperator();
uint[] memory shares = _calculateExpectedShares(strategies, tokenBalances);

assert_HasNoDelegatableShares(staker, "staker should not have delegatable shares before depositing");
assertFalse(delegationManager.isDelegated(address(staker)), "staker should not be delegated");

/// 1. Deposit Into Strategies
staker.depositIntoEigenlayer(strategies, tokenBalances);
check_Deposit_State(staker, strategies, shares);

// 2. Delegate to an operator
staker.delegateTo(operator1);
check_Delegation_State(staker, operator1, strategies, shares);

// 3. Undelegate from an operator
IDelegationManager.Withdrawal[] memory withdrawals = staker.undelegate();
bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals);
check_Undelegate_State(staker, operator1, withdrawals, withdrawalRoots, strategies, shares);

// 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);

// 5. Delegate to a new operator
staker.delegateTo(operator2);
check_Delegation_State(staker, operator2, strategies, shares);
assertNotEq(address(operator1), delegationManager.delegatedTo(address(staker)), "staker should not be delegated to operator1");

// 6. Queue Withdrawal
withdrawals = staker.queueWithdrawals(strategies, shares);
withdrawalRoots = _getWithdrawalHashes(withdrawals);
check_QueuedWithdrawal_State(staker, operator2, strategies, shares, withdrawals, withdrawalRoots);

// 7. Complete withdrawal
// Fast forward to when we can complete the withdrawal
cheats.roll(block.number + delegationManager.withdrawalDelayBlocks());

// Complete all but last withdrawal as tokens
for (uint i = 0; i < withdrawals.length - 1; i++) {
staker.completeWithdrawalAsTokens(withdrawals[i]);
}

// Complete last withdrawal as shares
staker.completeWithdrawalAsTokens(withdrawals[withdrawals.length - 1]);
check_Withdrawal_AsTokens_State(staker, operator2, withdrawals[withdrawals.length - 1], strategies, shares);
}

function testFuzz_deposit_delegate_reDelegate_withAdditionalDepositBefore(uint24 _random) public {
// When new Users are created, they will choose a random configuration from these params:
Expand Down

0 comments on commit c4b62f8

Please sign in to comment.