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

Failed to generate proofs #7

Closed
johnson86tw opened this issue Mar 11, 2022 · 1 comment
Closed

Failed to generate proofs #7

johnson86tw opened this issue Mar 11, 2022 · 1 comment

Comments

@johnson86tw
Copy link
Owner

johnson86tw commented Mar 11, 2022

Run cli/test.sh

Error:

...
All state subtrees have been merged.
Merging subroots to a main state root...
Executed mergeStateAq(); gas used: 1015876
Transaction hash: 0xf9346a01dcafa30da9aecf57303660706bdc5995d86587be7ceaf24a948ea358
The state tree has been merged.

fromBlock = 0
Generating proofs of message processing...
(node:2707) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'copy' of undefined
    at Poll.processMessages (/root/maci/core/ts/MaciState.ts:358:58)
    at /root/maci/cli/ts/genProofs.ts:335:36
    at step (/root/maci/cli/build/genProofs.js:33:23)
    at Object.next (/root/maci/cli/build/genProofs.js:14:53)
    at fulfilled (/root/maci/cli/build/genProofs.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2707) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2707) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The problem is in maci/core/ts/MaciState.ts:

...
  if (r) {
                // TODO: replace with try/catch after implementing error
                // handling
                const index = r.stateLeafIndex

                currentStateLeaves.unshift(r.originalStateLeaf)
                currentBallots.unshift(r.originalBallot)
                currentVoteWeights.unshift(r.originalVoteWeight)
                currentVoteWeightsPathElements.unshift(r.originalVoteWeightsPathElements)

                currentStateLeavesPathElements.unshift(r.originalStateLeafPathElements)
                currentBallotsPathElements.unshift(r.originalBallotPathElements)
                
                this.stateLeaves[index] = r.newStateLeaf.copy()      // Error: r.newStateLeaf is undefined
                this.stateTree.update(index, r.newStateLeaf.hash())

                this.ballots[index] = r.newBallot
                this.ballotTree.update(index, r.newBallot.hash())

            } else {
...
@johnson86tw
Copy link
Owner Author

appliedzkp#375 fixed.

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

No branches or pull requests

1 participant