From 3e3d9ba7c77eb9a7a1e982c3a81c5c16829e1f77 Mon Sep 17 00:00:00 2001 From: MarkLTZ Date: Sun, 25 Aug 2024 09:57:15 +0000 Subject: [PATCH 1/4] Fix 'LoadBlockIndex(): failed to read index entry' --- src/main.cpp | 2 -- src/txdb.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3b6077e4f..42097bdb9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2626,7 +2626,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin view.PushAnchor(sapling_tree); if (!fJustCheck) { pindex->hashFinalSproutRoot = sprout_tree.root(); - pindex->hashFinalSaplingRoot = sapling_tree.root(); } blockundo.old_sprout_tree_root = old_sprout_tree_root; @@ -3456,7 +3455,6 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) { pindexNew->pprev = (*miPrev).second; pindexNew->nHeight = pindexNew->pprev->nHeight + 1; - pindexNew->hashFinalSaplingRoot = pindexNew->hashFinalSaplingRoot; pindexNew->BuildSkip(); } pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + GetBlockProof(*pindexNew); diff --git a/src/txdb.cpp b/src/txdb.cpp index 5e68f0509..1316cd3bc 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -282,7 +282,7 @@ bool CBlockTreeDB::WriteBatchSync(const std::vector Date: Sun, 25 Aug 2024 13:54:14 +0000 Subject: [PATCH 2/4] Fix '-reindex' issues --- src/init.cpp | 21 ++++++++++----------- src/main.cpp | 2 +- src/wallet/wallet.cpp | 5 +---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index f176a20d5..738887b8f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -367,13 +367,8 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-prune=", strprintf(_("Reduce storage requirements by pruning (deleting) old blocks. This mode disables wallet support and is incompatible with -txindex. " "Warning: Reverting this setting requires re-downloading the entire blockchain. " "(default: 0 = disable pruning blocks, >%u = target size in MiB to use for block files)"), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)); -#ifdef ENABLE_WALLET - strUsage += HelpMessageOpt("-reindex-chainstate", _("Rebuild chain state from the currently indexed blocks (implies -rescan)")); - strUsage += HelpMessageOpt("-reindex", _("Rebuild chain state and block index from the blk*.dat files on disk (implies -rescan)")); -#else strUsage += HelpMessageOpt("-reindex-chainstate", _("Rebuild chain state from the currently indexed blocks")); strUsage += HelpMessageOpt("-reindex", _("Rebuild chain state and block index from the blk*.dat files on disk")); -#endif #ifndef WIN32 strUsage += HelpMessageOpt("-sysperms", _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)")); #endif @@ -621,7 +616,7 @@ void ThreadStartWalletNotifier() if (pwalletMain) { std::optional walletBestBlockHash; - if (!fReindex) { + { LOCK(pwalletMain->cs_wallet); walletBestBlockHash = pwalletMain->GetPersistedBestBlock(); } @@ -928,6 +923,7 @@ void InitParameterInteraction() LogPrintf("%s: parameter interaction: -externalip set -> setting -discover=0\n", __func__); } +#ifdef ENABLE_WALLET if (GetBoolArg("-salvagewallet", false)) { // Rewrite just private keys: rescan to find transactions if (SoftSetBoolArg("-rescan", true)) @@ -939,6 +935,7 @@ void InitParameterInteraction() if (SoftSetBoolArg("-rescan", true)) LogPrintf("%s: parameter interaction: -zapwallettxes= -> setting -rescan=1\n", __func__); } +#endif } void InitLogging() @@ -1523,9 +1520,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) // Check for changed -txindex state if (fTxIndex != GetBoolArg("-txindex", DEFAULT_TXINDEX)) { - // TODO: Recommend `-reindex-chainstate` instead of - // `-reindex` after #5964 and/or #5977 are fixed. - strLoadError = _("You need to rebuild the database using -reindex to change -txindex"); + strLoadError = _("You need to rebuild the database using -reindex-chainstate to change -txindex"); break; } @@ -1593,8 +1588,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) if (!fReset) { bool fRet = uiInterface.ThreadSafeQuestion( strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"), - // TODO: Recommend `-reindex or -reindex-chainstate` after - // #5964 and/or #5977 are fixed. strLoadError + ".\nPlease restart with -reindex to recover.", "", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT); if (fRet) { @@ -1711,6 +1704,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) if (mapArgs.count("-txexpirynotify")) uiInterface.NotifyTxExpiration.connect(TxExpiryNotifyCallback); + uiInterface.InitMessage(_("Activating best chain...")); + // scan for better chains in the block chain database, that are not yet connected in the active best chain + CValidationState state; + if (!ActivateBestChain(state, chainparams)) + strErrors << "Failed to connect best block"; + std::vector vImportFiles; if (mapArgs.count("-loadblock")) { diff --git a/src/main.cpp b/src/main.cpp index 42097bdb9..dc715ff80 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4879,6 +4879,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB { LogPrint("reindex", "%s: Processing out of order child %s of %s\n", __func__, block.GetHash().ToString(), head.ToString()); + LOCK(cs_main); CValidationState dummy; if (AcceptBlock(block, dummy, chainparams, NULL, true, &(range.first->second))) { @@ -5036,7 +5037,6 @@ void static CheckBlockIndex(const Consensus::Params& consensusParams) } } } - // assert(pindex->GetBlockHash() == pindex->GetBlockHeader().GetHash()); // Perhaps too slow // try { // assert(pindex->GetBlockHash() == pindex->GetBlockHeader().GetHash()); // Perhaps too slow // } catch (const runtime_error&) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c0974fac8..e2c03ba26 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4762,7 +4762,7 @@ std::string CWallet::GetWalletHelpString(bool showDebug) strUsage += HelpMessageOpt("-paytxfee=", strprintf(_("Fee (in %s/kB) to add to transactions you send (default: %s)"), CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK()))); strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions on startup")); - strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet on startup (implies -rescan)")); + strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet on startup")); strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), DEFAULT_SEND_FREE_TRANSACTIONS)); strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE)); strUsage += HelpMessageOpt("-txconfirmtarget=", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET)); @@ -4881,9 +4881,6 @@ bool CWallet::InitLoadWallet(bool clearWitnessCaches) RegisterValidationInterface(walletInstance); - // chainActive.Genesis() may return null; in this case, we want rescanning - // to happen automatically as a consequence of the genesis block (and subsequent - // blocks) being added to the chain. CBlockIndex *pindexRescan = chainActive.Tip(); if (clearWitnessCaches || GetBoolArg("-rescan", false)) { From a0059547f3cf78ec21a714352c6d0989ac5db489 Mon Sep 17 00:00:00 2001 From: MarkLTZ Date: Mon, 26 Aug 2024 07:47:32 +0000 Subject: [PATCH 3/4] txdb: remove consistency checks --- src/txdb.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index 1316cd3bc..b03426b52 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -509,23 +509,9 @@ bool CBlockTreeDB::LoadBlockIndexGuts(std::functionnSproutValue = diskindex.nSproutValue; pindexNew->nSaplingValue = diskindex.nSaplingValue; - // Consistency checks - CBlockHeader header; - { - LOCK(cs_main); - try { - header = pindexNew->GetBlockHeader(); - } catch (const runtime_error&) { - return error("LoadBlockIndex(): failed to read index entry: diskindex hash = %s", - diskindex.GetBlockHash().ToString()); - } - } - if (header.GetHash() != diskindex.GetBlockHash()) - return error("LoadBlockIndex(): inconsistent header vs diskindex hash: header hash = %s, diskindex hash = %s", - header.GetHash().ToString(), diskindex.GetBlockHash().ToString()); - if (header.GetHash() != pindexNew->GetBlockHash()) - return error("LoadBlockIndex(): block header inconsistency detected: on-disk = %s, in-memory = %s", - diskindex.ToString(), pindexNew->ToString()); + // Check the block hash against the required difficulty as encoded in the + // nBits field. The probability of this succeeding randomly is low enough + // that it is a useful check to detect logic or disk storage errors. if (pindexNew->nHeight > 0 && !CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus())) return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString()); From 2dc4484928fc13c656bff490831a29e0af6738a9 Mon Sep 17 00:00:00 2001 From: MarkLTZ Date: Mon, 26 Aug 2024 07:48:26 +0000 Subject: [PATCH 4/4] Release v2.0.10 --- README.md | 2 +- configure.ac | 2 +- contrib/debian/changelog | 6 + contrib/gitian-descriptors/gitian-linux.yml | 2 +- contrib/gitian-descriptors/gitian-osx.yml | 2 +- contrib/gitian-descriptors/gitian-win.yml | 2 +- doc/man/bitcoinz-cli.1 | 6 +- doc/man/bitcoinz-tx.1 | 6 +- doc/man/bitcoinzd.1 | 6 +- doc/release-notes.md | 152 +++----------------- doc/release-notes/release-notes-2.0.9.md | 142 ++++++++++++++++++ src/clientversion.h | 2 +- 12 files changed, 183 insertions(+), 147 deletions(-) create mode 100644 doc/release-notes/release-notes-2.0.9.md diff --git a/README.md b/README.md index efc7ba763..c691525f7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# BitcoinZ 2.0.9 +# BitcoinZ 2.0.10 **Keep running wallet to strengthen the BitcoinZ network. Backup your wallet in many locations & keep your coins wallet offline.** ### Ports: diff --git a/configure.ac b/configure.ac index 3a081e352..7b0bd3f74 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 2) define(_CLIENT_VERSION_MINOR, 0) -define(_CLIENT_VERSION_REVISION, 9) +define(_CLIENT_VERSION_REVISION, 10) define(_CLIENT_VERSION_BUILD, 50) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) diff --git a/contrib/debian/changelog b/contrib/debian/changelog index 3c5a837bf..e9ef3fd14 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -1,3 +1,9 @@ +bitcoinz (2.0.10) stable; urgency=high + + * 2.0.10 release. + + -- The BitcoinZ Community Aug 2024 + bitcoinz (2.0.9) stable; urgency=medium * 2.0.9 release. diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 1eeac496d..ca7e52f40 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "bitcoinz-2.0.9" +name: "bitcoinz-2.0.10" enable_cache: true distro: "debian" suites: diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index a249b5f8e..151a962b5 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -1,5 +1,5 @@ --- -name: "bitcoinz-osx-2.0.9" +name: "bitcoinz-osx-2.0.10" enable_cache: true suites: - "trusty" diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index f63b74f74..8df3e3898 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -1,5 +1,5 @@ --- -name: "bitcoinz-win-2.0.9" +name: "bitcoinz-win-2.0.10" enable_cache: true suites: - "trusty" diff --git a/doc/man/bitcoinz-cli.1 b/doc/man/bitcoinz-cli.1 index 91c3133ad..d1941e036 100644 --- a/doc/man/bitcoinz-cli.1 +++ b/doc/man/bitcoinz-cli.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BITCOINZ-CLI "1" "August 2024" "bitcoinz-cli v2.0.9" "User Commands" +.TH BITCOINZ-CLI "1" "August 2024" "bitcoinz-cli v2.0.10" "User Commands" .SH NAME -bitcoinz-cli \- manual page for bitcoinz-cli v2.0.9 +bitcoinz-cli \- manual page for bitcoinz-cli v2.0.10 .SH DESCRIPTION -BitcoinZ RPC client version v2.0.9 +BitcoinZ RPC client version v2.0.10 .PP In order to ensure you are adequately protecting your privacy when using BitcoinZ, please see . diff --git a/doc/man/bitcoinz-tx.1 b/doc/man/bitcoinz-tx.1 index 362f27bb4..f243b6435 100644 --- a/doc/man/bitcoinz-tx.1 +++ b/doc/man/bitcoinz-tx.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BITCOINZ-TX "1" "August 2024" "bitcoinz-tx v2.0.9" "User Commands" +.TH BITCOINZ-TX "1" "August 2024" "bitcoinz-tx v2.0.10" "User Commands" .SH NAME -bitcoinz-tx \- manual page for bitcoinz-tx v2.0.9 +bitcoinz-tx \- manual page for bitcoinz-tx v2.0.10 .SH DESCRIPTION -BitcoinZ bitcoinz\-tx utility version v2.0.9 +BitcoinZ bitcoinz\-tx utility version v2.0.10 .SS "Usage:" .TP bitcoinz\-tx [options] [commands] diff --git a/doc/man/bitcoinzd.1 b/doc/man/bitcoinzd.1 index a9f9150df..57f0576a7 100644 --- a/doc/man/bitcoinzd.1 +++ b/doc/man/bitcoinzd.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BITCOINZD "1" "August 2024" "bitcoinzd v2.0.9" "User Commands" +.TH BITCOINZD "1" "August 2024" "bitcoinzd v2.0.10" "User Commands" .SH NAME -bitcoinzd \- manual page for bitcoinzd v2.0.9 +bitcoinzd \- manual page for bitcoinzd v2.0.10 .SH DESCRIPTION -BitcoinZ Daemon version v2.0.9 +BitcoinZ Daemon version v2.0.10 .PP In order to ensure you are adequately protecting your privacy when using BitcoinZ, please see . diff --git a/doc/release-notes.md b/doc/release-notes.md index f525d5096..e6452b8c0 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -1,142 +1,30 @@ Notable changes =============== -DoS Mitigation: Mempool Size Limit and Random Drop --------------------------------------------------- +Fixes +----- -This release adds a mechanism for preventing nodes from running out of memory -in the situation where an attacker is trying to overwhelm the network with -transactions. This is achieved by keeping track of and limiting the total -`cost` and `evictionWeight` of all transactions in the mempool. The `cost` of a -transaction is determined by its size in bytes, and its `evictionWeight` is a -function of the transaction's `cost` and its fee. The maximum total cost is -configurable via the parameter `mempooltxcostlimit` which defaults to -80,000,000 (up to 20,000 txs). If a node's total mempool `cost` exceeds this -limit the node will evict a random transaction, preferentially picking larger -transactions and ones with below the standard fee. To prevent a node from -re-accepting evicted transactions, it keeps track of ones that it has evicted -recently. By default, a transaction will be considered recently evicted for 60 -minutes, but this can be configured with the parameter -`mempoolevictionmemoryminutes`. +Resolved a critical bug that prevented the program from starting up correctly in some cases. +The issue occurred during the startup process when the program attempted to rescan the latest indexed blocks. +A failure in the LoadBlockIndex() function, caused by a corrupted index file, was identified as the root cause. -For full details see ZIP 401. +Upgrading +========= -Asynchronous Operations Incorrectly Reporting Success ------------------------------------------------------ -We fixed an issue where asynchronous operations were sometimes reporting sucess -when they had actually failed. One way this could occur was when trying to use -`z_sendmany` to create a transaction spending coinbase funds in a way where -change would be generated (not a valid use of `z_sendmany`). In this case the -operation would erroneously report success, and the only way to see that the -transaction had actually failed was to look in the `debug.log` file. Such -operations will now correctly report that they have failed. +How to Upgrade +-------------- -Fake chain detection during initial block download --------------------------------------------------- +If you are running an older version, shut it down. Wait until it has completely +shut down (which might take a few minutes for older versions), then run the +installer (on Windows) or just copy over or bitcoinzd (on Linux). -One of the mechanisms that `bitcoinzd` uses to detect whether it is in "initial -block download" (IBD) mode is to compare the active chain's cumulative work -against a hard-coded "minimum chain work" value. This mechanism (inherited from -Bitcoin Core) means that once a node exits IBD mode, it is either on the main -chain, or a fake alternate chain with similar amounts of work. In the latter -case, the node has most likely become the victim of a 50% + 1 adversary. +If you are upgrading from version v2.0.9, due a bug on that version, to fix +a chainstate database corruption, you need to run this release with `-reindex` +option to rebuild the chainstate data structures. This will take anywhere from +30 minutes to several hours, depending on the speed of your machine. -Starting from this release, `bitcoinzd` additionally hard-codes the block hashes -for the activation blocks of each past network upgrade (NU). During initial -chain synchronization, and after the active chain has reached "minimum chain -work", the node checks the blocks at each NU activation height against the -hard-coded hashes. If any of them do not match, the node will immediately alert -the user and **shut down for safety**. +If you are upgrading from a version prior to v2.0.9, then the '-reindex' operation +is not necessary. -Disabling old Sprout proofs ---------------------------- - -As part of our ongoing work to clean up the codebase and minimise the security -surface of `bitcoinzd`, we are removing `libsnark` from the codebase, and dropping -support for creating and verifying old Sprout proofs. Funds stored in Sprout -addresses are not affected, as they are spent using the hybrid Sprout circuit -(built using `bellman`) that was deployed during the Sapling network upgrade. - -This change has several implications: - -- `bitcoinzd` no longer verifies old Sprout proofs, and will instead assume they - are valid. This has a minor implication for nodes: during initial block - download, an adversary could feed the node fake blocks containing invalid old - Sprout proofs, and the node would accept the fake chain as valid. However, - as soon as the active chain contains at least as much work as the hard-coded - "minimum chain work" value, the node will detect this situation and shut down. - -- Shielded transactions can no longer be created before Sapling has activated. - This does not affect BitcoinZ itself, but will affect downstream codebases that - have not yet activated Sapling (or that start a new chain after this point and - do not activate Sapling from launch). Note that the old Sprout circuit is - [vulnerable to counterfeiting](https://z.cash/support/security/announcements/security-announcement-2019-02-05-cve-2019-7167/) - and should not be used in current deployments. - -- Starting from this release, the circuit parameters from the original Sprout - MPC are no longer required to start `bitcoinzd`, and will not be downloaded by - `fetch-params.sh`. They are not being automatically deleted at this time. - -Option parsing behavior ------------------------ - -Command line options are now parsed strictly in the order in which they are -specified. It used to be the case that `-X -noX` ends up, unintuitively, with X -set, as `-X` had precedence over `-noX`. This is no longer the case. Like for -other software, the last specified value for an option will hold. - -Low-level RPC changes ---------------------- - -- Bare multisig outputs to our keys are no longer automatically treated as - incoming payments. As this feature was only available for multisig outputs for - which you had all private keys in your wallet, there was generally no use for - them compared to single-key schemes. Furthermore, no address format for such - outputs is defined, and wallet software can't easily send to it. These outputs - will no longer show up in `listtransactions`, `listunspent`, or contribute to - your balance, unless they are explicitly watched (using `importaddress` or - `importmulti` with hex script argument). `signrawtransaction*` also still - works for them. - -View shielded information in wallet transactions ------------------------------------------------- - -In previous `bitcoinzd` versions, to obtain information about shielded transactions -you would use either the `z_listreceivedbyaddress` RPC method (which returns all -notes received by an address) or `z_listunspent` (which returns unspent notes, -optionally filtered by addresses). There were no RPC methods that directly -returned details about spends, or anything equivalent to the `gettransaction` -method (which returns transparent information about in-wallet transactions). - -This release introduces a new RPC method `z_viewtransaction` to fill that gap. -Given the ID of a transaction in the wallet, it decrypts the transaction and -returns detailed shielded information for all decryptable new and spent notes, -including: - -- The address that each note belongs to. -- Values in both decimal ZEC and zatoshis. -- The ID of the transaction that each spent note was received in. -- An `outgoing` flag on each new note, which will be `true` if the output is not - for an address in the wallet. -- A `memoStr` field for each new note, containing its text memo (if its memo - field contains a valid UTF-8 string). - -Information will be shown for any address that appears in `z_listaddresses`; -this includes watch-only addresses linked to viewing keys imported with -`z_importviewingkey`, as well as addresses with spending keys (both generated -with `z_getnewaddress` and imported with `z_importkey`). - -Build system ------------- - -- The `--enable-lcov`, `--disable-tests`, and `--disable-mining` flags for - `zcutil/build.sh` have been removed. You can pass these flags instead by using - the `CONFIGURE_FLAGS` environment variable. For example, to enable coverage - instrumentation (thus enabling "make cov" to work), call: - - ``` - CONFIGURE_FLAGS="--enable-lcov --disable-hardening" ./zcutil/build.sh - ``` - -- The build system no longer defaults to verbose output. You can re-enable - verbose output with `./zcutil/build.sh V=1` +On Windows, do not forget to uninstall all earlier versions of the Bitcoin +client first. diff --git a/doc/release-notes/release-notes-2.0.9.md b/doc/release-notes/release-notes-2.0.9.md new file mode 100644 index 000000000..f525d5096 --- /dev/null +++ b/doc/release-notes/release-notes-2.0.9.md @@ -0,0 +1,142 @@ +Notable changes +=============== + +DoS Mitigation: Mempool Size Limit and Random Drop +-------------------------------------------------- + +This release adds a mechanism for preventing nodes from running out of memory +in the situation where an attacker is trying to overwhelm the network with +transactions. This is achieved by keeping track of and limiting the total +`cost` and `evictionWeight` of all transactions in the mempool. The `cost` of a +transaction is determined by its size in bytes, and its `evictionWeight` is a +function of the transaction's `cost` and its fee. The maximum total cost is +configurable via the parameter `mempooltxcostlimit` which defaults to +80,000,000 (up to 20,000 txs). If a node's total mempool `cost` exceeds this +limit the node will evict a random transaction, preferentially picking larger +transactions and ones with below the standard fee. To prevent a node from +re-accepting evicted transactions, it keeps track of ones that it has evicted +recently. By default, a transaction will be considered recently evicted for 60 +minutes, but this can be configured with the parameter +`mempoolevictionmemoryminutes`. + +For full details see ZIP 401. + +Asynchronous Operations Incorrectly Reporting Success +----------------------------------------------------- +We fixed an issue where asynchronous operations were sometimes reporting sucess +when they had actually failed. One way this could occur was when trying to use +`z_sendmany` to create a transaction spending coinbase funds in a way where +change would be generated (not a valid use of `z_sendmany`). In this case the +operation would erroneously report success, and the only way to see that the +transaction had actually failed was to look in the `debug.log` file. Such +operations will now correctly report that they have failed. + +Fake chain detection during initial block download +-------------------------------------------------- + +One of the mechanisms that `bitcoinzd` uses to detect whether it is in "initial +block download" (IBD) mode is to compare the active chain's cumulative work +against a hard-coded "minimum chain work" value. This mechanism (inherited from +Bitcoin Core) means that once a node exits IBD mode, it is either on the main +chain, or a fake alternate chain with similar amounts of work. In the latter +case, the node has most likely become the victim of a 50% + 1 adversary. + +Starting from this release, `bitcoinzd` additionally hard-codes the block hashes +for the activation blocks of each past network upgrade (NU). During initial +chain synchronization, and after the active chain has reached "minimum chain +work", the node checks the blocks at each NU activation height against the +hard-coded hashes. If any of them do not match, the node will immediately alert +the user and **shut down for safety**. + +Disabling old Sprout proofs +--------------------------- + +As part of our ongoing work to clean up the codebase and minimise the security +surface of `bitcoinzd`, we are removing `libsnark` from the codebase, and dropping +support for creating and verifying old Sprout proofs. Funds stored in Sprout +addresses are not affected, as they are spent using the hybrid Sprout circuit +(built using `bellman`) that was deployed during the Sapling network upgrade. + +This change has several implications: + +- `bitcoinzd` no longer verifies old Sprout proofs, and will instead assume they + are valid. This has a minor implication for nodes: during initial block + download, an adversary could feed the node fake blocks containing invalid old + Sprout proofs, and the node would accept the fake chain as valid. However, + as soon as the active chain contains at least as much work as the hard-coded + "minimum chain work" value, the node will detect this situation and shut down. + +- Shielded transactions can no longer be created before Sapling has activated. + This does not affect BitcoinZ itself, but will affect downstream codebases that + have not yet activated Sapling (or that start a new chain after this point and + do not activate Sapling from launch). Note that the old Sprout circuit is + [vulnerable to counterfeiting](https://z.cash/support/security/announcements/security-announcement-2019-02-05-cve-2019-7167/) + and should not be used in current deployments. + +- Starting from this release, the circuit parameters from the original Sprout + MPC are no longer required to start `bitcoinzd`, and will not be downloaded by + `fetch-params.sh`. They are not being automatically deleted at this time. + +Option parsing behavior +----------------------- + +Command line options are now parsed strictly in the order in which they are +specified. It used to be the case that `-X -noX` ends up, unintuitively, with X +set, as `-X` had precedence over `-noX`. This is no longer the case. Like for +other software, the last specified value for an option will hold. + +Low-level RPC changes +--------------------- + +- Bare multisig outputs to our keys are no longer automatically treated as + incoming payments. As this feature was only available for multisig outputs for + which you had all private keys in your wallet, there was generally no use for + them compared to single-key schemes. Furthermore, no address format for such + outputs is defined, and wallet software can't easily send to it. These outputs + will no longer show up in `listtransactions`, `listunspent`, or contribute to + your balance, unless they are explicitly watched (using `importaddress` or + `importmulti` with hex script argument). `signrawtransaction*` also still + works for them. + +View shielded information in wallet transactions +------------------------------------------------ + +In previous `bitcoinzd` versions, to obtain information about shielded transactions +you would use either the `z_listreceivedbyaddress` RPC method (which returns all +notes received by an address) or `z_listunspent` (which returns unspent notes, +optionally filtered by addresses). There were no RPC methods that directly +returned details about spends, or anything equivalent to the `gettransaction` +method (which returns transparent information about in-wallet transactions). + +This release introduces a new RPC method `z_viewtransaction` to fill that gap. +Given the ID of a transaction in the wallet, it decrypts the transaction and +returns detailed shielded information for all decryptable new and spent notes, +including: + +- The address that each note belongs to. +- Values in both decimal ZEC and zatoshis. +- The ID of the transaction that each spent note was received in. +- An `outgoing` flag on each new note, which will be `true` if the output is not + for an address in the wallet. +- A `memoStr` field for each new note, containing its text memo (if its memo + field contains a valid UTF-8 string). + +Information will be shown for any address that appears in `z_listaddresses`; +this includes watch-only addresses linked to viewing keys imported with +`z_importviewingkey`, as well as addresses with spending keys (both generated +with `z_getnewaddress` and imported with `z_importkey`). + +Build system +------------ + +- The `--enable-lcov`, `--disable-tests`, and `--disable-mining` flags for + `zcutil/build.sh` have been removed. You can pass these flags instead by using + the `CONFIGURE_FLAGS` environment variable. For example, to enable coverage + instrumentation (thus enabling "make cov" to work), call: + + ``` + CONFIGURE_FLAGS="--enable-lcov --disable-hardening" ./zcutil/build.sh + ``` + +- The build system no longer defaults to verbose output. You can re-enable + verbose output with `./zcutil/build.sh V=1` diff --git a/src/clientversion.h b/src/clientversion.h index 6b41b8649..c523ef40b 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -18,7 +18,7 @@ //! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 2 #define CLIENT_VERSION_MINOR 0 -#define CLIENT_VERSION_REVISION 9 +#define CLIENT_VERSION_REVISION 10 #define CLIENT_VERSION_BUILD 50 //! Set to true for release, false for prerelease or test build