diff --git a/.gitignore b/.gitignore index 3402293c6..bc02b55db 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,9 @@ src/config/bitcoin-config.h src/config/bitcoin-config.h.in src/config/stamp-h1 share/setup.nsi +confdefs.h +conftest.cpp +conftest.err cache/ venv-mnf/ diff --git a/contrib/debian/changelog b/contrib/debian/changelog index b8be90536..dcfa9617f 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -1,3 +1,9 @@ +zcash (4.6.0+2) stable; urgency=medium + + * 4.6.0-2 release. + + -- Electric Coin Company Mon, 04 Apr 2022 21:53:34 +0000 + zcash (4.7.0~rc1) stable; urgency=medium * 4.7.0-rc1 release. diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index c5fd9513f..98e1627cd 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -14,7 +14,7 @@ ARG ZCASHD_USER=zcashd ARG ZCASHD_UID=2001 RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $ZCASH_SIGNING_KEY_ID \ - && echo "deb [arch=amd64] https://apt.z.cash/ stretch main" > /etc/apt/sources.list.d/zcash.list \ + && echo "deb [arch=amd64] https://apt.z.cash/ buster main" > /etc/apt/sources.list.d/zcash.list \ && apt-get update RUN if [ -z "$ZCASH_VERSION" ]; \ diff --git a/doc/authors.md b/doc/authors.md index c7d8886dd..7a3b8f066 100644 --- a/doc/authors.md +++ b/doc/authors.md @@ -1,22 +1,22 @@ Zcash Contributors ================== -Jack Grigg (1127) +Jack Grigg (1136) Simon Liu (460) Sean Bowe (367) -Daira Hopwood (270) +Daira Hopwood (274) Eirik Ogilvie-Wigley (216) Kris Nuttycombe (181) Wladimir J. van der Laan (150) Alfredo Garcia (116) -Taylor Hornby (114) +Taylor Hornby (115) Marshall Gaucher (111) -Pieter Wuille (102) +Pieter Wuille (104) Jonas Schnelli (89) Jay Graber (89) Marco Falke (82) Cory Fields (75) -Larry Ruane (72) +Larry Ruane (73) Ying Tong Lai (56) Nathan Wilcox (56) Matt Corallo (52) @@ -38,6 +38,7 @@ Per Grön (14) Benjamin Winston (13) Pavel Janík (12) Patrick Strateman (12) +Charlie O'Keefe (12) Ariel Gabizon (12) Suhas Daftuar (11) Paige Peterson (11) @@ -46,7 +47,6 @@ Alex Morcos (11) Philip Kaufmann (10) Peter Todd (10) João Barbosa (10) -Charlie O'Keefe (10) nomnombtc (9) Marius Kjærstad (9) teor (8) @@ -94,6 +94,7 @@ Danny Willems (3) Anthony Towns (3) Alfie John (3) whythat (2) +sasha (2) rofl0r (2) ptschip (2) noname45688@gmail.com (2) diff --git a/doc/release-notes/release-notes-4.6.0-2.md b/doc/release-notes/release-notes-4.6.0-2.md new file mode 100644 index 000000000..ae6f649f5 --- /dev/null +++ b/doc/release-notes/release-notes-4.6.0-2.md @@ -0,0 +1,47 @@ +This is a bugfix release that also bumps the End-of-Support height to May 16th. +It backports bugfixes from v4.7.0-rc1, including a `getblocktemplate` deadlock +fix, and several portability fixes. + +Debian 9 "Stretch" is no longer supported from v4.6.0-2, due to its +[end-of-life](https://wiki.debian.org/LTS/Stretch) on June 30th, 2022. This will +allow us to direct more resources to supporting Debian 11 Bullseye, other Linux +distributions, and other platforms such as Windows and macOS. + +Changelog +========= + +Charlie O'Keefe (2): + Update base image used by Dockerfile from debian 10 to debian 11 + Remove stretch (debian 9), add bullseye (debian 11) in gitian descriptor + +Daira Hopwood (4): + Avoid a warning by explicitly calling drop. + Replace call to drop with zeroization. + qa/zcash/updatecheck.py: print status code and response of failed http requests. + Postpone native_clang and libcxx 14.0.0. + +Jack Grigg (9): + qa: Bump all postponed dependencies + qa: Postpone recent CCache release + depends: Update Rust to 1.59.0 + depends: Update Clang / libcxx to LLVM 13.0.1 + rust: Fix clippy lint + depends: Revert to `libc++ 13.0.0-3` for Windows cross-compile + qa: Exclude `native_libtinfo` from dependency update checks + make-release.py: Versioning changes for 4.6.0-2. + make-release.py: Updated manpages for 4.6.0-2. + +Larry Ruane (1): + document global variables + +Pieter Wuille (2): + Fix csBestBlock/cvBlockChange waiting in rpc/mining + Modernize best block mutex/cv/hash variable naming + +Taylor Hornby (1): + Untested, not working yet, use libtinfo from the debian packages + +sasha (2): + on Arch only, use Debian's libtinfo5_6.0 to satisfy clang + remove superfluous space at end of native_packages line + diff --git a/qa/zcash/postponed-updates.txt b/qa/zcash/postponed-updates.txt index bf08d9635..410b33578 100644 --- a/qa/zcash/postponed-updates.txt +++ b/qa/zcash/postponed-updates.txt @@ -17,11 +17,10 @@ native_ccache 4.5 2022-05-01 native_ccache 4.5.1 2022-05-01 native_ccache 4.6 2022-05-01 -# Clang is currently pinned to LLVM 13 +# Clang and Rust are currently pinned to LLVM 13 native_clang 14.0.0 2022-05-01 libcxx 14.0.0 2022-05-01 - -# Rust is currently pinned to 1.59.0 +native_rust 1.60.0 2022-05-01 # We're never updating to this version bdb 18.1.40 2024-02-01 diff --git a/src/deprecation.h b/src/deprecation.h index baece6442..bbf30e890 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 = 1504042; +static const int APPROX_RELEASE_HEIGHT = 1540976; 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/gtest/test_keystore.cpp b/src/gtest/test_keystore.cpp index 342e274b5..64e3ea97d 100644 --- a/src/gtest/test_keystore.cpp +++ b/src/gtest/test_keystore.cpp @@ -359,15 +359,14 @@ TEST(KeystoreTests, StoreAndRetrieveMnemonicSeedInEncryptedStore) { seedOut = keyStore.GetMnemonicSeed(); EXPECT_FALSE(seedOut.has_value()); - // Unlocking with a random key should fail - CKeyingMaterial vRandomKey(32, 0); - GetRandBytes(vRandomKey.data(), 32); - EXPECT_FALSE(keyStore.Unlock(vRandomKey)); + // Unlocking with a random key causes sporadic failures, since we currently + // don't use an authenticated encryption scheme for CCryptoKeyStore. - // Unlocking with a slightly-modified vMasterKey should fail - CKeyingMaterial vModifiedKey(vMasterKey); - vModifiedKey[0] += 1; - EXPECT_FALSE(keyStore.Unlock(vModifiedKey)); + // Currently, DecryptMnemonicSeed tests if a key is invalid by looking at + // the return value of CBCDecrypt. If keyStore.Unlock is called with an + // invalid key, there's roughly a 257/65536 chance that the padding check + // in CBCDecrypt will pass, in which case DecryptMnemonicSeed then calls + // the deserialization code in mnemonic.h with random data. // Unlocking with vMasterKey should succeed ASSERT_TRUE(keyStore.Unlock(vMasterKey)); diff --git a/src/miner.cpp b/src/miner.cpp index b17980713..600175b14 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -956,7 +956,17 @@ void static BitcoinMiner(const CChainParams& chainparams) // Create new block // unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated(); - CBlockIndex* pindexPrev = chainActive.Tip(); + CBlockIndex* pindexPrev; + { + LOCK(cs_main); + pindexPrev = chainActive.Tip(); + } + + // If we don't have a valid chain tip to work from, wait and try again. + if (pindexPrev == nullptr) { + MilliSleep(1000); + continue; + } unique_ptr pblocktemplate(CreateNewBlock(chainparams, minerAddress)); if (!pblocktemplate.get()) diff --git a/src/wallet/gtest/test_wallet_zkeys.cpp b/src/wallet/gtest/test_wallet_zkeys.cpp index a51ec83f9..5a2ce53da 100644 --- a/src/wallet/gtest/test_wallet_zkeys.cpp +++ b/src/wallet/gtest/test_wallet_zkeys.cpp @@ -67,9 +67,9 @@ TEST(WalletZkeysTest, StoreAndLoadSaplingZkeys) { EXPECT_EQ(1, addrs.count(address)); // Find a diversified address that does not use the same diversifier as the default address. - // By starting our search at `10` we ensure there's no more than a 2^-10 chance that we + // By starting our search at `128` we ensure there's no more than a 2^-128 chance that we // collide with the default diversifier. - libzcash::diversifier_index_t j(10); + libzcash::diversifier_index_t j(128); auto dpa = sk.ToXFVK().FindAddress(j).first; // add the default address @@ -461,11 +461,12 @@ TEST(WalletZkeysTest, WriteCryptedSaplingZkeyDirectToDb) { wallet.GetSaplingPaymentAddresses(addrs); ASSERT_EQ(1, addrs.size()); - // Generate a diversified address different to the default - // If we can't get an early diversified address, we are very unlucky + // Find a diversified address that does not use the same diversifier as the default address. + // By starting our search at `128` we ensure there's no more than a 2^-128 chance that we + // collide with the default diversifier. libzcash::SaplingExtendedSpendingKey extsk; EXPECT_TRUE(wallet.GetSaplingExtendedSpendingKey(address, extsk)); - libzcash::diversifier_index_t j(10); + libzcash::diversifier_index_t j(128); auto dpa = extsk.ToXFVK().FindAddress(j).first; // Add diversified address to the wallet diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 98fd86ce1..04f16cf96 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -522,7 +522,11 @@ std::pair CWallet::GenerateNewUnifie while (true) { auto accountId = hdChain.GetAccountCounter(); auto generated = GenerateUnifiedSpendingKeyForAccount(accountId); - hdChain.IncrementAccountCounter(); + auto account = hdChain.IncrementAccountCounter(); + if (!account.has_value()) { + throw std::runtime_error( + "CWallet::GenerateNewUnifiedSpendingKey(): Already generated the maxiumum number of accounts (2^31 - 2) for this wallet's mnemonic phrase. Congratulations, you need to create a new wallet!"); + } if (generated.has_value()) { // Update the persisted chain information diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index d26d0f3c7..9bec37536 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -11,6 +11,7 @@ #include "key.h" #include "keystore.h" #include "zcash/Address.hpp" +#include "zcash/address/zip32.h" #include #include @@ -103,9 +104,16 @@ public: return accountCounter; } - void IncrementAccountCounter() { - // TODO: We should check for overflow somewhere and handle it. - accountCounter += 1; + /** Increments the account counter by 1 and returns it. Returns std::nullopt + * if the increment operation would cause an overflow. */ + std::optional IncrementAccountCounter() { + auto newAccountCounter = accountCounter + 1; + if (newAccountCounter >= libzcash::ZCASH_LEGACY_ACCOUNT) { + return std::nullopt; + } else { + accountCounter = newAccountCounter; + return newAccountCounter; + } } uint32_t GetLegacyTKeyCounter(bool external) { diff --git a/src/zcash/address/mnemonic.h b/src/zcash/address/mnemonic.h index e93fd6fe4..3b5ed7ed3 100644 --- a/src/zcash/address/mnemonic.h +++ b/src/zcash/address/mnemonic.h @@ -79,7 +79,7 @@ public: READWRITE(mnemonic); language = (Language) language0; if (!SetSeedFromMnemonic()) { - throw std::ios_base::failure("Could not interpret the mnemonic phrase as a valid UTF-8 string."); + throw std::ios_base::failure("Invalid mnemonic phrase or language code."); } } else { uint32_t language0 = (uint32_t) language;