Commit Graph

311 Commits

Author SHA1 Message Date
Jack Grigg
bd3c860cb4 Use ovk directly in the TransactionBuilder API instead of fvk 2018-09-18 23:26:31 +01:00
Homu
396bdaf00f Auto merge of #3307 - gtank:3187-refactor-checkblock, r=bitcartel
Refactor ContextualCheckBlock tests

This cleans up and condenses our quadratically-scaling transaction format / consensus rule tests. They still technically scale quadratically, but should be much more readable and manageable now - all that remains in the individual test cases is the specific version flag tweaking we're trying to test.

Closes #3187.
2018-09-11 14:53:59 -07:00
Simon
17b6a9d376 Update comment for test ContextualCheckBlockTest.BlockSproutRulesRejectOtherTx 2018-09-11 14:49:47 -07:00
Jack Grigg
b33a7ec46e wallet: Don't allow an HDSeed to be overwritten
We can maybe relax this restriction later once we have worked out the UX
implications.
2018-09-03 10:45:37 +01:00
Jack Grigg
70b4ad2dcd wallet: Switch from SaplingSpendingKey to SaplingExtendedSpendingKey
The wallet now only stores Sapling extended spending keys, and thus can
only be used with keys generated from an HDSeed via ZIP 32.

Note that not all Sapling keys in the wallet will correspond to the
wallet's HDSeed, as a standalone Sapling xsk can be imported via
z_importkey. However, it must have been generated from a seed itself,
and thus is more likely to be backed up elsewhere.
2018-09-03 10:45:37 +01:00
Jack Grigg
ec653523ad Store HDSeed in CCryptoKeyStore 2018-09-03 10:45:33 +01:00
Jack Grigg
70c8c25e4b Store HDSeed in CBasicKeyStore 2018-09-03 10:27:52 +01:00
Jack Grigg
7614198f9d ZIP 32 Sapling structs 2018-09-03 10:27:52 +01:00
Homu
12c1156f31 Auto merge of #3172 - str4d:mingw32, r=str4d
Windows cross-compile support

Usage on Debian / Ubuntu:

> $ sudo apt install mingw-w64
> $ sudo update-alternatives --config x86_64-w64-mingw32-gcc
> (configure to use POSIX variant)
> $ sudo update-alternatives --config x86_64-w64-mingw32-g++
> (configure to use POSIX variant)
> $ HOST=x86_64-w64-mingw32 ./zcutil/build.sh

Closes #489.
2018-08-30 14:51:24 -07:00
Jack Grigg
2962a72e35 Rename GetFirstBlockTransaction() to GetFirstBlockCoinbaseTx() 2018-08-30 14:58:19 +01:00
Jack Grigg
d7bcbfaee4 Fix test after refactor to check bacd-cb-height rule on a genesis block 2018-08-30 14:50:57 +01:00
Jack Grigg
fb22b3bbd8 Revert NU activation heights in reverse order
Ensures that global state remains consistent.
2018-08-30 14:44:50 +01:00
Jack Grigg
d70d103ee0 Ensure SCOPED_TRACE falls out of scope when necessary 2018-08-30 14:41:56 +01:00
George Tankersley
e601446adc Refactor ContextualCheckBlock tests
Combines some of the needlessly separate tests. Each formerly separate
test is tagged with a SCOPED_TRACE to make sure logs are still useful.
2018-08-30 14:39:07 +01:00
George Tankersley
ec7466b62f Refactor ContextualCheckBlock tests (#3187)
Initial cleanup. Reduces duplication of code, especially around
constructing transactions, resetting the activation heights, and setting
up the EXPECT calls for accepting and rejecting tests.

Also adds a bunch of comments explaining the test plan and what
particular parts of the test are doing.
2018-08-30 14:37:19 +01:00
Homu
20f87bc226 Auto merge of #3422 - bitcartel:3061_track_notes_based_on_3062, r=str4d
Track Sapling notes and nullifiers in the wallet (in-memory only, no persistence to disk)

Part of #3061.  Add in-memory tracking of Sapling notes and nullifiers to the wallet.
2018-08-17 14:42:52 -07:00
David Mercer
32d3a3352e libsnark: convert long long and unsigned long to C++11 fixed-width types
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2018-08-17 18:53:59 +01:00
Jack Grigg
c5b26acad8 Use boost::filesystem::path::string() instead of path::native()
This fixes a mingw32 conversion error during cross-compilation.
2018-08-17 16:46:18 +01:00
Jack Grigg
554e00e8f9 Disable Sapling features on mainnet
Also places them behind an experimental features flag on testnet
2018-08-13 14:18:18 +01:00
Jack Grigg
e7ca4eb3c3 test: gtest for Sapling encoding and decoding 2018-08-13 13:20:07 +01:00
Simon
d4d0ec7e95 Update test to pass in required cm to SaplingNotePlaintext::decrypt(). 2018-08-08 12:03:09 -07:00
Sean Bowe
69c4391b0f Check commitment validity within the decryption API for Sapling note plaintexts. 2018-08-08 12:03:09 -07:00
Sean Bowe
198dfd3c36 Switch to use the official Sapling parameters. 2018-08-04 16:28:39 -06:00
Homu
aa32786576 Auto merge of #3396 - arcalinea:3389_sapling_crypter, r=str4d
Update CCryptoKeyStore with Sapling support

Sapling crypter overrides for various `CCryptoKeyStore` functions such as:
- `HaveSaplingSpendingKey()`
- `GetSaplingSpendingKey()`

Also includes some changes to prepare for diversified addresses and ZIP 32.

Closes #3389
2018-08-03 09:48:22 -07:00
Jack Grigg
25d5e80cbe Rename *SpendingKey -> *SproutSpendingKey
Also GetPaymentAddresses -> GetSproutPaymentAddresses
2018-08-03 10:10:26 +01:00
Jack Grigg
4c77517772 Rename *ViewingKey* -> *SproutViewingKey* 2018-08-03 02:23:38 +01:00
Jack Grigg
5175a7f07b Pass SaplingPaymentAddress to store through the CKeyStore 2018-08-03 01:01:45 +01:00
Sean Bowe
d9ef8f622e Check the hash of the (Sapling+) zk-SNARK parameters during initialization. 2018-08-02 12:18:13 -06:00
Homu
871e1726c6 Auto merge of #3340 - Eirik0:rename-merkle-typedefs, r=str4d
Rename merkle tree typedefs to include Sprout

This is to be consistent with the naming convention we have been using to distinguish Sprout/Sapling.
2018-08-01 20:48:17 -07:00
Sean Bowe
80bd573dc2 Make changes to gtest ECC behavior suggested by @str4d. 2018-08-01 16:53:27 -06:00
Sean Bowe
262d21bcbb Don't call ECC_Start/ECC_Stop outside the test harness. 2018-08-01 16:45:12 -06:00
Eirik Ogilvie-Wigley
7d379f18c5 Rename test objects to include sprout or sapling 2018-08-01 10:52:58 -06:00
Eirik Ogilvie-Wigley
8ea8ef9850 Rename Witnesses to include sprout or sapling 2018-08-01 10:41:36 -06:00
Eirik Ogilvie-Wigley
4fc309f0f5 Rename Merkle Trees to include sprout or sapling 2018-08-01 10:31:09 -06:00
Homu
d84f14ec4a Auto merge of #3417 - str4d:sapling-tx-builder, r=ebfull
TransactionBuilder for Sapling and transparent transactions

This PR includes zcash/librustzcash#24, and will create a testnet chain split once merged into master (and once a Sapling transaction is mined).
2018-07-31 23:44:29 -07:00
Sean Bowe
a310f6c5fa Relocate ECC_Start() to avoid test failures. 2018-08-01 00:42:02 -06:00
Sean Bowe
3d75e8b3e7 Move extern params to beginning of test_checktransaction. 2018-07-31 08:33:33 -06:00
Sean Bowe
291895fac7 Ensure sum of valueBalance and all vpub_new's does not exceed MAX_MONEY inside of CheckTransactionWithoutProofVerification. 2018-07-30 22:35:31 -06:00
Jack Grigg
54a868cf0a Rename xsk to expsk
xsk will be used for ZIP 32 extended spending keys, so renaming here to
reduce confusion.
2018-07-30 14:26:29 +01:00
Jack Grigg
a8dd4b0cf1 TransactionBuilder: Make fee configurable 2018-07-30 12:52:48 +01:00
Jack Grigg
45c0d1ec84 TransactionBuilder: Add change output to transaction 2018-07-30 12:46:18 +01:00
Jack Grigg
3466b4677e TransactionBuilder: Add support for transparent inputs and outputs 2018-07-30 11:03:29 +01:00
Jack Grigg
3fd0a269e1 test: Move ECC_Start() call into src/gtest/main.cpp 2018-07-27 17:18:49 +02:00
Jack Grigg
25bb05de23 Formatting 2018-07-27 12:17:14 +02:00
Jack Grigg
e5dc5228ea TransactionBuilder: Check that all anchors in a transaction are identical
This reduces the amount of information that is leaked by the choice of anchor.
In future we will make a protocol change to enforce that all inputs use the
same anchor.
2018-07-27 09:46:38 +02:00
Larry Ruane
772f87aaeb don't ban peers when loading pre-overwinter blocks 2018-07-26 12:29:04 -06:00
Jack Grigg
e691e21f40 TransactionBuilder with support for creating Sapling-only transactions 2018-07-25 11:35:10 +02:00
Jack Grigg
66a519f55d Alter SaplingNote::nullifier() to take a SaplingFullViewingKey
This means the API will work if you only have a SaplingExtendedSpendingKey,
as will be the case with ZIP 32.
2018-07-24 14:54:01 +02:00
Homu
a7a62b724b Auto merge of #3391 - bitcartel:3061_sapling_note_encryption, r=ebfull
Sapling note plaintext (encryption and decryption)

Add encryption and decryption of SaplingNotePlaintext and SaplingOutgoingPlaintext classes.

This is part of #3061 to add Sapling note functionality.
2018-07-24 03:27:28 -07:00
Simon
e739ca2ef2 Rename AttemptSaplingEncDecryptionUsingFullViewingKey and use function overloading. 2018-07-23 10:48:26 -07:00