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

generateProof() prevents program from exiting #736

Closed
brianblank opened this issue Mar 29, 2024 · 3 comments
Closed

generateProof() prevents program from exiting #736

brianblank opened this issue Mar 29, 2024 · 3 comments
Labels
bug 🐛 Something isn't working

Comments

@brianblank
Copy link

Describe the bug
Upon calling generateProof(), while the function returns with a valid answer, the program never exits back to the OS upon completion.

To Reproduce
This program produces the problem. Note I commented out the last two lines to identify which call is causing the issue. I'm including it for completeness.

#!/usr/bin/env node

import { Identity } from "@semaphore-protocol/identity"
import { Group } from "@semaphore-protocol/group" 
import { generateProof } from "@semaphore-protocol/proof"
import { verifyProof } from "@semaphore-protocol/proof"

// Create new identities
const identity1 = new Identity()
const identity2 = new Identity()
const identity3 = new Identity()

const members = [
    identity1.commitment,
    identity2.commitment,
    identity3.commitment
]

const group = new Group(members)

const scope = group.root
const message = "Hello, World!"
const proof = await generateProof(identity1, group, message, scope)
console.log(`Proof: ${JSON.stringify(proof)}`)

// const proofIsValid = await verifyProof(proof)
// console.log(`Proof is valid: ${proofIsValid}`)

Expected behavior
After completion of the code, the program should return back to the Operating System.

Screenshots

Here is a sample execution of the program. Note the "^C" at the end which is me forcing exit of the program which is stuck indefinitely.

brian@PC2024:~/dev/semaphore/my-semaphore$ npm exec semaphore-test
Proof: {"merkleTreeDepth":2,"merkleTreeRoot":"10911039934799539845414338062982480922838882535997216000587896732709048366642","nullifier":"21010560346614310038787909365376793825352778182963214616082342351945676821339","message":"32745724963525307109523713280444231124987508675532689804809885653891645702144","scope":"10911039934799539845414338062982480922838882535997216000587896732709048366642","points":["17201793473354116423591391683949808455563542687795108223371420678917958728833","19413141945641013042151771639504818005696033087545846461652214990370734420041","6013976044313108783367369421723939043738141196370251925305653622637079141479","5993718082660377565245243633831495074693670805573702697292324259590438270383","13895242153157977922193745732907313395522289625036079153493613696253233320935","18123084389446254662304040463263825322694296315412271770826477065571286072045","12237885797658033732515767455343975000397936640045213081183104191768177598782","655755471800889827261402214263052277201751098833431474891848689883216293348"]}
Proof is valid: true
^C
brian@PC2024:~/dev/semaphore/my-semaphore$ 

Technologies (please complete the following information):

  • Node.js version: v20.11.1
  • NPM version: 10.2.4
  • Solidity version: Not Applicable
  • "dependencies": {
    "@semaphore-protocol/group": "^4.0.0-beta.7",
    "@semaphore-protocol/identity": "^4.0.0-beta.7",
    "@semaphore-protocol/proof": "^4.0.0-beta.7"
    }

Additional context
The code was derived from documentation in your getting started guide here: https://docs.semaphore.pse.dev/guides/identities

@brianblank brianblank added the bug 🐛 Something isn't working label Mar 29, 2024
@vplasencia
Copy link
Member

Hey @brianblank !

You can find more information about this issue and how to solve it here: #579 (comment)

I think we should add it to the troubleshooting page in the docs. Thank you very much for pointing it out.

@cedoor
Copy link
Member

cedoor commented Mar 29, 2024

I think the bn128 curve needs to be terminated explicitly. An example here:

await curve.terminate()

@cedoor
Copy link
Member

cedoor commented Mar 29, 2024

We'll close this issue as duplicate: #318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants