Skip to content

Commit

Permalink
Rework signature rotation parallel (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-stakewise authored Jan 19, 2024
1 parent d345eda commit 35b7bfc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/exits/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,26 @@ async def send_signature_rotation_requests(
approvals: dict[ChecksumAddress, OracleApproval] = {}
failed_endpoints: list[str] = []
async with aiohttp.ClientSession() as session:
for address, replicas in endpoints:
try:
response = await send_signature_rotation_request_to_replicas(
results = await asyncio.gather(
*[
send_signature_rotation_request_to_replicas(
session=session, replicas=replicas, payload=payload
)
except Exception as e:
for address, replicas in endpoints
],
return_exceptions=True,
)
for (address, replicas), result in zip(endpoints, results):
if isinstance(result, Exception):
warning_verbose(
'All endpoints for oracle %s failed to sign signature rotation request. '
'Last error: %s',
address,
format_error(e),
format_error(result),
)
failed_endpoints.extend(replicas)
continue
approvals[address] = response
approvals[address] = result

logger.info(
'Fetched oracle approvals for signatures update of %d validators. '
Expand Down

0 comments on commit 35b7bfc

Please sign in to comment.