Skip to content
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

Introduce recursive proofs from within ZkPrograms #318

Merged
merged 6 commits into from
Dec 19, 2024

Conversation

mitschabaude
Copy link
Collaborator

@mitschabaude mitschabaude commented Nov 28, 2024

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

./run-in-browser.js src/tests/inductive-proofs-internal.ts 

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

@@ -26,59 +26,7 @@ if (!isMainThread) {
}

// state machine to enable calling multiple functions that need a thread pool at once
let state = 'none'; // 'initializing', 'running', 'exiting'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic was lifted into workers.ts in o1js, see o1-labs/o1js#1931

@mitschabaude mitschabaude merged commit 4ed86d4 into main Dec 19, 2024
1 check passed
@mitschabaude mitschabaude deleted the feature/declare-proofs branch December 19, 2024 15:00
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.

2 participants