Commit Graph

8482 Commits

Author SHA1 Message Date
Homu 0ba07d5842 Auto merge of #4056 - rex4539:fix-rpc-undefined-behavior, r=ebfull
Fix RPC undefined behavior

Closes https://github.com/zcash/zcash/issues/3792
2019-07-26 15:19:07 -07:00
Eirik Ogilvie-Wigley ff0820df5e Update test_pow for shorter block times 2019-07-26 10:48:16 -06:00
Eirik Ogilvie-Wigley c192e3a75d Update pow_tests for shorter block times 2019-07-26 10:34:23 -06:00
Dimitris Apostolou ff40531607 Fix RPC undefined behavior.
Co-Authored-By: Dimitris Apostolou <dimitris.apostolou@icloud.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-23 21:36:53 +01:00
Eirik Ogilvie-Wigley 7421272712 Make nextHeight required in CalculateNextWorkRequired 2019-07-18 14:57:13 -06:00
Daira Hopwood bc909a7a7f Replace http with https: in links to the MIT license.
Also change MIT/X11 to just MIT, since no distinction was intended.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-18 15:26:01 +01:00
Daira Hopwood f63731261c Update copyright information for Zcash, leveldb, and libsnark.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-18 13:59:30 +01:00
Daira Hopwood 6db54c9861 Add MIT license to Makefiles
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-18 13:59:30 +01:00
Homu d2a5526202 Auto merge of #4053 - rex4539:shielded-funds, r=Eirik0
Fix naming inconsistency

Closes https://github.com/zcash/zcash/issues/3486
2019-07-17 12:36:37 -07:00
Simon d7ebbeb2aa Modify PartitionCheck to be aware of pre & post Blossom target spacing. 2019-07-11 14:17:58 -06:00
Simon 3a8fd5ea33 Replace nPoWTargetSpacing -> PoWTargetSpacing() in tests 2019-07-11 13:46:29 -06:00
Simon 22e8dc2679 Replace nPoWTargetSpacing -> PoWTargetSpacing() in ProcessMessage() 2019-07-11 13:46:29 -06:00
Simon 4b985ce999 Update GetBlockTimeout() to take height parameter. 2019-07-11 13:46:29 -06:00
Simon b30ff0d367 Update PoW function calls to pass in height. 2019-07-11 13:46:29 -06:00
Simon 35d1fdeba6 Replace nPoWTargetSpacing -> PoWTargetSpacing() 2019-07-11 13:46:28 -06:00
Simon ac4a606d4a Remove use of redundant member nPowTargetSpacing. 2019-07-11 13:46:28 -06:00
Simon 8863d77d65 Redefine PoW functions to accept height parameter.
Introduce target spacing constants and redefine struct member
variable nPoWTargetSpacing as a member function.  The height
parameter is used to determine if Blossom has activated yet.
2019-07-11 13:46:28 -06:00
Homu 984b41422a Auto merge of #4054 - rex4539:haveshieldedrequirements, r=Eirik0
Rename joinsplit to shielded

Closes https://github.com/zcash/zcash/issues/3550
2019-07-11 09:45:19 -07:00
Homu 29c1b29f3f Auto merge of #4055 - rex4539:rename-findwallettx, r=Eirik0
Rename FindWalletTx to FindWalletTxToZap

Closes https://github.com/zcash/zcash/issues/3572
2019-07-10 15:45:46 -07:00
Homu 9d07a12750 Auto merge of #4052 - rex4539:rename-vjoinsplit, r=Eirik0
Rename vjoinsplit to vJoinSplit

Closes https://github.com/zcash/zcash/issues/3188
2019-07-10 11:59:23 -07:00
Daira Hopwood ef2dcbf1d4 make-release.py: Versioning changes for 2.0.6. 2019-06-19 00:27:11 +01:00
Dimitris Apostolou 8b1a8e8b93
Rename FindWalletTx to FindWalletTxToZap 2019-06-16 23:06:45 +03:00
Dimitris Apostolou 8bcb96999e
Rename joinsplit to shielded 2019-06-16 22:50:58 +03:00
Dimitris Apostolou ff1840f68a
Fix naming inconsistency 2019-06-16 22:37:23 +03:00
Dimitris Apostolou f57f76d789
Rename vjoinsplit to vJoinSplit 2019-06-16 19:13:49 +03:00
Daira Hopwood f7a4aab352 make-release.py: Versioning changes for 2.0.6-rc1. 2019-06-12 16:32:57 +01:00
Homu bb58c8ec2e Auto merge of #3863 - LarryRuane:3708-getrawtransaction, r=daira
add spentindex to getrawtransaction RPC results for bitcore block explorer

#3708 There are a few new `getrawtransaction` JSON result fields that the Insight block explorer depends on.
2019-06-11 13:15:00 -07:00
Larry Ruane f381d4e085 add spentindex to getrawtransaction RPC results 2019-06-11 10:29:51 -06:00
Daira Hopwood 346d11d3eb Closes #3992. Remove obsolete warning message.
Co-authored-by: Simon <simon@bitcartel.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-06-11 17:27:49 +01:00
Eirik0 cf30355fc3 Clarify what combinations of from addresses can be used in z_mergetoaddress 2019-06-10 13:21:25 -06:00
Eirik0 a8055cfe10 Fix z_mergetoaddress sending from ANY_SPROUT/ANY_SAPLING when the wallet contains both note types 2019-06-10 13:21:25 -06:00
Eirik0 406b8ff509 z_getmigrationstatus help message wording change 2019-06-06 13:49:11 -06:00
Homu 70d8489663 Auto merge of #4017 - bitcartel:fix_sapling_rpc_help_typo, r=Eirik0
Fix typo and clean up help message for RPC z_getmigrationstatus.
2019-06-05 18:27:22 -07:00
Homu 20aef43d7f Auto merge of #4036 - Eirik0:sprout-note-entry, r=Eirik0
Replace CSproutNotePlaintextEntry with SproutNoteEntry to match Sapling

This refactoring makes the output of GetFilteredNotes safer to use, by setting the Sprout note at the point of decryption, where the corresponding address is already known, rather than having to recall it using the correct payment address.
2019-06-05 14:13:08 -07:00
Eirik0 4120aff037 Use reserve key for transparent change when sending to Sapling 2019-05-30 09:56:45 -06:00
Eirik0 27f91abf00 Allow passing optional reserve key as a parameter to SendTransaction 2019-05-28 20:10:42 -06:00
Eirik0 d3d8fb7221 Inline sign_send_raw_transaction 2019-05-28 17:58:49 -06:00
Eirik0 de410efd54 Do not shadow the return value when testmode is true 2019-05-28 17:29:40 -06:00
Jack Grigg e12d018464
Globals: Explicitly pass const CChainParams& to ReceivedBlockTransactions() 2019-05-23 20:03:35 +01:00
Jack Grigg 3ffc29b881
Globals: Explicitly pass const CChainParams& to IsInitialBlockDownload() 2019-05-23 20:03:34 +01:00
Jack Grigg 9e0f75dcbd
Consistently use chainparams and consensusParams 2019-05-23 17:48:31 +01:00
Jack Grigg a3b64d8677
Globals: Explicitly pass const CChainParams& to DisconnectBlock() 2019-05-23 17:48:30 +01:00
Jack Grigg c6012fe923
Globals: Explicit const CChainParams& arg for main:
- ContextualCheckBlockHeader
- ContextualCheckBlock
2019-05-23 17:48:29 +01:00
Jack Grigg be94721953
Globals: Explicitly pass const CChainParams& to ContextualCheckTransaction() 2019-05-23 17:48:28 +01:00
Jack Grigg 7ef947c32b
Globals: Explicit const CChainParams& arg for main:
- CheckBlockHeader
- CheckBlock
2019-05-23 17:48:27 +01:00
Jack Grigg 13cfabb36c
Globals: Explicitly pass const CChainParams& to IsStandardTx() 2019-05-23 17:48:26 +01:00
Jack Grigg 9f7f70e0c3
Globals: Remove Zcash-specific Params() calls from main.cpp 2019-05-23 17:48:25 +01:00
Wladimir J. van der Laan 3647f0a7b1
Break circular dependency main ↔ txdb
Break the circular dependency between main and txdb by:

- Moving `CBlockFileInfo` from `main.h` to `chain.h`. I think this makes
  sense, as the other block-file stuff is there too.

- Moving `CDiskTxPos` from `main.h` to `txdb.h`. This type seems
  specific to txdb.

- Pass a functor `insertBlockIndex` to `LoadBlockIndexGuts`. This leaves
  it up to the caller how to insert block indices.

Zcash: This does not actually break the circular dependency for us yet, as we
still need to pull in bitcoin/bitcoin#7756 and bitcoin/bitcoin#7904.
2019-05-23 17:48:24 +01:00
face e9128c4a1d
Explicitly pass CChainParams to ConnectBlock 2019-05-23 17:48:23 +01:00
face f2baeb7cb6
Pass CChainParams to DisconnectTip() 2019-05-23 17:48:22 +01:00
Jorge Timón a68c8114e1
Globals: Explicitly pass const CChainParams& to UpdateTip() 2019-05-23 17:48:21 +01:00
MarcoFalke 98f3010026
[doc] Fix doxygen comments for members 2019-05-23 17:48:20 +01:00
Peter Todd 9b0f61af2d
Improve block validity/ConnectBlock() comments
Previously didn't make clear that the ContextualCheckBlock* functions
meant the block headers as context - not the UTXO set itself - and that
ConnectBlock() also did UTXO-related validity checks (in the future we
may split that functionality into a separate UTXO-specific contextual
check block function).

Also, reordered to put validity checks first for better readability.
2019-05-23 17:48:19 +01:00
Jorge Timón 44b2d060ef
Globals: Remove a bunch of Params() calls from main.cpp:
1) Chainparams: Explicit CChainParams arg for main:

-AcceptBlock
-AcceptBlockHeader
-ActivateBestChain
-ConnectTip
-InitBlockIndex
-LoadExternalBlockFile
-VerifyDB parametric constructor

2) Also pickup more Params()\. in main.cpp

3) Pass nPruneAfterHeight explicitly to new FindFilesToPrune() in main.cpp
2019-05-23 17:48:18 +01:00
Jorge Timón 793a72e31f
Chainparams: Explicit CChainParams arg for miner:
-BitcoinMiner
-CreateNewBlock
-GenerateBitcoins
-ProcessBlockFound
2019-05-23 17:48:17 +01:00
Jorge Timón 8e5d8ca52a
Chainparams: Explicit CChainParams arg for main (pre miner):
-ProcessNewBlock
-TestBlockValidity
2019-05-23 17:48:16 +01:00
Jorge Timón 94debefbcf
Globals: Make AcceptBlockHeader static (Fix #6163)
..and at the same time prevent AcceptBlockHeader() from calling global function Params()
2019-05-23 17:48:15 +01:00
Jorge Timón 71cf6ba98b
Globals: Explicit Consensus::Params arg for main:
-CheckBlockIndex
-DisconnectTip
-GetTransaction
-InvalidateBlock
-ProcessGetData
-ReadBlockFromDisk
2019-05-23 17:48:14 +01:00
Jack Grigg cea06a4fd3
Move Equihash parameters into consensus params 2019-05-23 17:48:13 +01:00
Daniel Kraft 9a529fd217
Add some const declarations where they are appropriate.
Declare some arguments of functions as "const" pointers where they are
not meant to be modified.
2019-05-23 17:48:04 +01:00
Eirik0 a630f50349 Replace CSproutNotePlaintextEntry with SproutNoteEntry to match Sapling 2019-05-23 09:24:46 -06:00
Homu de68430af6 Auto merge of #4008 - Eirik0:3971-fix-comment, r=Eirik0
Fix tree depth in comment

Closes #3971
2019-05-16 14:00:33 -07:00
Simon 831611edd3 Fix typo and clean up help message for RPC z_getmigrationstatus. 2019-05-15 11:06:37 -07:00
Eirik0 c34d253fa6 make-release.py: Versioning changes for 2.0.5-2. 2019-05-15 09:49:44 -06:00
Eirik0 23d9826ef9 Fix LogPrint statements 2019-05-10 17:25:30 -06:00
Eirik0 58348c79b3 Add logging for Sprout to Sapling migration transaction generation 2019-05-10 17:22:08 -06:00
Eirik0 7470ae8885 Do not automatically remove async migration operations and return txids 2019-05-10 17:19:56 -06:00
Eirik0 a84125aacd Fix tree depth in comment 2019-05-10 12:58:11 -06:00
Eirik0 0e06801e12 Move reused sign and send logic 2019-05-10 12:45:14 -06:00
Eirik0 a7a52d2424 Move reused async rpc send logic to separate file 2019-05-10 12:20:52 -06:00
Eirik0 3220d99360 Use CommitTransaction() rather than sendrawtransaction() 2019-05-10 11:44:40 -06:00
Daira Hopwood 9615caa8f9 Fix cosmetic spacing issue in z_setmigration help.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-05-10 16:08:03 +01:00
Daira Hopwood 14c0be6f27 Change expiry delta for migration transactions to 450 blocks.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-05-10 13:48:43 +01:00
Daira Hopwood 9cd34fc10a Repair calls to TransactionBuilder from tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-05-10 13:48:43 +01:00
Daira Hopwood 5eb7129d95 Generalize TransactionBuilder and CreateNewContextualCMutableTransaction to allow choosing the expiry delta.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-05-10 13:48:43 +01:00
Homu e97621acf7 Auto merge of #3995 - bitcartel:no_migration_during_block_download_phase, r=Eirik0
Don't allow Sprout-to-Sapling migration when syncing during IBD or after wake from sleep.

Prevent migration transactions from being created in response to incoming blocks when a node launches and syncs (the initial block download phase) and when a node wakes from sleep/hibernation and starts syncing old blocks rapidly.
2019-05-09 13:51:49 -07:00
Simon 6921c81b9d Don't allow migration when node is syncing at launch or after waking up. 2019-05-09 09:32:09 -07:00
Simon bda85eb06a Remove unused specifier from format string.
The extra specifier meant that a runtime error would be thrown
during Sprout to Sapling migration if `zrpcunsafe` logging
was enabled:
"tinyformat: Too many conversion specifiers in format string"
2019-05-08 20:51:13 -07:00
Eirik0 f809ff997f make-release.py: Versioning changes for 2.0.5-1. 2019-05-08 06:50:57 -06:00
Eirik0 ea8823ce51 coinsView is required when using TransactionBuilder if there may be Sprout change 2019-05-07 18:41:35 -06:00
Eirik0 5fd7af5f85 Add the amount migrated to the operation's result 2019-05-07 08:58:23 -06:00
Eirik0 f0f7b3f012 Fix summing available funds 2019-05-07 08:55:26 -06:00
Eirik0 94e419f95d Rename variable and add comment 2019-05-06 11:46:16 -06:00
Eirik0 d48c3efca7 Store the migration operation id rather than the operation iteslf 2019-05-06 09:57:40 -06:00
Eirik0 7cf4749d0d Correctly account for migration transactions in the mempool
Co-authored-by: LarryRuane <larry@z.cash>
2019-05-05 12:59:43 -06:00
Eirik0 c1daa11d7b make-release.py: Versioning changes for 2.0.5. 2019-05-03 16:30:13 -06:00
Simon 68c17ffec8 Update chain work and checkpoint using block 525000. 2019-05-02 14:53:35 -07:00
Eirik0 6c47e6fe7b make-release.py: Versioning changes for 2.0.5-rc1. 2019-05-01 14:15:14 -06:00
Homu d894f7b3b2 Auto merge of #3977 - LarryRuane:3873-setmigration-cli, r=bitcartel
3873 z_setmigration cli bool enable arg conversion

Addresses #3873.
2019-05-01 09:26:20 -07:00
Larry Ruane 4cbe0a9d02 3873 z_setmigration cli bool enable arg conversion 2019-05-01 10:03:24 -06:00
Eirik0 3cad5f454f Do not throw an exception if HD Seed is not found when exporting wallet 2019-04-30 15:47:03 -06:00
Eirik0 e14cf96642 Calculate the number of confimations in the canonical way 2019-04-30 11:06:08 -06:00
Eirik0 345177cfc1 Do not look at vin/vout when determining migration txs and other cleanup 2019-04-30 09:52:53 -06:00
Eirik0 e9530f40f2 use -valueBalance rather than vpub_new to calculate migrated amount 2019-04-29 17:00:26 -06:00
Eirik0 108e587c14 Fix typos and update documentation 2019-04-29 15:29:29 -06:00
Eirik0 5969bd8f55 Fix help message 2019-04-29 15:29:27 -06:00
Eirik0 6e82d72852 Add rpc to get Sprout to Sapling migration status 2019-04-29 15:28:35 -06:00
Eirik0 52cfa9c1ee Create method for getting HD seed in RPCs 2019-04-29 15:28:35 -06:00
Homu f283f2460e Auto merge of #3967 - Eirik0:3961-migration-address, r=Eirik0
3961 migration address

Closes #3961
2019-04-29 11:41:47 -07:00
Homu 63fff636d7 Auto merge of #3968 - bitcartel:3768_enable_mainnet_turnstile, r=bitcartel
Activate turnstile on mainnet

This PR enables [ZIP209](https://github.com/zcash/zips/blob/master/zip-0209.rst) support on mainnet, to mark blocks as invalid if they would lead to a turnstile violation in the Sprout or Sapling value pools.

To test this PR, I performed the following manual tests:

1. Used RPC call `getblock` to verify the fallback Sprout value.
2. Individually changed the fallback Sprout block hash, block height and chain value, recompiling and relaunching the node, verifying that each individual change resulted in an error.  When the block hash and block height are incorrect, an error is logged to debug.log `FallbackSproutValuePoolBalance(): fallback block hash is incorrect`.  An incorrect chain value results in node termination with error: `void FallbackSproutValuePoolBalance(CBlockIndex*, const CChainParams&): Assertion '*pindex->nChainSproutValue == chainparams.SproutValuePoolCheckpointBalance()' failed.`
3. Ran the `Smoke Testing` described in PR #3885, on mainnet.
4. Launched zcashd with experimental feature `-developersetpoolsizezero` to manually trigger a turnstile violation in both Sprout and Sapling shielded pools.  The Sprout turnstile violation occurred after launch, due to chance, when the next incoming block 520786 contained a Sprout unshielding transaction. The Sapling turnstile violation was triggered after creating a Sapling unshielding transaction.
2019-04-29 09:08:46 -07:00
str4d b9c7f274a4
remove extra hyphen
Co-Authored-By: Eirik0 <eirik@z.cash>
2019-04-29 09:55:07 -06:00
Eirik0 8ffd63af2d Add migration options to conf file
Co-authored-by: Simon <simon@bitcartel.com>
2019-04-29 09:36:26 -06:00
Homu 20821614a8 Auto merge of #3888 - Eirik0:3873-sapling-migration, r=Eirik0
Sapling migration RPC

Closes #3873
2019-04-27 12:29:29 -07:00
Larry Ruane 7fb8088288 add -timestampindex for bitcore insight block explorer 2019-04-26 08:44:56 -06:00
Homu 1b24243392 Auto merge of #3849 - LarryRuane:3708-spentindex, r=daira
add SpentIndex changes needed for bitcore block explorer

Addresses #3708, follow-on to #3837, note there are no tests yet (will come later with RPC interfaces).
2019-04-25 16:32:22 -07:00
Homu 1fefed9eb5 Auto merge of #3940 - str4d:3607-init-encrypted-wallet-without-hd-seed, r=bitcartel
init: Fix new HD seed generation for previously-encrypted wallets

Closes #3607.

How to verify (with `zcashd` flags `-testnet -wallet=wallet.3607.dat -experimentalfeatures -developerencryptwallet`):
- Start `zcashd` 2.0.0, encrypt the wallet, and stop the node.
- Start `zcashd` 2.0.1+ (before this branch), and see that it crashes during startup.
- Start `zcashd` built from this branch, and see that it does not crash during startup. Unlock the wallet, then stop.
- Start `zcashd` 2.0.1+ (before this branch), and see that it no longer crashes during startup.
2019-04-25 13:15:51 -07:00
Eirik0 5519d16997 Set min depth when selecting notes to migrate 2019-04-25 13:43:23 -06:00
Eirik0 7c4ad6e298 Additional locking and race condition prevention 2019-04-24 11:31:14 -06:00
Eirik0 699288b4b4 Documentation cleanup 2019-04-24 11:31:14 -06:00
Eirik0 162bfc3a1e Move migration logic to ChainTip 2019-04-24 11:31:14 -06:00
Eirik0 81a45d6984 Add rpc to enable and disable Sprout to Sapling migration 2019-04-24 11:31:14 -06:00
Simon 867786d777 Enable experimental feature -developersetpoolsizezero on mainnet. 2019-04-24 08:40:17 -07:00
Simon fc79a848fb Enable ZIP209 on mainnet and set fallback Sprout pool balance. 2019-04-23 22:57:30 -07:00
Homu e1c922de5b Auto merge of #3964 - bitcartel:test_turnstile_violation, r=bitcartel
Test turnstile violation

Adds experimental feature -developersetpoolsizezero to enable developers to test Sprout and Sapling turnstile violations on testnet and in regtest mode.
2019-04-23 15:07:43 -07:00
Larry Ruane 3d018ab556 add -spentindex changes for bitcore insight block explorer 2019-04-23 11:06:23 -06:00
Homu ab856294d9 Auto merge of #3505 - str4d:rust-targets, r=str4d
depends: Support additional cross-compilation targets in Rust

This will make it easier for third parties to cross-compile `zcashd` for other platforms. The third commit in this PR shows how to add a new target to the Rust dependency builder.

The default Rust target during cross-compilation is the canonical host, which is derived from `HOST` using `depends/config.sub`. If the canonical host differs from the required Rust target, add the necessary mapping in addition to the target itself.

Also includes fixes for cross-compiling aarch64 targets.
2019-04-23 08:33:40 -07:00
Simon 4c1a8884f4 Add testnet and regtest experimental feature: -developersetpoolsizezero 2019-04-22 14:24:40 -07:00
Gareth Davies 82848efb0e Adding addressindex.h to Makefile.am
Co-authored by: Daira Hopwood <daira@jacaranda.org>
2019-04-21 07:44:18 -07:00
Homu 8752c7aef5 Auto merge of #3935 - str4d:blossom-activation-logic, r=str4d
Add Blossom to upgrade list
2019-04-09 10:39:07 -07:00
Homu 33548140d9 Auto merge of #3907 - LarryRuane:3860-enable-debug-build, r=daira
fix enable-debug build DB_COINS undefined

Fixes #3860. The way `DB_COINS` is defined in this PR is the same as in `src/txdb.cpp` (static "global" instead of class member).
2019-04-09 03:45:07 -07:00
Homu e73326eed0 Auto merge of #3837 - LarryRuane:3708-addressindex, r=bitcartel
add AddressIndex changes needed for bitcore block explorer

Addresses #3708, note there are no tests yet (will come later with RPC interfaces).
2019-04-04 17:36:56 -07:00
Jack Grigg 1f561f323f
init: Fix new HD seed generation for previously-encrypted wallets
Closes #3607.
2019-04-04 18:27:46 +01:00
Homu 926fd0ce28 Auto merge of #3848 - str4d:transaction-builder-sprout, r=Eirik0
Add Sprout support to TransactionBuilder

The logic in `TransactionBuilder::CreateJSDescriptions()` is a combination of the logic used by `z_sendmany`, `z_mergetoaddress` and `z_shieldcoinbase`, in order to support arbitrary numbers of Sprout inputs or outputs.
2019-04-04 10:19:46 -07:00
Jack Grigg 885fce070a
Add Blossom to upgrade list 2019-04-02 07:39:36 +01:00
Braydon Fuller ec81c70964 tests: adds unit test for IsPayToPublicKeyHash method 2019-03-28 12:04:02 -06:00
Larry Ruane 6cf0e50b56 add -addressindex changes for bitcore insight block explorer 2019-03-28 12:03:48 -06:00
Simon 108dc2df95 make-release.py: Versioning changes for 2.0.4. 2019-03-26 11:25:19 -07:00
Larry Ruane e1df250a0d fix enable-debug build DB_COINS undefined 2019-03-20 16:29:06 -06:00
Simon b95cb71653 make-release.py: Versioning changes for 2.0.4-rc1. 2019-03-20 09:29:06 -07:00
Homu 3c5062aa90 Auto merge of #3898 - sandakersmann:patch-1, r=bitcartel
Update COPYRIGHT_YEAR in clientversion.h to 2019

Update COPYRIGHT_YEAR in clientversion.h to 2019
2019-03-20 07:36:25 -07:00
Homu 6158f0a4fa Auto merge of #3897 - ebfull:wallet-sprout-check-commitment, r=ebfull
Check consistency of note commitment and ciphertext in wallet

Fixes #3896.
2019-03-19 21:21:54 -07:00
Sean Bowe c1009374b1 (wallet) Check that the commitment matches the note plaintext provided by the sender. 2019-03-19 13:12:26 -06:00
Homu 008705d7c1 Auto merge of #3885 - ebfull:turnstile, r=bitcartel
Reject blocks that violate turnstile

This is an implementation of a consensus rule which marks blocks as invalid if they would lead to a turnstile violation in the Sprout or Shielded value pools. The motivations and deployment details can be found in the [accompanying ZIP draft](https://github.com/zcash/zips/pull/210).

**This PR only introduces the rule for testnet at the moment.**

We achieve the institution of this rule in three ways:

1. Nodes prior to #2795 did not record the "delta" in the Sprout value pool balance as part of the on-disk block index. This was a long time ago, though, and all nodes that are consensus-compatible with the network today have been recording this value for newer blocks. However, the value is absent from older block indexes unless the node has reindexed or synchronized from scratch in the time since. We shouldn't need to require nodes to reindex in order to enforce this consensus rule. We avoid this problem by falling back on a hardcoded Sprout shielded value pool balance in a very recent block.
2. If during `ConnectBlock` we observe that the resulting shielded value pool balance of Sprout or Sapling is negative, we reject the block.
3. During the miner's block assembly process the miner will skip over transactions if adding them to the assembled block might violate the turnstile, since the resulting block would be invalid. This means that theoretical transactions violating the turnstile would still be relayed in the network (and made available in users' memory pools) and so a turnstile violation would have some visibility outside of block relay.

## Smoke Testing

It's really tricky to test the behavior that automatically falls back to hardcoded shielded value pool balances in our architecture because it's very testnet-specific and node-version-specific. However, we can do some smoke tests to see that everything is working.

I modified the serialization of `CDiskBlockIndex` to serialize `boost::none` for `nSproutValue`

```
if ((s.GetType() & SER_DISK) && (nVersion >= SPROUT_VALUE_VERSION)) {
    boost::optional<CAmount> nSproutValueFake = boost::none;
    READWRITE(nSproutValueFake);
}
```

and then began a reindex of my node which I interruped around height 130k on testnet. I then restored the original serialization and resumed the reindex; I have thus _roughly_ simulated a older node "upgrading" to a newer node that records the deltas when processing new blocks. My node showed pool monitoring was disabled, as expected, for Sprout. I confirmed that some blocks following the reindex had nonzero Sprout `valueDelta` from `getblock`, as expected. I finished the reindex, restarted the node, and confirmed that the serialization worked for newer blocks but not older blocks by querying `getblock`, simply as a reassurance.

Finally, I introduced the code in this PR and reloaded the node. The desired behavior (that the chain began to be "monitored" again) worked, and the values were consistent with the hardcoded constant. I then made a payment to a Sprout z-addr from the transparent pool and the pool value increased as expected, as reported by `getblockchaininfo`. I reindexed the node again to exercise the remaining logic and check for turnstile violations throughout the history of testnet; there were none.
2019-03-19 12:10:17 -07:00
Eirik0 ee9ff2ce74 Rename and update comment 2019-03-19 12:55:55 -06:00
Sean Bowe 8d0e2befe7 (minor) Remove added newline. 2019-03-19 12:45:21 -06:00
Sean Bowe 4e3dca978b Do not enable ZIP209 on regtest right now. 2019-03-19 12:44:53 -06:00
Marius Kjærstad 3f8e662a89
Update COPYRIGHT_YEAR in clientversion.h to 2019
Update COPYRIGHT_YEAR in clientversion.h to 2019
2019-03-19 17:42:52 +01:00
Sean Bowe 30a5d6f520 Only enforce Sapling turnstile if balance values have been populated. 2019-03-18 14:09:32 -06:00
Sean Bowe b5c7e63bcd Change SproutValuePoolCheckpointEnabled to ZIP209Activated 2019-03-18 11:32:26 -06:00
Sean Bowe 6482b661ab Check blockhash of fallback block for Sprout value pool balance 2019-03-14 15:39:11 -06:00
Sean Bowe ebe2edce9a Add newlines to turntile log messages for miner 2019-03-14 15:25:31 -06:00
Sean Bowe 831725a671 Use existing chainparams variable 2019-03-14 15:25:10 -06:00
Sean Bowe 2b1252af80 Consolidate logic to enable turnstile auditing for testnet/regtest/mainnet. 2019-03-14 14:29:04 -06:00
Sean Bowe cb6df4b0cc Fix tallying for Sprout/Sapling value pools. 2019-03-14 14:08:12 -06:00
Simon ea5f00aa5d Add checkpoint for block 497000. 2019-03-13 17:31:49 -07:00
Simon 16385486b8 Update nMinimumChainWork using block 497000. 2019-03-13 17:24:43 -07:00
Sean Bowe bf4de896e7 (testnet/regtest) Avoid mining transactions that would violate the turnstile. 2019-03-13 01:38:34 -06:00
Jack Grigg 98cfe4228c
configure: Guess -march for libsnark OPTFLAGS instead of hard-coding
When cross-compiling, this will remove the -march flag entirely unless
the user specifies CONFIGURE_FLAGS="--with-gcc-arch=<arch>".
2019-03-13 07:37:56 +00:00
Sean Bowe 8a990a7d64 (testnet) Reject blocks that result in turnstile violations 2019-03-13 00:54:29 -06:00
Sean Bowe 24db3297df (testnet) Fall back to hardcoded shielded pool balance to avoid reorgs. 2019-03-13 00:43:54 -06:00