254 Commits

Author SHA1 Message Date
Nicholas Ward
db464f739e merge 2021-11-30 15:31:06 -08:00
Nicholas Ward
ebce0799a2 initial curve_types and curve_adds 2021-11-30 15:31:06 -08:00
wborgeaud
a0b0a2d715 Move polynomial.rs to mod.rs 2021-11-30 20:17:34 +01:00
wborgeaud
301edf3ab5 Move clippy::eq_ip 2021-11-30 18:18:56 +01:00
wborgeaud
2c06309cf7 Fix all clippy lints 2021-11-30 17:12:13 +01:00
Jakub Nabaglo
549ce0d8e9
Interleaved batched multiplicative inverse (#371)
* Interleaved batched multiplicative inverse

* Minor: typo
2021-11-23 21:36:12 -08:00
wborgeaud
172fdd3d89 Comments 2021-11-22 21:20:44 +01:00
wborgeaud
aec88a8528 First try 2021-11-19 18:11:14 +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
Hamish Ivey-Law
909a5c2392
Fix all lint warnings (#353)
* Suppress warnings about use of unstable compiler features.

* Remove unused functions.

* Refactor and remove PolynomialCoeffs::new_padded(); fix degree_padded.

Note that this fixes a minor mistake in the FFT testing code, where
`degree_padded` value was log2 of what it should have been, preventing
a testing loop from executing.

* Remove divide_by_z_h() and related test functions.

* Only compile check_{consistency,test_vectors} when testing.

* Move verify() to test module.

* Remove unused functions.

NB: Changed the config in the gadgets/arithmetic_extension.rs::tests
module which may change the test's meaning?

* Remove unused import.

* Mark GMiMC option as allowed 'dead code'.

* Fix missing feature.

* Remove unused functions.

* cargo fmt

* Mark variable as unused.

* Revert "Remove unused functions."

This reverts commit 99d2357f1c967fd9fd6cac63e1216d929888be72.

* Make config functions public.

* Mark 'reduce_nonnative()' as dead code for now.

* Revert "Move verify() to test module." Refactor to `verify_compressed`.

This reverts commit b426e810d033c642f54e25ebc4a8114491df5076.

* cargo fmt

* Reinstate `verify()` fn on `CompressedProofWithPublicInputs`.
2021-11-16 21:18:27 +11:00
Daniel Lubarov
07d03465b1
Verify that non-canonical splits are OK (#357)
The effect on soundness error is negligible for our current field, but this introduces an assertion that could fail if we changed to a field with more elements in the "ambiguous" range.
2021-11-15 10:03:13 -08:00
Nicholas Ward
f2ec2cadf4 new fmt 2021-11-10 12:14:23 -08:00
Nicholas Ward
ea4f950d6e fixes and fmt 2021-11-10 10:54:35 -08:00
Nicholas Ward
e838096940 use map; and TODOs 2021-11-10 09:58:16 -08:00
Nicholas Ward
b045afbb8a biguint methods in fields, and biguint gadget progress 2021-11-10 09:58:00 -08:00
Jakub Nabaglo
168f572804
Fix rustfmt failures on main (#348) 2021-11-09 14:52:05 -08:00
Daniel Lubarov
1450ffb29c
Small recursion optimizations (#338)
* Small recursion optimizations

Main thing is memoizing arithmetic operations. Overall savings is ~50 gates.

* feedback
2021-11-04 16:23:01 -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
Daniel Lubarov
806641d13f
Small optimizations (#319)
* Small optimizations

* Small optimizations

* feedback

* inline

* feedback

* fix unused import
2021-10-22 19:11:05 -07:00
Jakub Nabaglo
db23416b04
Goldilocks: better constant propagation through add_with_wraparound (#320) 2021-10-22 15:02:22 -07:00
Hamish Ivey-Law
c406f464b8
Faster squaring in extension fields (#318)
* Faster squaring for extension fields; use in cube().

* Add squaring to arithmetic benchmark.

* Rename variable to remove warning; adjust comment.

* Inline always (improves latency measurements a lot).
2021-10-22 16:05:00 +11:00
Jakub Nabaglo
609028c899
Poseidon-12 in hand-rolled ASM (#276)
* Goldilocks Poseidon-12 in asm

* Lints

* Hamish comments

* Reorganize arch-specific files
2021-10-13 09:47:50 -07:00
Jakub Nabaglo
5d099c5d45
x86 ASM tricks for scalar Goldilocks multiplication (#299)
* ASM tricks for scalar Goldilocks multiplication

* Minor style

* Provide generic versions of `add/sub_with_wraparound`

* Minor bugfix
2021-10-13 09:16:45 -07:00
Hamish Ivey-Law
41b26e1f56
Precompute the Dth root of unity. (#296) 2021-10-10 20:42:10 +11:00
Hamish Ivey-Law
8f59381c87
Faster modular inverse (#292)
* Working "faster" inverse algo, using u128s.

* Faster inverse_2exp for large exp.

* More inverse tests.

* Make f, g u64.

* Comments.

* Unroll first two iterations.

* Fix bug and re-unroll first two iterations.

* Simplify loop.

* Refactoring and documentation.

* Clean up testing.

* Move inverse code to inversion.rs; use in GoldilocksField.

* Bench quartic Goldilocks extension too.

* cargo fmt

* Add more documentation.

* Address Jakub's comments.
2021-10-10 10:39:02 +11:00
Nicholas Ward
7f18b21ace minor fix 2021-10-06 12:35:37 -07:00
Nicholas Ward
88b528e3fe fix 2021-10-06 11:44:02 -07:00
Nicholas Ward
d2c589e281 addressed comments 2021-10-06 11:42:34 -07:00
Nicholas Ward
695a56c4ca addressed comments 2021-10-06 11:34:50 -07:00
Nicholas Ward
b5fea8d1bb addressed comments 2021-10-06 11:24:24 -07:00
Nicholas Ward
e8805a126a fix 2021-10-06 11:22:21 -07:00
Nicholas Ward
097059e026 switch to u64 array 2021-10-06 11:20:11 -07:00
Nicholas Ward
c625aae87b cleanup and removed tests for now 2021-10-06 11:09:51 -07:00
Nicholas Ward
f79419cca3 add check to primitive_root_order field arithmetic test 2021-10-06 09:50:02 -07:00
Nicholas Ward
69678f53fc removed prime field tests 2021-10-05 22:02:57 -07:00
Nicholas Ward
5e0d2744d7 fixes 2021-10-05 22:01:18 -07:00
Nicholas Ward
a4c89201f3 fmt 2021-10-05 21:32:23 -07:00
Nicholas Ward
1262c6afd0 fixes 2021-10-05 21:32:18 -07:00
Nicholas Ward
351b92f31f progress towards Secp256K1Base field 2021-10-05 18:02:08 -07:00
Daniel Lubarov
3d39925973
Couple tweaks for Goldilocks (#274)
- impl `RichField`
- Fix missing imports (easy to miss since they're conditionally compiled)
- Have the benchmarks use Goldilocks
2021-09-28 10:03:19 -07:00
Jakub Nabaglo
7360391515
Cache FFT roots (#261) 2021-09-22 10:56:09 -07:00
Jakub Nabaglo
46cc27571d
Delete unrolled FFT (#258) 2021-09-21 17:32:38 -07:00
Jakub Nabaglo
1369dd7c76
Many small optimizations to scalar Poseidon (#253)
* Many small optimizations

* Lints

* Hamish comments

* Inlining
2021-09-20 10:52:12 -07:00
Jakub Nabaglo
5e748ed76b
#[inline] add_assign in CrandallField (#252) 2021-09-19 10:03:57 -07:00
Daniel Lubarov
e1812dd797 Slighly more user friendly Sage snippet 2021-09-15 21:13:57 -07:00
wborgeaud
b5d35b3582
Merge pull request #246 from mir-protocol/goldilocks_ext
Goldilocks extension fields
2021-09-15 18:32:15 +02:00
wborgeaud
c14673863a Add submodule for field extension tests 2021-09-15 18:22:26 +02:00
wborgeaud
5048a3f31d Minor 2021-09-15 10:05:41 +02:00
wborgeaud
c9d884f740 Change tests for quartic extension 2021-09-15 09:55:38 +02:00