126 Commits

Author SHA1 Message Date
wborgeaud
a0b0a2d715 Move polynomial.rs to mod.rs 2021-11-30 20:17:34 +01:00
wborgeaud
2c06309cf7 Fix all clippy lints 2021-11-30 17:12:13 +01:00
Daniel Lubarov
9b55ff9e81
edition = 2021 (#370)
* edition = 2021

Doesn't affect anything for us as far as I've noticed.

* imports
2021-11-17 14:43:54 -08:00
wborgeaud
799ff26e71 Avoid underflow when checking the length of terms 2021-11-15 19:46:28 +01:00
wborgeaud
49e4307820 Comments + test for reducing 100 extension elements 2021-11-15 13:35:21 +01:00
wborgeaud
f787c5385f Simplify 2021-11-15 11:50:41 +01:00
wborgeaud
a54db66f68 Use arithmetic gate for small reductions 2021-11-15 11:39:24 +01:00
wborgeaud
66719b0cfc Remove comments 2021-11-15 10:33:27 +01:00
wborgeaud
d44cb96744 Merge branch 'main' into reducing_ext_gate 2021-11-15 09:22:35 +01:00
Daniel Lubarov
7185c2d7d2
Fix & cleanup partial products (#355)
My previous change introduced a bug -- when `num_routed_wires` was a multiple of 8, the partial products "consumed" all `num_routed_wires` terms, whereas we actually want to leave 8 terms for the final product.

This also changes `check_partial_products` to include the final product constraint, and merges `vanishing_v_shift_terms` into `vanishing_partial_products_terms`. I think this is natural since `Z(x)`, partial products, and `Z(g x)` are all part of the product accumulator chain.
2021-11-14 11:58:44 -08:00
wborgeaud
72ef58c19d Add ReducingExtGate 2021-11-12 18:24:08 +01:00
wborgeaud
21d3b127e3 Cargo fmt 2021-11-12 09:15:37 +01:00
Daniel Lubarov
9139d1350a
Minor refactor of partial product code (#351) 2021-11-11 07:16:16 -08:00
wborgeaud
3084367133 Start accumulator at Z(x) 2021-11-10 18:36:35 +01:00
wborgeaud
32f09ac2df Remove quotients and work directly with numerators and denominators in partial products check 2021-11-10 18:13:27 +01:00
wborgeaud
ff943138f3
Apply suggestions from code review
Co-authored-by: Daniel Lubarov <daniel@lubarov.com>
2021-11-10 09:38:47 +01:00
wborgeaud
3717ff701e Minor 2021-11-09 17:33:14 +01:00
wborgeaud
abc706ee26 Fix partial product test 2021-11-09 17:18:15 +01:00
wborgeaud
7cf965ded5 All tests pass 2021-11-09 15:18:43 +01:00
wborgeaud
9617c22173 Increase degree 2021-11-09 14:24:04 +01:00
wborgeaud
bd1672cbf2 Working 2021-11-09 13:56:19 +01:00
wborgeaud
4e361726d0 Use partial product chain 2021-11-08 15:50:33 +01:00
Daniel Lubarov
fdce382af3
Standard configs (#337)
`large_config` was similar to `standard_recursion_config`; let's standardize on the latter.
2021-11-03 14:30:32 -07:00
Jakub Nabaglo
bc57a561e6 Delete CrandallField 2021-11-02 12:29:26 -07:00
Jakub Nabaglo
7d39074e61
Minor optimizations to addition (#323) 2021-10-26 18:05:52 -07:00
Jakub Nabaglo
db23416b04
Goldilocks: better constant propagation through add_with_wraparound (#320) 2021-10-22 15:02:22 -07:00
wborgeaud
ddac8026f2 Comments 2021-10-11 17:24:06 +02:00
wborgeaud
ea69a87338 Working 2021-10-11 16:40:31 +02:00
Daniel Lubarov
898cac1709
Automatically select FRI reduction arities (#282)
* Automatically select FRI reduction arities

This way when a proof's degree changes, we won't need to manually update the `FriConfig`s of any recursive proofs on top of it.

For now I've added two methods of selecting arities. The first, `ConstantArityBits`, just applies a fixed reduciton arity until the degree has shrunk below a certain threshold. The second, `MinSize`, searches for the sequence of arities that minimizes proof size.

Note that this optimization is approximate -- e.g. it doesn't account for the effect of compression, and doesn't count some minor contributions to proof size, like the Merkle roots from the commit phase. It also assumes we're not using Merkle caps in serialized proofs, and that we're inferring one of the evaluations, even though we haven't made those changes yet.

I think we should generally use `ConstantArityBits` for proofs that we will recurse on, since using a single arity tends to be more recursion-friendly. We could use `MinSize` for generating final bridge proofs, since we won't do further recursion on top of those.

* Fix tests

* Feedback
2021-10-04 13:52:05 -07:00
wborgeaud
bce3256c96 PR feedback 2021-10-04 10:21:35 +02:00
wborgeaud
3859ca2090 PR comments 2021-10-02 10:46:02 +02:00
wborgeaud
17ed6a2b04 Clippy 2021-10-01 17:12:46 +02:00
wborgeaud
c276596092 Remove useless test 2021-10-01 17:05:55 +02:00
wborgeaud
fb585064a9 (De)Serializer for CompressedProof 2021-10-01 16:54:14 +02:00
wborgeaud
8f212d31ef Working custom (de)serializer 2021-10-01 14:59:16 +02:00
wborgeaud
4305a95cdb Small fixes to the le_sum and reduce gadgets 2021-09-21 12:52:28 +02:00
Daniel Lubarov
91f7b4e300
Replace CrandallQuarticField with a more generic QuarticExtension (#232)
* Replace `CrandallQuarticField` with a more generic `QuarticExtension`

And likewise for `CrandallQuadraticField`.

There are a few parameters which we can't automatically derive (in const Rust), so I specified them in a `AutoExtendable` trait.

This would make it fairly easy to add extension fields for `GoldilocksField` and any future fields.

* Attempt to derive 2-adicity, see Hamish's feedback

* Simplify TWO_ADICITY based on chat with Hamish

* PR feedback

* Merge AutoExtendable into Extendable (#235)
2021-09-13 11:45:17 -07:00
Daniel Lubarov
3bc34c59d8
Refactor GMiMC code (#224)
* Refactor GMiMC code

Adds a sub-trait of `Field` called `GMiMCInterface`, which is similar to `PoseidonInterface`.

This lets us have different fields with different GMiMC constants in a type-safe way.

* Remove `Interface`

* Const generic for width
2021-09-07 18:28:28 -07:00
Nicholas Ward
c07f99ac81 merge 2021-09-06 21:38:52 -07:00
Daniel Lubarov
236a143abf
Move some Field members to a Field64 subtrait (#213)
* Move some Field members to a Field64 subtrait

I.e. move anything specific to 64-bit fields.

Also, relatedly,
- Tweak a bunch of prover code to require `Field64`, since 64-bit stuff is used in a couple places, like the FRI proof-of-work
- Remove `bits()`, which was unused and assumed a 64-bit field
- Rename a couple methods to reflect that they're u64 variants

There are no functional changes.

* Field64 -> PrimeField

* Remove `exp_u32`, `kth_root_u32`

* PrimeField: PrimeField

* Move `to_canonical_biguint` as well

* Add back from_noncanonical_u128
2021-09-05 10:27:11 -07:00
Nicholas Ward
013c8bb612 progress 2021-09-03 18:07:20 -07:00
Jakub Nabaglo
21b263ee3e
Shave off 2% by optimizing check_partial_products (#205)
* Shave off 2% by optimizing check_partial_products

Removes a bunch of allocations/deallocations

* Minor style (Daniel PR comment)
2021-08-28 14:59:56 -07:00
wborgeaud
71f64329c7 Minor 2021-08-24 08:30:34 +02:00
wborgeaud
69a945547a route, assert_equal -> connect 2021-08-24 08:25:11 +02:00
wborgeaud
cd1bd9e77b
Merge pull request #195 from mir-protocol/partition_witness
Remove `CopyGenerator`s and add new `PartitionWitness`
2021-08-24 08:16:35 +02:00
Jakub Nabaglo
8c4961222f
Optimize bit reverse transpose (#198)
* Bit reverse improvements

* Formatting

* Tests

* Daniel PR comment
2021-08-23 12:10:49 -07:00
wborgeaud
a90ea6ec79 PartialWitness back to HashMap 2021-08-20 11:56:57 +02:00
wborgeaud
e81001b9ba Clippy 2021-08-20 11:13:40 +02:00
wborgeaud
6584734928 Cleaning 2021-08-20 10:44:19 +02:00
wborgeaud
a44bf9ffd8 Added witness trait 2021-08-20 09:50:07 +02:00