ca333
a2d7c036e0
darwin 333
7 years ago
ca333
9d36579649
uni3
7 years ago
Jack Grigg
2cc0a252ad
Add compile flag to disable compilation of mining code
8 years ago
Joel Barker
cb42e55182
tweaks to allow compiling on linux
7 years ago
Joel Barker
e891d64b87
macifiy the build so that this compiles on a mac
7 years ago
4ZEC
cc6c9ec05e
Correct line swap
Pretty clear the author wanted these two lines in other order.
8 years ago
Daira Hopwood
bcf79c78c5
Change some asserts in equihash.cpp to be static.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
8 years ago
Daira Hopwood
c6a7e897bc
Add mostly-static checks on consistency of Equihash parameters, MAX_HEADERS_RESULTS, and MAX_PROTOCOL_MESSAGE_LENGTH.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
8 years ago
Jack Grigg
e273f05d10
Remove unnecessary temporary array from Equihash hash generation
8 years ago
Jack Grigg
5be6abbf84
Store the Equihash solution in minimal representation in the block header
The genesis blocks and miner tests have been regenerated, because changing the
block header serialisation format changes the block hash, and thus validity.
The Equihash solutions have been removed from the bloom test inputs for
simplicity (block validity is not checked there; only a valid serialisation is
necessary).
8 years ago
Jack Grigg
20abe2083c
Extend byte array expansion and compression methods with optional padding
8 years ago
Jack Grigg
caa0348f04
Update Equihash hash generation to match the Zcash spec
Changes:
- floor(512/n)*n/8 bytes of BLAKE2b output is split between floor(512/n)
adjacent indices, instead of using one hash call per index.
- Parameters with n/(k+1) mod 8 != 0 will expand the BLAKE2b output to byte
boundaries for colliding, instead of using a longer output and clearing bits.
- The genesis blocks have been regenerated.
- The test vectors have been regenerated.
- The Equihash inputs for the cancellation tests were modified to ensure that
valid solutions were available to exercise the full solver.
8 years ago
Jack Grigg
881ffbfc87
Add methods for byte array expansion and compression
These methods convert between:
- A byte array of length NL/8, and
- An array of N blocks of ceil(L/8) bytes.
8 years ago
Robert C. Seacord
1031047885
Update equihash.cpp
fix https://github.com/zcash/zcash/issues/1214
8 years ago
Jack Grigg
23acf86791
Ignore duplicate entries after partial recreation
8 years ago
Jack Grigg
fa19e1b357
Add test showing bug in IsProbablyDuplicate()
8 years ago
Jack Grigg
eeb4177843
Add Equihash support for n = 200, k = 9
Closes #1177
8 years ago
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>
8 years ago
Jack Grigg
3c3ef34505
Add missing assert
8 years ago
Jack Grigg
e999c1e339
Simplify IsProbablyDuplicate()
8 years ago
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.
8 years ago
Jack Grigg
6b4f4475a5
Use fixed-size array in IsProbablyDuplicate to avoid stack protector warning
8 years ago
Jack Grigg
d4af3dd5fd
Eliminate some of the duplicates caused by truncating indices
8 years ago
Jack Grigg
51eb5273f5
Equihash: Pass each obtained solution to a callback for immediate checking
Closes #1143
8 years ago
Jack Grigg
215b9e139d
Use std::shared_ptr to deallocate partialSolns automatically
8 years ago
Jack Grigg
1655db285d
Move initialisations to simplify cancelled checks
8 years ago
Jack Grigg
5a360a5c6a
Fix segfault by indirectly monitoring chainActive.Tip(), locking on mutex
8 years ago
Jack Grigg
5b4ebcd5e2
Add tests that exercise the cancellation code branches
8 years ago
Jack Grigg
2dbabb1159
Make Equihash solvers cancellable
The miner only cancels the solver when chainActive.Tip() changes.
Closes #1055
8 years ago
Jack Grigg
1bb40a42c2
Collect all permutations of final solutions
8 years ago
Jack Grigg
d151ab4fea
Only compare the first n/(k+1) bits when sorting
8 years ago
Jack Grigg
09e9a329b7
Tweaks after review
8 years ago
Jack Grigg
933cb4cd9f
Use htole32 and htobe32 for endian conversions
8 years ago
Jack Grigg
a6dcf2ee6f
Use little-endian for hash personalisation and hashing indices
The test vectors have been regenerated using the basic solver.
8 years ago
Jack Grigg
d07cf62991
Speed up FullStepRow index comparison by leveraging big-endian byte layout
8 years ago
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.
8 years ago
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.
8 years ago
Jack Grigg
447444ae7a
Fix nits after review
8 years ago
Jack Grigg
d4d76536a5
Use fixed-width array for storing hash and indices
8 years ago
Jack Grigg
29d9986c83
Store full indices in the same char* as the hash
8 years ago
Jack Grigg
639c40047f
Use comparator object for sorting StepRows
8 years ago
Jack Grigg
a683cc85d9
Merge *StepRow XOR and trimming operations
8 years ago
Jack Grigg
e95747288a
Use template parameters to statically initialise Equihash
8 years ago
Jack Grigg
39f5cb35f9
Store truncated indices in the same char* as the hash (H/T tromp for the idea!)
8 years ago
Jack Grigg
c92c1f6050
Implement index-truncation Equihash optimisation
8 years ago
Jack Grigg
6afef0dd6d
Cleanups
8 years ago
Jack Grigg
a3361e778b
Refactor StepRow to make optimisation easier
8 years ago
Taylor Hornby
675e17022f
Use left shift instead of floating-point pow() in equihash.
8 years ago
Jack Grigg
6d25662f25
Implement validator and basic solver for Equihash
8 years ago