diff --git a/README.md b/README.md index d8b7dfd62..32d1b8296 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Zcash 5.1.0-rc1 +Zcash 5.1.0 =========== diff --git a/configure.ac b/configure.ac index 342ef0ba2..8a7d77f3c 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 5) define(_CLIENT_VERSION_MINOR, 1) define(_CLIENT_VERSION_REVISION, 0) -define(_CLIENT_VERSION_BUILD, 25) +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))) define(_CLIENT_VERSION_IS_RELEASE, true) diff --git a/contrib/debian/changelog b/contrib/debian/changelog index e9ccaab99..a3beaee95 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -1,3 +1,9 @@ +zcash (5.1.0) stable; urgency=medium + + * 5.1.0 release. + + -- Electric Coin Company Fri, 08 Jul 2022 03:01:54 +0000 + zcash (5.1.0~rc1) stable; urgency=medium * 5.1.0-rc1 release. diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 792392c09..d25403476 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "zcash-5.1.0-rc1" +name: "zcash-5.1.0" enable_cache: true distro: "debian" suites: diff --git a/doc/authors.md b/doc/authors.md index 5700307b9..35be1a2b7 100644 --- a/doc/authors.md +++ b/doc/authors.md @@ -1,34 +1,34 @@ Zcash Contributors ================== -Jack Grigg (1142) -Kris Nuttycombe (524) +Jack Grigg (1188) +Kris Nuttycombe (552) Simon Liu (460) -Sean Bowe (379) -Daira Hopwood (325) +Sean Bowe (387) +Daira Hopwood (329) Eirik Ogilvie-Wigley (216) Wladimir J. van der Laan (150) Alfredo Garcia (119) Taylor Hornby (118) -Marshall Gaucher (112) -Pieter Wuille (106) +Marshall Gaucher (114) +Pieter Wuille (108) +Ying Tong Lai (90) Jonas Schnelli (90) Jay Graber (89) Larry Ruane (88) -Ying Tong Lai (87) -Marco Falke (82) -Cory Fields (75) +Marco Falke (85) +Cory Fields (76) +Matt Corallo (60) Nathan Wilcox (56) -Matt Corallo (52) -sasha (51) -practicalswift (38) +sasha (54) +practicalswift (41) Kevin Gallagher (38) Dimitris Apostolou (38) fanquake (36) Carl Dong (26) +John Newbery (23) Gregory Maxwell (23) Jorge Timón (22) -John Newbery (22) Luke Dashjr (21) Jonathan "Duke" Leto (18) syd (16) @@ -45,25 +45,26 @@ Ariel Gabizon (12) Suhas Daftuar (11) Paige Peterson (11) Kaz Wesley (11) +João Barbosa (11) Alex Morcos (11) Philip Kaufmann (10) Peter Todd (10) Marius Kjærstad (10) -João Barbosa (10) ying tong (9) teor (9) nomnombtc (9) +Russell Yanofsky (9) kozyilmaz (8) Zancas Wilcox (8) Jeremy Rubin (8) Jeff Garzik (8) Ben Wilson (8) Karl-Johan Alm (7) +Chun Kuan Lee (7) James O'Beirne (6) David Mercer (6) Daniel Kraft (6) Daniel Cousens (6) -Chun Kuan Lee (6) Casey Rodarmor (6) jnewbery (5) ca333 (5) @@ -78,12 +79,12 @@ sandakersmann (4) gladcow (4) WO (4) Sjors Provoost (4) -Russell Yanofsky (4) Nate Wilcox (4) mruddy (3) lpescher (3) isle2983 (3) elbandi (3) +Thomas Snider (3) NikVolf (3) Martin Ankerl (3) Julian Fleischer (3) @@ -107,7 +108,6 @@ aniemerg (2) Yuri Zhykin (2) UdjinM6 (2) Tim Ruffing (2) -Thomas Snider (2) Solar Designer (2) Sebastian Falbesoner (2) Scott (2) @@ -121,12 +121,14 @@ Matthew King (2) Mary Moore-Simmons (2) Marek (2) Joe Turgeon (2) +Jesse Cohen (2) Jeffrey Czyz (2) Jack Gavigan (2) ITH4Coinomia (2) Dagur Valberg Johannsson (2) Conrado Gouvea (2) Bryant Eisenbach (2) +Brian Stafford (2) Brad Miller (2) Bjorn Hjortsberg (2) Ben Woosley (2) @@ -206,7 +208,6 @@ Karel Bilek (1) Josh Lehan (1) Josh Ellithorpe (1) Jonas Nick (1) -Jesse Cohen (1) Jeffrey Walton (1) Janito Vaqueiro Ferreira Filho (1) Jainan-Tandel (1) diff --git a/doc/man/zcash-cli.1 b/doc/man/zcash-cli.1 index 40827a9da..5724e84ae 100644 --- a/doc/man/zcash-cli.1 +++ b/doc/man/zcash-cli.1 @@ -1,9 +1,9 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. -.TH ZCASH-CLI "1" "July 2022" "zcash-cli v5.1.0-rc1" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. +.TH ZCASH-CLI "1" "July 2022" "zcash-cli v5.1.0" "User Commands" .SH NAME -zcash-cli \- manual page for zcash-cli v5.1.0-rc1 +zcash-cli \- manual page for zcash-cli v5.1.0 .SH DESCRIPTION -Zcash RPC client version v5.1.0\-rc1 +Zcash RPC client version v5.1.0 .PP In order to ensure you are adequately protecting your privacy when using Zcash, please see . diff --git a/doc/man/zcash-tx.1 b/doc/man/zcash-tx.1 index 95d86bc37..56d676156 100644 --- a/doc/man/zcash-tx.1 +++ b/doc/man/zcash-tx.1 @@ -1,9 +1,9 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. -.TH ZCASH-TX "1" "July 2022" "zcash-tx v5.1.0-rc1" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. +.TH ZCASH-TX "1" "July 2022" "zcash-tx v5.1.0" "User Commands" .SH NAME -zcash-tx \- manual page for zcash-tx v5.1.0-rc1 +zcash-tx \- manual page for zcash-tx v5.1.0 .SH DESCRIPTION -Zcash zcash\-tx utility version v5.1.0\-rc1 +Zcash zcash\-tx utility version v5.1.0 .SS "Usage:" .TP zcash\-tx [options] [commands] diff --git a/doc/man/zcashd-wallet-tool.1 b/doc/man/zcashd-wallet-tool.1 index fae8d3571..6a3ec282b 100644 --- a/doc/man/zcashd-wallet-tool.1 +++ b/doc/man/zcashd-wallet-tool.1 @@ -1,7 +1,7 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. -.TH ZCASHD-WALLET-TOOL "1" "July 2022" "zcashd-wallet-tool v5.1.0-rc1" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. +.TH ZCASHD-WALLET-TOOL "1" "July 2022" "zcashd-wallet-tool v5.1.0" "User Commands" .SH NAME -zcashd-wallet-tool \- manual page for zcashd-wallet-tool v5.1.0-rc1 +zcashd-wallet-tool \- manual page for zcashd-wallet-tool v5.1.0 .SH SYNOPSIS .B zcashd-wallet-tool [\fI\,OPTIONS\/\fR] diff --git a/doc/man/zcashd.1 b/doc/man/zcashd.1 index 706ccd935..e2606d5a7 100644 --- a/doc/man/zcashd.1 +++ b/doc/man/zcashd.1 @@ -1,9 +1,9 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. -.TH ZCASHD "1" "July 2022" "zcashd v5.1.0-rc1" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. +.TH ZCASHD "1" "July 2022" "zcashd v5.1.0" "User Commands" .SH NAME -zcashd \- manual page for zcashd v5.1.0-rc1 +zcashd \- manual page for zcashd v5.1.0 .SH DESCRIPTION -Zcash Daemon version v5.1.0\-rc1 +Zcash Daemon version v5.1.0 .PP In order to ensure you are adequately protecting your privacy when using Zcash, please see . @@ -94,7 +94,7 @@ Keep at most unconnectable transactions in memory (default: 100) .HP \fB\-par=\fR .IP -Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 = +Set the number of script verification threads (\fB\-16\fR to 16, 0 = auto, <0 = leave that many cores free, default: 0) .HP \fB\-pid=\fR diff --git a/doc/release-notes.md b/doc/release-notes.md index 621f12a95..a29094b51 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -4,66 +4,3 @@ release-notes at release time) Notable changes =============== -Faster block validation for Sapling and Orchard transactions ------------------------------------------------------------- - -Block validation in `zcashd` is a mostly single-threaded process, due to how the -chain update logic inherited from Bitcoin Core is written. However, certain more -computationally intensive checks are performed more efficiently than checking -everything individually: - -- ECDSA signatures on transparent inputs are checked via multithreading. -- RedPallas signatures on Orchard actions are checked via batch validation. - -As of this release, `zcashd` applies these techniques to more Sapling and -Orchard components: - -- RedJubjub signatures on Sapling Spends are checked via batch validation. -- Groth16 proofs for Sapling Spends and Outputs are checked via batch validation - and multithreading. -- Halo 2 proofs for Orchard Actions are checked via batch validation and - multithreading. - -This reduces worst-case block validation times for observed historic blocks by -around 80% on a Ryzen 9 5950X CPU. - -The number of threads used for checking Groth16 and Halo 2 proofs (as well as -for creating them when spending funds) can be set via the `RAYON_NUM_THREADS` -environment variable. - -Option handling ---------------- - -- A new `-preferredtxversion` argument allows the node to preferentially create - transactions of a specified version, if a transaction does not contain - components that necessitate creation with a specific version. For example, - setting `-preferredtxversion=4` will cause the node to create V4 transactions - whenever the transaction does not contain Orchard components. This can be - helpful if recipients of transactions are likely to be using legacy wallets - that have not yet been upgraded to support parsing V5 transactions. - -RPC interface -------------- - -- The `getrawtransaction` RPC method now includes details about Orchard actions - within transactions. - -Deprecated ----------- - -As of this release, the following previously deprecated features are disabled -by default, but may be be reenabled using `-allowdeprecated=`. - - - The `dumpwallet` RPC method is disabled. It may be reenabled with - `allowdeprecated=dumpwallet`. `dumpwallet` should not be used; it is - unsafe for backup purposes as it does not return any key information - for keys used to derive shielded addresses. Use `z_exportwallet` instead. - -As of this release, the following features are deprecated, but remain available -by default. These features may be disabled by setting `-allowdeprecated=none`. -After at least 3 minor-version releases, these features will be disabled by -default and the following flags to `-allowdeprecated` will be required to -permit their continued use: - - - `wallettxvjoinsplit` - controls availability of the deprecated `vjoinsplit` - attribute returned by the `gettransaction` RPC method. diff --git a/doc/release-notes/release-notes-5.1.0.md b/doc/release-notes/release-notes-5.1.0.md new file mode 100644 index 000000000..be2aef4a6 --- /dev/null +++ b/doc/release-notes/release-notes-5.1.0.md @@ -0,0 +1,254 @@ +Notable changes +=============== + +Faster block validation for Sapling and Orchard transactions +------------------------------------------------------------ + +Block validation in `zcashd` is a mostly single-threaded process, due to how the +chain update logic inherited from Bitcoin Core is written. However, certain more +computationally intensive checks are performed more efficiently than checking +everything individually: + +- ECDSA signatures on transparent inputs are checked via multithreading. +- RedPallas signatures on Orchard actions are checked via batch validation. + +As of this release, `zcashd` applies these techniques to more Sapling and +Orchard components: + +- RedJubjub signatures on Sapling Spends are checked via batch validation. +- Groth16 proofs for Sapling Spends and Outputs are checked via batch validation + and multithreading. +- Halo 2 proofs for Orchard Actions are checked via batch validation and + multithreading. + +This reduces worst-case block validation times for observed historic blocks by +around 80% on a Ryzen 9 5950X CPU. + +The number of threads used for checking Groth16 and Halo 2 proofs (as well as +for creating them when spending funds) can be set via the `RAYON_NUM_THREADS` +environment variable. + +Option handling +--------------- + +- A new `-preferredtxversion` argument allows the node to preferentially create + transactions of a specified version, if a transaction does not contain + components that necessitate creation with a specific version. For example, + setting `-preferredtxversion=4` will cause the node to create V4 transactions + whenever the transaction does not contain Orchard components. This can be + helpful if recipients of transactions are likely to be using legacy wallets + that have not yet been upgraded to support parsing V5 transactions. + +RPC interface +------------- + +- The `getblocktemplate` RPC method now skips proof and signature checks on + templates it creates, as these templates only include transactions that have + previously been checked when being added to the mempool. + +- The `getrawtransaction` and `decoderawtransaction` RPC methods now include + details about Orchard actions within transactions. + +Wallet +------ + +- Rescan performance of post-NU5 blocks has been slightly improved (overall + rescan time for a single-account wallet decreases by around 6% on a Ryzen 9 + 5950X). Further improvements will be implemented in future releases to help + mitigate the effect of blocks full of shielded outputs. + +- The `CWallet::UpdatedTransaction` signal is no longer called while holding the + `cs_main` lock. This fixes an issue where RPCs could block for long periods of + time on `zcashd` nodes with large wallets. Downstream code forks that have + reconnected the `NotifyTransactionChanged` wallet signal should take note of + this change, and not rely there on access to globals protected by `cs_main`. + +- Some `zcashd 5.0.0` nodes would shut down some time after start with the error + `ThreadNotifyWallets: Failed to read block X while notifying wallets of block disconnects`. + `zcashd` now attempts to rectify the situation, and otherwise will inform the + user before shutting down that a reindex is required. + +Deprecated +---------- + +As of this release, the following previously deprecated features are disabled +by default, but may be be reenabled using `-allowdeprecated=`. + + - The `dumpwallet` RPC method is disabled. It may be reenabled with + `allowdeprecated=dumpwallet`. `dumpwallet` should not be used; it is + unsafe for backup purposes as it does not return any key information + for keys used to derive shielded addresses. Use `z_exportwallet` instead. + +As of this release, the following features are deprecated, but remain available +by default. These features may be disabled by setting `-allowdeprecated=none`. +After at least 3 minor-version releases, these features will be disabled by +default and the following flags to `-allowdeprecated` will be required to +permit their continued use: + + - `wallettxvjoinsplit` - controls availability of the deprecated `vjoinsplit` + attribute returned by the `gettransaction` RPC method. + +Changelog +========= + +Brian Stafford (2): + rpc: Add missing fields to getrawtransaction help text + rpc: add valueBalanceOrchard to getrawtransaction output + +Chun Kuan Lee (1): + break circular dependency: random/sync -> util -> random/sync + +Cory Fields (1): + threads: add a thread_local autoconf check + +Daira Hopwood (4): + halo2 is now under MIT/Apache-2.0, so does not need a declaration in `contrib/debian/copyright`. fixes #5203 + COPYING: Address feedback about the use of "permissive". Also refer to zcashd instead of "Zcash". + Upgrade to metrics 0.19.x and metrics-exporter-prometheus 0.10.x. + Apply cosmetic suggestions + +Jack Grigg (46): + book: Add platform support information and tier policy + lint: Fix cargo patches linter when no patches are present + Shorten thread name prefix + Name currently-unnamed threads that we can rename + book: Capitalize key words in platform tier policy + book: Add FreeBSD to tier 3 platforms list + depends: Add cxx crate to dependencies + depends: Add cxxbridge command to dependencies + build: Pass `CC` etc. flags through to `cargo build` + build: Add non-verbose output for `cargo build` + depends: Add `rust/cxx.h` header as a dependency + Migrate Equihash Rust FFI to `cxx` + Migrate BLAKE2b Rust FFI to `cxx` + depends: Vendor dependencies of native_cxxbuild + Revert "Switched sync.{cpp,h} to std threading primitives." + qa: Fix sprout_sapling_migration RPC test to handle wallet RPC change + wallet: Clear witness caches on load if reindexing + Document that `-reindex` and `-salvagewallet` both imply `-rescan` + Update orchard license with current exception text + Note dependence on BOSL in COPYING + qa: `cargo vet init` + qa: Add `crypto-reviewed` and `license-reviewed` criteria for `cargo vet` + CI: Add workflow that runs `cargo vet --locked` + qa: Add audits for the crates directly maintained by the ECC core team + book: Add section about auditing Rust dependencies + qa: Fix `qa/zcash/create_benchmark_archive.py` script + qa: Generalise `extract_benchmark_data` in `performance-measurements.sh` + bench: Support multiple trees in FakeCoinsViewDB + bench: Add `ConnectBlock` benchmark using block 1708048 + cargo vet fmt + Upgrade to `orchard 0.2.0` + Batch-validate Orchard proofs as well as Orchard signatures + test: Load the proof verification keys in Boost tests + bench: Add `ConnectBlock` benchmark using block 1723244 + Use batch validation for Sapling proofs and signatures + qa: Reformat for latest cargo-vet + qa: Postpone dependency updates + Update release notes + qa: Add native_cxxbridge and rustcxx to update checker + Move "previous coinbase" UI monitoring into ThreadNotifyWallets + miner: Disable proof and signature checks in CreateNewBlock + wallet: Comment out slow assertion + Add missing release note entries for 5.1.0 + qa: Postpone latest `cxx` update + make-release.py: Versioning changes for 5.1.0. + make-release.py: Updated manpages for 5.1.0. + +Jesse Cohen (1): + Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysis + +John Newbery (1): + [logging] Comment all continuing logs. + +João Barbosa (1): + Remove unused fTry from push_lock + +Kris Nuttycombe (28): + Fix incorrect links in 5.0.0 release notes. + Fix inconsistent caplitalization in copyright notices. + scripted-diff: Update Zcash copyrights to 2022 + scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 + scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 + scripted-diff: Add 2018-2022 copyright headers for files added/modified in 2018 + scripted-diff: Add 2019-2022 copyright headers for files added/modified in 2019 + scripted-diff: Add 2020-2022 copyright headers for files added/modified in 2020 + scripted-diff: Add 2021-2022 copyright headers for files added/modified in 2021 + Ensure that anchor depth is > 0 when selecting an Orchard anchor. + Add configure~ to .gitignore + Return an error if attempting to use z_shieldcoinbase for Orchard shielding. + Only return active protocol components from z_gettreestate. + Revert "Only return active protocol components from z_gettreestate." + Only return `skipHash` for Orchard & Sapling roots at heights >= activation. + Add a CLI flag to preferentially send V4 tx. + Revert "Make `-reindex` and `-reindex-chainstate` imply `-rescan`" + Do not attempt to begin a rescan if reindexing. + Disable wallet commands that are unavailable in safe mode during -reindex + Guard map accesses. + Mark the `dumpwallet` RPC method as disabled. + Add a clock for testing with an offset from the system clock. + Apply suggestions from code review + Note that `gettransaction` doesn't provide shielded info in RPC help. + Deprecate the `vjoinsplit` field of `gettransaction` results. + Revert "Merge pull request #6037 from nuttycom/feature/clock_capability" + Replace "Disabled" Orchard AuthValidator with std::nullopt + Ensure that the node has position information before attempting to read block data. + +Marco Falke (3): + qa: Initialize lockstack to prevent null pointer deref + sync: Add RecursiveMutex type alias + doc: Add comment to cs_main and mempool::cs + +Matt Corallo (8): + Split CNode::cs_vSend: message processing and message sending + Make the cs_sendProcessing a LOCK instead of a TRY_LOCK + Lock cs_vSend and cs_inventory in a consistent order even in TRY + Always enforce lock strict lock ordering (try or not) + Fixup style a bit by moving { to the same line as if statements + Further-enforce lockordering by enforcing directly after TRY_LOCKs + Fix -Wthread-safety-analysis warnings. Change the sync.h primitives to std from boost. + Fix fast-shutdown hang on ThreadImport+GenesisWait + +Pieter Wuille (2): + Use a signal to continue init after genesis activation + Do diskspace check before import thread is started + +Russell Yanofsky (5): + Add unit test for DEBUG_LOCKORDER code + MOVEONLY Move AnnotatedMixin declaration + Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection + Use LOCK macros for non-recursive locks + scripted-diff: Small locking rename + +Sean Bowe (8): + Fix "transparent" example that should be "p2pkh" + Make shielded requirements error "debug" level rather than an error. + Introduce new Sapling verification API via cxx and switch consensus rules to use the new API. + Enable ZIP 216 for blocks prior to NU5 activation + Remove the old Sapling verification FFI APIs. + cargo fmt + Address clippy lints. + Update minimum chain work and set NU5 activation block hash for mainnet + +Thomas Snider (1): + Switched sync.{cpp,h} to std threading primitives. + +Marshall Gaucher (2): + add rpc parallel test group logic + Update walletbackup.py + +practicalswift (3): + Remove unused code + Use -Wthread-safety-analysis if available (+ -Werror=thread-safety-analysis if --enable-werror) + Fix typos + +sasha (3): + make-release.py: Versioning changes for 5.1.0-rc1. + make-release.py: Updated manpages for 5.1.0-rc1. + make-release.py: Updated release notes and changelog for 5.1.0-rc1. + +Ying Tong Lai (3): + Add orchard_bundle FFI. + Use orchard_bundle ffi in getrawtransaction. + Test getrawtransaction in wallet_orchard.py + diff --git a/qa/zcash/postponed-updates.txt b/qa/zcash/postponed-updates.txt index d48b7b3cf..b9667095d 100644 --- a/qa/zcash/postponed-updates.txt +++ b/qa/zcash/postponed-updates.txt @@ -6,8 +6,10 @@ native_cxxbridge 1.0.69 2022-09-01 native_cxxbridge 1.0.70 2022-09-01 +native_cxxbridge 1.0.71 2022-09-01 rustcxx 1.0.69 2022-09-01 rustcxx 1.0.70 2022-09-01 +rustcxx 1.0.71 2022-09-01 # Ccache 4.0 requires adding CMake to the depends system. native_ccache 4.0 2022-09-01 diff --git a/src/clientversion.h b/src/clientversion.h index 926bd8e8a..c1997d2d9 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -18,7 +18,7 @@ #define CLIENT_VERSION_MAJOR 5 #define CLIENT_VERSION_MINOR 1 #define CLIENT_VERSION_REVISION 0 -#define CLIENT_VERSION_BUILD 25 +#define CLIENT_VERSION_BUILD 50 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/deprecation.h b/src/deprecation.h index 21e2ea91f..72d83414e 100644 --- a/src/deprecation.h +++ b/src/deprecation.h @@ -10,7 +10,7 @@ // Per https://zips.z.cash/zip-0200 // Shut down nodes running this version of code, 16 weeks' worth of blocks after the estimated // release block height. A warning is shown during the 14 days' worth of blocks prior to shut down. -static const int APPROX_RELEASE_HEIGHT = 1727474; +static const int APPROX_RELEASE_HEIGHT = 1730371; static const int RELEASE_TO_DEPRECATION_WEEKS = 16; static const int EXPECTED_BLOCKS_PER_HOUR = 3600 / Consensus::POST_BLOSSOM_POW_TARGET_SPACING; static_assert(EXPECTED_BLOCKS_PER_HOUR == 48, "The value of Consensus::POST_BLOSSOM_POW_TARGET_SPACING was chosen such that this assertion holds."); diff --git a/src/init.cpp b/src/init.cpp index e6e4944ee..e375ab166 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -712,8 +712,8 @@ void ThreadStartWalletNotifier() // We know we have the genesis block. assert(pindexFork != nullptr); - if (pindexLastTip->nHeight < pindexFork->nHeight || - pindexLastTip->nHeight - pindexFork->nHeight < 100) + if ((pindexLastTip->nHeight < pindexFork->nHeight || pindexLastTip->nHeight - pindexFork->nHeight < 100) && + !pindexLastTip->GetBlockPos().IsNull()) { break; } diff --git a/src/main.cpp b/src/main.cpp index 896c6adc0..77204f6a1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2241,6 +2241,11 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos, const Consensus: bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus::Params& consensusParams) { + if (pindex->GetBlockPos().IsNull()) { + return error("ReadBlockFromDisk(CBlock&, CBlockIndex*): block index entry does not provide a valid disk position for block %s at %s", + pindex->ToString(), pindex->GetBlockPos().ToString()); + } + if (!ReadBlockFromDisk(block, pindex->GetBlockPos(), consensusParams)) return false; if (block.GetHash() != pindex->GetBlockHash()) @@ -3060,12 +3065,30 @@ static bool ShouldCheckTransactions(const CChainParams& chainparams, const CBloc bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, const CChainParams& chainparams, - bool fJustCheck, bool fCheckAuthDataRoot) + bool fJustCheck, CheckAs blockChecks) { AssertLockHeld(cs_main); + bool fCheckAuthDataRoot = true; bool fExpensiveChecks = true; + switch (blockChecks) { + case CheckAs::Block: + break; + case CheckAs::BlockTemplate: + // Disable checking proofs and signatures for block templates, to avoid + // checking them twice for transactions that were already checked when + // added to the mempool. + fExpensiveChecks = false; + case CheckAs::SlowBenchmark: + // Disable checking the authDataRoot for block templates and slow block + // benchmarks. + fCheckAuthDataRoot = false; + break; + default: + assert(false); + } + // If this block is an ancestor of a checkpoint, disable expensive checks if (fCheckpointsEnabled && Checkpoints::IsAncestorOfLastCheckpoint(chainparams.Checkpoints(), pindex)) { fExpensiveChecks = false; @@ -3618,14 +3641,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin int64_t nTime3 = GetTimeMicros(); nTimeIndex += nTime3 - nTime2; LogPrint("bench", " - Index writing: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeIndex * 0.000001); - // Watch for changes to the previous coinbase transaction. - static uint256 hashPrevBestCoinBase; - GetMainSignals().UpdatedTransaction(hashPrevBestCoinBase); - hashPrevBestCoinBase = block.vtx[0].GetHash(); - - int64_t nTime4 = GetTimeMicros(); nTimeCallbacks += nTime4 - nTime3; - LogPrint("bench", " - Callbacks: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeCallbacks * 0.000001); - return true; } @@ -5090,7 +5105,10 @@ bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, c * This is only invoked by the miner. * The block's proof-of-work is assumed invalid and not checked. */ -bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckMerkleRoot) +bool TestBlockValidity( + CValidationState& state, const CChainParams& chainparams, + const CBlock& block, CBlockIndex* pindexPrev, + bool fIsBlockTemplate) { AssertLockHeld(cs_main); assert(pindexPrev == chainActive.Tip()); @@ -5103,6 +5121,9 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, // JoinSplit proofs are verified in ConnectBlock auto verifier = ProofVerifier::Disabled(); + bool fCheckMerkleRoot = !fIsBlockTemplate; + auto blockChecks = fIsBlockTemplate ? CheckAs::BlockTemplate : CheckAs::Block; + // NOTE: CheckBlockHeader is called by CheckBlock if (!ContextualCheckBlockHeader(block, state, chainparams, pindexPrev)) return false; @@ -5111,7 +5132,7 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, return false; if (!ContextualCheckBlock(block, state, chainparams, pindexPrev, true)) return false; - if (!ConnectBlock(block, state, &indexDummy, viewNew, chainparams, true, fCheckMerkleRoot)) + if (!ConnectBlock(block, state, &indexDummy, viewNew, chainparams, true, blockChecks)) return false; assert(state.IsValid()); diff --git a/src/main.h b/src/main.h index cceb17424..0034a4969 100644 --- a/src/main.h +++ b/src/main.h @@ -561,18 +561,35 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex *pindexPrev, bool fCheckTransactions); +/** + * How a given block should be checked. + * + * - `CheckAs::Block` applies all relevant block checks. + * - `CheckAs::BlockTemplate` is the same as `CheckAs::Block` except that proofs + * and signatures are not validated, and the authDataRoot is not checked (as + * the coinbase transaction is not fully complete). + * - `CheckAs::SlowBenchmark` is the same as `CheckAs::Block` except that the + * authDataRoot is not checked (as the required history tree state is not + * currently faked). + */ +enum class CheckAs { + Block, + BlockTemplate, + SlowBenchmark, +}; + /** Apply the effects of this block (with given index) on the UTXO set represented by coins. * Validity checks that depend on the UTXO set are also done; ConnectBlock() * can fail if those validity checks fail (among other reasons). */ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, const CChainParams& chainparams, - bool fJustCheck = false, bool fCheckAuthDataRoot = true); + bool fJustCheck = false, CheckAs blockChecks = CheckAs::Block); /** * Check a block is completely valid from start to finish (only works on top * of our current best block, with cs_main held) */ -bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckMerkleRoot); +bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fIsBlockTemplate); /** diff --git a/src/miner.cpp b/src/miner.cpp index e4c757fd3..cd8102ac2 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -769,7 +769,7 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const MinerAddre pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); CValidationState state; - if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false)) + if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, true)) throw std::runtime_error(std::string("CreateNewBlock(): TestBlockValidity failed: ") + state.GetRejectReason()); } diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 083be8bc2..3ca7dac28 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -561,7 +561,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return "inconclusive-not-best-prevblk"; CValidationState state; - TestBlockValidity(state, Params(), block, pindexPrev, true); + TestBlockValidity(state, Params(), block, pindexPrev, false); return BIP22ValidationResult(state); } } diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index a53efd9f2..52db414c8 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -250,6 +250,11 @@ void ThreadNotifyWallets(CBlockIndex *pindexLastTip) // exploitable as a timing channel. GetMainSignals().ChainTip(blockData.pindex, &block, blockData.oldTrees); + // Notify UI to display prev block's coinbase if it was ours. + static uint256 hashPrevBestCoinBase; + GetMainSignals().UpdatedTransaction(hashPrevBestCoinBase); + hashPrevBestCoinBase = block.vtx[0].GetHash(); + // This block is done! pindexLastTip = blockData.pindex; } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 268473e8f..679cdd6b0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2693,7 +2693,12 @@ void CWallet::IncrementNoteWitnesses( // If we're at or beyond NU5 activation, update the Orchard note commitment tree. if (performOrchardWalletUpdates && consensus.NetworkUpgradeActive(pindex->nHeight, Consensus::UPGRADE_NU5)) { assert(orchardWallet.AppendNoteCommitments(pindex->nHeight, *pblock)); - assert(pindex->hashFinalOrchardRoot == orchardWallet.GetLatestAnchor()); + // This assertion slows scanning for blocks with few shielded transactions by an + // order of magnitude. It is only intended as a consistency check between the node + // and wallet computing trees. Commented out until we have figured out what is + // causing the slowness and fixed it. + // https://github.com/zcash/zcash/issues/6052 + //assert(pindex->hashFinalOrchardRoot == orchardWallet.GetLatestAnchor()); } // Update witness heights diff --git a/src/zcbenchmarks.cpp b/src/zcbenchmarks.cpp index 2306ba128..8ed2b907a 100644 --- a/src/zcbenchmarks.cpp +++ b/src/zcbenchmarks.cpp @@ -645,7 +645,7 @@ double benchmark_connectblock_sapling() CValidationState state; struct timeval tv_start; timer_start(tv_start); - assert(ConnectBlock(block, state, &index, view, Params(), true, false)); + assert(ConnectBlock(block, state, &index, view, Params(), true, CheckAs::SlowBenchmark)); auto duration = timer_stop(tv_start); // Undo alterations to global state @@ -691,7 +691,7 @@ double benchmark_connectblock_orchard() CValidationState state; struct timeval tv_start; timer_start(tv_start); - assert(ConnectBlock(block, state, &index, view, Params(), true, false)); + assert(ConnectBlock(block, state, &index, view, Params(), true, CheckAs::SlowBenchmark)); auto duration = timer_stop(tv_start); // Undo alterations to global state