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

Proving keys should be written to files instead of recomputed each time #1680

Closed
kevaundray opened this issue Aug 20, 2023 · 1 comment
Closed
Labels
C-bb.js Component: bb.js - wrapping bberg in js

Comments

@kevaundray
Copy link
Contributor

Problem

Currently there is no way to write a proving key to file and re-use it in subsequent proof creation procedures.

The main drawback is for those who want to create multiple proofs natively of the same circuit. There is also the case that verifying a proof requires a vk which initially requires a proving key, so for local development it can add up in terms of time spent, if you are verifying and executing a proof.

A separate weaker argument, is that this will aid in the move to dynamic backends since right now the proving and verifying keys are being used.

Solution

  • So that we don't make a breaking change, we can add a new command called WriteKeys. This will write the proving and verification key to some disk.

  • We can then add a new flag which will be for commands which can now take the proving key as path.

  • We can then add a load_proving_key method similar to load_verification_key which loads the proving key into the Composer.

None of the rest of the code should need modification since most methods were already checking to see if the proving_key_ field was set.

Note

With this we can get rid of ProveAndVerify; I believe it was added for only testing and to improve testing times. If we write the proving and verification keys, then it will avoid the need to create the proving keys for proving and verification, lowering the test times.

It also aids us in running tests which have a workflow which is closer to what users will be doing

@kevaundray kevaundray added the C-bb.js Component: bb.js - wrapping bberg in js label Aug 20, 2023
@github-project-automation github-project-automation bot moved this to Todo in A3 Aug 20, 2023
@kevaundray
Copy link
Contributor Author

As noted in the PR, the time it takes to copy the proving key versus recomputing (natively) is about a difference of 2x. I'll close for now and we can revisit if users complain about proving times.

@kevaundray kevaundray closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bb.js Component: bb.js - wrapping bberg in js
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant