Skip to content

Make discrete_log asynchronous - #396

Closed
AddressXception wants to merge 2 commits into
mainfrom
bug/event-loop
Closed

AddressXception wants to merge 2 commits into
mainfrom
bug/event-loop

Conversation

@AddressXception

@AddressXception AddressXception commented Jul 23, 2021 •

Copy link
Copy Markdown
Contributor

Issue

Link your PR to an issue

Fixes #393

Description

Make the dlog async/await and propagate through the rest of the API's. This is not an ideal solution for the long term but it unblocks the issue in the short term allowing the code to be called from inside a running event loop.

Further work to fix this correctly is tracked in #397 #397

Testing

  1. run the tests

propagate async/await through the decrypt functions.  use asyncio.run when calling async functions from tests.  while not ideal, this is the simplest ways to bridge new functionality without reworking the code significantly.
@danwallach

Copy link
Copy Markdown
Collaborator

Propagating all that async stuff everywhere is a real mess for using ElectionGuard as a library. Much better to provide some sort of bridge so you can call an async version or a synchronous version. If you're making changes in elgamal.py, that's really bad.

@keithrfung
keithrfung self-requested a review July 26, 2021 11:52
@keithrfung

Copy link
Copy Markdown
Contributor

@danwallach
The bigger issue is the discrete log functiondlog which is sitting underneath is already asynchronous but is wrapped in synchronous calls. Your point is relevant, but it's already present with the dlog as it is currently designed.

This change highlights the clear asynchronous chain that's dependent on dlog.

Consider for a moment, that an async and sync set would still require making a truly non async dlog. The core root issue. If this could be completed, then there would be no need for these changes.

@danwallach

Copy link
Copy Markdown
Collaborator

The issue isn't synchronous vs asynchronous. The issue is that there needs to be a write-lock around the results cache. If async pollution is the problem, the solution is to find a different way to implement the write lock.

@AddressXception

Copy link
Copy Markdown
Contributor Author

agreed, what as missing here was this ticket to track the follow-on work as part of a larger epic.

#397

@AddressXception

Copy link
Copy Markdown
Contributor Author

replaced by #405

@keithrfung
keithrfung deleted the bug/event-loop branch August 4, 2021 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove asyncio.run call in dlog.py

3 participants