From 3f7d51ce60470678aef6db592d4a15faeff7af5a Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 22 Feb 2021 08:15:19 -0500 Subject: [PATCH 01/11] Add asmap.dat to Debian package --- zcutil/build-debian-package.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/zcutil/build-debian-package.sh b/zcutil/build-debian-package.sh index 629a053d4..421129702 100755 --- a/zcutil/build-debian-package.sh +++ b/zcutil/build-debian-package.sh @@ -45,6 +45,7 @@ chmod 0755 -R $BUILD_DIR/* #cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN # Copy binaries. We prefix our komodod binaries with hush- to prevent conflicting with # a stock komodod or other flavors of KMD +cp $SRC_PATH/contrib/asmap/asmap.dat $DEB_SHR cp $SRC_PATH/sapling-spend.params $DEB_SHR cp $SRC_PATH/sapling-output.params $DEB_SHR cp $SRC_PATH/src/komodod $DEB_BIN/hush-komodod From 30bfc7be3a3ef05ae5482bba2d436a74c29de469 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 22 Feb 2021 08:20:32 -0500 Subject: [PATCH 02/11] Add asmap to linux binary script --- contrib/devtools/gen-linux-binary-release.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/devtools/gen-linux-binary-release.sh b/contrib/devtools/gen-linux-binary-release.sh index a8ae359cb..47bd650fc 100755 --- a/contrib/devtools/gen-linux-binary-release.sh +++ b/contrib/devtools/gen-linux-binary-release.sh @@ -1,11 +1,12 @@ #!/bin/bash -# Copyright (c) 2016-2020 The Hush developers +# Copyright (c) 2016-2021 The Hush developers # Released under the GPLv3 #TODO: autodect version number, error handling -FILE="hush-3.6.0-linux-amd64.tar" +FILE="hush-3.6.2-linux-amd64.tar" mkdir build +cp contrib/asmap/asmap.dat build/ cp sapling*.params build/ cd src cp komodod komodo-cli komodo-tx hushd hush-cli hush-tx hush-smart-chain ../build From eb9a7cdd007a89fe591e768755660bd8f115dfbd Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 22 Feb 2021 08:34:53 -0500 Subject: [PATCH 03/11] Improve linux binary generation --- contrib/devtools/gen-linux-binary-release.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/devtools/gen-linux-binary-release.sh b/contrib/devtools/gen-linux-binary-release.sh index 47bd650fc..07e7af868 100755 --- a/contrib/devtools/gen-linux-binary-release.sh +++ b/contrib/devtools/gen-linux-binary-release.sh @@ -2,15 +2,22 @@ # Copyright (c) 2016-2021 The Hush developers # Released under the GPLv3 +set -e +set -x + #TODO: autodect version number, error handling FILE="hush-3.6.2-linux-amd64.tar" +TIME=$(perl -e 'print time') +mv build build.$TIME mkdir build cp contrib/asmap/asmap.dat build/ cp sapling*.params build/ cd src cp komodod komodo-cli komodo-tx hushd hush-cli hush-tx hush-smart-chain ../build cd ../build +strip komodo* tar -f $FILE -c * -gzip $FILE - +gzip -9 $FILE +sha256sum *.gz +du -sh *.gz From cec16658f1e36e10d455501cad16ec0f2a24c649 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 23 Feb 2021 07:43:28 -0500 Subject: [PATCH 04/11] Comments for future historians --- src/init.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 7ecfe9dbd..caad515dc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,8 +1,10 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin Core developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html +// What happened to the SuperNET devs, who were dedicated to privacy??? +// Did they go the way of the dodo when they embraced KYC? /****************************************************************************** * Copyright © 2014-2019 The SuperNET Developers. * * * From 00a7437ad818e5f06782cba4694e7f53d7efe20d Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 23 Feb 2021 07:54:40 -0800 Subject: [PATCH 05/11] Add -fPIC to make wolfssl happy on Ubuntu 16.04 --- depends/packages/wolfssl.mk | 2 +- src/Makefile.am | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/depends/packages/wolfssl.mk b/depends/packages/wolfssl.mk index 07f235838..d1e9ac08c 100644 --- a/depends/packages/wolfssl.mk +++ b/depends/packages/wolfssl.mk @@ -50,7 +50,7 @@ endef #endef define $(package)_build_cmds - $(MAKE) -j1 src/libwolfssl.la + $(MAKE) CPPFLAGS='-fPIC' -j1 src/libwolfssl.la endef define $(package)_stage_cmds diff --git a/src/Makefile.am b/src/Makefile.am index 1eb56ec24..0711b52cc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -# Copyright 2016-2020 The Hush developers +# Copyright 2016-2021 The Hush developers # Distributed under the GPLv3 software license, see the accompanying # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html @@ -483,8 +483,8 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h # komodod binary # komodod_SOURCES = bitcoind.cpp -komodod_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -komodod_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +komodod_CPPFLAGS = -fPIC $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) +komodod_CXXFLAGS = -fPIC $(AM_CXXFLAGS) $(PIE_FLAGS) komodod_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) if TARGET_WINDOWS From fea60d8bee0b044f7235fac86fc5af604d9f6698 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 23 Feb 2021 16:17:56 +0000 Subject: [PATCH 06/11] Update 'INSTALL.md' --- INSTALL.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 0c4095e5c..809316604 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -42,6 +42,18 @@ cd hush3 ./build.sh -j$(nproc) ``` +## Building On Ubuntu 16.04 and older systems + +Some older compilers may not be able to compile modern code, such as gcc 5.4 which comes with Ubuntu 16.04 by default. Here is how to install gcc 7 on Ubuntu 16.04: + +``` +sudo add-apt-repository ppa:ubuntu-toolchain-r/test && \ +apt update && \ +apt-get install -y gcc-7 g++-7 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60 && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 +``` + ## Run a HUSH Node ```sh From 36c655a07396b2f3769385405e81954fc1dcd434 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 23 Feb 2021 16:20:19 +0000 Subject: [PATCH 07/11] Update 'INSTALL.md' --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 809316604..7c7e5844f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -4,7 +4,7 @@ To install a Debian package: - dpkg -i hush-3.5.0-amd4.deb + dpkg -i hush-3.6.2-amd4.deb To uninstall: From 15ef25bf65639950b9b12ec31253f4808a0a090f Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 23 Feb 2021 11:36:57 -0500 Subject: [PATCH 08/11] Try hard to find asmap.dat in all scenarios: src, binary, packages --- src/init.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index caad515dc..2624945bf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1097,13 +1097,52 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) fs::path pwd = fs::path(cwd); fs::path contrib = pwd / ".." / "contrib" / "asmap"; - // if no filepath, use the default in contrib + // If no asmap given (default), look for one + // First we look in PWD, the most common case (binaries) + // Then we look in /usr/share/hush, for Debian packages + // then we look in ../contrib/asmap/ for compiling from source case + // finally we try the parent directory .. as a last resort + // if no asmap can be found, something is wrong, and we exit if (asmap_path.empty()) { - asmap_path = contrib / DEFAULT_ASMAP_FILENAME; - } - if (!asmap_path.is_absolute()) { - asmap_path = GetDataDir() / asmap_path; + // Most binaries will have it in PWD + asmap_path = pwd / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Debian Packages + asmap_path = fs::path("/usr/share/hush") / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Source code + asmap_path = contrib / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Last Resort: Check the parent directory + asmap_path = pwd / ".." / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Shit is fucked up, die an honorable death + InitError(strprintf(_("Could not find any asmap file! Please report this bug to Hush Developers"))); + return false; + } + } + } + } + } else { + if (!asmap_path.is_absolute()) { + asmap_path = GetDataDir() / asmap_path; + } + printf("%s: looking for custom asmap file at %s\n", __func__, asmap_path.c_str() ); } + + //TODO: verify asmap_path is not a directory if (!fs::exists(asmap_path)) { InitError(strprintf(_("Could not find asmap file %s"), asmap_path)); return false; @@ -1115,8 +1154,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) } const uint256 asmap_version = SerializeHash(asmap); printf("%s: asmap version=%s with %lu mappings\n", __func__, asmap_version.ToString().c_str(), asmap.size()); + LogPrintf("Using asmap version %s for IP bucketing with %lu mappings\n", asmap_version.ToString(), asmap.size()); addrman.m_asmap = std::move(asmap); // //node.connman->SetAsmap(std::move(asmap)); - LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString()); } else { LogPrintf("Using /16 prefix for IP bucketing, but why?\n"); From 61c162f5f584ae8e50f7ca9941a29665dc7a0dbc Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 23 Feb 2021 16:50:26 +0000 Subject: [PATCH 09/11] Update 'INSTALL.md' --- INSTALL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 7c7e5844f..0b2f084e7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -44,10 +44,10 @@ cd hush3 ## Building On Ubuntu 16.04 and older systems -Some older compilers may not be able to compile modern code, such as gcc 5.4 which comes with Ubuntu 16.04 by default. Here is how to install gcc 7 on Ubuntu 16.04: +Some older compilers may not be able to compile modern code, such as gcc 5.4 which comes with Ubuntu 16.04 by default. Here is how to install gcc 7 on Ubuntu 16.04. Run these commands as root: ``` -sudo add-apt-repository ppa:ubuntu-toolchain-r/test && \ +add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt update && \ apt-get install -y gcc-7 g++-7 && \ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60 && \ From 8ed3ced34f6a817adf5a85b8afae77d9c952cf33 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Wed, 24 Feb 2021 12:02:43 -0800 Subject: [PATCH 10/11] Log block height in AddToWallet --- src/rpc/rawtransaction.cpp | 8 +++----- src/wallet/wallet.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 948ad2eae..1914aa8df 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** @@ -1266,7 +1266,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& m if (fMissingInputs) { throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs"); } - throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason()); + throw JSONRPCError(RPC_TRANSACTION_ERROR, strprintf("Invalid state: %s", state.GetRejectReason())); } } } else if (fHaveChain) { @@ -1274,9 +1274,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& m } LogPrintf("%s: Relaying raw tx to mempool\n", __FUNCTION__); RelayTransaction(tx); - } - else - { + } else { NSPV_broadcast((char *)params[0].get_str().c_str()); } return hashTx.GetHex(); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index d2ea2b3a2..962fe36b7 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1473,7 +1473,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD } //// debug print - LogPrintf("AddToWallet %s %s%s\n", wtxIn.GetHash().ToString(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); + LogPrintf("AddToWallet %s at height %d %s%s\n", wtxIn.GetHash().ToString(), hush_blockheight(wtxIn.hashBlock), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); // Write to disk if (fInsertedNew || fUpdated) From e1d5c5b7315085c46c770bc85ada3b7a0a731c82 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 25 Feb 2021 16:07:27 -0500 Subject: [PATCH 11/11] Bump version to 3.6.3 and ++ proto version --- configure.ac | 2 +- src/clientversion.h | 4 ++-- src/version.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 3156d09e7..216f612bf 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 3) define(_CLIENT_VERSION_MINOR, 6) -define(_CLIENT_VERSION_REVISION, 2) +define(_CLIENT_VERSION_REVISION, 3) define(_CLIENT_VERSION_BUILD, 50) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) diff --git a/src/clientversion.h b/src/clientversion.h index 98075253d..b2f606f64 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2016-2017 The Zcash developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** @@ -29,7 +29,7 @@ // Must be kept in sync with configure.ac , ugh! #define CLIENT_VERSION_MAJOR 3 #define CLIENT_VERSION_MINOR 6 -#define CLIENT_VERSION_REVISION 2 +#define CLIENT_VERSION_REVISION 3 #define CLIENT_VERSION_BUILD 50 //! Set to true for release, false for prerelease or test build diff --git a/src/version.h b/src/version.h index 69c48d1a4..bc304b404 100644 --- a/src/version.h +++ b/src/version.h @@ -1,5 +1,5 @@ // Copyright (c) 2012-2014 The Bitcoin Core developers -// Copyright (c) 2016-2020 The Hush developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** @@ -21,7 +21,7 @@ #define HUSH_VERSION_H // network protocol versioning -static const int PROTOCOL_VERSION = 1987420; +static const int PROTOCOL_VERSION = 1987421; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; //! In this version, 'getheaders' was introduced.