Skip to content

Commit

Permalink
test: added check that minslashablestake increases for allocated stra…
Browse files Browse the repository at this point in the history
…tegies on delegation
  • Loading branch information
Michael authored and Michael committed Feb 20, 2025
1 parent 184a361 commit a1b5319
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/test/integration/IntegrationBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,13 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {
})[0];
}

function _getStrategyAllocations(
User operator,
IStrategy strategy
) internal view returns (OperatorSet[] memory operatorSets, Allocation[] memory allocations) {
(operatorSets, allocations) = allocationManager.getStrategyAllocations(address(operator), strategy);
}

function _getPrevIsSlashable(
User operator,
OperatorSet memory operatorSet
Expand Down
17 changes: 16 additions & 1 deletion src/test/integration/IntegrationChecks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,22 @@ contract IntegrationCheckUtils is IntegrationBase {
assert_Snap_Expected_Staker_WithdrawableShares_Delegation(staker, operator, strategies, shares, "withdrawable shares should be unchanged within rounding error after delegating");
uint256[] memory delegatableShares = _getPrevStakerWithdrawableShares(staker, strategies);
assert_Snap_Added_OperatorShares(operator, strategies, delegatableShares, "operator should have received shares");
//assert_Snap_Added_SlashableStake(operator, operatorSet, strategies, delegatableShares, "operator slashable stake should increase");
check_Added_SlashableStake_Delegation(operator, strategies, delegatableShares);
}

function check_Added_SlashableStake_Delegation(
User operator,
IStrategy[] memory strategies,
uint[] memory shares
) internal {
for (uint i = 0; i < strategies.length; i++) {
(OperatorSet[] memory operatorSets, Allocation[] memory allocations) = _getStrategyAllocations(operator, strategies[i]);
for (uint j = 0; j < operatorSets.length; j++) {
if (allocations[j].currentMagnitude < 0) {
assert_Snap_StakeBecameSlashable(operator, operatorSets[j], strategies[i].toArray(), "allocated strategies should have minSlashableStake increased");
}
}
}
}

function check_QueuedWithdrawal_State(
Expand Down

0 comments on commit a1b5319

Please sign in to comment.