Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop trivial 2022 03 13 #4725

Merged
merged 13 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,17 @@ AX_CHECK_COMPILE_FLAG([-march=armv8-a+crc+crypto],[[ARM_CRC_CXXFLAGS="-march=arm

TEMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $ARM_CRC_CXXFLAGS"
AC_MSG_CHECKING(for ARM CRC32 intrinsics)
AC_MSG_CHECKING(for AArch64 CRC32 intrinsics)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <arm_acle.h>
#include <arm_neon.h>
]],[[
#ifdef __aarch64__
__crc32cb(0, 0); __crc32ch(0, 0); __crc32cw(0, 0); __crc32cd(0, 0);
vmull_p64(0, 0);
#else
#error "crc32c library does not support hardware acceleration on 32-bit ARM"
#endif
]])],
[ AC_MSG_RESULT(yes); enable_arm_crc=yes; ],
[ AC_MSG_RESULT(no)]
Expand Down
7 changes: 5 additions & 2 deletions contrib/macdeploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ Our current macOS SDK
(`Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz`) can be
extracted from
[Xcode_12.1.xip](https://download.developer.apple.com/Developer_Tools/Xcode_12.1/Xcode_12.1.xip).
An Apple ID is needed to download this.
Alternatively, after logging in to your account go to 'Downloads', then 'More'
and look for [`Xcode_12.1`](https://download.developer.apple.com/Developer_Tools/Xcode_12.1/Xcode_12.1.xip).
An Apple ID and cookies enabled for the hostname are needed to download this.
The `sha256sum` of the archive should be `612443b1894b39368a596ea1607f30cbb0481ad44d5e29c75edb71a6d2cf050f`.

After Xcode version 7.x, Apple started shipping the `Xcode.app` in a `.xip`
archive. This makes the SDK less-trivial to extract on non-macOS machines. One
Expand Down Expand Up @@ -80,7 +83,7 @@ and its `libLTO.so` rather than those from `llvmgcc`, as it was originally done

To complicate things further, all builds must target an Apple SDK. These SDKs are free to
download, but not redistributable. To obtain it, register for an Apple Developer Account,
then download [Xcode_11.3.1](https://download.developer.apple.com/Developer_Tools/Xcode_11.3.1/Xcode_11.3.1.xip).
then download [Xcode_12.1](https://download.developer.apple.com/Developer_Tools/Xcode_12.1/Xcode_12.1.xip).

This file is many gigabytes in size, but most (but not all) of what we need is
contained only in a single directory:
Expand Down
4 changes: 1 addition & 3 deletions doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,7 @@ RECURSIVE = YES

EXCLUDE = src/crc32c \
src/leveldb \
src/json \
src/test \
src/qt/test
src/json

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
18 changes: 9 additions & 9 deletions src/crc32c/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

language: cpp
dist: bionic
osx_image: xcode10.3
osx_image: xcode12.5

compiler:
- gcc
Expand All @@ -24,20 +24,20 @@ env:
addons:
apt:
sources:
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- sourceline: 'ppa:ubuntu-toolchain-r/test'
packages:
- clang-9
- clang-12
- cmake
- gcc-9
- g++-9
- gcc-11
- g++-11
- ninja-build
homebrew:
packages:
- cmake
- gcc@9
- llvm@9
- gcc@11
- llvm@12
- ninja
update: true

Expand All @@ -48,14 +48,14 @@ install:
export PATH="$(brew --prefix llvm)/bin:$PATH";
fi
# /usr/bin/gcc points to an older compiler on both Linux and macOS.
- if [ "$CXX" = "g++" ]; then export CXX="g++-9" CC="gcc-9"; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-11" CC="gcc-11"; fi
# /usr/bin/clang points to an older compiler on both Linux and macOS.
#
# Homebrew's llvm package doesn't ship a versioned clang++ binary, so the values
# below don't work on macOS. Fortunately, the path change above makes the
# default values (clang and clang++) resolve to the correct compiler on macOS.
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ "$CXX" = "clang++" ]; then export CXX="clang++-9" CC="clang-9"; fi;
if [ "$CXX" = "clang++" ]; then export CXX="clang++-12" CC="clang-12"; fi;
fi
- echo ${CC}
- echo ${CXX}
Expand Down
4 changes: 2 additions & 2 deletions src/crc32c/.ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"""YouCompleteMe configuration that interprets a .clang_complete file.

This module implementes the YouCompleteMe configuration API documented at:
https://github.com/Valloric/ycmd#ycm_extra_confpy-specification
https://github.com/ycm-core/ycmd#ycm_extra_confpy-specification

The implementation loads and processes a .clang_complete file, documented at:
https://github.com/Rip-Rip/clang_complete/blob/master/README.md
https://github.com/xavierd/clang_complete/blob/master/README.md
"""

import os
Expand Down
2 changes: 1 addition & 1 deletion src/crc32c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ apm install autocomplete-clang build build-cmake clang-format language-cmake \

If you don't mind more setup in return for more speed, replace
`autocomplete-clang` and `linter-clang` with `you-complete-me`. This requires
[setting up ycmd](https://github.com/Valloric/ycmd#building).
[setting up ycmd](https://github.com/ycm-core/ycmd#building).

```bash
apm install autocomplete-plus build build-cmake clang-format language-cmake \
Expand Down
10 changes: 9 additions & 1 deletion src/crc32c/src/crc32c_arm64_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ inline bool CanUseArm64Crc32() {
// From 'arch/arm64/include/uapi/asm/hwcap.h' in Linux kernel source code.
constexpr unsigned long kHWCAP_PMULL = 1 << 4;
constexpr unsigned long kHWCAP_CRC32 = 1 << 7;
unsigned long hwcap = (&getauxval != nullptr) ? getauxval(AT_HWCAP) : 0;
unsigned long hwcap =
#if HAVE_STRONG_GETAUXVAL
// Some compilers warn on (&getauxval != nullptr) in the block below.
getauxval(AT_HWCAP);
#elif HAVE_WEAK_GETAUXVAL
(&getauxval != nullptr) ? getauxval(AT_HWCAP) : 0;
#else
#error This is supposed to be nested inside a check for HAVE_*_GETAUXVAL.
#endif // HAVE_STRONG_GETAUXVAL
return (hwcap & (kHWCAP_PMULL | kHWCAP_CRC32)) ==
(kHWCAP_PMULL | kHWCAP_CRC32);
#elif defined(__APPLE__)
Expand Down
4 changes: 4 additions & 0 deletions src/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ void ofstream::close()
}
#else // __GLIBCXX__

#if BOOST_VERSION >= 107700
static_assert(sizeof(*BOOST_FILESYSTEM_C_STR(fs::path())) == sizeof(wchar_t),
#else
static_assert(sizeof(*fs::path().BOOST_FILESYSTEM_C_STR) == sizeof(wchar_t),
#endif // BOOST_VERSION >= 107700
"Warning: This build is using boost::filesystem ofstream and ifstream "
"implementations which will fail to open paths containing multibyte "
"characters. You should delete this static_assert to ignore this warning, "
Expand Down
5 changes: 1 addition & 4 deletions src/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ unsigned int MurmurHash3(unsigned int nHashSeed, Span<const unsigned char> vData
void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64])
{
unsigned char num[4];
num[0] = (nChild >> 24) & 0xFF;
num[1] = (nChild >> 16) & 0xFF;
num[2] = (nChild >> 8) & 0xFF;
num[3] = (nChild >> 0) & 0xFF;
WriteBE32(num, nChild);
CHMAC_SHA512(chainCode.begin(), chainCode.size()).Write(&header, 1).Write(data, 32).Write(num, 4).Finalize(output);
}
5 changes: 2 additions & 3 deletions src/key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ CExtPubKey CExtKey::Neuter() const {
void CExtKey::Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const {
code[0] = nDepth;
memcpy(code+1, vchFingerprint, 4);
code[5] = (nChild >> 24) & 0xFF; code[6] = (nChild >> 16) & 0xFF;
code[7] = (nChild >> 8) & 0xFF; code[8] = (nChild >> 0) & 0xFF;
WriteBE32(code+5, nChild);
memcpy(code+9, chaincode.begin(), 32);
code[41] = 0;
assert(key.size() == 32);
Expand All @@ -333,7 +332,7 @@ void CExtKey::Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const {
void CExtKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) {
nDepth = code[0];
memcpy(vchFingerprint, code+1, 4);
nChild = (code[5] << 24) | (code[6] << 16) | (code[7] << 8) | code[8];
nChild = ReadBE32(code+5);
memcpy(chaincode.begin(), code+9, 32);
key.Set(code+42, code+BIP32_EXTKEY_SIZE, true);
}
Expand Down
1 change: 0 additions & 1 deletion src/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


/**
* secure_allocator is defined in allocators.h
* CPrivKey is a serialized private key, with all parameters included
* (SIZE bytes)
*/
Expand Down
22 changes: 10 additions & 12 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
static int GetnScore(const CService& addr)
{
LOCK(cs_mapLocalHost);
if (mapLocalHost.count(addr) == 0) return 0;
return mapLocalHost[addr].nScore;
const auto it = mapLocalHost.find(addr);
return (it != mapLocalHost.end()) ? it->second.nScore : 0;
}

// Is our peer's addrLocal potentially useful as an external IP source?
Expand Down Expand Up @@ -238,10 +238,10 @@ bool AddLocal(const CService& addr, int nScore)

{
LOCK(cs_mapLocalHost);
bool fAlready = mapLocalHost.count(addr) > 0;
LocalServiceInfo &info = mapLocalHost[addr];
if (!fAlready || nScore >= info.nScore) {
info.nScore = nScore + (fAlready ? 1 : 0);
const auto [it, is_newly_added] = mapLocalHost.emplace(addr, LocalServiceInfo());
LocalServiceInfo &info = it->second;
if (is_newly_added || nScore >= info.nScore) {
info.nScore = nScore + (is_newly_added ? 0 : 1);
info.nPort = addr.GetPort();
}
}
Expand Down Expand Up @@ -283,12 +283,10 @@ bool IsReachable(const CNetAddr &addr)
/** vote for a local address */
bool SeenLocal(const CService& addr)
{
{
LOCK(cs_mapLocalHost);
if (mapLocalHost.count(addr) == 0)
return false;
mapLocalHost[addr].nScore++;
}
LOCK(cs_mapLocalHost);
const auto it = mapLocalHost.find(addr);
if (it == mapLocalHost.end()) return false;
++it->second.nScore;
return true;
}

Expand Down
5 changes: 2 additions & 3 deletions src/pubkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChi
void CExtPubKey::Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const {
code[0] = nDepth;
memcpy(code+1, vchFingerprint, 4);
code[5] = (nChild >> 24) & 0xFF; code[6] = (nChild >> 16) & 0xFF;
code[7] = (nChild >> 8) & 0xFF; code[8] = (nChild >> 0) & 0xFF;
WriteBE32(code+5, nChild);
memcpy(code+9, chaincode.begin(), 32);
assert(pubkey.size() == CPubKey::COMPRESSED_SIZE);
memcpy(code+41, pubkey.begin(), CPubKey::COMPRESSED_SIZE);
Expand All @@ -263,7 +262,7 @@ void CExtPubKey::Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const {
void CExtPubKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) {
nDepth = code[0];
memcpy(vchFingerprint, code+1, 4);
nChild = (code[5] << 24) | (code[6] << 16) | (code[7] << 8) | code[8];
nChild = ReadBE32(code+5);
memcpy(chaincode.begin(), code+9, 32);
pubkey.Set(code+41, code+BIP32_EXTKEY_SIZE);
}
Expand Down
4 changes: 0 additions & 4 deletions src/test/fuzz/integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ void test_one_input(const std::vector<uint8_t>& buffer)
const unsigned char uch = static_cast<unsigned char>(u8);
(void)memusage::DynamicUsage(uch);
(void)MillisToTimeval(i64);
const double d = ser_uint64_to_double(u64);
assert(ser_double_to_uint64(d) == u64);
const float f = ser_uint32_to_float(u32);
assert(ser_float_to_uint32(f) == u32);
(void)SighashToStr(uch);
(void)SipHashUint256(u64, u64, u256);
(void)SipHashUint256Extra(u64, u64, u256, u32);
Expand Down
4 changes: 4 additions & 0 deletions src/util/getuniquepath.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <random.h>
#include <fs.h>
#include <util/strencodings.h>
Expand Down
2 changes: 1 addition & 1 deletion src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ void SetupEnvironment()
#endif
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
try {
std::locale(""); // Raises a runtime error if current locale is invalid
} catch (const std::runtime_error&) {
Expand Down
4 changes: 4 additions & 0 deletions src/wallet/test/db_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ BOOST_AUTO_TEST_CASE(getwalletenv_file)
std::string test_name = "test_name.dat";
const fs::path datadir = GetDataDir();
fs::path file_path = datadir / test_name;
#if BOOST_VERSION >= 107700
std::ofstream f(BOOST_FILESYSTEM_C_STR(file_path));
#else
std::ofstream f(file_path.BOOST_FILESYSTEM_C_STR);
#endif // BOOST_VERSION >= 107700
f.close();

std::string filename;
Expand Down
4 changes: 4 additions & 0 deletions src/wallet/test/init_test_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainNam
fs::create_directories(m_walletdir_path_cases["default"]);
fs::create_directories(m_walletdir_path_cases["custom"]);
fs::create_directories(m_walletdir_path_cases["relative"]);
#if BOOST_VERSION >= 107700
std::ofstream f(BOOST_FILESYSTEM_C_STR(m_walletdir_path_cases["file"]));
#else
std::ofstream f(m_walletdir_path_cases["file"].BOOST_FILESYSTEM_C_STR);
#endif // BOOST_VERSION >= 107700
f.close();
}

Expand Down
9 changes: 8 additions & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Before tests can be run locally, Dash Core must be built. See the [building ins

### Functional tests

#### Dependencies
#### Dependencies and prerequisites

Many Dash specific tests require dash_hash. To install it:

Expand All @@ -34,6 +34,13 @@ The ZMQ functional test requires a python ZMQ library. To install it:
- on Unix, run `sudo apt-get install python3-zmq`
- on mac OS, run `pip3 install pyzmq`


On Windows the `PYTHONUTF8` environment variable must be set to 1:

```cmd
set PYTHONUTF8=1
```

#### Running the tests

Individual tests can be run by directly calling the test script, e.g.:
Expand Down
5 changes: 3 additions & 2 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ def main():
for test in tests:
script = test.split("/")[-1]
script = script + ".py" if ".py" not in script else script
if script in ALL_SCRIPTS:
test_list.append(script)
matching_scripts = [s for s in ALL_SCRIPTS if s.startswith(script)]
if matching_scripts:
test_list.extend(matching_scripts)
else:
print("{}WARNING!{} Test '{}' not found in full test list.".format(BOLD[1], BOLD[0], test))
elif args.extended:
Expand Down