From e4afcbdc1687bddbba328aaa23a85f89444b4165 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 17:10:38 +0100 Subject: [PATCH 01/57] darwin builder gcc/g++ -> clang/clang++ default --- depends/builders/darwin.mk | 11 +++++---- depends/hosts/darwin.mk | 47 ++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk index cbbc5a667ab..9c8aed44e5c 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) --sysroot $(shell xcrun --show-sdk-path) +darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -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..6099fd4c716 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_SDK_VERSION=10.15.1 +XCODE_VERSION=11.3.1 +XCODE_BUILD_ID=11C505 +LD64_VERSION=530 + +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_CFLAGS=-O1 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 From 59872f9e325f5e32ad20ab29089edd2c927c4e84 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Tue, 9 Feb 2021 01:18:57 +0300 Subject: [PATCH 02/57] fix bdb build on native darwin (TODO: refactor bdb.mk) --- depends/packages/bdb.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From 31fad7971a3e07a6b7614da2c9c225f8b80d7a25 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 18:02:36 +0100 Subject: [PATCH 03/57] build: remove -Wno-builtin-declaration-mismatch for Mac as unknown warning option for clang --- zcutil/build-mac-dtest.sh | 2 +- zcutil/build-mac.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index c137cfa1b08..b3609b85a27 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -57,7 +57,7 @@ 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/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ ./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..609ef9784a6 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -57,7 +57,7 @@ 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/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" make "$@" NO_GTEST=1 STATIC=1 From 41636e8dd06754962c71228781e0e1cb2bd3b352 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 18:04:24 +0100 Subject: [PATCH 04/57] build: remove gcc related flags from Mac build --- zcutil/build-mac-dtest.sh | 11 +---------- zcutil/build-mac.sh | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index b3609b85a27..31d2fcdc175 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,7 @@ 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 -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ ./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 609ef9784a6..8c3a1b18ea1 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,7 @@ 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 -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" make "$@" NO_GTEST=1 STATIC=1 From 398c1b2708e7346fabdef7cd9eee7f2b90a08cdb Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 18:19:45 +0100 Subject: [PATCH 05/57] build: mac, remove linker options -Wl,-undefined -Wl,dynamic_lookup --- zcutil/build-mac-dtest.sh | 2 +- zcutil/build-mac.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index 31d2fcdc175..d14b3713c1f 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -48,7 +48,7 @@ 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$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -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 8c3a1b18ea1..75185496c3c 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -48,7 +48,7 @@ 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$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g" \ ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" make "$@" NO_GTEST=1 STATIC=1 From f02a1809a233460a965f52ee4323d7282f423877 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 7 Feb 2021 11:04:02 +0300 Subject: [PATCH 06/57] Support serialization of std::vector https://github.com/bitcoin/bitcoin/pull/16730 Without this fix we got a following error: no member named 'Serialize' in 'std::__1::__bit_const_reference > >' during clang build. --- src/serialize.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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&) { From e6cd777f3ef04152c0072c564e33b2b99313c9a6 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 18:40:15 +0100 Subject: [PATCH 07/57] ccutils: explicitly handle remaining enumerations in switch --- src/cc/CCutils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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; } } } From 7b64e7c414464160d7ce8e97230bb2f71d5645dc Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 18:47:04 +0100 Subject: [PATCH 08/57] payments: using correct format specifiers for logging --- src/cc/payments.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 3a3347624b828fc75bd91ec9c93622474193f7c2 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 19:03:18 +0100 Subject: [PATCH 09/57] komodo_utils: fix format specifiers --- src/komodo_utils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_utils.cpp b/src/komodo_utils.cpp index a8a6f4defba..4728e9f9302 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 ) { From 1c4d1b6bf8de01a47bf32a7a87921a0a58ef31dc Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 19:08:04 +0100 Subject: [PATCH 10/57] metrics: get rid of incorrect std::max usage both arguments here considered as unsigned int as 0 was 0U and taking the max of unsigned zero and a value is always equal to the other value. --- src/metrics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From bb7094c9bc80f3f7f110ed39d88716152aaf359f Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 19:41:19 +0100 Subject: [PATCH 11/57] test eval bet: avoid of adding int to a string --- src/test-komodo/test_eval_bet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() From 56182f9f9b99331d3dfb191a0263d3f76daa2d6f Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 19:49:47 +0100 Subject: [PATCH 12/57] test parse notarisation data: avoid of using std::ios_base::openmode directly --- .../test_parse_notarisation_data.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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()) From b646f20768a8917081a367c5180474ea6dc6acee Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 19:56:15 +0100 Subject: [PATCH 13/57] build: mac, remove gcc specific linker flag -static-libgcc --- src/Makefile.am | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 25b0aed016e..8e747e135f4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -547,19 +547,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 From c777bb17f257436802c2ecc9c09ae7bb844721ba Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 20:02:40 +0100 Subject: [PATCH 14/57] build: fix libcurl linkage under darwin --- depends/packages/libcurl.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/depends/packages/libcurl.mk b/depends/packages/libcurl.mk index d25f43e1705..798e2d8214b 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 $(package)_cflags_darwin=-mmacosx-version-min=$(OSX_MIN_VERSION) $(package)_conf_tool=./configure From 79b2f33a98a3807d4c989dd792fb429de8b0d04b Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 20:36:04 +0100 Subject: [PATCH 15/57] build: libsodium, fix MACOSX_DEPLOYMENT_TARGET --- depends/packages/libsodium.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From a3defc2c005387f75f1937c5a4563ac801672a38 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 22:47:57 +0100 Subject: [PATCH 16/57] tests: avoid dangling pointer after KomodoFeatures test --- src/test-komodo/test_kmd_feat.cpp | 2 ++ 1 file changed, 2 insertions(+) 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 } } From a90b0dc836e91476ec24e718b6bd403bcf3b2283 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 8 Mar 2024 23:11:55 +0100 Subject: [PATCH 17/57] build: remove gcc from mac ci workflow and from README --- .github/workflows/komodo_mac_ci.yml | 1 - README.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 493e536d2c0..301d6c38fd7 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -34,7 +34,6 @@ jobs: 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 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 From 728f74a02ca24288f7fd3b38a70048d76fed78ad Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 02:13:56 +0100 Subject: [PATCH 18/57] build: bump boost to 1.78.0, fix placeholders, remove patches --- depends/packages/boost.mk | 13 ++-- depends/patches/boost/fix-Solaris.patch | 23 ------- .../boost/ignore_wnonnull_gcc_11.patch | 68 ------------------- src/init.cpp | 2 +- src/rpc/server.cpp | 6 +- src/scheduler.cpp | 2 +- src/test/scheduler_tests.cpp | 2 +- src/torcontrol.cpp | 24 +++---- src/validationinterface.cpp | 32 ++++----- 9 files changed, 39 insertions(+), 133 deletions(-) delete mode 100644 depends/patches/boost/fix-Solaris.patch delete mode 100644 depends/patches/boost/ignore_wnonnull_gcc_11.patch diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index e671ea0e734..f118d499b15 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -1,10 +1,9 @@ package=boost -$(package)_version=1_72_0 -$(package)_download_path=https://github.com/KomodoPlatform/boost/releases/download/boost-1.72.0-kmd -$(package)_sha256_hash=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722 -$(package)_file_name=$(package)_$($(package)_version).tar.bz2 -$(package)_patches=fix-Solaris.patch ignore_wnonnull_gcc_11.patch +$(package)_version=1.78.0 +$(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$($(package)_version)/source/ +$(package)_sha256_hash=8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc +$(package)_file_name=boost_$(subst .,_,$($(package)_version)).tar.bz2 define $(package)_set_vars $(package)_config_opts_release=variant=release @@ -28,9 +27,7 @@ endef define $(package)_preprocess_cmds - echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam&& \ - patch -p1 < $($(package)_patch_dir)/fix-Solaris.patch &&\ - patch -p2 < $($(package)_patch_dir)/ignore_wnonnull_gcc_11.patch + echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam endef define $(package)_config_cmds diff --git a/depends/patches/boost/fix-Solaris.patch b/depends/patches/boost/fix-Solaris.patch deleted file mode 100644 index cb800609215..00000000000 --- a/depends/patches/boost/fix-Solaris.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 74fb0a26099bc51d717f5f154b37231ce7df3e98 Mon Sep 17 00:00:00 2001 -From: Rob Boehne -Date: Wed, 20 Nov 2019 11:25:20 -0600 -Subject: [PATCH] Revert change to elide a warning that caused Solaris builds to fail. - ---- - boost/thread/pthread/thread_data.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/boost/thread/pthread/thread_data.hpp b/boost/thread/pthread/thread_data.hpp -index aefbeb43c..bc9b1367a 100644 ---- a/boost/thread/pthread/thread_data.hpp -+++ b/boost/thread/pthread/thread_data.hpp -@@ -57,7 +57,7 @@ namespace boost - #else - std::size_t page_size = ::sysconf( _SC_PAGESIZE); - #endif --#if PTHREAD_STACK_MIN > 0 -- if (size(PTHREAD_STACK_MIN)) size=PTHREAD_STACK_MIN; - #endif - size = ((size+page_size-1)/page_size)*page_size; diff --git a/depends/patches/boost/ignore_wnonnull_gcc_11.patch b/depends/patches/boost/ignore_wnonnull_gcc_11.patch deleted file mode 100644 index f914c1e6826..00000000000 --- a/depends/patches/boost/ignore_wnonnull_gcc_11.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/include/boost/concept/detail/general.hpp b/include/boost/concept/detail/general.hpp -index eeb08750..8d7d6f69 100644 ---- a/include/boost/concept/detail/general.hpp -+++ b/include/boost/concept/detail/general.hpp -@@ -28,7 +28,14 @@ namespace detail - template - struct requirement - { -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic push -+# pragma GCC diagnostic ignored "-Wnonnull" -+# endif - static void failed() { ((Model*)0)->~Model(); } -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic pop -+# endif - }; - - struct failed {}; -@@ -36,7 +43,14 @@ struct failed {}; - template - struct requirement - { -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic push -+# pragma GCC diagnostic ignored "-Wnonnull" -+# endif - static void failed() { ((Model*)0)->~Model(); } -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic pop -+# endif - }; - - # ifdef BOOST_OLD_CONCEPT_SUPPORT -@@ -44,7 +58,14 @@ struct requirement - template - struct constraint - { -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic push -+# pragma GCC diagnostic ignored "-Wnonnull" -+# endif - static void failed() { ((Model*)0)->constraints(); } -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic pop -+# endif - }; - - template -diff --git a/include/boost/concept/usage.hpp b/include/boost/concept/usage.hpp -index 373de63a..fe88b5f5 100644 ---- a/include/boost/concept/usage.hpp -+++ b/include/boost/concept/usage.hpp -@@ -13,7 +13,14 @@ namespace boost { namespace concepts { - template - struct usage_requirements - { -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic push -+# pragma GCC diagnostic ignored "-Wnonnull" -+# endif - ~usage_requirements() { ((Model*)0)->~Model(); } -+# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) -+# pragma GCC diagnostic pop -+# endif - }; - - # if BOOST_WORKAROUND(__GNUC__, <= 3) diff --git a/src/init.cpp b/src/init.cpp index 734a797fa3a..c75f277afec 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index b6755a47fba..c19c2582582 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -34,7 +34,7 @@ #include -#include +#include #include #include #include @@ -78,12 +78,12 @@ void RPCServer::OnStopped(boost::function slot) void RPCServer::OnPreCommand(boost::function slot) { - g_rpcSignals.PreCommand.connect(boost::bind(slot, _1)); + g_rpcSignals.PreCommand.connect(boost::bind(slot, boost::placeholders::_1)); } void RPCServer::OnPostCommand(boost::function slot) { - g_rpcSignals.PostCommand.connect(boost::bind(slot, _1)); + g_rpcSignals.PostCommand.connect(boost::bind(slot, boost::placeholders::_1)); } void RPCTypeCheck(const UniValue& params, diff --git a/src/scheduler.cpp b/src/scheduler.cpp index 08aba322531..fde989134f7 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -22,7 +22,7 @@ #include "reverselock.h" #include -#include +#include #include CScheduler::CScheduler() : nThreadsServicingQueue(0), stopRequested(false), stopWhenEmpty(false) diff --git a/src/test/scheduler_tests.cpp b/src/test/scheduler_tests.cpp index d6c93ef3bca..6340b1eda97 100644 --- a/src/test/scheduler_tests.cpp +++ b/src/test/scheduler_tests.cpp @@ -7,7 +7,7 @@ #include "test/test_bitcoin.h" -#include +#include #include #include #include diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index a5bd149b2e5..1ba85b08c69 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -461,8 +461,8 @@ TorController::TorController(struct event_base* baseIn, const std::string& targe if (!reconnect_ev) LogPrintf("tor: Failed to create event for reconnection: out of memory?\n"); // Start connection attempts immediately - if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, _1), - boost::bind(&TorController::disconnected_cb, this, _1) )) { + if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, boost::placeholders::_1), + boost::bind(&TorController::disconnected_cb, this, boost::placeholders::_1) )) { LogPrintf("tor: Initiating connection to Tor control port %s failed\n", target); } // Read service private key if cached @@ -540,7 +540,7 @@ void TorController::auth_cb(TorControlConnection& conn, const TorControlReply& r // Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient // choice. TODO; refactor the shutdown sequence some day. conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, GetListenPort(), GetListenPort()), - boost::bind(&TorController::add_onion_cb, this, _1, _2)); + boost::bind(&TorController::add_onion_cb, this, boost::placeholders::_1, boost::placeholders::_2)); } else { LogPrintf("tor: Authentication failed\n"); } @@ -599,7 +599,7 @@ void TorController::authchallenge_cb(TorControlConnection& conn, const TorContro } std::vector computedClientHash = ComputeResponse(TOR_SAFE_CLIENTKEY, cookie, clientNonce, serverNonce); - conn.Command("AUTHENTICATE " + HexStr(computedClientHash), boost::bind(&TorController::auth_cb, this, _1, _2)); + conn.Command("AUTHENTICATE " + HexStr(computedClientHash), boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); } else { LogPrintf("tor: Invalid reply to AUTHCHALLENGE\n"); } @@ -648,23 +648,23 @@ void TorController::protocolinfo_cb(TorControlConnection& conn, const TorControl if (methods.count("HASHEDPASSWORD")) { LogPrint("tor", "tor: Using HASHEDPASSWORD authentication\n"); boost::replace_all(torpassword, "\"", "\\\""); - conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, _1, _2)); + conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); } else { LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n"); } } else if (methods.count("NULL")) { LogPrint("tor", "tor: Using NULL authentication\n"); - conn.Command("AUTHENTICATE", boost::bind(&TorController::auth_cb, this, _1, _2)); + conn.Command("AUTHENTICATE", boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); } else if (methods.count("SAFECOOKIE")) { // Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie LogPrint("tor", "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile); std::pair status_cookie = ReadBinaryFile(cookiefile, TOR_COOKIE_SIZE); if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) { - // conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), boost::bind(&TorController::auth_cb, this, _1, _2)); + // conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); cookie = std::vector(status_cookie.second.begin(), status_cookie.second.end()); clientNonce = std::vector(TOR_NONCE_SIZE, 0); GetRandBytes(&clientNonce[0], TOR_NONCE_SIZE); - conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), boost::bind(&TorController::authchallenge_cb, this, _1, _2)); + conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), boost::bind(&TorController::authchallenge_cb, this, boost::placeholders::_1, boost::placeholders::_2)); } else { if (status_cookie.first) { LogPrintf("tor: Authentication cookie %s is not exactly %i bytes, as is required by the spec\n", cookiefile, TOR_COOKIE_SIZE); @@ -686,7 +686,7 @@ void TorController::connected_cb(TorControlConnection& conn) { reconnect_timeout = RECONNECT_TIMEOUT_START; // First send a PROTOCOLINFO command to figure out what authentication is expected - if (!conn.Command("PROTOCOLINFO 1", boost::bind(&TorController::protocolinfo_cb, this, _1, _2))) + if (!conn.Command("PROTOCOLINFO 1", boost::bind(&TorController::protocolinfo_cb, this, boost::placeholders::_1, boost::placeholders::_2))) LogPrintf("tor: Error sending initial protocolinfo command\n"); } @@ -713,8 +713,8 @@ void TorController::Reconnect() /* Try to reconnect and reestablish if we get booted - for example, Tor * may be restarting. */ - if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, _1), - boost::bind(&TorController::disconnected_cb, this, _1) )) { + if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, boost::placeholders::_1), + boost::bind(&TorController::disconnected_cb, this, boost::placeholders::_1) )) { LogPrintf("tor: Re-initiating connection to Tor control port %s failed\n", target); } } diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index d01e8a849b5..a9ab52bad6f 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -13,27 +13,27 @@ CMainSignals& GetMainSignals() } void RegisterValidationInterface(CValidationInterface* pwalletIn) { - g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1)); - g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); - g_signals.EraseTransaction.connect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); - g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); + g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, boost::placeholders::_1)); + g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); + g_signals.EraseTransaction.connect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, boost::placeholders::_1)); + g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, boost::placeholders::_1)); g_signals.RescanWallet.connect(boost::bind(&CValidationInterface::RescanWallet, pwalletIn)); - g_signals.ChainTip.connect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3, _4, _5)); - g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); - g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); - g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); + g_signals.ChainTip.connect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5)); + g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, boost::placeholders::_1)); + g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, boost::placeholders::_1)); + g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); } void UnregisterValidationInterface(CValidationInterface* pwalletIn) { - g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); - g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); - g_signals.ChainTip.disconnect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3, _4, _5)); - g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); - g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); - g_signals.EraseTransaction.disconnect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); - g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); + g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); + g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, boost::placeholders::_1)); + g_signals.ChainTip.disconnect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5)); + g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, boost::placeholders::_1)); + g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, boost::placeholders::_1)); + g_signals.EraseTransaction.disconnect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, boost::placeholders::_1)); + g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); g_signals.RescanWallet.disconnect(boost::bind(&CValidationInterface::RescanWallet, pwalletIn)); - g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1)); + g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, boost::placeholders::_1)); } void UnregisterAllValidationInterfaces() { From 11a0138c8ccb55d79e7940697a8862a361bd03ae Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 03:25:49 +0100 Subject: [PATCH 19/57] ci: explicitly use macos-12 instead of latest, try to use Xcode 13.2.1 --- .github/workflows/komodo_mac_ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 301d6c38fd7..6271876da89 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -10,7 +10,7 @@ jobs: macos-build: name: MacOS Build - runs-on: macos-latest + runs-on: macos-12 steps: - uses: actions/checkout@v2 @@ -41,12 +41,15 @@ jobs: brew install python3 brew install gmp + # https://www.jessesquires.com/blog/2020/01/06/selecting-an-xcode-version-on-github-ci/ - 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 + env: + DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer - name: Upload komodo-macos.tar.gz as artifact uses: actions/upload-artifact@v1 From 771743d997462cb9cb068a84293f6ffba719b160 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 03:41:09 +0100 Subject: [PATCH 20/57] ci: mac try to remove cpath - https://discussions.apple.com/thread/251252160?answerId=252403424022&sortBy=best#252403424022 --- .github/workflows/komodo_mac_ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 6271876da89..bd9bff11597 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -45,7 +45,6 @@ jobs: - 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 env: From 2422583405f044bf6e5c963491c8374e9b27fdf2 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 03:59:05 +0100 Subject: [PATCH 21/57] ci: mac try to not upgrade all formulaes --- .github/workflows/komodo_mac_ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index bd9bff11597..08be886486e 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -31,7 +31,6 @@ 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 binutils From e31f8995612a15f8f8546c372631d389ff6f4949 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 04:16:13 +0100 Subject: [PATCH 22/57] Revert "build: bump boost to 1.78.0, fix placeholders, remove patches" This reverts commit 728f74a02ca24288f7fd3b38a70048d76fed78ad. --- depends/packages/boost.mk | 13 ++-- depends/patches/boost/fix-Solaris.patch | 23 +++++++ .../boost/ignore_wnonnull_gcc_11.patch | 68 +++++++++++++++++++ src/init.cpp | 2 +- src/rpc/server.cpp | 6 +- src/scheduler.cpp | 2 +- src/test/scheduler_tests.cpp | 2 +- src/torcontrol.cpp | 24 +++---- src/validationinterface.cpp | 32 ++++----- 9 files changed, 133 insertions(+), 39 deletions(-) create mode 100644 depends/patches/boost/fix-Solaris.patch create mode 100644 depends/patches/boost/ignore_wnonnull_gcc_11.patch diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index f118d499b15..e671ea0e734 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -1,9 +1,10 @@ package=boost -$(package)_version=1.78.0 -$(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$($(package)_version)/source/ -$(package)_sha256_hash=8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc -$(package)_file_name=boost_$(subst .,_,$($(package)_version)).tar.bz2 +$(package)_version=1_72_0 +$(package)_download_path=https://github.com/KomodoPlatform/boost/releases/download/boost-1.72.0-kmd +$(package)_sha256_hash=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722 +$(package)_file_name=$(package)_$($(package)_version).tar.bz2 +$(package)_patches=fix-Solaris.patch ignore_wnonnull_gcc_11.patch define $(package)_set_vars $(package)_config_opts_release=variant=release @@ -27,7 +28,9 @@ endef define $(package)_preprocess_cmds - echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam + echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam&& \ + patch -p1 < $($(package)_patch_dir)/fix-Solaris.patch &&\ + patch -p2 < $($(package)_patch_dir)/ignore_wnonnull_gcc_11.patch endef define $(package)_config_cmds diff --git a/depends/patches/boost/fix-Solaris.patch b/depends/patches/boost/fix-Solaris.patch new file mode 100644 index 00000000000..cb800609215 --- /dev/null +++ b/depends/patches/boost/fix-Solaris.patch @@ -0,0 +1,23 @@ +From 74fb0a26099bc51d717f5f154b37231ce7df3e98 Mon Sep 17 00:00:00 2001 +From: Rob Boehne +Date: Wed, 20 Nov 2019 11:25:20 -0600 +Subject: [PATCH] Revert change to elide a warning that caused Solaris builds to fail. + +--- + boost/thread/pthread/thread_data.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/boost/thread/pthread/thread_data.hpp b/boost/thread/pthread/thread_data.hpp +index aefbeb43c..bc9b1367a 100644 +--- a/boost/thread/pthread/thread_data.hpp ++++ b/boost/thread/pthread/thread_data.hpp +@@ -57,7 +57,7 @@ namespace boost + #else + std::size_t page_size = ::sysconf( _SC_PAGESIZE); + #endif +-#if PTHREAD_STACK_MIN > 0 +- if (size(PTHREAD_STACK_MIN)) size=PTHREAD_STACK_MIN; + #endif + size = ((size+page_size-1)/page_size)*page_size; diff --git a/depends/patches/boost/ignore_wnonnull_gcc_11.patch b/depends/patches/boost/ignore_wnonnull_gcc_11.patch new file mode 100644 index 00000000000..f914c1e6826 --- /dev/null +++ b/depends/patches/boost/ignore_wnonnull_gcc_11.patch @@ -0,0 +1,68 @@ +diff --git a/include/boost/concept/detail/general.hpp b/include/boost/concept/detail/general.hpp +index eeb08750..8d7d6f69 100644 +--- a/include/boost/concept/detail/general.hpp ++++ b/include/boost/concept/detail/general.hpp +@@ -28,7 +28,14 @@ namespace detail + template + struct requirement + { ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Wnonnull" ++# endif + static void failed() { ((Model*)0)->~Model(); } ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic pop ++# endif + }; + + struct failed {}; +@@ -36,7 +43,14 @@ struct failed {}; + template + struct requirement + { ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Wnonnull" ++# endif + static void failed() { ((Model*)0)->~Model(); } ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic pop ++# endif + }; + + # ifdef BOOST_OLD_CONCEPT_SUPPORT +@@ -44,7 +58,14 @@ struct requirement + template + struct constraint + { ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Wnonnull" ++# endif + static void failed() { ((Model*)0)->constraints(); } ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic pop ++# endif + }; + + template +diff --git a/include/boost/concept/usage.hpp b/include/boost/concept/usage.hpp +index 373de63a..fe88b5f5 100644 +--- a/include/boost/concept/usage.hpp ++++ b/include/boost/concept/usage.hpp +@@ -13,7 +13,14 @@ namespace boost { namespace concepts { + template + struct usage_requirements + { ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Wnonnull" ++# endif + ~usage_requirements() { ((Model*)0)->~Model(); } ++# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) ++# pragma GCC diagnostic pop ++# endif + }; + + # if BOOST_WORKAROUND(__GNUC__, <= 3) diff --git a/src/init.cpp b/src/init.cpp index c75f277afec..734a797fa3a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index c19c2582582..b6755a47fba 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -34,7 +34,7 @@ #include -#include +#include #include #include #include @@ -78,12 +78,12 @@ void RPCServer::OnStopped(boost::function slot) void RPCServer::OnPreCommand(boost::function slot) { - g_rpcSignals.PreCommand.connect(boost::bind(slot, boost::placeholders::_1)); + g_rpcSignals.PreCommand.connect(boost::bind(slot, _1)); } void RPCServer::OnPostCommand(boost::function slot) { - g_rpcSignals.PostCommand.connect(boost::bind(slot, boost::placeholders::_1)); + g_rpcSignals.PostCommand.connect(boost::bind(slot, _1)); } void RPCTypeCheck(const UniValue& params, diff --git a/src/scheduler.cpp b/src/scheduler.cpp index fde989134f7..08aba322531 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -22,7 +22,7 @@ #include "reverselock.h" #include -#include +#include #include CScheduler::CScheduler() : nThreadsServicingQueue(0), stopRequested(false), stopWhenEmpty(false) diff --git a/src/test/scheduler_tests.cpp b/src/test/scheduler_tests.cpp index 6340b1eda97..d6c93ef3bca 100644 --- a/src/test/scheduler_tests.cpp +++ b/src/test/scheduler_tests.cpp @@ -7,7 +7,7 @@ #include "test/test_bitcoin.h" -#include +#include #include #include #include diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index 1ba85b08c69..a5bd149b2e5 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -461,8 +461,8 @@ TorController::TorController(struct event_base* baseIn, const std::string& targe if (!reconnect_ev) LogPrintf("tor: Failed to create event for reconnection: out of memory?\n"); // Start connection attempts immediately - if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, boost::placeholders::_1), - boost::bind(&TorController::disconnected_cb, this, boost::placeholders::_1) )) { + if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, _1), + boost::bind(&TorController::disconnected_cb, this, _1) )) { LogPrintf("tor: Initiating connection to Tor control port %s failed\n", target); } // Read service private key if cached @@ -540,7 +540,7 @@ void TorController::auth_cb(TorControlConnection& conn, const TorControlReply& r // Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient // choice. TODO; refactor the shutdown sequence some day. conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, GetListenPort(), GetListenPort()), - boost::bind(&TorController::add_onion_cb, this, boost::placeholders::_1, boost::placeholders::_2)); + boost::bind(&TorController::add_onion_cb, this, _1, _2)); } else { LogPrintf("tor: Authentication failed\n"); } @@ -599,7 +599,7 @@ void TorController::authchallenge_cb(TorControlConnection& conn, const TorContro } std::vector computedClientHash = ComputeResponse(TOR_SAFE_CLIENTKEY, cookie, clientNonce, serverNonce); - conn.Command("AUTHENTICATE " + HexStr(computedClientHash), boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); + conn.Command("AUTHENTICATE " + HexStr(computedClientHash), boost::bind(&TorController::auth_cb, this, _1, _2)); } else { LogPrintf("tor: Invalid reply to AUTHCHALLENGE\n"); } @@ -648,23 +648,23 @@ void TorController::protocolinfo_cb(TorControlConnection& conn, const TorControl if (methods.count("HASHEDPASSWORD")) { LogPrint("tor", "tor: Using HASHEDPASSWORD authentication\n"); boost::replace_all(torpassword, "\"", "\\\""); - conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); + conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, _1, _2)); } else { LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n"); } } else if (methods.count("NULL")) { LogPrint("tor", "tor: Using NULL authentication\n"); - conn.Command("AUTHENTICATE", boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); + conn.Command("AUTHENTICATE", boost::bind(&TorController::auth_cb, this, _1, _2)); } else if (methods.count("SAFECOOKIE")) { // Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie LogPrint("tor", "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile); std::pair status_cookie = ReadBinaryFile(cookiefile, TOR_COOKIE_SIZE); if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) { - // conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2)); + // conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), boost::bind(&TorController::auth_cb, this, _1, _2)); cookie = std::vector(status_cookie.second.begin(), status_cookie.second.end()); clientNonce = std::vector(TOR_NONCE_SIZE, 0); GetRandBytes(&clientNonce[0], TOR_NONCE_SIZE); - conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), boost::bind(&TorController::authchallenge_cb, this, boost::placeholders::_1, boost::placeholders::_2)); + conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), boost::bind(&TorController::authchallenge_cb, this, _1, _2)); } else { if (status_cookie.first) { LogPrintf("tor: Authentication cookie %s is not exactly %i bytes, as is required by the spec\n", cookiefile, TOR_COOKIE_SIZE); @@ -686,7 +686,7 @@ void TorController::connected_cb(TorControlConnection& conn) { reconnect_timeout = RECONNECT_TIMEOUT_START; // First send a PROTOCOLINFO command to figure out what authentication is expected - if (!conn.Command("PROTOCOLINFO 1", boost::bind(&TorController::protocolinfo_cb, this, boost::placeholders::_1, boost::placeholders::_2))) + if (!conn.Command("PROTOCOLINFO 1", boost::bind(&TorController::protocolinfo_cb, this, _1, _2))) LogPrintf("tor: Error sending initial protocolinfo command\n"); } @@ -713,8 +713,8 @@ void TorController::Reconnect() /* Try to reconnect and reestablish if we get booted - for example, Tor * may be restarting. */ - if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, boost::placeholders::_1), - boost::bind(&TorController::disconnected_cb, this, boost::placeholders::_1) )) { + if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, _1), + boost::bind(&TorController::disconnected_cb, this, _1) )) { LogPrintf("tor: Re-initiating connection to Tor control port %s failed\n", target); } } diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index a9ab52bad6f..d01e8a849b5 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -13,27 +13,27 @@ CMainSignals& GetMainSignals() } void RegisterValidationInterface(CValidationInterface* pwalletIn) { - g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, boost::placeholders::_1)); - g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); - g_signals.EraseTransaction.connect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, boost::placeholders::_1)); - g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, boost::placeholders::_1)); + g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1)); + g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); + g_signals.EraseTransaction.connect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); + g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); g_signals.RescanWallet.connect(boost::bind(&CValidationInterface::RescanWallet, pwalletIn)); - g_signals.ChainTip.connect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5)); - g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, boost::placeholders::_1)); - g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, boost::placeholders::_1)); - g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); + g_signals.ChainTip.connect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3, _4, _5)); + g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); + g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); + g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); } void UnregisterValidationInterface(CValidationInterface* pwalletIn) { - g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); - g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, boost::placeholders::_1)); - g_signals.ChainTip.disconnect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5)); - g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, boost::placeholders::_1)); - g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, boost::placeholders::_1)); - g_signals.EraseTransaction.disconnect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, boost::placeholders::_1)); - g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, boost::placeholders::_1, boost::placeholders::_2)); + g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); + g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); + g_signals.ChainTip.disconnect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3, _4, _5)); + g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); + g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); + g_signals.EraseTransaction.disconnect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); + g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); g_signals.RescanWallet.disconnect(boost::bind(&CValidationInterface::RescanWallet, pwalletIn)); - g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, boost::placeholders::_1)); + g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1)); } void UnregisterAllValidationInterfaces() { From eedfc49f06066f0aeb0bf7f054117ffda07189d0 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 04:54:55 +0100 Subject: [PATCH 23/57] depends: try disable HTTP/2 in curl for Mac --- depends/packages/libcurl.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/packages/libcurl.mk b/depends/packages/libcurl.mk index 798e2d8214b..cbae74b3e13 100644 --- a/depends/packages/libcurl.mk +++ b/depends/packages/libcurl.mk @@ -7,7 +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 +$(package)_config_opts_darwin=--without-libidn2 --without-zstd --without-nghttp2 $(package)_cflags_darwin=-mmacosx-version-min=$(OSX_MIN_VERSION) $(package)_conf_tool=./configure From ae9e1b804d1a979496c6605ea422255b71d8e02d Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 05:07:30 +0100 Subject: [PATCH 24/57] depends: libcurl, fix mac build --- depends/packages/libcurl.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/packages/libcurl.mk b/depends/packages/libcurl.mk index cbae74b3e13..1996ad3502f 100644 --- a/depends/packages/libcurl.mk +++ b/depends/packages/libcurl.mk @@ -7,7 +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 +$(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 From b4bad46d7afd06ccf53422bc6c9843e2fdc5d0ba Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 06:13:42 +0100 Subject: [PATCH 25/57] ci: mac try to select needed Xcode version --- .github/workflows/komodo_mac_ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 08be886486e..d6806a1bc6c 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -40,6 +40,10 @@ jobs: brew install python3 brew install gmp + - name: Select Xcode version + run: | + sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer' + # https://www.jessesquires.com/blog/2020/01/06/selecting-an-xcode-version-on-github-ci/ - name: Build (macOS) run: | From a2d038c34456ade4fc5726765beb8b30ea0b9ef6 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 06:52:42 +0100 Subject: [PATCH 26/57] build: mac bump macOS SDK to 10.15.6 (12.1) --- depends/hosts/darwin.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 6099fd4c716..c34dc576c91 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -1,8 +1,8 @@ -OSX_MIN_VERSION=10.12 -OSX_SDK_VERSION=10.15.1 -XCODE_VERSION=11.3.1 -XCODE_BUILD_ID=11C505 -LD64_VERSION=530 +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 From 0c0954c2f56ba9aa5747678809c17f372ce9e120 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 9 Mar 2024 07:36:26 +0100 Subject: [PATCH 27/57] build: mac add -fvisibility=hidden -fvisibility-inlines-hidden --- depends/builders/darwin.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk index 9c8aed44e5c..6b877101327 100644 --- a/depends/builders/darwin.mk +++ b/depends/builders/darwin.mk @@ -10,8 +10,8 @@ build_darwin_SHA256SUM = shasum -a 256 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=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(shell xcrun --show-sdk-path) -darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++ --sysroot $(shell xcrun --show-sdk-path) +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) From ec83438e396da276c70962b8296de3c1cf32caef Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 00:56:37 +0100 Subject: [PATCH 28/57] ci: disable explicit select XCode version --- .github/workflows/komodo_mac_ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index d6806a1bc6c..ed30d84813c 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -40,18 +40,14 @@ jobs: brew install python3 brew install gmp - - name: Select Xcode version - run: | - sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer' - # https://www.jessesquires.com/blog/2020/01/06/selecting-an-xcode-version-on-github-ci/ - name: Build (macOS) run: | # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! ./zcutil/build-mac-dtest.sh -j4 tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli - env: - DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer + # env: + # DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer - name: Upload komodo-macos.tar.gz as artifact uses: actions/upload-artifact@v1 From 33f48c4da7347da1ab460ffda6c70d6a92ce7c4f Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 00:57:14 +0100 Subject: [PATCH 29/57] ci: mac run on macos-13 --- .github/workflows/komodo_mac_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index ed30d84813c..24b5f256b22 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -10,7 +10,7 @@ jobs: macos-build: name: MacOS Build - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v2 From 3ce0a0f5aadd7394e176009747404bc83d4307a4 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 10:29:54 +0100 Subject: [PATCH 30/57] build: add -Wno-deprecated-builtins -Wno-enum-constexpr-conversion to unbreak Mac build --- zcutil/build-mac-dtest.sh | 2 +- zcutil/build-mac.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index d14b3713c1f..bd94eb0a183 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -48,7 +48,7 @@ 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$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -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 75185496c3c..c057ee06e24 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -48,7 +48,7 @@ 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$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Werror -Wno-error=attributes -g" \ +CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -Werror -Wno-error=attributes -g" \ ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" make "$@" NO_GTEST=1 STATIC=1 From 2d1f5a4cbc5f59f3bbe07bdd7ffaed33c69da856 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 10:31:41 +0100 Subject: [PATCH 31/57] build: consider libcc.a as static library, not lt-library --- src/Makefile.am | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8e747e135f4..125d3d7a286 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -72,7 +72,9 @@ EXTRA_LIBRARIES += \ $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_CLI) \ - libzcash.a + libzcash.a \ + $(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) From bfc87c04e932a4f4e113015656dd00420f33e082 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 11:05:12 +0100 Subject: [PATCH 32/57] ci: Update to actions/checkout@v3 --- .github/workflows/komodo_linux_ci.yml | 12 ++++++------ .github/workflows/komodo_mac_ci.yml | 12 ++++++------ .github/workflows/komodo_win_ci.yml | 12 ++++++------ .github/workflows/komodod_cd.yml | 6 +++--- 4 files changed, 21 insertions(+), 21 deletions(-) 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 24b5f256b22..91b1fecb67e 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: macos-13 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # Workaround for https://github.com/actions/setup-python/issues/577 - name: Clean up binaries and links (macOS) @@ -63,7 +63,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (Dice, Token, Faucet, Rewards CC) run: | @@ -93,7 +93,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (OraclesCC) run: | @@ -122,7 +122,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (BasicRPC) run: | @@ -151,7 +151,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (ChannelsCC) run: | @@ -180,7 +180,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (HeirCC) run: | 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 5514bf57e30..7a31147801e 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: @@ -78,7 +78,7 @@ jobs: name: OSX Build runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (macOS) run: | rm '/usr/local/bin/2to3' @@ -109,7 +109,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install deps (Windows) env: DEBIAN_FRONTEND: noninteractive From 43b30d02f5d53da88d5d1ce40e08817fb1be4259 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 11:10:36 +0100 Subject: [PATCH 33/57] build: mac add -Wno-unknown-warning-option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The macOS build uses Xcode’s clang, which is relatively old and doesn’t support all the warnings that other platforms do, so we ignore complaints about unsupported warnings. --- zcutil/build-mac-dtest.sh | 2 +- zcutil/build-mac.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index bd94eb0a183..d1220164bf6 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -48,7 +48,7 @@ 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$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -Werror -Wno-error=attributes -g" \ +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 c057ee06e24..7f3ae4a714a 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -48,7 +48,7 @@ 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$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -Werror -Wno-error=attributes -g" \ +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 From 86480ba97f26f9ea2db8afeab76baa70dce73479 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 11:15:03 +0100 Subject: [PATCH 34/57] ci: mac add wallet-utility and komodo-tx to artifacts --- .github/workflows/komodo_mac_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 91b1fecb67e..229cbb3c2c7 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -45,7 +45,7 @@ jobs: run: | # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! ./zcutil/build-mac-dtest.sh -j4 - tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli + tar -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 From 19c5d1a11d489385ccadac136cb3d0d7b6c427f0 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 11:41:57 +0100 Subject: [PATCH 35/57] build: mac add --enable-static --disable-shared --- zcutil/build-mac-dtest.sh | 2 +- zcutil/build-mac.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index d1220164bf6..bbcf040e993 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -49,6 +49,6 @@ make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1 CPPFLAGS="-I$PREFIX/include -arch x86_64 -DTESTMODE" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ 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" +./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" --enable-static --disable-shared make "$@" NO_GTEST=1 STATIC=1 diff --git a/zcutil/build-mac.sh b/zcutil/build-mac.sh index 7f3ae4a714a..65a6d432800 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -49,6 +49,6 @@ make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1 CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ 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" +./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" --enable-static --disable-shared make "$@" NO_GTEST=1 STATIC=1 From 349e5e408bd751173866e95a76231d42250d0566 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 11:42:14 +0100 Subject: [PATCH 36/57] ci: mac revert runner to macos-latest --- .github/workflows/komodo_mac_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 229cbb3c2c7..5572a488b4f 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -10,7 +10,7 @@ jobs: macos-build: name: MacOS Build - runs-on: macos-13 + runs-on: macos-latest steps: - uses: actions/checkout@v3 From 05b83954dd865d9745194cfd34eacb1255a2c497 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 11:47:35 +0100 Subject: [PATCH 37/57] build: revert darwin_debug_CFLAGS to -g -O0 --- depends/hosts/darwin.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index c34dc576c91..43df3a566e5 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -37,7 +37,7 @@ darwin_CXXFLAGS=$(darwin_CFLAGS) darwin_release_CFLAGS=-O2 darwin_release_CXXFLAGS=$(darwin_release_CFLAGS) -darwin_debug_CFLAGS=-O1 +darwin_debug_CFLAGS=-g -O0 darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS) darwin_native_binutils=native_cctools From 82823cd491cd21f318c4ab47e3b83d3b4c99e0a5 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 12:41:01 +0100 Subject: [PATCH 38/57] build: add test-linkage app to test on which library linkage will break --- .github/workflows/komodo_mac_ci.yml | 2 +- src/Makefile.am | 9 ++++++++ src/test-linkage.cpp | 33 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/test-linkage.cpp diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 5572a488b4f..774f84ad374 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -45,7 +45,7 @@ jobs: run: | # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! ./zcutil/build-mac-dtest.sh -j4 - tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx + tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage # env: # DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer diff --git a/src/Makefile.am b/src/Makefile.am index 125d3d7a286..190f8db566a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -549,6 +549,15 @@ if ENABLE_PROTON komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS) endif +# test-linkage binary # +test_linkage_SOURCES = test-linkage.cpp +test_linkage_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) +test_linkage_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +test_linkage_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +test_linkage_LDADD = \ + -lcurl +bin_PROGRAMS += test-linkage + # bitcoin-cli binary # komodo_cli_SOURCES = bitcoin-cli.cpp komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp new file mode 100644 index 00000000000..d2254d0ec25 --- /dev/null +++ b/src/test-linkage.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include + +#if defined(HAVE_CONFIG_H) +#include "config/bitcoin-config.h" +#endif + +int main(int argc, char* argv[]) +{ + std::string sPackageString = "v0.01a"; +#ifdef PACKAGE_STRING + sPackageString = sPackageString + " (" + std::string(PACKAGE_STRING) + ")"; +#endif + std::cerr << "Test Linkage : Runner by Decker " << sPackageString << std::endl; + + curl_global_init(CURL_GLOBAL_DEFAULT); + curl_version_info_data* info = curl_version_info(CURLVERSION_NOW); + if (info) { + printf("libcurl version: %s\n", info->version); + printf("Version number: %x (%d.%d.%d)\n", info->version_num, + (info->version_num >> 16) & 0xff, (info->version_num >> 8) & 0xff, info->version_num & 0xff); + } + + std::cout << "Boost version: " + << BOOST_VERSION / 100000 << "." // Major version + << BOOST_VERSION / 100 % 1000 << "." // Minor version + << BOOST_VERSION % 100 // Patch version + << std::endl; + + curl_global_cleanup(); +} \ No newline at end of file From 4452a97eeaca0e0f5768b6a11fb844e9559231e3 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 13:22:42 +0100 Subject: [PATCH 39/57] test linkage: add libcjson --- src/Makefile.am | 3 ++- src/test-linkage.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 190f8db566a..f773a6958f0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -72,7 +72,7 @@ EXTRA_LIBRARIES += \ $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_CLI) \ - libzcash.a \ + $(LIBZCASH) \ $(LIBCC) if ENABLE_WALLET @@ -555,6 +555,7 @@ test_linkage_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) test_linkage_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) test_linkage_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) test_linkage_LDADD = \ + $(LIBCJSON) \ -lcurl bin_PROGRAMS += test-linkage diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index d2254d0ec25..1a26b14abc4 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -7,6 +7,10 @@ #include "config/bitcoin-config.h" #endif +#include "komodo_cJSON.h" + +char *CClib_name(); // cclib.cpp (no interface) + int main(int argc, char* argv[]) { std::string sPackageString = "v0.01a"; @@ -30,4 +34,27 @@ int main(int argc, char* argv[]) << std::endl; curl_global_cleanup(); + + std::cout << "cJSON version: " << cJSON_Version() << std::endl; + + // std::cout << "CClib name: " << CClib_name() << std::endl; + // nb! libcc can't be added without bitcoin_server and other dependencies + + /* + + Remaining libs to test: + + $(LIBBITCOIN_SERVER) + $(LIBBITCOIN_ZMQ) + $(LIBBITCOIN_PROTON) + $(LIBLEVELDB) + $(LIBMEMENV) + $(EVENT_PTHREADS_LIBS) + $(ZMQ_LIBS) + $(PROTON_LIBS) + $(LIBCC) + -lcurl (explicitly added) + + libbitcoin_wallet.a + */ } \ No newline at end of file From db21ec81bbc9b64fce65a9700207023802e616ac Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 13:42:00 +0100 Subject: [PATCH 40/57] test linkage: add bitcoin common --- src/Makefile.am | 1 + src/test-linkage.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index f773a6958f0..1f2d20c9350 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -555,6 +555,7 @@ test_linkage_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) test_linkage_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) test_linkage_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) test_linkage_LDADD = \ + $(LIBBITCOIN_COMMON) \ $(LIBCJSON) \ -lcurl bin_PROGRAMS += test-linkage diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index 1a26b14abc4..029ffb4f148 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -2,15 +2,19 @@ #include #include #include +#include +#include #if defined(HAVE_CONFIG_H) #include "config/bitcoin-config.h" #endif #include "komodo_cJSON.h" +#include "hex.h" char *CClib_name(); // cclib.cpp (no interface) + int main(int argc, char* argv[]) { std::string sPackageString = "v0.01a"; @@ -35,8 +39,17 @@ int main(int argc, char* argv[]) curl_global_cleanup(); + // cjson test std::cout << "cJSON version: " << cJSON_Version() << std::endl; + // decode_hex test from bitcoin_common + const char hexString[] = "4465636B6572"; + size_t len = std::strlen(hexString); + size_t byteLen = len / 2 + 1; + std::unique_ptr byteArray(new char[byteLen]); + decode_hex((uint8_t *)byteArray.get(), len / 2, hexString); + std::cerr << "Decoded hex: '" << byteArray.get() << "'" << std::endl; + // std::cout << "CClib name: " << CClib_name() << std::endl; // nb! libcc can't be added without bitcoin_server and other dependencies From a822a5df49fe0ea7fbd975b17f929b16dbe9f656 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 13:48:49 +0100 Subject: [PATCH 41/57] test linkage: add zmq libs --- src/Makefile.am | 1 + src/test-linkage.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 1f2d20c9350..97afdf37f64 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -557,6 +557,7 @@ test_linkage_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) test_linkage_LDADD = \ $(LIBBITCOIN_COMMON) \ $(LIBCJSON) \ + $(ZMQ_LIBS) \ -lcurl bin_PROGRAMS += test-linkage diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index 029ffb4f148..0ee2fff1ecf 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -11,6 +11,7 @@ #include "komodo_cJSON.h" #include "hex.h" +#include char *CClib_name(); // cclib.cpp (no interface) @@ -50,6 +51,11 @@ int main(int argc, char* argv[]) decode_hex((uint8_t *)byteArray.get(), len / 2, hexString); std::cerr << "Decoded hex: '" << byteArray.get() << "'" << std::endl; + // libzmq test + int zmq_major, zmq_minor, zmq_patch; + zmq_version(&zmq_major, &zmq_minor, &zmq_patch); + std::cout << "ZeroMQ version: " << zmq_major << "." << zmq_minor << "." << zmq_patch << std::endl; + // std::cout << "CClib name: " << CClib_name() << std::endl; // nb! libcc can't be added without bitcoin_server and other dependencies From 33a8cedc16e49ab8a6d621c8522335587dca7249 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 14:06:10 +0100 Subject: [PATCH 42/57] test linkage: add leveldb + memenv --- src/Makefile.am | 2 ++ src/test-linkage.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 97afdf37f64..74c123c03a3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -558,6 +558,8 @@ test_linkage_LDADD = \ $(LIBBITCOIN_COMMON) \ $(LIBCJSON) \ $(ZMQ_LIBS) \ + $(LIBLEVELDB) \ + $(LIBMEMENV) \ -lcurl bin_PROGRAMS += test-linkage diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index 0ee2fff1ecf..16422fbbdbb 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -12,6 +12,9 @@ #include "komodo_cJSON.h" #include "hex.h" #include +#include +#include +#include char *CClib_name(); // cclib.cpp (no interface) @@ -56,6 +59,11 @@ int main(int argc, char* argv[]) zmq_version(&zmq_major, &zmq_minor, &zmq_patch); std::cout << "ZeroMQ version: " << zmq_major << "." << zmq_minor << "." << zmq_patch << std::endl; + // leveldb test + std::cout << "LevelDB version " << leveldb::kMajorVersion << "." << leveldb::kMinorVersion << std::endl; + leveldb::Env* penv = leveldb::NewMemEnv(leveldb::Env::Default()); + delete penv; + // std::cout << "CClib name: " << CClib_name() << std::endl; // nb! libcc can't be added without bitcoin_server and other dependencies From 6fb09528145057f11a2943d4946a2070ddc723d9 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 15:55:23 +0100 Subject: [PATCH 43/57] test linkage: add bitcoin server and others --- src/Makefile.am | 16 ++++++++-- src/test-linkage.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 74c123c03a3..300bc6db8ad 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -555,11 +555,23 @@ test_linkage_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) test_linkage_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) test_linkage_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) test_linkage_LDADD = \ + $(LIBBITCOIN_SERVER) \ $(LIBBITCOIN_COMMON) \ - $(LIBCJSON) \ - $(ZMQ_LIBS) \ + $(LIBUNIVALUE) \ + $(LIBBITCOIN_UTIL) \ + $(LIBBITCOIN_CRYPTO) \ + $(LIBZCASH) \ $(LIBLEVELDB) \ $(LIBMEMENV) \ + $(LIBSECP256K1) \ + $(LIBCRYPTOCONDITIONS) \ + $(LIBCJSON) \ + $(BOOST_LIBS) \ + $(ZMQ_LIBS) \ + $(LIBZCASH) \ + $(LIBBITCOIN_CRYPTO) \ + $(LIBZCASH_LIBS) \ + $(LIBCC) \ -lcurl bin_PROGRAMS += test-linkage diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index 16422fbbdbb..8a36c7f8a47 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -16,8 +16,69 @@ #include #include -char *CClib_name(); // cclib.cpp (no interface) - +#include "assetchain.h" +#include "bloom.h" +#include "amount.h" +#include "consensus/params.h" +#include "key_io.h" +#include "main.h" +#include "wallet/wallet.h" +#include +#include "cc/CCinclude.h" +#include "komodo_utils.h" +#include "komodo_notary.h" +#include "komodo_interest.h" +#include "ui_interface.h" + +using namespace std; + +// #include "komodo_nSPV_defs.h" +// #include "komodo_nSPV.h" // shared defines, structs, serdes, purge functions +// #include "komodo_nSPV_fullnode.h" // nSPV fullnode handling of the getnSPV request messages +// #include "komodo_nSPV_superlite.h" // nSPV superlite client, issuing requests and handling nSPV responses +// #include "komodo_nSPV_wallet.h" // nSPV_send and support functions, really all the rest is to support this + +/* --- stubs for linkage --- */ +CCriticalSection cs_main; +BlockMap mapBlockIndex; +CChain chainActive; +bool ShutdownRequested() { return false; } +void StartShutdown() {} +CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { return 0; } +uint8_t is_STAKED(const std::string& symbol) { return 0; } +bool IsInitialBlockDownload() { return false; } +bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { return false; } +bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock) { return false; } +bool EnsureWalletIsAvailable(bool avoidException) { return true; } + +uint32_t GetLatestTimestamp(int32_t height) { return 0; } // CCutils.cpp +struct NSPV_inforesp NSPV_inforesult; +char NSPV_pubkeystr[67],NSPV_wifstr[64]; + +int32_t STAKED_era(int timestamp) { return 0; } // notaries_staked.cpp +int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { return 0; } +int32_t komodo_longestchain() { return -1; } +uint64_t komodo_interestsum() { return 0; } // we don't link agains libbitcoin_wallet_a, so should have stubs +// uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight) { return 0; } +CClientUIInterface uiInterface; +bool pubkey2addr(char *destaddr,uint8_t *pubkey33) { return false; } +void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries) { } +uint256 GetMerkleRoot(const std::vector& vLeaves) { return uint256(); } // cc/eval.cpp +bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& params) { return false; } //pow.cpp +isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest) { return ISMINE_NO; } +CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight) { return CMutableTransaction(); } +FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly) { return nullptr; } +// bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos,bool checkPOW) { return false; } +bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW) { return false; } +void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const {} + +CScript COINBASE_FLAGS; + +assetchain chainName; +#ifdef ENABLE_WALLET +CWallet* pwalletMain = nullptr; +#endif +/* --- stubs for linkage --- */ int main(int argc, char* argv[]) { @@ -37,7 +98,8 @@ int main(int argc, char* argv[]) std::cout << "Boost version: " << BOOST_VERSION / 100000 << "." // Major version - << BOOST_VERSION / 100 % 1000 << "." // Minor version + << BOOST_VERSION / 100 % 1000 + << "." // Minor version << BOOST_VERSION % 100 // Patch version << std::endl; @@ -64,6 +126,12 @@ int main(int argc, char* argv[]) leveldb::Env* penv = leveldb::NewMemEnv(leveldb::Env::Default()); delete penv; + // bitcoin server test + CBloomFilter filter; + filter.clear(); + // to use this we should link GetRand from libbitcoin_util and this will require libsecp256k1 also, and libzcash_libs (lsodium) + // and libbitcoin crypto for hashes ... + // std::cout << "CClib name: " << CClib_name() << std::endl; // nb! libcc can't be added without bitcoin_server and other dependencies From 41e231dbff975846924ee869f8995f16683625c9 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 17:19:25 +0100 Subject: [PATCH 44/57] linkage test: add extra lib calls for linkage --- src/test-linkage.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index 8a36c7f8a47..7bcadf06693 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -30,6 +30,9 @@ #include "komodo_interest.h" #include "ui_interface.h" +#include +#include + using namespace std; // #include "komodo_nSPV_defs.h" @@ -126,12 +129,66 @@ int main(int argc, char* argv[]) leveldb::Env* penv = leveldb::NewMemEnv(leveldb::Env::Default()); delete penv; - // bitcoin server test + /* libbitcoin server test */ CBloomFilter filter; filter.clear(); // to use this we should link GetRand from libbitcoin_util and this will require libsecp256k1 also, and libzcash_libs (lsodium) // and libbitcoin crypto for hashes ... + secp256k1_pubkey pubkey; + size_t pubkeylen = 0; + + std::cout << "Public Key: "; + for (int i = 0; i < sizeof(pubkey.data); ++i) { + std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast(pubkey.data[i]); + } + std::cout << std::dec << std::endl; + + /* libbitcoin_util call */ + std::vectorvch(32, 0); + std::cout << "Zero bytes : " << HexStr(vch, true) << std::endl; + GetRandBytes(vch.data(), vch.size()); + std::cout << "Random bytes: " << HexStr(vch, true) << std::endl; + + /* libsecp256k1 call */ + secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); + unsigned char seed[32]; + LockObject(seed); + GetRandBytes(seed, 32); + bool ret = secp256k1_context_randomize(ctx, seed); + UnlockObject(seed); + std::cerr << secp256k1_ec_pubkey_create(ctx, &pubkey, vch.data()) << std::endl; + if (ctx) { + secp256k1_context_destroy(ctx); + } + + /* libbitcoin common call */ + CScript script = CScript() << OP_1; + std::cout << script.ToString() << std::endl; + + /* libunivalue call */ + UniValue obj(UniValue::VOBJ); + obj.push_back(Pair("status", "still buggy =)")); + std::cout << obj.write() << std::endl; + + /* libbitcoin crypto call */ + string data = "DECKER"; + uint256 sha256; + CSHA256().Write((const unsigned char *)data.c_str(), data.length()).Finalize(sha256.begin()); + std::cout << sha256.ToString() << std::endl; + std::cout << HexStr(sha256) << std::endl; + + /* libzcash call */ + std::vector bytes{1, 1, 1, 0, 0, 0, 1, 1, 1}; + std::vector vBool = convertBytesVectorToVector(bytes); + std::cout << "vBool contents: "; + for (const bool bit : vBool) { + std::cout << bit; + } + std::cout << std::endl; + + /* libcryptoconditions call */ + // std::cout << "CClib name: " << CClib_name() << std::endl; // nb! libcc can't be added without bitcoin_server and other dependencies From 04c1edf0b9657e441ce6e5c38b3748603d5c290c Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 17:55:05 +0100 Subject: [PATCH 45/57] linkage test: add libcryptocondition, libcjson, boost thread and sodium calls --- src/test-linkage.cpp | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index 7bcadf06693..097bced0bff 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -32,6 +32,11 @@ #include #include +#include +#include "komodo_cutils.h" + +#include +#include using namespace std; @@ -83,6 +88,10 @@ CWallet* pwalletMain = nullptr; #endif /* --- stubs for linkage --- */ +void printMessage(const std::string& message) { + std::cout << message << std::endl; +} + int main(int argc, char* argv[]) { std::string sPackageString = "v0.01a"; @@ -183,11 +192,39 @@ int main(int argc, char* argv[]) std::vector vBool = convertBytesVectorToVector(bytes); std::cout << "vBool contents: "; for (const bool bit : vBool) { - std::cout << bit; + std::cout << (bit ? "1" : "0"); } std::cout << std::endl; /* libcryptoconditions call */ + CC *cond = cc_new(CC_Eval); + if (cond) { + cc_free(cond); + } + + /* libcjson call */ + const char s_decker[] = "DECKER"; + char *cloned_decker = clonestr(const_cast(s_decker)); + if (cloned_decker) { + // there should not be any clones of Decker; all clones must be freed =) + std::cout << cloned_decker << std::endl; + free(cloned_decker); + } + + /* boost lib(s) call */ + std::string threadMessage = "This message is printed from a separate thread."; + boost::thread myThread(printMessage, threadMessage); + std::cout << "This message is printed from the main thread." << std::endl; + myThread.join(); + + /* sodium, rustzcash calls */ + if (sodium_init() < 0) { + std::cerr << "Error initializing Libsodium" << std::endl; + } else { + const char* version = sodium_version_string(); + std::cout << "Libsodium version: " << version << std::endl; + } + // std::cout << "CClib name: " << CClib_name() << std::endl; // nb! libcc can't be added without bitcoin_server and other dependencies From dfd0e2bea60427a9e7369d0d953d4a23d396fa1e Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 17:56:05 +0100 Subject: [PATCH 46/57] build: add logging debug info into mac build script --- zcutil/build-mac-dtest.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index bbcf040e993..79e31b1a3cb 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -52,3 +52,10 @@ CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-depre ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" --enable-static --disable-shared make "$@" NO_GTEST=1 STATIC=1 + +# logging debug info +sw_vers +xcodebuild -version +ld -v +xxd -l 16 -g 1 ./src/komodod || true +xxd -l 16 -g 1 ./src/test-linkage || true From 324040a6336c87ad660ebd14b02d7bce8deae2fd Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 18:53:51 +0100 Subject: [PATCH 47/57] test linkage: add sodium, librustzcash calls --- src/test-linkage.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp index 097bced0bff..c8cdb60cfbf 100644 --- a/src/test-linkage.cpp +++ b/src/test-linkage.cpp @@ -21,6 +21,7 @@ #include "amount.h" #include "consensus/params.h" #include "key_io.h" +#include "cc/CCinclude.h" #include "main.h" #include "wallet/wallet.h" #include @@ -37,6 +38,7 @@ #include #include +#include "librustzcash.h" using namespace std; @@ -60,6 +62,8 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo bool EnsureWalletIsAvailable(bool avoidException) { return true; } uint32_t GetLatestTimestamp(int32_t height) { return 0; } // CCutils.cpp +bool pubkey2addr(char *destaddr,uint8_t *pubkey33) { return false; } + struct NSPV_inforesp NSPV_inforesult; char NSPV_pubkeystr[67],NSPV_wifstr[64]; @@ -69,7 +73,6 @@ int32_t komodo_longestchain() { return -1; } uint64_t komodo_interestsum() { return 0; } // we don't link agains libbitcoin_wallet_a, so should have stubs // uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight) { return 0; } CClientUIInterface uiInterface; -bool pubkey2addr(char *destaddr,uint8_t *pubkey33) { return false; } void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries) { } uint256 GetMerkleRoot(const std::vector& vLeaves) { return uint256(); } // cc/eval.cpp bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& params) { return false; } //pow.cpp @@ -217,7 +220,7 @@ int main(int argc, char* argv[]) std::cout << "This message is printed from the main thread." << std::endl; myThread.join(); - /* sodium, rustzcash calls */ + /* sodium call */ if (sodium_init() < 0) { std::cerr << "Error initializing Libsodium" << std::endl; } else { @@ -225,6 +228,15 @@ int main(int argc, char* argv[]) std::cout << "Libsodium version: " << version << std::endl; } + /* librustzcash calls */ + auto ctx_librustzcash = librustzcash_sapling_proving_ctx_init(); + librustzcash_sapling_proving_ctx_free(ctx_librustzcash); + + /* libcc calls */ + + /* after this main.o should be linked to the project as a part of libbitcoin_server */ + // char destaddr[65]; + // Getscriptaddress(destaddr,CScript()); // std::cout << "CClib name: " << CClib_name() << std::endl; // nb! libcc can't be added without bitcoin_server and other dependencies From 8a14d86b7017f9b551fe3d8d6a7aa22655e9b601 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 18:55:03 +0100 Subject: [PATCH 48/57] ci: mac get rid of using tar for archive artifacts, upload binaries directly --- .github/workflows/komodo_mac_ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 774f84ad374..81d2d02fe50 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -45,15 +45,20 @@ jobs: run: | # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! ./zcutil/build-mac-dtest.sh -j4 - tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage + # tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage # env: # DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer - - name: Upload komodo-macos.tar.gz as artifact - uses: actions/upload-artifact@v1 + - name: Upload binaries as artifacts + uses: actions/upload-artifact@v4 with: name: komodo-macos - path: ./komodo-macos.tar.gz + path: | + ./src/komodod + ./src/komodo-cli + ./src/wallet-utility + ./src/komodo-tx + ./src/test-linkage macos-test-dice-token-reards-faucet-cc: if: ${{ false }} From d9f516b55acf3c527c60d6d3a18a071092f1d0e5 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 19:22:40 +0100 Subject: [PATCH 49/57] ci: mac revert .tar.gz archive creation and upload to artifacts --- .github/workflows/komodo_mac_ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 81d2d02fe50..8b2acfde4c5 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -45,7 +45,7 @@ jobs: run: | # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! ./zcutil/build-mac-dtest.sh -j4 - # tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage + tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage # env: # DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer @@ -59,6 +59,7 @@ jobs: ./src/wallet-utility ./src/komodo-tx ./src/test-linkage + ./komodo-macos.tar.gz macos-test-dice-token-reards-faucet-cc: if: ${{ false }} From 900409884f4275a563259bb55f15aefddc4b0bdb Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 19:55:20 +0100 Subject: [PATCH 50/57] ci: use gtar on macos runner to avoid corrupting tar file contents - https://github.com/actions/runner-images/issues/2619 --- .github/workflows/komodo_mac_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 8b2acfde4c5..0f9c643cd46 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -45,7 +45,7 @@ jobs: run: | # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! ./zcutil/build-mac-dtest.sh -j4 - tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage + gtar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage # env: # DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer From 81fd9afded3e22d7c06834ed609873ac7e80fe50 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 21:24:59 +0100 Subject: [PATCH 51/57] ci: mac bump actions versions --- .github/workflows/komodo_mac_ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 0f9c643cd46..371471bbb5e 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@v3 + - uses: actions/checkout@v4 # Workaround for https://github.com/actions/setup-python/issues/577 - name: Clean up binaries and links (macOS) @@ -69,7 +69,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install deps (Dice, Token, Faucet, Rewards CC) run: | @@ -78,7 +78,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 @@ -99,7 +99,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install deps (OraclesCC) run: | @@ -107,7 +107,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 @@ -128,7 +128,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install deps (BasicRPC) run: | @@ -136,7 +136,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 @@ -157,7 +157,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install deps (ChannelsCC) run: | @@ -165,7 +165,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 @@ -186,7 +186,7 @@ jobs: needs: macos-build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install deps (HeirCC) run: | @@ -194,7 +194,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 From d86c8fcb950b836db9a94e891b65759159fbbe28 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 21:26:07 +0100 Subject: [PATCH 52/57] ci: mac remove separate files upload, remove test-linkage --- .github/workflows/komodo_mac_ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 371471bbb5e..52ddbc368d0 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -45,7 +45,7 @@ jobs: run: | # flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!! ./zcutil/build-mac-dtest.sh -j4 - gtar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx src/test-linkage + 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 @@ -54,11 +54,6 @@ jobs: with: name: komodo-macos path: | - ./src/komodod - ./src/komodo-cli - ./src/wallet-utility - ./src/komodo-tx - ./src/test-linkage ./komodo-macos.tar.gz macos-test-dice-token-reards-faucet-cc: From f313d5f9371ccca56593cb9de29b347b4b0cc7c2 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 21:26:40 +0100 Subject: [PATCH 53/57] ci: mac remove gmp installation --- .github/workflows/komodo_mac_ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index 52ddbc368d0..f8e28607af5 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -38,7 +38,6 @@ jobs: 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/ - name: Build (macOS) From b8ae49cd0adbe2bed5e261d73559fca1c5ac760c Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 21:28:27 +0100 Subject: [PATCH 54/57] remove test-linkage experiment(s) --- src/Makefile.am | 26 ----- src/test-linkage.cpp | 261 ------------------------------------------- 2 files changed, 287 deletions(-) delete mode 100644 src/test-linkage.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 300bc6db8ad..00d04f13d45 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -549,32 +549,6 @@ if ENABLE_PROTON komodod_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS) endif -# test-linkage binary # -test_linkage_SOURCES = test-linkage.cpp -test_linkage_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) -test_linkage_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -test_linkage_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -test_linkage_LDADD = \ - $(LIBBITCOIN_SERVER) \ - $(LIBBITCOIN_COMMON) \ - $(LIBUNIVALUE) \ - $(LIBBITCOIN_UTIL) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBZCASH) \ - $(LIBLEVELDB) \ - $(LIBMEMENV) \ - $(LIBSECP256K1) \ - $(LIBCRYPTOCONDITIONS) \ - $(LIBCJSON) \ - $(BOOST_LIBS) \ - $(ZMQ_LIBS) \ - $(LIBZCASH) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBZCASH_LIBS) \ - $(LIBCC) \ - -lcurl -bin_PROGRAMS += test-linkage - # bitcoin-cli binary # komodo_cli_SOURCES = bitcoin-cli.cpp komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) diff --git a/src/test-linkage.cpp b/src/test-linkage.cpp deleted file mode 100644 index c8cdb60cfbf..00000000000 --- a/src/test-linkage.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#if defined(HAVE_CONFIG_H) -#include "config/bitcoin-config.h" -#endif - -#include "komodo_cJSON.h" -#include "hex.h" -#include -#include -#include -#include - -#include "assetchain.h" -#include "bloom.h" -#include "amount.h" -#include "consensus/params.h" -#include "key_io.h" -#include "cc/CCinclude.h" -#include "main.h" -#include "wallet/wallet.h" -#include -#include "cc/CCinclude.h" -#include "komodo_utils.h" -#include "komodo_notary.h" -#include "komodo_interest.h" -#include "ui_interface.h" - -#include -#include -#include -#include "komodo_cutils.h" - -#include -#include -#include "librustzcash.h" - -using namespace std; - -// #include "komodo_nSPV_defs.h" -// #include "komodo_nSPV.h" // shared defines, structs, serdes, purge functions -// #include "komodo_nSPV_fullnode.h" // nSPV fullnode handling of the getnSPV request messages -// #include "komodo_nSPV_superlite.h" // nSPV superlite client, issuing requests and handling nSPV responses -// #include "komodo_nSPV_wallet.h" // nSPV_send and support functions, really all the rest is to support this - -/* --- stubs for linkage --- */ -CCriticalSection cs_main; -BlockMap mapBlockIndex; -CChain chainActive; -bool ShutdownRequested() { return false; } -void StartShutdown() {} -CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { return 0; } -uint8_t is_STAKED(const std::string& symbol) { return 0; } -bool IsInitialBlockDownload() { return false; } -bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { return false; } -bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock) { return false; } -bool EnsureWalletIsAvailable(bool avoidException) { return true; } - -uint32_t GetLatestTimestamp(int32_t height) { return 0; } // CCutils.cpp -bool pubkey2addr(char *destaddr,uint8_t *pubkey33) { return false; } - -struct NSPV_inforesp NSPV_inforesult; -char NSPV_pubkeystr[67],NSPV_wifstr[64]; - -int32_t STAKED_era(int timestamp) { return 0; } // notaries_staked.cpp -int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { return 0; } -int32_t komodo_longestchain() { return -1; } -uint64_t komodo_interestsum() { return 0; } // we don't link agains libbitcoin_wallet_a, so should have stubs -// uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight) { return 0; } -CClientUIInterface uiInterface; -void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries) { } -uint256 GetMerkleRoot(const std::vector& vLeaves) { return uint256(); } // cc/eval.cpp -bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& params) { return false; } //pow.cpp -isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest) { return ISMINE_NO; } -CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight) { return CMutableTransaction(); } -FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly) { return nullptr; } -// bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos,bool checkPOW) { return false; } -bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW) { return false; } -void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const {} - -CScript COINBASE_FLAGS; - -assetchain chainName; -#ifdef ENABLE_WALLET -CWallet* pwalletMain = nullptr; -#endif -/* --- stubs for linkage --- */ - -void printMessage(const std::string& message) { - std::cout << message << std::endl; -} - -int main(int argc, char* argv[]) -{ - std::string sPackageString = "v0.01a"; -#ifdef PACKAGE_STRING - sPackageString = sPackageString + " (" + std::string(PACKAGE_STRING) + ")"; -#endif - std::cerr << "Test Linkage : Runner by Decker " << sPackageString << std::endl; - - curl_global_init(CURL_GLOBAL_DEFAULT); - curl_version_info_data* info = curl_version_info(CURLVERSION_NOW); - if (info) { - printf("libcurl version: %s\n", info->version); - printf("Version number: %x (%d.%d.%d)\n", info->version_num, - (info->version_num >> 16) & 0xff, (info->version_num >> 8) & 0xff, info->version_num & 0xff); - } - - std::cout << "Boost version: " - << BOOST_VERSION / 100000 << "." // Major version - << BOOST_VERSION / 100 % 1000 - << "." // Minor version - << BOOST_VERSION % 100 // Patch version - << std::endl; - - curl_global_cleanup(); - - // cjson test - std::cout << "cJSON version: " << cJSON_Version() << std::endl; - - // decode_hex test from bitcoin_common - const char hexString[] = "4465636B6572"; - size_t len = std::strlen(hexString); - size_t byteLen = len / 2 + 1; - std::unique_ptr byteArray(new char[byteLen]); - decode_hex((uint8_t *)byteArray.get(), len / 2, hexString); - std::cerr << "Decoded hex: '" << byteArray.get() << "'" << std::endl; - - // libzmq test - int zmq_major, zmq_minor, zmq_patch; - zmq_version(&zmq_major, &zmq_minor, &zmq_patch); - std::cout << "ZeroMQ version: " << zmq_major << "." << zmq_minor << "." << zmq_patch << std::endl; - - // leveldb test - std::cout << "LevelDB version " << leveldb::kMajorVersion << "." << leveldb::kMinorVersion << std::endl; - leveldb::Env* penv = leveldb::NewMemEnv(leveldb::Env::Default()); - delete penv; - - /* libbitcoin server test */ - CBloomFilter filter; - filter.clear(); - // to use this we should link GetRand from libbitcoin_util and this will require libsecp256k1 also, and libzcash_libs (lsodium) - // and libbitcoin crypto for hashes ... - - secp256k1_pubkey pubkey; - size_t pubkeylen = 0; - - std::cout << "Public Key: "; - for (int i = 0; i < sizeof(pubkey.data); ++i) { - std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast(pubkey.data[i]); - } - std::cout << std::dec << std::endl; - - /* libbitcoin_util call */ - std::vectorvch(32, 0); - std::cout << "Zero bytes : " << HexStr(vch, true) << std::endl; - GetRandBytes(vch.data(), vch.size()); - std::cout << "Random bytes: " << HexStr(vch, true) << std::endl; - - /* libsecp256k1 call */ - secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - unsigned char seed[32]; - LockObject(seed); - GetRandBytes(seed, 32); - bool ret = secp256k1_context_randomize(ctx, seed); - UnlockObject(seed); - std::cerr << secp256k1_ec_pubkey_create(ctx, &pubkey, vch.data()) << std::endl; - if (ctx) { - secp256k1_context_destroy(ctx); - } - - /* libbitcoin common call */ - CScript script = CScript() << OP_1; - std::cout << script.ToString() << std::endl; - - /* libunivalue call */ - UniValue obj(UniValue::VOBJ); - obj.push_back(Pair("status", "still buggy =)")); - std::cout << obj.write() << std::endl; - - /* libbitcoin crypto call */ - string data = "DECKER"; - uint256 sha256; - CSHA256().Write((const unsigned char *)data.c_str(), data.length()).Finalize(sha256.begin()); - std::cout << sha256.ToString() << std::endl; - std::cout << HexStr(sha256) << std::endl; - - /* libzcash call */ - std::vector bytes{1, 1, 1, 0, 0, 0, 1, 1, 1}; - std::vector vBool = convertBytesVectorToVector(bytes); - std::cout << "vBool contents: "; - for (const bool bit : vBool) { - std::cout << (bit ? "1" : "0"); - } - std::cout << std::endl; - - /* libcryptoconditions call */ - CC *cond = cc_new(CC_Eval); - if (cond) { - cc_free(cond); - } - - /* libcjson call */ - const char s_decker[] = "DECKER"; - char *cloned_decker = clonestr(const_cast(s_decker)); - if (cloned_decker) { - // there should not be any clones of Decker; all clones must be freed =) - std::cout << cloned_decker << std::endl; - free(cloned_decker); - } - - /* boost lib(s) call */ - std::string threadMessage = "This message is printed from a separate thread."; - boost::thread myThread(printMessage, threadMessage); - std::cout << "This message is printed from the main thread." << std::endl; - myThread.join(); - - /* sodium call */ - if (sodium_init() < 0) { - std::cerr << "Error initializing Libsodium" << std::endl; - } else { - const char* version = sodium_version_string(); - std::cout << "Libsodium version: " << version << std::endl; - } - - /* librustzcash calls */ - auto ctx_librustzcash = librustzcash_sapling_proving_ctx_init(); - librustzcash_sapling_proving_ctx_free(ctx_librustzcash); - - /* libcc calls */ - - /* after this main.o should be linked to the project as a part of libbitcoin_server */ - // char destaddr[65]; - // Getscriptaddress(destaddr,CScript()); - - // std::cout << "CClib name: " << CClib_name() << std::endl; - // nb! libcc can't be added without bitcoin_server and other dependencies - - /* - - Remaining libs to test: - - $(LIBBITCOIN_SERVER) - $(LIBBITCOIN_ZMQ) - $(LIBBITCOIN_PROTON) - $(LIBLEVELDB) - $(LIBMEMENV) - $(EVENT_PTHREADS_LIBS) - $(ZMQ_LIBS) - $(PROTON_LIBS) - $(LIBCC) - -lcurl (explicitly added) - - libbitcoin_wallet.a - */ -} \ No newline at end of file From 9994db008ba61493386b29ae1c73ec30e352e968 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 21:29:02 +0100 Subject: [PATCH 55/57] remove logging debug info after build on mac --- zcutil/build-mac-dtest.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index 79e31b1a3cb..bbcf040e993 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -52,10 +52,3 @@ CXXFLAGS="-arch x86_64 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-depre ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" --enable-static --disable-shared make "$@" NO_GTEST=1 STATIC=1 - -# logging debug info -sw_vers -xcodebuild -version -ld -v -xxd -l 16 -g 1 ./src/komodod || true -xxd -l 16 -g 1 ./src/test-linkage || true From 6b8683af1a45e21361ab8200a86ea41dcbdb9624 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 21:32:27 +0100 Subject: [PATCH 56/57] build: mac remove -enable-static --disable-shared from scripts --- zcutil/build-mac-dtest.sh | 6 ++++-- zcutil/build-mac.sh | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/zcutil/build-mac-dtest.sh b/zcutil/build-mac-dtest.sh index bbcf040e993..1ab7377abe5 100755 --- a/zcutil/build-mac-dtest.sh +++ b/zcutil/build-mac-dtest.sh @@ -48,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$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" --enable-static --disable-shared +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 65a6d432800..991d4d09a03 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -48,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$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" --enable-static --disable-shared +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 From 9a79ff0b0fd02974afe20d5245166fced92c7720 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 10 Mar 2024 21:45:17 +0100 Subject: [PATCH 57/57] ci: mac add / fix workflow comments --- .github/workflows/komodo_mac_ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index f8e28607af5..f5482660f7b 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -40,15 +40,16 @@ jobs: brew install python3 # 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!!! ./zcutil/build-mac-dtest.sh -j4 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 binaries as artifacts + - name: Upload komodo-macos.tar.gz as artifact uses: actions/upload-artifact@v4 with: name: komodo-macos