Commit Graph

36 Commits

Author SHA1 Message Date
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 393b2b7834 Update proving/verifying keys. 2016-08-22 15:48:43 -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
Simon 75c2f26887 Update variable. 2016-08-08 00:51:27 -07:00
Simon 822b84b616 Fixes #1193 so that during verification benchmarking it does not
unncessarily create thousands of CTransaction objects.
2016-08-07 23:57:39 -07: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
Jack Grigg f7478de67f Add thread parameter to solveequihash benchmark
Closes #1147
2016-08-05 15:05:38 +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
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
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
Sean Bowe 1477fd3f40 Remove the constraint system from the alpha proving key. 2016-07-19 14:01:58 -06:00
Sean Bowe 22de160219 Fixes for indentation and local variable names. 2016-07-18 10:07:29 -06:00
Sean Bowe b7e4abd6f7 Rename some usage of 'pour'. 2016-07-18 10:06:18 -06:00
Sean Bowe a8c68ffe99 Rename CPourTx to JSDescription. 2016-07-18 10:06:18 -06:00
Sean Bowe 000383c193 Increase block size to 2MB and update performance test. 2016-07-07 16:53:16 -06:00
Sean Bowe 9c45b501ad Make `validatelargetx` test more accurate, reduce block size limit to 1MB for now. 2016-07-06 12:07:50 -06:00
Sean Bowe 2ba9641767 Fix performance test for block verification. 2016-07-05 07:55:35 -06: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 f5edc37f3f Add performance tests for creating and validating a MAX_BLOCK_SIZE transaction 2016-06-21 13:48:04 +12:00
Sean Bowe 1744fec274 Update the zkSNARK parameters. 2016-06-03 21:04:07 -06:00
zkbot 55bf149df9 Auto merge of #921 - str4d:optimised-equihash, r=daira
Optimise memory usage of Equihash implementation

Part of #857.
2016-06-01 13:10:26 +00:00
Taylor Hornby ed6c1b5d15 We don't want to benchmark signature creation / verification. 2016-05-30 11:05:43 -06:00
Sean Bowe 6b5d608899 Update proving key and tests that depend on transaction structure changes 2016-05-24 11:09:17 -06:00
Jack Grigg b5c6a3af12 Use optimised Equihash solver for miner and benchmarks
The basic solver is still used for regtest-only purposes.
2016-05-24 23:16:53 +12:00
Jack Grigg e95747288a Use template parameters to statically initialise Equihash 2016-05-24 23:16:50 +12:00
Sean Bowe b8d320df19 Update public zkSNARK parameters for new circuit. 2016-05-12 16:44:49 -06:00
Sean Bowe 2dc3599271 Transplant of libzcash. 2016-05-12 16:44:47 -06:00
Sean Bowe 2140639309 Remove scriptPubKey/scriptSig from CPourTx, and add randomSeed. 2016-05-12 16:44:30 -06:00
Sean Bowe 5961dcb6da Change ciphertext length to match protocol spec, and refactor the use of constants. 2016-05-05 21:02:03 -06:00
Sean Bowe 434f328446 Integrate new incremental merkle tree implementation into consensus. 2016-04-28 16:07:52 -06:00
Taylor Hornby 722b0117d0 Benchmark a random equihash input. 2016-04-11 11:51:12 -06:00
Taylor Hornby a1cd1a27ac Add verify equihash benchmark 2016-04-11 10:03:31 -06:00
Taylor Hornby d44feea44c Add JoinSplit verification benchmarks 2016-04-11 10:03:17 -06:00
Taylor Hornby bf8def9749 Add equihash solving benchmarks 2016-04-11 10:02:59 -06:00
Taylor Hornby 6962bb3df0 Add automated performance measurement system. 2016-04-11 08:15:25 -06:00