Commit Graph

140 Commits

Author SHA1 Message Date
Chethan Krishna 7814d628ce wallet-utility: extract addresses and private keys
usage: ./wallet-utility -datadir=<directory>
help: ./wallet-utility -h

Zcash: Backported to older chainparams code, added Zcash libs to LDADD
2018-09-05 13:05:50 -07:00
Jay Graber 052d640cb0 Add json test vectors for Sapling key components. 2018-06-13 10:38:32 -07:00
Sean Bowe 8f5429a13a Update merkle tree and pedersen hash tests to account for new encoding 2018-05-18 13:26:39 -06:00
Homu f0daf3915f Auto merge of #3233 - str4d:3164-sapling-sighash, r=str4d
ZIP 243: Sapling SignatureHash

Closes #3164.
2018-05-08 16:59:33 -07:00
Homu b1d2a69908 Auto merge of #3202 - str4d:3058-sapling-bech32, r=str4d
Bech32 encoding support

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#8578
- bitcoin/bitcoin#11167
  - Only the second and third commits (first is in #3228, fourth depends on #2390, later ones are SegWit-specific).
- bitcoin/bitcoin#12757
  - Only the change to `src/bech32.h`

Part of #3058.
2018-05-08 09:08:37 -07:00
Jack Grigg 50284985e9
Update sighash tests 2018-05-08 11:45:41 +01:00
Sean Bowe 40bfb9e5b9 Swap bit endianness of test vectors 2018-05-07 18:57:04 -06:00
Sean Bowe 2f23a656fb Add regression tests and test vectors for Sapling merkle tree 2018-05-07 13:46:06 -06:00
Pieter Wuille 488d43dd8f
Convert base58_tests from type/payload to scriptPubKey comparison 2018-05-04 10:27:11 +01:00
Jack Grigg ee6220c0ed
[Bitcoin-Tx] Adjust util-test test cases for Zcash 2018-04-12 19:36:48 -06:00
Jonas Schnelli f11fb32967
[Bitcoin-Tx] Add tests for sequence number support 2018-04-12 18:10:04 -06:00
Jack Grigg d58ed91af0
Optimise serialization of MerklePath, avoiding ambiguity of std::vector<bool>
The serialization enforces a maximum supported Merkle tree depth of 64.

Closes #2831.
2018-03-28 18:26:08 +02:00
Jack Grigg 713b366231
Regenerate sighash tests 2018-02-23 01:40:08 +00:00
Jack Grigg a3353b4e01
Regenerate SignatureHash tests 2018-02-20 04:22:21 +00:00
Jack Grigg be12669982
Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter
We do not need to be able to calculate multiple SignatureHash versions for a
single transaction format; instead, we use the transaction format to determine
the SigVersion.

The consensus branch ID *does* need to be passed in from the outside, as only
the caller knows the context in which the SignatureHash is being calculated
(ie. mempool acceptance vs. block validation).

JoinSplit signature verification has been moved into ContextualCheckTransaction,
where the consensus branch ID can be obtained.

The argument to the sign command for zcash-tx has been modified to take a height
in addition to the optional sigtype flags.
2018-02-20 04:22:20 +00:00
Jack Grigg 46d3762a90 Update SignatureHash tests for transaction format changes
The test uses randomly-generated transactions, some of which fell outside the
actual consensus rules.
2018-02-16 10:10:35 -08:00
Daira Hopwood 4a785b0a5b Repair tests for strict DER signatures.
While we're at it, repair a similar test for CLTV, and make the repaired RPC tests run by default.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-06-19 16:32:15 +01:00
Daira Hopwood de609b8c54 Strict DER signatures are always enforced; remove the flag and code that used it.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-06-17 17:19:08 +01:00
Wladimir J. van der Laan 1eb6654314
tests: Fix bitcoin-tx signing testcase
Fixes wrong scriptPubkey problem, which caused the transaction to
not actually be signed.
2017-03-03 11:47:01 -08:00
Sean Bowe d92bea9888 Add tests for witness `element` and tree `last` methods. Strengthen testing by inserting a different commitment into the tree at each step. 2016-11-14 10:13:06 -07:00
Jack Grigg 66a89c08df
Rename bitcoin-tx to zcash-tx
Closes #1565
2016-10-18 16:45:43 -05:00
Simon 5bd677f5c6 Rename client identifier from Satoshi to MagicBean (closes #1481) 2016-10-12 10:50:05 -07:00
zkbot b4526f4d22 Auto merge of #1458 - str4d:1386-remove-findanddelete-and-codeseparator, r=ageis
Remove FindAndDelete and disable OP_CODESEPARATOR

Closes #1386
2016-10-04 21:51:29 -04:00
Daira Hopwood 9418345fe6 Repair bitcoin-util-test.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-10-04 22:56:33 +01:00
Daira Hopwood fbad4cac24 Reencode keys in JSON test data. refs #812
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-10-03 23:53:14 -07:00
Jack Grigg a4f2555b35 Mark previously-valid test data as invalid 2016-10-03 20:09:18 -07:00
Jack Grigg 7f01e437a6 Remove OP_CODESEPARATOR from tests 2016-10-01 01:17:32 +13:00
Jack Grigg 6567a7b534 Add tests for alerts enabling RPC safe mode 2016-09-30 17:47:28 +13:00
Daira Hopwood 05e2db116d Remove FindAndDelete. refs #1386
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-09-27 00:48:30 +01: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
Sean Bowe f0dab51cf3 Implement zkSNARK compression. 2016-08-22 00:36:12 -06:00
Sean Bowe f5e5707d4c Change memo field size and relocate `ciphertexts` field of JoinSplit description. 2016-08-15 09:39:14 -06:00
Simon 0ccb650b5a Update genesis block hashes and test data. 2016-07-27 00:55:48 -07:00
Simon 3574c9251f Updated test data for script_tests by uncommenting UPDATE_JSON_TESTS flag. 2016-07-26 17:09:27 -07:00
Taylor Hornby 838e3c753f Fix the tests that the SIGHASH_SINGLE bugfix breaks. 2016-07-19 16:36:37 -06:00
Simon 939aaeb620 New alert test data generated for new alert key pair.
Added test fixture to create new test data.
Added instructions for developer.
2016-07-17 12:36:26 -07:00
Sean Bowe 320f2cc7e0 Switch to Ed25519 for cryptographic binding of joinsplits to transactions. 2016-05-30 11:05:55 -06:00
Taylor Hornby b48122b57b Fix tests for JoinSplit signatures 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
Taylor Hornby bf2e3122ac Remove the Merkle tree hash function's fixed point. 2016-05-16 20:20:36 -06:00
Sean Bowe 2140639309 Remove scriptPubKey/scriptSig from CPourTx, and add randomSeed. 2016-05-12 16:44:30 -06:00
zkbot 92f3c6082a Auto merge of #889 - ebfull:new-imt-redux, r=ebfull
Implement and integrate new Incremental Merkle Tree

This supersedes #823.

----

This is an implementation of a new incremental merkle tree with

* no memory safety issues
* a more sensible internal design
* better space efficiency (tree representation, witnessing)
* simpler API

It is intended that this tracks the behavior of the previous tree, which it does, as verified by tests. I even wrote a little circuit for testing that all the paths work.

This PR also integrates the tree into the codebase and deprecates the old tree in almost all of our code. (I left it alone in `zerocashTest` but everything else has been changed.)

This change is compatible with the testnet but you will need to clear your *local* blockchain data out since the serialized representation of the merkle tree is now different.

Closes #517, Closes #519, Closes #591, Closes #460, Closes #473
2016-05-03 17:33:27 +00:00
Sean Bowe 6c36a9fe03 NoteEncryption implementation and integration, removal of ECIES and crypto++ dependencies. 2016-04-28 16:25:12 -06:00
Sean Bowe e1ff849d8d New implementation of incremental merkle tree
This is a new implementation of the incremental merkle tree used by our
scheme to witness commitments to spendable value. It serves as a fixed-sized
accumulator.

This new construction has a much simpler API surface area, avoids memory
safety issues, remains pruned at all times, avoids serialization edge cases,
has more efficient insertion, and is abstract over the depth and hash
function used at the type level.

Further, it lays the groundwork for efficient "fast-forwarding" of witnesses
into the tree as the treestate is updated.
2016-04-28 16:07:52 -06:00
Taylor Hornby 3098bab6d6 Fix sighash tests 2016-04-28 09:44:12 -06:00
Sean Bowe 5884044ba9 Introduce `vpour` to `CTransaction`.
Transactions of version 2 and above contain a `vpour` field which is a vector of `CPourTx`
objects that embody our protocol. We introduce serialization primitives for boost::array
(we intend for changing the amount of inputs and outputs in the circuit to be simple).

SIGHASH_* operations hash this field like any other for now.
2016-01-19 14:35:59 -07:00
Esteban Ordano 70a427b2b5 CLTV: Add more tests to improve coverage
Four cases included:

* The CLTV operand type mismatches the tx locktime. In the script it is
  1 (interpreted as block height), but in the tx is 500000000
  (interpreted as date)
* The stack is empty when executing OP_CLTV
* The tx is final by having only one input with MAX_INT sequence number
* The operand for CLTV is negative (after OP_0 OP_1 OP_SUB)

Rebased-From: cb54d17355864fa08826d6511a0d7692b21ef2c9
2015-10-08 17:49:00 +02:00
Peter Todd 4fa7a048d1 Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65)
<nLockTime> CHECKLOCKTIMEVERIFY -> <nLockTime>

Fails if tx.nLockTime < nLockTime, allowing the funds in a txout to be
locked until some block height or block time in the future is reached.

Only the logic and unittests are implemented; this commit does not have
any actual soft-fork logic in it.

Thanks to Pieter Wuille for rebase.

Credit goes to Gregory Maxwell for the suggestion of comparing the
argument against the transaction nLockTime rather than the current
time/blockheight directly.

Rebased-From: bc60b2b4b401f0adff5b8b9678903ff8feb5867b
2015-10-08 17:46:55 +02:00
Dave Collins 1c54757f86 Add more script edge condition tests.
This commit adds some tests to the script_valid.json and tx_invalid.json
data which exercise more edge conditions that are not currently being
tested.
2015-05-06 10:20:18 -05:00
Wladimir J. van der Laan df1609f314
Merge pull request #6075
9fadf1c Add additional script edge condition tests. (Dave Collins)
2015-04-29 15:56:30 +02:00