diff --git a/.github/workflows/komodo_linux_ci.yml b/.github/workflows/komodo_linux_ci.yml index 54c2b597c9f..61226de824e 100644 --- a/.github/workflows/komodo_linux_ci.yml +++ b/.github/workflows/komodo_linux_ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (Linux) @@ -54,7 +54,7 @@ jobs: needs: linux-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (Dice, Token, Faucet, Rewards CC) run: | @@ -91,7 +91,7 @@ jobs: needs: linux-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (OraclesCC) run: | @@ -128,7 +128,7 @@ jobs: needs: linux-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (BasicRPC) run: | @@ -165,7 +165,7 @@ jobs: needs: linux-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (ChannelsCC) run: | @@ -202,7 +202,7 @@ jobs: needs: linux-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (HeirCC) run: | diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 493e536d2c0..f5482660f7b 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # Workaround for https://github.com/actions/setup-python/issues/577 - name: Clean up binaries and links (macOS) @@ -31,29 +31,30 @@ jobs: - name: Install deps (macOS) run: | brew update - brew upgrade || true brew tap discoteq/discoteq; brew install flock brew install autoconf autogen automake - brew install gcc@8 brew install binutils brew install protobuf brew install coreutils brew install wget brew install python3 - brew install gmp + # https://www.jessesquires.com/blog/2020/01/06/selecting-an-xcode-version-on-github-ci/ + # https://github.com/actions/runner-images/issues/2619 (bsdtar issues) + # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! - name: Build (macOS) run: | - # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! - export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ ./zcutil/build-mac-dtest.sh -j4 - tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli + gtar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx + # env: + # DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer - name: Upload komodo-macos.tar.gz as artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: komodo-macos - path: ./komodo-macos.tar.gz + path: | + ./komodo-macos.tar.gz macos-test-dice-token-reards-faucet-cc: if: ${{ false }} @@ -63,7 +64,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install deps (Dice, Token, Faucet, Rewards CC) run: | @@ -72,7 +73,7 @@ jobs: python3 -m pip install slick-bitcoinrpc pytest wget jsonschema - name: Download komodo-macos.tar.gz - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4 with: name: komodo-macos @@ -93,7 +94,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install deps (OraclesCC) run: | @@ -101,7 +102,7 @@ jobs: python3 -m pip install setuptools wheel python3 -m pip install slick-bitcoinrpc pytest wget jsonschema - name: Download komodo-macos.tar.gz - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4 with: name: komodo-macos @@ -122,7 +123,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install deps (BasicRPC) run: | @@ -130,7 +131,7 @@ jobs: python3 -m pip install setuptools wheel python3 -m pip install slick-bitcoinrpc pytest wget jsonschema - name: Download komodo-macos.tar.gz - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4 with: name: komodo-macos @@ -151,7 +152,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install deps (ChannelsCC) run: | @@ -159,7 +160,7 @@ jobs: python3 -m pip install setuptools wheel python3 -m pip install slick-bitcoinrpc pytest wget jsonschema - name: Download komodo-macos.tar.gz - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4 with: name: komodo-macos @@ -180,7 +181,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install deps (HeirCC) run: | @@ -188,7 +189,7 @@ jobs: python3 -m pip install setuptools wheel python3 -m pip install slick-bitcoinrpc pytest wget jsonschema - name: Download komodo-macos.tar.gz - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4 with: name: komodo-macos diff --git a/.github/workflows/komodo_win_ci.yml b/.github/workflows/komodo_win_ci.yml index 1565b35b169..1a383f4a7bd 100644 --- a/.github/workflows/komodo_win_ci.yml +++ b/.github/workflows/komodo_win_ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps(mingw) env: DEBIAN_FRONTEND: noninteractive @@ -80,7 +80,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download komodo_win.zip uses: actions/download-artifact@v1 @@ -111,7 +111,7 @@ jobs: needs: windows-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download komodo_win.zip uses: actions/download-artifact@v1 @@ -142,7 +142,7 @@ jobs: needs: windows-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download komodo_win.zip uses: actions/download-artifact@v1 @@ -173,7 +173,7 @@ jobs: needs: windows-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download komodo_win.zip uses: actions/download-artifact@v1 @@ -204,7 +204,7 @@ jobs: needs: windows-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download komodo_win.zip uses: actions/download-artifact@v1 diff --git a/.github/workflows/komodod_cd.yml b/.github/workflows/komodod_cd.yml index 1313798144a..09d765a7e7b 100644 --- a/.github/workflows/komodod_cd.yml +++ b/.github/workflows/komodod_cd.yml @@ -30,7 +30,7 @@ jobs: id: shortify_commit - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install deps (Linux) env: @@ -79,7 +79,7 @@ jobs: if: ${{ github.event_name != 'workflow_dispatch' }} runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (macOS) run: | rm '/usr/local/bin/2to3' @@ -111,7 +111,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (Windows) env: DEBIAN_FRONTEND: noninteractive diff --git a/README.md b/README.md index 9568c70741a..4514d16edb9 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ brew update brew upgrade brew tap discoteq/discoteq; brew install flock brew install autoconf autogen automake -brew update && brew install gcc@8 +brew update brew install binutils brew install protobuf brew install coreutils diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk index cbbc5a667ab..6b877101327 100644 --- a/depends/builders/darwin.mk +++ b/depends/builders/darwin.mk @@ -1,5 +1,5 @@ -build_darwin_CC = gcc-8 -build_darwin_CXX = g++-8 +build_darwin_CC:=$(shell xcrun -f clang) --sysroot $(shell xcrun --show-sdk-path) +build_darwin_CXX:=$(shell xcrun -f clang++) --sysroot $(shell xcrun --show-sdk-path) build_darwin_AR: = $(shell xcrun -f ar) build_darwin_RANLIB: = $(shell xcrun -f ranlib) build_darwin_STRIP: = $(shell xcrun -f strip) @@ -7,11 +7,11 @@ build_darwin_OTOOL: = $(shell xcrun -f otool) build_darwin_NM: = $(shell xcrun -f nm) build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool) build_darwin_SHA256SUM = shasum -a 256 -build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o +build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o #darwin host on darwin builder. overrides darwin host preferences. -darwin_CC= gcc-8 -darwin_CXX= g++-8 +darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) -fvisibility=hidden -fvisibility-inlines-hidden --sysroot $(shell xcrun --show-sdk-path) +darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++ --sysroot $(shell xcrun --show-sdk-path) darwin_AR:=$(shell xcrun -f ar) darwin_RANLIB:=$(shell xcrun -f ranlib) darwin_STRIP:=$(shell xcrun -f strip) @@ -19,4 +19,5 @@ darwin_LIBTOOL:=$(shell xcrun -f libtool) darwin_OTOOL:=$(shell xcrun -f otool) darwin_NM:=$(shell xcrun -f nm) darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool) +darwin_native_binutils= darwin_native_toolchain= diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 43a4c88f2ab..43df3a566e5 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -1,17 +1,50 @@ -OSX_MIN_VERSION=10.12 -OSX_SDK_VERSION=10.12 -OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk -LD64_VERSION=253.9 -darwin_CC=gcc-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) +OSX_MIN_VERSION=10.15 +OSX_SDK_VERSION=10.15.6 +XCODE_VERSION=12.1 +XCODE_BUILD_ID=12A7403 +LD64_VERSION=609 + +OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers + +# Flag explanations: +# +# -mlinker-version +# +# Ensures that modern linker features are enabled. See here for more +# details: https://github.com/bitcoin/bitcoin/pull/19407. +# +# -B$(build_prefix)/bin +# +# Explicitly point to our binaries (e.g. cctools) so that they are +# ensured to be found and preferred over other possibilities. +# +# -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1 +# +# Forces clang to use the libc++ headers from our SDK and completely +# forget about the libc++ headers from the standard directories +# +# TODO: Once we start requiring a clang version that has the +# -stdlib++-isystem flag first introduced here: +# https://reviews.llvm.org/D64089, we should use that instead. Read the +# differential summary there for more details. +# +darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin +darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1 darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS) -darwin_release_CFLAGS=-g -O2 +darwin_release_CFLAGS=-O2 darwin_release_CXXFLAGS=$(darwin_release_CFLAGS) darwin_debug_CFLAGS=-g -O0 darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS) +darwin_native_binutils=native_cctools +ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),) darwin_native_toolchain=native_cctools +else +darwin_native_toolchain= +endif + +darwin_cmake_system=Darwin diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk index 222f09d3aee..50f8e597a01 100644 --- a/depends/packages/bdb.mk +++ b/depends/packages/bdb.mk @@ -25,7 +25,9 @@ endef ifeq ($(build_os),darwin) define $(package)_preprocess_cmds - sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h + sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h && \ + sed -i.old 's/__atomic_compare_exchange\\(/__atomic_compare_exchange_db(/' src/dbinc/atomic.h && \ + sed -i.old 's/atomic_init/atomic_init_db/' src/dbinc/atomic.h src/mp/mp_region.c src/mp/mp_mvcc.c src/mp/mp_fget.c src/mutex/mut_method.c src/mutex/mut_tas.c endef else ifeq ($(host_os),mingw32) define $(package)_preprocess_cmds diff --git a/depends/packages/libcurl.mk b/depends/packages/libcurl.mk index d25f43e1705..1996ad3502f 100644 --- a/depends/packages/libcurl.mk +++ b/depends/packages/libcurl.mk @@ -7,6 +7,7 @@ $(package)_sha256_hash=816e41809c043ff285e8c0f06a75a1fa250211bbfb2dc0a037eeef39f $(package)_config_opts=--with-openssl --disable-shared --enable-static --prefix=$(host_prefix) $(package)_config_opts_linux=--host=x86_64-unknown-linux-gnu $(package)_config_opts_mingw32=--enable-mingw --host=x86_64-w64-mingw32 +$(package)_config_opts_darwin=--without-libidn2 --without-zstd --without-nghttp2 --without-librtmp --without-brotli $(package)_cflags_darwin=-mmacosx-version-min=$(OSX_MIN_VERSION) $(package)_conf_tool=./configure diff --git a/depends/packages/libsodium.mk b/depends/packages/libsodium.mk index 4974edc70d1..fe8b0a4e915 100644 --- a/depends/packages/libsodium.mk +++ b/depends/packages/libsodium.mk @@ -9,7 +9,7 @@ $(package)_config_opts= define $(package)_set_vars $(package)_build_env=DO_NOT_UPDATE_CONFIG_SCRIPTS=1 ifeq ($(build_os),darwin) - $(package)_build_env+=MACOSX_DEPLOYMENT_TARGET="10.11" + $(package)_build_env+=MACOSX_DEPLOYMENT_TARGET="$(OSX_MIN_VERSION)" $(package)_cc=clang $(package)_cxx=clang++ endif diff --git a/src/Makefile.am b/src/Makefile.am index 25b0aed016e..00d04f13d45 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -72,7 +72,9 @@ EXTRA_LIBRARIES += \ $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_CLI) \ - libzcash.a + $(LIBZCASH) \ + $(LIBCC) + if ENABLE_WALLET BITCOIN_INCLUDES += $(BDB_CPPFLAGS) EXTRA_LIBRARIES += $(LIBBITCOIN_WALLET) @@ -84,7 +86,7 @@ if ENABLE_PROTON EXTRA_LIBRARIES += $(LIBBITCOIN_PROTON) endif -lib_LTLIBRARIES = $(LIBZCASH_CONSENSUS) $(LIBCC) +lib_LTLIBRARIES = $(LIBZCASH_CONSENSUS) bin_PROGRAMS = noinst_PROGRAMS = @@ -364,10 +366,10 @@ libbitcoin_wallet_a_SOURCES = \ $(BITCOIN_CORE_H) \ $(LIBZCASH_H) -# a shared library for cryptoconditions +# a static library for cryptoconditions libcc_a_SOURCES = cc/cclib.cpp libcc_a_CXXFLAGS = -DBUILD_CUSTOMCC -I../secp256k1/include -I../depends/$(shell echo `../depends/config.guess`/include) -I./univalue/include -I./cryptoconditions/include -I./cryptoconditions/src -I./cryptoconditions/src/asn -I. -I./cc -libcc_a_LDFLAGS = -version-info 0:0:0 +# libcc_a_LDFLAGS = -version-info 0:0:0 # crypto primitives library crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES) @@ -547,19 +549,11 @@ if ENABLE_PROTON komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS) endif -# [+] Decker: use static linking for libstdc++.6.dylib, libgomp.1.dylib, libgcc_s.1.dylib -if TARGET_DARWIN -komodod_LDFLAGS += -static-libgcc -endif - # bitcoin-cli binary # komodo_cli_SOURCES = bitcoin-cli.cpp komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -if TARGET_DARWIN -komodo_cli_LDFLAGS += -static-libgcc -endif # wallet-utility binary # if ENABLE_WALLET diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index 2222786d7c6..9d4c83f4612 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -788,6 +788,12 @@ int64_t TotalPubkeyNormalInputs(const CTransaction &tx, const CPubKey &pubkey) if (pubkey.GetID() == CKeyID(uint160(vSolutions[0]))) // is my input? total += vintx.vout[vin.prevout.n].nValue; break; + case TX_NONSTANDARD: + case TX_SCRIPTHASH: + case TX_MULTISIG: + case TX_CRYPTOCONDITION: + case TX_NULL_DATA: + break; } } } diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index 2f8e1036267..31fd6dbafc0 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -370,7 +370,7 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & { if ( amountReleased < minrelease*COIN ) { - fprintf(stderr, "does not meet minrelease amount.%li minrelease.%li\n",amountReleased, (int64_t)minrelease*COIN); + fprintf(stderr, "does not meet minrelease amount.%" PRId64 " minrelease.%" PRId64 "\n",amountReleased, (int64_t)minrelease*COIN); return(eval->Invalid("amount is too small")); } // Get all the script pubkeys and allocations @@ -477,7 +477,7 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & if ( test < minimum ) { // prevent anyone being paid the minimum. - fprintf(stderr, "vout.%i test.%li vs minimum.%i\n",i, test, minimum); + fprintf(stderr, "vout.%" PRId32 " test.%" PRId64 " vs minimum.%" PRId32 "\n",i, test, minimum); return(eval->Invalid("under minimum size")); } amount += tx.vout[i].nValue; diff --git a/src/komodo_utils.cpp b/src/komodo_utils.cpp index e67e477891b..17c88ee4ff1 100644 --- a/src/komodo_utils.cpp +++ b/src/komodo_utils.cpp @@ -1129,9 +1129,9 @@ void komodo_args(char *argv0) { if ( equihash_params_possible(ASSETCHAINS_NK[0], ASSETCHAINS_NK[1]) == -1 ) { - printf("equihash values N.%li and K.%li are not currently available\n", ASSETCHAINS_NK[0], ASSETCHAINS_NK[1]); + printf("equihash values N.%" PRIu64 " and K.%" PRIu64 " are not currently available\n", ASSETCHAINS_NK[0], ASSETCHAINS_NK[1]); exit(0); - } else printf("ASSETCHAINS_ALGO, algorithm set to equihash with N.%li and K.%li\n", ASSETCHAINS_NK[0], ASSETCHAINS_NK[1]); + } else printf("ASSETCHAINS_ALGO, algorithm set to equihash with N.%" PRIu64 " and K.%" PRIu64 "\n", ASSETCHAINS_NK[0], ASSETCHAINS_NK[1]); } if (i == ASSETCHAINS_NUMALGOS) { @@ -1142,7 +1142,7 @@ void komodo_args(char *argv0) if ( ASSETCHAINS_LASTERA < 1 || ASSETCHAINS_LASTERA > ASSETCHAINS_MAX_ERAS ) { ASSETCHAINS_LASTERA = 1; - printf("ASSETCHAINS_LASTERA, if specified, must be between 1 and %u. ASSETCHAINS_LASTERA set to %lu\n", ASSETCHAINS_MAX_ERAS, ASSETCHAINS_LASTERA); + printf("ASSETCHAINS_LASTERA, if specified, must be between 1 and %u. ASSETCHAINS_LASTERA set to %" PRIu64 "\n", ASSETCHAINS_MAX_ERAS, ASSETCHAINS_LASTERA); } ASSETCHAINS_LASTERA -= 1; @@ -1321,7 +1321,7 @@ void komodo_args(char *argv0) } else { - printf("ASSETCHAINS_FOUNDERS_REWARD set to %ld\n", ASSETCHAINS_FOUNDERS_REWARD); + printf("ASSETCHAINS_FOUNDERS_REWARD set to %" PRIu64 "\n", ASSETCHAINS_FOUNDERS_REWARD); } /*else if ( ASSETCHAINS_SELFIMPORT.size() == 0 ) { diff --git a/src/metrics.cpp b/src/metrics.cpp index 3d057b6e8a3..7c776ec3113 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -366,7 +366,7 @@ int printMetrics(size_t cols, bool mining) subsidy -= subsidy/5; } - if ((std::max( 0U, Params().CoinbaseMaturity() - (tipHeight - height)) > 0) || + if ((static_cast(Params().CoinbaseMaturity() - (tipHeight - height)) > 0) || (tipHeight < komodo_block_unlocktime(height) && subsidy >= ASSETCHAINS_TIMELOCKGTE)) { immature += subsidy; } else { diff --git a/src/serialize.h b/src/serialize.h index 3d9c3fae6ee..722b1babed7 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -542,6 +542,7 @@ template inline void Unserialize(St * vectors of unsigned char are a special case and are intended to be serialized as a single opaque blob. */ template void Serialize_impl(Stream& os, const std::vector& v, const unsigned char&); +template void Serialize_impl(Stream& os, const std::vector& v, const bool&); template void Serialize_impl(Stream& os, const std::vector& v, const V&); template inline void Serialize(Stream& os, const std::vector& v); template void Unserialize_impl(Stream& is, std::vector& v, const unsigned char&); @@ -718,6 +719,18 @@ void Serialize_impl(Stream& os, const std::vector& v, const unsigned char& os.write((char*)&v[0], v.size() * sizeof(T)); } +template +void Serialize_impl(Stream& os, const std::vector& v, const bool&) +{ + // A special case for std::vector, as dereferencing + // std::vector::const_iterator does not result in a const bool& + // due to std::vector's special casing for bool arguments. + WriteCompactSize(os, v.size()); + for (bool elem : v) { + ::Serialize(os, elem); + } +} + template void Serialize_impl(Stream& os, const std::vector& v, const V&) { diff --git a/src/test-komodo/test_eval_bet.cpp b/src/test-komodo/test_eval_bet.cpp index 4dfcf1cab6b..f1a26edb2ea 100644 --- a/src/test-komodo/test_eval_bet.cpp +++ b/src/test-komodo/test_eval_bet.cpp @@ -152,7 +152,7 @@ class ExampleBet BetProtocol bet; CAmount totalPayout; - ExampleBet() : bet(BetProtocol(EVAL_DISPUTEBET, players, 2, VCH("BetHeader", 9))), totalPayout(100) {} + ExampleBet() : bet(BetProtocol(EVAL_DISPUTEBET, players, 2, std::vector { 'B','e','t','H','e','a','d','e','r' })), totalPayout(100) {} ~ExampleBet() {}; CTransaction SessionTx() diff --git a/src/test-komodo/test_kmd_feat.cpp b/src/test-komodo/test_kmd_feat.cpp index 3a61fb6b3a4..20b69f37e9e 100644 --- a/src/test-komodo/test_kmd_feat.cpp +++ b/src/test-komodo/test_kmd_feat.cpp @@ -334,6 +334,8 @@ TEST_F(KomodoFeatures, komodo_interest_validate) { delete pLastBlockIndex; } } + + pcoinsTip = nullptr; // avoid dangling pointer after this test } } diff --git a/src/test-komodo/test_parse_notarisation_data.cpp b/src/test-komodo/test_parse_notarisation_data.cpp index ddf7010c952..74fc0016f44 100644 --- a/src/test-komodo/test_parse_notarisation_data.cpp +++ b/src/test-komodo/test_parse_notarisation_data.cpp @@ -8107,10 +8107,10 @@ std::vector get_test_checkpoints() /* void write_test_checkpoints(const std::string& filename, const std::vector& checkpoints) { - std::ofstream out(filename, - std::ios_base::openmode::_S_out - | std::ios_base::openmode::_S_bin - | std::ios_base::openmode::_S_trunc); + std::ofstream out(filename, + std::ios::out + | std::ios::binary + | std::ios::trunc); for(auto itr = checkpoints.begin(); itr != checkpoints.end(); ++itr) { @@ -8140,22 +8140,22 @@ std::vector get_test_checkpoints_from_file(const std::stri { std::vector retval; - std::ifstream in(filename, std::ios_base::openmode::_S_in - | std::ios_base::openmode::_S_bin); + std::ifstream in(filename, std::ios::in + | std::ios::binary); if (!in.is_open()) { // look in the test directory std::string test = std::string("./test/") + filename; - in.open(test, std::ios_base::openmode::_S_in - | std::ios_base::openmode::_S_bin); + in.open(test, std::ios::in + | std::ios::binary); } if (!in.is_open()) { // look in the ../test directory std::string test = std::string("../test/") + filename; - in.open(test, std::ios_base::openmode::_S_in - | std::ios_base::openmode::_S_bin); + in.open(test, std::ios::in + | std::ios::binary); } while(!in.eof()) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index c137cfa1b08..1ab7377abe5 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -1,13 +1,4 @@ #!/bin/bash -export CC=gcc-8 -export CXX=g++-8 -export LIBTOOL=libtool -export AR=ar -export RANLIB=ranlib -export STRIP=strip -export OTOOL=otool -export NM=nm - set -eu -o pipefail if [ "x$*" = 'x--help' ] @@ -57,7 +48,9 @@ make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1 ./autogen.sh CPPFLAGS="-I$PREFIX/include -arch x86_64 -DTESTMODE" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ -CXXFLAGS="-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Wno-builtin-declaration-mismatch -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing \ +-Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion \ +-Wno-unknown-warning-option -Werror -Wno-error=attributes -g" \ ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" make "$@" NO_GTEST=1 STATIC=1 diff --git a/zcutil/build-mac.sh b/zcutil/build-mac.sh index b01cb23cecc..991d4d09a03 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -1,13 +1,4 @@ #!/bin/bash -export CC=gcc-8 -export CXX=g++-8 -export LIBTOOL=libtool -export AR=ar -export RANLIB=ranlib -export STRIP=strip -export OTOOL=otool -export NM=nm - set -eu -o pipefail if [ "x$*" = 'x--help' ] @@ -57,7 +48,9 @@ make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1 ./autogen.sh CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ -CXXFLAGS="-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Wno-builtin-declaration-mismatch -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing \ +-Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion \ +-Wno-unknown-warning-option -Werror -Wno-error=attributes -g" \ ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" make "$@" NO_GTEST=1 STATIC=1