Commit Graph

746 Commits

Author SHA1 Message Date
Simon
da5e7e5185 Formatting and updated test per review. 2016-09-08 21:46:15 -07:00
Simon
e883ffef91 Add test for calling RPC z_getbalance, z_gettotalbalance, z_listreceivedbyaddress with invalid parameters. 2016-09-08 21:46:15 -07:00
Simon
7b79275eba Add tests to try and improve coverage of perform_joinsplit. 2016-09-08 21:46:14 -07:00
Simon
cff6f0ac46 Add friend class for testing private members of AsyncRPCOperation_sendmany. 2016-09-08 21:46:14 -07:00
Simon
fc4b127ed3 Add tests for async queue and rpc commands: z_getoperationstatus, z_getoperationresult, z_listoperationids, z_sendmany 2016-09-08 21:46:14 -07:00
Simon
b922924d14 Add test for AsyncRPCQueue and AsyncRPCOperation. 2016-09-08 21:46:14 -07:00
zkbot
2271d3feda Auto merge of #1338 - str4d:147-tweak-difficulty-adjustment-algorithm, r=ebfull
Tweaks to difficulty adjustment algorithm

This PR changes the difficulty algorithm to adjust from the average difficulty over the
block window instead of from the last difficulty. It also removes the special rules for the
testnet, which are incompatible with difficulty averaging.

Closes #147 again.
2016-09-08 02:21:13 +00:00
Jack Grigg
4b37cfd5b8 Remove unnecessary method 2016-09-08 12:22:08 +12:00
Simon
805344dcf4 Refactor: replace calls to GetTxid() with GetHash() 2016-09-07 15:12:09 -07:00
Simon
a64f681f2c Remove #1144 from input data of script_tests.
Revert script_invalid.json to commit df1609f.
Revert script_valid.json to commit 1c54757.
2016-09-07 15:12:09 -07:00
Simon
5316bd3560 Remove #1144 from bloom_tests by reverting to commit 5012190. 2016-09-07 15:12:09 -07:00
Sean Bowe
a4b00373ab Fix transaction test in test_bitcoin. 2016-09-07 13:55:31 -06:00
Jack Grigg
4a749674a8 Update tests for new genesis blocks 2016-09-07 21:05:12 +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
zkbot
485ace0a1b Auto merge of #1311 - ebfull:cleanup-pp, r=ebfull
Deallocate the public parameters during Shutdown.

This also has it deallocated in `GenerateParams` and `test_bitcoin`. The virtual destructor probably isn't necessary but I added it just in case we need it some other time.
2016-09-02 03:03:45 +00:00
Simon
5d50130bc9 Closes #1315. RPC getblocksubsidy height parameter is now optional and
a test has been added to verify parameter input and results.
2016-08-30 15:11:07 -07:00
Sean Bowe
7ee82c4361 Deallocate the public parameters during Shutdown. 2016-08-26 16:55:43 -06:00
Simon
4b2e557181 Fix comments. 2016-08-24 11:19:34 -07:00
Simon
badb9a9c2f Add test coverage for RPC call z_getnewaddress. 2016-08-24 11:19:34 -07:00
Simon
60f762a549 Added wallet rpc tests to cover:
z_importwallet, z_exportwallet
z_importkey, z_exportkey
z_listaddresses
2016-08-24 11:19:34 -07:00
zkbot
cd9d373987 Auto merge of #1260 - str4d:1175-byte-array-manipulation, r=ebfull
Update Equihash implementation to match the Zcash spec

Closes #1175
2016-08-24 03:01:13 +00:00
Sean Bowe
f0dab51cf3 Implement zkSNARK compression. 2016-08-22 00:36:12 -06:00
zkbot
365845216b Auto merge of #1268 - ThisIsNotOfficialCodeItsJustForks:t1130-upgrade-libsodium, r=ebfull
Upgrade libsodium for AVX2-detection bugfix.

Upgrades libsodium to bring in an AVX2-detection bugfix (to help with #1130).
2016-08-22 02:34:30 +00:00
Taylor Hornby
2902ac7ce8 Use libsodium's s < L check, instead checking that libsodium checks that. 2016-08-18 16:38:20 -06: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
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
Sean Bowe
f5e5707d4c Change memo field size and relocate ciphertexts field of JoinSplit description. 2016-08-15 09:39:14 -06:00
Jack Grigg
a23507d086 Update tests to account for new Equihash parameters 2016-08-06 17:33:23 +12:00
zkbot
95277e0311 Auto merge of #1144 - bitcartel:zc.v0.11.2.z7_tx_malleability_gettxid, r=bitcartel
A fix for transaction malleability

This PR fixes transaction malleability by not including the sigscript of transaction inputs and joinsplit sigs when hashing the txid.

This PR supercedes PR #1101 which was a minimal solution based on a new serialization flag.

This PR introduces GetTxid() to distinguish between getting a transaction id and the double sha256 hash.

The key changes are:
- Adding GetTxid() method to CTransaction which makes a copy of the transaction, clearing out the sigscript and joinsplitsig fields, before hashing.
- Verifying that every call to GetHash() actually wants a txid, and replacing with GetTxid().
- Renaming GetHash() to GetSerializeHash()
  - Rationale: In future, upstream code we want to merge will use GetHash() but we don't know the intent.  We should check to see if the intent is to receive a txid (most likely) in which case we replace with GetTxid(), or if upstream actually wants a double hash of the transaction we can use GetSerializeHash().
- Updated genesis data in chainparams.cpp

Note that coinbase transactions are excluded as they need the sigscript hashed to help avoid duplicate txids per BIP34:
  - This modification is related to a question from @ebfull on PR #1101 - "Can we think of a way this change allows us to construct two transactions with the same txid which can simultaneously appear in the blockchain? My guess is it would be possible to construct a coinbase transaction of such a form... this surely breaks invariants."

This PR Passes all tests in test_bitcoin (test data was updated in bloom_tests, miner_tests and script_tests).
2016-08-05 19:31:52 +00:00
Simon
0ccb650b5a Update genesis block hashes and test data. 2016-07-27 00:55:48 -07:00
Simon
2481bab2b8 Revert "Set nLockTime in CreateNewBlock() so coinbase txs do not have the same txid."
This reverts commit 29306269f4.
2016-07-27 00:41:26 -07: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
Simon
29306269f4 Set nLockTime in CreateNewBlock() so coinbase txs do not have the same txid.
Update test data in miner_tests.
2016-07-26 17:13:03 -07:00
Simon
10d2c57c0d Replace calls to GetHash() with GetTxid() for transaction objects.
Where the caller intends to receive a transaction id and not a double
SHA256 hash.
2016-07-26 17:13:03 -07:00
Simon
3574c9251f Updated test data for script_tests by uncommenting UPDATE_JSON_TESTS flag. 2016-07-26 17:09:27 -07:00
Simon
b742003ee9 Update block and tx data used in bloom filter tests. 2016-07-26 17:09:27 -07:00
Simon
2b9130cd1f Update precomputed equihash solutions used in test. 2016-07-26 17:09:27 -07: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
zkbot
e117ff7651 Auto merge of #1048 - str4d:collect-all-valid-equihash-solns, r=ebfull
Collect all permutations of final solutions

This fixes a small bug where if there was a three-way (or more) collision in the final step, one or more valid solutions would be left out.
2016-07-20 03:54:30 +00:00
Taylor Hornby
838e3c753f Fix the tests that the SIGHASH_SINGLE bugfix breaks. 2016-07-19 16:36:37 -06:00
Taylor Hornby
67f0243533 Remove in-band error signalling from SignatureHash, fixing the SIGHASH_SINGLE bug. 2016-07-19 16:36:35 -06:00
Jack Grigg
c6365f4d80 Add test case that requires the fix 2016-07-19 23:33:28 +12:00
zkbot
d20d866d89 Auto merge of #1105 - bitcartel:zc.v0.11.2.z6_issue_424, r=ebfull
New private/public key pairs for broadcasting alert messages

Implements #424

Fixes and integrates method of sending alerts as described by upstream here:
- https://gist.github.com/laanwj/0e689cfa37b52bcbbb44

To send an alert:
- Copy private keys into alertkeys.h.
- Modify alert parameters and message found in sendalert.cpp
- Build and run to send the alert e.g. ./zcashd -printtoconsole -sendalert

Tested and verified with local nodes on alpha 6 testnet.
2016-07-18 21:09:46 +00:00
Sean Bowe
22de160219 Fixes for indentation and local variable names. 2016-07-18 10:07:29 -06:00
Sean Bowe
28173cd0de Remove more usage of serial. 2016-07-18 10:06:18 -06:00
Sean Bowe
9e511dbbdd Rename CSerialsCacheEntry. 2016-07-18 10:06:18 -06:00
Sean Bowe
1d184d53e1 Rename cacheSerials to cacheNullifiers and fix tests. 2016-07-18 10:06:18 -06:00
Sean Bowe
b7e4abd6f7 Rename some usage of 'pour'. 2016-07-18 10:06:18 -06:00
Sean Bowe
bb64be52fe Rename mapSerials to mapNullifiers. 2016-07-18 10:06:18 -06:00