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

Projects
None yet
5 participants
@ebfull
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

This comment has been minimized.

Show comment
Hide comment
@str4d

str4d Nov 3, 2016

Contributor

utACK

Contributor

str4d commented Nov 3, 2016

utACK

@daira

This comment has been minimized.

Show comment
Hide comment
@daira

daira Nov 3, 2016

Contributor

utACK

Contributor

daira commented Nov 3, 2016

utACK

@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Nov 4, 2016

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bitcartel

bitcartel Nov 12, 2016

Contributor

utACK

Contributor

bitcartel commented Nov 12, 2016

utACK

@bitcartel

This comment has been minimized.

Show comment
Hide comment
@bitcartel

bitcartel Nov 12, 2016

Contributor

@ebfull Please rebase. Thanks.

Contributor

bitcartel commented Nov 12, 2016

@ebfull Please rebase. Thanks.

@ebfull

This comment has been minimized.

Show comment
Hide comment
@ebfull

ebfull Nov 14, 2016

Contributor

Rebased @bitcartel.

Contributor

ebfull commented Nov 14, 2016

Rebased @bitcartel.

@bitcartel

This comment has been minimized.

Show comment
Hide comment
@bitcartel

bitcartel Nov 15, 2016

Contributor

@zkbot try

Contributor

bitcartel commented Nov 15, 2016

@zkbot try

@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Nov 15, 2016

Contributor

⌛️ Trying commit 78df9f0 with merge 78df9f0...

Contributor

zkbot commented Nov 15, 2016

⌛️ Trying commit 78df9f0 with merge 78df9f0...

@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Nov 15, 2016

Contributor

☀️ Test successful - zcash

Contributor

zkbot commented Nov 15, 2016

☀️ Test successful - zcash

@ebfull

This comment has been minimized.

Show comment
Hide comment
@ebfull

ebfull Nov 15, 2016

Contributor

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

Contributor

ebfull commented Nov 15, 2016

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

@bitcartel

This comment has been minimized.

Show comment
Hide comment
@bitcartel

bitcartel Nov 15, 2016

Contributor

ACK

Contributor

bitcartel commented Nov 15, 2016

ACK

@bitcartel

This comment has been minimized.

Show comment
Hide comment
@bitcartel

bitcartel Nov 15, 2016

Contributor

@zkbot r+

Contributor

bitcartel commented Nov 15, 2016

@zkbot r+

@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Nov 15, 2016

Contributor

📌 Commit 78df9f0 has been approved by bitcartel

Contributor

zkbot commented Nov 15, 2016

📌 Commit 78df9f0 has been approved by bitcartel

@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Nov 15, 2016

Contributor

⌛️ Testing commit 78df9f0 with merge 057ab6b...

Contributor

zkbot commented Nov 15, 2016

⌛️ Testing commit 78df9f0 with merge 057ab6b...

zkbot pushed a commit that referenced this pull request Nov 15, 2016

zkbot
Auto merge of #1760 - ebfull:vk-preprocess, r=bitcartel
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

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Nov 15, 2016

Contributor

☀️ Test successful - zcash

Contributor

zkbot commented Nov 15, 2016

☀️ Test successful - zcash

@zkbot zkbot merged commit 78df9f0 into zcash:master Nov 15, 2016

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