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

Process verification keys to perform online verification #1760

Merged
merged 2 commits into from Nov 15, 2016

Conversation

@ebfull
Copy link
Contributor

ebfull commented Nov 2, 2016

Checking proofs involves some arithmetic with pairings using components of the proof and the verification key. If you already have some curve points, like those in the verification key, you can amortize the cost of some of the more expensive arithmetic.

This PR adopts libsnark's precomputation of G2 elements in the verification key.

We currently call r1cs_ppzksnark_verifier_strong_IC:

template<typename ppT>
bool r1cs_ppzksnark_verifier_strong_IC(const r1cs_ppzksnark_verification_key<ppT> &vk,
                                       const r1cs_ppzksnark_primary_input<ppT> &primary_input,
                                       const r1cs_ppzksnark_proof<ppT> &proof)
{
    enter_block("Call to r1cs_ppzksnark_verifier_strong_IC");
    r1cs_ppzksnark_processed_verification_key<ppT> pvk = r1cs_ppzksnark_verifier_process_vk<ppT>(vk);
    bool result = r1cs_ppzksnark_online_verifier_strong_IC<ppT>(pvk, primary_input, proof);
    leave_block("Call to r1cs_ppzksnark_verifier_strong_IC");
    return result;
}

Notice that this merely performs precomputation of the verification key, and then calls r1cs_ppzksnark_online_verifier_strong_IC. This PR merely performs the precomputation during verification key initialization, and calls that function directly.

@str4d
Copy link
Contributor

str4d commented Nov 3, 2016

utACK

1 similar comment
@daira
Copy link
Contributor

daira commented Nov 3, 2016

utACK

@zkbot
Copy link
Collaborator

zkbot commented Nov 4, 2016

The latest upstream changes (presumably #1399) made this pull request unmergeable. Please resolve the merge conflicts.

@bitcartel bitcartel added this to the 1.0.2 milestone Nov 4, 2016
@str4d str4d modified the milestones: 1.0.3, 1.0.2 Nov 5, 2016
@bitcartel
Copy link
Contributor

bitcartel commented Nov 12, 2016

utACK

@bitcartel
Copy link
Contributor

bitcartel commented Nov 12, 2016

@ebfull Please rebase. Thanks.

@ebfull ebfull force-pushed the ebfull:vk-preprocess branch from 72e1c06 to 78df9f0 Nov 14, 2016
@ebfull
Copy link
Contributor Author

ebfull commented Nov 14, 2016

Rebased @bitcartel.

@bitcartel
Copy link
Contributor

bitcartel commented Nov 15, 2016

@zkbot try

@zkbot
Copy link
Collaborator

zkbot commented Nov 15, 2016

Trying commit 78df9f0 with merge 78df9f0...

@zkbot
Copy link
Collaborator

zkbot commented Nov 15, 2016

☀️ Test successful - zcash

@ebfull
Copy link
Contributor Author

ebfull commented Nov 15, 2016

Don't r+ this until something else gets merged, because of buildbot's refusal to test it.

@bitcartel
Copy link
Contributor

bitcartel commented Nov 15, 2016

ACK

@bitcartel
Copy link
Contributor

bitcartel commented Nov 15, 2016

@zkbot r+

@zkbot
Copy link
Collaborator

zkbot commented Nov 15, 2016

📌 Commit 78df9f0 has been approved by bitcartel

@zkbot
Copy link
Collaborator

zkbot commented Nov 15, 2016

Testing commit 78df9f0 with merge 057ab6b...

zkbot pushed a commit that referenced this pull request Nov 15, 2016
Process verification keys to perform online verification

Checking proofs involves some arithmetic with pairings using components of the proof and the verification key. If you already have some curve points, like those in the verification key, you can amortize the cost of some of the more expensive arithmetic.

This PR adopts libsnark's precomputation of G2 elements in the verification key.

We *currently* call `r1cs_ppzksnark_verifier_strong_IC`:

```c++
template<typename ppT>
bool r1cs_ppzksnark_verifier_strong_IC(const r1cs_ppzksnark_verification_key<ppT> &vk,
                                       const r1cs_ppzksnark_primary_input<ppT> &primary_input,
                                       const r1cs_ppzksnark_proof<ppT> &proof)
{
    enter_block("Call to r1cs_ppzksnark_verifier_strong_IC");
    r1cs_ppzksnark_processed_verification_key<ppT> pvk = r1cs_ppzksnark_verifier_process_vk<ppT>(vk);
    bool result = r1cs_ppzksnark_online_verifier_strong_IC<ppT>(pvk, primary_input, proof);
    leave_block("Call to r1cs_ppzksnark_verifier_strong_IC");
    return result;
}
```

Notice that this merely performs precomputation of the verification key, and then calls `r1cs_ppzksnark_online_verifier_strong_IC`. This PR merely performs the precomputation during verification key initialization, and calls that function directly.
@zkbot
Copy link
Collaborator

zkbot commented Nov 15, 2016

☀️ Test successful - zcash

@zkbot zkbot merged commit 78df9f0 into zcash:master Nov 15, 2016
1 check passed
1 check passed
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.