Skip to content

Commit 27cade3

Browse files
committed
fix(horizon): respect minimum delegation requirement in slash test
The testSlash_RoundDown_TokensThawing_Delegation test was failing because it could generate scenarios where undelegating would leave less than the minimum delegation amount (1 ether) in the pool, which violates the protocol's minimum delegation constraint. Added assumption to ensure undelegation either removes all tokens or leaves at least MIN_DELEGATION in the pool, making the test compliant with the protocol's validation rules introduced in commit 91cda56.
1 parent 3faf055 commit 27cade3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/horizon/test/unit/staking/slash/slash.t.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ contract HorizonStakingSlashTest is HorizonStakingTest {
172172
vm.assume(delegationTokensToSlash <= delegationTokens);
173173
vm.assume(delegationTokensToUndelegate <= delegationTokens);
174174
vm.assume(delegationTokensToUndelegate > 0);
175+
// Ensure that after undelegating, either we undelegate everything or leave at least MIN_DELEGATION
176+
vm.assume(delegationTokensToUndelegate == delegationTokens || delegationTokens - delegationTokensToUndelegate >= MIN_DELEGATION);
175177

176178
resetPrank(users.delegator);
177179
_delegate(users.indexer, subgraphDataServiceAddress, delegationTokens, 0);

0 commit comments

Comments
 (0)