diff --git a/src/test/integration/IntegrationBase.t.sol b/src/test/integration/IntegrationBase.t.sol index b0ecefd066..cb178b3c27 100644 --- a/src/test/integration/IntegrationBase.t.sol +++ b/src/test/integration/IntegrationBase.t.sol @@ -20,7 +20,7 @@ abstract contract IntegrationBase is IntegrationDeployer { using Strings for *; using print for *; - using ArrayLib for IStrategy[]; + using ArrayLib for *; uint numStakers = 0; uint numOperators = 0; @@ -49,7 +49,7 @@ abstract contract IntegrationBase is IntegrationDeployer { IStrategy[] memory strategies; uint[] memory tokenBalances; - if (forkType == MAINNET && !isUpgraded) { + if (!isUpgraded) { stakerName = string.concat("M2Staker", cheats.toString(numStakers)); (staker, strategies, tokenBalances) = _randUser(stakerName); @@ -79,7 +79,7 @@ abstract contract IntegrationBase is IntegrationDeployer { uint[] memory tokenBalances; uint[] memory addedShares; - if (forkType == MAINNET && !isUpgraded) { + if (!isUpgraded) { string memory operatorName = string.concat("M2Operator", numOperators.toString()); // Create an operator for M2. @@ -102,11 +102,12 @@ abstract contract IntegrationBase is IntegrationDeployer { operator.registerAsOperator(); operator.depositIntoEigenlayer(strategies, tokenBalances); - // Roll passed the allocation configuration delay + // Roll past the allocation configuration delay rollForward({blocks: ALLOCATION_CONFIGURATION_DELAY}); - } - assert_Snap_Added_Staker_DepositShares(operator, strategies, addedShares, "_newRandomOperator: failed to add delegatable shares"); + assert_Snap_Added_Staker_DepositShares(operator, strategies, addedShares, "_newRandomOperator: failed to add delegatable shares"); + } + assert_Snap_Added_OperatorShares(operator, strategies, addedShares, "_newRandomOperator: failed to award shares to operator"); assertTrue(delegationManager.isOperator(address(operator)), "_newRandomOperator: operator should be registered"); @@ -141,13 +142,13 @@ abstract contract IntegrationBase is IntegrationDeployer { /// @dev Choose a random subset of validators (selects AT LEAST ONE) function _choose(uint40[] memory validators) internal returns (uint40[] memory) { - uint rand = _randUint({ min: 1, max: validators.length ** 2 }); + uint _rand = _randUint({ min: 1, max: validators.length ** 2 }); uint40[] memory result = new uint40[](validators.length); uint newLen; for (uint i = 0; i < validators.length; i++) { // if bit set, add validator - if (rand >> i & 1 == 1) { + if (_rand >> i & 1 == 1) { result[newLen] = validators[i]; newLen++; } @@ -645,20 +646,15 @@ abstract contract IntegrationBase is IntegrationDeployer { function assert_Snap_Added_Staker_DepositShares( User staker, IStrategy strat, - uint _addedShares, + uint addedShares, string memory err ) internal { - IStrategy[] memory strategies = new IStrategy[](1); - uint[] memory addedShares = new uint[](1); - strategies[0] = strat; - addedShares[0] = _addedShares; - - assert_Snap_Added_Staker_DepositShares(staker, strategies, addedShares, err); + assert_Snap_Added_Staker_DepositShares(staker, strat.toArray(), addedShares.toArrayU256(), err); } /// @dev Check that the staker has `removedShares` fewer delegatable shares /// for each strategy since the last snapshot - function assert_Snap_Removed_StakerDepositShares( + function assert_Snap_Removed_Staker_DepositShares( User staker, IStrategy[] memory strategies, uint[] memory removedShares, @@ -674,22 +670,52 @@ abstract contract IntegrationBase is IntegrationDeployer { } } - function assert_Snap_Removed_StakerDepositShares( + function assert_Snap_Removed_Staker_DepositShares( User staker, IStrategy strat, - uint _removedShares, + uint removedShares, + string memory err + ) internal { + assert_Snap_Removed_Staker_DepositShares(staker, strat.toArray(), removedShares.toArrayU256(), err); + } + + /// @dev Check that the staker's delegatable shares in ALL strategies have not changed + /// since the last snapshot + function assert_Snap_Unchanged_Staker_DepositShares( + User staker, string memory err ) internal { - IStrategy[] memory strategies = new IStrategy[](1); - uint[] memory removedShares = new uint[](1); - strategies[0] = strat; - removedShares[0] = _removedShares; + IStrategy[] memory strategies = allStrats; + + uint[] memory curShares = _getStakerDepositShares(staker, strategies); + // Use timewarp to get previous staker shares + uint[] memory prevShares = _getPrevStakerDepositShares(staker, strategies); - assert_Snap_Removed_StakerDepositShares(staker, strategies, removedShares, err); + // For each strategy, check (prev == cur) + for (uint i = 0; i < strategies.length; i++) { + assertEq(prevShares[i], curShares[i], err); + } } /// @dev Check that the staker's withdrawable shares have decreased by `removedShares` - function assert_Snap_Removed_StakerWithdrawableShares( + function assert_Snap_Added_Staker_WithdrawableShares( + User staker, + IStrategy[] memory strategies, + uint[] memory addedShares, + string memory err + ) internal { + uint[] memory curShares = _getStakerWithdrawableShares(staker, strategies); + // Use timewarp to get previous staker shares + uint[] memory prevShares = _getPrevStakerWithdrawableShares(staker, strategies); + + // For each strategy, check (prev - removed == cur) + for (uint i = 0; i < strategies.length; i++) { + assertEq(prevShares[i] + addedShares[i], curShares[i], err); + } + } + + /// @dev Check that the staker's withdrawable shares have decreased by `removedShares` + function assert_Snap_Removed_Staker_WithdrawableShares( User staker, IStrategy[] memory strategies, uint[] memory removedShares, @@ -705,18 +731,30 @@ abstract contract IntegrationBase is IntegrationDeployer { } } - function assert_Snap_Removed_StakerWithdrawableShares( + function assert_Snap_Removed_Staker_WithdrawableShares( User staker, IStrategy strat, - uint _removedShares, + uint removedShares, + string memory err + ) internal { + assert_Snap_Removed_Staker_WithdrawableShares(staker, strat.toArray(), removedShares.toArrayU256(), err); + } + + /// @dev Check that the staker's withdrawable shares have decreased by `removedShares` + function assert_Snap_Unchanged_Staker_WithdrawableShares( + User staker, string memory err ) internal { - IStrategy[] memory strategies = new IStrategy[](1); - uint[] memory removedShares = new uint[](1); - strategies[0] = strat; - removedShares[0] = _removedShares; + IStrategy[] memory strategies = allStrats; + + uint[] memory curShares = _getStakerWithdrawableShares(staker, strategies); + // Use timewarp to get previous staker shares + uint[] memory prevShares = _getPrevStakerWithdrawableShares(staker, strategies); - assert_Snap_Removed_StakerWithdrawableShares(staker, strategies, removedShares, err); + // For each strategy, check (prev - removed == cur) + for (uint i = 0; i < strategies.length; i++) { + assertEq(prevShares[i], curShares[i], err); + } } /// @dev Check that the staker's withdrawable shares have decreased by at least `removedShares` @@ -743,30 +781,7 @@ abstract contract IntegrationBase is IntegrationDeployer { uint removedShares, string memory err ) internal { - IStrategy[] memory strategies = new IStrategy[](1); - uint[] memory removedSharesArr = new uint[](1); - strategies[0] = strat; - removedSharesArr[0] = removedShares; - - assert_Snap_Removed_Staker_WithdrawableShares_AtLeast(staker, strategies, removedSharesArr, err); - } - - /// @dev Check that the staker's delegatable shares in ALL strategies have not changed - /// since the last snapshot - function assert_Snap_Unchanged_StakerDepositShares( - User staker, - string memory err - ) internal { - IStrategy[] memory strategies = allStrats; - - uint[] memory curShares = _getStakerDepositShares(staker, strategies); - // Use timewarp to get previous staker shares - uint[] memory prevShares = _getPrevStakerDepositShares(staker, strategies); - - // For each strategy, check (prev == cur) - for (uint i = 0; i < strategies.length; i++) { - assertEq(prevShares[i], curShares[i], err); - } + assert_Snap_Removed_Staker_WithdrawableShares_AtLeast(staker, strat.toArray(), removedShares.toArrayU256(), err); } function assert_Snap_Delta_StakerShares( @@ -1485,12 +1500,7 @@ abstract contract IntegrationBase is IntegrationDeployer { // This method should only be used for tests that handle positive // balances. Negative balances are an edge case that require // the own tests and helper methods. - int shares; - if (forkType != LOCAL && !isUpgraded) { - shares = int(IEigenPodManager_DeprecatedM2(address(eigenPodManager)).podOwnerShares(address(staker))); - } else { - shares = int(eigenPodManager.podOwnerDepositShares(address(staker))); - } + int shares = eigenPodManager.podOwnerDepositShares(address(staker)); if (shares < 0) { revert("_getStakerDepositShares: negative shares"); @@ -1498,11 +1508,7 @@ abstract contract IntegrationBase is IntegrationDeployer { curShares[i] = uint(shares); } else { - if (forkType != LOCAL && !isUpgraded) { - curShares[i] = IStrategyManager_DeprecatedM2(address(strategyManager)).stakerStrategyShares(address(staker), strat); - } else { - curShares[i] = strategyManager.stakerDepositShares(address(staker), strat); - } + curShares[i] = strategyManager.stakerDepositShares(address(staker), strat); } } @@ -1656,13 +1662,8 @@ abstract contract IntegrationBase is IntegrationDeployer { } function _getCheckpointPodBalanceGwei(User staker) internal view returns (uint64) { - if (forkType != LOCAL && !isUpgraded) { - IEigenPod_DeprecatedM2 pod = IEigenPod_DeprecatedM2(address(staker.pod())); - return uint64(pod.currentCheckpoint().podBalanceGwei); - } else { - EigenPod pod = staker.pod(); - return uint64(pod.currentCheckpoint().podBalanceGwei); - } + EigenPod pod = staker.pod(); + return uint64(pod.currentCheckpoint().podBalanceGwei); } function _getPrevCheckpointPodBalanceGwei(User staker) internal timewarp() returns (uint64) { diff --git a/src/test/integration/IntegrationChecks.t.sol b/src/test/integration/IntegrationChecks.t.sol index 1a6ed6b81d..960e9a19b2 100644 --- a/src/test/integration/IntegrationChecks.t.sol +++ b/src/test/integration/IntegrationChecks.t.sol @@ -88,8 +88,8 @@ contract IntegrationCheckUtils is IntegrationBase { ) internal { check_CompleteCheckpoint_State(staker); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker shares should not have decreased"); - assert_Snap_Removed_StakerWithdrawableShares(staker, BEACONCHAIN_ETH_STRAT, slashedAmountGwei * GWEI_TO_WEI, "should have decreased withdrawable shares by slashed amount"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker shares should not have decreased"); + assert_Snap_Removed_Staker_WithdrawableShares(staker, BEACONCHAIN_ETH_STRAT, slashedAmountGwei * GWEI_TO_WEI, "should have decreased withdrawable shares by slashed amount"); assert_Snap_Removed_ActiveValidatorCount(staker, slashedValidators.length, "should have decreased active validator count"); assert_Snap_Removed_ActiveValidators(staker, slashedValidators, "exited validators should each be WITHDRAWN"); } @@ -101,7 +101,7 @@ contract IntegrationCheckUtils is IntegrationBase { ) internal { check_CompleteCheckpoint_State(staker); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker shares should not have decreased"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker shares should not have decreased"); assert_Snap_Removed_Staker_WithdrawableShares_AtLeast(staker, BEACONCHAIN_ETH_STRAT, slashedAmountGwei * GWEI_TO_WEI, "should have decreased withdrawable shares by at least slashed amount"); assert_Snap_Removed_ActiveValidatorCount(staker, slashedValidators.length, "should have decreased active validator count"); assert_Snap_Removed_ActiveValidators(staker, slashedValidators, "exited validators should each be WITHDRAWN"); @@ -113,7 +113,7 @@ contract IntegrationCheckUtils is IntegrationBase { ) internal { check_CompleteCheckpoint_State(staker); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker shares should not have decreased"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker shares should not have decreased"); assert_Snap_Removed_Staker_WithdrawableShares_AtLeast(staker, BEACONCHAIN_ETH_STRAT, slashedAmountGwei * GWEI_TO_WEI, "should have decreased withdrawable shares by at least slashed amount"); assert_Snap_Unchanged_ActiveValidatorCount(staker, "should not have changed active validator count"); } @@ -124,8 +124,8 @@ contract IntegrationCheckUtils is IntegrationBase { ) internal { check_CompleteCheckpoint_State(staker); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker shares should not have decreased"); - assert_Snap_Removed_StakerWithdrawableShares(staker, BEACONCHAIN_ETH_STRAT, slashedAmountGwei * GWEI_TO_WEI, "should have decreased withdrawable shares by slashed amount"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker shares should not have decreased"); + assert_Snap_Removed_Staker_WithdrawableShares(staker, BEACONCHAIN_ETH_STRAT, slashedAmountGwei * GWEI_TO_WEI, "should have decreased withdrawable shares by slashed amount"); assert_Snap_Unchanged_ActiveValidatorCount(staker, "should not have changed active validator count"); } @@ -136,7 +136,7 @@ contract IntegrationCheckUtils is IntegrationBase { ) internal { check_CompleteCheckpoint_WithPodBalance_State(staker, exitedBalanceGwei); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker should not have changed shares"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker should not have changed shares"); assert_Snap_Added_BalanceExitedGwei(staker, exitedBalanceGwei, "should have attributed expected gwei to exited balance"); assert_Snap_Removed_ActiveValidatorCount(staker, exitedValidators.length, "should have decreased active validator count"); assert_Snap_Removed_ActiveValidators(staker, exitedValidators, "exited validators should each be WITHDRAWN"); @@ -159,8 +159,8 @@ contract IntegrationCheckUtils is IntegrationBase { // and that the staker now has the expected amount of delegated shares in each strategy assert_HasNoUnderlyingTokenBalance(staker, strategies, "staker should have transferred all underlying tokens"); assert_Snap_Added_Staker_DepositShares(staker, strategies, shares, "staker should expect shares in each strategy after depositing"); + assert_Snap_Added_Staker_WithdrawableShares(staker, strategies, shares, "deposit should increase withdrawable shares"); } - function check_Deposit_State_PartialDeposit(User staker, IStrategy[] memory strategies, uint[] memory shares, uint[] memory tokenBalances) internal { /// Deposit into strategies: @@ -171,6 +171,7 @@ contract IntegrationCheckUtils is IntegrationBase { // and that the staker now has the expected amount of delegated shares in each strategy assert_HasUnderlyingTokenBalances(staker, strategies, tokenBalances, "staker should have transferred some underlying tokens"); assert_Snap_Added_Staker_DepositShares(staker, strategies, shares, "staker should expected shares in each strategy after depositing"); + assert_Snap_Added_Staker_WithdrawableShares(staker, strategies, shares, "deposit should increase withdrawable shares"); } function check_Delegation_State( @@ -186,9 +187,9 @@ contract IntegrationCheckUtils is IntegrationBase { assertTrue(delegationManager.isDelegated(address(staker)), "staker should be delegated"); assertEq(address(operator), delegationManager.delegatedTo(address(staker)), "staker should be delegated to operator"); assert_HasExpectedShares(staker, strategies, shares, "staker should still have expected shares after delegating"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker shares should be unchanged after delegating"); - // TODO: fix this assertion - // assert_Snap_Added_OperatorShares(operator, strategies, shares, "operator should have received shares"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker shares should be unchanged after delegating"); + assert_Snap_Unchanged_Staker_WithdrawableShares(staker, "withdrawable shares should be unchanged after delegating"); + assert_Snap_Added_OperatorShares(operator, strategies, shares, "operator should have received shares"); } function check_QueuedWithdrawal_State( @@ -213,8 +214,10 @@ contract IntegrationCheckUtils is IntegrationBase { "check_QueuedWithdrawal_State: staker should have increased nonce by withdrawals.length"); assert_Snap_Removed_OperatorShares(operator, strategies, shares, "check_QueuedWithdrawal_State: failed to remove operator shares"); - assert_Snap_Removed_StakerDepositShares(staker, strategies, shares, + assert_Snap_Removed_Staker_DepositShares(staker, strategies, shares, "check_QueuedWithdrawal_State: failed to remove staker shares"); + assert_Snap_Removed_Staker_WithdrawableShares(staker, strategies, shares, + "check_QueuedWithdrawal_State: failed to remove staker withdrawable shares"); } function check_Undelegate_State( @@ -240,8 +243,10 @@ contract IntegrationCheckUtils is IntegrationBase { "check_Undelegate_State: staker should have increased nonce by withdrawals.length"); assert_Snap_Removed_OperatorShares(operator, strategies, shares, "check_Undelegate_State: failed to remove operator shares"); - assert_Snap_Removed_StakerDepositShares(staker, strategies, shares, + assert_Snap_Removed_Staker_DepositShares(staker, strategies, shares, "check_Undelegate_State: failed to remove staker shares"); + assert_Snap_Removed_Staker_WithdrawableShares(staker, strategies, shares, + "check_QueuedWithdrawal_State: failed to remove staker withdrawable shares"); } /** @@ -267,7 +272,7 @@ contract IntegrationCheckUtils is IntegrationBase { assert_WithdrawalNotPending(delegationManager.calculateWithdrawalRoot(withdrawal), "staker withdrawal should no longer be pending"); assert_Snap_Added_TokenBalances(staker, tokens, expectedTokens, "staker should have received expected tokens"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker shares should not have changed"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker shares should not have changed"); assert_Snap_Removed_StrategyShares(strategies, shares, "strategies should have total shares decremented"); // Checks specific to an operator that the Staker has delegated to @@ -366,8 +371,9 @@ contract IntegrationCheckUtils is IntegrationBase { // Common checks assert_WithdrawalNotPending(delegationManager.calculateWithdrawalRoot(withdrawal), "staker withdrawal should no longer be pending"); + // TODO FIXME // assert_Snap_Added_TokenBalances(staker, tokens, expectedTokens, "staker should have received expected tokens"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker shares should not have changed"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker shares should not have changed"); assert_Snap_Removed_StrategyShares(withdrawal.strategies, withdrawal.scaledShares, "strategies should have total shares decremented"); // Checks specific to an operator that the Staker has delegated to diff --git a/src/test/integration/IntegrationDeployer.t.sol b/src/test/integration/IntegrationDeployer.t.sol index 77ef046c64..f3f758f004 100644 --- a/src/test/integration/IntegrationDeployer.t.sol +++ b/src/test/integration/IntegrationDeployer.t.sol @@ -10,6 +10,7 @@ import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; import "forge-std/Test.sol"; import "src/contracts/core/DelegationManager.sol"; +import "src/contracts/core/AllocationManager.sol"; import "src/contracts/core/StrategyManager.sol"; import "src/contracts/strategies/StrategyFactory.sol"; import "src/contracts/strategies/StrategyBase.sol"; @@ -92,6 +93,10 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser { _assetTypes: HOLDS_LST | HOLDS_ETH | HOLDS_ALL, _userTypes: DEFAULT | ALT_METHODS }); + + // Used to create shared setups between tests + _init(); + _; } @@ -137,6 +142,12 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser { } } + /// @dev Used to create shared setup between tests. This method is called + /// when the `rand` modifier is run, before a test starts + function _init() internal virtual { + return; + } + /** * env FOUNDRY_PROFILE=forktest forge t --mc Integration * @@ -473,7 +484,7 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser { allTokens.push(underlyingToken); } - function _configRand(uint24 _randomSeed, uint _assetTypes, uint _userTypes) internal { + function _configRand(uint24 _randomSeed, uint _assetTypes, uint _userTypes) private { // Using uint24 for the seed type so that if a test fails, it's easier // to manually use the seed to replay the same test. random = _hash(_randomSeed); diff --git a/src/test/integration/tests/Deposit_Delegate_Allocate_Slash_Queue_Redeposit.t.sol b/src/test/integration/tests/Deposit_Delegate_Allocate_Slash_Queue_Redeposit.t.sol index 3ea423dfc8..b85b22ccdc 100644 --- a/src/test/integration/tests/Deposit_Delegate_Allocate_Slash_Queue_Redeposit.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_Allocate_Slash_Queue_Redeposit.t.sol @@ -7,15 +7,11 @@ import {console} from "forge-std/console.sol"; contract Integration_Deposit_Delegate_Allocate_Slash_Queue_Redeposit is IntegrationCheckUtils, IDelegationManagerTypes { - // TODO: Partial deposits don't work when beacon chain eth balance is initialized to < 64 ETH, need to write _newRandomStaker variant that ensures beacon chain ETH balance - // greater than or equal to 64 - modifier rand(uint24 r) override { - _configRand({ - _randomSeed: r, - _assetTypes: HOLDS_LST, - _userTypes: DEFAULT - }); - _; + function _init() internal override { + // TODO: Partial deposits don't work when beacon chain eth balance is initialized to < 64 ETH, need to write _newRandomStaker variant that ensures beacon chain ETH balance + // greater than or equal to 64 + _configAssetTypes(HOLDS_LST); + _configUserTypes(DEFAULT); } function testFuzz_deposit_delegate_allocate_fullSlash_queue_complete_redeposit( @@ -74,7 +70,7 @@ contract Integration_Deposit_Delegate_Allocate_Slash_Queue_Redeposit is Integrat slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } @@ -161,7 +157,7 @@ contract Integration_Deposit_Delegate_Allocate_Slash_Queue_Redeposit is Integrat slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } @@ -249,7 +245,7 @@ contract Integration_Deposit_Delegate_Allocate_Slash_Queue_Redeposit is Integrat slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } @@ -316,7 +312,7 @@ contract Integration_Deposit_Delegate_Allocate_Slash_Queue_Redeposit is Integrat _strategiesAndWadsForRandFullSlash(operatorSet); slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } 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 9936fce413..ff558d79d7 100644 --- a/src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol @@ -5,6 +5,8 @@ import "src/test/integration/users/User.t.sol"; import "src/test/integration/IntegrationChecks.t.sol"; contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUtils { + using ArrayLib for *; + /// Randomly generates a user with different held assets. Then: /// 1. deposit into strategy /// 2. delegate to an operator @@ -254,7 +256,7 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti (User operator1, ,) = _newRandomOperator(); (User operator2, ,) = _newRandomOperator(); - uint[] memory shares = _calculateExpectedShares(strategies, tokenBalances); + uint[] memory totalShares = new uint[](strategies.length); assert_HasNoDelegatableShares(staker, "staker should not have delegatable shares before depositing"); assertFalse(delegationManager.isDelegated(address(staker)), "staker should not be delegated"); @@ -263,24 +265,24 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti // Divide shares by 2 in new array to do deposits after redelegate uint[] memory numTokensToDeposit = new uint[](tokenBalances.length); uint[] memory numTokensRemaining = new uint[](tokenBalances.length); - for (uint i = 0; i < shares.length; i++) { + for (uint i = 0; i < strategies.length; i++) { numTokensToDeposit[i] = tokenBalances[i] / 2; numTokensRemaining[i] = tokenBalances[i] - numTokensToDeposit[i]; } - uint[] memory halfShares = _calculateExpectedShares(strategies, numTokensToDeposit); + uint[] memory sharesFromFirstDeposit = _calculateExpectedShares(strategies, numTokensToDeposit); /// 1. Deposit Into Strategies staker.depositIntoEigenlayer(strategies, numTokensToDeposit); - check_Deposit_State_PartialDeposit(staker, strategies, halfShares, numTokensRemaining); + check_Deposit_State_PartialDeposit(staker, strategies, sharesFromFirstDeposit, numTokensRemaining); // 2. Delegate to an operator staker.delegateTo(operator1); - check_Delegation_State(staker, operator1, strategies, halfShares); + check_Delegation_State(staker, operator1, strategies, sharesFromFirstDeposit); // 3. Undelegate from an operator IDelegationManagerTypes.Withdrawal[] memory withdrawals = staker.undelegate(); bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); - check_Undelegate_State(staker, operator1, withdrawals, withdrawalRoots, strategies, halfShares); + check_Undelegate_State(staker, operator1, withdrawals, withdrawalRoots, strategies, sharesFromFirstDeposit); // 4. Complete withdrawal as shares // Fast forward to when we can complete the withdrawal @@ -291,23 +293,27 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti } // 5. Deposit into Strategies - uint[] memory sharesAdded = _calculateExpectedShares(strategies, numTokensRemaining); + uint[] memory sharesFromSecondDeposit = _calculateExpectedShares(strategies, numTokensRemaining); + for (uint i = 0; i < strategies.length; i++) { + totalShares[i] = sharesFromFirstDeposit[i] + sharesFromSecondDeposit[i]; + } + staker.depositIntoEigenlayer(strategies, numTokensRemaining); - tokenBalances = _calculateExpectedTokens(strategies, shares); - check_Deposit_State(staker, strategies, sharesAdded); + tokenBalances = _calculateExpectedTokens(strategies, totalShares); + check_Deposit_State(staker, strategies, sharesFromSecondDeposit); // 6. Delegate to a new operator staker.delegateTo(operator2); - check_Delegation_State(staker, operator2, strategies, shares); + check_Delegation_State(staker, operator2, strategies, totalShares); assertNotEq(address(operator1), delegationManager.delegatedTo(address(staker)), "staker should not be delegated to operator1"); } { // 7. Queue Withdrawal - shares = _calculateExpectedShares(strategies, tokenBalances); - IDelegationManagerTypes.Withdrawal[] memory newWithdrawals = staker.queueWithdrawals(strategies, shares); + totalShares = _calculateExpectedShares(strategies, tokenBalances); + IDelegationManagerTypes.Withdrawal[] memory newWithdrawals = staker.queueWithdrawals(strategies, totalShares); bytes32[] memory newWithdrawalRoots = _getWithdrawalHashes(newWithdrawals); - check_QueuedWithdrawal_State(staker, operator2, strategies, shares, newWithdrawals, newWithdrawalRoots); + check_QueuedWithdrawal_State(staker, operator2, strategies, totalShares, newWithdrawals, newWithdrawalRoots); // 8. Complete withdrawal // Fast forward to when we can complete the withdrawal @@ -317,7 +323,7 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti for (uint i = 0; i < newWithdrawals.length; i++) { uint[] memory expectedTokens = _calculateExpectedTokens(newWithdrawals[i].strategies, newWithdrawals[i].scaledShares); IERC20[] memory tokens = staker.completeWithdrawalAsTokens(newWithdrawals[i]); - check_Withdrawal_AsTokens_State(staker, operator2, newWithdrawals[i], strategies, shares, tokens, expectedTokens); + check_Withdrawal_AsTokens_State(staker, operator2, newWithdrawals[i], strategies, totalShares, tokens, expectedTokens); } } } @@ -425,7 +431,8 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti check_Withdrawal_AsTokens_State(staker, operator1, withdrawals[i], withdrawals[i].strategies, withdrawals[i].scaledShares, tokens, expectedTokens); } - //5. Deposit into Strategies + // 5. Deposit into Strategies + shares = _calculateExpectedShares(strategies, withdrawnTokenBalances); staker.depositIntoEigenlayer(strategies, withdrawnTokenBalances); check_Deposit_State(staker, strategies, shares); diff --git a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol b/src/test/integration/tests/SlashingWithdrawals.t.sol similarity index 51% rename from src/test/integration/tests/Deposit_Delegate_Allocate.t.sol rename to src/test/integration/tests/SlashingWithdrawals.t.sol index c55d8eb7af..fb2cff0927 100644 --- a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol +++ b/src/test/integration/tests/SlashingWithdrawals.t.sol @@ -2,27 +2,48 @@ pragma solidity ^0.8.27; import "src/test/integration/IntegrationChecks.t.sol"; -import "src/test/integration/users/User.t.sol"; -contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { - function testFuzz_deposit_delegate_allocate(uint24 _random) public rand(_random) { - (User staker, IStrategy[] memory strategies, uint256[] memory tokenBalances) = _newRandomStaker(); - (User operator,,) = _newRandomOperator(); - (AVS avs,) = _newRandomAVS(); +contract SlashingWithdrawals is IntegrationCheckUtils { + + AVS avs; + OperatorSet operatorSet; + + User operator; + IAllocationManagerTypes.AllocateParams allocateParams; + + User staker; + IStrategy[] strategies; + uint[] initTokenBalances; + + /// Shared setup: + /// + /// 1. Generate staker, operator, and AVS + /// 2. Staker deposits and delegates to operator + /// 3. AVS creates an operator set containing the strategies held by the staker + /// 4. Operator registers for operator set (default allocation delay) + /// 5. Operator allocates to operator set + function _init() internal override { + (staker, strategies, initTokenBalances) = _newRandomStaker(); + (operator,,) = _newRandomOperator(); + (avs,) = _newRandomAVS(); // 1. Deposit Into Strategies - staker.depositIntoEigenlayer(strategies, tokenBalances); + staker.depositIntoEigenlayer(strategies, initTokenBalances); + uint[] memory shares = _calculateExpectedShares(strategies, initTokenBalances); + check_Deposit_State(staker, strategies, shares); // 2. Delegate to an operator staker.delegateTo(operator); + check_Delegation_State(staker, operator, strategies, shares); - // Create an operator set and register an operator. - OperatorSet memory operatorSet = avs.createOperatorSet(strategies); + // 3. Create an operator set and register an operator. + operatorSet = avs.createOperatorSet(strategies); + // TODO invariant checks here operator.registerForOperatorSet(operatorSet); - - // 3. Allocate to operator set. - IAllocationManagerTypes.AllocateParams memory allocateParams = - operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); + // TODO invariant checks here + + // 4. Allocate to operator set + allocateParams = operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); assert_Snap_Allocations_Modified( operator, allocateParams, false, "operator allocations should be updated before delay" ); @@ -32,34 +53,9 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { ); } - function testFuzz_deposit_delegate_allocate_slash_undelegate_completeAsTokens( + function testFuzz_slash_undelegate_completeAsTokens( uint24 _random ) public rand(_random) { - (User staker, IStrategy[] memory strategies, uint256[] memory tokenBalances) = _newRandomStaker(); - (User operator,,) = _newRandomOperator(); - (AVS avs,) = _newRandomAVS(); - - // 1. Deposit Into Strategies - staker.depositIntoEigenlayer(strategies, tokenBalances); - - // 2. Delegate to an operator - staker.delegateTo(operator); - - // Create an operator set and register an operator. - OperatorSet memory operatorSet = avs.createOperatorSet(strategies); - operator.registerForOperatorSet(operatorSet); - - // 3. Allocate to operator set. - IAllocationManagerTypes.AllocateParams memory allocateParams = - operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); - assert_Snap_Allocations_Modified( - operator, allocateParams, false, "operator allocations should be updated before delay" - ); - _rollBlocksForCompleteAllocation(operator, operatorSet, strategies); - assert_Snap_Allocations_Modified( - operator, allocateParams, true, "operator allocations should be updated after delay" - ); - // 4. Slash operator IAllocationManagerTypes.SlashingParams memory slashingParams; { @@ -67,7 +63,7 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { _randStrategiesAndWadsToSlash(operatorSet); slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } @@ -90,43 +86,15 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { staker, allocateParams, slashingParams, - tokenBalances, - "staker should once again have original token tokenBalances minus slashed" + initTokenBalances, + "staker should once again have original token initTokenBalances minus slashed" ); assert_NoWithdrawalsPending(withdrawalRoots, "all withdrawals should be removed from pending"); } - function testFuzz_deposit_delegate_allocate_slash_undelegate_completeAsShares( + function testFuzz_slash_undelegate_completeAsShares( uint24 _random ) public rand(_random) { - (User staker, IStrategy[] memory strategies, uint256[] memory tokenBalances) = _newRandomStaker(); - (User operator,,) = _newRandomOperator(); - (AVS avs,) = _newRandomAVS(); - - - // 1. Deposit Into Strategies - staker.depositIntoEigenlayer(strategies, tokenBalances); - uint256[] memory shares = _calculateExpectedShares(strategies, tokenBalances); - // TODO - post-deposit and post-delegate checks? - - // 2. Delegate to an operator - staker.delegateTo(operator); - - // Create an operator set and register an operator. - OperatorSet memory operatorSet = avs.createOperatorSet(strategies); - operator.registerForOperatorSet(operatorSet); - - // 3. Allocate to operator set. - IAllocationManagerTypes.AllocateParams memory allocateParams = - operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); - assert_Snap_Allocations_Modified( - operator, allocateParams, false, "operator allocations should be updated before delay" - ); - _rollBlocksForCompleteAllocation(operator, operatorSet, strategies); - assert_Snap_Allocations_Modified( - operator, allocateParams, true, "operator allocations should be updated after delay" - ); - // 4. Slash operator IAllocationManagerTypes.SlashingParams memory slashingParams; { @@ -134,7 +102,7 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { _randStrategiesAndWadsToSlash(operatorSet); slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } @@ -156,36 +124,12 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { assert_NoWithdrawalsPending(withdrawalRoots, "all withdrawals should be removed from pending"); } - function testFuzz_deposit_delegate_allocate_queue_slash_completeAsTokens( + function testFuzz_queue_slash_completeAsTokens( uint24 _random ) public rand(_random) { - (User staker, IStrategy[] memory strategies, uint256[] memory tokenBalances) = _newRandomStaker(); - (User operator,,) = _newRandomOperator(); - (AVS avs,) = _newRandomAVS(); - - // 1. Deposit Into Strategies - staker.depositIntoEigenlayer(strategies, tokenBalances); - // 2. Delegate to an operator - staker.delegateTo(operator); - - // Create an operator set and register an operator. - OperatorSet memory operatorSet = avs.createOperatorSet(strategies); - operator.registerForOperatorSet(operatorSet); - - // 3. Allocate to operator set. - IAllocationManagerTypes.AllocateParams memory allocateParams = - operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); - assert_Snap_Allocations_Modified( - operator, allocateParams, false, "operator allocations should be updated before delay" - ); - _rollBlocksForCompleteAllocation(operator, operatorSet, strategies); - assert_Snap_Allocations_Modified( - operator, allocateParams, true, "operator allocations should be updated after delay" - ); - // 4. Queue withdrawal IDelegationManagerTypes.Withdrawal[] memory withdrawals = - staker.queueWithdrawals(strategies, _calculateExpectedShares(strategies, tokenBalances)); + staker.queueWithdrawals(strategies, _calculateExpectedShares(strategies, initTokenBalances)); bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); // 5. Slash operator @@ -195,7 +139,7 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { _randStrategiesAndWadsToSlash(operatorSet); slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } @@ -216,43 +160,18 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { staker, allocateParams, slashingParams, - tokenBalances, - "staker should once again have original token tokenBalances minus slashed" + initTokenBalances, + "staker should once again have original token initTokenBalances minus slashed" ); assert_NoWithdrawalsPending(withdrawalRoots, "all withdrawals should be removed from pending"); } - function testFuzz_deposit_delegate_allocate_queue_slash_completeAsShares( + function testFuzz_queue_slash_completeAsShares( uint24 _random ) public rand(_random) { - (User staker, IStrategy[] memory strategies, uint256[] memory tokenBalances) = _newRandomStaker(); - (User operator,,) = _newRandomOperator(); - (AVS avs,) = _newRandomAVS(); - - // 1. Deposit Into Strategies - staker.depositIntoEigenlayer(strategies, tokenBalances); - // 2. Delegate to an operator - staker.delegateTo(operator); - - // Create an operator set and register an operator. - OperatorSet memory operatorSet = avs.createOperatorSet(strategies); - operator.registerForOperatorSet(operatorSet); - operator.setAllocationDelay(1); - - // 3. Allocate to operator set. - IAllocationManagerTypes.AllocateParams memory allocateParams = - operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); - assert_Snap_Allocations_Modified( - operator, allocateParams, false, "operator allocations should be updated before delay" - ); - _rollBlocksForCompleteAllocation(operator, operatorSet, strategies); - assert_Snap_Allocations_Modified( - operator, allocateParams, true, "operator allocations should be updated after delay" - ); - // 4. Queue withdrawal IDelegationManagerTypes.Withdrawal[] memory withdrawals = - staker.queueWithdrawals(strategies, _calculateExpectedShares(strategies, tokenBalances)); + staker.queueWithdrawals(strategies, _calculateExpectedShares(strategies, initTokenBalances)); bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); // 5. Slash operator @@ -262,7 +181,7 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { _randStrategiesAndWadsToSlash(operatorSet); slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } @@ -280,35 +199,9 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { assert_NoWithdrawalsPending(withdrawalRoots, "all withdrawals should be removed from pending"); } - function testFuzz_deposit_delegate_allocate_deallocate_slash_queue_completeAsTokens( + function testFuzz_deallocate_slash_queue_completeAsTokens( uint24 _random ) public rand(_random) { - (User staker, IStrategy[] memory strategies, uint256[] memory tokenBalances) = _newRandomStaker(); - (User operator,,) = _newRandomOperator(); - (AVS avs,) = _newRandomAVS(); - - // 1. Deposit Into Strategies - staker.depositIntoEigenlayer(strategies, tokenBalances); - // 2. Delegate to an operator - staker.delegateTo(operator); - - // Create an operator set and register an operator. - OperatorSet memory operatorSet = avs.createOperatorSet(strategies); - operator.registerForOperatorSet(operatorSet); - operator.setAllocationDelay(1); - - console.log("block allocated", block.number); - // 3. Allocate to operator set. - IAllocationManagerTypes.AllocateParams memory allocateParams = - operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); - assert_Snap_Allocations_Modified( - operator, allocateParams, false, "operator allocations should be updated before delay" - ); - _rollBlocksForCompleteAllocation(operator, operatorSet, strategies); - assert_Snap_Allocations_Modified( - operator, allocateParams, true, "operator allocations should be updated after delay" - ); - // 4. Deallocate all. IAllocationManagerTypes.AllocateParams memory deallocateParams = operator.deallocateAll(operatorSet); _rollBlocksForCompleteAllocation(operator, operatorSet, strategies); @@ -320,13 +213,13 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { _randStrategiesAndWadsToSlash(operatorSet); slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, deallocateParams, slashingParams, "staker deposit shares should be slashed"); } // 6. Queue withdrawals IDelegationManagerTypes.Withdrawal[] memory withdrawals = - staker.queueWithdrawals(strategies, _calculateExpectedShares(strategies, tokenBalances)); + staker.queueWithdrawals(strategies, _calculateExpectedShares(strategies, initTokenBalances)); bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); // 7. Complete withdrawal @@ -344,39 +237,15 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { assert_HasUnderlyingTokenBalances( staker, allocateParams.strategies, - tokenBalances, + initTokenBalances, "staker should have withdrawn all shares" ); assert_NoWithdrawalsPending(withdrawalRoots, "all withdrawals should be removed from pending"); } - function testFuzz_deposit_delegate_allocate_deregister_slash( + function testFuzz_deregister_slash( uint24 _random ) public rand(_random) { - (User staker, IStrategy[] memory strategies, uint256[] memory tokenBalances) = _newRandomStaker(); - (User operator,,) = _newRandomOperator(); - (AVS avs,) = _newRandomAVS(); - - // 1. Deposit Into Strategies - staker.depositIntoEigenlayer(strategies, tokenBalances); - // 2. Delegate to an operator - staker.delegateTo(operator); - - // Create an operator set and register an operator. - OperatorSet memory operatorSet = avs.createOperatorSet(strategies); - operator.registerForOperatorSet(operatorSet); - - // 3. Allocate to operator set. - IAllocationManagerTypes.AllocateParams memory allocateParams = - operator.modifyAllocations(operatorSet, _randMagnitudes({sum: 1 ether, len: strategies.length})); - assert_Snap_Allocations_Modified( - operator, allocateParams, false, "operator allocations should be updated before delay" - ); - _rollBlocksForCompleteAllocation(operator, operatorSet, strategies); - assert_Snap_Allocations_Modified( - operator, allocateParams, true, "operator allocations should be updated after delay" - ); - // 4. Deregister. operator.deregisterFromOperatorSet(operatorSet); @@ -387,8 +256,8 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { _randStrategiesAndWadsToSlash(operatorSet); slashingParams = avs.slashOperator(operator, operatorSet.id, strategiesToSlash, wadsToSlash); assert_Snap_Allocations_Slashed(slashingParams, operatorSet, true, "operator allocations should be slashed"); - assert_Snap_Unchanged_StakerDepositShares(staker, "staker deposit shares should be unchanged after slashing"); + assert_Snap_Unchanged_Staker_DepositShares(staker, "staker deposit shares should be unchanged after slashing"); assert_Snap_StakerWithdrawableShares_AfterSlash(staker, allocateParams, slashingParams, "staker deposit shares should be slashed"); } } -} +} \ No newline at end of file diff --git a/src/test/integration/tests/eigenpod/VerifyWC_StartCP_CompleteCP.t.sol b/src/test/integration/tests/eigenpod/VerifyWC_StartCP_CompleteCP.t.sol index 90374d679a..e72a39a0cb 100644 --- a/src/test/integration/tests/eigenpod/VerifyWC_StartCP_CompleteCP.t.sol +++ b/src/test/integration/tests/eigenpod/VerifyWC_StartCP_CompleteCP.t.sol @@ -6,13 +6,9 @@ import "src/test/integration/users/User.t.sol"; contract Integration_VerifyWC_StartCP_CompleteCP is IntegrationCheckUtils { - modifier rand(uint24 r) override { - _configRand({ - _randomSeed: r, - _assetTypes: HOLDS_ETH, - _userTypes: DEFAULT - }); - _; + function _init() internal override { + _configAssetTypes(HOLDS_ETH); + _configUserTypes(DEFAULT); } function test_GasMetering() public rand(0) { diff --git a/src/test/integration/tests/upgrade/Complete_PreSlashing_Withdrawal.t.sol b/src/test/integration/tests/upgrade/Complete_PreSlashing_Withdrawal.t.sol index f161a3d9d0..347b0543db 100644 --- a/src/test/integration/tests/upgrade/Complete_PreSlashing_Withdrawal.t.sol +++ b/src/test/integration/tests/upgrade/Complete_PreSlashing_Withdrawal.t.sol @@ -28,7 +28,7 @@ contract Integration_Upgrade_Complete_PreSlashing_Withdrawal is UpgradeTest { } } - function testFuzz_delegate_deposit_queue_completeAsShares(uint24 _random) public rand(_random) { + function testFuzz_delegate_deposit_queue_upgrade_completeAsShares(uint24 _random) public rand(_random) { /// Pre-upgrade: /// 1. Create staker and operator with some asset amounts /// 2. Staker delegates to operator @@ -77,7 +77,7 @@ contract Integration_Upgrade_Complete_PreSlashing_Withdrawal is UpgradeTest { } } - function testFuzz_delegate_deposit_queue_completeAsTokens(uint24 _random) public rand(_random) { + function testFuzz_delegate_deposit_queue_upgrade_completeAsTokens(uint24 _random) public rand(_random) { /// Pre-upgrade: /// 1. Create staker and operator with some asset amounts /// 2. Staker delegates to operator diff --git a/src/test/integration/tests/upgrade/EigenPod_Slashing_Migration.t.sol b/src/test/integration/tests/upgrade/EigenPod_Slashing_Migration.t.sol index 47bb30b470..f7ed80228e 100644 --- a/src/test/integration/tests/upgrade/EigenPod_Slashing_Migration.t.sol +++ b/src/test/integration/tests/upgrade/EigenPod_Slashing_Migration.t.sol @@ -5,13 +5,9 @@ import "src/test/integration/UpgradeTest.t.sol"; contract Integration_Upgrade_EigenPod_Slashing_Migration is UpgradeTest, EigenPodPausingConstants { - modifier rand(uint24 _rand) override { - _configRand({ - _randomSeed: _rand, - _assetTypes: HOLDS_ETH, - _userTypes: DEFAULT - }); - _; + function _init() internal override { + _configAssetTypes(HOLDS_ETH); + _configUserTypes(DEFAULT); } /**