Daniel Lubarov
df03c22c48
Fix order
2021-07-29 09:12:24 -07:00
Daniel Lubarov
5f79b9630e
Update division calls ( #132 )
...
We have two division methods: one "unsafe" one, which permits 0/0 = anything, and one "safe" one, for which 0/0 results in an unsatisfiable instance. The latter is slightly more expensive.
I switched a few calls over to safe division, where unsafe division didn't seem sound (or at least it wasn't obvious). For calls where unsafe division did seem sound, I added comments explaining why.
Closes #97 .
2021-07-28 18:06:32 -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
1e5a503a14
Merge pull request #127 from mir-protocol/reducing_gate
...
Add `ReducingGate` to compute reductions by `alpha` of base field elements
2021-07-25 18:14:40 +02:00
wborgeaud
c16d93ab33
scaling.rs -> reducing.rs
2021-07-23 17:31:00 +02:00
wborgeaud
ca540a8475
Working fri_combine_initial
2021-07-23 17:29:31 +02:00
wborgeaud
19140e39b2
Update comment
2021-07-23 15:01:45 +02:00
wborgeaud
f325586beb
Replace exp_from_complement_bits with simpler method
2021-07-23 14:58:41 +02:00
wborgeaud
6f8053cc37
Forgot to exponentiate from bits in computation of subgroup_x. Saves 80 gates.
2021-07-23 08:53:00 +02:00
wborgeaud
9a1c289f8e
Merge branch 'main' into remove_acc_in_gmimc
...
# Conflicts:
# src/gadgets/arithmetic.rs
2021-07-23 08:16:23 +02:00
Nicholas Ward
3612b9f05e
Merge branch 'main' into order_bigint
2021-07-22 13:28:48 -07:00
wborgeaud
e87aa2c90b
Renaming
2021-07-22 16:25:47 +02:00
wborgeaud
1d92191227
Make exp_complement_bits take an iterator to avoid cloning.
2021-07-22 16:18:13 +02:00
wborgeaud
c729a3c235
Remove all non-bits indices in the FRI verifier
2021-07-22 16:07:07 +02:00
wborgeaud
22fcc3bc06
Pass bits around
2021-07-22 15:10:55 +02:00
wborgeaud
be2e870aee
PR feedback
2021-07-22 06:50:07 +02:00
Nicholas Ward
7f92a33964
cargo fmt
2021-07-21 13:05:40 -07:00
Nicholas Ward
1dd850b0e5
fixes
2021-07-21 13:05:32 -07:00
wborgeaud
6fff9363c6
Use mul_many
2021-07-21 20:06:29 +02:00
wborgeaud
a54a4e5830
Merge branch 'main' into avoid_rotating
2021-07-21 20:02:22 +02:00
wborgeaud
7c1c082a39
Comments
2021-07-21 19:53:32 +02:00
Nicholas Ward
5062029d3f
fixes
2021-07-21 09:32:18 -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
Nicholas Ward
906a0c00f4
Merge branch 'main' into order_bigint
2021-07-20 15:42:51 -07:00
Nicholas Ward
b103c0774f
progress
2021-07-20 15:42:27 -07:00
Daniel Lubarov
ac1872a8c8
FRI tweaks ( #111 )
...
- Call `exp_power_of_2` instead of manual squaring
- Replace `evaluations[i]` with `evals`
2021-07-20 12:49:02 -07:00
wborgeaud
925c0bcb5c
Replace rotation with exp in compute_evaluation
2021-07-20 15:25:03 +02:00
wborgeaud
0d233505d7
Merge branch 'main' into precomputed_reduced_evals
...
# Conflicts:
# src/fri/recursive_verifier.rs
2021-07-20 11:08:53 +02:00
wborgeaud
fbeedd47d3
Minor
2021-07-20 11:02:22 +02:00
wborgeaud
38f4cca3f5
Target version
2021-07-20 10:57:20 +02:00
wborgeaud
97c4cfff7a
Fixed bug
2021-07-20 10:44:58 +02:00
Nicholas Ward
8a51e6a323
started
2021-07-19 17:11:22 -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
69dc14f88a
Added PrecomputedReducedEvals struct
2021-07-19 20:46:18 +02:00
wborgeaud
8868378fda
Merge pull request #103 from mir-protocol/remove_frobenius_opening
...
Remove openings at the Frobenius of zeta
2021-07-19 16:57:19 +02:00
wborgeaud
52cc7c79f5
Remove openings at the Frobenius of zeta
2021-07-19 16:45:38 +02:00
wborgeaud
9baea1ae26
Trim final poly and check FRI arity
2021-07-19 16:24:21 +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
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
573badc96f
Parallel proof-of-work search ( #92 )
2021-07-15 07:40:41 -07:00
wborgeaud
4bc06deed8
zs_root -> zs_partial_products_root
2021-07-15 10:59:53 +02:00
wborgeaud
fe05da6720
Clipp
2021-07-15 10:39:57 +02:00
wborgeaud
2e12ee8e82
Minor
2021-07-15 10:13:13 +02:00
wborgeaud
7dec6efc6c
Rewrite Markable to avoid Arcs
2021-07-15 09:52:42 +02:00
wborgeaud
0ba5916346
Minor
2021-07-15 09:11:54 +02:00
wborgeaud
92c4bba2a3
Fix bug in GMiMC
2021-07-14 21:16:04 +02:00
wborgeaud
7793b5a956
Identify problem in GMiMc
2021-07-14 20:54:30 +02:00
wborgeaud
5c2c01b1ab
Circuit compiles
2021-07-13 15:20:14 +02:00
wborgeaud
ad24f5d4d1
Almost working recursive verifier
2021-07-12 14:25:28 +02:00