From d9cd254e5e93b13f6b90451e03f9ceb26af852df Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 28 Mar 2018 17:55:45 +0200 Subject: [PATCH] Make Rust compilation mandatory The temporary integration check in CheckEquihashSolution() remains, until we have "real" Rust code to integrate. Closes #2688. --- configure.ac | 23 +---------------------- depends/Makefile | 3 +-- src/pow.cpp | 4 ---- zcutil/build.sh | 19 ++++--------------- 4 files changed, 6 insertions(+), 43 deletions(-) diff --git a/configure.ac b/configure.ac index 2b364419e..2b93df281 100644 --- a/configure.ac +++ b/configure.ac @@ -96,12 +96,6 @@ AC_ARG_ENABLE([mining], [enable_mining=$enableval], [enable_mining=yes]) -AC_ARG_ENABLE([rust], - [AS_HELP_STRING([--enable-rust], - [enable rust (default is yes)])], - [enable_rust=$enableval], - [enable_rust=yes]) - AC_ARG_ENABLE([proton], [AS_HELP_STRING([--disable-proton], [disable Proton (AMQP messaging)])], @@ -728,10 +722,7 @@ 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)]) -RUST_LIBS="" -if test x$enable_rust != xno; then - RUST_LIBS="-lrustzcash" -fi +RUST_LIBS="-lrustzcash" dnl Check for OpenMP support AX_OPENMP( @@ -815,16 +806,6 @@ else AC_MSG_RESULT(no) fi -dnl enable rust -AC_MSG_CHECKING([if rust should be enabled]) -if test x$enable_rust != xno; then - AC_MSG_RESULT(yes) - AC_DEFINE(ENABLE_RUST, 1, [Define to 1 to enable Rust language dependent functions]) - -else - AC_MSG_RESULT(no) -fi - AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"]) AM_CONDITIONAL([ENABLE_PROTON], [test "x$use_proton" = "xyes"]) @@ -854,7 +835,6 @@ AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin]) AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) AM_CONDITIONAL([ENABLE_MINING],[test x$enable_mining = xyes]) -AM_CONDITIONAL([ENABLE_RUST],[test x$enable_rust = xyes]) AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) @@ -947,7 +927,6 @@ esac echo echo "Options used to compile and link:" echo " with wallet = $enable_wallet" -echo " with rust = $enable_rust" echo " with proton = $use_proton" echo " with zmq = $use_zmq" echo " with test = $use_tests" diff --git a/depends/Makefile b/depends/Makefile index 60b3e42f7..5c1fb9fdd 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -72,11 +72,10 @@ include builders/$(build_os).mk include builders/default.mk include packages/packages.mk -rust_packages_$(NO_RUST) = $(rust_packages) 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) $(proton_packages_) $(wallet_packages_) native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) all_packages = $(packages) $(native_packages) diff --git a/src/pow.cpp b/src/pow.cpp index 83e83e9e9..ae7467961 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -16,9 +16,7 @@ #include "sodium.h" -#ifdef ENABLE_RUST #include "librustzcash.h" -#endif // ENABLE_RUST unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { @@ -100,13 +98,11 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param // H(I||V||... crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size()); - #ifdef ENABLE_RUST // Ensure that our Rust interactions are working in production builds. This is // temporary and should be removed. { assert(librustzcash_xor(0x0f0f0f0f0f0f0f0f, 0x1111111111111111) == 0x1e1e1e1e1e1e1e1e); } - #endif // ENABLE_RUST bool isValid; EhIsValidSolution(n, k, state, pblock->nSolution, isValid); diff --git a/zcutil/build.sh b/zcutil/build.sh index 6b142990c..6d79d246b 100755 --- a/zcutil/build.sh +++ b/zcutil/build.sh @@ -54,7 +54,7 @@ Usage: $0 --help Show this help message and exit. -$0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --disable-rust ] [ --enable-proton ] [ --disable-libs ] [ MAKEARGS... ] +$0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --enable-proton ] [ --disable-libs ] [ MAKEARGS... ] Build Zcash and most of its transitive dependencies from source. MAKEARGS are applied to both dependencies and Zcash itself. @@ -65,12 +65,9 @@ $0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --disable-rust ] If --disable-mining is passed, Zcash is configured to not build any mining code. It must be passed after the test arguments, if present. - If --disable-rust is passed, Zcash is configured to not build any Rust language - assets. It must be passed after test/mining arguments, if present. - If --enable-proton is passed, Zcash is configured to build the Apache Qpid Proton library required for AMQP support. This library is not built by default. - It must be passed after the test/mining/Rust arguments, if present. + It must be passed after the test/mining arguments, if present. If --disable-libs is passed, Zcash is configured to not build any libraries like 'libzcashconsensus'. @@ -103,14 +100,6 @@ then shift fi -# If --disable-rust is the next argument, disable Rust code: -RUST_ARG='' -if [ "x${1:-}" = 'x--disable-rust' ] -then - RUST_ARG='--enable-rust=no' - shift -fi - # If --enable-proton is the next argument, enable building Proton code: PROTON_ARG='--enable-proton=no' if [ "x${1:-}" = 'x--enable-proton' ] @@ -135,7 +124,7 @@ eval "$CXX" --version as --version ld -v -HOST="$HOST" BUILD="$BUILD" NO_RUST="$RUST_ARG" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1 +HOST="$HOST" BUILD="$BUILD" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1 ./autogen.sh -CC="$CC" CXX="$CXX" ./configure --prefix="${PREFIX}" --host="$HOST" --build="$BUILD" "$RUST_ARG" "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" "$LIBS_ARG" $CONFIGURE_FLAGS --enable-werror CXXFLAGS='-g' +CC="$CC" CXX="$CXX" ./configure --prefix="${PREFIX}" --host="$HOST" --build="$BUILD" "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" "$LIBS_ARG" $CONFIGURE_FLAGS --enable-werror CXXFLAGS='-g' "$MAKE" "$@" V=1