From 83bef3fcbe13414b3b3d8a25bf3c2e65af9fea43 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 15 Nov 2017 10:14:19 +0000 Subject: [PATCH 1/4] Move libsnark from DIST_SUBDIRS into EXTRA_DIST --- src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5b80b724f..e9f10232c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -DIST_SUBDIRS = secp256k1 snark univalue +DIST_SUBDIRS = secp256k1 univalue AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) @@ -553,7 +553,7 @@ CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a *.gcda *.gcno */*.gcno wal DISTCLEANFILES = obj/build.h -EXTRA_DIST = leveldb +EXTRA_DIST = leveldb snark clean-local: -$(MAKE) -C leveldb clean From 8f23c734e6484a9ee37e857c5225202a581d2123 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 15 Nov 2017 14:39:57 +0000 Subject: [PATCH 2/4] Pass correct dependencies path to libsnark from both Gitian and build.sh --- configure.ac | 10 +++++++++- src/Makefile.am | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8cafa452d..8c30efcfe 100644 --- a/configure.ac +++ b/configure.ac @@ -762,6 +762,14 @@ if test x$enable_rust != xno; then RUST_LIBS="-lrustzcash" fi +# 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 + LIBZCASH_LIBS="-lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium -fopenmp $RUST_LIBS" CXXFLAGS_TEMP="$CXXFLAGS" @@ -897,7 +905,7 @@ AC_SUBST(TESTDEFS) AC_SUBST(LEVELDB_TARGET_FLAGS) AC_SUBST(GMP_LIBS) AC_SUBST(GMPXX_LIBS) -AC_SUBST(LIBSNARK_LIBS) +AC_SUBST(LIBSNARK_DEPINST) AC_SUBST(LIBZCASH_LIBS) AC_SUBST(PROTON_LIBS) AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi src/test/buildenv.py]) diff --git a/src/Makefile.am b/src/Makefile.am index e9f10232c..ea745a1f7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,10 +49,10 @@ LIBSNARK_CXXFLAGS = -fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 LIBSNARK_CONFIG_FLAGS = CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1 $(LIBSNARK): $(wildcard snark/src/*) - $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ install PREFIX=$(srcdir)/build DEPINST=$(prefix) $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" + $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ install PREFIX=$(srcdir)/build DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" libsnark-tests: $(wildcard snark/src/*) - $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check PREFIX=$(srcdir)/build DEPINST=$(prefix) $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" + $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check PREFIX=$(srcdir)/build DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" $(LIBUNIVALUE): $(wildcard univalue/lib/*) $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue/ From fee88353885147111bcca69c817a5339abd76109 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 15 Nov 2017 16:49:10 +0000 Subject: [PATCH 3/4] Mark libsnark includes as library includes --- src/gtest/main.cpp | 6 +++--- src/gtest/test_circuit.cpp | 9 +++++---- src/gtest/test_merkletree.cpp | 8 ++++---- src/gtest/test_proofs.cpp | 7 +++---- src/init.cpp | 2 +- src/zcash/CreateJoinSplit.cpp | 3 ++- src/zcash/JoinSplit.cpp | 8 ++++---- src/zcash/Proof.cpp | 10 +++++----- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/gtest/main.cpp b/src/gtest/main.cpp index a0a2e0042..0b6e1ad08 100644 --- a/src/gtest/main.cpp +++ b/src/gtest/main.cpp @@ -1,12 +1,12 @@ #include "gtest/gtest.h" #include "crypto/common.h" #include "pubkey.h" - -#include "libsnark/common/default_types/r1cs_ppzksnark_pp.hpp" -#include "libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp" #include "zcash/JoinSplit.hpp" #include "util.h" +#include +#include + struct ECCryptoClosure { ECCVerifyHandle handle; diff --git a/src/gtest/test_circuit.cpp b/src/gtest/test_circuit.cpp index f8a0416a7..2cc9dbcbb 100644 --- a/src/gtest/test_circuit.cpp +++ b/src/gtest/test_circuit.cpp @@ -7,10 +7,11 @@ #include #include -#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 +#include +#include +#include + #include "zcash/IncrementalMerkleTree.hpp" using namespace libsnark; diff --git a/src/gtest/test_merkletree.cpp b/src/gtest/test_merkletree.cpp index 6bac9ab3c..d603b0aa6 100644 --- a/src/gtest/test_merkletree.cpp +++ b/src/gtest/test_merkletree.cpp @@ -19,10 +19,10 @@ #include "zcash/IncrementalMerkleTree.hpp" #include "zcash/util.h" -#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 +#include +#include +#include #include diff --git a/src/gtest/test_proofs.cpp b/src/gtest/test_proofs.cpp index cf097d716..e33b1cc0c 100644 --- a/src/gtest/test_proofs.cpp +++ b/src/gtest/test_proofs.cpp @@ -3,10 +3,9 @@ #include -#include "libsnark/common/default_types/r1cs_ppzksnark_pp.hpp" -#include "libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp" -#include "zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp" -#include "relations/constraint_satisfaction_problems/r1cs/examples/r1cs_examples.hpp" +#include +#include +#include using namespace libzcash; diff --git a/src/init.cpp b/src/init.cpp index fe7f17009..7df31ab1b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -53,7 +53,7 @@ #include #include -#include "libsnark/common/profiling.hpp" +#include #if ENABLE_ZMQ #include "zmq/zmqnotificationinterface.h" diff --git a/src/zcash/CreateJoinSplit.cpp b/src/zcash/CreateJoinSplit.cpp index 7253e9568..bcf9a218e 100644 --- a/src/zcash/CreateJoinSplit.cpp +++ b/src/zcash/CreateJoinSplit.cpp @@ -5,7 +5,8 @@ #include "../util.h" #include "primitives/transaction.h" #include "zcash/JoinSplit.hpp" -#include "libsnark/common/profiling.hpp" + +#include using namespace libzcash; diff --git a/src/zcash/JoinSplit.cpp b/src/zcash/JoinSplit.cpp index ab2059238..2685569d3 100644 --- a/src/zcash/JoinSplit.cpp +++ b/src/zcash/JoinSplit.cpp @@ -10,10 +10,10 @@ #include #include #include -#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 +#include +#include +#include #include "tinyformat.h" #include "sync.h" #include "amount.h" diff --git a/src/zcash/Proof.cpp b/src/zcash/Proof.cpp index 1b2199407..e7264e684 100644 --- a/src/zcash/Proof.cpp +++ b/src/zcash/Proof.cpp @@ -1,11 +1,11 @@ #include "Proof.hpp" -#include -#include - #include "crypto/common.h" -#include "libsnark/common/default_types/r1cs_ppzksnark_pp.hpp" -#include "libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp" + +#include +#include +#include +#include using namespace libsnark; From 051698a05c852793316810d3538fb4a84906d547 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 16 Nov 2017 22:37:38 +0000 Subject: [PATCH 4/4] Add the tar-pax option to automake This enables the tarball generated by "make dist" to contain file names longer than 99 characters. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8c30efcfe..8d18fb2a9 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ dnl faketime breaks configure and is only needed for make. Disable it here. unset FAKETIME dnl Automake init set-up and checks -AM_INIT_AUTOMAKE([no-define subdir-objects foreign]) +AM_INIT_AUTOMAKE([no-define subdir-objects foreign tar-pax]) dnl faketime messes with timestamps and causes configure to be re-run. dnl --disable-maintainer-mode can be used to bypass this.