Skip to content

Commit

Permalink
Problem: If a user request an already generated request_id and the sy…
Browse files Browse the repository at this point in the history
…stem cannot locate enough nodes it fails and doesn't check the already existing requests.

Solution: Execute the already request_id check before getting the existing nodes, allowing to return the existing ones also if any good node is found.
  • Loading branch information
Andres D. Molins authored and nesitor committed Sep 27, 2024
1 parent 26efc53 commit 4700931
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/aleph_vrf/coordinator/vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,6 @@ async def _generate_vrf(
executor_selection_policy: ExecutorSelectionPolicy,
request_id: Optional[str] = None,
) -> PublishedVRFResponse:
executors = await executor_selection_policy.select_executors(nb_executors)
selected_nodes_json = json.dumps(
[executor.node for executor in executors], default=pydantic_encoder
).encode(encoding="utf-8")

nonce = generate_nonce()

if request_id:
existing_message = await get_existing_vrf_message(aleph_client, request_id)
if existing_message:
Expand All @@ -120,6 +113,13 @@ async def _generate_vrf(

return message

executors = await executor_selection_policy.select_executors(nb_executors)
selected_nodes_json = json.dumps(
[executor.node for executor in executors], default=pydantic_encoder
).encode(encoding="utf-8")

nonce = generate_nonce()

vrf_request = VRFRequest(
nb_bytes=nb_bytes,
nb_executors=nb_executors,
Expand Down

0 comments on commit 4700931

Please sign in to comment.