Skip to content

Commit

Permalink
Decrease logging for indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-stakewise committed Oct 3, 2023
1 parent 81b9e2d commit 1131df8
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/exits/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ async def _get_oracles_request(
exit_signature_shards=[],
deadline=get_current_timestamp() + oracles.signature_validity_period,
)
failed_indexes = []

for validator_index, public_key in validators.items():
if len(keystores) > 0 and public_key in keystores:
shards = get_exit_signature_shards(
Expand All @@ -221,15 +223,25 @@ async def _get_oracles_request(
fork=fork,
)
else:
logger.warning(
'Failed to rotate validator exit signature: '
'public key %s not found in keystores or remote signer',
public_key,
)
failed_indexes.append(validator_index)
continue

request.public_keys.append(public_key)
request.public_key_shards.append(shards.public_keys)
request.exit_signature_shards.append(shards.exit_signatures)

if failed_indexes:
logger.warning(
'Failed to rotate validator exit signature for indexes: %s. '
'Reason: public key not found in keystores or remote signer',
_format_indexes(failed_indexes),
)

return request


def _format_indexes(indexes: list[int], max_len: int = 10) -> str:
if len(indexes) <= max_len:
return ', '.join(str(i) for i in indexes)

return f"{', '.join(str(i) for i in indexes)}..."

0 comments on commit 1131df8

Please sign in to comment.