From 447ec28997d96dadcee9278a45e1436501111fbe Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 23 Jan 2020 18:45:41 -0500 Subject: [PATCH] Delete a lot of libsnark stuff --- configure.ac | 31 +---------------------- contrib/debian/copyright | 4 --- qa/hush/full_test_suite.py | 2 -- src/Makefile.am | 14 ++--------- src/Makefile.gtest.include | 2 +- src/Makefile.test.include | 2 +- src/Makefile.zcash.include | 1 - src/init.cpp | 9 ------- src/zcash/JoinSplit.cpp | 50 +------------------------------------- 9 files changed, 6 insertions(+), 109 deletions(-) diff --git a/configure.ac b/configure.ac index b57e0969f..e06bfb402 100644 --- a/configure.ac +++ b/configure.ac @@ -756,27 +756,6 @@ fi #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 *mingw*) @@ -796,13 +775,6 @@ AX_OPENMP( 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 AX_CHECK_COMPILE_FLAG([-fwrapv],[CXXFLAGS="$CXXFLAGS -fwrapv"]) @@ -944,7 +916,6 @@ 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]) @@ -975,7 +946,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 diff --git a/contrib/debian/copyright b/contrib/debian/copyright index 3c93ce7a9..9371b7022 100644 --- a/contrib/debian/copyright +++ b/contrib/debian/copyright @@ -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 diff --git a/qa/hush/full_test_suite.py b/qa/hush/full_test_suite.py index 0e8605cc3..fcbdf0cd8 100755 --- a/qa/hush/full_test_suite.py +++ b/qa/hush/full_test_suite.py @@ -138,7 +138,6 @@ STAGES = [ 'no-dot-so', 'util-test', 'secp256k1', - 'libsnark', 'univalue', 'rpc', ] @@ -150,7 +149,6 @@ STAGE_COMMANDS = { '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')], } diff --git a/src/Makefile.am b/src/Makefile.am index 2a304c5a5..c9f7cdc4d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,8 +27,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,7 +46,6 @@ 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 @@ -77,12 +74,6 @@ 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" - $(LIBUNIVALUE): $(wildcard univalue/lib/*) $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g " @@ -139,7 +130,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 \ @@ -708,12 +699,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 diff --git a/src/Makefile.gtest.include b/src/Makefile.gtest.include index cb9aa844a..1f1b511db 100644 --- a/src/Makefile.gtest.include +++ b/src/Makefile.gtest.include @@ -63,7 +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) +komodo_gtest_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS) if ENABLE_PROTON komodo_gtest_LDADD += $(LIBBITCOIN_PROTON) $(PROTON_LIBS) diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 59c66ad43..14324b02b 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -123,7 +123,7 @@ 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 diff --git a/src/Makefile.zcash.include b/src/Makefile.zcash.include index da5b4344d..0eb4582c1 100644 --- a/src/Makefile.zcash.include +++ b/src/Makefile.zcash.include @@ -9,7 +9,6 @@ zcash_GenerateParams_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) zcash_GenerateParams_LDADD = \ $(BOOST_LIBS) \ $(LIBZCASH) \ - $(LIBSNARK) \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CRYPTO) \ $(LIBZCASH_LIBS) diff --git a/src/init.cpp b/src/init.cpp index 36ed5e0cb..aaa1aa12a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -79,8 +79,6 @@ #include #include -#include - #if ENABLE_ZMQ #include "zmq/zmqnotificationinterface.h" #endif @@ -569,9 +567,6 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-rpcservertimeout=", strprintf("Timeout during HTTP requests (default: %d)", DEFAULT_HTTP_SERVER_TIMEOUT)); } - // Disabled until we can lock notes and also tune performance of libsnark which by default uses multiple threads - //strUsage += HelpMessageOpt("-rpcasyncthreads=", strprintf(_("Set the number of threads to service Async RPC calls (default: %d)"), 1)); - if (mode == HMM_BITCOIND) { strUsage += HelpMessageGroup(_("Metrics Options (only if -daemon and -printtoconsole are not set):")); strUsage += HelpMessageOpt("-showmetrics", _("Show metrics on stdout (default: 1 if running in a console, 0 otherwise)")); @@ -1456,10 +1451,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) } //fprintf(stderr,"%s tik15\n", __FUNCTION__); - // These must be disabled for now, they are buggy and we probably don't - // want any of libsnark's profiling in production anyway. - libsnark::inhibit_profiling_info = true; - libsnark::inhibit_profiling_counters = true; if ( KOMODO_NSPV_FULLNODE ) { diff --git a/src/zcash/JoinSplit.cpp b/src/zcash/JoinSplit.cpp index ac59ccfa3..d24f2174f 100644 --- a/src/zcash/JoinSplit.cpp +++ b/src/zcash/JoinSplit.cpp @@ -10,10 +10,6 @@ #include #include #include -#include -#include -#include -#include #include "tinyformat.h" #include "sync.h" #include "amount.h" @@ -321,51 +317,7 @@ public: return proof; } - if (!computeProof) { - return PHGRProof(); - } - - protoboard pb; - { - joinsplit_gadget g(pb); - g.generate_r1cs_constraints(); - g.generate_r1cs_witness( - phi, - rt, - h_sig, - inputs, - out_notes, - vpub_old, - vpub_new - ); - } - - // The constraint system must be satisfied or there is an unimplemented - // or incorrect sanity check above. Or the constraint system is broken! - assert(pb.is_satisfied()); - - // TODO: These are copies, which is not strictly necessary. - std::vector primary_input = pb.primary_input(); - std::vector aux_input = pb.auxiliary_input(); - - // Swap A and B if it's beneficial (less arithmetic in G2) - // In our circuit, we already know that it's beneficial - // to swap, but it takes so little time to perform this - // estimate that it doesn't matter if we check every time. - pb.constraint_system.swap_AB_if_beneficial(); - - std::ifstream fh(pkPath, std::ios::binary); - - if(!fh.is_open()) { - throw std::runtime_error(strprintf("could not load param file at %s", pkPath)); - } - - return PHGRProof(r1cs_ppzksnark_prover_streaming( - fh, - primary_input, - aux_input, - pb.constraint_system - )); + throw std::invalid_argument("Cannot create non-Groth16 Sprout proofs"); } };