-
Notifications
You must be signed in to change notification settings - Fork 107
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
Make circuits async: JS side #735
Comments
Having an async Circuit.witness could enable much nicer UX on 3rd party library side |
We've run into a performance bottleneck again while building https://protokit.dev, I'll try to briefly explain what exactly we have to do in the current block production pipeline and how async witnesses could help. For Smart Contracts / zkApps the on-chain state is preloaded at once (all 8 fields) and therefore synchronously accessible within the smart contract method, e.g. using a synchronous If the execution of a smart contract relies on additional private inputs (not known upfront), that depend on the partial result of computation of the method, and these inputs have to be fetched from somewhere - API, DB, etc. Then the code looks something like this:
What the synchronous witness approach results in is that if we can't reliably determine what data needs to be prefetched for the circuit execution, we end up with re-running the circuit to try and populate all the prefetched data one by one. This becomes especially noticeable if prefetching of "data 2" relies on the result of prefetching "data 1". To sum it up, async witnesses would greatly increase the performance of Protokit block production by decreasing the complexity of the implementation as well. |
Note: async witness is easy to implement purely in o1js if only we have async circuits |
Why:
The text was updated successfully, but these errors were encountered: