Commit graph

301 commits

Author SHA1 Message Date
Sean Bowe
e1a772d6e1
Remove transcript forking API. 2021-01-12 07:40:31 -07:00
Sean Bowe
f308eb969c
Remove deterministic square root calculation as it's no longer needed. 2021-01-12 07:40:26 -07:00
Sean Bowe
98c1d80c90
Avoid square challenges and forking in inner product argument
This modifies the scheme to be almost identical to the construction
outlined in Appenix A.2 of "Proof-Carrying Data from Accumulation
Schemes" (https://eprint.iacr.org/2020/499). The only remaining
difference is that we do not compute [v] U but instead subtract
[v] G_0 from the commitment before opening.
2021-01-12 07:40:20 -07:00
Jack Grigg
d94e9b3daf Remove unnecessary trailing semicolon 2021-01-08 02:22:16 +00:00
Jack Grigg
f24b60b5b0 Add a placeholder module for gadgets 2021-01-08 01:55:10 +00:00
Jack Grigg
7e2406cc77 Implement a simple single-chip layouter 2021-01-08 01:54:44 +00:00
Jack Grigg
17da891b25 General traits and structs for implementing circuits 2021-01-08 01:54:18 +00:00
Jack Grigg
08da49353e Fix clippy lints in MockProver 2021-01-07 12:42:04 +00:00
Jack Grigg
8590211585 Remove unnecessary parts from MockProver per review comments 2021-01-06 21:52:56 +00:00
Jack Grigg
49f1598c0e Add example to MockProver documentation
Also fixes a bug in MockProver::verify (which was exposing an internal
implementation detail as an incorrect row numbering).
2021-01-06 21:52:56 +00:00
Jack Grigg
64b06735bf Expose MockProver in crate, and add documentation 2021-01-06 21:52:56 +00:00
therealyingtong
fb939f17a9 Add permutation check to MockProver 2021-01-06 21:52:56 +00:00
Jack Grigg
6eebf3994b Add MockProver for developing circuits 2021-01-06 21:52:56 +00:00
Sean Bowe
c8dedf2ec3
Fix challenge multiplications as per #119. 2021-01-06 10:47:06 -07:00
Sean Bowe
c5e0364962
Remove the Read/Write type parameters from Transcript{Read,Write}. 2021-01-06 10:45:11 -07:00
Sean Bowe
dff5a3a692
Generate the URS using a homebrew mixture of blake2b and try-and-increment. 2021-01-06 10:45:11 -07:00
Sean Bowe
a2999accb5
Rename DummyHash{Reader,Writer} to DummyHash{Read,Write}. 2021-01-06 10:45:11 -07:00
Sean Bowe
7ffd28a1b5
Remove unnecessary separate msm from commitment::verify_proof. 2021-01-06 10:45:11 -07:00
Sean Bowe
4ecbfb548e
Remove unnecessary lifetimes. 2021-01-06 10:45:11 -07:00
Sean Bowe
06552eec44
Update the PLONK implementation to adapt to the new transcript API. 2021-01-06 10:45:11 -07:00
Sean Bowe
5be7d9525d
Update multiopen APIs to reflect changes made to Transcript APIs 2021-01-06 10:45:10 -07:00
Sean Bowe
d30c6b62e4
Modification of the polynomial commitment scheme to compensate for Transcript API changes. 2021-01-06 10:40:26 -07:00
Sean Bowe
fb232ddec0
Change API for dealing with transcripts to integrate proof reading/writing. 2021-01-06 10:39:11 -07:00
Jack Grigg
f49e1e6177 Fix breakage of trait resolution in Rust 1.49.0
Previously, `ChallengeScalar` could use the operator traits defined on
the `F: Field` type it wrapped, due to its `impl Deref<Target = F>`.
This was technically ambiguous, and Rust 1.49.0 makes that ambiguity an
error.

We could fix this by adding operator impls with `ChallengeScalar` on the
RHS, but that would conflict with zcash/halo2#111. Instead we manually
dereference every challenge scalar when used in an arithmetic operation.
2021-01-06 00:48:29 +00:00
Jack Grigg
90c50fdd11 Refactor permutation proofs to reflect the separate permutations 2020-12-22 23:51:32 +00:00
Jack Grigg
62cace289b Add a few comments to the permutation construction code
We mainly point at the design document that describes the algorithm.
2020-12-22 20:25:33 +00:00
Jack Grigg
838d21f2be Refactor permutation keygen to reflect the separate permutations 2020-12-22 18:11:42 +00:00
Sean Bowe
9df7b5386f
Account more rigorously for the degrees of permutations' and lookups' constraints. 2020-12-22 08:59:08 -07:00
Sean Bowe
65ed1d8568
Check h_evals/h_commitments lengths in vanishing argument verifier. 2020-12-22 08:59:06 -07:00
Jack Grigg
8389389d37 model: metrics 0.13.0-alpha.13 2020-12-22 12:27:36 +00:00
Sean Bowe
c25b7e7d09
cargo fmt 2020-12-13 10:37:32 -07:00
ebfull
7c0e56a44e
Merge pull request #84 from zcash/pasta-curves
Replace Tweedle curves with Pasta curves
2020-12-13 08:51:52 -07:00
Sean Bowe
1c0daa5478
Add leading zeroes to hex in some constants. 2020-12-11 13:25:18 -07:00
ebfull
0101014268
Use constants where applicable in field implementations
Co-authored-by: str4d <jack@electriccoin.co>
2020-12-11 11:54:32 -07:00
therealyingtong
8360b94f89 Extract plonk::vanishing::{Argument, Proof} from prover and verifier
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2020-12-08 00:57:14 +08:00
Sean Bowe
81345e0cf1
Change ZETA constant of Fp to make it consistent with the endomorphism over Fq. 2020-12-07 09:42:33 -07:00
therealyingtong
e5f55a8576 Abstract add_rotation() helper in plonk::circuit 2020-12-06 07:19:44 +08:00
therealyingtong
4273bbb2ba [Documentation] Consistently use zero-based numbering 2020-12-06 07:10:09 +08:00
ying tong
30c13d5a6a Further cleanups
Co-authored-by: ebfull <ewillbefull@gmail.com>
2020-12-05 13:14:50 +08:00
Sean Bowe
e7c4213537
Remove duplicative from_bytes_wide method in fq.rs; it already exists in the trait impl for FieldExt. 2020-12-04 17:22:02 -07:00
Sean Bowe
3b91899a19
Make comment consistent between fq.rs / fp.rs 2020-12-04 15:01:44 -07:00
ying tong
ecc805fa35 Correct privacy of lookup structs + minor cleanups
Co-authored-by: str4d <jack@electriccoin.co>
2020-12-04 09:19:15 +08:00
Sean Bowe
6c0e6f7348
cargo fmt 2020-12-03 13:59:17 -07:00
Sean Bowe
95e41fcfcf
Rename curves to Pallas/Vesta (Pasta). 2020-12-03 13:47:47 -07:00
Sean Bowe
7536af8b69
Implement Fp/Fq for the Pallas and Vesta curves.
Co-authored-by: Kris Nuttycombe <kris@electriccoin.co>
2020-12-03 13:46:13 -07:00
therealyingtong
2284bbd0d8 Deduplicate Argument::commit_permuted() and rename {input,table}_values -> {input,table}_columns 2020-12-03 14:00:16 +08:00
therealyingtong
9a3d1b1d05 Optimisations and documentation updates 2020-12-03 12:54:25 +08:00
therealyingtong
e51ab7eaa7 Linearise state transition from Argument -> Permuted -> Committed 2020-12-03 12:11:00 +08:00
therealyingtong
0a85e93714 Add lookup to circuit and test 2020-12-03 10:50:20 +08:00
therealyingtong
0c81e9adab Use lookup mod in plonk::prover and plonk::verifier 2020-12-03 10:50:20 +08:00
therealyingtong
19c1b20063 Add lookup::verifier methods 2020-12-03 10:50:20 +08:00
therealyingtong
c692311a12 Add Evaluated::open() and Evaluated::build() to lookup::prover 2020-12-03 10:50:20 +08:00
therealyingtong
6ccf58fc7c Add Constructed::evaluate() to lookup::prover 2020-12-03 10:50:20 +08:00
therealyingtong
39df4954b5 Add Committed::construct() to lookup::prover 2020-12-03 10:50:20 +08:00
therealyingtong
2d0f4a11e3 Add commit_product() to lookup::prover 2020-12-03 10:50:20 +08:00
therealyingtong
46eed7be93 Add commit_permuted() in lookup::prover 2020-12-03 10:50:20 +08:00
therealyingtong
02344eb711 Add lookup mod and structs 2020-12-03 10:50:20 +08:00
therealyingtong
2ba44cff9f Add theta challenge 2020-12-03 10:50:20 +08:00
therealyingtong
5d891e029d Add fixed_values to ProvingKey 2020-12-03 10:50:20 +08:00
Sean Bowe
2e65229920
Remove unnecessary Clone impl from plonk::permutation::prover::Committed. 2020-12-02 09:50:45 -07:00
Jack Grigg
4d4c79be58 Move Challenge and ChallengeScalar into the transcript module 2020-12-01 22:40:54 +00:00
Jack Grigg
2e6ca274a4 Fix challenge types in poly::multiopen and poly::commitment
The argument to the poly::commitment prover and verifier was mistakenly
represented as a challenge, when in fact the commitments may be opened at
any scalar (which just happens to be a challenge within poly::multiopen).

The poly::commitment APIs are now public again.
2020-12-01 22:34:18 +00:00
Jack Grigg
3d6afd7b8e permutation: Clean up opening chains 2020-12-01 22:09:50 +00:00
Jack Grigg
dd3d1dd68b Small type annotation cleanups 2020-12-01 21:49:07 +00:00
Jack Grigg
f0723dbbcc multiopen: Rename [x_4, x_5] challenges to [x_1, x_2]
Also added types for these challenges, even though it's not technically
necessary yet because we don't pass these around anywhere.
2020-12-01 21:42:32 +00:00
Jack Grigg
eb7ce442f9 Rename ChallengeX6 to ChallengeZ 2020-12-01 21:40:16 +00:00
Jack Grigg
a63e6e25d8 Restrict visibility of PLONK challenges to plonk module 2020-12-01 21:14:14 +00:00
Jack Grigg
7422efca72 s/permutation::Proof::commit/permutation::Argument::commit
Once we refactor the permutation argument implementation to be integrated
as Vec<permutation::Proof>, we can change this again to just map from the
Vec<permutation::Argument> inside ConstraintSystem.
2020-12-01 21:10:31 +00:00
Jack Grigg
66240800a3 Move permutation keygen into plonk::permutation::keygen 2020-12-01 21:10:31 +00:00
Jack Grigg
f63f3ff2af Introduce typed challenge scalars
This also centralises the challenge generation logic in Challenge::get,
ensuring it is consistent across the codebase.
2020-12-01 21:09:03 +00:00
Jack Grigg
63e3bc1e15 Remove unnecessary Transcript::init_with_hashers constructor 2020-12-01 21:03:31 +00:00
Jack Grigg
4a3b830165 Extract permutation argument into a submodule 2020-12-01 21:03:31 +00:00
Jack Grigg
cdbc41148a Migrate to ff traits
The `Field` trait in this crate is now `FieldExt: ff::PrimeField`.
2020-12-01 20:55:03 +00:00
therealyingtong
72471dc07e Clippy fixes 2020-11-30 23:57:48 +08:00
therealyingtong
0b2ec8965f Update documentation in polycommit verifier 2020-11-30 15:28:19 +08:00
therealyingtong
d168f5c21b Parallelize and rename methods in msm.rs 2020-11-30 15:28:19 +08:00
Jack Grigg
a0a9538132 Use renamed broken_intra_doc_links lint 2020-11-27 14:40:37 +00:00
Jack Grigg
e5e6700e10 Pin most recent metrics alpha 2020-11-25 19:56:52 +00:00
Jack Grigg
875c223748 Simplify h_poly expression evaluation in Proof::create 2020-11-24 23:43:48 +00:00
Jack Grigg
61c9392475 Remove query allocations from Proof::create
multiopen::Proof::create takes `instances: IntoIterator`, so we can just
pass it an iterator directly.
2020-11-24 18:25:55 +00:00
Jack Grigg
6360da1f4e Remove query allocations from Proof::verify
multiopen::Proof::verify takes `queries: IntoIterator`, so we can just
pass it an iterator directly.
2020-11-24 18:23:27 +00:00
Jack Grigg
7f29ab913d Simplify h(x_3) computation in verifier using Horner's rule
Closes zcash/halo2#45
2020-11-24 18:18:45 +00:00
Jack Grigg
feba8e2fdf Allocate permutation_modified_advice once in Proof::create 2020-11-24 18:18:45 +00:00
str4d
cc5f45231d
Merge pull request #42 from zcash/plonk-benches
PLONK benchmarks
2020-11-24 18:14:07 +00:00
Jack Grigg
9a4f27056c Fix clippy lint in metrics model doctest 2020-11-24 17:56:33 +00:00
therealyingtong
3eb6712c6c Add aux information to metrics 2020-11-24 09:39:34 +08:00
Jack Grigg
236b3a6692 Collect some verifier metrics 2020-11-23 12:47:51 +00:00
Jack Grigg
d4424db8d4 Collect some prover metrics 2020-11-23 12:47:51 +00:00
Jack Grigg
fb8f67dfe5 Add a simple metrics Recorder for counting things in models 2020-11-23 12:47:42 +00:00
therealyingtong
bffab9953e Conditionally squeeze scalar hasher before interacting with base hasher 2020-11-16 21:28:37 +00:00
ying tong
15682bf16f Make init_with_hashers() internal to transcript crate
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2020-11-16 21:28:37 +00:00
ying tong
7822201c9c Remove redundant point checks in commitment verifier
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2020-11-16 21:28:37 +00:00
therealyingtong
2375507f4f Update error handling 2020-11-16 21:26:46 +00:00
therealyingtong
43337dea1b Make Transcript generic over curve points
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2020-11-16 21:26:46 +00:00
Jack Grigg
71111e88b7 Type aliases for the tweedle groups 2020-11-12 21:45:56 +00:00
Jack Grigg
3407d13e4b Move curves and fields into tweedle module 2020-11-12 21:36:59 +00:00
Jack Grigg
f4c15760f2 Use explicit trait paths in arithmetic macros 2020-11-12 19:38:27 +00:00
ebfull
5a2f474616
Merge pull request #56 from zcash/coset-docs
Add to documentation for coset evaluation domain
2020-11-11 08:56:03 -07:00
ebfull
5d1e1a29db
Merge pull request #51 from zcash/update-ci
Update Actions CI with improved workflow
2020-11-11 08:52:59 -07:00
ying tong
a856137619 Minor refactors
Co-authored-by: str4d <jack@electriccoin.co>
2020-11-11 13:56:34 +08:00