mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge pull request #4725 from PastaPastaPasta/develop-trivial-2022-03-13
Develop trivial 2022 03 13
This commit is contained in:
commit
39827f9eb4
@ -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)]
|
||||
|
@ -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
|
||||
@ -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:
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
language: cpp
|
||||
dist: bionic
|
||||
osx_image: xcode10.3
|
||||
osx_image: xcode12.5
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
@ -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
|
||||
|
||||
@ -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}
|
||||
|
@ -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
|
||||
|
@ -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 \
|
||||
|
@ -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__)
|
||||
|
@ -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, "
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
@ -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);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
|
||||
/**
|
||||
* secure_allocator is defined in allocators.h
|
||||
* CPrivKey is a serialized private key, with all parameters included
|
||||
* (SIZE bytes)
|
||||
*/
|
||||
|
22
src/net.cpp
22
src/net.cpp
@ -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?
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -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&) {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
||||
@ -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.:
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user