Daniel Lubarov
018fb005f8
Move stuff around ( #135 )
...
No functional changes here. The biggest change was moving certain files into new directories like `plonk` and `iop` (for things like `Challenger` that could be used in STARKs or other IOPs). I also split a few files, renames, etc, but again nothing functional, so I don't think a careful review is necessary (just a sanity check).
2021-07-29 22:00:29 -07:00
Daniel Lubarov
9081ae7337
Reduce noise in FRI logging ( #129 )
...
* Reduce noise in FRI logging
Previously, all logs related to gate counts were at the `Debug` log level. This PR gives us more flexibility to adjust the log levels of particular scopes.
In particular, our circuit checks 40 FRI queries, and we log a bunch of steps for each query, creating a lot of noise. With this change, we log just a single FRI query at the `Debug` level, and demote others to the `Trace` level.
With `RUST_LOG=debug`, our logs now look like
```
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] 17631 gates to root
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 8 gates to observe proof and generates challenges
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 4150 gates to evaluate the vanishing polynomial at our challenge point, zeta.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 3184 gates to evaluate gate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 227 gates to evaluate InterpolationGate { num_points: 4, _phantom: PhantomData }<D=4> constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 867 gates to evaluate <R=101> GMiMCGate { ... } constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 576 gates to evaluate BaseSumGate { num_limbs: 63 } + Base: 2 constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 78 gates to evaluate ArithmeticExtensionGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 288 gates to evaluate BaseSumGate { num_limbs: 31 } + Base: 2 constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 115 gates to evaluate InsertionGate { vec_size: 3, _phantom: PhantomData }<D=4> constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 26 gates to evaluate BaseSumGate { num_limbs: 2 } + Base: 2 constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 633 gates to evaluate ReducingGate { num_coeffs: 21 } constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 4 gates to evaluate ConstantGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 11 gates to evaluate PublicInputGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 2 gates to evaluate NoopGate constraints
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 16 gates to check vanishing and quotient polynomials.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | 13336 gates to verify FRI proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 6 gates to recover the random betas used in the FRI reductions.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 4 gates to check PoW
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 104 gates to precompute reduced evaluations
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 330 gates to verify one (of 40) query rounds
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 95 gates to check FRI initial proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 22 gates to verify 0'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 33 gates to verify 1'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 20 gates to verify 2'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | | 20 gates to verify 3'th initial Merkle proof
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 34 gates to compute x from its index
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 32 gates to combine initial oracles
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 17 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 15 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 13 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 11 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 9 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 7 gates to verify FRI round Merkle proof.
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 10 gates to infer final evaluation using interpolation
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | | 8 gates to evaluate final polynomial
```
This bit corresponds to the single FRI query being shown:
```
[2021-07-26T21:07:45Z DEBUG plonky2::context_tree] | | 330 gates to verify one (of 40) query rounds
```
* Minor cleanup
* Address feedback
2021-07-26 16:21:14 -07:00
wborgeaud
c16d93ab33
scaling.rs -> reducing.rs
2021-07-23 17:31:00 +02:00
Daniel Lubarov
01461ce388
Update a TODO
2021-07-21 21:25:52 -07:00
Daniel Lubarov
80b696a3a2
Avoid a clone ( #114 )
2021-07-21 08:26:56 -07:00
Daniel Lubarov
7d8bac7169
Change FFT methods to accept references ( #115 )
2021-07-21 08:26:41 -07:00
Daniel Lubarov
8438d23937
Tree of scopes ( #106 )
...
* Tree of scopes
This is an extension of the context concept.
Earlier I was planning to store a simple stack of contexts, but I ended up storing the whole history, in a tree structure. This gives us more control over the output, i.e. we can print the gate count of a parent scope before those of its child scopes, which seems more user-friendly.
Sample gate count output:
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] 27829 gates to root
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] | 2373 gates to evaluate the vanishing polynomial at our challenge point, zeta.
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] | | 1284 gates to evaluate gate constraints
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] | 25312 gates to verify FRI proof
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] | | 650 gates to verify 0'th FRI query
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] | | | 96 gates to check FRI initial proof
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] | | | 65 gates to compute x from its index
[2021-07-19T18:09:24Z INFO plonky2::circuit_builder] | | | 233 gates to combine initial oracles
...
Sample copy constraint failure:
Error: Copy constraint 'root > verify FRI proof > verify 0'th FRI query > check FRI initial proof > verify 0'th initial Merkle proof > check Merkle root: 0-th hash element' between wire 12 of gate #2550 [...] and wire 0 of gate #0 [...] is not satisfied. Got values of 6861386743364621393 and 0 respectively.
* No min
* info -> debug
* Move to its own file
2021-07-19 12:22:18 -07:00
wborgeaud
52cc7c79f5
Remove openings at the Frobenius of zeta
2021-07-19 16:45:38 +02:00
Daniel Lubarov
d11bcd1928
Optional zk ( #101 )
...
* Make ZK optional
* Remove rate from FriConfig
Seems redundant, and we've had some tests break due to the two fields not matching.
* zero_knowledge: false in bench
2021-07-18 23:24:33 -07:00
wborgeaud
b7d51db979
Fix merge problems
2021-07-19 07:11:40 +02:00
wborgeaud
461f24a57e
Merge branch 'main' into more_recursive_verifier
...
# Conflicts:
# src/polynomial/commitment.rs
# src/proof.rs
2021-07-19 07:08:06 +02:00
Daniel Lubarov
77ce69dc15
Proof serialization ( #93 )
...
Using `serde_cbor` for now. It's probably far from optimal, as we have many `Vec`s which I assume it will prefix with their lengths, but it's a nice and easy method for now.
2021-07-15 07:35:12 -07:00
Daniel Lubarov
83a1430038
Fix some warnings ( #94 )
2021-07-15 07:34:46 -07:00
wborgeaud
2e12ee8e82
Minor
2021-07-15 10:13:13 +02:00
wborgeaud
0ba5916346
Minor
2021-07-15 09:11:54 +02:00
wborgeaud
becd0c969e
Merge branch 'main' into more_recursive_verifier
...
# Conflicts:
# src/gadgets/insert.rs
# src/plonk_common.rs
# src/verifier.rs
2021-07-15 09:01:36 +02:00
Daniel Lubarov
c678c55452
Imports
2021-07-14 21:43:55 -07:00
wborgeaud
c3d53392c4
Problem in permutation argument
2021-07-14 08:14:00 +02:00
wborgeaud
ad24f5d4d1
Almost working recursive verifier
2021-07-12 14:25:28 +02:00
wborgeaud
b50a9809db
Start recursive verifier test
2021-07-08 17:16:26 +02:00
wborgeaud
805ebb1b0d
Working verifier
2021-07-08 15:13:29 +02:00
wborgeaud
525db6c461
Merge branch 'main' into fix_z_check
...
# Conflicts:
# src/circuit_builder.rs
2021-07-02 10:15:23 +02:00
wborgeaud
b86e60a397
Open the partial products polynomials only at zeta
2021-07-01 18:24:49 +02:00
wborgeaud
cc3c278a92
Some renaming
2021-07-01 17:34:00 +02:00
wborgeaud
59410447bf
Add lengths to CommonData
2021-07-01 15:41:01 +02:00
Nicholas Ward
8de59c2a84
cargo fmt
2021-06-30 21:59:18 -07:00
Hamish Ivey-Law
574a3d4847
FFT improvements ( #81 )
...
* Use built-in `reverse_bits`; remove duplicate `reverse_index_bits`.
* Reduce precomputation time/space complexity from quadratic to linear.
* Several working cache-friendly FFTs.
* Fix to allow FFT of constant polynomial.
* Simplify FFT strategy choice.
* Add PrimeField and CHARACTERISTIC properties to Fields.
* Add faster method for inverse of 2^m.
* Pre-compute some of the roots; tidy up loop iteration.
* Precomputation for both FFT variants.
* Refactor precomputation; add optional parameters; rename some things.
* Unrolled version with zero tail.
* Iterative version of Unrolled precomputation.
* Test zero tail algo.
* Restore default degree.
* Address comments from @dlubarov and @wborgeaud.
2021-07-01 14:55:41 +10:00
wborgeaud
bae3777bcd
Use max filtered degree found with the tree method in CircuitBuilder::build
2021-06-29 14:00:34 +02:00
Daniel Lubarov
7734aed62c
Performance tweaks ( #77 )
2021-06-28 08:56:36 -07:00
wborgeaud
c2b2ef921a
PR feedback
2021-06-28 09:47:47 +02:00
wborgeaud
625377b4c0
Merge constant and sigma polynomials
2021-06-25 11:24:26 +02:00
wborgeaud
727919b14f
Comment and test for coset_ifft
2021-06-25 10:20:20 +02:00
wborgeaud
2e9d3f768e
Better error message when quotient hasn't correct degree
2021-06-25 09:56:15 +02:00
wborgeaud
35f73a505f
Clippy
2021-06-24 15:49:36 +02:00
wborgeaud
31f4eee367
Fix bug with shifted x
2021-06-24 14:11:47 +02:00
wborgeaud
f215dffa9d
Compute quotient directly
2021-06-24 11:45:16 +02:00
wborgeaud
ef7561fc84
Merge branch 'main' into permutation_argument
...
# Conflicts:
# src/circuit_builder.rs
# src/circuit_data.rs
# src/polynomial/commitment.rs
# src/prover.rs
# src/witness.rs
2021-06-24 10:51:18 +02:00
wborgeaud
492b04843e
Optimize some polynomial operations to avoid cloning.
2021-06-23 11:41:32 +02:00
wborgeaud
01053ab96a
Fix bug
2021-06-23 11:30:57 +02:00
wborgeaud
70e980488c
Merge branch 'main' into optimize_reductions
...
# Conflicts:
# src/fri/verifier.rs
# src/polynomial/commitment.rs
2021-06-23 11:03:59 +02:00
wborgeaud
15922d2518
Add comment for denominator polynomial
2021-06-21 10:32:32 +02:00
wborgeaud
37171505c7
Remove useless interpolation from open_plonk
2021-06-18 12:49:40 +02:00
wborgeaud
a4c86a6b08
lagrange.rs -> interpolation.rs
2021-06-18 11:44:06 +02:00
wborgeaud
7d4e79f069
Clippy
2021-06-18 11:22:38 +02:00
wborgeaud
621c046fe4
Use long division when dividing by quadratic polynomial
2021-06-18 11:17:15 +02:00
wborgeaud
4f8ef2e178
Optimize some polynomial operations
2021-06-18 11:10:33 +02:00
wborgeaud
9db7dce738
scale -> reduce
2021-06-17 22:06:53 +02:00
wborgeaud
92e0f60c23
Clippy
2021-06-17 21:57:31 +02:00
wborgeaud
fe9cd3f76b
Working commitments and verifier
2021-06-17 21:34:04 +02:00
wborgeaud
ad5c18b499
Comments and Clippy
2021-06-17 16:23:15 +02:00