Merge branch 'danger' into sietch_dynamic
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -156,7 +156,9 @@ src/Makefile.in
|
||||
doc/man/Makefile.in
|
||||
Makefile.in
|
||||
src/libcc.so
|
||||
src/libcc.dll
|
||||
src/cc/customcc.so
|
||||
src/cc/customcc.dll
|
||||
src/HUSH3_7776
|
||||
REGTEST_7776
|
||||
src/cc/librogue.so
|
||||
|
||||
@@ -25,14 +25,8 @@ sometimes introduce weird bugs or make compiling really annoying.
|
||||
|
||||
Switching branches and doing partial compiles in Komodo/Hush source code
|
||||
can introduce weird bugs, which are fixed by running `build.sh` again.
|
||||
When in doubt, if you run into a compile error, especially if it mentions
|
||||
`OCTET_STRING`, run `build.sh` again. Running `make clean` before switching
|
||||
branches can often prevent those problems.
|
||||
|
||||
```
|
||||
cryptoconditions/src/asn/SimpleSha256Condition.h:14:10: fatal error: OCTET_STRING.h: No such file or directory
|
||||
```
|
||||
|
||||
Additionally, it's a good idea to run `make clean` before you switch
|
||||
between branches.
|
||||
|
||||
## Partial compiles
|
||||
|
||||
@@ -60,3 +54,7 @@ After successfully compiling Hush, you can generate a debian package of these bi
|
||||
This command will not work on Mac OS X. Currently you cannot generate a Debian package
|
||||
from operating systems other than Linux.
|
||||
|
||||
|
||||
## Updates to this document
|
||||
|
||||
If you think something else should be in this guide, please send your suggestions!
|
||||
|
||||
@@ -39,7 +39,7 @@ sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib \
|
||||
git clone https://github.com/MyHush/hush3.git
|
||||
cd hush3
|
||||
# Build
|
||||
./zcutil/build.sh -j$(nproc)
|
||||
./build.sh -j$(nproc)
|
||||
```
|
||||
|
||||
## Run a HUSH Node
|
||||
@@ -63,10 +63,8 @@ Downloading Git source repo, building and running Hush:
|
||||
# pull
|
||||
git clone https://github.com/MyHush/hush3.git
|
||||
cd hush
|
||||
# fetch key
|
||||
./zcutil/fetch-params.sh
|
||||
# Build
|
||||
./zcutil/build-win.sh -j$(nproc)
|
||||
./build-win.sh -j$(nproc)
|
||||
# Run a HUSH node
|
||||
./src/hushd
|
||||
```
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_openmp.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_OPENMP([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro tries to find out how to compile programs that use OpenMP a
|
||||
# standard API and set of compiler directives for parallel programming
|
||||
# (see http://www-unix.mcs/)
|
||||
#
|
||||
# On success, it sets the OPENMP_CFLAGS/OPENMP_CXXFLAGS/OPENMP_F77FLAGS
|
||||
# output variable to the flag (e.g. -omp) used both to compile *and* link
|
||||
# OpenMP programs in the current language.
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these flags,
|
||||
# but also link it with them as well.
|
||||
#
|
||||
# If you want to compile everything with OpenMP, you should set:
|
||||
#
|
||||
# CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
||||
# #OR# CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
|
||||
# #OR# FFLAGS="$FFLAGS $OPENMP_FFLAGS"
|
||||
#
|
||||
# (depending on the selected language).
|
||||
#
|
||||
# The user can override the default choice by setting the corresponding
|
||||
# environment variable (e.g. OPENMP_CFLAGS).
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if an OpenMP flag is
|
||||
# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is
|
||||
# not found. If ACTION-IF-FOUND is not specified, the default action will
|
||||
# define HAVE_OPENMP.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2015 John W. Peterson <jwpeterson@gmail.com>
|
||||
# Copyright (c) 2016 Nick R. Papior <nickpapior@gmail.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 13
|
||||
|
||||
AC_DEFUN([AX_OPENMP], [
|
||||
AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX
|
||||
|
||||
AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
|
||||
# Flags to try: -fopenmp (gcc), -mp (SGI & PGI),
|
||||
# -qopenmp (icc>=15), -openmp (icc),
|
||||
# -xopenmp (Sun), -omp (Tru64),
|
||||
# -qsmp=omp (AIX),
|
||||
# none
|
||||
ax_openmp_flags="-fopenmp -openmp -qopenmp -mp -xopenmp -omp -qsmp=omp none"
|
||||
if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then
|
||||
ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags"
|
||||
fi
|
||||
for ax_openmp_flag in $ax_openmp_flags; do
|
||||
case $ax_openmp_flag in
|
||||
none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
|
||||
*) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
|
||||
esac
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
@%:@include <omp.h>
|
||||
|
||||
static void
|
||||
parallel_fill(int * data, int n)
|
||||
{
|
||||
int i;
|
||||
@%:@pragma omp parallel for
|
||||
for (i = 0; i < n; ++i)
|
||||
data[i] = i;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int arr[100000];
|
||||
omp_set_num_threads(2);
|
||||
parallel_fill(arr, 100000);
|
||||
return 0;
|
||||
}
|
||||
]])],[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break],[])
|
||||
done
|
||||
[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
|
||||
])
|
||||
if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then
|
||||
m4_default([$2],:)
|
||||
else
|
||||
if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then
|
||||
OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp
|
||||
fi
|
||||
m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
|
||||
fi
|
||||
])dnl AX_OPENMP
|
||||
5
build.sh
Executable file
5
build.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2019-2020 The Hush developers
|
||||
|
||||
set -eu -o pipefail
|
||||
./zcutil/build.sh $@
|
||||
122
configure.ac
122
configure.ac
@@ -1,8 +1,8 @@
|
||||
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
|
||||
AC_PREREQ([2.60])
|
||||
define(_CLIENT_VERSION_MAJOR, 3)
|
||||
define(_CLIENT_VERSION_MINOR, 3)
|
||||
define(_CLIENT_VERSION_REVISION, 1)
|
||||
define(_CLIENT_VERSION_MINOR, 4)
|
||||
define(_CLIENT_VERSION_REVISION, 0)
|
||||
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)))
|
||||
@@ -96,12 +96,6 @@ AC_ARG_ENABLE([mining],
|
||||
[enable_mining=$enableval],
|
||||
[enable_mining=yes])
|
||||
|
||||
AC_ARG_ENABLE([proton],
|
||||
[AS_HELP_STRING([--disable-proton],
|
||||
[disable Proton (AMQP messaging)])],
|
||||
[use_proton=$enableval],
|
||||
[use_proton=yes])
|
||||
|
||||
AC_ARG_ENABLE(tests,
|
||||
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
|
||||
[use_tests=$enableval],
|
||||
@@ -507,15 +501,24 @@ if test x$use_hardening != xno; then
|
||||
HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2"
|
||||
],[AC_MSG_ERROR(Cannot enable -D_FORTIFY_SOURCE=2)])
|
||||
|
||||
#AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
|
||||
#AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
|
||||
if test x$BUILD_OS = xdarwin || test x$TARGET_OS = xwindows; then
|
||||
# Xcode's ld (at least ld64-302.3) doesn't support -z
|
||||
# mingw-w64's ld (at least mingw-w64 4.0.4-2) also appears to not support -z
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_WARN(Cannot enable RELRO)])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_WARN(Cannot enable BIND_NOW)])
|
||||
else
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
|
||||
fi
|
||||
|
||||
if test x$TARGET_OS != xwindows; then
|
||||
# All windows code is PIC, forcing it on just adds useless compile warnings
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
|
||||
AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)])
|
||||
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
|
||||
AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)])
|
||||
if test x$BUILD_OS = xdarwin; then
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-pie"],[AC_MSG_ERROR(Cannot enable -Wl,-pie)])
|
||||
else
|
||||
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
|
||||
fi
|
||||
else
|
||||
# These are only available on Windows.
|
||||
AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"],[AC_MSG_ERROR(Cannot enable --dynamicbase)])
|
||||
@@ -596,23 +599,6 @@ if test x$enable_wallet != xno; then
|
||||
BITCOIN_FIND_BDB62
|
||||
fi
|
||||
|
||||
dnl Check Qpid Proton headers and library exist
|
||||
if test x$use_proton = xyes; then
|
||||
AC_CHECK_HEADERS([proton/connection.hpp],
|
||||
[],
|
||||
[AC_MSG_WARN([Proton headers not found, disabling Proton support])
|
||||
use_proton=no])
|
||||
AC_CHECK_LIB([qpid-proton-cpp], [main],
|
||||
[PROTON_LIBS="-lqpid-proton-cpp -lqpid-proton"],
|
||||
[AC_MSG_WARN([Proton libraries not found, disabling Proton support])
|
||||
use_proton=no])
|
||||
fi
|
||||
if test x$use_proton = xyes; then
|
||||
AC_DEFINE(ENABLE_PROTON, 1, [Define to 1 to enable Proton functions])
|
||||
else
|
||||
AC_DEFINE(ENABLE_PROTON, 0, [Define to 1 to enable Proton functions])
|
||||
fi
|
||||
|
||||
if test x$build_bitcoin_utils$build_bitcoind$use_tests = xnonono; then
|
||||
use_boost=no
|
||||
else
|
||||
@@ -700,7 +686,7 @@ if test x$use_pkgconfig = xyes; then
|
||||
)
|
||||
else
|
||||
# BUG: Fix this:
|
||||
echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++, libgmp'
|
||||
echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++, gmp'
|
||||
|
||||
AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing))
|
||||
AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing))
|
||||
@@ -716,6 +702,22 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# These packages don't provide pkgconfig config files across all
|
||||
# platforms, so we use older autoconf detection mechanisms:
|
||||
if test x$TARGET_OS = xdarwin; then
|
||||
AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
|
||||
AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
|
||||
|
||||
AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
|
||||
fi
|
||||
|
||||
#AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
|
||||
#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
|
||||
|
||||
#AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||
#AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
|
||||
|
||||
if test "x$use_zmq" = "xyes"; then
|
||||
AC_CHECK_HEADER([zmq.h],
|
||||
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
|
||||
@@ -742,40 +744,11 @@ fi
|
||||
|
||||
# These packages don't provide pkgconfig config files across all
|
||||
# platforms, so we use older autoconf detection mechanisms:
|
||||
if test x$TARGET_OS = xdarwin; then
|
||||
AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
|
||||
AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
|
||||
|
||||
AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
|
||||
fi
|
||||
|
||||
#AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
|
||||
#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
|
||||
|
||||
#AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||
#AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
|
||||
|
||||
# libsnark header layout is broken unless cpp's -I is passed with the
|
||||
# libsnark directory, so for now we use this hideous workaround:
|
||||
echo 'Hunting for libsnark include directory...'
|
||||
[LIBSNARK_INCDIR="$(echo "$CPPFLAGS" | sed 's,^.*-I\([^ ]*/include\).*$,\1/libsnark,')"]
|
||||
if test -d "$LIBSNARK_INCDIR"; then
|
||||
echo "Found libsnark include directory: $LIBSNARK_INCDIR"
|
||||
else
|
||||
#AC_MSG_ERROR(libsnark include directory not found)
|
||||
echo "libsnark include directory not found ($LIBSNARK_INCDIR)"
|
||||
fi
|
||||
|
||||
CPPFLAGS="-I$LIBSNARK_INCDIR $CPPFLAGS"
|
||||
|
||||
# Now check for libsnark compilability using traditional autoconf tests:
|
||||
if test x$TARGET_OS = xdarwin; then
|
||||
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
|
||||
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
|
||||
fi
|
||||
#AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
|
||||
#AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
|
||||
|
||||
RUST_LIBS="-lrustzcash"
|
||||
case $host in
|
||||
@@ -786,25 +759,7 @@ case $host in
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Check for OpenMP support
|
||||
AX_OPENMP(
|
||||
[AC_DEFINE(HAVE_OPENMP, 1, [Define if OpenMP is enabled])
|
||||
AM_CONDITIONAL([HAVE_OPENMP], [true])
|
||||
CPPFLAGS="$CPPFLAGS -DMULTICORE"
|
||||
CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"],
|
||||
[AC_MSG_WARN([OpenMP not supported, disabling multithreading])
|
||||
AC_DEFINE(HAVE_OPENMP, 0, [Define if OpenMP is enabled])
|
||||
AM_CONDITIONAL([HAVE_OPENMP], [false])])
|
||||
|
||||
# Gitian uses a config.site that sets depends_prefix, and then sets --prefix=/
|
||||
# build.sh just uses --prefix
|
||||
if test x$depends_prefix != x; then
|
||||
LIBSNARK_DEPINST="$depends_prefix"
|
||||
else
|
||||
LIBSNARK_DEPINST="$prefix"
|
||||
fi
|
||||
|
||||
# Additional Zcash flags
|
||||
# Additional Zcash internals flags
|
||||
AX_CHECK_COMPILE_FLAG([-fwrapv],[CXXFLAGS="$CXXFLAGS -fwrapv"])
|
||||
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing],[CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wno-builtin-declaration-mismatch],[CXXFLAGS="$CXXFLAGS -Wno-builtin-declaration-mismatch"],,[[$CXXFLAG_WERROR]])
|
||||
@@ -871,8 +826,6 @@ fi
|
||||
|
||||
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_PROTON], [test "x$use_proton" = "xyes"])
|
||||
|
||||
AC_MSG_CHECKING([whether to build test_bitcoin])
|
||||
if test x$use_tests = xyes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
@@ -944,9 +897,7 @@ AC_SUBST(EVENT_PTHREADS_LIBS)
|
||||
AC_SUBST(ZMQ_LIBS)
|
||||
AC_SUBST(GMP_LIBS)
|
||||
AC_SUBST(GMPXX_LIBS)
|
||||
AC_SUBST(LIBSNARK_DEPINST)
|
||||
AC_SUBST(LIBZCASH_LIBS)
|
||||
AC_SUBST(PROTON_LIBS)
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile src/test/buildenv.py])
|
||||
AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
|
||||
AC_CONFIG_FILES([qa/pull-tester/tests-config.sh],[chmod +x qa/pull-tester/tests-config.sh])
|
||||
@@ -975,7 +926,7 @@ unset PKG_CONFIG_LIBDIR
|
||||
PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP"
|
||||
|
||||
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no --enable-module-recovery"
|
||||
AC_CONFIG_SUBDIRS([src/secp256k1 src/snark src/univalue src/cryptoconditions])
|
||||
AC_CONFIG_SUBDIRS([src/secp256k1 src/univalue src/cryptoconditions])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -993,7 +944,6 @@ esac
|
||||
echo
|
||||
echo "Options used to compile and link:"
|
||||
echo " with wallet = $enable_wallet"
|
||||
echo " with proton = $use_proton"
|
||||
echo " with zmq = $use_zmq"
|
||||
echo " with test = $use_tests"
|
||||
echo " debug enabled = $enable_debug"
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# Requirements:
|
||||
# pip install python-qpid-proton
|
||||
|
||||
import binascii
|
||||
from proton.handlers import MessagingHandler
|
||||
from proton.reactor import Container
|
||||
|
||||
port = 5672
|
||||
|
||||
class Server(MessagingHandler):
|
||||
def __init__(self, url):
|
||||
super(Server, self).__init__()
|
||||
self.url = url
|
||||
self.senders = {}
|
||||
|
||||
def on_start(self, event):
|
||||
print "Listening on:", self.url
|
||||
self.container = event.container
|
||||
self.acceptor = event.container.listen(self.url)
|
||||
|
||||
def on_message(self, event):
|
||||
m = event.message
|
||||
topic = m.subject
|
||||
body = m.body
|
||||
sequence = str( m.properties['x-opt-sequence-number'] )
|
||||
if topic == "hashablock":
|
||||
print '- HASH BLOCK ('+sequence+') -'
|
||||
print binascii.hexlify(body)
|
||||
elif topic == "hashtx":
|
||||
print '- HASH TX ('+sequence+') -'
|
||||
print binascii.hexlify(body)
|
||||
elif topic == "rawblock":
|
||||
print '- RAW BLOCK HEADER ('+sequence+') -'
|
||||
print binascii.hexlify(body[:80])
|
||||
elif topic == "rawtx":
|
||||
print '- RAW TX ('+sequence+') -'
|
||||
print binascii.hexlify(body)
|
||||
|
||||
try:
|
||||
Container(Server("127.0.0.1:%i" % port)).run()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# Copyright 2019 The Hush developers
|
||||
# Copyright 2019-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
use warnings;
|
||||
use strict;
|
||||
@@ -9,6 +9,11 @@ my $block = shift || die "Usage: $0 123";
|
||||
my $hush = "./src/hush-cli";
|
||||
my $blockcount = qx{$hush getblockcount};
|
||||
|
||||
unless ($blockcount = int($blockcount)) {
|
||||
print "Invalid response from hush-cli\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ($block <= $blockcount) {
|
||||
die "That block has already happened!";
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# Copyright 2019 The Hush developers
|
||||
# Copyright 2019-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
use warnings;
|
||||
use strict;
|
||||
@@ -12,6 +12,10 @@ my $gethash = "$hush getblockhash";
|
||||
my $stride = shift || 1000;
|
||||
my $count = 0;
|
||||
my $blocks = qx{$hush getblockcount};
|
||||
if($?) {
|
||||
print "ERROR, exiting...\n";
|
||||
exit 1;
|
||||
}
|
||||
my $prev = $blocks - $perday;
|
||||
my $last = 0;
|
||||
my $now = time();
|
||||
|
||||
@@ -16,10 +16,6 @@ Files: depends/sources/libsodium-*.tar.gz
|
||||
Copyright: 2013-2016 Frank Denis
|
||||
License: ISC
|
||||
|
||||
Files: depends/sources/libsnark-*.tar.gz
|
||||
Copyright: 2012-2016 SCIPR Lab and contributors; 2016 The Zcash developers
|
||||
License: Expat
|
||||
|
||||
Files: depends/sources/gmp-*.tar.bz2
|
||||
Copyright: 1991, 1996, 1999, 2000, 2007 Free Software Foundation, Inc.
|
||||
License: LGPL
|
||||
@@ -56,10 +52,6 @@ Files: depends/sources/google*.tar.gz
|
||||
Copyright: 2008 Google Inc.
|
||||
License: BSD-3clause-Google
|
||||
|
||||
Files: depends/sources/qpid-proton-*.tar.gz
|
||||
Copyright: 2012-2017 The Apache Software Foundation
|
||||
License: Apache-Qpid-Proton-with-BSD-Subcomponents
|
||||
|
||||
Files: src/secp256k1/build-aux/m4/ax_jni_include_dir.m4
|
||||
Copyright: 2008 Don Anderson <dda@sleepycat.com>
|
||||
License: GNU-All-permissive-License
|
||||
@@ -1105,222 +1097,6 @@ Comment:
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
License: Apache-Qpid-Proton-with-BSD-Subcomponents
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
.
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
.
|
||||
1. Definitions.
|
||||
.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
.
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
.
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
.
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
.
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
.
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
.
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
.
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
.
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
.
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
.
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
.
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
.
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
.
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
.
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
.
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
.
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
.
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
.
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
.
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
.
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
.
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
.
|
||||
END OF TERMS AND CONDITIONS
|
||||
.
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
.
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
.
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
.
|
||||
.
|
||||
PROTON SUBCOMPONENTS:
|
||||
.
|
||||
Proton includes freegetopt with a separate BSD license. Your use
|
||||
of the source code for freegetopt is subject to the terms and
|
||||
conditions of its license in examples/include/pncompat/internal/LICENSE.
|
||||
.
|
||||
The setup scripts for the python bindings include files derived by
|
||||
PyZMQ and are licensed with a separate Modified BSD license. Use of
|
||||
the source code in these setup files are subject to the terms and
|
||||
conditions in the license:
|
||||
proton-c/bindings/python/setuputils/PYZMQ_LICENSE.BSD.
|
||||
|
||||
License: GNU-All-permissive-License
|
||||
Copying and distribution of this file, with or without modification, are
|
||||
permitted in any medium without royalty provided the copyright notice
|
||||
|
||||
@@ -85,7 +85,7 @@ script: |
|
||||
BASEPREFIX=`pwd`/depends
|
||||
# Build dependencies for each host
|
||||
for i in $HOSTS; do
|
||||
NO_PROTON="x" make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
|
||||
make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
|
||||
done
|
||||
|
||||
# Faketime for binaries
|
||||
|
||||
1
depends/.gitignore
vendored
1
depends/.gitignore
vendored
@@ -7,3 +7,4 @@ x86_64*
|
||||
i686*
|
||||
mips*
|
||||
arm*
|
||||
aarch64*
|
||||
|
||||
@@ -74,9 +74,8 @@ include builders/default.mk
|
||||
include packages/packages.mk
|
||||
|
||||
wallet_packages_$(NO_WALLET) = $(wallet_packages)
|
||||
proton_packages_$(NO_PROTON) = $(proton_packages)
|
||||
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages) $(proton_packages_) $(wallet_packages_)
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages) $(wallet_packages_)
|
||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
|
||||
all_packages = $(packages) $(native_packages)
|
||||
|
||||
@@ -112,6 +111,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
|
||||
-e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \
|
||||
-e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
|
||||
-e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
|
||||
-e 's|@rust_target@|$(call rust_target,rust,$(canonical_host),$(host_os))|' \
|
||||
-e 's|@no_wallet@|$(NO_WALLET)|' \
|
||||
-e 's|@debug@|$(DEBUG)|' \
|
||||
$< > $@
|
||||
|
||||
@@ -13,6 +13,9 @@ if test -z $enable_wallet && test -n "@no_wallet@"; then
|
||||
enable_wallet=no
|
||||
fi
|
||||
|
||||
RUST_TARGET="@rust_target@"
|
||||
RUST_VENDORED_SOURCES="$depends_prefix/vendored-sources"
|
||||
|
||||
if test x@host_os@ = xdarwin; then
|
||||
BREW=no
|
||||
PORT=no
|
||||
|
||||
@@ -40,7 +40,7 @@ endef
|
||||
|
||||
define vendor_crate_source
|
||||
mkdir -p $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY) && \
|
||||
cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_name) && \
|
||||
cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \
|
||||
cd $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \
|
||||
rm -r `basename $($(1)_patch_dir)` .stamp_* .$($(1)_file_name).hash
|
||||
endef
|
||||
@@ -59,8 +59,8 @@ $(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SU
|
||||
final_build_id_long+=$($(package)_build_id_long)
|
||||
|
||||
#override platform specific files and hashes
|
||||
$(eval $(1)_file_name=$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name)))
|
||||
$(eval $(1)_sha256_hash=$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash)))
|
||||
$(eval $(1)_file_name=$(if $($(1)_exact_file_name),$($(1)_exact_file_name),$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name))))
|
||||
$(eval $(1)_sha256_hash=$(if $($(1)_exact_sha256_hash),$($(1)_exact_sha256_hash),$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash))))
|
||||
|
||||
#compute package-specific paths
|
||||
$(1)_build_subdir?=.
|
||||
@@ -91,8 +91,9 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
|
||||
|
||||
|
||||
#default commands
|
||||
# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior
|
||||
$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
|
||||
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --strip-components=1 -xf $$($(1)_source)
|
||||
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --no-same-owner --strip-components=1 -xf $$($(1)_source)
|
||||
$(1)_preprocess_cmds ?=
|
||||
$(1)_build_cmds ?=
|
||||
$(1)_config_cmds ?=
|
||||
@@ -193,7 +194,7 @@ $($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted)
|
||||
$(AT)touch $$@
|
||||
$($(1)_configured): | $($(1)_preprocessed)
|
||||
$(AT)echo Configuring $(1)...
|
||||
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar xf $($(package)_cached); )
|
||||
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); )
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
|
||||
$(AT)touch $$@
|
||||
|
||||
@@ -9,6 +9,11 @@ define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
|
||||
$(package)_config_opts_mingw32=--enable-mingw
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
$(package)_config_opts_freebsd=--with-pic
|
||||
ifneq ($(build_os),darwin)
|
||||
$(package)_config_opts_darwin=--disable-atomicsupport
|
||||
endif
|
||||
$(package)_config_opts_aarch64=--disable-atomicsupport
|
||||
$(package)_cxxflags=-std=c++11
|
||||
endef
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=boost
|
||||
|
||||
$(package)_version=1_66_0
|
||||
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.66.0/source
|
||||
$(package)_sha256_hash=5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9
|
||||
$(package)_version=1_72_0
|
||||
$(package)_download_path=https://github.com/MyHush/boost/releases/download/v1.72.0/
|
||||
$(package)_sha256_hash=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722
|
||||
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
|
||||
|
||||
define $(package)_set_vars
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package=libcurl
|
||||
$(package)_version=7.64.1
|
||||
$(package)_version=7.67.0
|
||||
$(package)_dependencies=openssl
|
||||
$(package)_download_path=https://curl.haxx.se/download
|
||||
$(package)_file_name=curl-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=432d3f466644b9416bc5b649d344116a753aeaa520c8beaf024a90cba9d3d35d
|
||||
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-unknown-linux-gnu
|
||||
$(package)_sha256_hash=52af3361cf806330b88b4fe6f483b6844209d47ae196ac46da4de59bb361ab02
|
||||
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=$(host)
|
||||
$(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32
|
||||
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix)
|
||||
$(package)_cflags_darwin=-mmacosx-version-min=10.9
|
||||
|
||||
@@ -8,15 +8,29 @@ $(package)_git_commit=06da3b9ac8f278e5d4ae13088cf0a4c03d2c13f5
|
||||
$(package)_dependencies=rust $(rust_crates)
|
||||
$(package)_patches=cargo.config 0001-Start-using-cargo-clippy-for-CI.patch remove-dev-dependencies.diff no-groth16.patch
|
||||
|
||||
$(package)_rust_target=$(if $(rust_rust_target_$(canonical_host)),$(rust_rust_target_$(canonical_host)),$(canonical_host))
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
$(package)_library_file=target/x86_64-pc-windows-gnu/release/rustzcash.lib
|
||||
else ifneq ($(canonical_host),$(build))
|
||||
ifeq ($(host_os),darwin)
|
||||
$(package)_library_file=target/x86_64-apple-darwin/release/librustzcash.a
|
||||
else
|
||||
$(package)_library_file=target/$($(package)_rust_target)/release/librustzcash.a
|
||||
endif
|
||||
else
|
||||
$(package)_library_file=target/release/librustzcash.a
|
||||
endif
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_build_opts=--frozen --release
|
||||
$(package)_build_opts_mingw32=--target=x86_64-pc-windows-gnu
|
||||
ifneq ($(canonical_host),$(build))
|
||||
ifeq ($(host_os),darwin)
|
||||
$(package)_build_opts+=--target=x86_64-apple-darwin
|
||||
else
|
||||
$(package)_build_opts+=--target=$($(package)_rust_target)
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
@@ -27,7 +41,7 @@ define $(package)_preprocess_cmds
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
cargo build --package librustzcash $($(package)_build_opts)
|
||||
$(host_prefix)/native/bin/cargo build --package librustzcash $($(package)_build_opts)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=native_ccache
|
||||
$(package)_version=3.3.1
|
||||
$(package)_download_path=https://www.samba.org/ftp/ccache
|
||||
$(package)_file_name=ccache-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=cb6e4bafbb19ba0a2ec43386b123a5f92a20e1e3384c071d5d13e0cb3c84bf73
|
||||
$(package)_version=3.7.9
|
||||
$(package)_download_path=https://github.com/ccache/ccache/releases/download/v$($(package)_version)
|
||||
$(package)_file_name=ccache-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=92838e2133c9e704fdab9ee2608dad86c99021278b9ac47d065aa8ff2ea8ce36
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package=openssl
|
||||
$(package)_version=1.1.1a
|
||||
$(package)_download_path=https://www.openssl.org/source
|
||||
$(package)_download_path=https://www.openssl.org/source/old/1.1.1
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41
|
||||
$(package)_patches=ssl_fix.patch
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
rust_packages := rust librustzcash
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
zcash_packages := libsnark libgmp libsodium utfcpp
|
||||
else
|
||||
proton_packages := proton
|
||||
zcash_packages := libgmp libsodium utfcpp
|
||||
endif
|
||||
|
||||
zcash_packages := libgmp libsodium utfcpp
|
||||
rust_crates := \
|
||||
crate_aes \
|
||||
crate_aesni \
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package=proton
|
||||
$(package)_version=0.17.0
|
||||
$(package)_download_path=https://archive.apache.org/dist/qpid/proton/$($(package)_version)
|
||||
$(package)_file_name=qpid-proton-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=6ffd26d3d0e495bfdb5d9fefc5349954e6105ea18cc4bb191161d27742c5a01a
|
||||
$(package)_patches=minimal-build.patch
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
patch -p1 < $($(package)_patch_dir)/minimal-build.patch && \
|
||||
mkdir -p build/proton-c/src
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
cd build; cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=/ -DSYSINSTALL_BINDINGS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_PYTHON=OFF -DBUILD_PHP=OFF -DBUILD_JAVA=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_GO=OFF
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
cd build; $(MAKE) VERBOSE=1
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
cd build; $(MAKE) VERBOSE=1 DESTDIR=$($(package)_staging_prefix_dir) install
|
||||
endef
|
||||
@@ -1,7 +1,6 @@
|
||||
package=rust
|
||||
$(package)_version=1.32.0
|
||||
$(package)_download_path=https://static.rust-lang.org/dist
|
||||
|
||||
$(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
|
||||
$(package)_sha256_hash_linux=e024698320d76b74daf0e6e71be3681a1e7923122e3ebd03673fcac3ecc23810
|
||||
$(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
|
||||
@@ -9,20 +8,26 @@ $(package)_sha256_hash_darwin=f0dfba507192f9b5c330b5984ba71d57d434475f3d62bd44a3
|
||||
$(package)_file_name_mingw32=rust-$($(package)_version)-x86_64-pc-windows-gnu.tar.gz
|
||||
$(package)_sha256_hash_mingw32=358e1435347c67dbf33aa9cad6fe501a833d6633ed5d5aa1863d5dffa0349be9
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
$(package)_file_name=$($(package)_file_name_darwin)
|
||||
$(package)_sha256_hash=$($(package)_sha256_hash_darwin)
|
||||
else ifeq ($(host_os),mingw32)
|
||||
$(package)_file_name=$($(package)_file_name_mingw32)
|
||||
$(package)_sha256_hash=$($(package)_sha256_hash_mingw32)
|
||||
else
|
||||
$(package)_file_name=$($(package)_file_name_linux)
|
||||
$(package)_sha256_hash=$($(package)_sha256_hash_linux)
|
||||
endif
|
||||
# Mapping from GCC canonical hosts to Rust targets
|
||||
# If a mapping is not present, we assume they are identical, unless $host_os is
|
||||
# "darwin", in which case we assume x86_64-apple-darwin.
|
||||
$(package)_rust_target_x86_64-w64-mingw32=x86_64-pc-windows-gnu
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
# Mapping from Rust targets to SHA-256 hashes
|
||||
$(package)_rust_std_sha256_hash_aarch64-unknown-linux-gnu=346efe3aef2aff7b71a611bf7661bcec5f9bc4025a599c2866ec5fd330247cb9
|
||||
$(package)_rust_std_sha256_hash_x86_64-apple-darwin=b736d035a97f830585360e54e3f8877b68c942211cf0a75e805f34bfb36103a6
|
||||
$(package)_rust_std_sha256_hash_x86_64-pc-windows-gnu=cad5f1454d591c13eeb3657f1c9dbfeb30e648f59680bd0765b94c63e7afc49e
|
||||
|
||||
define rust_target
|
||||
$(if $($(1)_rust_target_$(2)),$($(1)_rust_target_$(2)),$(if $(findstring darwin,$(3)),x86_64-apple-darwin,$(2)))
|
||||
endef
|
||||
|
||||
ifneq ($(canonical_host),$(build))
|
||||
$(package)_rust_target=$(call rust_target,$(package),$(canonical_host),$(host_os))
|
||||
$(package)_exact_file_name=rust-std-$($(package)_version)-$($(package)_rust_target).tar.gz
|
||||
$(package)_exact_sha256_hash=$($(package)_rust_std_sha256_hash_$($(package)_rust_target))
|
||||
$(package)_build_subdir=buildos
|
||||
$(package)_extra_sources = $($(package)_file_name_$(build_os))
|
||||
$(package)_extra_sources=$($(package)_file_name_$(build_os))
|
||||
|
||||
define $(package)_fetch_cmds
|
||||
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
|
||||
@@ -34,19 +39,19 @@ define $(package)_extract_cmds
|
||||
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
echo "$($(package)_sha256_hash_$(build_os)) $($(package)_source_dir)/$($(package)_file_name_$(build_os))" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
mkdir mingw32 && \
|
||||
tar --strip-components=1 -xf $($(package)_source) -C mingw32 && \
|
||||
mkdir $(canonical_host) && \
|
||||
tar --strip-components=1 -xf $($(package)_source) -C $(canonical_host) && \
|
||||
mkdir buildos && \
|
||||
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_file_name_$(build_os)) -C buildos
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig && \
|
||||
cp -r ../mingw32/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu $($(package)_staging_dir)$(host_prefix)/native/lib/rustlib
|
||||
bash ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig && \
|
||||
../$(canonical_host)/install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
endef
|
||||
else
|
||||
|
||||
define $(package)_stage_cmds
|
||||
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
bash ./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
endef
|
||||
endif
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
From 03f5fc0826115edbfca468261b70c0daf627f488 Mon Sep 17 00:00:00 2001
|
||||
From: Simon <simon@bitcartel.com>
|
||||
Date: Thu, 27 Apr 2017 17:15:59 -0700
|
||||
Subject: [PATCH] Enable C++11, build static library and cpp bindings with minimal dependencies.
|
||||
|
||||
---
|
||||
CMakeLists.txt | 13 +++++++------
|
||||
examples/cpp/CMakeLists.txt | 1 +
|
||||
proton-c/CMakeLists.txt | 32 +++++++++++++++----------------
|
||||
proton-c/bindings/CMakeLists.txt | 6 +++---
|
||||
proton-c/bindings/cpp/CMakeLists.txt | 24 +++++++++++------------
|
||||
proton-c/bindings/cpp/docs/CMakeLists.txt | 2 +-
|
||||
proton-c/docs/api/CMakeLists.txt | 2 +-
|
||||
7 files changed, 41 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b538ffd..4a5e787 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -18,14 +18,15 @@
|
||||
#
|
||||
cmake_minimum_required (VERSION 2.8.7)
|
||||
|
||||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
project (Proton C)
|
||||
|
||||
# Enable C++ now for examples and bindings subdirectories, but make it optional.
|
||||
enable_language(CXX OPTIONAL)
|
||||
|
||||
# Enable testing
|
||||
-enable_testing()
|
||||
-include (CTest)
|
||||
+#enable_testing()
|
||||
+#include (CTest)
|
||||
|
||||
# Pull in local cmake modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/Modules/")
|
||||
@@ -141,7 +142,7 @@ set (BINDINGS_DIR ${LIB_INSTALL_DIR}/proton/bindings)
|
||||
|
||||
set (SYSINSTALL_BINDINGS OFF CACHE BOOL "If SYSINSTALL_BINDINGS is OFF then proton bindings will be installed underneath ${BINDINGS_DIR} and each user will need to modify their interpreter configuration to load the appropriate binding. If SYSINSTALL_BINDINGS is ON, then each language interpreter will be queried for the appropriate directory and proton bindings will be installed and available system wide with no additional per user configuration.")
|
||||
|
||||
-set (BINDING_LANGS PERL PHP PYTHON RUBY)
|
||||
+#set (BINDING_LANGS PERL PHP PYTHON RUBY)
|
||||
|
||||
foreach (LANG ${BINDING_LANGS})
|
||||
set (SYSINSTALL_${LANG} OFF CACHE BOOL "Install ${LANG} bindings into interpreter specified location.")
|
||||
@@ -156,10 +157,10 @@ set (PROTON_SHARE ${SHARE_INSTALL_DIR}/proton-${PN_VERSION})
|
||||
# End of variables used during install
|
||||
|
||||
# Check for valgrind here so tests under proton-c/ and examples/ can use it.
|
||||
-find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
|
||||
+#find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
|
||||
mark_as_advanced (VALGRIND_EXE)
|
||||
|
||||
-option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
|
||||
+#option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
|
||||
if (ENABLE_VALGRIND)
|
||||
if (NOT VALGRIND_EXE)
|
||||
message(STATUS "Can't locate the valgrind command; no run-time error detection")
|
||||
@@ -171,7 +172,7 @@ if (ENABLE_VALGRIND)
|
||||
endif (ENABLE_VALGRIND)
|
||||
|
||||
add_subdirectory(proton-c)
|
||||
-add_subdirectory(examples)
|
||||
+#add_subdirectory(examples)
|
||||
|
||||
install (FILES LICENSE README.md
|
||||
DESTINATION ${PROTON_SHARE})
|
||||
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
|
||||
index 304d899..f4877b4 100644
|
||||
--- a/examples/cpp/CMakeLists.txt
|
||||
+++ b/examples/cpp/CMakeLists.txt
|
||||
@@ -17,6 +17,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
find_package(ProtonCpp REQUIRED)
|
||||
|
||||
include_directories(${ProtonCpp_INCLUDE_DIRS})
|
||||
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
|
||||
index 8edb661..dc7b99c 100644
|
||||
--- a/proton-c/CMakeLists.txt
|
||||
+++ b/proton-c/CMakeLists.txt
|
||||
@@ -22,24 +22,24 @@ include(CheckSymbolExists)
|
||||
|
||||
include(soversion.cmake)
|
||||
|
||||
-add_custom_target(docs)
|
||||
-add_custom_target(doc DEPENDS docs)
|
||||
+#add_custom_target(docs)
|
||||
+#add_custom_target(doc DEPENDS docs)
|
||||
|
||||
# Set the default SSL/TLS implementation
|
||||
-find_package(OpenSSL)
|
||||
+#find_package(OpenSSL)
|
||||
find_package(PythonInterp REQUIRED)
|
||||
-find_package(SWIG)
|
||||
+#find_package(SWIG)
|
||||
# FindSwig.cmake "forgets" make its outputs advanced like a good citizen
|
||||
mark_as_advanced(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION)
|
||||
|
||||
# See if Cyrus SASL is available
|
||||
-find_library(CYRUS_SASL_LIBRARY sasl2)
|
||||
-find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include)
|
||||
-find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
|
||||
+#find_library(CYRUS_SASL_LIBRARY sasl2)
|
||||
+#find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include)
|
||||
+#find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
|
||||
mark_as_advanced(CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
|
||||
|
||||
# Find saslpasswd2 executable to generate test config
|
||||
-find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing")
|
||||
+#find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing")
|
||||
mark_as_advanced(SASLPASSWD_EXE)
|
||||
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
@@ -315,8 +315,8 @@ pn_absolute_install_dir(EXEC_PREFIX "." ${CMAKE_INSTALL_PREFIX})
|
||||
pn_absolute_install_dir(LIBDIR ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
|
||||
pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
-add_subdirectory(docs/api)
|
||||
-add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
|
||||
+#add_subdirectory(docs/api)
|
||||
+#add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
|
||||
|
||||
# for full source distribution:
|
||||
set (qpid-proton-platform-all
|
||||
@@ -507,7 +507,7 @@ if (BUILD_WITH_CXX)
|
||||
endif (BUILD_WITH_CXX)
|
||||
|
||||
add_library (
|
||||
- qpid-proton-core SHARED
|
||||
+ qpid-proton-core STATIC
|
||||
${qpid-proton-core}
|
||||
${qpid-proton-layers}
|
||||
${qpid-proton-platform}
|
||||
@@ -527,7 +527,7 @@ set_target_properties (
|
||||
)
|
||||
|
||||
add_library(
|
||||
- qpid-proton SHARED
|
||||
+ qpid-proton STATIC
|
||||
# Proton Core
|
||||
${qpid-proton-core}
|
||||
${qpid-proton-layers}
|
||||
@@ -629,7 +629,7 @@ install (FILES
|
||||
|
||||
# c tests:
|
||||
|
||||
-add_subdirectory(src/tests)
|
||||
+#add_subdirectory(src/tests)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
# No change needed for windows already use correct separator
|
||||
@@ -712,7 +712,7 @@ if (BUILD_PYTHON)
|
||||
|
||||
endif (BUILD_PYTHON)
|
||||
|
||||
-find_program(RUBY_EXE "ruby")
|
||||
+#find_program(RUBY_EXE "ruby")
|
||||
if (RUBY_EXE AND BUILD_RUBY)
|
||||
set (rb_root "${pn_test_root}/ruby")
|
||||
set (rb_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby")
|
||||
@@ -751,8 +751,8 @@ if (RUBY_EXE AND BUILD_RUBY)
|
||||
else (DEFAULT_RUBY_TESTING)
|
||||
message(STATUS "Skipping Ruby tests: missing dependencies")
|
||||
endif (DEFAULT_RUBY_TESTING)
|
||||
-else (RUBY_EXE)
|
||||
- message (STATUS "Cannot find ruby, skipping ruby tests")
|
||||
+#else (RUBY_EXE)
|
||||
+# message (STATUS "Cannot find ruby, skipping ruby tests")
|
||||
endif()
|
||||
|
||||
mark_as_advanced (RUBY_EXE RSPEC_EXE)
|
||||
diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt
|
||||
index 6b88384..d1a50a5 100644
|
||||
--- a/proton-c/bindings/CMakeLists.txt
|
||||
+++ b/proton-c/bindings/CMakeLists.txt
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
# Add bindings that do not require swig here - the directory name must be the same as the binding name
|
||||
# See below for swig bindings
|
||||
-set(BINDINGS javascript cpp go)
|
||||
+set(BINDINGS cpp)
|
||||
|
||||
# Prerequisites for javascript.
|
||||
#
|
||||
# It uses a C/C++ to JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++
|
||||
# and compiles it into a highly optimisable subset of JavaScript called asm.js (http://asmjs.org/) that can be
|
||||
# aggressively optimised and run at near-native speed (usually between 1.5 to 10 times slower than native C/C++).
|
||||
-find_package(Emscripten)
|
||||
+#find_package(Emscripten)
|
||||
if (EMSCRIPTEN_FOUND)
|
||||
set (DEFAULT_JAVASCRIPT ON)
|
||||
endif (EMSCRIPTEN_FOUND)
|
||||
@@ -37,7 +37,7 @@ if (CMAKE_CXX_COMPILER)
|
||||
endif (CMAKE_CXX_COMPILER)
|
||||
|
||||
# Prerequisites for Go
|
||||
-find_program(GO_EXE go)
|
||||
+#find_program(GO_EXE go)
|
||||
mark_as_advanced(GO_EXE)
|
||||
if (GO_EXE)
|
||||
if(WIN32)
|
||||
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
|
||||
index 0cc4024..796fe29 100644
|
||||
--- a/proton-c/bindings/cpp/CMakeLists.txt
|
||||
+++ b/proton-c/bindings/cpp/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
-
|
||||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
include(cpp.cmake) # Compiler checks
|
||||
|
||||
include_directories(
|
||||
@@ -89,7 +89,7 @@ set_source_files_properties (
|
||||
COMPILE_FLAGS "${LTO}"
|
||||
)
|
||||
|
||||
-add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source})
|
||||
+add_library(qpid-proton-cpp STATIC ${qpid-proton-cpp-source})
|
||||
|
||||
target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton)
|
||||
|
||||
@@ -120,8 +120,8 @@ endif (MSVC)
|
||||
|
||||
install (DIRECTORY "include/proton" DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.hpp")
|
||||
|
||||
-add_subdirectory(docs)
|
||||
-add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp)
|
||||
+#add_subdirectory(docs)
|
||||
+#add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp)
|
||||
|
||||
# Pkg config file
|
||||
configure_file(
|
||||
@@ -171,12 +171,12 @@ macro(add_cpp_test test)
|
||||
endif ()
|
||||
endmacro(add_cpp_test)
|
||||
|
||||
-add_cpp_test(codec_test)
|
||||
+#add_cpp_test(codec_test)
|
||||
#add_cpp_test(engine_test)
|
||||
-add_cpp_test(thread_safe_test)
|
||||
-add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
|
||||
-add_cpp_test(message_test)
|
||||
-add_cpp_test(scalar_test)
|
||||
-add_cpp_test(value_test)
|
||||
-add_cpp_test(container_test)
|
||||
-add_cpp_test(url_test)
|
||||
+#add_cpp_test(thread_safe_test)
|
||||
+#add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
|
||||
+#add_cpp_test(message_test)
|
||||
+#add_cpp_test(scalar_test)
|
||||
+#add_cpp_test(value_test)
|
||||
+#add_cpp_test(container_test)
|
||||
+#add_cpp_test(url_test)
|
||||
diff --git a/proton-c/bindings/cpp/docs/CMakeLists.txt b/proton-c/bindings/cpp/docs/CMakeLists.txt
|
||||
index d512d15..8576867 100644
|
||||
--- a/proton-c/bindings/cpp/docs/CMakeLists.txt
|
||||
+++ b/proton-c/bindings/cpp/docs/CMakeLists.txt
|
||||
@@ -17,7 +17,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
-find_package(Doxygen)
|
||||
+#find_package(Doxygen)
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
configure_file (
|
||||
diff --git a/proton-c/docs/api/CMakeLists.txt b/proton-c/docs/api/CMakeLists.txt
|
||||
index 7756e48..71ebb93 100644
|
||||
--- a/proton-c/docs/api/CMakeLists.txt
|
||||
+++ b/proton-c/docs/api/CMakeLists.txt
|
||||
@@ -17,7 +17,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
-find_package(Doxygen)
|
||||
+#find_package(Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/user.doxygen.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/user.doxygen)
|
||||
--
|
||||
2.7.4
|
||||
|
||||
123
doc/amqp.md
123
doc/amqp.md
@@ -1,123 +0,0 @@
|
||||
# Block and Transaction Broadcasting With AMQP 1.0 (Experimental Feature)
|
||||
|
||||
[AMQP](https://www.amqp.org/) is an enterprise-level message queuing
|
||||
protocol for the reliable passing of real-time data and business
|
||||
transactions between applications. AMQP supports both broker and
|
||||
brokerless messaging. AMQP 1.0 is an open standard and has been
|
||||
ratified as ISO/IEC 19464.
|
||||
|
||||
The Hush daemon can be configured to act as a trusted "border
|
||||
router", implementing the Hush P2P protocol and relay, making
|
||||
consensus decisions, maintaining the local blockchain database,
|
||||
broadcasting locally generated transactions into the network, and
|
||||
providing a queryable RPC interface to interact on a polled basis for
|
||||
requesting blockchain related data. However, there exists only a
|
||||
limited service to notify external software of events like the arrival
|
||||
of new blocks or transactions.
|
||||
|
||||
The AMQP facility implements a notification interface through a set
|
||||
of specific notifiers. Currently there are notifiers that publish
|
||||
blocks and transactions. This read-only facility requires only the
|
||||
connection of a corresponding AMQP subscriber port in receiving
|
||||
software.
|
||||
|
||||
Currently the facility is not authenticated nor is there any two-way
|
||||
protocol involvement. Therefore, subscribers should validate the
|
||||
received data since it may be out of date, incomplete or even invalid.
|
||||
|
||||
Because AMQP is message oriented, subscribers receive transactions
|
||||
and blocks all-at-once and do not need to implement any sort of
|
||||
buffering or reassembly.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The AMQP feature in Hush requires [Qpid Proton](https://qpid.apache.org/proton/)
|
||||
version 0.17 or newer, which you will need to install if you are not
|
||||
using the depends system. Typically, it is packaged by distributions as
|
||||
something like *libqpid-proton*. The C++ wrapper for AMQP *is* required.
|
||||
|
||||
In order to run the example Python client scripts in contrib/ one must
|
||||
also install *python-qpid-proton*, though this is not necessary for
|
||||
daemon operation.
|
||||
|
||||
## Enabling
|
||||
|
||||
By default, the AMQP feature is automatically compiled in if the
|
||||
necessary prerequisites are found. To disable, use --disable-proton
|
||||
during the *configure* step of building zcashd:
|
||||
|
||||
$ ./configure --disable-proton (other options)
|
||||
|
||||
To actually enable operation, one must set the appropriate options on
|
||||
the commandline or in the configuration file.
|
||||
|
||||
## Usage
|
||||
|
||||
AMQP support is currently an experimental feature, so you must pass
|
||||
the option:
|
||||
|
||||
-experimentalfeatures
|
||||
|
||||
Currently, the following notifications are supported:
|
||||
|
||||
-amqppubhashtx=address
|
||||
-amqppubhashblock=address
|
||||
-amqppubrawblock=address
|
||||
-amqppubrawtx=address
|
||||
|
||||
The address must be a valid AMQP address, where the same address can be
|
||||
used in more than notification. Note that SSL and SASL addresses are
|
||||
not currently supported.
|
||||
|
||||
Launch zcashd like this:
|
||||
|
||||
$ zcashd -amqppubhashtx=amqp://127.0.0.1:5672
|
||||
|
||||
Or this:
|
||||
|
||||
$ zcashd -amqppubhashtx=amqp://127.0.0.1:5672 \
|
||||
-amqppubrawtx=amqp://127.0.0.1:5672 \
|
||||
-amqppubrawblock=amqp://127.0.0.1:5672 \
|
||||
-amqppubhashblock=amqp://127.0.0.1:5672 \
|
||||
-debug=amqp
|
||||
|
||||
The debug category `amqp` enables AMQP-related logging.
|
||||
|
||||
Each notification has a topic and body, where the header corresponds
|
||||
to the notification type. For instance, for the notification `-amqpubhashtx`
|
||||
the topic is `hashtx` (no null terminator) and the body is the hexadecimal
|
||||
transaction hash (32 bytes). This transaction hash and the block hash
|
||||
found in `hashblock` are in RPC byte order.
|
||||
|
||||
These options can also be provided in zcash.conf.
|
||||
|
||||
Please see `contrib/amqp/amqp_sub.py` for a working example of an
|
||||
AMQP server listening for messages.
|
||||
|
||||
## Remarks
|
||||
|
||||
From the perspective of zcashd, the local end of an AMQP link is write-only.
|
||||
|
||||
No information is broadcast that wasn't already received from the public
|
||||
P2P network.
|
||||
|
||||
No authentication or authorization is done on peers that zcashd connects
|
||||
to; it is assumed that the AMQP link is exposed only to trusted entities,
|
||||
using other means such as firewalling.
|
||||
|
||||
TLS support may be added once OpenSSL has been removed from the Hush
|
||||
project and alternative TLS implementations have been evaluated.
|
||||
|
||||
SASL support may be added in a future update for secure communication.
|
||||
|
||||
Note that when the block chain tip changes, a reorganisation may occur
|
||||
and just the tip will be notified. It is up to the subscriber to
|
||||
retrieve the chain from the last known block to the new tip.
|
||||
|
||||
At present, zcashd does not try to resend a notification if there was
|
||||
a problem confirming receipt. Support for delivery guarantees such as
|
||||
*at-least-once* and *exactly-once* will be added in in a future update.
|
||||
|
||||
Currently, zcashd appends an up-counting sequence number to each notification
|
||||
which allows listeners to detect lost notifications.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
|
||||
.TH HUSH-CLI "1" "January 2020" "hush-cli v3.3.1" "User Commands"
|
||||
.TH HUSH-CLI "1" "June 2020" "hush-cli v3.4.0" "User Commands"
|
||||
.SH NAME
|
||||
hush-cli \- manual page for hush-cli v3.3.1
|
||||
hush-cli \- manual page for hush-cli v3.4.0
|
||||
.SH DESCRIPTION
|
||||
Komodo RPC client version v3.3.1\-d4ac8162f
|
||||
Komodo RPC client version v3.4.0\-2fbcca416\-dirty
|
||||
.PP
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://myhush.org/security/>.
|
||||
@@ -71,7 +71,7 @@ Timeout in seconds during HTTP requests, or 0 for no timeout. (default:
|
||||
Read extra arguments from standard input, one per line until EOF/Ctrl\-D
|
||||
(recommended for sensitive information such as passphrases)
|
||||
.SH COPYRIGHT
|
||||
Hush Daemon version v3.3.1-d4ac8162f
|
||||
Hush Daemon version v3.4.0-2fbcca416-dirty
|
||||
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://myhush.org/security/>.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
|
||||
.TH HUSH-TX "1" "January 2020" "hush-tx v3.3.1" "User Commands"
|
||||
.TH HUSH-TX "1" "June 2020" "hush-tx v3.4.0" "User Commands"
|
||||
.SH NAME
|
||||
hush-tx \- manual page for hush-tx v3.3.1
|
||||
hush-tx \- manual page for hush-tx v3.4.0
|
||||
.SH DESCRIPTION
|
||||
Hush komodo\-tx utility version v3.3.1\-d4ac8162f
|
||||
Hush komodo\-tx utility version v3.4.0\-2fbcca416\-dirty
|
||||
.SS "Usage:"
|
||||
.TP
|
||||
komodo\-tx [options] <hex\-tx> [commands]
|
||||
@@ -84,7 +84,7 @@ set=NAME:JSON\-STRING
|
||||
.IP
|
||||
Set register NAME to given JSON\-STRING
|
||||
.SH COPYRIGHT
|
||||
Hush Daemon version v3.3.1-d4ac8162f
|
||||
Hush Daemon version v3.4.0-2fbcca416-dirty
|
||||
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://myhush.org/security/>.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
|
||||
.TH HUSHD "1" "January 2020" "hushd v3.3.1" "User Commands"
|
||||
.TH HUSHD "1" "June 2020" "hushd v3.4.0" "User Commands"
|
||||
.SH NAME
|
||||
hushd \- manual page for hushd v3.3.1
|
||||
hushd \- manual page for hushd v3.4.0
|
||||
.SH DESCRIPTION
|
||||
Found binary: ./komodod
|
||||
Hush Daemon version v3.3.1\-d4ac8162f
|
||||
Hush Daemon version v3.4.0\-2fbcca416\-dirty
|
||||
.PP
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://myhush.org/security/>.
|
||||
@@ -87,6 +87,11 @@ leave that many cores free, default: 0)
|
||||
.IP
|
||||
Specify pid file (default: komodod.pid)
|
||||
.HP
|
||||
\fB\-txexpirynotify=\fR<cmd>
|
||||
.IP
|
||||
Execute command when transaction expires (%s in cmd is replaced by
|
||||
transaction id)
|
||||
.HP
|
||||
\fB\-prune=\fR<n>
|
||||
.IP
|
||||
Reduce storage requirements by pruning (deleting) old blocks. This mode
|
||||
@@ -265,6 +270,41 @@ Do not load the wallet and disable wallet RPC calls
|
||||
.IP
|
||||
Set key pool size to <n> (default: 100)
|
||||
.HP
|
||||
\fB\-consolidation\fR
|
||||
.IP
|
||||
Enable auto Sapling note consolidation (default: false)
|
||||
.HP
|
||||
\fB\-consolidatesaplingaddress=\fR<zaddr>
|
||||
.IP
|
||||
Specify Sapling Address to Consolidate. (default: all)
|
||||
.HP
|
||||
\fB\-consolidationtxfee\fR
|
||||
.IP
|
||||
Fee amount in Puposhis used send consolidation transactions. (default
|
||||
10000)
|
||||
.HP
|
||||
\fB\-deletetx\fR
|
||||
.IP
|
||||
Enable Old Transaction Deletion
|
||||
.HP
|
||||
\fB\-deleteinterval\fR
|
||||
.IP
|
||||
Delete transaction every <n> blocks during inital block download
|
||||
(default: 1000)
|
||||
.HP
|
||||
\fB\-keeptxnum\fR
|
||||
.IP
|
||||
Keep the last <n> transactions (default: 200)
|
||||
.HP
|
||||
\fB\-keeptxfornblocks\fR
|
||||
.IP
|
||||
Keep transactions for at least <n> blocks (default: 10000)
|
||||
.HP
|
||||
\fB\-opretmintxfee=\fR<amt>
|
||||
.IP
|
||||
Minimum fee (in KMD/kB) to allow for OP_RETURN transactions (default:
|
||||
400000)
|
||||
.HP
|
||||
\fB\-paytxfee=\fR<amt>
|
||||
.IP
|
||||
Fee (in KMD/kB) to add to transactions you send (default: 0.00)
|
||||
@@ -358,7 +398,7 @@ Debugging/Testing options:
|
||||
Output debugging information (default: 0, supplying <category> is
|
||||
optional). If <category> is not supplied or if <category> = 1, output
|
||||
all debugging information. <category> can be: addrman, alert, bench,
|
||||
coindb, db, estimatefee, http, libevent, lock, mempool, net,
|
||||
coindb, db, deletetx, estimatefee, http, libevent, lock, mempool, net,
|
||||
partitioncheck, pow, proxy, prune, rand, reindex, rpc, selectcoins, tor,
|
||||
zmq, zrpc, zrpcunsafe (implies zrpc).
|
||||
.HP
|
||||
@@ -599,7 +639,7 @@ Starting supply, default is 0
|
||||
.IP
|
||||
Enforce transaction\-rate limit, default 0
|
||||
.SH COPYRIGHT
|
||||
Hush Daemon version v3.3.1-d4ac8162f
|
||||
Hush Daemon version v3.4.0-2fbcca416-dirty
|
||||
|
||||
In order to ensure you are adequately protecting your privacy when using Hush,
|
||||
please see <https://myhush.org/security/>.
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
# Payment Disclosure (Experimental Feature)
|
||||
|
||||
**Summary**
|
||||
|
||||
Use RPC calls `z_getpaymentdisclosure` and `z_validatepaymentdisclosure` to reveal details of a shielded payment.
|
||||
|
||||
**Who should read this document**
|
||||
|
||||
Frequent users of shielded transactions, payment processors, exchanges, block explorer
|
||||
|
||||
### Experimental Feature
|
||||
|
||||
This is an experimental feature. Enable it by launching `zcashd` with flags:
|
||||
|
||||
zcashd -experimentalfeatures -paymentdisclosure -debug=paymentdisclosure -txindex=1
|
||||
|
||||
These flags can also be set as options in `zcash.conf`.
|
||||
|
||||
All nodes that generate or validate payment disclosures must run with `txindex=1` enabled.
|
||||
|
||||
### Background
|
||||
|
||||
Payment Disclosure is an implementation of the work-in-progress Payment Disclosure ZIP [1].
|
||||
|
||||
The ZIP describes a method of proving that a payment was sent to a shielded address. In the typical case, this means enabling a sender to present a proof that they transferred funds to a recipient's shielded address.
|
||||
|
||||
[1] https://github.com/zcash/zips/pull/119
|
||||
|
||||
### Example Use Case
|
||||
|
||||
Alice the customer sends 10 HUSH to Bob the merchant at the shielded address shown on their website. However, Bob is not sure if he received the funds.
|
||||
|
||||
Alice's node is running with payment disclosure enabled, so Alice generates a payment disclosure and provides it to Bob, who verifies the payment was made.
|
||||
|
||||
If Bob is a bad merchant, Alice can present the payment disclosure to a third party to validate that payment was indeed made.
|
||||
|
||||
### Solution
|
||||
|
||||
A payment disclosure can be generated for any output of a JoinSplit using the RPC call:
|
||||
|
||||
z_getpaymentdisclosure txid js_index output_index (message)
|
||||
|
||||
An optional message can be supplied. This could be used for a refund address or some other reference, as currently it is not common practice to (ahead of time) include a refund address in the memo field when making a payment.
|
||||
|
||||
To validate a payment disclosure, the following RPC call can be used:
|
||||
|
||||
z_validatepaymentdisclosure hexdata
|
||||
|
||||
### Example
|
||||
|
||||
Generate a payment disclosure for the first joinsplit, second output (index starts from zero):
|
||||
|
||||
hush-cli z_getpaymentdisclosure 79189528d611e811a1c7bb0358dd31343033d14b4c1e998d7c4799c40f8b652b 0 1 "Hello"
|
||||
|
||||
This returns a payment disclosure in the form of a hex string:
|
||||
|
||||
706462ff000a3722aafa8190cdf9710bfad6da2af6d3a74262c1fc96ad47df814b0cd5641c2b658b0fc499477c8d991e4c4bd133303431dd5803bbc7a111e811d6289518790000000000000000017e861adb829d8cb1cbcf6330b8c2e25fb0d08041a67a857815a136f0227f8a5342bce5b3c0d894e2983000eb594702d3c1580817d0374e15078528e56bb6f80c0548656c6c6f59a7085395c9e706d82afe3157c54ad4ae5bf144fcc774a8d9c921c58471402019c156ec5641e2173c4fb6467df5f28530dc4636fa71f4d0e48fc5c560fac500
|
||||
|
||||
To validate the payment disclosure:
|
||||
|
||||
hush-cli z_validatepaymentdisclosure HEXDATA
|
||||
|
||||
This returns data related to the payment and the payment disclosure:
|
||||
|
||||
{
|
||||
"txid": "79189528d611e811a1c7bb0358dd31343033d14b4c1e998d7c4799c40f8b652b",
|
||||
"jsIndex": 0,
|
||||
"outputIndex": 1,
|
||||
"version": 0,
|
||||
"onetimePrivKey": "1c64d50c4b81df47ad96fcc16242a7d3f62adad6fa0b71f9cd9081faaa22370a",
|
||||
"message": "Hello",
|
||||
"joinSplitPubKey": "d1c465d16166b602992479acfac18e87dc18065f6cefde6a002e70bc371b9faf",
|
||||
"signatureVerified": true,
|
||||
"paymentAddress": "ztaZJXy8iX8nrk2ytXKDBoTWqPkhQcj6E2ifARnD3wfkFwsxXs5SoX7NGmrjkzSiSKn8VtLHTJae48vX5NakvmDhtGNY5eb",
|
||||
"memo": "f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"value": 12.49900000,
|
||||
"commitmentMatch": true,
|
||||
"valid": true
|
||||
}
|
||||
|
||||
The `signatureVerified` field confirms that the payment disclosure was generated and signed with the joinSplitPrivKey, which should only be known by the node generating and sending the transaction 7918...652b in question.
|
||||
|
||||
### Where is the data stored?
|
||||
|
||||
For all nodes, payment disclosure does not touch `wallet.dat` in any way.
|
||||
|
||||
For nodes that only validate payment disclosures, no data is stored locally.
|
||||
|
||||
For nodes that generate payment disclosures, a LevelDB database is created in the node's datadir. For most users, this would be in the folder:
|
||||
|
||||
$HOME/.zcash/paymentdisclosure
|
||||
|
||||
If you decide you don't want to use payment disclosure, it is safe to shut down your node and delete the database folder.
|
||||
|
||||
### Security Properties
|
||||
|
||||
Please consult the work-in-progress ZIP for details about the protocol, security properties and caveats.
|
||||
|
||||
### Reminder
|
||||
|
||||
Feedback is most welcome!
|
||||
|
||||
This is an experimental feature so there are no guarantees that the protocol, database format, RPC interface etc. will remain the same in the future.
|
||||
|
||||
### Notes
|
||||
|
||||
Currently there is no user friendly way to help senders identify which joinsplit output index maps to a given payment they made. It is possible to construct this from `debug.log`. Ideas and feedback are most welcome on how to improve the user experience.
|
||||
@@ -1,13 +1,20 @@
|
||||
Security Warnings
|
||||
====================
|
||||
|
||||
Security Audit
|
||||
Security Audits
|
||||
--------------
|
||||
|
||||
Hush has been subjected to a formal third-party security review. For security
|
||||
Hush has not been subjected to a formal third-party security review! But the
|
||||
Zcash source code has. For security
|
||||
announcements, audit results and other general security information, see
|
||||
https://z.cash/support/security.html
|
||||
|
||||
Hush does our best to integrate fixes and recommendations from Zcash audits
|
||||
to our own code, such as audits on ZecWallet that apply to SilentDragon.
|
||||
Hush also reports many new bugs and issues to upstream Zcash and many other
|
||||
Zcash Protocol coins.
|
||||
|
||||
|
||||
x86-64 Linux Only
|
||||
-----------------------
|
||||
|
||||
@@ -64,7 +71,7 @@ be able to:
|
||||
each note ciphertext on the blockchain.
|
||||
|
||||
You should ensure no other users have the ability to execute code (even
|
||||
unprivileged) on the hardware your `zcashd` process runs on until these
|
||||
unprivileged) on the hardware your `hushd` process runs on until these
|
||||
vulnerabilities are fully analyzed and fixed.
|
||||
|
||||
REST Interface
|
||||
@@ -77,9 +84,9 @@ security review.
|
||||
RPC Interface
|
||||
---------------
|
||||
|
||||
Users should choose a strong RPC password. If no RPC username and password are set, zcashd will not start and will print an error message with a suggestion for a strong random password. If the client knows the RPC password, they have at least full access to the node. In addition, certain RPC commands can be misused to overwrite files and/or take over the account that is running zcashd. (In the future we may restrict these commands, but full node access – including the ability to spend from and export keys held by the wallet – would still be possible unless wallet methods are disabled.)
|
||||
Users should choose a strong RPC password. If no RPC username and password are set, hush will not start and will print an error message with a suggestion for a strong random password. If the client knows the RPC password, they have at least full access to the node. In addition, certain RPC commands can be misused to overwrite files and/or take over the account that is running hushd. (In the future we may restrict these commands, but full node access – including the ability to spend from and export keys held by the wallet – would still be possible unless wallet methods are disabled.)
|
||||
|
||||
Users should also refrain from changing the default setting that only allows RPC connections from localhost. Allowing connections from remote hosts would enable a MITM to execute arbitrary RPC commands, which could lead to compromise of the account running zcashd and loss of funds. For multi-user services that use one or more zcashd instances on the backend, the parameters passed in by users should be controlled to prevent confused-deputy attacks which could spend from any keys held by that zcashd.
|
||||
Users should also refrain from changing the default setting that only allows RPC connections from localhost. Allowing connections from remote hosts would enable a MITM to execute arbitrary RPC commands, which could lead to compromise of the account running hushd and loss of funds. For multi-user services that use one or more hushd instances on the backend, the parameters passed in by users should be controlled to prevent confused-deputy attacks which could spend from any keys held by that zcashd.
|
||||
|
||||
Block Chain Reorganization: Major Differences
|
||||
-------------------------------------------------
|
||||
@@ -100,11 +107,9 @@ Private spending keys for z addresses are never logged.
|
||||
Potentially-Missing Required Modifications
|
||||
------------------------------------------
|
||||
|
||||
In addition to potential mistakes in code we added to Bitcoin Core, and
|
||||
potential mistakes in our modifications to Bitcoin Core, it is also possible
|
||||
that there were potential changes we were supposed to make to Bitcoin Core but
|
||||
didn't, either because we didn't even consider making those changes, or we ran
|
||||
out of time. We have brainstormed and documented a variety of such possibilities
|
||||
in [issue #826](https://github.com/zcash/zcash/issues/826), and believe that we
|
||||
have changed or done everything that was necessary for the 1.0.0 launch. Users
|
||||
may want to review this list themselves.
|
||||
In addition to potential mistakes in code we added to Bitcoin Core, Zcash
|
||||
and Komodo and
|
||||
potential mistakes in our modifications to Bitcoin Core, Zcash and Komodo, it is also possible
|
||||
that there were potential changes we were supposed to make to Bitcoin Core, Zcash and Komodo but
|
||||
didn't, either because we didn't even consider making those changes or have not found out about
|
||||
them. Submitting Github issues is highly appreciated!
|
||||
|
||||
@@ -64,21 +64,19 @@ def check_security_hardening():
|
||||
# PIE, RELRO, Canary, and NX are tested by make check-security.
|
||||
ret &= subprocess.call(['make', '-C', repofile('src'), 'check-security']) == 0
|
||||
|
||||
ret &= test_rpath_runpath('src/zcashd')
|
||||
ret &= test_rpath_runpath('src/zcash-cli')
|
||||
ret &= test_rpath_runpath('src/zcash-gtest')
|
||||
ret &= test_rpath_runpath('src/zcash-tx')
|
||||
ret &= test_rpath_runpath('src/hushd')
|
||||
ret &= test_rpath_runpath('src/hush-cli')
|
||||
ret &= test_rpath_runpath('src/hush-gtest')
|
||||
ret &= test_rpath_runpath('src/hush-tx')
|
||||
ret &= test_rpath_runpath('src/test/test_bitcoin')
|
||||
ret &= test_rpath_runpath('src/zcash/GenerateParams')
|
||||
|
||||
# NOTE: checksec.sh does not reliably determine whether FORTIFY_SOURCE
|
||||
# is enabled for the entire binary. See issue #915.
|
||||
ret &= test_fortify_source('src/zcashd')
|
||||
ret &= test_fortify_source('src/zcash-cli')
|
||||
ret &= test_fortify_source('src/zcash-gtest')
|
||||
ret &= test_fortify_source('src/zcash-tx')
|
||||
ret &= test_fortify_source('src/hushd')
|
||||
ret &= test_fortify_source('src/hush-cli')
|
||||
ret &= test_fortify_source('src/hush-gtest')
|
||||
ret &= test_fortify_source('src/hush-tx')
|
||||
ret &= test_fortify_source('src/test/test_bitcoin')
|
||||
ret &= test_fortify_source('src/zcash/GenerateParams')
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2019-2020 Hush developers
|
||||
# Released under the GPLv3
|
||||
#
|
||||
# Execute all of the automated tests related to Zcash.
|
||||
# Execute all of the automated tests related to Hush
|
||||
#
|
||||
|
||||
import argparse
|
||||
@@ -32,7 +34,7 @@ RE_FORTIFY_USED = re.compile('Binary compiled with FORTIFY_SOURCE support.*Yes')
|
||||
|
||||
def test_rpath_runpath(filename):
|
||||
output = subprocess.check_output(
|
||||
[repofile('qa/zcash/checksec.sh'), '--file', repofile(filename)]
|
||||
[repofile('qa/hush/checksec.sh'), '--file', repofile(filename)]
|
||||
)
|
||||
if RE_RPATH_RUNPATH.search(output):
|
||||
print('PASS: %s has no RPATH or RUNPATH.' % filename)
|
||||
@@ -44,7 +46,7 @@ def test_rpath_runpath(filename):
|
||||
|
||||
def test_fortify_source(filename):
|
||||
proc = subprocess.Popen(
|
||||
[repofile('qa/zcash/checksec.sh'), '--fortify-file', repofile(filename)],
|
||||
[repofile('qa/hush/checksec.sh'), '--fortify-file', repofile(filename)],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
line1 = proc.stdout.readline()
|
||||
@@ -64,24 +66,24 @@ def check_security_hardening():
|
||||
ret &= subprocess.call(['make', '-C', repofile('src'), 'check-security']) == 0
|
||||
|
||||
# The remaining checks are only for ELF binaries
|
||||
# Assume that if zcashd is an ELF binary, they all are
|
||||
with open(repofile('src/zcashd'), 'rb') as f:
|
||||
# Assume that if hushd is an ELF binary, they all are
|
||||
with open(repofile('src/hushd'), 'rb') as f:
|
||||
magic = f.read(4)
|
||||
if not magic.startswith(b'\x7fELF'):
|
||||
return ret
|
||||
|
||||
ret &= test_rpath_runpath('src/zcashd')
|
||||
ret &= test_rpath_runpath('src/zcash-cli')
|
||||
ret &= test_rpath_runpath('src/zcash-gtest')
|
||||
ret &= test_rpath_runpath('src/zcash-tx')
|
||||
ret &= test_rpath_runpath('src/hushd')
|
||||
ret &= test_rpath_runpath('src/hush-cli')
|
||||
ret &= test_rpath_runpath('src/hush-gtest')
|
||||
ret &= test_rpath_runpath('src/hush-tx')
|
||||
ret &= test_rpath_runpath('src/test/test_bitcoin')
|
||||
|
||||
# NOTE: checksec.sh does not reliably determine whether FORTIFY_SOURCE
|
||||
# is enabled for the entire binary. See issue #915.
|
||||
ret &= test_fortify_source('src/zcashd')
|
||||
ret &= test_fortify_source('src/zcash-cli')
|
||||
ret &= test_fortify_source('src/zcash-gtest')
|
||||
ret &= test_fortify_source('src/zcash-tx')
|
||||
ret &= test_fortify_source('src/hushd')
|
||||
ret &= test_fortify_source('src/hush-cli')
|
||||
ret &= test_fortify_source('src/hush-gtest')
|
||||
ret &= test_fortify_source('src/hush-tx')
|
||||
ret &= test_fortify_source('src/test/test_bitcoin')
|
||||
|
||||
return ret
|
||||
@@ -138,19 +140,17 @@ STAGES = [
|
||||
'no-dot-so',
|
||||
'util-test',
|
||||
'secp256k1',
|
||||
'libsnark',
|
||||
'univalue',
|
||||
'rpc',
|
||||
]
|
||||
|
||||
STAGE_COMMANDS = {
|
||||
'btest': [repofile('src/test/test_bitcoin'), '-p'],
|
||||
'gtest': [repofile('src/zcash-gtest')],
|
||||
'gtest': [repofile('src/komodo-gtest')],
|
||||
'sec-hard': check_security_hardening,
|
||||
'no-dot-so': ensure_no_dot_so_in_depends,
|
||||
'util-test': util_test,
|
||||
'secp256k1': ['make', '-C', repofile('src/secp256k1'), 'check'],
|
||||
'libsnark': ['make', '-C', repofile('src'), 'libsnark-tests'],
|
||||
'univalue': ['make', '-C', repofile('src/univalue'), 'check'],
|
||||
'rpc': [repofile('qa/pull-tester/rpc-tests.sh')],
|
||||
}
|
||||
|
||||
@@ -17,14 +17,12 @@ testScripts=(
|
||||
'dpow.py'
|
||||
'dpowconfs.py'
|
||||
'ac_private.py'
|
||||
'paymentdisclosure.py'
|
||||
'prioritisetransaction.py'
|
||||
'wallet_treestate.py'
|
||||
'wallet_anchorfork.py'
|
||||
'wallet_changeindicator.py'
|
||||
'wallet_import_export.py'
|
||||
'wallet_protectcoinbase.py'
|
||||
'wallet_shieldcoinbase_sprout.py'
|
||||
'wallet_shieldcoinbase_sapling.py'
|
||||
'wallet_listreceived.py'
|
||||
'wallet_mergetoaddress.py'
|
||||
@@ -65,14 +63,11 @@ testScripts=(
|
||||
'decodescript.py'
|
||||
'blockchain.py'
|
||||
'disablewallet.py'
|
||||
'zcjoinsplit.py'
|
||||
'zcjoinsplitdoublespend.py'
|
||||
'ivk_import_export.py'
|
||||
'zkey_import_export.py'
|
||||
'getblocktemplate.py'
|
||||
'bip65-cltv-p2p.py'
|
||||
'bipdersig-p2p.py'
|
||||
'p2p_nu_peer_management.py'
|
||||
'rewind_index.py'
|
||||
'p2p_txexpiry_dos.py'
|
||||
'p2p_node_bloom.py'
|
||||
@@ -101,10 +96,6 @@ if [ "x$ENABLE_ZMQ" = "x1" ]; then
|
||||
testScripts+=('zmq_test.py')
|
||||
fi
|
||||
|
||||
if [ "x$ENABLE_PROTON" = "x1" ]; then
|
||||
testScripts+=('proton_test.py')
|
||||
fi
|
||||
|
||||
extArg="-extended"
|
||||
passOn=${@#$extArg}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ]
|
||||
|
||||
blocks.extend(self.nodes[0].generate(1))
|
||||
self.sync_all()
|
||||
|
||||
# mempool should be empty, all txns confirmed
|
||||
assert_equal(set(self.nodes[0].getrawmempool()), set())
|
||||
@@ -74,6 +75,8 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
|
||||
# Generate another block, they should all get mined
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# mempool should be empty, all txns confirmed
|
||||
assert_equal(set(self.nodes[0].getrawmempool()), set())
|
||||
for txid in spends1_id+spends2_id:
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework.mininode import (
|
||||
NodeConn,
|
||||
NodeConnCB,
|
||||
NetworkThread,
|
||||
msg_ping,
|
||||
SPROUT_PROTO_VERSION,
|
||||
OVERWINTER_PROTO_VERSION,
|
||||
SAPLING_PROTO_VERSION,
|
||||
)
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import initialize_chain_clean, start_nodes, \
|
||||
p2p_port, assert_equal
|
||||
|
||||
import time
|
||||
|
||||
#
|
||||
# In this test we connect Sprout, Overwinter, and Sapling mininodes to a Zcashd
|
||||
# node which will activate Overwinter at block 10 and Sapling at block 15.
|
||||
#
|
||||
# We test:
|
||||
# 1. the mininodes stay connected to Zcash with Sprout consensus rules
|
||||
# 2. when Overwinter activates, the Sprout mininodes are dropped
|
||||
# 3. new Overwinter and Sapling nodes can connect to Zcash
|
||||
# 4. new Sprout nodes cannot connect to Zcash
|
||||
# 5. when Sapling activates, the Overwinter mininodes are dropped
|
||||
# 6. new Sapling nodes can connect to Zcash
|
||||
# 7. new Sprout and Overwinter nodes cannot connect to Zcash
|
||||
#
|
||||
# This test *does not* verify that prior to each activation, the Zcashd
|
||||
# node will prefer connections with NU-aware nodes, with an eviction process
|
||||
# that prioritizes non-NU-aware connections.
|
||||
#
|
||||
|
||||
|
||||
class TestManager(NodeConnCB):
|
||||
def __init__(self):
|
||||
NodeConnCB.__init__(self)
|
||||
self.create_callback_map()
|
||||
|
||||
def on_close(self, conn):
|
||||
pass
|
||||
|
||||
def on_reject(self, conn, message):
|
||||
conn.rejectMessage = message
|
||||
|
||||
|
||||
class NUPeerManagementTest(BitcoinTestFramework):
|
||||
|
||||
def setup_chain(self):
|
||||
print "Initializing test directory "+self.options.tmpdir
|
||||
initialize_chain_clean(self.options.tmpdir, 1)
|
||||
|
||||
def setup_network(self):
|
||||
self.nodes = start_nodes(1, self.options.tmpdir, extra_args=[[
|
||||
'-nuparams=5ba81b19:10', # Overwinter
|
||||
'-nuparams=76b809bb:15', # Sapling
|
||||
'-debug',
|
||||
'-whitelist=127.0.0.1',
|
||||
]])
|
||||
|
||||
def run_test(self):
|
||||
test = TestManager()
|
||||
|
||||
# Launch Sprout, Overwinter, and Sapling mininodes
|
||||
nodes = []
|
||||
for x in xrange(10):
|
||||
nodes.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0],
|
||||
test, "regtest", SPROUT_PROTO_VERSION))
|
||||
nodes.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0],
|
||||
test, "regtest", OVERWINTER_PROTO_VERSION))
|
||||
nodes.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0],
|
||||
test, "regtest", SAPLING_PROTO_VERSION))
|
||||
|
||||
# Start up network handling in another thread
|
||||
NetworkThread().start()
|
||||
|
||||
# Sprout consensus rules apply at block height 9
|
||||
self.nodes[0].generate(9)
|
||||
assert_equal(9, self.nodes[0].getblockcount())
|
||||
|
||||
# Verify mininodes are still connected to zcashd node
|
||||
peerinfo = self.nodes[0].getpeerinfo()
|
||||
versions = [x["version"] for x in peerinfo]
|
||||
assert_equal(10, versions.count(SPROUT_PROTO_VERSION))
|
||||
assert_equal(10, versions.count(OVERWINTER_PROTO_VERSION))
|
||||
assert_equal(10, versions.count(SAPLING_PROTO_VERSION))
|
||||
|
||||
# Overwinter consensus rules activate at block height 10
|
||||
self.nodes[0].generate(1)
|
||||
assert_equal(10, self.nodes[0].getblockcount())
|
||||
print('Overwinter active')
|
||||
|
||||
# Mininodes send ping message to zcashd node.
|
||||
pingCounter = 1
|
||||
for node in nodes:
|
||||
node.send_message(msg_ping(pingCounter))
|
||||
pingCounter = pingCounter + 1
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
# Verify Sprout mininodes have been dropped, while Overwinter and
|
||||
# Sapling mininodes are still connected.
|
||||
peerinfo = self.nodes[0].getpeerinfo()
|
||||
versions = [x["version"] for x in peerinfo]
|
||||
assert_equal(0, versions.count(SPROUT_PROTO_VERSION))
|
||||
assert_equal(10, versions.count(OVERWINTER_PROTO_VERSION))
|
||||
assert_equal(10, versions.count(SAPLING_PROTO_VERSION))
|
||||
|
||||
# Extend the Overwinter chain with another block.
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
# Connect a new Overwinter mininode to the zcashd node, which is accepted.
|
||||
nodes.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test, "regtest", OVERWINTER_PROTO_VERSION))
|
||||
time.sleep(3)
|
||||
assert_equal(21, len(self.nodes[0].getpeerinfo()))
|
||||
|
||||
# Connect a new Sapling mininode to the zcashd node, which is accepted.
|
||||
nodes.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test, "regtest", SAPLING_PROTO_VERSION))
|
||||
time.sleep(3)
|
||||
assert_equal(22, len(self.nodes[0].getpeerinfo()))
|
||||
|
||||
# Try to connect a new Sprout mininode to the zcashd node, which is rejected.
|
||||
sprout = NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test, "regtest", SPROUT_PROTO_VERSION)
|
||||
nodes.append(sprout)
|
||||
time.sleep(3)
|
||||
assert("Version must be 170003 or greater" in str(sprout.rejectMessage))
|
||||
|
||||
# Verify that only Overwinter and Sapling mininodes are connected.
|
||||
peerinfo = self.nodes[0].getpeerinfo()
|
||||
versions = [x["version"] for x in peerinfo]
|
||||
assert_equal(0, versions.count(SPROUT_PROTO_VERSION))
|
||||
assert_equal(11, versions.count(OVERWINTER_PROTO_VERSION))
|
||||
assert_equal(11, versions.count(SAPLING_PROTO_VERSION))
|
||||
|
||||
# Sapling consensus rules activate at block height 15
|
||||
self.nodes[0].generate(4)
|
||||
assert_equal(15, self.nodes[0].getblockcount())
|
||||
print('Sapling active')
|
||||
|
||||
# Mininodes send ping message to zcashd node.
|
||||
pingCounter = 1
|
||||
for node in nodes:
|
||||
node.send_message(msg_ping(pingCounter))
|
||||
pingCounter = pingCounter + 1
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
# Verify Sprout and Overwinter mininodes have been dropped, while
|
||||
# Sapling mininodes are still connected.
|
||||
peerinfo = self.nodes[0].getpeerinfo()
|
||||
versions = [x["version"] for x in peerinfo]
|
||||
assert_equal(0, versions.count(SPROUT_PROTO_VERSION))
|
||||
assert_equal(0, versions.count(OVERWINTER_PROTO_VERSION))
|
||||
assert_equal(11, versions.count(SAPLING_PROTO_VERSION))
|
||||
|
||||
# Extend the Sapling chain with another block.
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
# Connect a new Sapling mininode to the zcashd node, which is accepted.
|
||||
nodes.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test, "regtest", SAPLING_PROTO_VERSION))
|
||||
time.sleep(3)
|
||||
assert_equal(12, len(self.nodes[0].getpeerinfo()))
|
||||
|
||||
# Try to connect a new Sprout mininode to the zcashd node, which is rejected.
|
||||
sprout = NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test, "regtest", SPROUT_PROTO_VERSION)
|
||||
nodes.append(sprout)
|
||||
time.sleep(3)
|
||||
assert("Version must be 170006 or greater" in str(sprout.rejectMessage))
|
||||
|
||||
# Try to connect a new Overwinter mininode to the zcashd node, which is rejected.
|
||||
sprout = NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test, "regtest", OVERWINTER_PROTO_VERSION)
|
||||
nodes.append(sprout)
|
||||
time.sleep(3)
|
||||
assert("Version must be 170006 or greater" in str(sprout.rejectMessage))
|
||||
|
||||
# Verify that only Sapling mininodes are connected.
|
||||
peerinfo = self.nodes[0].getpeerinfo()
|
||||
versions = [x["version"] for x in peerinfo]
|
||||
assert_equal(0, versions.count(SPROUT_PROTO_VERSION))
|
||||
assert_equal(0, versions.count(OVERWINTER_PROTO_VERSION))
|
||||
assert_equal(12, versions.count(SAPLING_PROTO_VERSION))
|
||||
|
||||
for node in nodes:
|
||||
node.disconnect_node()
|
||||
|
||||
if __name__ == '__main__':
|
||||
NUPeerManagementTest().main()
|
||||
@@ -1,215 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
from test_framework.util import assert_equal, initialize_chain_clean, \
|
||||
start_node, connect_nodes_bi, wait_and_assert_operationid_status
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
class PaymentDisclosureTest (BitcoinTestFramework):
|
||||
|
||||
def setup_chain(self):
|
||||
print("Initializing test directory "+self.options.tmpdir)
|
||||
initialize_chain_clean(self.options.tmpdir, 4)
|
||||
|
||||
def setup_network(self, split=False):
|
||||
args = ['-debug=zrpcunsafe,paymentdisclosure', '-experimentalfeatures', '-paymentdisclosure', '-txindex=1']
|
||||
self.nodes = []
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, args))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, args))
|
||||
# node 2 does not enable payment disclosure
|
||||
args2 = ['-debug=zrpcunsafe', '-experimentalfeatures', '-txindex=1']
|
||||
self.nodes.append(start_node(2, self.options.tmpdir, args2))
|
||||
connect_nodes_bi(self.nodes,0,1)
|
||||
connect_nodes_bi(self.nodes,1,2)
|
||||
connect_nodes_bi(self.nodes,0,2)
|
||||
self.is_network_split=False
|
||||
self.sync_all()
|
||||
|
||||
def run_test (self):
|
||||
print "Mining blocks..."
|
||||
|
||||
self.nodes[0].generate(4)
|
||||
walletinfo = self.nodes[0].getwalletinfo()
|
||||
assert_equal(walletinfo['immature_balance'], 40)
|
||||
assert_equal(walletinfo['balance'], 0)
|
||||
self.sync_all()
|
||||
self.nodes[2].generate(3)
|
||||
self.sync_all()
|
||||
self.nodes[1].generate(101)
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[0].getbalance(), 40)
|
||||
assert_equal(self.nodes[1].getbalance(), 10)
|
||||
assert_equal(self.nodes[2].getbalance(), 30)
|
||||
|
||||
mytaddr = self.nodes[0].getnewaddress()
|
||||
myzaddr = self.nodes[0].z_getnewaddress()
|
||||
|
||||
# Check that Node 2 has payment disclosure disabled.
|
||||
try:
|
||||
self.nodes[2].z_getpaymentdisclosure("invalidtxid", 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("payment disclosure is disabled" in errorString)
|
||||
|
||||
# Check that Node 0 returns an error for an unknown txid
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure("invalidtxid", 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("No information available about transaction" in errorString)
|
||||
|
||||
# Shield coinbase utxos from node 0 of value 40, standard fee of 0.00010000
|
||||
recipients = [{"address":myzaddr, "amount":Decimal('40.0')-Decimal('0.0001')}]
|
||||
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
|
||||
txid = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
|
||||
# Check the tx has joinsplits
|
||||
assert( len(self.nodes[0].getrawtransaction("" + txid, 1)["vjoinsplit"]) > 0 )
|
||||
|
||||
# Sync mempools
|
||||
self.sync_all()
|
||||
|
||||
# Confirm that you can't create a payment disclosure for an unconfirmed tx
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure(txid, 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Transaction has not been confirmed yet" in errorString)
|
||||
|
||||
try:
|
||||
self.nodes[1].z_getpaymentdisclosure(txid, 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Transaction has not been confirmed yet" in errorString)
|
||||
|
||||
# Mine tx
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# Confirm that Node 1 cannot create a payment disclosure for a transaction which does not impact its wallet
|
||||
try:
|
||||
self.nodes[1].z_getpaymentdisclosure(txid, 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Transaction does not belong to the wallet" in errorString)
|
||||
|
||||
# Check that an invalid joinsplit index is rejected
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure(txid, 1, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Invalid js_index" in errorString)
|
||||
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure(txid, -1, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Invalid js_index" in errorString)
|
||||
|
||||
# Check that an invalid output index is rejected
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure(txid, 0, 2)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Invalid output_index" in errorString)
|
||||
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure(txid, 0, -1)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Invalid output_index" in errorString)
|
||||
|
||||
# Ask Node 0 to create and validate a payment disclosure for output 0
|
||||
message = "Here is proof of my payment!"
|
||||
pd = self.nodes[0].z_getpaymentdisclosure(txid, 0, 0, message)
|
||||
result = self.nodes[0].z_validatepaymentdisclosure(pd)
|
||||
assert(result["valid"])
|
||||
output_value_sum = Decimal(result["value"])
|
||||
|
||||
# Ask Node 1 to confirm the payment disclosure is valid
|
||||
result = self.nodes[1].z_validatepaymentdisclosure(pd)
|
||||
assert(result["valid"])
|
||||
assert_equal(result["message"], message)
|
||||
assert_equal(result["value"], output_value_sum)
|
||||
|
||||
# Confirm that payment disclosure begins with prefix zpd:
|
||||
assert(pd.startswith("zpd:"))
|
||||
|
||||
# Confirm that payment disclosure without prefix zpd: fails validation
|
||||
try:
|
||||
self.nodes[1].z_validatepaymentdisclosure(pd[4:])
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("payment disclosure prefix not found" in errorString)
|
||||
|
||||
# Check that total value of output index 0 and index 1 should equal shielding amount of 40 less standard fee.
|
||||
pd = self.nodes[0].z_getpaymentdisclosure(txid, 0, 1)
|
||||
result = self.nodes[0].z_validatepaymentdisclosure(pd)
|
||||
output_value_sum += Decimal(result["value"])
|
||||
assert_equal(output_value_sum, Decimal('39.99990000'))
|
||||
|
||||
# Create a z->z transaction, sending shielded funds from node 0 to node 1
|
||||
node1zaddr = self.nodes[1].z_getnewaddress()
|
||||
recipients = [{"address":node1zaddr, "amount":Decimal('1')}]
|
||||
myopid = self.nodes[0].z_sendmany(myzaddr, recipients)
|
||||
txid = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# Confirm that Node 0 can create a valid payment disclosure
|
||||
pd = self.nodes[0].z_getpaymentdisclosure(txid, 0, 0, "a message of your choice")
|
||||
result = self.nodes[0].z_validatepaymentdisclosure(pd)
|
||||
assert(result["valid"])
|
||||
|
||||
# Confirm that Node 1, even as recipient of shielded funds, cannot create a payment disclosure
|
||||
# as the transaction was created by Node 0 and Node 1's payment disclosure database does not
|
||||
# contain the necessary data to do so, where the data would only have been available on Node 0
|
||||
# when executing z_shieldcoinbase.
|
||||
try:
|
||||
self.nodes[1].z_getpaymentdisclosure(txid, 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Could not find payment disclosure info for the given joinsplit output" in errorString)
|
||||
|
||||
# Payment disclosures cannot be created for transparent transactions.
|
||||
txid = self.nodes[2].sendtoaddress(mytaddr, 1.0)
|
||||
self.sync_all()
|
||||
|
||||
# No matter the type of transaction, if it has not been confirmed, it is ignored.
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure(txid, 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Transaction has not been confirmed yet" in errorString)
|
||||
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# Confirm that a payment disclosure can only be generated for a shielded transaction.
|
||||
try:
|
||||
self.nodes[0].z_getpaymentdisclosure(txid, 0, 0)
|
||||
assert(False)
|
||||
except JSONRPCException as e:
|
||||
errorString = e.error['message']
|
||||
assert("Transaction is not a shielded transaction" in errorString)
|
||||
|
||||
if __name__ == '__main__':
|
||||
PaymentDisclosureTest().main()
|
||||
@@ -1,117 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2017 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#
|
||||
# Test Proton interface (provides AMQP 1.0 messaging support).
|
||||
#
|
||||
# Requirements:
|
||||
# Python library for Qpid Proton:
|
||||
# https://pypi.python.org/pypi/python-qpid-proton
|
||||
# To install:
|
||||
# pip install python-qpid-proton
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, bytes_to_hex_str, \
|
||||
start_nodes
|
||||
|
||||
from proton.handlers import MessagingHandler
|
||||
from proton.reactor import Container
|
||||
|
||||
import threading
|
||||
|
||||
|
||||
class Server(MessagingHandler):
|
||||
|
||||
def __init__(self, url, limit):
|
||||
super(Server, self).__init__()
|
||||
self.url = url
|
||||
self.counter = limit
|
||||
self.blockhashes = []
|
||||
self.txids = []
|
||||
self.blockseq = -1
|
||||
self.txidseq = -1
|
||||
|
||||
def on_start(self, event):
|
||||
print "Proton listening on:", self.url
|
||||
self.container = event.container
|
||||
self.acceptor = event.container.listen(self.url)
|
||||
|
||||
def on_message(self, event):
|
||||
m = event.message
|
||||
hash = bytes_to_hex_str(m.body)
|
||||
sequence = m.properties['x-opt-sequence-number']
|
||||
if m.subject == "hashtx":
|
||||
self.txids.append(hash)
|
||||
|
||||
# Test that sequence id is incrementing
|
||||
assert(sequence == 1 + self.txidseq)
|
||||
self.txidseq = sequence
|
||||
elif m.subject == "hashblock":
|
||||
self.blockhashes.append(hash)
|
||||
|
||||
# Test that sequence id is incrementing
|
||||
assert(sequence == 1 + self.blockseq)
|
||||
self.blockseq = sequence
|
||||
|
||||
self.counter = self.counter - 1
|
||||
if self.counter == 0:
|
||||
self.container.stop()
|
||||
|
||||
|
||||
class ProtonTest (BitcoinTestFramework):
|
||||
|
||||
port = 25672
|
||||
numblocks = 10 # must be even, as two nodes generate equal number
|
||||
assert(numblocks % 2 == 0)
|
||||
|
||||
def setup_nodes(self):
|
||||
|
||||
# Launch proton server in background thread
|
||||
# It terminates after receiving numblocks * 2 messages (one for coinbase, one for block)
|
||||
self.server = Server("127.0.0.1:%i" % self.port, self.numblocks * 2)
|
||||
self.container = Container(self.server)
|
||||
self.t1 = threading.Thread(target=self.container.run)
|
||||
self.t1.start()
|
||||
|
||||
return start_nodes(4, self.options.tmpdir, extra_args=[
|
||||
['-experimentalfeatures', '-debug=amqp', '-amqppubhashtx=amqp://127.0.0.1:'+str(self.port),
|
||||
'-amqppubhashblock=amqp://127.0.0.1:'+str(self.port)],
|
||||
[],
|
||||
[],
|
||||
[]
|
||||
])
|
||||
|
||||
def run_test(self):
|
||||
self.sync_all()
|
||||
baseheight = self.nodes[0].getblockcount() # 200 blocks already mined
|
||||
|
||||
# generate some blocks
|
||||
self.nodes[0].generate(self.numblocks/2)
|
||||
self.sync_all()
|
||||
self.nodes[1].generate(self.numblocks/2)
|
||||
self.sync_all()
|
||||
|
||||
# wait for server to finish
|
||||
self.t1.join()
|
||||
|
||||
# sequence numbers have already been checked in the server's message handler
|
||||
|
||||
# sanity check that we have the right number of block hashes and coinbase txids
|
||||
assert_equal(len(self.server.blockhashes), self.numblocks)
|
||||
assert_equal(len(self.server.txids), self.numblocks)
|
||||
|
||||
# verify that each block has the correct coinbase txid
|
||||
for i in xrange(0, self.numblocks):
|
||||
height = baseheight + i + 1
|
||||
blockhash = self.nodes[0].getblockhash(height)
|
||||
assert_equal(blockhash, self.server.blockhashes[i])
|
||||
resp = self.nodes[0].getblock(blockhash)
|
||||
coinbase = resp["tx"][0]
|
||||
assert_equal(coinbase, self.server.txids[i])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ProtonTest().main()
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2019-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
@@ -18,7 +19,7 @@ class RegtestSignrawtransactionTest (BitcoinTestFramework):
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
taddr = self.nodes[1].getnewaddress()
|
||||
zaddr1 = self.nodes[1].z_getnewaddress('sprout')
|
||||
zaddr1 = self.nodes[1].z_getnewaddress('sapling')
|
||||
|
||||
self.nodes[0].sendtoaddress(taddr, 2.0)
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
@@ -60,6 +60,14 @@ def sync_blocks(rpc_connections, wait=1):
|
||||
break
|
||||
time.sleep(wait)
|
||||
|
||||
# Now that the block counts are in sync, wait for the internal
|
||||
# notifications to finish
|
||||
while True:
|
||||
notified = [ x.getblockchaininfo()['fullyNotified'] for x in rpc_connections ]
|
||||
if notified == [ True ] * len(notified):
|
||||
break
|
||||
time.sleep(wait)
|
||||
|
||||
def sync_mempools(rpc_connections, wait=1):
|
||||
"""
|
||||
Wait until everybody has the same transactions in their memory
|
||||
|
||||
@@ -31,6 +31,7 @@ class WalletTest (BitcoinTestFramework):
|
||||
print "Mining blocks..."
|
||||
|
||||
self.nodes[0].generate(4)
|
||||
self.sync_all()
|
||||
|
||||
walletinfo = self.nodes[0].getwalletinfo()
|
||||
assert_equal(walletinfo['immature_balance'], 40)
|
||||
|
||||
@@ -45,6 +45,7 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
|
||||
|
||||
self.nodes[0].setmocktime(starttime)
|
||||
self.nodes[0].generate(101)
|
||||
self.sync_all()
|
||||
|
||||
mytaddr = self.nodes[0].getnewaddress() # where coins were mined
|
||||
myzaddr = self.nodes[0].z_getnewaddress()
|
||||
@@ -63,6 +64,7 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
|
||||
self.nodes[0].generate(1)
|
||||
self.nodes[0].setmocktime(starttime + 9000)
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# Confirm the balance on node 0.
|
||||
resp = self.nodes[0].z_getbalance(myzaddr)
|
||||
|
||||
@@ -27,6 +27,7 @@ class WalletAnchorForkTest (BitcoinTestFramework):
|
||||
def run_test (self):
|
||||
print "Mining blocks..."
|
||||
self.nodes[0].generate(4)
|
||||
self.sync_all()
|
||||
|
||||
walletinfo = self.nodes[0].getwalletinfo()
|
||||
assert_equal(walletinfo['immature_balance'], 40)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2019-2020 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
@@ -20,89 +21,9 @@ class WalletListNotes(BitcoinTestFramework):
|
||||
def run_test(self):
|
||||
# Current height = 200 -> Sprout
|
||||
assert_equal(200, self.nodes[0].getblockcount())
|
||||
sproutzaddr = self.nodes[0].z_getnewaddress('sprout')
|
||||
|
||||
# test that we can create a sapling zaddr before sapling activates
|
||||
saplingzaddr = self.nodes[0].z_getnewaddress('sapling')
|
||||
|
||||
# we've got lots of coinbase (taddr) but no shielded funds yet
|
||||
assert_equal(0, Decimal(self.nodes[0].z_gettotalbalance()['private']))
|
||||
|
||||
# Set current height to 201 -> Sprout
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
assert_equal(201, self.nodes[0].getblockcount())
|
||||
|
||||
mining_addr = self.nodes[0].listunspent()[0]['address']
|
||||
|
||||
# Shield coinbase funds (must be a multiple of 10, no change allowed pre-sapling)
|
||||
receive_amount_10 = Decimal('10.0') - Decimal('0.0001')
|
||||
recipients = [{"address":sproutzaddr, "amount":receive_amount_10}]
|
||||
myopid = self.nodes[0].z_sendmany(mining_addr, recipients)
|
||||
txid_1 = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
self.sync_all()
|
||||
|
||||
# No funds (with (default) one or more confirmations) in sproutzaddr yet
|
||||
assert_equal(0, len(self.nodes[0].z_listunspent()))
|
||||
assert_equal(0, len(self.nodes[0].z_listunspent(1)))
|
||||
|
||||
# no private balance because no confirmations yet
|
||||
assert_equal(0, Decimal(self.nodes[0].z_gettotalbalance()['private']))
|
||||
|
||||
# list private unspent, this time allowing 0 confirmations
|
||||
unspent_cb = self.nodes[0].z_listunspent(0)
|
||||
assert_equal(1, len(unspent_cb))
|
||||
assert_equal(False, unspent_cb[0]['change'])
|
||||
assert_equal(txid_1, unspent_cb[0]['txid'])
|
||||
assert_equal(True, unspent_cb[0]['spendable'])
|
||||
assert_equal(sproutzaddr, unspent_cb[0]['address'])
|
||||
assert_equal(receive_amount_10, unspent_cb[0]['amount'])
|
||||
|
||||
# list unspent, filtering by address, should produce same result
|
||||
unspent_cb_filter = self.nodes[0].z_listunspent(0, 9999, False, [sproutzaddr])
|
||||
assert_equal(unspent_cb, unspent_cb_filter)
|
||||
|
||||
# Generate a block to confirm shield coinbase tx
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# Current height = 202 -> Overwinter. Default address type remains Sprout
|
||||
assert_equal(202, self.nodes[0].getblockcount())
|
||||
|
||||
# Send 1.0 (actually 0.9999) from sproutzaddr to a new zaddr
|
||||
sproutzaddr2 = self.nodes[0].z_getnewaddress()
|
||||
receive_amount_1 = Decimal('1.0') - Decimal('0.0001')
|
||||
change_amount_9 = receive_amount_10 - Decimal('1.0')
|
||||
assert_equal('sprout', self.nodes[0].z_validateaddress(sproutzaddr2)['type'])
|
||||
recipients = [{"address": sproutzaddr2, "amount":receive_amount_1}]
|
||||
myopid = self.nodes[0].z_sendmany(sproutzaddr, recipients)
|
||||
txid_2 = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
self.sync_all()
|
||||
|
||||
# list unspent, allowing 0conf txs
|
||||
unspent_tx = self.nodes[0].z_listunspent(0)
|
||||
assert_equal(len(unspent_tx), 2)
|
||||
# sort low-to-high by amount (order of returned entries is not guaranteed)
|
||||
unspent_tx = sorted(unspent_tx, key=lambda k: k['amount'])
|
||||
assert_equal(False, unspent_tx[0]['change'])
|
||||
assert_equal(txid_2, unspent_tx[0]['txid'])
|
||||
assert_equal(True, unspent_tx[0]['spendable'])
|
||||
assert_equal(sproutzaddr2, unspent_tx[0]['address'])
|
||||
assert_equal(receive_amount_1, unspent_tx[0]['amount'])
|
||||
|
||||
assert_equal(True, unspent_tx[1]['change'])
|
||||
assert_equal(txid_2, unspent_tx[1]['txid'])
|
||||
assert_equal(True, unspent_tx[1]['spendable'])
|
||||
assert_equal(sproutzaddr, unspent_tx[1]['address'])
|
||||
assert_equal(change_amount_9, unspent_tx[1]['amount'])
|
||||
|
||||
unspent_tx_filter = self.nodes[0].z_listunspent(0, 9999, False, [sproutzaddr2])
|
||||
assert_equal(1, len(unspent_tx_filter))
|
||||
assert_equal(unspent_tx[0], unspent_tx_filter[0])
|
||||
|
||||
unspent_tx_filter = self.nodes[0].z_listunspent(0, 9999, False, [sproutzaddr])
|
||||
assert_equal(1, len(unspent_tx_filter))
|
||||
assert_equal(unspent_tx[1], unspent_tx_filter[0])
|
||||
|
||||
# Set current height to 204 -> Sapling
|
||||
self.nodes[0].generate(2)
|
||||
|
||||
@@ -44,6 +44,7 @@ class WalletShieldCoinbaseTest (BitcoinTestFramework):
|
||||
print "Mining blocks..."
|
||||
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
do_not_shield_taddr = self.nodes[0].getnewaddress()
|
||||
|
||||
self.nodes[0].generate(4)
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
#
|
||||
# Test joinsplit semantics
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, start_node, \
|
||||
gather_inputs
|
||||
|
||||
|
||||
class JoinSplitTest(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
self.is_network_split = False
|
||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
||||
|
||||
def run_test(self):
|
||||
zckeypair = self.nodes[0].zcrawkeygen()
|
||||
zcsecretkey = zckeypair["zcsecretkey"]
|
||||
zcaddress = zckeypair["zcaddress"]
|
||||
|
||||
(total_in, inputs) = gather_inputs(self.nodes[0], 40)
|
||||
protect_tx = self.nodes[0].createrawtransaction(inputs, {})
|
||||
joinsplit_result = self.nodes[0].zcrawjoinsplit(protect_tx, {}, {zcaddress:39.99}, 39.99, 0)
|
||||
|
||||
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, joinsplit_result["encryptednote1"])
|
||||
assert_equal(receive_result["exists"], False)
|
||||
|
||||
protect_tx = self.nodes[0].signrawtransaction(joinsplit_result["rawtxn"])
|
||||
self.nodes[0].sendrawtransaction(protect_tx["hex"])
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, joinsplit_result["encryptednote1"])
|
||||
assert_equal(receive_result["exists"], True)
|
||||
|
||||
# The pure joinsplit we create should be mined in the next block
|
||||
# despite other transactions being in the mempool.
|
||||
addrtest = self.nodes[0].getnewaddress()
|
||||
for xx in range(0,10):
|
||||
self.nodes[0].generate(1)
|
||||
for x in range(0,50):
|
||||
self.nodes[0].sendtoaddress(addrtest, 0.01);
|
||||
|
||||
joinsplit_tx = self.nodes[0].createrawtransaction([], {})
|
||||
joinsplit_result = self.nodes[0].zcrawjoinsplit(joinsplit_tx, {receive_result["note"] : zcsecretkey}, {zcaddress: 39.98}, 0, 0.01)
|
||||
|
||||
self.nodes[0].sendrawtransaction(joinsplit_result["rawtxn"])
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
print "Done!"
|
||||
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, joinsplit_result["encryptednote1"])
|
||||
assert_equal(receive_result["exists"], True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
JoinSplitTest().main()
|
||||
@@ -1,182 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
#
|
||||
# Tests a joinsplit double-spend and a subsequent reorg.
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
from test_framework.util import assert_equal, connect_nodes, \
|
||||
gather_inputs, sync_blocks
|
||||
|
||||
import time
|
||||
|
||||
class JoinSplitTest(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
# Start with split network:
|
||||
return super(JoinSplitTest, self).setup_network(True)
|
||||
|
||||
def txid_in_mempool(self, node, txid):
|
||||
exception_triggered = False
|
||||
|
||||
try:
|
||||
node.getrawtransaction(txid)
|
||||
except JSONRPCException:
|
||||
exception_triggered = True
|
||||
|
||||
return not exception_triggered
|
||||
|
||||
def cannot_joinsplit(self, node, txn):
|
||||
exception_triggered = False
|
||||
|
||||
try:
|
||||
node.sendrawtransaction(txn)
|
||||
except JSONRPCException:
|
||||
exception_triggered = True
|
||||
|
||||
return exception_triggered
|
||||
|
||||
def expect_cannot_joinsplit(self, node, txn):
|
||||
assert_equal(self.cannot_joinsplit(node, txn), True)
|
||||
|
||||
def run_test(self):
|
||||
# All nodes should start with 250 HUSH:
|
||||
starting_balance = 250
|
||||
for i in range(4):
|
||||
assert_equal(self.nodes[i].getbalance(), starting_balance)
|
||||
self.nodes[i].getnewaddress("") # bug workaround, coins generated assigned to first getnewaddress!
|
||||
|
||||
# Generate zcaddress keypairs
|
||||
zckeypair = self.nodes[0].zcrawkeygen()
|
||||
zcsecretkey = zckeypair["zcsecretkey"]
|
||||
zcaddress = zckeypair["zcaddress"]
|
||||
|
||||
pool = [0, 1, 2, 3]
|
||||
for i in range(4):
|
||||
(total_in, inputs) = gather_inputs(self.nodes[i], 40)
|
||||
pool[i] = self.nodes[i].createrawtransaction(inputs, {})
|
||||
pool[i] = self.nodes[i].zcrawjoinsplit(pool[i], {}, {zcaddress:39.99}, 39.99, 0)
|
||||
signed = self.nodes[i].signrawtransaction(pool[i]["rawtxn"])
|
||||
|
||||
# send the tx to both halves of the network
|
||||
self.nodes[0].sendrawtransaction(signed["hex"])
|
||||
self.nodes[0].generate(1)
|
||||
self.nodes[2].sendrawtransaction(signed["hex"])
|
||||
self.nodes[2].generate(1)
|
||||
pool[i] = pool[i]["encryptednote1"]
|
||||
|
||||
sync_blocks(self.nodes[0:2])
|
||||
sync_blocks(self.nodes[2:4])
|
||||
|
||||
# Confirm that the protects have taken place
|
||||
for i in range(4):
|
||||
enc_note = pool[i]
|
||||
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, enc_note)
|
||||
assert_equal(receive_result["exists"], True)
|
||||
pool[i] = receive_result["note"]
|
||||
|
||||
# Extra confirmations
|
||||
receive_result = self.nodes[1].zcrawreceive(zcsecretkey, enc_note)
|
||||
assert_equal(receive_result["exists"], True)
|
||||
|
||||
receive_result = self.nodes[2].zcrawreceive(zcsecretkey, enc_note)
|
||||
assert_equal(receive_result["exists"], True)
|
||||
|
||||
receive_result = self.nodes[3].zcrawreceive(zcsecretkey, enc_note)
|
||||
assert_equal(receive_result["exists"], True)
|
||||
|
||||
blank_tx = self.nodes[0].createrawtransaction([], {})
|
||||
# Create joinsplit {A, B}->{*}
|
||||
joinsplit_AB = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[0] : zcsecretkey, pool[1] : zcsecretkey},
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# Create joinsplit {B, C}->{*}
|
||||
joinsplit_BC = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[1] : zcsecretkey, pool[2] : zcsecretkey},
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# Create joinsplit {C, D}->{*}
|
||||
joinsplit_CD = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[2] : zcsecretkey, pool[3] : zcsecretkey},
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# Create joinsplit {A, D}->{*}
|
||||
joinsplit_AD = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[0] : zcsecretkey, pool[3] : zcsecretkey},
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# (a) Node 0 will spend joinsplit AB, then attempt to
|
||||
# double-spend it with BC. It should fail before and
|
||||
# after Node 0 mines blocks.
|
||||
#
|
||||
# (b) Then, Node 2 will spend BC, and mine 5 blocks.
|
||||
# Node 1 connects, and AB will be reorg'd from the chain.
|
||||
# Any attempts to spend AB or CD should fail for
|
||||
# both nodes.
|
||||
#
|
||||
# (c) Then, Node 0 will spend AD, which should work
|
||||
# because the previous spend for A (AB) is considered
|
||||
# invalid due to the reorg.
|
||||
|
||||
# (a)
|
||||
|
||||
AB_txid = self.nodes[0].sendrawtransaction(joinsplit_AB["rawtxn"])
|
||||
|
||||
self.expect_cannot_joinsplit(self.nodes[0], joinsplit_BC["rawtxn"])
|
||||
|
||||
# Wait until node[1] receives AB before we attempt to double-spend
|
||||
# with BC.
|
||||
print "Waiting for AB_txid...\n"
|
||||
while True:
|
||||
if self.txid_in_mempool(self.nodes[1], AB_txid):
|
||||
break
|
||||
time.sleep(0.2)
|
||||
print "Done!\n"
|
||||
|
||||
self.expect_cannot_joinsplit(self.nodes[1], joinsplit_BC["rawtxn"])
|
||||
|
||||
# Generate a block
|
||||
self.nodes[0].generate(1)
|
||||
sync_blocks(self.nodes[0:2])
|
||||
|
||||
self.expect_cannot_joinsplit(self.nodes[0], joinsplit_BC["rawtxn"])
|
||||
self.expect_cannot_joinsplit(self.nodes[1], joinsplit_BC["rawtxn"])
|
||||
|
||||
# (b)
|
||||
self.nodes[2].sendrawtransaction(joinsplit_BC["rawtxn"])
|
||||
self.nodes[2].generate(5)
|
||||
|
||||
# Connect the two nodes
|
||||
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
sync_blocks(self.nodes)
|
||||
|
||||
# AB and CD should all be impossible to spend for each node.
|
||||
self.expect_cannot_joinsplit(self.nodes[0], joinsplit_AB["rawtxn"])
|
||||
self.expect_cannot_joinsplit(self.nodes[0], joinsplit_CD["rawtxn"])
|
||||
|
||||
self.expect_cannot_joinsplit(self.nodes[1], joinsplit_AB["rawtxn"])
|
||||
self.expect_cannot_joinsplit(self.nodes[1], joinsplit_CD["rawtxn"])
|
||||
|
||||
self.expect_cannot_joinsplit(self.nodes[2], joinsplit_AB["rawtxn"])
|
||||
self.expect_cannot_joinsplit(self.nodes[2], joinsplit_CD["rawtxn"])
|
||||
|
||||
self.expect_cannot_joinsplit(self.nodes[3], joinsplit_AB["rawtxn"])
|
||||
self.expect_cannot_joinsplit(self.nodes[3], joinsplit_CD["rawtxn"])
|
||||
|
||||
# (c)
|
||||
# AD should be possible to send due to the reorg that
|
||||
# tossed out AB.
|
||||
|
||||
self.nodes[0].sendrawtransaction(joinsplit_AD["rawtxn"])
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
sync_blocks(self.nodes)
|
||||
|
||||
if __name__ == '__main__':
|
||||
JoinSplitTest().main()
|
||||
@@ -37,15 +37,6 @@ class ZMQTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
print "listen..."
|
||||
msg = self.zmqSubSocket.recv_multipart()
|
||||
topic = msg[0]
|
||||
assert_equal(topic, b"hashtx")
|
||||
body = msg[1]
|
||||
nseq = msg[2]
|
||||
[nseq] # hush pyflakes
|
||||
msgSequence = struct.unpack('<I', msg[-1])[-1]
|
||||
assert_equal(msgSequence, 0) # must be sequence 0 on hashtx
|
||||
|
||||
msg = self.zmqSubSocket.recv_multipart()
|
||||
topic = msg[0]
|
||||
body = msg[1]
|
||||
@@ -55,6 +46,15 @@ class ZMQTest(BitcoinTestFramework):
|
||||
|
||||
assert_equal(genhashes[0], blkhash) #blockhash from generate must be equal to the hash received over zmq
|
||||
|
||||
msg = self.zmqSubSocket.recv_multipart()
|
||||
topic = msg[0]
|
||||
assert_equal(topic, b"hashtx")
|
||||
body = msg[1]
|
||||
nseq = msg[2]
|
||||
[nseq] # hush pyflakes
|
||||
msgSequence = struct.unpack('<I', msg[-1])[-1]
|
||||
assert_equal(msgSequence, 0) # must be sequence 0 on hashtx
|
||||
|
||||
n = 10
|
||||
genhashes = self.nodes[1].generate(n)
|
||||
self.sync_all()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# Copyright 2019-2020 The Hush developers
|
||||
|
||||
DIST_SUBDIRS = secp256k1 univalue cryptoconditions
|
||||
|
||||
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(SAN_LDFLAGS) $(HARDENED_LDFLAGS)
|
||||
@@ -27,8 +29,6 @@ BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/include
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/src
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/src/asn
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/snark
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/snark/libsnark
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
|
||||
|
||||
if TARGET_WINDOWS
|
||||
@@ -48,16 +48,12 @@ LIBBITCOIN_UTIL=libbitcoin_util.a
|
||||
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
|
||||
LIBSECP256K1=secp256k1/libsecp256k1.la
|
||||
LIBCRYPTOCONDITIONS=cryptoconditions/libcryptoconditions_core.la
|
||||
LIBSNARK=snark/libsnark.a
|
||||
LIBUNIVALUE=univalue/libunivalue.la
|
||||
LIBZCASH=libzcash.a
|
||||
|
||||
if ENABLE_ZMQ
|
||||
LIBBITCOIN_ZMQ=libbitcoin_zmq.a
|
||||
endif
|
||||
if ENABLE_PROTON
|
||||
LIBBITCOIN_PROTON=libbitcoin_proton.a
|
||||
endif
|
||||
if BUILD_BITCOIN_LIBS
|
||||
LIBZCASH_CONSENSUS=libzcashconsensus.la
|
||||
endif
|
||||
@@ -66,28 +62,13 @@ LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
||||
endif
|
||||
|
||||
$(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "
|
||||
|
||||
LIBSNARK_CXXFLAGS = $(AM_CXXFLAGS) $(PIC_FLAGS) -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 -fstack-protector-all
|
||||
LIBSNARK_CONFIG_FLAGS = CURVE=ALT_BN128 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1 NO_COMPILE_LIBGTEST=1
|
||||
if HAVE_OPENMP
|
||||
LIBSNARK_CONFIG_FLAGS += MULTICORE=1
|
||||
endif
|
||||
if TARGET_DARWIN
|
||||
LIBSNARK_CONFIG_FLAGS += PLATFORM=darwin
|
||||
endif
|
||||
|
||||
$(LIBSNARK): $(wildcard snark/src/*)
|
||||
$(AM_V_at) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"
|
||||
|
||||
libsnark-tests: $(wildcard snark/src/*)
|
||||
$(AM_V_at) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64"
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g "
|
||||
|
||||
$(LIBUNIVALUE): $(wildcard univalue/lib/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g "
|
||||
|
||||
$(LIBCRYPTOCONDITIONS): $(wildcard cryptoconditions/src/*) $(wildcard cryptoconditions/include/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g "
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -g "
|
||||
|
||||
# Make is not made aware of per-object dependencies to avoid limiting building parallelization
|
||||
# But to build the less dependent modules first, we manually select their order here:
|
||||
@@ -105,9 +86,6 @@ endif
|
||||
if ENABLE_ZMQ
|
||||
EXTRA_LIBRARIES += $(LIBBITCOIN_ZMQ)
|
||||
endif
|
||||
if ENABLE_PROTON
|
||||
EXTRA_LIBRARIES += $(LIBBITCOIN_PROTON)
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = $(LIBZCASH_CONSENSUS)
|
||||
|
||||
@@ -139,7 +117,7 @@ LIBZCASH_H = \
|
||||
zcash/Zcash.h \
|
||||
zcash/zip32.h
|
||||
|
||||
.PHONY: FORCE collate-libsnark check-symbols check-security
|
||||
.PHONY: FORCE check-symbols check-security
|
||||
# bitcoin core #
|
||||
BITCOIN_CORE_H = \
|
||||
addressindex.h \
|
||||
@@ -199,14 +177,11 @@ BITCOIN_CORE_H = \
|
||||
netbase.h \
|
||||
notaries_staked.h \
|
||||
noui.h \
|
||||
paymentdisclosure.h \
|
||||
paymentdisclosuredb.h \
|
||||
policy/fees.h \
|
||||
pow.h \
|
||||
prevector.h \
|
||||
primitives/block.h \
|
||||
primitives/transaction.h \
|
||||
primitives/nonce.h \
|
||||
protocol.h \
|
||||
pubkey.h \
|
||||
random.h \
|
||||
@@ -248,11 +223,13 @@ BITCOIN_CORE_H = \
|
||||
validationinterface.h \
|
||||
version.h \
|
||||
wallet/asyncrpcoperation_mergetoaddress.h \
|
||||
wallet/asyncrpcoperation_saplingconsolidation.h \
|
||||
wallet/asyncrpcoperation_sendmany.h \
|
||||
wallet/asyncrpcoperation_shieldcoinbase.h \
|
||||
wallet/crypter.h \
|
||||
wallet/db.h \
|
||||
wallet/rpcwallet.h \
|
||||
wallet/rpchushwallet.h \
|
||||
wallet/wallet.h \
|
||||
wallet/wallet_ismine.h \
|
||||
wallet/walletdb.h \
|
||||
@@ -319,8 +296,6 @@ libbitcoin_server_a_SOURCES = \
|
||||
notaries_staked.cpp \
|
||||
noui.cpp \
|
||||
notarisationdb.cpp \
|
||||
paymentdisclosure.cpp \
|
||||
paymentdisclosuredb.cpp \
|
||||
policy/fees.cpp \
|
||||
pow.cpp \
|
||||
rest.cpp \
|
||||
@@ -350,38 +325,27 @@ libbitcoin_zmq_a_SOURCES = \
|
||||
zmq/zmqpublishnotifier.cpp
|
||||
endif
|
||||
|
||||
if ENABLE_PROTON
|
||||
libbitcoin_proton_a_CPPFLAGS = $(BITCOIN_INCLUDES)
|
||||
libbitcoin_proton_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_proton_a_SOURCES = \
|
||||
amqp/amqpabstractnotifier.cpp \
|
||||
amqp/amqpnotificationinterface.cpp \
|
||||
amqp/amqppublishnotifier.cpp
|
||||
endif
|
||||
|
||||
# wallet: zcashd, but only linked when wallet enabled
|
||||
# wallet: komodod, but only linked when wallet enabled
|
||||
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_wallet_a_SOURCES = \
|
||||
utiltest.cpp \
|
||||
utiltest.h \
|
||||
zcbenchmarks.cpp \
|
||||
zcbenchmarks.h \
|
||||
wallet/asyncrpcoperation_mergetoaddress.cpp \
|
||||
wallet/asyncrpcoperation_saplingconsolidation.cpp \
|
||||
wallet/asyncrpcoperation_sendmany.cpp \
|
||||
wallet/asyncrpcoperation_shieldcoinbase.cpp \
|
||||
wallet/crypter.cpp \
|
||||
wallet/db.cpp \
|
||||
paymentdisclosure.cpp \
|
||||
paymentdisclosuredb.cpp \
|
||||
zcash/Note.cpp \
|
||||
transaction_builder.cpp \
|
||||
wallet/rpcdisclosure.cpp \
|
||||
wallet/rpcdump.cpp \
|
||||
cc/CCtokens.cpp \
|
||||
cc/CCassetsCore.cpp \
|
||||
cc/CCassetstx.cpp \
|
||||
cc/CCtx.cpp \
|
||||
wallet/rpcwallet.cpp \
|
||||
wallet/rpchushwallet.cpp \
|
||||
wallet/wallet.cpp \
|
||||
wallet/wallet_ismine.cpp \
|
||||
wallet/walletdb.cpp \
|
||||
@@ -450,7 +414,6 @@ libbitcoin_common_a_SOURCES = \
|
||||
metrics.cpp \
|
||||
primitives/block.cpp \
|
||||
primitives/transaction.cpp \
|
||||
primitives/nonce.cpp \
|
||||
protocol.cpp \
|
||||
pubkey.cpp \
|
||||
scheduler.cpp \
|
||||
@@ -510,7 +473,7 @@ libbitcoin_cli_a_SOURCES = \
|
||||
nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
|
||||
#
|
||||
|
||||
# bitcoind binary #
|
||||
# komodod binary #
|
||||
komodod_SOURCES = bitcoind.cpp
|
||||
komodod_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
komodod_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
@@ -526,10 +489,8 @@ komodod_LDADD = \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_ZMQ) \
|
||||
$(LIBBITCOIN_PROTON) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBZCASH) \
|
||||
$(LIBSNARK) \
|
||||
$(LIBLEVELDB) \
|
||||
$(LIBMEMENV) \
|
||||
$(LIBSECP256K1) \
|
||||
@@ -547,7 +508,6 @@ komodod_LDADD += \
|
||||
$(EVENT_PTHREADS_LIBS) \
|
||||
$(EVENT_LIBS) \
|
||||
$(ZMQ_LIBS) \
|
||||
$(PROTON_LIBS) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBZCASH_LIBS)
|
||||
|
||||
@@ -561,16 +521,12 @@ if TARGET_LINUX
|
||||
komodod_LDADD += libcc.so $(LIBSECP256K1)
|
||||
endif
|
||||
|
||||
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 binary #
|
||||
komodo_cli_SOURCES = bitcoin-cli.cpp
|
||||
komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
|
||||
komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
@@ -614,12 +570,11 @@ wallet_utility_LDADD = \
|
||||
$(BDB_LIBS) \
|
||||
$(CRYPTO_LIBS) \
|
||||
$(LIBZCASH) \
|
||||
$(LIBSNARK) \
|
||||
$(LIBZCASH_LIBS)\
|
||||
$(LIBCRYPTOCONDITIONS)
|
||||
endif
|
||||
|
||||
# zcash-tx binary #
|
||||
# komodo-tx binary #
|
||||
komodo_tx_SOURCES = komodo-tx.cpp
|
||||
komodo_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
komodo_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
@@ -629,20 +584,17 @@ if TARGET_WINDOWS
|
||||
komodo_tx_SOURCES += bitcoin-tx-res.rc
|
||||
endif
|
||||
|
||||
# FIXME: Is libzcash needed for hush-tx ?
|
||||
komodo_tx_LDADD = \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBSECP256K1) \
|
||||
$(LIBZCASH) \
|
||||
$(LIBSNARK) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBZCASH_LIBS) \
|
||||
$(LIBCRYPTOCONDITIONS)
|
||||
|
||||
komodo_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
|
||||
#
|
||||
|
||||
# zcash protocol primitives #
|
||||
libzcash_a_SOURCES = \
|
||||
@@ -654,15 +606,9 @@ libzcash_a_SOURCES = \
|
||||
zcash/Note.cpp \
|
||||
zcash/prf.cpp \
|
||||
zcash/util.cpp \
|
||||
zcash/zip32.cpp \
|
||||
zcash/circuit/commitment.tcc \
|
||||
zcash/circuit/gadget.tcc \
|
||||
zcash/circuit/merkle.tcc \
|
||||
zcash/circuit/note.tcc \
|
||||
zcash/circuit/prfs.tcc \
|
||||
zcash/circuit/utils.tcc
|
||||
zcash/zip32.cpp
|
||||
|
||||
libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) $(HARDENED_CXXFLAGS) $(HARDENED_LDFLAGS) -pipe $(SAN_LDFLAGS) -O1 -g -Wstack-protector $(SAN_CXXFLAGS) -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)
|
||||
libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) $(HARDENED_CXXFLAGS) $(HARDENED_LDFLAGS) -pipe $(SAN_LDFLAGS) -O1 -g -Wstack-protector $(SAN_CXXFLAGS) -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES)
|
||||
|
||||
#libzcash_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
#libzcash_a_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
@@ -684,7 +630,6 @@ libzcashconsensus_la_SOURCES = \
|
||||
crypto/sha512.cpp \
|
||||
hash.cpp \
|
||||
primitives/transaction.cpp \
|
||||
primitives/nonce.cpp \
|
||||
pubkey.cpp \
|
||||
script/zcashconsensus.cpp \
|
||||
script/interpreter.cpp \
|
||||
@@ -708,12 +653,11 @@ CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno */*.gcno wal
|
||||
|
||||
DISTCLEANFILES = obj/build.h
|
||||
|
||||
EXTRA_DIST = leveldb snark
|
||||
EXTRA_DIST = leveldb
|
||||
|
||||
clean-local:
|
||||
-$(MAKE) -C leveldb clean
|
||||
-$(MAKE) -C secp256k1 clean
|
||||
-$(MAKE) -C snark clean
|
||||
-$(MAKE) -C univalue clean
|
||||
rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno
|
||||
-rm -f config.h
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
# Copyright (c) 2019-2020 Hush developers
|
||||
# Released under the GPLv3
|
||||
TESTS += komodo-gtest
|
||||
bin_PROGRAMS += komodo-gtest
|
||||
|
||||
@@ -9,7 +10,6 @@ komodo_gtest_SOURCES = \
|
||||
gtest/test_checktransaction.cpp \
|
||||
gtest/json_test_vectors.cpp \
|
||||
gtest/json_test_vectors.h \
|
||||
# gtest/test_foundersreward.cpp \
|
||||
gtest/test_wallet_zkeys.cpp \
|
||||
# These tests are order-dependent, because they
|
||||
# depend on global state (see #1539)
|
||||
@@ -63,12 +63,7 @@ if ENABLE_WALLET
|
||||
komodo_gtest_LDADD += $(LIBBITCOIN_WALLET)
|
||||
endif
|
||||
|
||||
komodo_gtest_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(LIBZCASH) $(LIBSNARK) $(LIBZCASH_LIBS)
|
||||
|
||||
if ENABLE_PROTON
|
||||
komodo_gtest_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS)
|
||||
endif
|
||||
|
||||
komodo_gtest_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS)
|
||||
|
||||
komodo_gtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||
|
||||
|
||||
@@ -123,17 +123,13 @@ test_test_bitcoin_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_C
|
||||
$(LIBLEVELDB) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
|
||||
test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
|
||||
test_test_bitcoin_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(LIBZCASH) $(LIBSNARK) $(LIBZCASH_LIBS)
|
||||
test_test_bitcoin_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS)
|
||||
test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||
|
||||
if ENABLE_ZMQ
|
||||
test_test_bitcoin_LDADD += $(ZMQ_LIBS)
|
||||
endif
|
||||
|
||||
if ENABLE_PROTON
|
||||
test_test_bitcoin_LDADD += $(PROTON_LIBS)
|
||||
endif
|
||||
|
||||
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
||||
|
||||
$(BITCOIN_TESTS): $(GENERATED_TEST_FILES)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
noinst_PROGRAMS += \
|
||||
zcash/GenerateParams \
|
||||
zcash/CreateJoinSplit
|
||||
|
||||
# tool for generating our public parameters
|
||||
zcash_GenerateParams_SOURCES = zcash/GenerateParams.cpp
|
||||
zcash_GenerateParams_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
zcash_GenerateParams_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
zcash_GenerateParams_LDADD = \
|
||||
$(BOOST_LIBS) \
|
||||
$(LIBZCASH) \
|
||||
$(LIBSNARK) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBZCASH_LIBS)
|
||||
|
||||
# tool for profiling the creation of joinsplits
|
||||
zcash_CreateJoinSplit_SOURCES = zcash/CreateJoinSplit.cpp
|
||||
zcash_CreateJoinSplit_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
zcash_CreateJoinSplit_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
zcash_CreateJoinSplit_LDADD = \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBZCASH) \
|
||||
$(LIBSNARK) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(BOOST_LIBS) \
|
||||
$(LIBZCASH_LIBS) \
|
||||
$(LIBCRYPTOCONDITIONS) \
|
||||
$(LIBSECP256K1)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Copyright (c) 2012 Pieter Wuille
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -268,7 +269,7 @@ bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimeP
|
||||
|
||||
if (pinfo) {
|
||||
// periodically update nTime
|
||||
bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);
|
||||
bool fCurrentlyOnline = (GetTime() - addr.nTime < 24 * 60 * 60);
|
||||
int64_t nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60);
|
||||
if (addr.nTime && (!pinfo->nTime || pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty))
|
||||
pinfo->nTime = std::max((int64_t)0, addr.nTime - nTimePenalty);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012 Pieter Wuille
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
@@ -112,10 +113,10 @@ public:
|
||||
int GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const;
|
||||
|
||||
//! Determine whether the statistics about this entry are bad enough so that it can just be deleted
|
||||
bool IsTerrible(int64_t nNow = GetAdjustedTime()) const;
|
||||
bool IsTerrible(int64_t nNow = GetTime()) const;
|
||||
|
||||
//! Calculate the relative chance this entry should be given when selecting nodes to connect to
|
||||
double GetChance(int64_t nNow = GetAdjustedTime()) const;
|
||||
double GetChance(int64_t nNow = GetTime()) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -530,7 +531,7 @@ public:
|
||||
}
|
||||
|
||||
//! Mark an entry as accessible.
|
||||
void Good(const CService &addr, int64_t nTime = GetAdjustedTime())
|
||||
void Good(const CService &addr, int64_t nTime = GetTime())
|
||||
{
|
||||
{
|
||||
LOCK(cs);
|
||||
@@ -541,7 +542,7 @@ public:
|
||||
}
|
||||
|
||||
//! Mark an entry as connection attempted to.
|
||||
void Attempt(const CService &addr, int64_t nTime = GetAdjustedTime())
|
||||
void Attempt(const CService &addr, int64_t nTime = GetTime())
|
||||
{
|
||||
{
|
||||
LOCK(cs);
|
||||
@@ -580,7 +581,7 @@ public:
|
||||
}
|
||||
|
||||
//! Mark an entry as currently-connected-to.
|
||||
void Connected(const CService &addr, int64_t nTime = GetAdjustedTime())
|
||||
void Connected(const CService &addr, int64_t nTime = GetTime())
|
||||
{
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
@@ -117,7 +118,7 @@ uint256 CAlert::GetHash() const
|
||||
|
||||
bool CAlert::IsInEffect() const
|
||||
{
|
||||
return (GetAdjustedTime() < nExpiration);
|
||||
return (GetTime() < nExpiration);
|
||||
}
|
||||
|
||||
bool CAlert::Cancels(const CAlert& alert) const
|
||||
@@ -152,7 +153,7 @@ bool CAlert::RelayTo(CNode* pnode) const
|
||||
{
|
||||
if (AppliesTo(pnode->nVersion, pnode->strSubVer) ||
|
||||
AppliesToMe() ||
|
||||
GetAdjustedTime() < nRelayUntil)
|
||||
GetTime() < nRelayUntil)
|
||||
{
|
||||
pnode->PushMessage("alert", *this);
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "amqpabstractnotifier.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
AMQPAbstractNotifier::~AMQPAbstractNotifier()
|
||||
{
|
||||
}
|
||||
|
||||
bool AMQPAbstractNotifier::NotifyBlock(const CBlockIndex * /*CBlockIndex*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMQPAbstractNotifier::NotifyTransaction(const CTransaction &/*transaction*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPABSTRACTNOTIFIER_H
|
||||
#define ZCASH_AMQP_AMQPABSTRACTNOTIFIER_H
|
||||
|
||||
#include "amqpconfig.h"
|
||||
|
||||
class CBlockIndex;
|
||||
class AMQPAbstractNotifier;
|
||||
|
||||
typedef AMQPAbstractNotifier* (*AMQPNotifierFactory)();
|
||||
|
||||
class AMQPAbstractNotifier
|
||||
{
|
||||
public:
|
||||
AMQPAbstractNotifier() { }
|
||||
virtual ~AMQPAbstractNotifier();
|
||||
|
||||
template <typename T>
|
||||
static AMQPAbstractNotifier* Create()
|
||||
{
|
||||
return new T();
|
||||
}
|
||||
|
||||
std::string GetType() const { return type; }
|
||||
void SetType(const std::string &t) { type = t; }
|
||||
std::string GetAddress() const { return address; }
|
||||
void SetAddress(const std::string &a) { address = a; }
|
||||
|
||||
virtual bool Initialize() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual bool NotifyBlock(const CBlockIndex *pindex);
|
||||
virtual bool NotifyTransaction(const CTransaction &transaction);
|
||||
|
||||
protected:
|
||||
std::string type;
|
||||
std::string address;
|
||||
};
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPABSTRACTNOTIFIER_H
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPCONFIG_H
|
||||
#define ZCASH_AMQP_AMQPCONFIG_H
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
|
||||
#if ENABLE_PROTON
|
||||
#include <proton/connection.hpp>
|
||||
#include <proton/connection_options.hpp>
|
||||
#include <proton/container.hpp>
|
||||
#include <proton/default_container.hpp>
|
||||
#include <proton/message.hpp>
|
||||
#include <proton/message_id.hpp>
|
||||
#include <proton/messaging_handler.hpp>
|
||||
#include <proton/thread_safe.hpp>
|
||||
#include <proton/tracker.hpp>
|
||||
#include <proton/transport.hpp>
|
||||
#include <proton/types.hpp>
|
||||
#include <proton/url.hpp>
|
||||
#endif
|
||||
|
||||
#include "primitives/block.h"
|
||||
#include "primitives/transaction.h"
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPCONFIG_H
|
||||
@@ -1,136 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "amqpnotificationinterface.h"
|
||||
#include "amqppublishnotifier.h"
|
||||
|
||||
#include "version.h"
|
||||
#include "main.h"
|
||||
#include "streams.h"
|
||||
#include "util.h"
|
||||
|
||||
// AMQP 1.0 Support
|
||||
//
|
||||
// The boost::signals2 signals and slot system is thread safe, so CValidationInterface listeners
|
||||
// can be invoked from any thread.
|
||||
//
|
||||
// Currently signals are fired from main.cpp so the callbacks should be invoked on the same thread.
|
||||
// It should be safe to share objects responsible for sending, as they should not be run concurrently
|
||||
// across different threads.
|
||||
//
|
||||
// Developers should be mindful of where notifications are fired to avoid potential race conditions.
|
||||
// For example, different signals targeting the same address could be fired from different threads
|
||||
// in different parts of the system around the same time.
|
||||
//
|
||||
// Like the ZMQ notification interface, if a notifier fails to send a message, the notifier is shut down.
|
||||
//
|
||||
|
||||
AMQPNotificationInterface::AMQPNotificationInterface()
|
||||
{
|
||||
}
|
||||
|
||||
AMQPNotificationInterface::~AMQPNotificationInterface()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
}
|
||||
|
||||
AMQPNotificationInterface* AMQPNotificationInterface::CreateWithArguments(const std::map<std::string, std::string> &args)
|
||||
{
|
||||
AMQPNotificationInterface* notificationInterface = nullptr;
|
||||
std::map<std::string, AMQPNotifierFactory> factories;
|
||||
std::list<AMQPAbstractNotifier*> notifiers;
|
||||
|
||||
factories["pubhashblock"] = AMQPAbstractNotifier::Create<AMQPPublishHashBlockNotifier>;
|
||||
factories["pubhashtx"] = AMQPAbstractNotifier::Create<AMQPPublishHashTransactionNotifier>;
|
||||
factories["pubrawblock"] = AMQPAbstractNotifier::Create<AMQPPublishRawBlockNotifier>;
|
||||
factories["pubrawtx"] = AMQPAbstractNotifier::Create<AMQPPublishRawTransactionNotifier>;
|
||||
|
||||
for (std::map<std::string, AMQPNotifierFactory>::const_iterator i=factories.begin(); i!=factories.end(); ++i) {
|
||||
std::map<std::string, std::string>::const_iterator j = args.find("-amqp" + i->first);
|
||||
if (j!=args.end()) {
|
||||
AMQPNotifierFactory factory = i->second;
|
||||
std::string address = j->second;
|
||||
AMQPAbstractNotifier *notifier = factory();
|
||||
notifier->SetType(i->first);
|
||||
notifier->SetAddress(address);
|
||||
notifiers.push_back(notifier);
|
||||
}
|
||||
}
|
||||
|
||||
if (!notifiers.empty()) {
|
||||
notificationInterface = new AMQPNotificationInterface();
|
||||
notificationInterface->notifiers = notifiers;
|
||||
|
||||
if (!notificationInterface->Initialize()) {
|
||||
delete notificationInterface;
|
||||
notificationInterface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return notificationInterface;
|
||||
}
|
||||
|
||||
// Called at startup to conditionally set up
|
||||
bool AMQPNotificationInterface::Initialize()
|
||||
{
|
||||
LogPrint("amqp", "amqp: Initialize notification interface\n");
|
||||
|
||||
std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin();
|
||||
for (; i != notifiers.end(); ++i) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
if (notifier->Initialize()) {
|
||||
LogPrint("amqp", "amqp: Notifier %s ready (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
||||
} else {
|
||||
LogPrint("amqp", "amqp: Notifier %s failed (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != notifiers.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Called during shutdown sequence
|
||||
void AMQPNotificationInterface::Shutdown()
|
||||
{
|
||||
LogPrint("amqp", "amqp: Shutdown notification interface\n");
|
||||
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ++i) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
notifier->Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
void AMQPNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindex)
|
||||
{
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
if (notifier->NotifyBlock(pindex)) {
|
||||
i++;
|
||||
} else {
|
||||
notifier->Shutdown();
|
||||
i = notifiers.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AMQPNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
|
||||
{
|
||||
for (std::list<AMQPAbstractNotifier*>::iterator i = notifiers.begin(); i != notifiers.end(); ) {
|
||||
AMQPAbstractNotifier *notifier = *i;
|
||||
if (notifier->NotifyTransaction(tx)) {
|
||||
i++;
|
||||
} else {
|
||||
notifier->Shutdown();
|
||||
i = notifiers.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPNOTIFICATIONINTERFACE_H
|
||||
#define ZCASH_AMQP_AMQPNOTIFICATIONINTERFACE_H
|
||||
|
||||
#include "validationinterface.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class CBlockIndex;
|
||||
class AMQPAbstractNotifier;
|
||||
|
||||
class AMQPNotificationInterface : public CValidationInterface
|
||||
{
|
||||
public:
|
||||
virtual ~AMQPNotificationInterface();
|
||||
|
||||
static AMQPNotificationInterface* CreateWithArguments(const std::map<std::string, std::string> &args);
|
||||
|
||||
protected:
|
||||
bool Initialize();
|
||||
void Shutdown();
|
||||
|
||||
// CValidationInterface
|
||||
void SyncTransaction(const CTransaction &tx, const CBlock *pblock);
|
||||
void UpdatedBlockTip(const CBlockIndex *pindex);
|
||||
|
||||
private:
|
||||
AMQPNotificationInterface();
|
||||
|
||||
std::list<AMQPAbstractNotifier*> notifiers;
|
||||
};
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPNOTIFICATIONINTERFACE_H
|
||||
@@ -1,177 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "amqppublishnotifier.h"
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "amqpsender.h"
|
||||
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
static std::multimap<std::string, AMQPAbstractPublishNotifier*> mapPublishNotifiers;
|
||||
|
||||
static const char *MSG_HASHBLOCK = "hashblock";
|
||||
static const char *MSG_HASHTX = "hashtx";
|
||||
static const char *MSG_RAWBLOCK = "rawblock";
|
||||
static const char *MSG_RAWTX = "rawtx";
|
||||
|
||||
// Invoke this method from a new thread to run the proton container event loop.
|
||||
void AMQPAbstractPublishNotifier::SpawnProtonContainer()
|
||||
{
|
||||
try {
|
||||
proton::default_container(*handler_).run();
|
||||
}
|
||||
catch (const proton::error_condition &e) {
|
||||
LogPrint("amqp", "amqp: container error: %s\n", e.what());
|
||||
}
|
||||
catch (const std::runtime_error &e) {
|
||||
LogPrint("amqp", "amqp: runtime error: %s\n", e.what());
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
LogPrint("amqp", "amqp: exception: %s\n", e.what());
|
||||
}
|
||||
catch (...) {
|
||||
LogPrint("amqp", "amqp: unknown error\n");
|
||||
}
|
||||
handler_->terminate();
|
||||
}
|
||||
|
||||
bool AMQPAbstractPublishNotifier::Initialize()
|
||||
{
|
||||
std::multimap<std::string, AMQPAbstractPublishNotifier*>::iterator i = mapPublishNotifiers.find(address);
|
||||
|
||||
if (i == mapPublishNotifiers.end()) {
|
||||
try {
|
||||
handler_ = std::make_shared<AMQPSender>(address);
|
||||
thread_ = std::make_shared<std::thread>(&AMQPAbstractPublishNotifier::SpawnProtonContainer, this);
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
LogPrint("amqp", "amqp: initialization error: %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
mapPublishNotifiers.insert(std::make_pair(address, this));
|
||||
} else {
|
||||
// copy the shared ptrs to the message handler and the thread where the proton container is running
|
||||
handler_ = i->second->handler_;
|
||||
thread_ = i->second->thread_;
|
||||
mapPublishNotifiers.insert(std::make_pair(address, this));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void AMQPAbstractPublishNotifier::Shutdown()
|
||||
{
|
||||
LogPrint("amqp", "amqp: Shutdown notifier %s at %s\n", GetType(), GetAddress());
|
||||
|
||||
int count = mapPublishNotifiers.count(address);
|
||||
|
||||
// remove this notifier from the list of publishers using this address
|
||||
typedef std::multimap<std::string, AMQPAbstractPublishNotifier*>::iterator iterator;
|
||||
std::pair<iterator, iterator> iterpair = mapPublishNotifiers.equal_range(address);
|
||||
|
||||
for (iterator it = iterpair.first; it != iterpair.second; ++it) {
|
||||
if (it->second == this) {
|
||||
mapPublishNotifiers.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// terminate the connection if this is the last publisher using this address
|
||||
if (count == 1) {
|
||||
handler_->terminate();
|
||||
if (thread_.get() != nullptr) {
|
||||
if (thread_->joinable()) {
|
||||
thread_->join();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool AMQPAbstractPublishNotifier::SendMessage(const char *command, const void* data, size_t size)
|
||||
{
|
||||
try {
|
||||
proton::binary content;
|
||||
const char *p = (const char *)data;
|
||||
content.assign(p, p + size);
|
||||
|
||||
proton::message message(content);
|
||||
message.subject(std::string(command));
|
||||
proton::message::property_map & props = message.properties();
|
||||
props.put("x-opt-sequence-number", sequence_);
|
||||
handler_->publish(message);
|
||||
|
||||
} catch (proton::error_condition &e) {
|
||||
LogPrint("amqp", "amqp: error : %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
catch (const std::runtime_error &e) {
|
||||
LogPrint("amqp", "amqp: runtime error: %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
LogPrint("amqp", "amqp: exception: %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
catch (...) {
|
||||
LogPrint("amqp", "amqp: unknown error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
sequence_++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMQPPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||
{
|
||||
uint256 hash = pindex->GetBlockHash();
|
||||
LogPrint("amqp", "amqp: Publish hashblock %s\n", hash.GetHex());
|
||||
char data[32];
|
||||
for (unsigned int i = 0; i < 32; i++)
|
||||
data[31 - i] = hash.begin()[i];
|
||||
return SendMessage(MSG_HASHBLOCK, data, 32);
|
||||
}
|
||||
|
||||
bool AMQPPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
||||
{
|
||||
uint256 hash = transaction.GetHash();
|
||||
LogPrint("amqp", "amqp: Publish hashtx %s\n", hash.GetHex());
|
||||
char data[32];
|
||||
for (unsigned int i = 0; i < 32; i++)
|
||||
data[31 - i] = hash.begin()[i];
|
||||
return SendMessage(MSG_HASHTX, data, 32);
|
||||
}
|
||||
|
||||
bool AMQPPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||
{
|
||||
LogPrint("amqp", "amqp: Publish rawblock %s\n", pindex->GetBlockHash().GetHex());
|
||||
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
{
|
||||
LOCK(cs_main);
|
||||
CBlock block;
|
||||
if(!ReadBlockFromDisk(block, pindex)) {
|
||||
LogPrint("amqp", "amqp: Can't read block from disk");
|
||||
return false;
|
||||
}
|
||||
|
||||
ss << block;
|
||||
}
|
||||
|
||||
return SendMessage(MSG_RAWBLOCK, &(*ss.begin()), ss.size());
|
||||
}
|
||||
|
||||
bool AMQPPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
||||
{
|
||||
uint256 hash = transaction.GetHash();
|
||||
LogPrint("amqp", "amqp: Publish rawtx %s\n", hash.GetHex());
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ss << transaction;
|
||||
return SendMessage(MSG_RAWTX, &(*ss.begin()), ss.size());
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPPUBLISHNOTIFIER_H
|
||||
#define ZCASH_AMQP_AMQPPUBLISHNOTIFIER_H
|
||||
|
||||
#include "amqpabstractnotifier.h"
|
||||
#include "amqpconfig.h"
|
||||
#include "amqpsender.h"
|
||||
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
class CBlockIndex;
|
||||
|
||||
class AMQPAbstractPublishNotifier : public AMQPAbstractNotifier
|
||||
{
|
||||
private:
|
||||
uint64_t sequence_; // memory only, per notifier instance: upcounting message sequence number
|
||||
|
||||
std::shared_ptr<std::thread> thread_; // proton container thread, may be shared between notifiers
|
||||
std::shared_ptr<AMQPSender> handler_; // proton container message handler, may be shared between notifiers
|
||||
|
||||
public:
|
||||
bool SendMessage(const char *command, const void* data, size_t size);
|
||||
bool Initialize();
|
||||
void Shutdown();
|
||||
void SpawnProtonContainer();
|
||||
};
|
||||
|
||||
class AMQPPublishHashBlockNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyBlock(const CBlockIndex *pindex);
|
||||
};
|
||||
|
||||
class AMQPPublishHashTransactionNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyTransaction(const CTransaction &transaction);
|
||||
};
|
||||
|
||||
class AMQPPublishRawBlockNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyBlock(const CBlockIndex *pindex);
|
||||
};
|
||||
|
||||
class AMQPPublishRawTransactionNotifier : public AMQPAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyTransaction(const CTransaction &transaction);
|
||||
};
|
||||
|
||||
#endif // ZCASH_AMQP_AMQPPUBLISHNOTIFIER_H
|
||||
@@ -1,115 +0,0 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef ZCASH_AMQP_AMQPSENDER_H
|
||||
#define ZCASH_AMQP_AMQPSENDER_H
|
||||
|
||||
#include "amqpconfig.h"
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
|
||||
class AMQPSender : public proton::messaging_handler {
|
||||
private:
|
||||
std::deque<proton::message> messages_;
|
||||
proton::url url_;
|
||||
proton::connection conn_;
|
||||
proton::sender sender_;
|
||||
std::mutex lock_;
|
||||
std::atomic<bool> terminated_ = {false};
|
||||
|
||||
public:
|
||||
|
||||
AMQPSender(const std::string& url) : url_(url) {}
|
||||
|
||||
// Callback to initialize the container when run() is invoked
|
||||
void on_container_start(proton::container& c) override {
|
||||
proton::duration t(10000); // milliseconds
|
||||
proton::connection_options opts = proton::connection_options().idle_timeout(t);
|
||||
conn_ = c.connect(url_, opts);
|
||||
sender_ = conn_.open_sender(url_.path());
|
||||
}
|
||||
|
||||
// Remote end signals when the local end can send (i.e. has credit)
|
||||
void on_sendable(proton::sender &s) override {
|
||||
dispatch();
|
||||
}
|
||||
|
||||
// Publish message by adding to queue and trying to dispatch it
|
||||
void publish(const proton::message &m) {
|
||||
add_message(m);
|
||||
dispatch();
|
||||
}
|
||||
|
||||
// Add message to queue
|
||||
void add_message(const proton::message &m) {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
messages_.push_back(m);
|
||||
}
|
||||
|
||||
// Send messages in queue
|
||||
void dispatch() {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
|
||||
if (isTerminated()) {
|
||||
throw std::runtime_error("amqp connection was terminated");
|
||||
}
|
||||
|
||||
if (!conn_.active()) {
|
||||
throw std::runtime_error("amqp connection is not active");
|
||||
}
|
||||
|
||||
while (messages_.size() > 0) {
|
||||
if (sender_.credit()) {
|
||||
const proton::message& m = messages_.front();
|
||||
sender_.send(m);
|
||||
messages_.pop_front();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close connection to remote end. Container event-loop, by default, will auto-stop.
|
||||
void terminate() {
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
conn_.close();
|
||||
terminated_.store(true);
|
||||
}
|
||||
|
||||
bool isTerminated() const {
|
||||
return terminated_.load();
|
||||
}
|
||||
|
||||
void on_transport_error(proton::transport &t) override {
|
||||
t.connection().close();
|
||||
throw t.error();
|
||||
}
|
||||
|
||||
void on_connection_error(proton::connection &c) override {
|
||||
c.close();
|
||||
throw c.error();
|
||||
}
|
||||
|
||||
void on_session_error(proton::session &s) override {
|
||||
s.connection().close();
|
||||
throw s.error();
|
||||
}
|
||||
|
||||
void on_receiver_error(proton::receiver &r) override {
|
||||
r.connection().close();
|
||||
throw r.error();
|
||||
}
|
||||
|
||||
void on_sender_error(proton::sender &s) override {
|
||||
s.connection().close();
|
||||
throw s.error();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //ZCASH_AMQP_AMQPSENDER_H
|
||||
@@ -193,9 +193,10 @@ unsigned int base_uint<BITS>::bits() const
|
||||
{
|
||||
for (int pos = WIDTH - 1; pos >= 0; pos--) {
|
||||
if (pn[pos]) {
|
||||
for (int bits = 31; bits > 0; bits--) {
|
||||
if (pn[pos] & 1 << bits)
|
||||
for (size_t bits = 31; bits > 0; bits--) {
|
||||
if (pn[pos] & (1U << bits)) {
|
||||
return 32 * pos + bits + 1;
|
||||
}
|
||||
}
|
||||
return 32 * pos + 1;
|
||||
}
|
||||
|
||||
5
src/cc/Makefile_custom
Executable file → Normal file
5
src/cc/Makefile_custom
Executable file → Normal file
@@ -2,6 +2,7 @@ SHELL = /bin/sh
|
||||
CC = gcc
|
||||
CC_DARWIN = g++-8
|
||||
CC_WIN = x86_64-w64-mingw32-gcc-posix
|
||||
CC_AARCH64 = aarch64-linux-gnu-g++
|
||||
CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -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. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
|
||||
CFLAGS = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -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. -fPIC -shared
|
||||
CFLAGS_WIN = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/x86_64-w64-mingw32/include -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
|
||||
@@ -28,6 +29,10 @@ else ifeq ($(HOST),x86_64-w64-mingw32)
|
||||
$(CC_WIN) $(CFLAGS_WIN) $(DEBUGFLAGS) -o $(TARGET_WIN) -c $(SOURCES)
|
||||
cp $(TARGET_WIN) ../libcc.dll
|
||||
#else ifeq ($(WIN_HOST),True) - todo: pass ENV var from build.sh if WIN host
|
||||
else ifeq ($(HOST),aarch64-linux-gnu)
|
||||
$(info LINUX ARM 64bit )
|
||||
$(CC_AARCH64) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) -c $(SOURCES)
|
||||
cp $(TARGET) ../libcc.so
|
||||
else
|
||||
$(info LINUX)
|
||||
$(CC) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) -c $(SOURCES)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright © 2019-2020 The Hush Developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# Copyright 2020 The Hush Developers
|
||||
# just type make to compile all dapps
|
||||
all: zmigrate oraclefeed
|
||||
|
||||
subatomic:
|
||||
$(CC) subatomic.c -o subatomic -lm
|
||||
|
||||
zmigrate:
|
||||
$(CC) zmigrate.c -o zmigrate -lm
|
||||
|
||||
@@ -9,3 +13,4 @@ oraclefeed:
|
||||
|
||||
clean:
|
||||
rm zmigrate oraclefeed
|
||||
|
||||
|
||||
1599
src/cc/dapps/dappinc.h
Normal file
1599
src/cc/dapps/dappinc.h
Normal file
File diff suppressed because it is too large
Load Diff
1429
src/cc/dapps/subatomic.c
Normal file
1429
src/cc/dapps/subatomic.c
Normal file
File diff suppressed because it is too large
Load Diff
27
src/cc/dapps/subatomic.json
Normal file
27
src/cc/dapps/subatomic.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"authorized": [
|
||||
{"chmex":"030754bffcf6dfcb34a20c486ff5a5be5546b9cc16fba9692165272b3f8e98c4af" },
|
||||
{"SHossain":"03c8657bd57b6ceb14514a10e99fe8a0cec5a9bc24592df7f66f050e670e4f6bac" },
|
||||
{"satinder":"03732f8ef851ff234c74d0df575c2c5b159e2bab3faca4ec52b3f217d5cda5361d" },
|
||||
{"ml777":"02453d028c74cb9551e1aaf35113383b6ecbd9f06ff23a4ab1a953429b9763e345" },
|
||||
{"tonylhub":"0218e0f435d4544404c25a7759b7f7174d821215085ef936218c5569d975af468b" },
|
||||
{"gthub":"036c7de9a5090fbad78b9eea41549ccacc07bd0e9e7f8d290c88f470f3569e1a35" },
|
||||
{"zkTrader":"026c6b0b35ec0adc2f8a5c648da1fce634f798c69d5e9fe518400447e88398b830" },
|
||||
{"nutellalicka":"03aee08860e0340f0f490a3ef3718d6676882f2d63d4f536dfebb1d348b82c79ee" },
|
||||
{"gcharang":"02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567" },
|
||||
{"jl777":"02b27de3ee5335518b06f69f4fbabb029cfc737613b100996841d5532b324a5a61" }
|
||||
],
|
||||
"tokens":[
|
||||
{"RICK.demo":"2b1feef719ecb526b07416dd432bce603ac6dc8bfe794cddf105cb52f6aae3cd"}
|
||||
],
|
||||
"files":[
|
||||
{"filename":"hushd","prices":[{"HUSH":0.1}, {"PIRATE":1}]}
|
||||
],
|
||||
"externalcoins":[
|
||||
{ "BTC":"bitcoin-cli" },
|
||||
{ "KMD":"komodod-cli" },
|
||||
{ "CHIPS":"chips-cli" },
|
||||
{ "PIRATE":"pirate-cli" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
if make -f Makefile_custom "$@"; then
|
||||
if HOST="$HOST" make -B -f Makefile_custom "$@"; then
|
||||
echo CUSTOMCC BUILD SUCCESSFUL
|
||||
else
|
||||
echo CUSTOMCC BUILD FAILED
|
||||
|
||||
15
src/chain.h
15
src/chain.h
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019 The Hush developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -276,9 +276,12 @@ public:
|
||||
//! inputs and outputs.
|
||||
int64_t nShieldedTx;
|
||||
|
||||
//! (memory only) Number of shielded outputs in the block up to and including this block.
|
||||
//! (memory only) Number of shielded outputs
|
||||
int64_t nShieldedOutputs;
|
||||
|
||||
//! (memory only) Number of shielded spends
|
||||
int64_t nShieldedSpends;
|
||||
|
||||
//! (memory only) Number of fully shielded transactions. A fully shielded transaction is defined
|
||||
//! as a transaction containing JoinSplits and only shielded inputs and outputs, i.e. no transparent
|
||||
// inputs or outputs: z->z or z->(z,z) or z->(z,z,z,) etc...
|
||||
@@ -332,6 +335,9 @@ public:
|
||||
//! (memory only) Number of shielded outputs in the chain up to and including this block.
|
||||
int64_t nChainShieldedOutputs;
|
||||
|
||||
//! (memory only) Number of shielded spends in the chain up to and including this block.
|
||||
int64_t nChainShieldedSpends;
|
||||
|
||||
//! (memory only) Number of fully shielded transactions. A fully shielded transaction is defined
|
||||
//! as a transaction containing JoinSplits and only shielded inputs and outputs, i.e. no transparent
|
||||
// inputs or outputs: z->z or z->(z,z) or z->(z,z,z,) etc...
|
||||
@@ -429,18 +435,20 @@ public:
|
||||
nChainNotarizations = 0;
|
||||
nChainFullyShieldedTx = 0;
|
||||
nChainShieldedOutputs = 0;
|
||||
nChainShieldedSpends = 0;
|
||||
nChainShieldedPayments = 0;
|
||||
nChainShieldingPayments = 0;
|
||||
nChainDeshieldingPayments = 0;
|
||||
nChainFullyShieldedPayments = 0;
|
||||
|
||||
// Shieldex Index stats
|
||||
// Shielded Index stats
|
||||
nPayments = 0;
|
||||
nShieldedTx = 0;
|
||||
nShieldingTx = 0;
|
||||
nNotarizations = 0;
|
||||
nDeshieldingTx = 0;
|
||||
nShieldedOutputs = 0;
|
||||
nShieldedSpends = 0;
|
||||
nFullyShieldedTx = 0;
|
||||
nShieldedPayments = 0;
|
||||
nShieldingPayments = 0;
|
||||
@@ -679,6 +687,7 @@ public:
|
||||
READWRITE(nDeshieldingPayments);
|
||||
READWRITE(nFullyShieldedPayments);
|
||||
READWRITE(nShieldedOutputs);
|
||||
READWRITE(nShieldedSpends);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -544,6 +544,14 @@ int32_t MAX_BLOCK_SIZE(int32_t height)
|
||||
else return(2000000);
|
||||
}
|
||||
|
||||
// Change the Hush blocktime at run-time(!)
|
||||
void hush_changeblocktime()
|
||||
{
|
||||
pCurrentParams->consensus.nMaxFutureBlockTime = 7 * ASSETCHAINS_BLOCKTIME;
|
||||
pCurrentParams->consensus.nPowTargetSpacing = ASSETCHAINS_BLOCKTIME;
|
||||
fprintf(stderr,"HUSH blocktime changing to %d seconds\n",ASSETCHAINS_BLOCKTIME);
|
||||
}
|
||||
|
||||
void komodo_setactivation(int32_t height)
|
||||
{
|
||||
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = height;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Checkpoints {
|
||||
fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
|
||||
}
|
||||
|
||||
return fWorkBefore / (fWorkBefore + fWorkAfter);
|
||||
return std::min(fWorkBefore / (fWorkBefore + fWorkAfter), 1.0);
|
||||
}
|
||||
|
||||
int GetTotalBlocksEstimate(const CChainParams::CCheckpointData& data)
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
|
||||
// Must be kept in sync with configure.ac !
|
||||
#define CLIENT_VERSION_MAJOR 3
|
||||
#define CLIENT_VERSION_MINOR 3
|
||||
#define CLIENT_VERSION_REVISION 1
|
||||
#define CLIENT_VERSION_MINOR 4
|
||||
#define CLIENT_VERSION_REVISION 0
|
||||
#define CLIENT_VERSION_BUILD 50
|
||||
|
||||
//! Set to true for release, false for prerelease or test build
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2012-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019 The Hush developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -65,7 +65,6 @@ bool CCoins::Spend(uint32_t nPos)
|
||||
Cleanup();
|
||||
return true;
|
||||
}
|
||||
bool CCoinsView::GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const { return false; }
|
||||
bool CCoinsView::GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const { return false; }
|
||||
bool CCoinsView::GetNullifier(const uint256 &nullifier, ShieldedType type) const { return false; }
|
||||
bool CCoinsView::GetCoins(const uint256 &txid, CCoins &coins) const { return false; }
|
||||
@@ -85,7 +84,6 @@ bool CCoinsView::GetStats(CCoinsStats &stats) const { return false; }
|
||||
|
||||
CCoinsViewBacked::CCoinsViewBacked(CCoinsView *viewIn) : base(viewIn) { }
|
||||
|
||||
bool CCoinsViewBacked::GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const { return base->GetSproutAnchorAt(rt, tree); }
|
||||
bool CCoinsViewBacked::GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const { return base->GetSaplingAnchorAt(rt, tree); }
|
||||
bool CCoinsViewBacked::GetNullifier(const uint256 &nullifier, ShieldedType type) const { return base->GetNullifier(nullifier, type); }
|
||||
bool CCoinsViewBacked::GetCoins(const uint256 &txid, CCoins &coins) const { return base->GetCoins(txid, coins); }
|
||||
@@ -139,30 +137,6 @@ CCoinsMap::const_iterator CCoinsViewCache::FetchCoins(const uint256 &txid) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool CCoinsViewCache::GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const {
|
||||
CAnchorsSproutMap::const_iterator it = cacheSproutAnchors.find(rt);
|
||||
if (it != cacheSproutAnchors.end()) {
|
||||
if (it->second.entered) {
|
||||
tree = it->second.tree;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!base->GetSproutAnchorAt(rt, tree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CAnchorsSproutMap::iterator ret = cacheSproutAnchors.insert(std::make_pair(rt, CAnchorsSproutCacheEntry())).first;
|
||||
ret->second.entered = true;
|
||||
ret->second.tree = tree;
|
||||
cachedCoinsUsage += ret->second.tree.DynamicMemoryUsage();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCoinsViewCache::GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const {
|
||||
CAnchorsSaplingMap::const_iterator it = cacheSaplingAnchors.find(rt);
|
||||
if (it != cacheSaplingAnchors.end()) {
|
||||
@@ -271,7 +245,6 @@ void CCoinsViewCache::BringBestAnchorIntoCache(
|
||||
SproutMerkleTree &tree
|
||||
)
|
||||
{
|
||||
assert(GetSproutAnchorAt(currentRoot, tree));
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -436,8 +409,8 @@ void CCoinsViewCache::SetBestBlock(const uint256 &hashBlockIn) {
|
||||
|
||||
void BatchWriteNullifiers(CNullifiersMap &mapNullifiers, CNullifiersMap &cacheNullifiers)
|
||||
{
|
||||
if(fZdebug)
|
||||
LogPrintf("%s\n", __FUNCTION__);
|
||||
//if(fZdebug)
|
||||
// LogPrintf("%s\n", __FUNCTION__);
|
||||
for (CNullifiersMap::iterator child_it = mapNullifiers.begin(); child_it != mapNullifiers.end();) {
|
||||
if (child_it->second.flags & CNullifiersCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization).
|
||||
CNullifiersMap::iterator parent_it = cacheNullifiers.find(child_it->first);
|
||||
@@ -550,9 +523,9 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins,
|
||||
bool CCoinsViewCache::Flush() {
|
||||
bool fOk = base->BatchWrite(cacheCoins, hashBlock, hashSproutAnchor, hashSaplingAnchor, cacheSproutAnchors, cacheSaplingAnchors, cacheSproutNullifiers, cacheSaplingNullifiers);
|
||||
cacheCoins.clear();
|
||||
cacheSproutAnchors.clear();
|
||||
//cacheSproutAnchors.clear();
|
||||
cacheSaplingAnchors.clear();
|
||||
cacheSproutNullifiers.clear();
|
||||
//cacheSproutNullifiers.clear();
|
||||
cacheSaplingNullifiers.clear();
|
||||
cachedCoinsUsage = 0;
|
||||
return fOk;
|
||||
@@ -624,37 +597,8 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
|
||||
}
|
||||
|
||||
|
||||
bool CCoinsViewCache::HaveJoinSplitRequirements(const CTransaction& tx) const
|
||||
bool CCoinsViewCache::HaveShieldedRequirements(const CTransaction& tx) const
|
||||
{
|
||||
boost::unordered_map<uint256, SproutMerkleTree, CCoinsKeyHasher> intermediates;
|
||||
|
||||
BOOST_FOREACH(const JSDescription &joinsplit, tx.vjoinsplit)
|
||||
{
|
||||
BOOST_FOREACH(const uint256& nullifier, joinsplit.nullifiers)
|
||||
{
|
||||
if (GetNullifier(nullifier, SPROUT)) {
|
||||
// If the nullifier is set, this transaction
|
||||
// double-spends!
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SproutMerkleTree tree;
|
||||
auto it = intermediates.find(joinsplit.anchor);
|
||||
if (it != intermediates.end()) {
|
||||
tree = it->second;
|
||||
} else if (!GetSproutAnchorAt(joinsplit.anchor, tree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const uint256& commitment, joinsplit.commitments)
|
||||
{
|
||||
tree.append(commitment);
|
||||
}
|
||||
|
||||
intermediates.insert(std::make_pair(tree.root(), tree));
|
||||
}
|
||||
|
||||
for (const SpendDescription &spendDescription : tx.vShieldedSpend) {
|
||||
if (GetNullifier(spendDescription.nullifier, SAPLING)) { // Prevent double spends
|
||||
LogPrintf("%s: sapling nullifier %s exists, preventing double spend\n", __FUNCTION__, spendDescription.nullifier.GetHex().c_str());
|
||||
|
||||
11
src/coins.h
11
src/coins.h
@@ -372,9 +372,6 @@ struct CCoinsStats
|
||||
class CCoinsView
|
||||
{
|
||||
public:
|
||||
//! Retrieve the tree (Sprout) at a particular anchored root in the chain
|
||||
virtual bool GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const;
|
||||
|
||||
//! Retrieve the tree (Sapling) at a particular anchored root in the chain
|
||||
virtual bool GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const;
|
||||
|
||||
@@ -421,7 +418,6 @@ protected:
|
||||
|
||||
public:
|
||||
CCoinsViewBacked(CCoinsView *viewIn);
|
||||
bool GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const;
|
||||
bool GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const;
|
||||
bool GetNullifier(const uint256 &nullifier, ShieldedType type) const;
|
||||
bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
||||
@@ -493,7 +489,6 @@ public:
|
||||
CNullifiersMap getNullifiers();
|
||||
|
||||
// Standard CCoinsView methods
|
||||
bool GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const;
|
||||
bool GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const;
|
||||
bool GetNullifier(const uint256 &nullifier, ShieldedType type) const;
|
||||
bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
||||
@@ -550,7 +545,7 @@ public:
|
||||
size_t DynamicMemoryUsage() const;
|
||||
|
||||
/**
|
||||
* Amount of bitcoins coming in to a transaction
|
||||
* Amount of HUSH coming in to a transaction
|
||||
* Note that lightweight clients may not know anything besides the hash of previous transactions,
|
||||
* so may not be able to calculate this.
|
||||
*
|
||||
@@ -562,8 +557,8 @@ public:
|
||||
//! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
|
||||
bool HaveInputs(const CTransaction& tx) const;
|
||||
|
||||
//! Check whether all joinsplit requirements (anchors/nullifiers) are satisfied
|
||||
bool HaveJoinSplitRequirements(const CTransaction& tx) const;
|
||||
//! Check whether all shielded requirements (anchors/nullifiers) are satisfied
|
||||
bool HaveShieldedRequirements(const CTransaction& tx) const;
|
||||
|
||||
//! Return priority of tx at height nHeight
|
||||
double GetPriority(const CTransaction &tx, int nHeight) const;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
// file COPYING or https://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2018 The Zcash developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -15,7 +15,7 @@ AM_CFLAGS = -I$(top_srcdir)/src/asn -I$(top_srcdir)/include -I$(top_srcdir)/src/
|
||||
LIBSECP256K1=src/include/secp256k1/libsecp256k1.la
|
||||
|
||||
$(LIBSECP256K1): $(wildcard src/secp256k1/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) -march:x86-64 -g
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) -g
|
||||
|
||||
CRYPTOCONDITIONS_CORE=libcryptoconditions_core.la
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -53,11 +54,8 @@ static void anonToJSON(const CC *cond, cJSON *params) {
|
||||
}
|
||||
|
||||
|
||||
static unsigned char *anonFingerprint(const CC *cond) {
|
||||
unsigned char *out = calloc(1, 32);
|
||||
//fprintf(stderr,"anon fingerprint %p %p\n",out,cond->fingerprint);
|
||||
static void anonFingerprint(const CC *cond, uint8_t *out) {
|
||||
memcpy(out, cond->fingerprint, 32);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1714,7 +1714,9 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
|
||||
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
|
||||
asn_OCTET_STRING_specifics_t *specs;
|
||||
asn_struct_ctx_t *ctx;
|
||||
#if !defined(__aarch64__)
|
||||
struct _stack *stck;
|
||||
#endif
|
||||
|
||||
if(!td || !st)
|
||||
return;
|
||||
@@ -1731,6 +1733,15 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
|
||||
st->buf = 0;
|
||||
}
|
||||
|
||||
/* Attention !!!
|
||||
* this is quick & dirty workaround for memory corruption bug on aarch64-linux-gnu
|
||||
* - downside: allows memory leakage
|
||||
* - issue description: On Raspberry Pi 4 @ 64bit linux, daemon crashes with "free(): invalid pointer" error
|
||||
* - probable cause: misaligned memory access to nested structs containing pointers
|
||||
* - TODO: use the latest asn1c compiler on CryptoConditions.asn, maybe generate cpp instead of c code... investigation in progress
|
||||
*/
|
||||
|
||||
#if !defined(__aarch64__)
|
||||
/*
|
||||
* Remove decode-time stack.
|
||||
*/
|
||||
@@ -1747,6 +1758,7 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
|
||||
if(!contents_only) {
|
||||
FREEMEM(st);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -65,8 +66,8 @@ void appendUriSubtypes(uint32_t mask, unsigned char *buf) {
|
||||
|
||||
|
||||
char *cc_conditionUri(const CC *cond) {
|
||||
unsigned char *fp = cond->type->fingerprint(cond);
|
||||
if (!fp) return NULL;
|
||||
unsigned char *fp = calloc(1, 32);
|
||||
cond->type->fingerprint(cond, fp);
|
||||
|
||||
unsigned char *encoded = base64_encode(fp, 32);
|
||||
|
||||
@@ -118,13 +119,13 @@ uint32_t fromAsnSubtypes(const ConditionTypes_t types) {
|
||||
size_t cc_conditionBinary(const CC *cond, unsigned char *buf) {
|
||||
Condition_t *asn = calloc(1, sizeof(Condition_t));
|
||||
asnCondition(cond, asn);
|
||||
size_t out = 0;
|
||||
asn_enc_rval_t rc = der_encode_to_buffer(&asn_DEF_Condition, asn, buf, 1000);
|
||||
if (rc.encoded == -1) {
|
||||
fprintf(stderr, "CONDITION NOT ENCODED\n");
|
||||
return 0;
|
||||
}
|
||||
if (rc.encoded == -1) goto end;
|
||||
out = rc.encoded;
|
||||
end:
|
||||
ASN_STRUCT_FREE(asn_DEF_Condition, asn);
|
||||
return rc.encoded;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,10 +147,12 @@ void asnCondition(const CC *cond, Condition_t *asn) {
|
||||
// This may look a little weird - we dont have a reference here to the correct
|
||||
// union choice for the condition type, so we just assign everything to the threshold
|
||||
// type. This works out nicely since the union choices have the same binary interface.
|
||||
|
||||
CompoundSha256Condition_t *choice = &asn->choice.thresholdSha256;
|
||||
choice->cost = cc_getCost(cond);
|
||||
choice->fingerprint.buf = cond->type->fingerprint(cond);
|
||||
choice->fingerprint.size = 32;
|
||||
choice->fingerprint.buf = calloc(1, 32);
|
||||
cond->type->fingerprint(cond, choice->fingerprint.buf);
|
||||
choice->subtypes = asnSubtypes(cond->type->getSubtypes(cond));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -25,11 +26,10 @@
|
||||
struct CCType CC_Ed25519Type;
|
||||
|
||||
|
||||
static unsigned char *ed25519Fingerprint(const CC *cond) {
|
||||
static void ed25519Fingerprint(const CC *cond, uint8_t *out) {
|
||||
Ed25519FingerprintContents_t *fp = calloc(1, sizeof(Ed25519FingerprintContents_t));
|
||||
//fprintf(stderr,"ed25519 fingerprint %p %p\n",fp,cond->publicKey);
|
||||
OCTET_STRING_fromBuf(&fp->publicKey, cond->publicKey, 32);
|
||||
return hashFingerprintContents(&asn_DEF_Ed25519FingerprintContents, fp);
|
||||
hashFingerprintContents(&asn_DEF_Ed25519FingerprintContents, fp, out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -25,11 +26,8 @@
|
||||
struct CCType CC_EvalType;
|
||||
|
||||
|
||||
static unsigned char *evalFingerprint(const CC *cond) {
|
||||
unsigned char *hash = calloc(1, 32);
|
||||
//fprintf(stderr,"evalfingerprint %p %p\n",hash,cond->code);
|
||||
sha256(cond->code, cond->codeLength, hash);
|
||||
return hash;
|
||||
static void evalFingerprint(const CC *cond, uint8_t *out) {
|
||||
sha256(cond->code, cond->codeLength, out);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +103,7 @@ static uint32_t evalSubtypes(const CC *cond) {
|
||||
*/
|
||||
int jsonVerifyEval(CC *cond, void *context) {
|
||||
if (cond->codeLength == 5 && 0 == memcmp(cond->code, "TEST", 4)) {
|
||||
return cond->code[5];
|
||||
return cond->code[4];
|
||||
}
|
||||
fprintf(stderr, "Cannot verify eval; user function unknown\n");
|
||||
return 0;
|
||||
|
||||
@@ -71,7 +71,7 @@ endif
|
||||
endif
|
||||
|
||||
libsecp256k1_la_SOURCES = src/secp256k1.c
|
||||
libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -march=x86-64 -g
|
||||
libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -g
|
||||
libsecp256k1_la_LIBADD = $(JNI_LIB) $(SECP_LIBS) $(COMMON_LIB)
|
||||
|
||||
libsecp256k1_jni_la_SOURCES = src/java/org_bitcoin_NativeSecp256k1.c src/java/org_bitcoin_Secp256k1Context.c
|
||||
|
||||
@@ -36,4 +36,4 @@ static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, cons
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -41,7 +42,7 @@ typedef struct CCType {
|
||||
char name[100];
|
||||
Condition_PR asnType;
|
||||
int (*visitChildren)(CC *cond, CCVisitor visitor);
|
||||
unsigned char *(*fingerprint)(const CC *cond);
|
||||
void (*fingerprint)(const CC *cond, uint8_t *fp);
|
||||
unsigned long (*getCost)(const CC *cond);
|
||||
uint32_t (*getSubtypes)(const CC *cond);
|
||||
CC *(*fromJSON)(const cJSON *params, char *err);
|
||||
@@ -77,7 +78,7 @@ struct CCType *getTypeByAsnEnum(Condition_PR present);
|
||||
*/
|
||||
unsigned char *base64_encode(const unsigned char *data, size_t input_length);
|
||||
unsigned char *base64_decode(const unsigned char *data_, size_t *output_length);
|
||||
unsigned char *hashFingerprintContents(asn_TYPE_descriptor_t *asnType, void *fp);
|
||||
void hashFingerprintContents(asn_TYPE_descriptor_t *asnType, void *fp, uint8_t* out);
|
||||
void dumpStr(unsigned char *str, size_t len);
|
||||
int checkString(const cJSON *value, char *key, char *err);
|
||||
int checkDecodeBase64(const cJSON *value, char *key, char *err, unsigned char **data, size_t *size);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -37,13 +38,12 @@ static int prefixVisitChildren(CC *cond, CCVisitor visitor) {
|
||||
}
|
||||
|
||||
|
||||
static unsigned char *prefixFingerprint(const CC *cond) {
|
||||
static void prefixFingerprint(const CC *cond, uint8_t *out) {
|
||||
PrefixFingerprintContents_t *fp = calloc(1, sizeof(PrefixFingerprintContents_t));
|
||||
//fprintf(stderr,"prefixfinger %p %p\n",fp,cond->prefix);
|
||||
asnCondition(cond->subcondition, &fp->subcondition); // TODO: check asnCondition for safety
|
||||
asnCondition(cond->subcondition, &fp->subcondition);
|
||||
fp->maxMessageLength = cond->maxMessageLength;
|
||||
OCTET_STRING_fromBuf(&fp->prefix, cond->prefix, cond->prefixLength);
|
||||
return hashFingerprintContents(&asn_DEF_PrefixFingerprintContents, fp);
|
||||
hashFingerprintContents(&asn_DEF_PrefixFingerprintContents, fp, out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -44,11 +45,8 @@ static unsigned long preimageCost(const CC *cond) {
|
||||
}
|
||||
|
||||
|
||||
static unsigned char *preimageFingerprint(const CC *cond) {
|
||||
unsigned char *hash = calloc(1, 32);
|
||||
//fprintf(stderr,"preimage %p %p\n",hash,cond->preimage);
|
||||
sha256(cond->preimage, cond->preimageLength, hash);
|
||||
return hash;
|
||||
static void preimageFingerprint(const CC *cond, uint8_t *out) {
|
||||
sha256(cond->preimage, cond->preimageLength, out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -88,11 +89,10 @@ void initVerify() {
|
||||
}
|
||||
|
||||
|
||||
static unsigned char *secp256k1Fingerprint(const CC *cond) {
|
||||
static void secp256k1Fingerprint(const CC *cond, uint8_t *out) {
|
||||
Secp256k1FingerprintContents_t *fp = calloc(1, sizeof(Secp256k1FingerprintContents_t));
|
||||
//fprintf(stderr,"secpfinger %p %p size %d vs %d\n",fp,cond->publicKey,(int32_t)sizeof(Secp256k1FingerprintContents_t),(int32_t)SECP256K1_PK_SIZE);
|
||||
OCTET_STRING_fromBuf(&fp->publicKey, cond->publicKey, SECP256K1_PK_SIZE);
|
||||
return hashFingerprintContents(&asn_DEF_Secp256k1FingerprintContents, fp);
|
||||
hashFingerprintContents(&asn_DEF_Secp256k1FingerprintContents, fp, out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -94,17 +95,15 @@ static int cmpConditionBin(const void *a, const void *b) {
|
||||
}
|
||||
|
||||
|
||||
static unsigned char *thresholdFingerprint(const CC *cond) {
|
||||
/* Create fingerprint */
|
||||
static void thresholdFingerprint(const CC *cond, uint8_t *out) {
|
||||
ThresholdFingerprintContents_t *fp = calloc(1, sizeof(ThresholdFingerprintContents_t));
|
||||
//fprintf(stderr,"thresholdfinger %p\n",fp);
|
||||
fp->threshold = cond->threshold;
|
||||
for (int i=0; i<cond->size; i++) {
|
||||
Condition_t *asnCond = asnConditionNew(cond->subconditions[i]);
|
||||
asn_set_add(&fp->subconditions2, asnCond);
|
||||
}
|
||||
qsort(fp->subconditions2.list.array, cond->size, sizeof(Condition_t*), cmpConditionBin);
|
||||
return hashFingerprintContents(&asn_DEF_ThresholdFingerprintContents, fp);
|
||||
hashFingerprintContents(&asn_DEF_ThresholdFingerprintContents, fp, out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -210,17 +211,15 @@ void jsonAddBase64(cJSON *params, char *key, unsigned char *bin, size_t size) {
|
||||
}
|
||||
|
||||
|
||||
unsigned char *hashFingerprintContents(asn_TYPE_descriptor_t *asnType, void *fp) {
|
||||
void hashFingerprintContents(asn_TYPE_descriptor_t *asnType, void *fp, uint8_t *out) {
|
||||
unsigned char buf[BUF_SIZE];
|
||||
asn_enc_rval_t rc = der_encode_to_buffer(asnType, fp, buf, BUF_SIZE);
|
||||
ASN_STRUCT_FREE(*asnType, fp);
|
||||
if (rc.encoded < 1) {
|
||||
fprintf(stderr, "Encoding fingerprint failed\n");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
unsigned char *hash = calloc(1,32);
|
||||
sha256(buf, rc.encoded, hash);
|
||||
return hash;
|
||||
sha256(buf, rc.encoded, out);
|
||||
}
|
||||
|
||||
|
||||
@@ -301,5 +300,3 @@ int jsonGetHexOptional(const cJSON *params, char *key, char *err, unsigned char
|
||||
}
|
||||
return checkDecodeHex(item, key, err, data, size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -82,4 +82,25 @@ def test_malleability_checked():
|
||||
assert not cc_rfb(b'\xa2\x13\xa0\x0f\xa0\x06\x80\x04abcd\xa0\x05\x80\x03abc\xa1\x00')
|
||||
|
||||
|
||||
def test_large_threshold():
|
||||
conds = [{
|
||||
'type': "secp256k1-sha-256",
|
||||
"publicKey": "02D5D969305535AC29A77079C11D4F0DD40661CF96E04E974A5E8D7E374EE225AA"
|
||||
}]
|
||||
|
||||
for i in range(250):
|
||||
conds.append({
|
||||
"type": "eval-sha-256",
|
||||
"code": "VEVTVAE"
|
||||
})
|
||||
|
||||
r = jsonRPC("encodeCondition", {
|
||||
"type": "threshold-sha-256",
|
||||
"subfulfillments": conds,
|
||||
"threshold": 251
|
||||
})
|
||||
assert 'error' not in r, r
|
||||
|
||||
|
||||
|
||||
so.cc_conditionUri.restype = ctypes.c_char_p
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include "util.h"
|
||||
|
||||
#include <libsnark/common/default_types/r1cs_ppzksnark_pp.hpp>
|
||||
#include <libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp>
|
||||
|
||||
#include "librustzcash.h"
|
||||
|
||||
struct ECCryptoClosure
|
||||
@@ -23,12 +20,7 @@ int main(int argc, char **argv) {
|
||||
assert(init_and_check_sodium() != -1);
|
||||
ECC_Start();
|
||||
|
||||
libsnark::default_r1cs_ppzksnark_pp::init_public_params();
|
||||
libsnark::inhibit_profiling_info = true;
|
||||
libsnark::inhibit_profiling_counters = true;
|
||||
boost::filesystem::path pk_path = ZC_GetParamsDir() / "sprout-proving.key";
|
||||
boost::filesystem::path vk_path = ZC_GetParamsDir() / "sprout-verifying.key";
|
||||
params = ZCJoinSplit::Prepared(vk_path.string(), pk_path.string());
|
||||
params = ZCJoinSplit::Prepared();
|
||||
|
||||
boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params";
|
||||
boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params";
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "uint256.h"
|
||||
|
||||
#include "zcash/util.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <libsnark/common/default_types/r1cs_ppzksnark_pp.hpp>
|
||||
#include <libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp>
|
||||
#include <libsnark/gadgetlib1/gadgets/hashes/sha256/sha256_gadget.hpp>
|
||||
#include <libsnark/gadgetlib1/gadgets/merkle_tree/merkle_tree_check_read_gadget.hpp>
|
||||
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
|
||||
using namespace libsnark;
|
||||
using namespace libzcash;
|
||||
|
||||
#include "zcash/circuit/utils.tcc"
|
||||
#include "zcash/circuit/merkle.tcc"
|
||||
|
||||
template<typename FieldT>
|
||||
void test_value_equals(uint64_t i) {
|
||||
protoboard<FieldT> pb;
|
||||
pb_variable_array<FieldT> num;
|
||||
num.allocate(pb, 64, "");
|
||||
num.fill_with_bits(pb, uint64_to_bool_vector(i));
|
||||
pb.add_r1cs_constraint(r1cs_constraint<FieldT>(
|
||||
packed_addition(num),
|
||||
FieldT::one(),
|
||||
FieldT::one() * i
|
||||
), "");
|
||||
ASSERT_TRUE(pb.is_satisfied());
|
||||
}
|
||||
|
||||
TEST(circuit, values)
|
||||
{
|
||||
typedef Fr<default_r1cs_ppzksnark_pp> FieldT;
|
||||
test_value_equals<FieldT>(0);
|
||||
test_value_equals<FieldT>(1);
|
||||
test_value_equals<FieldT>(3);
|
||||
test_value_equals<FieldT>(5391);
|
||||
test_value_equals<FieldT>(883128374);
|
||||
test_value_equals<FieldT>(173419028459);
|
||||
test_value_equals<FieldT>(2205843009213693953);
|
||||
}
|
||||
|
||||
TEST(circuit, endianness)
|
||||
{
|
||||
std::vector<unsigned char> before = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39,
|
||||
40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55,
|
||||
56, 57, 58, 59, 60, 61, 62, 63
|
||||
};
|
||||
auto result = swap_endianness_u64(before);
|
||||
|
||||
std::vector<unsigned char> after = {
|
||||
56, 57, 58, 59, 60, 61, 62, 63,
|
||||
48, 49, 50, 51, 52, 53, 54, 55,
|
||||
40, 41, 42, 43, 44, 45, 46, 47,
|
||||
32, 33, 34, 35, 36, 37, 38, 39,
|
||||
24, 25, 26, 27, 28, 29, 30, 31,
|
||||
16, 17, 18, 19, 20, 21, 22, 23,
|
||||
8, 9, 10, 11, 12, 13, 14, 15,
|
||||
0, 1, 2, 3, 4, 5, 6, 7
|
||||
};
|
||||
|
||||
EXPECT_EQ(after, result);
|
||||
|
||||
std::vector<unsigned char> bad = {0, 1, 2, 3};
|
||||
|
||||
ASSERT_THROW(swap_endianness_u64(bad), std::length_error);
|
||||
}
|
||||
|
||||
template<typename FieldT>
|
||||
bool test_merkle_gadget(
|
||||
bool enforce_a,
|
||||
bool enforce_b,
|
||||
bool write_root_first
|
||||
)
|
||||
{
|
||||
protoboard<FieldT> pb;
|
||||
digest_variable<FieldT> root(pb, 256, "root");
|
||||
pb.set_input_sizes(256);
|
||||
|
||||
digest_variable<FieldT> commitment1(pb, 256, "commitment1");
|
||||
digest_variable<FieldT> commitment2(pb, 256, "commitment2");
|
||||
|
||||
pb_variable<FieldT> commitment1_read;
|
||||
commitment1_read.allocate(pb);
|
||||
pb_variable<FieldT> commitment2_read;
|
||||
commitment2_read.allocate(pb);
|
||||
|
||||
merkle_tree_gadget<FieldT> mgadget1(pb, commitment1, root, commitment1_read);
|
||||
merkle_tree_gadget<FieldT> mgadget2(pb, commitment2, root, commitment2_read);
|
||||
|
||||
commitment1.generate_r1cs_constraints();
|
||||
commitment2.generate_r1cs_constraints();
|
||||
root.generate_r1cs_constraints();
|
||||
mgadget1.generate_r1cs_constraints();
|
||||
mgadget2.generate_r1cs_constraints();
|
||||
|
||||
SproutMerkleTree tree;
|
||||
uint256 commitment1_data = uint256S("54d626e08c1c802b305dad30b7e54a82f102390cc92c7d4db112048935236e9c");
|
||||
uint256 commitment2_data = uint256S("59d2cde5e65c1414c32ba54f0fe4bdb3d67618125286e6a191317917c812c6d7");
|
||||
tree.append(commitment1_data);
|
||||
auto wit1 = tree.witness();
|
||||
tree.append(commitment2_data);
|
||||
wit1.append(commitment2_data);
|
||||
auto wit2 = tree.witness();
|
||||
auto expected_root = tree.root();
|
||||
tree.append(uint256S("3e243c8798678570bb8d42616c23a536af44be15c4eef073490c2a44ae5f32c3"));
|
||||
auto unexpected_root = tree.root();
|
||||
tree.append(uint256S("26d9b20c7f1c3d2528bbcd43cd63344b0afd3b6a0a8ebd37ec51cba34907bec7"));
|
||||
auto badwit1 = tree.witness();
|
||||
tree.append(uint256S("02c2467c9cd15e0d150f74cd636505ed675b0b71b66a719f6f52fdb49a5937bb"));
|
||||
auto badwit2 = tree.witness();
|
||||
|
||||
// Perform the test
|
||||
|
||||
pb.val(commitment1_read) = enforce_a ? FieldT::one() : FieldT::zero();
|
||||
pb.val(commitment2_read) = enforce_b ? FieldT::one() : FieldT::zero();
|
||||
|
||||
commitment1.bits.fill_with_bits(pb, uint256_to_bool_vector(commitment1_data));
|
||||
commitment2.bits.fill_with_bits(pb, uint256_to_bool_vector(commitment2_data));
|
||||
|
||||
if (write_root_first) {
|
||||
root.bits.fill_with_bits(pb, uint256_to_bool_vector(expected_root));
|
||||
}
|
||||
|
||||
mgadget1.generate_r1cs_witness(wit1.path());
|
||||
mgadget2.generate_r1cs_witness(wit2.path());
|
||||
|
||||
// Overwrite with our expected root
|
||||
root.bits.fill_with_bits(pb, uint256_to_bool_vector(expected_root));
|
||||
|
||||
return pb.is_satisfied();
|
||||
}
|
||||
|
||||
TEST(circuit, merkle_tree_gadget_weirdness)
|
||||
{
|
||||
/*
|
||||
The merkle tree gadget takes a leaf in the merkle tree (the Note commitment),
|
||||
a merkle tree authentication path, and a root (anchor). It also takes a parameter
|
||||
called read_success, which is used to determine if the commitment actually needs to
|
||||
appear in the tree.
|
||||
|
||||
If two input notes use the same root (which our protocol does) then if `read_success`
|
||||
is disabled on the first note but enabled on the second note (i.e., the first note
|
||||
has value of zero and second note has nonzero value) then there is an edge case in
|
||||
the witnessing behavior. The first witness will accidentally constrain the root to
|
||||
equal null (the default value of the anchor) and the second witness will actually
|
||||
copy the bits, violating the constraint system.
|
||||
|
||||
Notice that this edge case is not in the constraint system but in the witnessing
|
||||
behavior.
|
||||
*/
|
||||
|
||||
typedef Fr<default_r1cs_ppzksnark_pp> FieldT;
|
||||
|
||||
// Test the normal case
|
||||
ASSERT_TRUE(test_merkle_gadget<FieldT>(true, true, false));
|
||||
ASSERT_TRUE(test_merkle_gadget<FieldT>(true, true, true));
|
||||
|
||||
// Test the case where the first commitment is enforced but the second isn't
|
||||
// Works because the first read is performed before the second one
|
||||
ASSERT_TRUE(test_merkle_gadget<FieldT>(true, false, false));
|
||||
ASSERT_TRUE(test_merkle_gadget<FieldT>(true, false, true));
|
||||
|
||||
// Test the case where the first commitment isn't enforced but the second is
|
||||
// Doesn't work because the first multipacker witnesses the existing root (which
|
||||
// is null)
|
||||
ASSERT_TRUE(!test_merkle_gadget<FieldT>(false, true, false));
|
||||
|
||||
// Test the last again, except this time write the root first.
|
||||
ASSERT_TRUE(test_merkle_gadget<FieldT>(false, true, true));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user