Commit Graph

37 Commits

Author SHA1 Message Date
Robert C. Seacord
1031047885 Update equihash.cpp
fix https://github.com/zcash/zcash/issues/1214
2016-08-10 15:40:32 -04:00
Jack Grigg
23acf86791 Ignore duplicate entries after partial recreation 2016-08-06 17:33:38 +12:00
Jack Grigg
fa19e1b357 Add test showing bug in IsProbablyDuplicate() 2016-08-06 15:23:47 +12:00
Jack Grigg
eeb4177843 Add Equihash support for n = 200, k = 9
Closes #1177
2016-08-06 10:33:14 +12:00
zkbot
e5b57a1432 Auto merge of #1173 - str4d:1165-equihash-fix-large-k-ballooning, r=bitcartel
Eliminate some of the duplicates caused by truncating indices

Closes #1165
2016-08-05 17:35:35 +00:00
Jack Grigg
036dcbd94a Remove the assumption that n/(k+1) is a multiple of 8.
This version works, but generates the initial rows in a way that is not what we
want to specify. See #1175 for resolving this.

Co-author: Daira Hopwood <daira@jacaranda.org>
2016-08-06 02:40:07 +12:00
Jack Grigg
3c3ef34505 Add missing assert 2016-08-05 22:24:04 +12:00
Jack Grigg
e999c1e339 Simplify IsProbablyDuplicate() 2016-08-05 22:17:40 +12:00
Jack Grigg
3c654f38eb Eliminate probably duplicates in final round
This is more likely to eliminate valid solutions than doing so in intermediate
rounds, but the probability is still very low.
2016-08-05 18:15:34 +12:00
Jack Grigg
6b4f4475a5 Use fixed-size array in IsProbablyDuplicate to avoid stack protector warning 2016-08-05 17:18:47 +12:00
Jack Grigg
d4af3dd5fd Eliminate some of the duplicates caused by truncating indices 2016-08-05 17:09:30 +12:00
Jack Grigg
51eb5273f5 Equihash: Pass each obtained solution to a callback for immediate checking
Closes #1143
2016-07-27 19:15:49 +12:00
Jack Grigg
215b9e139d Use std::shared_ptr to deallocate partialSolns automatically 2016-07-23 00:31:47 +12:00
Jack Grigg
1655db285d Move initialisations to simplify cancelled checks 2016-07-22 23:54:14 +12:00
Jack Grigg
5a360a5c6a Fix segfault by indirectly monitoring chainActive.Tip(), locking on mutex 2016-07-21 19:34:21 +12:00
Jack Grigg
5b4ebcd5e2 Add tests that exercise the cancellation code branches 2016-07-21 16:39:32 +12:00
Jack Grigg
2dbabb1159 Make Equihash solvers cancellable
The miner only cancels the solver when chainActive.Tip() changes.

Closes #1055
2016-07-20 19:17:02 +12:00
Jack Grigg
1bb40a42c2 Collect all permutations of final solutions 2016-07-19 23:11:49 +12:00
Jack Grigg
d151ab4fea Only compare the first n/(k+1) bits when sorting 2016-06-21 15:53:47 +12:00
Jack Grigg
09e9a329b7 Tweaks after review 2016-06-14 09:41:03 +12:00
Jack Grigg
933cb4cd9f Use htole32 and htobe32 for endian conversions 2016-06-11 16:52:02 +12:00
Jack Grigg
a6dcf2ee6f Use little-endian for hash personalisation and hashing indices
The test vectors have been regenerated using the basic solver.
2016-06-11 16:28:57 +12:00
Jack Grigg
d07cf62991 Speed up FullStepRow index comparison by leveraging big-endian byte layout 2016-06-11 16:28:57 +12:00
Jack Grigg
ae37d2a4cd Increase Equihash parameters to n = 96, k = 3 (about 430 MiB)
Includes a tweak to set the fixed-width of the rows based on whether the first
or last round is widest. This is necessary for some parameters, these ones
included.
2016-06-11 12:15:25 +12:00
Jack Grigg
0a66f01304 Use depth-first scan for eliminating partial solutions instead of breadth-first
This reduces the peak number of lists in-memory from 2^k to k, and enables the
solver to eliminate most duplicates before it has instantiated the full set of
leaves.
2016-06-03 17:00:03 +12:00
Jack Grigg
447444ae7a Fix nits after review 2016-06-01 23:15:04 +12:00
Jack Grigg
d4d76536a5 Use fixed-width array for storing hash and indices 2016-05-24 23:16:53 +12:00
Jack Grigg
29d9986c83 Store full indices in the same char* as the hash 2016-05-24 23:16:52 +12:00
Jack Grigg
639c40047f Use comparator object for sorting StepRows 2016-05-24 23:16:52 +12:00
Jack Grigg
a683cc85d9 Merge *StepRow XOR and trimming operations 2016-05-24 23:16:52 +12:00
Jack Grigg
e95747288a Use template parameters to statically initialise Equihash 2016-05-24 23:16:50 +12:00
Jack Grigg
39f5cb35f9 Store truncated indices in the same char* as the hash (H/T tromp for the idea!) 2016-05-24 12:02:46 +12:00
Jack Grigg
c92c1f6050 Implement index-truncation Equihash optimisation 2016-05-24 12:02:46 +12:00
Jack Grigg
6afef0dd6d Cleanups 2016-05-24 12:02:46 +12:00
Jack Grigg
a3361e778b Refactor StepRow to make optimisation easier 2016-05-24 12:02:08 +12:00
Taylor Hornby
675e17022f Use left shift instead of floating-point pow() in equihash. 2016-05-18 11:22:29 -06:00
Jack Grigg
6d25662f25 Implement validator and basic solver for Equihash 2016-04-08 13:56:00 +12:00