Skip to content

Commit

Permalink
Merge pull request #640 from lidofinance/skip-empty-exitable-validato…
Browse files Browse the repository at this point in the history
…rs-has-predictable

Skip ejection on empty exitable_validators
  • Loading branch information
F4ever authored Feb 28, 2025
2 parents 14e2836 + 529c645 commit d57c554
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/services/exit_order_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,14 @@ def get_remaining_forced_validators(self) -> list[tuple[NodeOperatorGlobalIndex,
# The current and all subsequent NOs in the list has no forced validators to exit. Cycle done
return result

if no_stats.predictable_validators:
gid = (
no_stats.node_operator.staking_module.id,
no_stats.node_operator.id,
)

if self.exitable_validators[gid]:
# When found Node Operator
self.index += 1
gid = (
no_stats.node_operator.staking_module.id,
no_stats.node_operator.id,
)
result.append((gid, self._eject_validator(gid)))
break

Expand Down
6 changes: 6 additions & 0 deletions tests/modules/ejector/test_validator_exit_order_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,19 @@ def test_get_remaining_forced_validators(iterator):
force_exit_to=9,
node_operator=NodeOperatorFactory.build(id=4, staking_module=sm),
),
(1, 5): NodeOperatorStatsFactory.build(
predictable_validators=10,
force_exit_to=9,
node_operator=NodeOperatorFactory.build(id=5, staking_module=sm),
),
}

iterator.exitable_validators = {
(1, 1): [],
(1, 2): [LidoValidatorFactory.build(index=5)],
(1, 3): [LidoValidatorFactory.build(index=3)],
(1, 4): [LidoValidatorFactory.build(index=4)],
(1, 5): [],
}

def _eject(self, gid):
Expand Down

0 comments on commit d57c554

Please sign in to comment.