Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease logging for indexes #190

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)}..."