Introduce recursive proofs from within ZkPrograms #318
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
companion of o1-labs/o1js#1931
1. Worker changes
Previously, we properly managed thread pool accesses in the Node.js version using a little ad-hoc state machine. Thanks to that, creating a proof from within a witness block inside another proof (needed in o1-labs/o1js#1931) just worked in Node.js from the get-go.
However, the web version naively tried to launch a second thread pool, which doesn't work because on the Rust side the thread pool is a single global object.
This PR moves the thread pool management into a separate file, porting it to TS in the process, and uses it in the web version as well.
I manually confirmed that nested proofs work in the browser, by running
and navigating to the web page that this script serves.
2. Pickles bindings changes
A second change here was necessary because the API used to dictate that we have all recursive proofs ready when calling the prover. Since proofs can now be created inside a circuit, I changed the bindings API such that it expects the proofs to be returned from the JS circuit, and not already as direct argument to the prover