1160 Commits

Author SHA1 Message Date
Nicholas Ward
1fb7eeb03e variable-sized tests 2021-09-04 16:29:33 -07:00
Nicholas Ward
4c3f3cda39 6x6 test 2021-09-04 16:29:33 -07:00
Nicholas Ward
4f7a587bfa fix for non-2x2 permutation case 2021-09-04 16:29:32 -07:00
Nicholas Ward
f01d373d1e made switch_bool wires routeable 2021-09-04 16:28:10 -07:00
Nicholas Ward
7acdf976c1 fixed fill_switch_gates 2021-09-04 16:28:07 -07:00
Daniel Lubarov
f89f49249a wip 2021-09-04 16:27:40 -07:00
Daniel Lubarov
ba4b03e487
Unroll a couple loops in Poseidon code (#215)
* Unroll a couple loops in Poseidon code (super hacky)

* Comments
2021-09-03 21:42:40 -07:00
Nicholas Ward
d1fea5cfd3 witnessgenerator 2021-09-03 18:07:51 -07:00
Nicholas Ward
10d016a92c chunk size as field 2021-09-03 18:07:21 -07:00
Nicholas Ward
3ad0365967 fixed infinite loop 2021-09-03 18:07:21 -07:00
Nicholas Ward
3494839227 removed more to_vec calls (within maps) 2021-09-03 18:07:21 -07:00
Nicholas Ward
260d4bd13c removed to_vec calls 2021-09-03 18:07:21 -07:00
Nicholas Ward
485d4862ff fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
4ea1df82ba fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
c2439557bf fix 2021-09-03 18:07:21 -07:00
Nicholas Ward
0f6e9c5b68 progress 2021-09-03 18:07:21 -07:00
Nicholas Ward
ab744a7c36 edits and fixes 2021-09-03 18:07:21 -07:00
Nicholas Ward
d4aa4d7153 fixes and new generator 2021-09-03 18:07:21 -07:00
Nicholas Ward
f7607dddd4 fmt 2021-09-03 18:07:21 -07:00
Nicholas Ward
fe843db57f many fixes 2021-09-03 18:07:20 -07:00
Nicholas Ward
a1d5f5b6fe progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
f9a47ade33 fixes 2021-09-03 18:07:20 -07:00
Nicholas Ward
2d5f362c6a fixes 2021-09-03 18:07:20 -07:00
Nicholas Ward
013c8bb612 progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
2ab37e688f progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
a574fecc4d permutation progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
412ada762a permutation progress 2021-09-03 18:07:20 -07:00
Nicholas Ward
b0a855a9c3 progress on permutation 2021-09-03 18:07:20 -07:00
Jakub Nabaglo
032e2feeb4 Daniel comments 2021-09-03 17:19:48 -07:00
Jakub Nabaglo
ec0195c8eb PackedField trait 2021-09-03 17:19:48 -07:00
Hamish Ivey-Law
92bc65a6b5
Native Poseidon implementation(s) (#207)
* Simplify and refactor GMiMC benchmark.

* Refactor/combine GMiMC and Rescue hash benchmarks.

* Remove old Rescue bench; rename GMiMC bench.

* Add from_canonical_u128 for fields.

* Initial version of Poseidon.

* Partial implementation of fast Poseidon.

* Complete (but broken) implementation of fast partial rounds.

* Fix index calculation.

* Add basic tests.

* Fix constants; fix bugs in fast partial round calculation.

* Rename main functions.

* Add test vectors.

* Use x^7 for s-box monomial.

* Fix s-box application in fast version.

* Make WIDTH a parameter.

* Working version with both widths.

* Updated the constants so they use x^3; added test vectors.

* Expand bench_hash to cover both widths and report relative slowdown.

* Remove references to MaybeUninit.

* First draft of refactoring the two Poseidon widths.

* Tidy up use of conversion to/from raw data.

* Add some comments.

* Refactor tests.

* Apply cargo fmt changes.

* Have `Field`s implement `PoseidonInterface` (#209)

* Have `Field`s implement `PoseidonInterface`

Rather than having a sort of "dummy struct" implement `PoseidonInterface` with the field as a generic param. I think this seems more natural and type-safe.

The type safety does come at a price -- it would be harder to do dynamic things such as taking `WIDTH` as a command line option -- but I think that's alright.

* Fix missed conflicts.

* cargo fmt fixes.

* Fix to accommodate changes in latest nightly.

Co-authored-by: Hamish Ivey-Law <426294+unzvfu@users.noreply.github.com>
Co-authored-by: Hamish Ivey-Law <hamish@ivey-law.name>

* Sanity check number of rounds.

Co-authored-by: Daniel Lubarov <daniel@lubarov.com>
2021-09-01 21:45:52 +10:00
Jakub Nabaglo
1727d2c872
Batch multiplicative inverse optimizations (#210)
* Batch multiplicative inverse optimizations

* Minor style (Daniel PR comment)
2021-08-31 15:08:39 -07:00
Daniel Lubarov
d51bb98dcc
Tweaks to reflect that we're not running clippy 2021-08-31 14:01:50 -07:00
Jakub Nabaglo
5513a64614
Buffer reuse in eval_vanishing_poly_base (#211)
* Buffer reuse in eval_vanishing_poly_base

* Lint
2021-08-31 13:23:00 -07:00
Jakub Nabaglo
c4fd0919b6
Save 3% on eval_unfiltered_base (#206)
* Save 3% on eval_unfiltered_base

Again, remove a few allocations/deallocations.

* Minor style
2021-08-28 15:00:47 -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
Jakub Nabaglo
a71966f6f5
Bugfix: Crandall field addition occasionally returns incorrect results (#203)
* Fix bug that causes Crandall field addition to yield incorrect results in rare circumstances

* Minor proof correction

* Daniel PR comment
2021-08-26 12:24:18 -07:00
Jakub Nabaglo
6949d04c72
Field arithmetic benchmark improvements (#200)
* Field arithmetic benchmark improvements

* Separate throughput/latency benchmarks

* Widen addition throughput benchmark
2021-08-24 11:56:00 -07:00
wborgeaud
002a0ffc06
Merge pull request #199 from mir-protocol/rename_connect
Rename `route` and `assert_equal` to `connect`
2021-08-24 18:29:35 +02:00
wborgeaud
d01d206524 Remove named connects 2021-08-24 18:20:47 +02: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
Nicholas Ward
8f75a8de7f Merge commit '717efbb' 2021-08-23 14:22:20 -07: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
d4ee2a6c18
Merge pull request #197 from mir-protocol/remove_remaining_reverse_bits
Remove remaining `reverse_bits`
2021-08-23 18:16:37 +02:00
wborgeaud
bc3eb856f2 Remove remaining reverse_bits 2021-08-23 11:57:35 +02:00
wborgeaud
181ddf93ab Merge two impls 2021-08-23 11:06:33 +02:00
wborgeaud
2fcfa230a6 Pr feedback 2021-08-22 10:36:44 +02:00
wborgeaud
5fba65a3f5 Check old value in PartitionWitness::set_target 2021-08-20 22:42:09 +02:00