Commit Graph
100 Commits
Author SHA1 Message Date
Jack Grigg 48bb727d8a Remove .z# suffix from version 2016-09-09 00:22:18 -06:00
Jack Grigg 289b12e448 Add tests for refactored wallet code 2016-09-08 17:29:08 +12:00
Jack Grigg ac1c94350d Refactor wallet note code for testing 2016-09-08 17:17:35 +12:00
Jack Grigg 622ced8a74 Adjust test to account for integer division precision loss 2016-09-08 12:46:00 +12:00
Jack Grigg 4b37cfd5b8 Remove unnecessary method 2016-09-08 12:22:08 +12:00
Jack Grigg aea79ec053 Adjust test to avoid spurious failures
Previously, if the two random numbers happened to be equal, the block time
would not be updated, and subsequent checks would fail.
2016-09-08 11:34:50 +12:00
Jack Grigg 4a749674a8 Update tests for new genesis blocks 2016-09-07 21:05:12 +12:00
Jack Grigg 66f07f5d0d Regenerate genesis blocks for new powLimits 2016-09-07 08:18:46 +12:00
Jack Grigg 3e24a533f5 Restrict powLimit due to difficulty averaging 2016-09-07 08:17:43 +12:00
Jack Grigg 7b173bd80f Simplify difficulty averaging code 2016-09-06 23:03:36 +12:00
Jack Grigg 5fbb839f53 Add test of difficulty averaging 2016-09-06 23:01:58 +12:00
Jack Grigg f50e8313f5 Remove accidental double-semicolon (harmless but odd) 2016-09-06 13:18:33 +12:00
Jack Grigg 8f3ec042af Expand bounds on difficulty adjustment 2016-09-06 13:13:23 +12:00
Jack Grigg cb708a99a5 Add comments explaining changed semantics of pow_tests 2016-09-06 11:33:59 +12:00
Jack Grigg 333ea3c426 Remove testnet-only difficulty rules
The min-difficulty blocks are incompatible with difficulty averaging.

Network difficulty is also now defined as the difficulty the network is
currently working to solve, rather than the last non-min-difficulty block
difficulty.
2016-09-05 23:13:25 +12:00
Jack Grigg 29842505cc Adjust from average difficulty instead of previous difficulty 2016-09-05 22:25:11 +12:00
Jack Grigg f7d78fdde1 Fix failing test 2016-09-01 20:16:18 +12:00
Jack Grigg 57466ea652 Remove mainnet DNS seeds, set checkpoint to genesis
Closes #1185
2016-09-01 17:01:28 +12:00
Jack Grigg 00939d09ba Add test comparing GetDifficulty() with GetNetworkDifficulty() 2016-09-01 16:36:18 +12:00
Jack Grigg 695a7a8826 Separate concepts of block difficulty and network difficulty in RPC
"Block difficulty" is the difficulty listed in a block's header, which in the
testnet can sometimes be min-difficulty (if time-since-last-block is too large).

"Network difficulty" is the difficulty that the network was trying to satisfy
at a particular block height. In mainnet this is always equal to the difficulty
of the solved block for that height, but in testnet the network difficulty is
derived from the last non-min-difficulty block difficulty.

This commit fixes the RPC APIs that are intended to show network difficulty, so
that on testnet they don't sometimes drop to 1.0, confusing users.

Closes #1181
2016-09-01 15:13:05 +12:00
Jack Grigg 268bd84f9a Add coverage of the assertion inside GetNoteWitnesses() 2016-09-01 15:04:57 +12:00
Jack Grigg 73db0c12b9 Increase coverage of GetNoteDecryptor() 2016-09-01 14:44:01 +12:00
Jack Grigg 5abaca1af6 Fix the failing test! 2016-09-01 13:00:02 +12:00
Jack Grigg ac91ebbe92 Add test showing that the witness cache isn't being serialised 2016-09-01 12:47:44 +12:00
Jack Grigg 32a103aab7 Changes after review 2016-09-01 11:48:15 +12:00
Jack Grigg 0736fa14fc Keep any existing cached witnesses when updating transactions 2016-08-31 21:16:59 +12:00
Jack Grigg be86b6c332 Add test for GetNoteDecryptor() 2016-08-31 18:57:32 +12:00
Jack Grigg 1551db870a Add transactions to wallet if we spend notes in them 2016-08-31 18:28:00 +12:00
Jack Grigg 38a6e7a74d Set witness cache size equal to coinbase maturity duration
Both constants have the same implicit assumption: that the blockchain will very
rarely undergo a reorganisation of that size.
2016-08-31 15:26:49 +12:00
Jack Grigg ad20f2149a mapNullifiers -> mapNullifiersToNotes for clarity 2016-08-31 15:11:35 +12:00
Jack Grigg 4086e5ce98 Replace vAnchorCache with a cache size counter
The anchor is obtained from the returned witnesses; since all witnesses are to
the same point (the latest blockchain tip), they all have the same root.
2016-08-31 15:03:42 +12:00
Jack Grigg 3fac1020e7 Remove GetNoteDecryptors(), lock inside FindMyNotes() instead 2016-08-31 02:09:17 +12:00
Jack Grigg de42390f90 Pass ZCIncrementalMerkleTree to wallet to prevent race conditions 2016-08-31 02:00:11 +12:00
Jack Grigg 3e3da44c71 Test solution output of blockToJSON() 2016-08-30 14:42:49 +12:00
Jack Grigg 769e031c1a Update cached incremental witnesses when the active block chain tip changes 2016-08-30 00:29:49 +12:00
Jack Grigg be74c80deb Add caching of incremental witnesses for spendable notes 2016-08-30 00:29:49 +12:00
Jack Grigg 8db7e25c3f Create mapping from nullifiers to received notes
This is used in the same way as CTxIn.prevout (e.g. to mark transactions dirty).
2016-08-30 00:29:49 +12:00
Jack Grigg 0f1060478f Keep track of spent notes, and detect and report conflicts 2016-08-30 00:29:49 +12:00
Jack Grigg c3a7307a69 Store mapping between notes and PaymentAddresses in CWalletTx 2016-08-30 00:29:49 +12:00
Jack Grigg 02e674555e Add wallet method for finding spendable notes in a CTransaction 2016-08-30 00:29:49 +12:00
Jack Grigg 5db5e42ec3 Add optional bool to disable computation of proof in JSDescription constructor 2016-08-30 00:29:49 +12:00
Jack Grigg e1dde421c3 Output Equihash solution in RPC results as a hex string 2016-08-27 23:58:11 +12:00
Jack Grigg 488e61e852 Undo debugging change from 5be6abbf84
This was unintentionally committed, and caused Equihash verification of blocks
without parents to be skipped. This only affects the genesis block on the test
network, but also causes the "time verifyequihash" benchmark to incorrectly
appear instantaneous.
2016-08-26 14:09:25 +12:00
Jack Grigg 90b740fd3b Test conversion between solution indices and minimal representation 2016-08-24 13:42:52 +12:00
Jack Grigg e273f05d10 Remove unnecessary temporary array from Equihash hash generation 2016-08-21 06:05:48 +12:00
Jack Grigg 6e629886e5 Add another test case based on example in the spec 2016-08-21 05:57:46 +12:00
Jack Grigg a4f4fa8fe9 ASSERT -> EXPECT in test to get more info per test run about future regressions 2016-08-18 12:25:01 +12:00
Jack Grigg 04dfc3c569 Rework test to check for failure to return a spending key 2016-08-18 12:22:30 +12:00
Jack Grigg 0d7386916d Add separate lock for SpendingKey key store operations 2016-08-16 22:17:33 +12:00
Jack Grigg c2059f9e09 Remove non-libsnark dependencies and test harness code from coverage reports
Closes #1203
2016-08-16 22:05:35 +12:00
Jack Grigg 71442d31cf Add gtest coverage to folders deleted by "make clean" 2016-08-16 20:30:24 +12:00
Jack Grigg 873625bc85 Add gtest coverage intermediates to list of files deleted by make 2016-08-16 18:38:42 +12:00
Jack Grigg 6ecb05dd2f Enable branch coverage in coverage reports
Closes #892
2016-08-16 18:32:56 +12:00
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).
2016-08-16 16:02:39 +12:00
Jack Grigg 20abe2083c Extend byte array expansion and compression methods with optional padding 2016-08-16 11:02:04 +12:00
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.
2016-08-16 11:02:04 +12:00
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.
2016-08-16 11:02:00 +12:00
Jack Grigg b5c06c83b0 Consistent parameter naming 2016-08-12 14:37:17 +12:00
Jack Grigg 0bfdb9628e Merge AddSpendingKeyPaymentAddress into AddSpendingKey to simplify API 2016-08-12 14:24:29 +12:00
Jack Grigg 7c929cf5bc Add support for spending keys to the basic key store 2016-08-09 17:38:25 +12:00
Jack Grigg 23acf86791 Ignore duplicate entries after partial recreation 2016-08-06 17:33:38 +12:00
Jack Grigg a23507d086 Update tests to account for new Equihash parameters 2016-08-06 17:33:23 +12:00
Jack Grigg ca202e2db1 Change Equihash parameters to n = 200, k = 9 (about 563-700 MiB) 2016-08-06 15:27:27 +12:00
Jack Grigg 30bd297920 Fix bug in IsProbablyDuplicate()
Closes #1179
2016-08-06 15:26:22 +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
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 649be423f8 Fix previous commit 2016-08-06 02:03:08 +12:00
Jack Grigg 6609813753 Simplify optional parameters 2016-08-06 00:36:33 +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 f7478de67f Add thread parameter to solveequihash benchmark
Closes #1147
2016-08-05 15:05:38 +12:00
Jack Grigg 4a0bdc9020 Fix bug in 'generate' RPC method that caused it to fail with high probability 2016-07-30 01:28:17 +12:00
Jack Grigg 9e0713f47f Remove hardfork from special testnet difficulty rules
Closes #1131
2016-07-29 21:46:27 +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 9e6adb124f Hardfork to the previous testnet difficulty adjustment behaviour at block 43400
This hardfork will be removed the next time the testnet blockchain is reset.
2016-07-22 14:17:46 +12:00
Jack Grigg e99731b4a4 Reinstate previous testnet adjustment behaviour
When the difficulty adjustment algorithm was altered, the special testnet
min-difficulty case was maintained, but the difficulty adjustment for the
following block then adjusted from min-difficulty instead of from the last
non-min-difficulty block. This caused the difficulty on the testnet to sawtooth
instead of stabilising. The intended behaviour is restored here.
2016-07-21 20:50:05 +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 c6365f4d80 Add test case that requires the fix 2016-07-19 23:33:28 +12:00
Jack Grigg 1bb40a42c2 Collect all permutations of final solutions 2016-07-19 23:11:49 +12:00
Jack Grigg c2e092f29e Fix memory leak in large tx benchmark 2016-06-29 11:45:47 +12:00
Jack Grigg cfd806e161 Clear mempool before using it for benchmark test, fix parameter name 2016-06-29 11:19:41 +12:00
Jack Grigg 8e165d57d9 Randomise the nonce in the block header
The top and bottom 16 bits of the nonce are left clear for local use as thread
flags and counters. This does not leak any more local information about the
miner than is currently exposed.

The cleared bits should not be considered a consensus rule, as miners are free
to set all bits of the nonce however they wish.

Closes #1033
2016-06-28 11:36:35 +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 f5edc37f3f Add performance tests for creating and validating a MAX_BLOCK_SIZE transaction 2016-06-21 13:48:04 +12:00
Jack Grigg 3985a40d1f Change default ports 2016-06-17 00:21:58 +12:00
Jack Grigg cdec0b923e Fix bug in network hashrate lookup window configuration 2016-06-16 21:26:49 +12:00
Jack Grigg 71671484fd Handle full Zcash version string in AC_INIT 2016-06-16 13:48:42 +12:00
Jack Grigg 5e207f4ea5 Improve comments per review 2016-06-16 10:45:19 +12:00
Jack Grigg 284e125957 Update tests for new difficulty algorithm 2016-06-15 13:44:27 +12:00
Jack Grigg f2c48e15e5 Implement new difficulty algorithm (#931)
The algorithm is based on DigiShield v3/v4.
2016-06-15 09:48:42 +12:00
Jack Grigg 09e9a329b7 Tweaks after review 2016-06-14 09:41:03 +12:00
Jack Grigg f3aee6b109 Update miner tests for platform-independent Equihash 2016-06-12 00:00:26 +12:00