Merge pull request #5814 from daira/backports-v4.6.0-2

Backports for hotfix v4.6.0-2
This commit is contained in:
str4d 2022-04-04 22:34:58 +01:00 committed by GitHub
commit 86e36b941b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 127 additions and 63 deletions

View File

@ -70,19 +70,19 @@ jobs:
if: always()
rust-clippy:
name: Clippy (1.54.0)
name: Clippy (1.59.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.54.0
toolchain: 1.59.0
components: clippy
override: true
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
name: Clippy (1.54.0)
name: Clippy (1.59.0)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
@ -93,7 +93,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.54.0
toolchain: 1.59.0
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1

1
Cargo.lock generated
View File

@ -815,6 +815,7 @@ dependencies = [
"zcash_note_encryption",
"zcash_primitives",
"zcash_proofs",
"zeroize",
]
[[package]]

View File

@ -18,7 +18,7 @@ repository = "https://github.com/zcash/zcash"
readme = "README.md"
license = "MIT OR Apache-2.0"
edition = "2018"
rust-version = "1.56"
rust-version = "1.59"
[lib]
name = "rustzcash"
@ -49,6 +49,7 @@ zcash_note_encryption = "0.1"
zcash_primitives = "0.5"
zcash_proofs = "0.5"
ed25519-zebra = "3"
zeroize = "1.4.2"
# Metrics
hyper = { version = "=0.14.2", default-features = false, features = ["server", "tcp", "http1"] }

View File

@ -1,4 +1,4 @@
FROM debian:10
FROM debian:11
RUN apt-get update \
&& apt-get install -y gnupg2 apt-transport-https curl

View File

@ -3,8 +3,8 @@ name: "zcash-4.6.0-1"
enable_cache: true
distro: "debian"
suites:
- "stretch"
- "buster"
- "bullseye"
architectures:
- "amd64"
packages:

View File

@ -8,10 +8,10 @@ ifneq ($(host_os),mingw32)
$(package)_download_path=$(native_clang_download_path)
$(package)_download_file_aarch64_linux=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_file_name_aarch64_linux=clang-llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_sha256_hash_aarch64_linux=968d65d2593850ee9b37fcda074fb7641529bd45d2f976af6c8197de3c22612f
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_sha256_hash_linux=76d0bf002ede7a893f69d9ad2c4e101d15a8f4186fbfe24e74856c8449acd7c1
$(package)_sha256_hash_aarch64_linux=15ff2db12683e69e552b6668f7ca49edaa01ce32cb1cbc8f8ed2e887ab291069
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_sha256_hash_linux=84a54c69781ad90615d1b0276a83ff87daaeded99fbc64457c350679df7b4ff0
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib && \
@ -21,6 +21,7 @@ endef
else
# For Windows cross-compilation, use the MSYS2 binaries.
# Using 13.0.0-3 because 13.0.1-1 has missing `new` and `delete` symbols.
$(package)_download_path=https://repo.msys2.org/mingw/x86_64
$(package)_download_file=mingw-w64-x86_64-libc++-13.0.0-3-any.pkg.tar.zst
$(package)_file_name=mingw-w64-x86_64-libcxx-13.0.0-3-any.pkg.tar.zst

View File

@ -1,22 +1,26 @@
package=native_clang
$(package)_major_version=13
$(package)_version=13.0.0
$(package)_version=13.0.1
$(package)_download_path=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
$(package)_download_path_linux=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_sha256_hash_linux=76d0bf002ede7a893f69d9ad2c4e101d15a8f4186fbfe24e74856c8449acd7c1
$(package)_download_path_darwin=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_major_version).0.0
$(package)_download_file_darwin=clang+llvm-$($(package)_major_version).0.0-x86_64-apple-darwin.tar.xz
$(package)_file_name_darwin=clang-llvm-$($(package)_major_version).0.0-x86_64-apple-darwin.tar.xz
$(package)_sha256_hash_darwin=d051234eca1db1f5e4bc08c64937c879c7098900f7a0370f3ceb7544816a8b09
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$(package)_sha256_hash_linux=84a54c69781ad90615d1b0276a83ff87daaeded99fbc64457c350679df7b4ff0
$(package)_download_path_darwin=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
$(package)_download_file_darwin=clang+llvm-$($(package)_version)-x86_64-apple-darwin.tar.xz
$(package)_file_name_darwin=clang-llvm-$($(package)_version)-x86_64-apple-darwin.tar.xz
$(package)_sha256_hash_darwin=dec02d17698514d0fc7ace8869c38937851c542b02adf102c4e898f027145a4d
$(package)_download_path_freebsd=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
$(package)_download_file_freebsd=clang+llvm-$($(package)_version)-amd64-unknown-freebsd12.tar.xz
$(package)_file_name_freebsd=clang-llvm-$($(package)_version)-amd64-unknown-freebsd12.tar.xz
$(package)_sha256_hash_freebsd=e579747a36ff78aa0a5533fe43bc1ed1f8ed449c9bfec43c358d953ffbbdcf76
$(package)_sha256_hash_freebsd=8101c8d3a920bf930b33987ada5373f43537c5de8c194be0ea10530fd0ad5617
$(package)_download_file_aarch64_linux=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_file_name_aarch64_linux=clang-llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_sha256_hash_aarch64_linux=968d65d2593850ee9b37fcda074fb7641529bd45d2f976af6c8197de3c22612f
$(package)_sha256_hash_aarch64_linux=15ff2db12683e69e552b6668f7ca49edaa01ce32cb1cbc8f8ed2e887ab291069
ifneq (,$(wildcard /etc/arch-release))
$(package)_dependencies=native_libtinfo
endif
# Ensure we have clang native to the builder, not the target host
ifneq ($(canonical_host),$(build))

View File

@ -0,0 +1,22 @@
package=native_tinfo
$(package)_version=5.6.0
$(package)_download_path_linux=http://ftp.debian.org/debian/pool/main/n/ncurses/
$(package)_download_file_linux=libtinfo5_6.0+20161126-1+deb9u2_amd64.deb
$(package)_file_name_linux=libtinfo5_6.0+20161126-1+deb9u2_amd64.deb
$(package)_sha256_hash_linux=1d249a3193568b5ef785ad8993b9ba6d6fdca0eb359204c2355532b82d25e9f5
define $(package)_extract_cmds
mkdir -p $($(package)_extract_dir) && \
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
mkdir -p libtinfo5 && \
ar x --output libtinfo5 $($(package)_source_dir)/$($(package)_file_name) && \
cd libtinfo5 && \
tar xf data.tar.xz
endef
define $(package)_stage_cmds
pwd && \
mkdir -p $($(package)_staging_prefix_dir)/lib && \
cp libtinfo5/lib/x86_64-linux-gnu/libtinfo.so.5.9 $($(package)_staging_prefix_dir)/lib/libtinfo.so.5
endef

View File

@ -1,14 +1,14 @@
package=native_rust
$(package)_version=1.57.0
$(package)_version=1.59.0
$(package)_download_path=https://static.rust-lang.org/dist
$(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
$(package)_sha256_hash_linux=ea0253784b2e5c22659ff148d492a68d2e11da734491714ebc61cc93896efcda
$(package)_sha256_hash_linux=0c1c2da3fa26372e5178123aa5bb0fdcd4933fbad9bfb268ffbd71807182ecae
$(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
$(package)_sha256_hash_darwin=15ceffc4743434c19d08f73fb4edd6642b7fd8162ed7101d3e6ca2c691fcb699
$(package)_sha256_hash_darwin=d82204f536af0c7bfd2ea2213dc46b99911860cfc5517f7321244412ae96f159
$(package)_file_name_freebsd=rust-$($(package)_version)-x86_64-unknown-freebsd.tar.gz
$(package)_sha256_hash_freebsd=ebe96fa1f15e8d70c91e81aab7e0c341717b909225029f37d52fbdfa506e3fab
$(package)_sha256_hash_freebsd=83f9c49b6e9025b712fc5d65e49f1b6ad959966534cd39c8dc2ce2c85a6ca484
$(package)_file_name_aarch64_linux=rust-$($(package)_version)-aarch64-unknown-linux-gnu.tar.gz
$(package)_sha256_hash_aarch64_linux=d66847f7cf7b548ecb328c400ac4f691ee2aea6ff5cd9286ad8733239569556c
$(package)_sha256_hash_aarch64_linux=ab5da30a3de5433e26cbc74c56b9d97b569769fc2e456fc54378adc8baaee4f0
# Mapping from GCC canonical hosts to Rust targets
# If a mapping is not present, we assume they are identical, unless $host_os is
@ -17,10 +17,10 @@ $(package)_rust_target_x86_64-pc-linux-gnu=x86_64-unknown-linux-gnu
$(package)_rust_target_x86_64-w64-mingw32=x86_64-pc-windows-gnu
# Mapping from Rust targets to SHA-256 hashes
$(package)_rust_std_sha256_hash_aarch64-unknown-linux-gnu=4c70901d1cbddec9ea99fbd62b20f454d30e1ffbb48a21169ac823b3f02a1fbc
$(package)_rust_std_sha256_hash_x86_64-apple-darwin=c1eb892ddb50ebeed288b7aa8171ad46d62362bb26b2d82d2b463dfd45606dc2
$(package)_rust_std_sha256_hash_x86_64-pc-windows-gnu=75c910899ed36a90b155e3a01c21b863000675867efc56f2b68c44edd4b7e18c
$(package)_rust_std_sha256_hash_x86_64-unknown-freebsd=1528a4bc7e3ba42da164bcc7b952dfa73048333c5b9254ce2d03db6bab6081e8
$(package)_rust_std_sha256_hash_aarch64-unknown-linux-gnu=81dbd37919f631f962ac0798111803eb8f06ffde608f0e5dd3682d701cf5566d
$(package)_rust_std_sha256_hash_x86_64-apple-darwin=959af8bafbc9f3916a1d1111d7378fdd7aa459410cdd2d3bbfc2d9d9a6db0683
$(package)_rust_std_sha256_hash_x86_64-pc-windows-gnu=9a67ae84e9e75efb57eeeab617e32379a555de336a30bb74a476e575cd38f63a
$(package)_rust_std_sha256_hash_x86_64-unknown-freebsd=cf5e4303dd7c3b70a738a2336097c9f2189c8b702a89a8c453d83ac0dee4602c
define rust_target
$(if $($(1)_rust_target_$(2)),$($(1)_rust_target_$(2)),$(if $(findstring darwin,$(3)),x86_64-apple-darwin,$(if $(findstring freebsd,$(3)),x86_64-unknown-freebsd,$(2))))

View File

@ -2,6 +2,10 @@ zcash_packages := libsodium utfcpp
packages := boost libevent zeromq $(zcash_packages) googletest
native_packages := native_clang native_ccache native_rust
ifneq (,$(wildcard /etc/arch-release))
native_packages += native_libtinfo
endif
wallet_packages=bdb
$(host_arch)_$(host_os)_native_packages += native_b2

View File

@ -5,23 +5,27 @@
#
# Ccache 4.0 requires adding CMake to the depends system.
native_ccache 4.0 2022-02-01
native_ccache 4.1 2022-02-01
native_ccache 4.2 2022-02-01
native_ccache 4.2.1 2022-02-01
native_ccache 4.3 2022-02-01
native_ccache 4.4 2022-02-01
native_ccache 4.4.1 2022-02-01
native_ccache 4.4.2 2022-02-01
native_ccache 4.5 2022-02-01
native_ccache 4.5.1 2022-02-01
native_ccache 4.0 2022-05-01
native_ccache 4.1 2022-05-01
native_ccache 4.2 2022-05-01
native_ccache 4.2.1 2022-05-01
native_ccache 4.3 2022-05-01
native_ccache 4.4 2022-05-01
native_ccache 4.4.1 2022-05-01
native_ccache 4.4.2 2022-05-01
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
native_clang 14.0.0 2022-05-01
libcxx 14.0.0 2022-05-01
# Rust is currently pinned to 1.56.1
# Rust is currently pinned to 1.59.0
bdb 18.1.40 2022-02-01
# We're never updating to this version
bdb 18.1.40 2024-02-01
# Google Test 1.10.0 requires adding CMake to the depends system.
googletest 1.10.0 2022-02-01
googletest 1.11.0 2022-02-01
googletest 1.10.0 2022-05-01
googletest 1.11.0 2022-05-01

View File

@ -199,6 +199,8 @@ class GithubTagReleaseLister:
url = "https://api.github.com/repos/" + safe(self.org) + "/" + safe(self.repo) + "/git/refs/tags"
r = requests.get(url, auth=requests.auth.HTTPBasicAuth(self.token.user(), self.token.password()))
if r.status_code != 200:
print("API request failed (error %d)" % (r.status_code,), file=sys.stderr)
print(r.text, file=sys.stderr)
raise RuntimeError("Request to GitHub tag API failed.")
json = r.json()
return list(map(lambda t: t["ref"].split("/")[-1], json))
@ -208,6 +210,8 @@ class BerkeleyDbReleaseLister:
url = "https://www.oracle.com/database/technologies/related/berkeleydb-downloads.html"
r = requests.get(url)
if r.status_code != 200:
print("API request failed (error %d)" % (r.status_code,), file=sys.stderr)
print(r.text, file=sys.stderr)
raise RuntimeError("Request to Berkeley DB download directory failed.")
page = r.text
@ -328,7 +332,9 @@ def main():
# packages.mk is not a dependency, it just specifies the list of them all.
"packages",
# This package doesn't have conventional version numbers
"native_cctools"
"native_cctools",
# This package is pinned specifically for Arch.
"native_libtinfo",
]
print_row("NAME", "STATUS", "CURRENT VERSION", "NEWER VERSIONS")

View File

@ -1 +1 @@
1.56.1
1.59.0

View File

@ -305,7 +305,7 @@ bool static Bind(const CService &addr, unsigned int flags) {
void OnRPCStopped()
{
cvBlockChange.notify_all();
g_best_block_cv.notify_all();
LogPrint("rpc", "RPC stopped.\n");
}

View File

@ -66,8 +66,10 @@ BlockMap mapBlockIndex;
CChain chainActive;
CBlockIndex *pindexBestHeader = NULL;
static std::atomic<int64_t> nTimeBestReceived(0); // Used only to inform the wallet of when we last received a block
CWaitableCriticalSection csBestBlock;
CConditionVariable cvBlockChange;
CWaitableCriticalSection g_best_block_mutex;
CConditionVariable g_best_block_cv;
uint256 g_best_block;
int g_best_block_height;
int nScriptCheckThreads = 0;
std::atomic_bool fImporting(false);
std::atomic_bool fReindex(false);
@ -3757,7 +3759,12 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) {
RenderPoolMetrics("sapling", saplingPool);
RenderPoolMetrics("transparent", transparentPool);
cvBlockChange.notify_all();
{
boost::unique_lock<boost::mutex> lock(g_best_block_mutex);
g_best_block = pindexNew->GetBlockHash();
g_best_block_height = pindexNew->nHeight;
g_best_block_cv.notify_all();
}
}
/**

View File

@ -160,8 +160,19 @@ extern BlockMap mapBlockIndex;
extern std::optional<uint64_t> last_block_num_txs;
extern std::optional<uint64_t> last_block_size;
extern const std::string strMessageMagic;
extern CWaitableCriticalSection csBestBlock;
extern CConditionVariable cvBlockChange;
//! These four variables are used to notify getblocktemplate RPC of new tips.
//! When UpdateTip() establishes a new tip (best block), it must awaken a
//! waiting getblocktemplate RPC (if there is one) immediately. But upon waking
//! up, getblocktemplate cannot call chainActive->Tip() because it does not
//! (and cannot) hold cs_main. So the g_best_block_height and g_best_block variables
//! (protected by g_best_block_mutex) provide the needed height and block
//! hash respectively to getblocktemplate without it requiring cs_main.
extern CWaitableCriticalSection g_best_block_mutex;
extern CConditionVariable g_best_block_cv;
extern int g_best_block_height;
extern uint256 g_best_block;
extern std::atomic_bool fImporting;
extern std::atomic_bool fReindex;
extern int nScriptCheckThreads;

View File

@ -607,15 +607,15 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
nTransactionsUpdatedLastLP = nTransactionsUpdatedLast;
}
// Release the main lock while waiting
// Don't call chainActive->Tip() without holding cs_main
LEAVE_CRITICAL_SECTION(cs_main);
{
checktxtime = boost::get_system_time() + boost::posix_time::seconds(10);
boost::unique_lock<boost::mutex> lock(csBestBlock);
while (chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning())
boost::unique_lock<boost::mutex> lock(g_best_block_mutex);
while (g_best_block == hashWatchedChain && IsRPCRunning())
{
// Release the main lock while waiting
LEAVE_CRITICAL_SECTION(cs_main);
// Before waiting, generate the coinbase for the block following the next
// block (since this is cpu-intensive), so that when next block arrives,
// we can quickly respond with a template for following block.
@ -628,12 +628,11 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
Params(), CAmount{0}, minerAddress, cached_next_cb_height);
next_cb_mtx = cached_next_cb_mtx;
}
bool timedout = !cvBlockChange.timed_wait(lock, checktxtime);
ENTER_CRITICAL_SECTION(cs_main);
bool timedout = !g_best_block_cv.timed_wait(lock, checktxtime);
// Optimization: even if timed out, a new block may have arrived
// while waiting for cs_main; if so, don't discard next_cb_mtx.
if (chainActive.Tip()->GetBlockHash() != hashWatchedChain) break;
if (g_best_block != hashWatchedChain) break;
// Timeout: Check transactions for update
if (timedout && mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP) {
@ -643,11 +642,12 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
}
checktxtime += boost::posix_time::seconds(10);
}
if (chainActive.Tip()->nHeight != nHeight + 1) {
if (g_best_block_height != nHeight + 1) {
// Unexpected height (reorg or >1 blocks arrived while waiting) invalidates coinbase tx.
next_cb_mtx = nullopt;
}
}
ENTER_CRITICAL_SECTION(cs_main);
if (!IsRPCRunning())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Shutting down");

View File

@ -156,7 +156,7 @@ pub extern "C" fn librustzcash_init_zksnark_params(
let (spend_path, output_path, sprout_path) = (
Path::new(&spend_path),
Path::new(&output_path),
sprout_path.as_ref().map(|p| Path::new(p)),
sprout_path.as_ref().map(Path::new),
);
// Load params

View File

@ -4,6 +4,7 @@ use std::{
ffi::{CStr, CString},
ptr, slice,
};
use zeroize::Zeroize;
use zcash_primitives::zip339;
@ -63,7 +64,9 @@ pub extern "C" fn zip339_free_phrase(phrase: *const c_char) {
if !phrase.is_null() {
unsafe {
// It is correct to cast away const here; the memory is not actually immutable.
CString::from_raw(phrase as *mut c_char);
CString::from_raw(phrase as *mut c_char)
.into_bytes()
.zeroize();
}
}
}