Skip to content

Commit

Permalink
Ignore missed validators in exit sig update task (#235)
Browse files Browse the repository at this point in the history
* Ignore missed validators in exit sig update task

Signed-off-by: cyc60 <[email protected]>

* Update tests

Signed-off-by: cyc60 <[email protected]>

---------

Signed-off-by: cyc60 <[email protected]>
  • Loading branch information
cyc60 authored Nov 17, 2023
1 parent 2bf007f commit 8510427
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def mocked_oracles(
for i in range(len(_mocked_oracle_committee.oracle_pubkeys))
],
validators_approval_batch_limit=1,
validators_exit_rotation_batch_limit=1,
validators_exit_rotation_batch_limit=2,
signature_validity_period=60,
)

Expand Down
7 changes: 4 additions & 3 deletions src/exits/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ async def _update_exit_signatures(
outdated_indexes: list[int],
) -> None:
"""Fetches update signature requests from oracles."""
exit_rotation_batch_limit = oracles.validators_exit_rotation_batch_limit
outdated_indexes = outdated_indexes[:exit_rotation_batch_limit]

logger.info('Starting exit signature rotation for %d validators', len(outdated_indexes))
# pylint: disable=duplicate-code
validators = await get_validator_public_keys(outdated_indexes)
Expand Down Expand Up @@ -184,8 +181,12 @@ async def _get_oracles_request(
deadline=get_current_timestamp() + oracles.signature_validity_period,
)
failed_indexes = []
exit_rotation_batch_limit = oracles.validators_exit_rotation_batch_limit

for validator_index, public_key in validators.items():
if len(request.public_keys) >= exit_rotation_batch_limit:
break

if len(keystores) > 0 and public_key in keystores:
shards = get_exit_signature_shards(
validator_index=validator_index,
Expand Down
5 changes: 4 additions & 1 deletion src/exits/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,8 @@ async def test_remote_signer(
)

assert request.vault_address == vault_address
assert request.public_keys == list(validators.values())
assert (
request.public_keys
== list(validators.values())[: oracles.validators_exit_rotation_batch_limit]
)
assert request.deadline == deadline

0 comments on commit 8510427

Please sign in to comment.