-
Notifications
You must be signed in to change notification settings - Fork 486
Abort extracting vk when there are no phase 2 contributions #620
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,10 @@ async function groth16Vk(zkey, fd, sections) { | |
| const curve = await getCurve(zkey.q); | ||
| const sG1 = curve.G1.F.n8 * 2; | ||
|
|
||
| if (curve.G2.eq(zkey.vk_gamma_2, zkey.vk_delta_2)) { | ||
| throw new Error("SOUNDNESS ERROR: vk_gamma_2 and vk_delta_2 are equal. This zkey is insecure, it likely has no phase 2 contribution. Proofs can be forged. Run 'snarkjs zkey contribute' before exporting."); | ||
| } | ||
|
Comment on lines
+59
to
+61
|
||
|
|
||
| const alphaBeta = await curve.pairing(zkey.vk_alpha_1, zkey.vk_beta_2); | ||
|
|
||
| let vKey = { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New behavior returns
falsewhenvk_gamma_2equalsvk_delta_2, but there doesn’t appear to be a test exercising this soundness guard. Adding a unit/integration test that verifiesgroth16.verifyrejects an insecure verification key (e.g., by crafting a VK withvk_delta_2copied fromvk_gamma_2, or by exporting from an un-contributed zkey if that produces equality) would prevent regressions.