From 92b42d287e7101fe5c1fb5c8698edd9ec2314d39 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Sun, 23 Sep 2018 06:18:22 -0700 Subject: [PATCH 01/21] Clarify in sendmany/z_sendmany rpc docs that amounts are not floating point --- src/wallet/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 82b98304a..52caac6ac 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -960,7 +960,7 @@ UniValue sendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() < 2 || params.size() > 5) throw runtime_error( "sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" [\"address\",...] )\n" - "\nSend multiple times. Amounts are double-precision floating point numbers." + "\nSend multiple times. Amounts are decimal numbers with at most 8 digits of precision." + HelpRequiringPassphrase() + "\n" "\nArguments:\n" "1. \"fromaccount\" (string, required) MUST be set to the empty string \"\" to represent the default account. Passing any other string will result in an error.\n" @@ -3583,7 +3583,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() < 2 || params.size() > 4) throw runtime_error( "z_sendmany \"fromaddress\" [{\"address\":... ,\"amount\":...},...] ( minconf ) ( fee )\n" - "\nSend multiple times. Amounts are double-precision floating point numbers." + "\nSend multiple times. Amounts are decimal numbers with at most 8 digits of precision." "\nChange generated from a taddr flows to a new taddr address, while change generated from a zaddr returns to itself." "\nWhen sending coinbase UTXOs to a zaddr, change is not allowed. The entire value of the UTXO(s) must be consumed." + strprintf("\nBefore Sapling activates, the maximum number of zaddr outputs is %d due to transaction size limits.\n", Z_SENDMANY_MAX_ZADDR_OUTPUTS_BEFORE_SAPLING) From 92fc29a3f4e08fd4bf5aad1e87190cd19b11b566 Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Mon, 8 Oct 2018 14:23:03 -0600 Subject: [PATCH 02/21] Rename GenerateNewZKey to include Sprout --- src/test/rpc_wallet_tests.cpp | 14 +++++++------- src/wallet/gtest/test_wallet_zkeys.cpp | 12 ++++++------ src/wallet/rpcwallet.cpp | 2 +- src/wallet/wallet.cpp | 6 +++--- src/wallet/wallet.h | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 9f2ad9fe8..38da9814f 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_exportwallet) BOOST_CHECK(addrs.size()==0); // wallet should have one key - auto address = pwalletMain->GenerateNewZKey(); + auto address = pwalletMain->GenerateNewSproutZKey(); BOOST_CHECK(IsValidPaymentAddress(address)); BOOST_ASSERT(boost::get(&address) != nullptr); auto addr = boost::get(address); @@ -603,7 +603,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_importexport) // Make new addresses for the set for (int i=0; iGenerateNewZKey())); + myaddrs.insert(EncodePaymentAddress(pwalletMain->GenerateNewSproutZKey())); } // Verify number of addresses stored in wallet is n1+n2 @@ -956,7 +956,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters) std::vector v (2 * (ZC_MEMO_SIZE+1)); // x2 for hexadecimal string format std::fill(v.begin(),v.end(), 'A'); std::string badmemo(v.begin(), v.end()); - auto pa = pwalletMain->GenerateNewZKey(); + auto pa = pwalletMain->GenerateNewSproutZKey(); std::string zaddr1 = EncodePaymentAddress(pa); BOOST_CHECK_THROW(CallRPC(string("z_sendmany tmRr6yJonqGK23UVhrKuyvTpF8qxQQjKigJ ") + "[{\"address\":\"" + zaddr1 + "\", \"amount\":123.456}]"), runtime_error); @@ -1034,7 +1034,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) // add keys manually BOOST_CHECK_NO_THROW(retValue = CallRPC("getnewaddress")); std::string taddr1 = retValue.get_str(); - auto pa = pwalletMain->GenerateNewZKey(); + auto pa = pwalletMain->GenerateNewSproutZKey(); std::string zaddr1 = EncodePaymentAddress(pa); // there are no utxos to spend @@ -1620,7 +1620,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_shieldcoinbase_internals) mapArgs["-mempooltxinputlimit"] = "1"; // Add keys manually - auto pa = pwalletMain->GenerateNewZKey(); + auto pa = pwalletMain->GenerateNewSproutZKey(); std::string zaddr = EncodePaymentAddress(pa); // Supply 2 inputs when mempool limit is 1 @@ -1745,7 +1745,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_parameters) std::vector v (2 * (ZC_MEMO_SIZE+1)); // x2 for hexadecimal string format std::fill(v.begin(),v.end(), 'A'); std::string badmemo(v.begin(), v.end()); - auto pa = pwalletMain->GenerateNewZKey(); + auto pa = pwalletMain->GenerateNewSproutZKey(); std::string zaddr1 = EncodePaymentAddress(pa); BOOST_CHECK_THROW(CallRPC(string("z_mergetoaddress [\"tmRr6yJonqGK23UVhrKuyvTpF8qxQQjKigJ\"] ") + zaddr1 + " 0.0001 100 100 " + badmemo), runtime_error); @@ -1816,7 +1816,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_internals) // Add keys manually BOOST_CHECK_NO_THROW(retValue = CallRPC("getnewaddress")); MergeToAddressRecipient taddr1(retValue.get_str(), ""); - auto pa = pwalletMain->GenerateNewZKey(); + auto pa = pwalletMain->GenerateNewSproutZKey(); MergeToAddressRecipient zaddr1(EncodePaymentAddress(pa), "DEADBEEF"); // Supply 2 inputs when mempool limit is 1 diff --git a/src/wallet/gtest/test_wallet_zkeys.cpp b/src/wallet/gtest/test_wallet_zkeys.cpp index 0dcec1077..fb819ec49 100644 --- a/src/wallet/gtest/test_wallet_zkeys.cpp +++ b/src/wallet/gtest/test_wallet_zkeys.cpp @@ -105,7 +105,7 @@ TEST(wallet_zkeys_tests, StoreAndLoadSaplingZkeys) { /** * This test covers methods on CWallet - * GenerateNewZKey() + * GenerateNewSproutZKey() * AddSproutZKey() * LoadZKey() * LoadZKeyMetadata() @@ -121,7 +121,7 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) { ASSERT_EQ(0, addrs.size()); // wallet should have one key - auto address = wallet.GenerateNewZKey(); + auto address = wallet.GenerateNewSproutZKey(); ASSERT_NE(boost::get(&address), nullptr); auto addr = boost::get(address); wallet.GetSproutPaymentAddresses(addrs); @@ -236,7 +236,7 @@ TEST(wallet_zkeys_tests, write_zkey_direct_to_db) { ASSERT_EQ(0, addrs.size()); // Add random key to the wallet - auto paymentAddress = wallet.GenerateNewZKey(); + auto paymentAddress = wallet.GenerateNewSproutZKey(); // wallet should have one key wallet.GetSproutPaymentAddresses(addrs); @@ -353,7 +353,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) { ASSERT_EQ(0, addrs.size()); // Add random key to the wallet - auto address = wallet.GenerateNewZKey(); + auto address = wallet.GenerateNewSproutZKey(); ASSERT_NE(boost::get(&address), nullptr); auto paymentAddress = boost::get(address); @@ -368,11 +368,11 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) { ASSERT_TRUE(wallet.EncryptWallet(strWalletPass)); // adding a new key will fail as the wallet is locked - EXPECT_ANY_THROW(wallet.GenerateNewZKey()); + EXPECT_ANY_THROW(wallet.GenerateNewSproutZKey()); // unlock wallet and then add wallet.Unlock(strWalletPass); - auto address2 = wallet.GenerateNewZKey(); + auto address2 = wallet.GenerateNewSproutZKey(); ASSERT_NE(boost::get(&address2), nullptr); auto paymentAddress2 = boost::get(address2); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b85ab8f89..0f95a1b65 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3166,7 +3166,7 @@ UniValue z_getnewaddress(const UniValue& params, bool fHelp) } if (addrType == ADDR_TYPE_SPROUT) { - return EncodePaymentAddress(pwalletMain->GenerateNewZKey()); + return EncodePaymentAddress(pwalletMain->GenerateNewSproutZKey()); } else if (addrType == ADDR_TYPE_SAPLING) { return EncodePaymentAddress(pwalletMain->GenerateNewSaplingZKey()); } else { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3690ed166..05a6cb086 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -82,7 +82,7 @@ const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const } // Generate a new spending key and return its public payment address -libzcash::PaymentAddress CWallet::GenerateNewZKey() +libzcash::PaymentAddress CWallet::GenerateNewSproutZKey() { AssertLockHeld(cs_wallet); // mapSproutZKeyMetadata // TODO: Add Sapling support @@ -91,14 +91,14 @@ libzcash::PaymentAddress CWallet::GenerateNewZKey() // Check for collision, even though it is unlikely to ever occur if (CCryptoKeyStore::HaveSproutSpendingKey(addr)) - throw std::runtime_error("CWallet::GenerateNewZKey(): Collision detected"); + throw std::runtime_error("CWallet::GenerateNewSproutZKey(): Collision detected"); // Create new metadata int64_t nCreationTime = GetTime(); mapSproutZKeyMetadata[addr] = CKeyMetadata(nCreationTime); if (!AddSproutZKey(k)) - throw std::runtime_error("CWallet::GenerateNewZKey(): AddSproutZKey failed"); + throw std::runtime_error("CWallet::GenerateNewSproutZKey(): AddSproutZKey failed"); return addr; } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index e7d30f467..0ff61771e 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1045,7 +1045,7 @@ public: * ZKeys */ //! Generates a new zaddr - libzcash::PaymentAddress GenerateNewZKey(); + libzcash::PaymentAddress GenerateNewSproutZKey(); //! Adds spending key to the store, and saves it to disk bool AddSproutZKey(const libzcash::SproutSpendingKey &key); //! Adds spending key to the store, without saving it to disk (used by LoadWallet) From d6ad8cef2ca578a176c93d4a9c88bd19cb6cd191 Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Mon, 8 Oct 2018 14:52:58 -0600 Subject: [PATCH 03/21] GenerateNewSproutZKey can return a SproutPaymentAddress --- src/test/rpc_wallet_tests.cpp | 6 ++---- src/wallet/gtest/test_wallet_zkeys.cpp | 12 +++--------- src/wallet/wallet.cpp | 4 ++-- src/wallet/wallet.h | 6 +++--- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 38da9814f..31540d7d0 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -404,10 +404,8 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_exportwallet) BOOST_CHECK(addrs.size()==0); // wallet should have one key - auto address = pwalletMain->GenerateNewSproutZKey(); - BOOST_CHECK(IsValidPaymentAddress(address)); - BOOST_ASSERT(boost::get(&address) != nullptr); - auto addr = boost::get(address); + auto addr = pwalletMain->GenerateNewSproutZKey(); + BOOST_CHECK(IsValidPaymentAddress(addr)); pwalletMain->GetSproutPaymentAddresses(addrs); BOOST_CHECK(addrs.size()==1); diff --git a/src/wallet/gtest/test_wallet_zkeys.cpp b/src/wallet/gtest/test_wallet_zkeys.cpp index fb819ec49..5f022c5d5 100644 --- a/src/wallet/gtest/test_wallet_zkeys.cpp +++ b/src/wallet/gtest/test_wallet_zkeys.cpp @@ -121,9 +121,7 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) { ASSERT_EQ(0, addrs.size()); // wallet should have one key - auto address = wallet.GenerateNewSproutZKey(); - ASSERT_NE(boost::get(&address), nullptr); - auto addr = boost::get(address); + auto addr = wallet.GenerateNewSproutZKey(); wallet.GetSproutPaymentAddresses(addrs); ASSERT_EQ(1, addrs.size()); @@ -353,9 +351,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) { ASSERT_EQ(0, addrs.size()); // Add random key to the wallet - auto address = wallet.GenerateNewSproutZKey(); - ASSERT_NE(boost::get(&address), nullptr); - auto paymentAddress = boost::get(address); + auto paymentAddress = wallet.GenerateNewSproutZKey(); // wallet should have one key wallet.GetSproutPaymentAddresses(addrs); @@ -372,9 +368,7 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) { // unlock wallet and then add wallet.Unlock(strWalletPass); - auto address2 = wallet.GenerateNewSproutZKey(); - ASSERT_NE(boost::get(&address2), nullptr); - auto paymentAddress2 = boost::get(address2); + auto paymentAddress2 = wallet.GenerateNewSproutZKey(); // Create a new wallet from the existing wallet path CWallet wallet2("wallet_crypted.dat"); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 05a6cb086..e8cfdc44c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -82,10 +82,10 @@ const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const } // Generate a new spending key and return its public payment address -libzcash::PaymentAddress CWallet::GenerateNewSproutZKey() +libzcash::SproutPaymentAddress CWallet::GenerateNewSproutZKey() { AssertLockHeld(cs_wallet); // mapSproutZKeyMetadata - // TODO: Add Sapling support + auto k = SproutSpendingKey::random(); auto addr = k.address(); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 0ff61771e..31f2b0aee 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1042,10 +1042,10 @@ public: void GetKeyBirthTimes(std::map &mapKeyBirth) const; /** - * ZKeys + * Sprout ZKeys */ - //! Generates a new zaddr - libzcash::PaymentAddress GenerateNewSproutZKey(); + //! Generates a new Sprout zaddr + libzcash::SproutPaymentAddress GenerateNewSproutZKey(); //! Adds spending key to the store, and saves it to disk bool AddSproutZKey(const libzcash::SproutSpendingKey &key); //! Adds spending key to the store, without saving it to disk (used by LoadWallet) From 6829be190207d56cade0e2b0f8f889590f53a0ac Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Mon, 8 Oct 2018 16:25:29 -0600 Subject: [PATCH 04/21] Remove unnecessary call to IsValidPaymentAddress --- src/test/rpc_wallet_tests.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 31540d7d0..d629d9adc 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -404,8 +404,7 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_exportwallet) BOOST_CHECK(addrs.size()==0); // wallet should have one key - auto addr = pwalletMain->GenerateNewSproutZKey(); - BOOST_CHECK(IsValidPaymentAddress(addr)); + libzcash::SproutPaymentAddress addr = pwalletMain->GenerateNewSproutZKey(); pwalletMain->GetSproutPaymentAddresses(addrs); BOOST_CHECK(addrs.size()==1); From 56765e24cb965527e3287225dfbba9e360320a7b Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 10 Oct 2018 17:30:58 -0700 Subject: [PATCH 05/21] Add test to verify final sapling root in block header is updated. --- qa/pull-tester/rpc-tests.sh | 1 + qa/rpc-tests/finalsaplingroot.py | 131 +++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100755 qa/rpc-tests/finalsaplingroot.py diff --git a/qa/pull-tester/rpc-tests.sh b/qa/pull-tester/rpc-tests.sh index e8d8a0093..f53e0448c 100755 --- a/qa/pull-tester/rpc-tests.sh +++ b/qa/pull-tester/rpc-tests.sh @@ -68,6 +68,7 @@ testScripts=( 'p2p_txexpiry_dos.py' 'p2p_node_bloom.py' 'regtest_signrawtransaction.py' + 'finalsaplingroot.py' ); testScriptsExt=( 'getblocktemplate_longpoll.py' diff --git a/qa/rpc-tests/finalsaplingroot.py b/qa/rpc-tests/finalsaplingroot.py new file mode 100755 index 000000000..106bcbf45 --- /dev/null +++ b/qa/rpc-tests/finalsaplingroot.py @@ -0,0 +1,131 @@ +#!/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.test_framework import BitcoinTestFramework +from test_framework.util import ( + assert_equal, + connect_nodes_bi, + initialize_chain_clean, + start_nodes, + wait_and_assert_operationid_status, +) + +from decimal import Decimal + +SAPLING_TREE_EMPTY_ROOT = "3e49b5f954aa9d3545bc6c37744661eea48d7c34e3000d82b7f0010c30f4c2fb" +NULL_FIELD = "0000000000000000000000000000000000000000000000000000000000000000" + +# Verify block header field 'hashFinalSaplingRoot' (returned in rpc as 'finalsaplingroot') +# is updated when Sapling transactions with outputs (commitments) are mined into a block. +class FinalSaplingRootTest(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): + self.nodes = start_nodes(4, self.options.tmpdir, extra_args=[[ + '-nuparams=5ba81b19:100', # Overwinter + '-nuparams=76b809bb:200', # Sapling + '-txindex' # Avoid JSONRPC error: No information available about transaction + ]] * 4 ) + connect_nodes_bi(self.nodes,0,1) + connect_nodes_bi(self.nodes,1,2) + connect_nodes_bi(self.nodes,0,2) + connect_nodes_bi(self.nodes,0,3) + self.is_network_split=False + self.sync_all() + + def run_test(self): + # Activate Overwinter and Sapling + self.nodes[0].generate(200) + self.sync_all() + + # Verfify genesis block contains null field for what is now called the final sapling root field. + blk = self.nodes[0].getblock("0") + assert_equal(blk["finalsaplingroot"], NULL_FIELD) + + # Verify all generated blocks contain the empty root of the Sapling tree. + blockcount = self.nodes[0].getblockcount() + for height in xrange(1, blockcount + 1): + blk = self.nodes[0].getblock(str(height)) + assert_equal(blk["finalsaplingroot"], SAPLING_TREE_EMPTY_ROOT) + + # Node 0 shields some funds + taddr0 = self.nodes[0].getnewaddress() + saplingAddr0 = self.nodes[0].z_getnewaddress('sapling') + recipients = [] + recipients.append({"address": saplingAddr0, "amount": Decimal('20')}) + myopid = self.nodes[0].z_sendmany(taddr0, recipients, 1, 0) + mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid) + + self.sync_all() + self.nodes[0].generate(1) + self.sync_all() + + # Verify the final Sapling root has changed + blk = self.nodes[0].getblock("201") + root = blk["finalsaplingroot"] + assert(root is not SAPLING_TREE_EMPTY_ROOT) + assert(root is not NULL_FIELD) + + # Verify there is a Sapling output description (its commitment was added to tree) + result = self.nodes[0].getrawtransaction(mytxid, 1) + assert_equal(len(result["vShieldedOutput"]), 1) + + # Mine an empty block and verify the final Sapling root does not change + self.sync_all() + self.nodes[0].generate(1) + self.sync_all() + assert_equal(root, self.nodes[0].getblock("202")["finalsaplingroot"]) + + # Mine a block with a transparent tx and verify the final Sapling root does not change + taddr1 = self.nodes[1].getnewaddress() + self.nodes[0].sendtoaddress(taddr1, Decimal("1.23")) + + self.sync_all() + self.nodes[0].generate(1) + self.sync_all() + + assert_equal(len(self.nodes[0].getblock("203")["tx"]), 2) + assert_equal(self.nodes[1].z_getbalance(taddr1), Decimal("1.23")) + assert_equal(root, self.nodes[0].getblock("203")["finalsaplingroot"]) + + # Mine a block with a Sprout shielded tx and verify the final Sapling root does not change + zaddr1 = self.nodes[1].z_getnewaddress() + recipients = [] + recipients.append({"address": zaddr1, "amount": Decimal('10')}) + myopid = self.nodes[0].z_sendmany(taddr0, recipients, 1, 0) + wait_and_assert_operationid_status(self.nodes[0], myopid) + + self.sync_all() + self.nodes[0].generate(1) + self.sync_all() + + assert_equal(len(self.nodes[0].getblock("204")["tx"]), 2) + assert_equal(self.nodes[1].z_getbalance(zaddr1), Decimal("10")) + assert_equal(root, self.nodes[0].getblock("204")["finalsaplingroot"]) + + # Mine a block with a Sapling shielded tx and verify the final Sapling root changes + saplingAddr1 = self.nodes[1].z_getnewaddress("sapling") + recipients = [] + recipients.append({"address": saplingAddr1, "amount": Decimal('12.34')}) + myopid = self.nodes[0].z_sendmany(saplingAddr0, recipients, 1, 0) + mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid) + + self.sync_all() + self.nodes[0].generate(1) + self.sync_all() + + assert_equal(len(self.nodes[0].getblock("205")["tx"]), 2) + assert_equal(self.nodes[1].z_getbalance(saplingAddr1), Decimal("12.34")) + assert(root is not self.nodes[0].getblock("205")["finalsaplingroot"]) + + # Verify there is a Sapling output description (its commitment was added to tree) + result = self.nodes[0].getrawtransaction(mytxid, 1) + assert_equal(len(result["vShieldedOutput"]), 2) # there is Sapling shielded change + +if __name__ == '__main__': + FinalSaplingRootTest().main() From eb0bf237515b004048ee08d610eb77f2a753977e Mon Sep 17 00:00:00 2001 From: arielgabizon Date: Thu, 11 Oct 2018 15:22:20 +0200 Subject: [PATCH 06/21] add test for sapling spend with transparent recipient --- qa/rpc-tests/finalsaplingroot.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/qa/rpc-tests/finalsaplingroot.py b/qa/rpc-tests/finalsaplingroot.py index 106bcbf45..83f16edec 100755 --- a/qa/rpc-tests/finalsaplingroot.py +++ b/qa/rpc-tests/finalsaplingroot.py @@ -108,7 +108,7 @@ class FinalSaplingRootTest(BitcoinTestFramework): assert_equal(self.nodes[1].z_getbalance(zaddr1), Decimal("10")) assert_equal(root, self.nodes[0].getblock("204")["finalsaplingroot"]) - # Mine a block with a Sapling shielded tx and verify the final Sapling root changes + # Mine a block with a Sapling shielded recipient and verify the final Sapling root changes saplingAddr1 = self.nodes[1].z_getnewaddress("sapling") recipients = [] recipients.append({"address": saplingAddr1, "amount": Decimal('12.34')}) @@ -127,5 +127,24 @@ class FinalSaplingRootTest(BitcoinTestFramework): result = self.nodes[0].getrawtransaction(mytxid, 1) assert_equal(len(result["vShieldedOutput"]), 2) # there is Sapling shielded change + # Mine a block with a Sapling shielded sender and transparent recipient and verify the final Sapling root doesn't change + taddr2 = self.nodes[0].getnewaddress() + recipients = [] + recipients.append({"address": taddr2, "amount": Decimal('12.34')}) + myopid = self.nodes[1].z_sendmany(saplingAddr1, recipients, 1, 0) + mytxid = wait_and_assert_operationid_status(self.nodes[1], myopid) + + self.sync_all() + self.nodes[0].generate(1) + self.sync_all() + + assert_equal(len(self.nodes[0].getblock("206")["tx"]), 2) + assert_equal(self.nodes[0].z_getbalance(taddr2), Decimal("12.34")) + + blk = self.nodes[0].getblock("206") + root = blk["finalsaplingroot"] + assert_equal(root, self.nodes[0].getblock("205")["finalsaplingroot"]) + + if __name__ == '__main__': FinalSaplingRootTest().main() From 5707edd4b123d155dd890aea9166aac81a37883e Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Sun, 14 Oct 2018 06:37:25 -0700 Subject: [PATCH 07/21] Fix another instance of incorrectly saying amount is double precision, and s/ZC/ZEC/ --- doc/payment-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/payment-api.md b/doc/payment-api.md index 5d43ed4ac..9ae6c57c9 100644 --- a/doc/payment-api.md +++ b/doc/payment-api.md @@ -39,7 +39,7 @@ RPC parameter conventions: * taddr : Transparent address * zaddr : Private address * address : Accepts both private and transparent addresses. -* amount : JSON format double-precision number with 1 ZC expressed as 1.00000000. +* amount : JSON format decimal number with at most 8 digits of precision, with 1 ZEC expressed as 1.00000000. * memo : Metadata expressed in hexadecimal format. Limited to 512 bytes, the current size of the memo field of a private transaction. Zero padding is automatic. ### Accounting From 3332fb00e4b7b18fd9b504a1f99ac0e2e247c24d Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 14 Oct 2018 13:38:49 -0700 Subject: [PATCH 08/21] Update release-notes.md for clarity. --- doc/release-notes.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 0ae3ea63a..fc7621fe4 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -6,11 +6,11 @@ Notable changes Enabled Sapling features for mainnet ------------------------------------ -This release adds significant support for Sapling to the wallet and RPC interface. Sapling will activate at block 419200, which is expected to be mined on the 28th of October 2018. Users running v2.0.0 nodes (which are consensus-compatible with Sapling) will follow the network upgrade, but must upgrade to v2.0.1 in order to send Sapling shielded transactions. +This release adds significant support for Sapling to the wallet and RPC interface. Sapling will activate at block 419200, which is expected to be mined on the 28th of October 2018. Users running v2.0.0 nodes (which are consensus-compatible with Sapling) will follow the network upgrade, but must upgrade to v2.0.1 in order to send or receive Sapling shielded transactions. Minimum Difficulty Blocks allowed on testnet -------------------------------------------- -Sapling activated on testnet at block 280000. Users running v2.0.1 nodes no longer need to specify `-experimentalfeatures` and `-developersapling` to use Sapling functionality on testnet. Users running v2.0.0 nodes should upgrade to v2.0.1 which introduces a consensus rule change to allow minimum difficulty blocks to be mined from block 299188, thereby splitting the chain. +Sapling activated on testnet at block 280000. Users running v2.0.0 nodes should upgrade to v2.0.1 which introduces a consensus rule change to allow minimum difficulty blocks to be mined from block 299188, thereby splitting the chain. In addition, users running v2.0.1 nodes no longer need to specify `-experimentalfeatures` and `-developersapling` to use Sapling functionality on testnet. [Pull request](https://github.com/zcash/zcash/pull/3559) @@ -32,4 +32,5 @@ Fix Signing Raw Transactions with Unsynced Offline Nodes -------------------------------------------------------- With v2.0.0, in `signrawtransaction` the consensus branch ID (which is used to construct the transaction) was estimated using the chain height. With v2.0.1 this has been improved by also considering the `APPROX_RELEASE_HEIGHT` of the release, and a new parameter to allow the caller to manually override the consensus branch ID that zcashd will use. -[Pull request](https://github.com/zcash/zcash/pull/3520) \ No newline at end of file +[Pull request](https://github.com/zcash/zcash/pull/3520) + From 0cabb007ae3a7c5d00dc17264af307f6f8f43397 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 14 Oct 2018 13:39:40 -0700 Subject: [PATCH 09/21] make-release.py: Versioning changes for 2.0.1. --- README.md | 2 +- configure.ac | 2 +- contrib/gitian-descriptors/gitian-linux.yml | 2 +- src/clientversion.h | 2 +- src/deprecation.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8271e4731..036c9f0f1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Zcash 2.0.1-rc1 +Zcash 2.0.1 =========== diff --git a/configure.ac b/configure.ac index 4cbd38b18..41b0d9aa9 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 2) define(_CLIENT_VERSION_MINOR, 0) define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 25) +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))) define(_CLIENT_VERSION_IS_RELEASE, true) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index aab968337..c619cf270 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "zcash-2.0.1-rc1" +name: "zcash-2.0.1" enable_cache: true distro: "debian" suites: diff --git a/src/clientversion.h b/src/clientversion.h index ed6e89048..111a4051a 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -18,7 +18,7 @@ #define CLIENT_VERSION_MAJOR 2 #define CLIENT_VERSION_MINOR 0 #define CLIENT_VERSION_REVISION 1 -#define CLIENT_VERSION_BUILD 25 +#define CLIENT_VERSION_BUILD 50 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/deprecation.h b/src/deprecation.h index 74e216616..91d853908 100644 --- a/src/deprecation.h +++ b/src/deprecation.h @@ -8,7 +8,7 @@ // Deprecation policy: // * Shut down 16 weeks' worth of blocks after the estimated release block height. // * A warning is shown during the 2 weeks' worth of blocks prior to shut down. -static const int APPROX_RELEASE_HEIGHT = 407600; +static const int APPROX_RELEASE_HEIGHT = 411500; static const int WEEKS_UNTIL_DEPRECATION = 16; static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 24 * 24); From 6282e3ed2ab4db9fd9cf57ca0f0c49f978ec9963 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 14 Oct 2018 13:40:30 -0700 Subject: [PATCH 10/21] make-release.py: Updated manpages for 2.0.1. --- doc/man/zcash-cli.1 | 6 +++--- doc/man/zcash-tx.1 | 6 +++--- doc/man/zcashd.1 | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/man/zcash-cli.1 b/doc/man/zcash-cli.1 index 50a69cbe5..c1bd12a78 100644 --- a/doc/man/zcash-cli.1 +++ b/doc/man/zcash-cli.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH ZCASH-CLI "1" "October 2018" "zcash-cli v2.0.1-rc1" "User Commands" +.TH ZCASH-CLI "1" "October 2018" "zcash-cli v2.0.1" "User Commands" .SH NAME -zcash-cli \- manual page for zcash-cli v2.0.1-rc1 +zcash-cli \- manual page for zcash-cli v2.0.1 .SH DESCRIPTION -Zcash RPC client version v2.0.1\-rc1 +Zcash RPC client version v2.0.1 .PP In order to ensure you are adequately protecting your privacy when using Zcash, please see . diff --git a/doc/man/zcash-tx.1 b/doc/man/zcash-tx.1 index 1dd3f9ec7..110f79de7 100644 --- a/doc/man/zcash-tx.1 +++ b/doc/man/zcash-tx.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH ZCASH-TX "1" "October 2018" "zcash-tx v2.0.1-rc1" "User Commands" +.TH ZCASH-TX "1" "October 2018" "zcash-tx v2.0.1" "User Commands" .SH NAME -zcash-tx \- manual page for zcash-tx v2.0.1-rc1 +zcash-tx \- manual page for zcash-tx v2.0.1 .SH DESCRIPTION -Zcash zcash\-tx utility version v2.0.1\-rc1 +Zcash zcash\-tx utility version v2.0.1 .SS "Usage:" .TP zcash\-tx [options] [commands] diff --git a/doc/man/zcashd.1 b/doc/man/zcashd.1 index 6a2b38e22..3900a29c3 100644 --- a/doc/man/zcashd.1 +++ b/doc/man/zcashd.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH ZCASHD "1" "October 2018" "zcashd v2.0.1-rc1" "User Commands" +.TH ZCASHD "1" "October 2018" "zcashd v2.0.1" "User Commands" .SH NAME -zcashd \- manual page for zcashd v2.0.1-rc1 +zcashd \- manual page for zcashd v2.0.1 .SH DESCRIPTION -Zcash Daemon version v2.0.1\-rc1 +Zcash Daemon version v2.0.1 .PP In order to ensure you are adequately protecting your privacy when using Zcash, please see . From 472f7fa8733ab57ca17ca352effaab366575f304 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 14 Oct 2018 13:40:30 -0700 Subject: [PATCH 11/21] make-release.py: Updated release notes and changelog for 2.0.1. --- contrib/debian/changelog | 6 + doc/authors.md | 25 +- doc/release-notes.md | 30 --- doc/release-notes/release-notes-2.0.1.md | 276 +++++++++++++++++++++++ 4 files changed, 296 insertions(+), 41 deletions(-) create mode 100644 doc/release-notes/release-notes-2.0.1.md diff --git a/contrib/debian/changelog b/contrib/debian/changelog index d36688954..1dbe1cc0d 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -1,3 +1,9 @@ +zcash (2.0.1) stable; urgency=medium + + * 2.0.1 release. + + -- Zcash Company Sun, 14 Oct 2018 13:40:30 -0700 + zcash (2.0.1~rc1) stable; urgency=medium * 2.0.1-rc1 release. diff --git a/doc/authors.md b/doc/authors.md index e4dfec076..1782e7ecf 100644 --- a/doc/authors.md +++ b/doc/authors.md @@ -1,43 +1,46 @@ Zcash Contributors ================== -Jack Grigg (760) -Simon Liu (352) -Sean Bowe (263) +Jack Grigg (843) +Simon Liu (420) +Sean Bowe (264) Daira Hopwood (110) -Jay Graber (84) +Jay Graber (89) Wladimir J. van der Laan (81) Taylor Hornby (65) +Eirik Ogilvie-Wigley (60) +Jonas Schnelli (58) Nathan Wilcox (56) -Jonas Schnelli (55) Pieter Wuille (50) Kevin Gallagher (38) -Eirik Ogilvie-Wigley (36) Cory Fields (35) syd (15) Matt Corallo (13) +Larry Ruane (11) +mdr0id (10) Paige Peterson (10) MarcoFalke (10) +Jonathan "Duke" Leto (10) nomnombtc (9) -Jonathan "Duke" Leto (9) kozyilmaz (8) fanquake (8) Jeff Garzik (7) Gregory Maxwell (7) Ariel Gabizon (7) Luke Dashjr (6) -Larry Ruane (6) +David Mercer (6) Daniel Cousens (6) Pavel Janík (5) Karl-Johan Alm (5) Johnathan Corgan (5) +WO (4) Philip Kaufmann (4) Peter Todd (4) Patrick Strateman (4) +Marius Kjærstad (4) João Barbosa (4) Jorge Timón (4) Duke Leto (4) -David Mercer (4) lpescher (3) Suhas Daftuar (3) Per Grön (3) @@ -65,6 +68,7 @@ Kaz Wesley (2) Joe Turgeon (2) Jack Gavigan (2) ITH4Coinomia (2) +George Tankersley (2) Gavin Andresen (2) Brad Miller (2) Bjorn Hjortsberg (2) @@ -74,7 +78,6 @@ zathras-crypto (1) unsystemizer (1) practicalswift (1) mrbandrews (1) -mdr0id (1) kazcw (1) jc (1) isle2983 (1) @@ -84,6 +87,7 @@ dexX7 (1) daniel (1) calebogden (1) ayleph (1) +Za Wilcox (1) Tom Ritter (1) Tom Harding (1) Stephen (1) @@ -103,7 +107,6 @@ Murilo Santana (1) Maxwell Gubler (1) Matt Quinn (1) Mark Friedenbach (1) -Marius Kjærstad (1) Louis Nyffenegger (1) Leo Arias (1) Lauda (1) diff --git a/doc/release-notes.md b/doc/release-notes.md index fc7621fe4..a29094b51 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -4,33 +4,3 @@ release-notes at release time) Notable changes =============== -Enabled Sapling features for mainnet ------------------------------------- -This release adds significant support for Sapling to the wallet and RPC interface. Sapling will activate at block 419200, which is expected to be mined on the 28th of October 2018. Users running v2.0.0 nodes (which are consensus-compatible with Sapling) will follow the network upgrade, but must upgrade to v2.0.1 in order to send or receive Sapling shielded transactions. - -Minimum Difficulty Blocks allowed on testnet --------------------------------------------- -Sapling activated on testnet at block 280000. Users running v2.0.0 nodes should upgrade to v2.0.1 which introduces a consensus rule change to allow minimum difficulty blocks to be mined from block 299188, thereby splitting the chain. In addition, users running v2.0.1 nodes no longer need to specify `-experimentalfeatures` and `-developersapling` to use Sapling functionality on testnet. - -[Pull request](https://github.com/zcash/zcash/pull/3559) - -Hierarchical Deterministic Key Generation for Sapling ------------------------------------------------------ -All Sapling addresses will use hierarchical deterministic key generation -according to ZIP 32 (keypath m/32'/133'/k' on mainnet). Transparent and -Sprout addresses will still use traditional key generation. - -Backups of HD wallets, regardless of when they have been created, can -therefore be used to re-generate all possible Sapling private keys, even the -ones which haven't already been generated during the time of the backup. -Regular backups are still necessary, however, in order to ensure that -transparent and Sprout addresses are not lost. - -[Pull request](https://github.com/zcash/zcash/pull/3492), [ZIP 32](https://github.com/zcash/zips/blob/master/zip-0032.mediawiki) - -Fix Signing Raw Transactions with Unsynced Offline Nodes --------------------------------------------------------- -With v2.0.0, in `signrawtransaction` the consensus branch ID (which is used to construct the transaction) was estimated using the chain height. With v2.0.1 this has been improved by also considering the `APPROX_RELEASE_HEIGHT` of the release, and a new parameter to allow the caller to manually override the consensus branch ID that zcashd will use. - -[Pull request](https://github.com/zcash/zcash/pull/3520) - diff --git a/doc/release-notes/release-notes-2.0.1.md b/doc/release-notes/release-notes-2.0.1.md new file mode 100644 index 000000000..b4dad7c25 --- /dev/null +++ b/doc/release-notes/release-notes-2.0.1.md @@ -0,0 +1,276 @@ +Notable changes +=============== + +Enabled Sapling features for mainnet +------------------------------------ +This release adds significant support for Sapling to the wallet and RPC interface. Sapling will activate at block 419200, which is expected to be mined on the 28th of October 2018. Users running v2.0.0 nodes (which are consensus-compatible with Sapling) will follow the network upgrade, but must upgrade to v2.0.1 in order to send or receive Sapling shielded transactions. + +Minimum Difficulty Blocks allowed on testnet +-------------------------------------------- +Sapling activated on testnet at block 280000. Users running v2.0.0 nodes should upgrade to v2.0.1 which introduces a consensus rule change to allow minimum difficulty blocks to be mined from block 299188, thereby splitting the chain. In addition, users running v2.0.1 nodes no longer need to specify `-experimentalfeatures` and `-developersapling` to use Sapling functionality on testnet. + +[Pull request](https://github.com/zcash/zcash/pull/3559) + +Hierarchical Deterministic Key Generation for Sapling +----------------------------------------------------- +All Sapling addresses will use hierarchical deterministic key generation +according to ZIP 32 (keypath m/32'/133'/k' on mainnet). Transparent and +Sprout addresses will still use traditional key generation. + +Backups of HD wallets, regardless of when they have been created, can +therefore be used to re-generate all possible Sapling private keys, even the +ones which haven't already been generated during the time of the backup. +Regular backups are still necessary, however, in order to ensure that +transparent and Sprout addresses are not lost. + +[Pull request](https://github.com/zcash/zcash/pull/3492), [ZIP 32](https://github.com/zcash/zips/blob/master/zip-0032.mediawiki) + +Fix Signing Raw Transactions with Unsynced Offline Nodes +-------------------------------------------------------- +With v2.0.0, in `signrawtransaction` the consensus branch ID (which is used to construct the transaction) was estimated using the chain height. With v2.0.1 this has been improved by also considering the `APPROX_RELEASE_HEIGHT` of the release, and a new parameter to allow the caller to manually override the consensus branch ID that zcashd will use. + +[Pull request](https://github.com/zcash/zcash/pull/3520) + + +Changelog +========= + +David Mercer (2): + libsnark: convert long long and unsigned long to C++11 fixed-width types + libsnark: convert 0ul to UINT64_C(0) + +Eirik Ogilvie-Wigley (24): + Rename map to include sprout + Add sapling spending keys to z_exportwallet + Rename AddZKey to include sprout + Move AddSpendingKeyToWallet + Return more information when adding a spending key + Add sapling support to z_importwallet + Export comment on HDSeed and fingerprint with wallet + Export zip32 metadata with sapling keys + Don't export empty zip32 metadata + Allow more information to be returned when an async rpc fails + Use utility method to wait for async operations + Remove unneeded semicolons + Remove unused imports + Allow passing timeout parameter to wait_and_assert_operationid_status + Add test for signing raw transactions offline + Incorporate APPROX_RELEASE_HEIGHT when determining what consensus branch to sign with + Allow passing branchId when calling signrawtransaction + Remove unused import + Address need not be optional when adding sapling keys + Use max priority for all shielded transfers + Move FIXME comment to where the fix should happen + Add newly discovered sapling addresses to the wallet + Fix HDSeed comment + Better error message when sending to both sprout and sapling + +George Tankersley (2): + Refactor ContextualCheckBlock tests (#3187) + Refactor ContextualCheckBlock tests + +Jack Grigg (83): + [ci-workers] Install Python modules in a virtualenv + [ci-workers] Handle user home directories outside /home + [ci-workers] Handle ansible_processor being either a string or a list + [ci-workers] Add support for MacOSX + [ci-workers] Add a tag for updating dependencies + [ci-workers] Add curl and cmake to dependencies + [ci-workers] README cleanups + [ci-workers] Add pkg-config to general dependencies + depends: Correctly configure Rust when cross-compiling + depends: Configure librustzcash for cross-compiling + depends: Fix BDB naming issue when cross-compiling + zcutil/build.sh: Use $HOST to specify the depends prefix + configure: Don't require RELRO and BIND_NOW when cross-compiling + Measure Windows console size for metrics UI + Use -O1 for darwin and mingw32 release builds + Clean up libzcash CPPFLAGS, CXXFLAGS, and LDFLAGS + zcutil/build.sh: Use config.site to set default ./configure settings + zcutil/build.sh: Remove --enable-werror from default configuration + Pass correct compiler, linker, and flags into libsnark + Use boost::filesystem::path::string() instead of path::native() + Metrics UI: Enable virtual terminal sequence processing on Windows + Metrics UI: Tell Windows users how to stop zcashd + depends: Pass correct compiler, linker, and flags into googletest + configure: Don't add -ldl to RUST_LIBS for mingw32 + test: Fix comment in WalletTests.FindMySaplingNotes + Add Sapling support to GetFilteredNotes() and GetUnspentFilteredNotes() + Add Sapling support to z_getbalance and z_gettotalbalance + Metrics UI: Fall back to 80 cols if GetConsoleScreenBufferInfo() fails + libsnark: Adjust SHA256 K value type to match the constant + libsnark: Use mp_limb_t cast instead of uint64_t when masking bigint.data + libsnark: Fix stale comment + rpc: Clarify Sprout shielded addresses in help text + rpc: Clarify ivk balance issues in help text + Move GetSpendingKeyForPaymentAddress visitor into wallet.h + wallet: Add HaveSpendingKeyForPaymentAddress visitor + rpcwallet: Add TransactionBuilder argument to AsyncRPCOperation_sendmany + rpcwallet: Prevent use of both Sprout and Sapling addresses in z_sendmany + rpcwallet: Add Sapling support to z_sendmany + Define additional booleans for readability + Ensure SCOPED_TRACE falls out of scope when necessary + Revert NU activation heights in reverse order + Fix test after refactor to check bacd-cb-height rule on a genesis block + Rename GetFirstBlockTransaction() to GetFirstBlockCoinbaseTx() + libsnark: Force constants used in test comparisons to be unsigned + libsnark: Use format macro constants for printing fixed-width values + Rename z_inputs_ to z_sprout_inputs_ + Minor cleanups + Fix RPC test that checks exact wording of cleaned-up error message + Fix file permissions of wallet_sapling RPC test + Update librustzcash with ZIP 32 APIs + ZIP 32 Sapling structs + Store HDSeed in CBasicKeyStore + Store HDSeed in CCryptoKeyStore + wallet: Store HDSeed and chain data + wallet: Store Sapling key metadata indexed by ivk + wallet: Switch from SaplingSpendingKey to SaplingExtendedSpendingKey + init: Generate a new HD seed on startup + wallet: Comment out HDSeed and CHDChain persistence to disk + Add ZIP 32 usage to release notes + wallet: Don't allow an HDSeed to be overwritten + Bugfix: Use time instead of block height for Sapling key metadata + net: Check against the current epoch's version when rejecting nodes + Extract a helper method for finding the next epoch + net: Check against the next epoch's version when evicting peers + net: Check against the current epoch's version when disconnecting peers + qa: Test both Overwinter and Sapling peer management + Use ovk directly in the TransactionBuilder API instead of fvk + Generate an ovk to encrypt outCiphertext for t-addr senders + Revert "Disable Sapling features on mainnet" + Use the correct empty memo for Sapling outputs + Add Sapling support to z_shieldcoinbase + Revert "Get rid of consensus.fPowAllowMinDifficultyBlocks." + Revert "Remove testnet-only difficulty rules" + Allow minimum-difficulty blocks on testnet and regtest + Only enable min-difficulty blocks on testnet from a particular height + Update wallet_listreceived test for now-correct empty Sapling memos + Rename min-difficulty flag to remove off-by-one in the name + Explicitly check the min-difficulty flag against boost::none + Position PoW.MinDifficultyRules test after rule activates + Fix pyflakes warnings + Store ExtFVK with encrypted Sapling spending key instead of FVK + Persist Sapling payment address to IVK map + Ignore decoding errors during -zapwallettxes + +Jay Graber (5): + s/jsoutindex/outindex for sapling outputs + z_listunspent sapling support - needs refactor + Add rpc test for sprout txs z_listunspent + Modify comments + Modify GetNullifiersForAddresses for Sapling + +Jonas Schnelli (3): + [Wallet] extend CKeyMetadata with HD keypath Zcash: modified for zip32 + [Wallet] print hd masterkeyid in getwalletinfo Zcash: modified for zip32 + [Wallet] ensure CKeyMetadata.hdMasterKeyID will be cleared during SetNull() Zcash: modified for zip32 + +Jonathan "Duke" Leto (1): + Fix some typos in rpc-tests readme + +Larry Ruane (5): + generalize mininode.py protocol versioning + Test peer banning logic in both pre- and post-initial block download states + Sapling support for z_listreceivedbyaddress + z_listunspent rpc unit test: add testing for Sapling + fix z_listunspent includeWatchonly logic + +Marius Kjærstad (3): + Fix for license not being valid + Update debian package copyright license + Missing comma in debian package copyright license + +Sean Bowe (1): + Check commitment validity within the decryption API for Sapling note plaintexts. + +Simon Liu (68): + Rename FindMyNotes to FindMySproutNotes. + Rename GetNoteNullifier to GetSproutNoteNullifier. + Rename mapNullifiersToNotes to mapSproutNullifiersToNotes. + Rename CWallet::AddToSpends methods for clarity. + Rename mapTxNullifiers to mapTxSproutNullifiers. + Add ivk member variable and equality comparators to SaplingNoteData class. + Update CWallet::MarkAffectedTransactionsDirty() for Sapling. + Update CWallet::UpdatedNoteData() for Sapling. + Create CWallet::AddToSaplingSpends() to track Sapling nullifiers. + Update test to pass in required cm to SaplingNotePlaintext::decrypt(). + Create CWallet::FindMySaplingNotes() + Rename IsFromMe(nullifier) to IsSproutNullifierFromMe(nullifier). + Create CWallet::IsSaplingNullifierFromMe() + Remove dead code in CWalletTx::GetAmounts() as filed in issue #3434. + Cleanup CWalletTx::GetAmounts() for clarity. No-op. + Update CWalletTx::GetAmounts() to return COutputEntry for Sapling valueBalance. + Add caching and updating of Sapling note nullifier. + Update CWallet::IsSpent() to check Sapling nullifiers. + Clean up names of unit tests in gtest/test_wallet.cpp. + Add test for CWalletTx::SetSaplingNoteData() + Iterate over mapSaplingFullViewingKeys with ivk->fvk mapping (1:1). + Refactor IsSpent(nullifier) for Sprout and Sapling domain separation. + Fix code review nits. + Add two new wallet tests: FindMySaplingNotes, SaplingNullifierIsSpent. + Add new wallet test: NavigateFromSaplingNullifierToNote + Add new wallet test: UpdatedSaplingNoteData. + Add new wallet tests: SpentSaplingNoteIsFromMe. + Rename wallet tests for clarity between Sprout and Sapling. + Fix typo in variable name in test. + Fix inaccurate comments in test. + Fix typo in parameter name. + Update CWallet::GetConflicts for Sapling. + Add new wallet test: SetSaplingNoteAddrsInCWalletTx. + Add new wallet test: GetConflictedSaplingNotes + Add new wallet test: MarkAffectedSaplingTransactionsDirty + Update wallet unit tests to revert upgraded network parameters. + Clean up wallet unit tests: replace .value() with .get() for clarity. + Fix comment in CWallet::SyncMetaData. + Refactor: rename setLockedNotes -> setLockedSproutNotes + Refactor: rename UnlockAllNotes -> UnlockAllSproutNotes + Refactor: rename ListLockedNotes -> ListLockedSproutNotes + Add methods to store SaplingOutPoint in setLockedSaplingNotes + Add unit test SaplingNoteLocking + Update comment for test ContextualCheckBlockTest.BlockSproutRulesRejectOtherTx + Add Sapling fields to JSON RPC output using TxToJSON. + Update qa test to check for Sapling related JSON fields. + Closes #3534. Do not use APPROX_RELEASE_HEIGHT to get consensus branch id when in regtest mode. + For #3533. Replace asserts with JSON errors. + Update qa test as offline regtest nodes need branch id passed in. + Fix rebasing of CWallet::GetNullifiersForAddresses + Cleanup to address review comments. + Add test that Sapling shielded transactions have MAX_PRIORITY + Closes #3560. Update Sapling note data correctly when importing a key. + For #3546. Shielded tx with missing inputs are not treated as orphans. + For #3546. Improve estimated tx size for Sapling outputs. + Fix deadlock from calling CWallet::AddSaplingIncomingViewingKey instead of CBasicKeyStore::AddSaplingIncomingViewingKey + Fix file permissions of QA test wallet_persistence.py + Update wallet_persistence test to verify wallet txs are persisted across restarts. + Update wallet_persistence test to verify spending notes after restart. + Resolves Sapling nullifier persistence issue when importing a key. + Update test to verify Sapling nullifiers and witnesses persist correctly. + For #3359. RPCs transferring funds return error if Sapling addresses are used before Sapling activation. + For #3359. Return error if Sapling addresses passed to RPC z_mergetoaddress. + Update mainnet checkpoint for block 410100. + Update release notes for v2.0.1 + Update release-notes.md for clarity. + make-release.py: Versioning changes for 2.0.1. + make-release.py: Updated manpages for 2.0.1. + +WO (4): + Fix a bug of Windows binary + Add an assert for num_bits function + long -> int64_t + The long data type is replaced with int64_t + +Za Wilcox (1): + Revise help output for z_sendmany + +mdr0id (9): + Resolve final edits for README + Revert "wallet: Comment out HDSeed and CHDChain persistence to disk" + Persist Sapling key material in the wallet to disk + Serialize Sapling data in CWalletTx + Adding in rpc wallet sap for test_bitcoin + Add gtest coverage of Sapling wallet persistence + make-release.py: Versioning changes for 2.0.1-rc1. + make-release.py: Updated manpages for 2.0.1-rc1. + make-release.py: Updated release notes and changelog for 2.0.1-rc1. + From 9396b85db85d64192fc87b6441716a05dc96bc9e Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Tue, 9 Oct 2018 09:48:32 -0600 Subject: [PATCH 12/21] Remove unspent note entry structs --- src/wallet/rpcwallet.cpp | 12 ++++++------ src/wallet/wallet.cpp | 12 ++++++------ src/wallet/wallet.h | 27 ++++++--------------------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b85ab8f89..9796f8d19 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2566,17 +2566,17 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) UniValue results(UniValue::VARR); if (zaddrs.size() > 0) { - std::vector sproutEntries; - std::vector saplingEntries; + std::vector sproutEntries; + std::vector saplingEntries; pwalletMain->GetUnspentFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, !fIncludeWatchonly); std::set> nullifierSet = pwalletMain->GetNullifiersForAddresses(zaddrs); - for (CUnspentSproutNotePlaintextEntry & entry : sproutEntries) { + for (auto & entry : sproutEntries) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("txid", entry.jsop.hash.ToString())); obj.push_back(Pair("jsindex", (int)entry.jsop.js )); obj.push_back(Pair("jsoutindex", (int)entry.jsop.n)); - obj.push_back(Pair("confirmations", entry.nHeight)); + obj.push_back(Pair("confirmations", entry.confirmations)); bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get(entry.address)); obj.push_back(Pair("spendable", hasSproutSpendingKey)); obj.push_back(Pair("address", EncodePaymentAddress(entry.address))); @@ -2589,11 +2589,11 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) results.push_back(obj); } - for (UnspentSaplingNoteEntry & entry : saplingEntries) { + for (auto & entry : saplingEntries) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("txid", entry.op.hash.ToString())); obj.push_back(Pair("outindex", (int)entry.op.n)); - obj.push_back(Pair("confirmations", entry.nHeight)); + obj.push_back(Pair("confirmations", entry.confirmations)); libzcash::SaplingIncomingViewingKey ivk; libzcash::SaplingFullViewingKey fvk; pwalletMain->GetSaplingIncomingViewingKey(boost::get(entry.address), ivk); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3690ed166..6a29242fa 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4440,7 +4440,7 @@ void CWallet::GetFilteredNotes( hSig, (unsigned char) j); - sproutEntries.push_back(CSproutNotePlaintextEntry{jsop, pa, plaintext}); + sproutEntries.push_back(CSproutNotePlaintextEntry{jsop, pa, plaintext, wtx.GetDepthInMainChain()}); } catch (const note_decryption_failed &err) { // Couldn't decrypt with this spending key @@ -4495,7 +4495,7 @@ void CWallet::GetFilteredNotes( auto note = notePt.note(nd.ivk).get(); saplingEntries.push_back(SaplingNoteEntry { - op, pa, note, notePt.memo() }); + op, pa, note, notePt.memo(), wtx.GetDepthInMainChain() }); } } } @@ -4503,8 +4503,8 @@ void CWallet::GetFilteredNotes( /* Find unspent notes filtered by payment address, min depth and max depth */ void CWallet::GetUnspentFilteredNotes( - std::vector& sproutEntries, - std::vector& saplingEntries, + std::vector& sproutEntries, + std::vector& saplingEntries, std::set& filterAddresses, int minDepth, int maxDepth, @@ -4560,7 +4560,7 @@ void CWallet::GetUnspentFilteredNotes( hSig, (unsigned char) j); - sproutEntries.push_back(CUnspentSproutNotePlaintextEntry{jsop, pa, plaintext, wtx.GetDepthInMainChain()}); + sproutEntries.push_back(CSproutNotePlaintextEntry{jsop, pa, plaintext, wtx.GetDepthInMainChain()}); } catch (const note_decryption_failed &err) { // Couldn't decrypt with this spending key @@ -4609,7 +4609,7 @@ void CWallet::GetUnspentFilteredNotes( } auto note = notePt.note(nd.ivk).get(); - saplingEntries.push_back(UnspentSaplingNoteEntry { + saplingEntries.push_back(SaplingNoteEntry { op, pa, note, notePt.memo(), wtx.GetDepthInMainChain() }); } } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index e7d30f467..45918a26c 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -309,38 +309,23 @@ public: typedef std::map mapSproutNoteData_t; typedef std::map mapSaplingNoteData_t; -/** Decrypted note and its location in a transaction. */ +/** Decrypted note, its location in a transaction, and number of confirmations. */ struct CSproutNotePlaintextEntry { JSOutPoint jsop; libzcash::SproutPaymentAddress address; libzcash::SproutNotePlaintext plaintext; + int confirmations; }; -/** Decrypted note, location in a transaction, and confirmation height. */ -struct CUnspentSproutNotePlaintextEntry { - JSOutPoint jsop; - libzcash::SproutPaymentAddress address; - libzcash::SproutNotePlaintext plaintext; - int nHeight; -}; - -/** Sapling note and its location in a transaction. */ +/** Sapling note, its location in a transaction, and number of confirmations. */ struct SaplingNoteEntry { SaplingOutPoint op; libzcash::SaplingPaymentAddress address; libzcash::SaplingNote note; std::array memo; -}; - -/** Sapling note, location in a transaction, and confirmation height. */ -struct UnspentSaplingNoteEntry { - SaplingOutPoint op; - libzcash::SaplingPaymentAddress address; - libzcash::SaplingNote note; - std::array memo; - int nHeight; + int confirmations; }; /** A transaction with a merkle branch linking it to the block chain. */ @@ -1305,8 +1290,8 @@ public: bool ignoreUnspendable=true); /* Find unspent notes filtered by payment address, min depth and max depth */ - void GetUnspentFilteredNotes(std::vector& sproutEntries, - std::vector& saplingEntries, + void GetUnspentFilteredNotes(std::vector& sproutEntries, + std::vector& saplingEntries, std::set& filterAddresses, int minDepth=1, int maxDepth=INT_MAX, From ef27d7e4b3e30651c497aa63b529ebebaf1e5c29 Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Tue, 9 Oct 2018 12:19:56 -0600 Subject: [PATCH 13/21] Add functionality from GetUnspentFilteredNotes to GetFilteredNotes --- src/wallet/wallet.cpp | 18 ++++++++++-------- src/wallet/wallet.h | 6 ++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6a29242fa..e600999b6 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4362,7 +4362,7 @@ void CWallet::GetFilteredNotes( std::string address, int minDepth, bool ignoreSpent, - bool ignoreUnspendable) + bool requireSpendingKey) { std::set filterAddresses; @@ -4370,7 +4370,7 @@ void CWallet::GetFilteredNotes( filterAddresses.insert(DecodePaymentAddress(address)); } - GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, ignoreSpent, ignoreUnspendable); + GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, INT_MAX, ignoreSpent, requireSpendingKey); } /** @@ -4382,8 +4382,10 @@ void CWallet::GetFilteredNotes( std::vector& saplingEntries, std::set& filterAddresses, int minDepth, + int maxDepth, bool ignoreSpent, - bool ignoreUnspendable) + bool requireSpendingKey, + bool ignoreLocked) { LOCK2(cs_main, cs_wallet); @@ -4391,7 +4393,7 @@ void CWallet::GetFilteredNotes( CWalletTx wtx = p.second; // Filter the transactions before checking for notes - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth) { + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth || wtx.GetDepthInMainChain() > maxDepth) { continue; } @@ -4411,12 +4413,12 @@ void CWallet::GetFilteredNotes( } // skip notes which cannot be spent - if (ignoreUnspendable && !HaveSproutSpendingKey(pa)) { + if (requireSpendingKey && !HaveSproutSpendingKey(pa)) { continue; } // skip locked notes - if (IsLockedNote(jsop)) { + if (ignoreLocked && IsLockedNote(jsop)) { continue; } @@ -4477,7 +4479,7 @@ void CWallet::GetFilteredNotes( } // skip notes which cannot be spent - if (ignoreUnspendable) { + if (requireSpendingKey) { libzcash::SaplingIncomingViewingKey ivk; libzcash::SaplingFullViewingKey fvk; if (!(GetSaplingIncomingViewingKey(pa, ivk) && @@ -4489,7 +4491,7 @@ void CWallet::GetFilteredNotes( // skip locked notes // TODO: Add locking for Sapling notes - // if (IsLockedNote(jsop)) { + // if (ignoreLocked && IsLockedNote(op)) { // continue; // } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 45918a26c..7806ae686 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1279,15 +1279,17 @@ public: std::string address, int minDepth=1, bool ignoreSpent=true, - bool ignoreUnspendable=true); + bool requireSpendingKey=true); /* Find notes filtered by payment addresses, min depth, ability to spend */ void GetFilteredNotes(std::vector& sproutEntries, std::vector& saplingEntries, std::set& filterAddresses, int minDepth=1, + int maxDepth=INT_MAX, bool ignoreSpent=true, - bool ignoreUnspendable=true); + bool requireSpendingKey=true, + bool ignoreLocked=true); /* Find unspent notes filtered by payment address, min depth and max depth */ void GetUnspentFilteredNotes(std::vector& sproutEntries, From e92414f91e63edc5811c47bbda9645012b9b74b3 Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Tue, 9 Oct 2018 12:44:45 -0600 Subject: [PATCH 14/21] Remove GetUnspentFilteredNotes --- src/wallet/rpcwallet.cpp | 2 +- src/wallet/wallet.cpp | 114 --------------------------------------- src/wallet/wallet.h | 8 --- 3 files changed, 1 insertion(+), 123 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9796f8d19..fd128598a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2568,7 +2568,7 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) if (zaddrs.size() > 0) { std::vector sproutEntries; std::vector saplingEntries; - pwalletMain->GetUnspentFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, !fIncludeWatchonly); + pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, true, !fIncludeWatchonly, false); std::set> nullifierSet = pwalletMain->GetNullifiersForAddresses(zaddrs); for (auto & entry : sproutEntries) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e600999b6..76a44afc0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4503,120 +4503,6 @@ void CWallet::GetFilteredNotes( } -/* Find unspent notes filtered by payment address, min depth and max depth */ -void CWallet::GetUnspentFilteredNotes( - std::vector& sproutEntries, - std::vector& saplingEntries, - std::set& filterAddresses, - int minDepth, - int maxDepth, - bool requireSpendingKey) -{ - LOCK2(cs_main, cs_wallet); - - for (auto & p : mapWallet) { - CWalletTx wtx = p.second; - - // Filter the transactions before checking for notes - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth || wtx.GetDepthInMainChain() > maxDepth) { - continue; - } - - for (auto & pair : wtx.mapSproutNoteData) { - JSOutPoint jsop = pair.first; - SproutNoteData nd = pair.second; - SproutPaymentAddress pa = nd.address; - - // skip notes which belong to a different payment address in the wallet - if (!(filterAddresses.empty() || filterAddresses.count(pa))) { - continue; - } - - // skip note which has been spent - if (nd.nullifier && IsSproutSpent(*nd.nullifier)) { - continue; - } - - // skip notes where the spending key is not available - if (requireSpendingKey && !HaveSproutSpendingKey(pa)) { - continue; - } - - int i = jsop.js; // Index into CTransaction.vjoinsplit - int j = jsop.n; // Index into JSDescription.ciphertexts - - // Get cached decryptor - ZCNoteDecryption decryptor; - if (!GetNoteDecryptor(pa, decryptor)) { - // Note decryptors are created when the wallet is loaded, so it should always exist - throw std::runtime_error(strprintf("Could not find note decryptor for payment address %s", EncodePaymentAddress(pa))); - } - - // determine amount of funds in the note - auto hSig = wtx.vjoinsplit[i].h_sig(*pzcashParams, wtx.joinSplitPubKey); - try { - SproutNotePlaintext plaintext = SproutNotePlaintext::decrypt( - decryptor, - wtx.vjoinsplit[i].ciphertexts[j], - wtx.vjoinsplit[i].ephemeralKey, - hSig, - (unsigned char) j); - - sproutEntries.push_back(CSproutNotePlaintextEntry{jsop, pa, plaintext, wtx.GetDepthInMainChain()}); - - } catch (const note_decryption_failed &err) { - // Couldn't decrypt with this spending key - throw std::runtime_error(strprintf("Could not decrypt note for payment address %s", EncodePaymentAddress(pa))); - } catch (const std::exception &exc) { - // Unexpected failure - throw std::runtime_error(strprintf("Error while decrypting note for payment address %s: %s", EncodePaymentAddress(pa), exc.what())); - } - } - - for (auto & pair : wtx.mapSaplingNoteData) { - SaplingOutPoint op = pair.first; - SaplingNoteData nd = pair.second; - - auto maybe_pt = SaplingNotePlaintext::decrypt( - wtx.vShieldedOutput[op.n].encCiphertext, - nd.ivk, - wtx.vShieldedOutput[op.n].ephemeralKey, - wtx.vShieldedOutput[op.n].cm); - assert(static_cast(maybe_pt)); - auto notePt = maybe_pt.get(); - - auto maybe_pa = nd.ivk.address(notePt.d); - assert(static_cast(maybe_pa)); - auto pa = maybe_pa.get(); - - // skip notes which belong to a different payment address in the wallet - if (!(filterAddresses.empty() || filterAddresses.count(pa))) { - continue; - } - - // skip note which has been spent - if (nd.nullifier && IsSaplingSpent(*nd.nullifier)) { - continue; - } - - // skip notes where the spending key is not available - if (requireSpendingKey) { - libzcash::SaplingIncomingViewingKey ivk; - libzcash::SaplingFullViewingKey fvk; - if (!(GetSaplingIncomingViewingKey(pa, ivk) && - GetSaplingFullViewingKey(ivk, fvk) && - HaveSaplingSpendingKey(fvk))) { - continue; - } - } - - auto note = notePt.note(nd.ivk).get(); - saplingEntries.push_back(SaplingNoteEntry { - op, pa, note, notePt.memo(), wtx.GetDepthInMainChain() }); - } - } -} - // // Shielded key and address generalizations // diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 7806ae686..f492657f7 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1290,14 +1290,6 @@ public: bool ignoreSpent=true, bool requireSpendingKey=true, bool ignoreLocked=true); - - /* Find unspent notes filtered by payment address, min depth and max depth */ - void GetUnspentFilteredNotes(std::vector& sproutEntries, - std::vector& saplingEntries, - std::set& filterAddresses, - int minDepth=1, - int maxDepth=INT_MAX, - bool requireSpendingKey=true); }; /** A key allocated from the key pool. */ From 67d2b79783d08507cb9e268111e8dc8c0408f4d4 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 18 Oct 2018 19:10:59 -0700 Subject: [PATCH 15/21] Closes #3467. Add benchmarks for Sapling spends and outputs. Four new benchmarks are added to RPC zcbenchmark: - createsaplingspend - createsaplingoutput - verifysaplingspend - verifysaplingoutput --- src/wallet/rpcwallet.cpp | 8 ++ src/zcbenchmarks.cpp | 158 +++++++++++++++++++++++++++++++++++++++ src/zcbenchmarks.h | 4 + 3 files changed, 170 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d6940aeb7..3d0eaf440 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2800,6 +2800,14 @@ UniValue zc_benchmark(const UniValue& params, bool fHelp) sample_times.push_back(benchmark_loadwallet()); } else if (benchmarktype == "listunspent") { sample_times.push_back(benchmark_listunspent()); + } else if (benchmarktype == "createsaplingspend") { + sample_times.push_back(benchmark_create_sapling_spend()); + } else if (benchmarktype == "createsaplingoutput") { + sample_times.push_back(benchmark_create_sapling_output()); + } else if (benchmarktype == "verifysaplingspend") { + sample_times.push_back(benchmark_verify_sapling_spend()); + } else if (benchmarktype == "verifysaplingoutput") { + sample_times.push_back(benchmark_verify_sapling_output()); } else { throw JSONRPCError(RPC_TYPE_ERROR, "Invalid benchmarktype"); } diff --git a/src/zcbenchmarks.cpp b/src/zcbenchmarks.cpp index bad4ce605..c15df36a0 100644 --- a/src/zcbenchmarks.cpp +++ b/src/zcbenchmarks.cpp @@ -30,6 +30,8 @@ #include "zcash/Zcash.h" #include "zcash/IncrementalMerkleTree.hpp" +#include "zcash/Note.hpp" +#include "librustzcash.h" using namespace libzcash; // This method is based on Shutdown from init.cpp @@ -472,3 +474,159 @@ double benchmark_listunspent() auto unspent = listunspent(params, false); return timer_stop(tv_start); } + +double benchmark_create_sapling_spend() +{ + auto sk = libzcash::SaplingSpendingKey::random(); + auto expsk = sk.expanded_spending_key(); + auto address = sk.default_address(); + SaplingNote note(address, GetRand(MAX_MONEY)); + SaplingMerkleTree tree; + auto maybe_cm = note.cm(); + tree.append(maybe_cm.get()); + auto anchor = tree.root(); + auto witness = tree.witness(); + auto maybe_nf = note.nullifier(expsk.full_viewing_key(), witness.position()); + if (!(maybe_cm && maybe_nf)) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "Could not create note commitment and nullifier"); + } + + CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); + ss << witness.path(); + std::vector witnessChars(ss.begin(), ss.end()); + + uint256 alpha; + librustzcash_sapling_generate_r(alpha.begin()); + + auto ctx = librustzcash_sapling_proving_ctx_init(); + + struct timeval tv_start; + timer_start(tv_start); + + SpendDescription sdesc; + bool result = librustzcash_sapling_spend_proof( + ctx, + expsk.full_viewing_key().ak.begin(), + expsk.nsk.begin(), + note.d.data(), + note.r.begin(), + alpha.begin(), + note.value(), + anchor.begin(), + witnessChars.data(), + sdesc.cv.begin(), + sdesc.rk.begin(), + sdesc.zkproof.data()); + + double t = timer_stop(tv_start); + librustzcash_sapling_proving_ctx_free(ctx); + if (!result) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "librustzcash_sapling_spend_proof() should return true"); + } + return t; +} + +double benchmark_create_sapling_output() +{ + auto sk = libzcash::SaplingSpendingKey::random(); + auto address = sk.default_address(); + + std::array memo; + SaplingNote note(address, GetRand(MAX_MONEY)); + + libzcash::SaplingNotePlaintext notePlaintext(note, memo); + auto res = notePlaintext.encrypt(note.pk_d); + if (!res) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "SaplingNotePlaintext::encrypt() failed"); + } + + auto enc = res.get(); + auto encryptor = enc.second; + + auto ctx = librustzcash_sapling_proving_ctx_init(); + + struct timeval tv_start; + timer_start(tv_start); + + OutputDescription odesc; + bool result = librustzcash_sapling_output_proof( + ctx, + encryptor.get_esk().begin(), + note.d.data(), + note.pk_d.begin(), + note.r.begin(), + note.value(), + odesc.cv.begin(), + odesc.zkproof.begin()); + + double t = timer_stop(tv_start); + librustzcash_sapling_proving_ctx_free(ctx); + if (!result) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "librustzcash_sapling_output_proof() should return true"); + } + return t; +} + +// Verify Sapling spend from testnet +// txid: abbd823cbd3d4e3b52023599d81a96b74817e95ce5bb58354f979156bd22ecc8 +// position: 0 +double benchmark_verify_sapling_spend() +{ + SpendDescription spend; + CDataStream ss(ParseHex("8c6cf86bbb83bf0d075e5bd9bb4b5cd56141577be69f032880b11e26aa32aa5ef09fd00899e4b469fb11f38e9d09dc0379f0b11c23b5fe541765f76695120a03f0261d32af5d2a2b1e5c9a04200cd87d574dc42349de9790012ce560406a8a876a1e54cfcdc0eb74998abec2a9778330eeb2a0ac0e41d0c9ed5824fbd0dbf7da930ab299966ce333fd7bc1321dada0817aac5444e02c754069e218746bf879d5f2a20a8b028324fb2c73171e63336686aa5ec2e6e9a08eb18b87c14758c572f4531ccf6b55d09f44beb8b47563be4eff7a52598d80959dd9c9fee5ac4783d8370cb7d55d460053d3e067b5f9fe75ff2722623fb1825fcba5e9593d4205b38d1f502ff03035463043bd393a5ee039ce75a5d54f21b395255df6627ef96751566326f7d4a77d828aa21b1827282829fcbc42aad59cdb521e1a3aaa08b99ea8fe7fff0a04da31a52260fc6daeccd79bb877bdd8506614282258e15b3fe74bf71a93f4be3b770119edf99a317b205eea7d5ab800362b97384273888106c77d633600"), SER_NETWORK, PROTOCOL_VERSION); + ss >> spend; + uint256 dataToBeSigned = uint256S("0x2dbf83fe7b88a7cbd80fac0c719483906bb9a0c4fc69071e4780d5f2c76e592c"); + + auto ctx = librustzcash_sapling_verification_ctx_init(); + + struct timeval tv_start; + timer_start(tv_start); + + bool result = librustzcash_sapling_check_spend( + ctx, + spend.cv.begin(), + spend.anchor.begin(), + spend.nullifier.begin(), + spend.rk.begin(), + spend.zkproof.begin(), + spend.spendAuthSig.begin(), + dataToBeSigned.begin() + ); + + double t = timer_stop(tv_start); + librustzcash_sapling_verification_ctx_free(ctx); + if (!result) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "librustzcash_sapling_check_spend() should return true"); + } + return t; +} + +// Verify Sapling output from testnet +// txid: abbd823cbd3d4e3b52023599d81a96b74817e95ce5bb58354f979156bd22ecc8 +// position: 0 +double benchmark_verify_sapling_output() +{ + OutputDescription output; + CDataStream ss(ParseHex("edd742af18857e5ec2d71d346a7fe2ac97c137339bd5268eea86d32e0ff4f38f76213fa8cfed3347ac4e8572dd88aff395c0c10a59f8b3f49d2bc539ed6c726667e29d4763f914ddd0abf1cdfa84e44de87c233434c7e69b8b5b8f4623c8aa444163425bae5cef842972fed66046c1c6ce65c866ad894d02e6e6dcaae7a962d9f2ef95757a09c486928e61f0f7aed90ad0a542b0d3dc5fe140dfa7626b9315c77e03b055f19cbacd21a866e46f06c00e0c7792b2a590a611439b510a9aaffcf1073bad23e712a9268b36888e3727033eee2ab4d869f54a843f93b36ef489fb177bf74b41a9644e5d2a0a417c6ac1c8869bc9b83273d453f878ed6fd96b82a5939903f7b64ecaf68ea16e255a7fb7cc0b6d8b5608a1c6b0ed3024cc62c2f0f9c5cfc7b431ae6e9d40815557aa1d010523f9e1960de77b2274cb6710d229d475c87ae900183206ba90cb5bbc8ec0df98341b82726c705e0308ca5dc08db4db609993a1046dfb43dfd8c760be506c0bed799bb2205fc29dc2e654dce731034a23b0aaf6da0199248702ee0523c159f41f4cbfff6c35ace4dd9ae834e44e09c76a0cbdda1d3f6a2c75ad71212daf9575ab5f09ca148718e667f29ddf18c8a330a86ace18a86e89454653902aa393c84c6b694f27d0d42e24e7ac9fe34733de5ec15f5066081ce912c62c1a804a2bb4dedcef7cc80274f6bb9e89e2fce91dc50d6a73c8aefb9872f1cf3524a92626a0b8f39bbf7bf7d96ca2f770fc04d7f457021c536a506a187a93b2245471ddbfb254a71bc4a0d72c8d639a31c7b1920087ffca05c24214157e2e7b28184e91989ef0b14f9b34c3dc3cc0ac64226b9e337095870cb0885737992e120346e630a416a9b217679ce5a778fb15779c136bcecca5efe79012013d77d90b4e99dd22c8f35bc77121716e160d05bd30d288ee8886390ee436f85bdc9029df888a3a3326d9d4ddba5cb5318b3274928829d662e96fea1d601f7a306251ed8c6cc4e5a3a7a98c35a3650482a0eee08f3b4c2da9b22947c96138f1505c2f081f8972d429f3871f32bef4aaa51aa6945df8e9c9760531ac6f627d17c1518202818a91ca304fb4037875c666060597976144fcbbc48a776a2c61beb9515fa8f3ae6d3a041d320a38a8ac75cb47bb9c866ee497fc3cd13299970c4b369c1c2ceb4220af082fbecdd8114492a8e4d713b5a73396fd224b36c1185bd5e20d683e6c8db35346c47ae7401988255da7cfffdced5801067d4d296688ee8fe424b4a8a69309ce257eefb9345ebfda3f6de46bb11ec94133e1f72cd7ac54934d6cf17b3440800e70b80ebc7c7bfc6fb0fc2c"), SER_NETWORK, PROTOCOL_VERSION); + ss >> output; + + auto ctx = librustzcash_sapling_verification_ctx_init(); + + struct timeval tv_start; + timer_start(tv_start); + + bool result = librustzcash_sapling_check_output( + ctx, + output.cv.begin(), + output.cm.begin(), + output.ephemeralKey.begin(), + output.zkproof.begin() + ); + + double t = timer_stop(tv_start); + librustzcash_sapling_verification_ctx_free(ctx); + if (!result) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "librustzcash_sapling_check_output() should return true"); + } + return timer_stop(tv_start); +} diff --git a/src/zcbenchmarks.h b/src/zcbenchmarks.h index 60a0be848..363823838 100644 --- a/src/zcbenchmarks.h +++ b/src/zcbenchmarks.h @@ -19,5 +19,9 @@ extern double benchmark_connectblock_slow(); extern double benchmark_sendtoaddress(CAmount amount); extern double benchmark_loadwallet(); extern double benchmark_listunspent(); +extern double benchmark_create_sapling_spend(); +extern double benchmark_create_sapling_output(); +extern double benchmark_verify_sapling_spend(); +extern double benchmark_verify_sapling_output(); #endif From 095eee4f4db1f9dfc4ca8f8280286c7b853f0894 Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Mon, 22 Oct 2018 10:01:17 -0600 Subject: [PATCH 16/21] Wrap long line and update comments --- src/wallet/wallet.cpp | 8 ++++++-- src/wallet/wallet.h | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 76a44afc0..b3c419b87 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4374,7 +4374,8 @@ void CWallet::GetFilteredNotes( } /** - * Find notes in the wallet filtered by payment addresses, min depth and ability to spend. + * Find notes in the wallet filtered by payment addresses, min depth, max depth, + * if the note is spent, if a spending key is required, and if the notes are locked. * These notes are decrypted and added to the output parameter vector, outEntries. */ void CWallet::GetFilteredNotes( @@ -4393,7 +4394,10 @@ void CWallet::GetFilteredNotes( CWalletTx wtx = p.second; // Filter the transactions before checking for notes - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth || wtx.GetDepthInMainChain() > maxDepth) { + if (!CheckFinalTx(wtx) || + wtx.GetBlocksToMaturity() > 0 || + wtx.GetDepthInMainChain() < minDepth || + wtx.GetDepthInMainChain() > maxDepth) { continue; } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index f492657f7..2d65a8779 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1281,7 +1281,8 @@ public: bool ignoreSpent=true, bool requireSpendingKey=true); - /* Find notes filtered by payment addresses, min depth, ability to spend */ + /* Find notes filtered by payment addresses, min depth, max depth, if they are spent, + if a spending key is required, and if they are locked */ void GetFilteredNotes(std::vector& sproutEntries, std::vector& saplingEntries, std::set& filterAddresses, From 81005fb214c44e35962b73519f78fb18c1bf8171 Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Wed, 24 Oct 2018 12:05:48 -0600 Subject: [PATCH 17/21] Fix error message --- src/wallet/asyncrpcoperation_sendmany.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index 64b1a5f26..0f08d826f 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -394,7 +394,7 @@ bool AsyncRPCOperation_sendmany::main_impl() { if (!pwalletMain->GetHDSeed(seed)) { throw JSONRPCError( RPC_WALLET_ERROR, - "CWallet::GenerateNewSaplingZKey(): HD seed not found"); + "AsyncRPCOperation_sendmany::main_impl(): HD seed not found"); } ovk = ovkForShieldingFromTaddr(seed); } From 882a4f577f9a30dd37f838c60e2de863a6deccc7 Mon Sep 17 00:00:00 2001 From: Eirik Ogilvie-Wigley Date: Wed, 24 Oct 2018 13:53:25 -0600 Subject: [PATCH 18/21] Fix potentially misleading test failures --- qa/rpc-tests/test_framework/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index ca5bcee3e..1a6315ef5 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -355,11 +355,11 @@ def random_transaction(nodes, amount, min_fee, fee_increment, fee_variants): return (txid, signresult["hex"], fee) -def assert_equal(expected, actual, message = ""): +def assert_equal(expected, actual, message=""): if expected != actual: if message: - message = "%s; " % message - raise AssertionError("%sexpected: <%s> but was: <%s>" % (message, str(expected), str(actual))) + message = "; %s" % message + raise AssertionError("(left == right)%s\n left: <%s>\n right: <%s>" % (message, str(expected), str(actual))) def assert_true(condition, message = ""): if not condition: From eff2938e46b05d0071a9323b363d68b6eb2893d1 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sat, 27 Oct 2018 17:03:47 +1300 Subject: [PATCH 19/21] Migrate to current librustzcash The only upstream change relative to the previous commit is that the various Zcash-specific dependencies have been pulled into a cargo workspace. The dependecies in the workspace use the same commits as the crates we had previously vendored. The patches are necessary to handle the fact that cargo requires that dev dependencies are available even if not used, and we would otherwise need to vendor all the underlying crates. --- depends/packages/crate_aesni.mk | 4 +- depends/packages/crate_stream_cipher.mk | 4 +- depends/packages/librustzcash.mk | 14 +- depends/packages/packages.mk | 6 +- ...0001-Start-using-cargo-clippy-for-CI.patch | 42 ++ .../librustzcash/remove-dev-dependencies.diff | 630 ++++++++++++++++++ 6 files changed, 686 insertions(+), 14 deletions(-) create mode 100644 depends/patches/librustzcash/0001-Start-using-cargo-clippy-for-CI.patch create mode 100644 depends/patches/librustzcash/remove-dev-dependencies.diff diff --git a/depends/packages/crate_aesni.mk b/depends/packages/crate_aesni.mk index 6f93d155f..ccd6bb8c9 100644 --- a/depends/packages/crate_aesni.mk +++ b/depends/packages/crate_aesni.mk @@ -1,9 +1,9 @@ package=crate_aesni $(package)_crate_name=aesni -$(package)_version=0.4.0 +$(package)_version=0.4.1 $(package)_download_path=https://static.crates.io/crates/$($(package)_crate_name) $(package)_file_name=$($(package)_crate_name)-$($(package)_version).crate -$(package)_sha256_hash=f2838c142db62c0c6aea0a24054c46d35488532fdaea0f51dbeba430f0985df5 +$(package)_sha256_hash=6810b7fb9f2bb4f76f05ac1c170b8dde285b6308955dc3afd89710268c958d9e $(package)_crate_versioned_name=$($(package)_crate_name) define $(package)_preprocess_cmds diff --git a/depends/packages/crate_stream_cipher.mk b/depends/packages/crate_stream_cipher.mk index 6429a6179..b0ede4e55 100644 --- a/depends/packages/crate_stream_cipher.mk +++ b/depends/packages/crate_stream_cipher.mk @@ -1,9 +1,9 @@ package=crate_stream_cipher $(package)_crate_name=stream-cipher -$(package)_version=0.1.0 +$(package)_version=0.1.1 $(package)_download_path=https://static.crates.io/crates/$($(package)_crate_name) $(package)_file_name=$($(package)_crate_name)-$($(package)_version).crate -$(package)_sha256_hash=ac49bc6cb2847200d18bfb738ce89448570f4aa1c34ac0348db6205ee69a0777 +$(package)_sha256_hash=30dc6118470d69ce0fdcf7e6f95e95853f7f4f72f80d835d4519577c323814ab $(package)_crate_versioned_name=$($(package)_crate_name) define $(package)_preprocess_cmds diff --git a/depends/packages/librustzcash.mk b/depends/packages/librustzcash.mk index 178e544f2..c3437120a 100644 --- a/depends/packages/librustzcash.mk +++ b/depends/packages/librustzcash.mk @@ -3,10 +3,10 @@ $(package)_version=0.1 $(package)_download_path=https://github.com/zcash/$(package)/archive/ $(package)_file_name=$(package)-$($(package)_git_commit).tar.gz $(package)_download_file=$($(package)_git_commit).tar.gz -$(package)_sha256_hash=e9a488a8bbecf7fb237a32dadd65133211ef61616d44cf55609e029837a41004 -$(package)_git_commit=f5e5cb24e1bd756a02fc4a3fd2b824238ccd15ad +$(package)_sha256_hash=d2f0d93876b490f9c20060d28dcad833eb85e0609163a1106f540153e1b459c9 +$(package)_git_commit=041671f6425563bdef43c7c907a8396da76f8f21 $(package)_dependencies=rust $(rust_crates) -$(package)_patches=cargo.config +$(package)_patches=cargo.config 0001-Start-using-cargo-clippy-for-CI.patch remove-dev-dependencies.diff ifeq ($(host_os),mingw32) $(package)_library_file=target/x86_64-pc-windows-gnu/release/rustzcash.lib @@ -20,17 +20,21 @@ $(package)_build_opts_mingw32=--target=x86_64-pc-windows-gnu endef define $(package)_preprocess_cmds + patch -p1 -d pairing < $($(package)_patch_dir)/0001-Start-using-cargo-clippy-for-CI.patch && \ + patch -p1 < $($(package)_patch_dir)/remove-dev-dependencies.diff && \ mkdir .cargo && \ cat $($(package)_patch_dir)/cargo.config | sed 's|CRATE_REGISTRY|$(host_prefix)/$(CRATE_REGISTRY)|' > .cargo/config endef define $(package)_build_cmds - cargo build $($(package)_build_opts) + cd librustzcash && \ + cargo build $($(package)_build_opts) && \ + cd .. endef define $(package)_stage_cmds mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \ mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \ cp $($(package)_library_file) $($(package)_staging_dir)$(host_prefix)/lib/ && \ - cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/ + cp librustzcash/include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/ endef diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 44346cb5f..e88bbd441 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -3,7 +3,6 @@ rust_crates := \ crate_aesni \ crate_aes_soft \ crate_arrayvec \ - crate_bellman \ crate_bitflags \ crate_bit_vec \ crate_blake2_rfc \ @@ -27,15 +26,12 @@ rust_crates := \ crate_num_integer \ crate_num_traits \ crate_opaque_debug \ - crate_pairing \ crate_rand \ - crate_sapling_crypto \ crate_stream_cipher \ crate_typenum \ crate_winapi_i686_pc_windows_gnu \ crate_winapi \ - crate_winapi_x86_64_pc_windows_gnu \ - crate_zip32 + crate_winapi_x86_64_pc_windows_gnu rust_packages := rust $(rust_crates) librustzcash proton_packages := proton zcash_packages := libgmp libsodium diff --git a/depends/patches/librustzcash/0001-Start-using-cargo-clippy-for-CI.patch b/depends/patches/librustzcash/0001-Start-using-cargo-clippy-for-CI.patch new file mode 100644 index 000000000..6bfeee574 --- /dev/null +++ b/depends/patches/librustzcash/0001-Start-using-cargo-clippy-for-CI.patch @@ -0,0 +1,42 @@ +From cc5b83510277632852af67d896a27e0cb40f342b Mon Sep 17 00:00:00 2001 +From: Sean Bowe +Date: Wed, 4 Jul 2018 12:45:08 -0600 +Subject: [PATCH 1/2] Start using cargo-clippy for CI. + +--- + src/lib.rs | 21 ++++++++++----------- + 1 file changed, 10 insertions(+), 11 deletions(-) + +diff --git a/src/lib.rs b/src/lib.rs +index fefdae3..c3640c4 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -1,15 +1,14 @@ + // `clippy` is a code linting tool for improving code quality by catching +-// common mistakes or strange code patterns. If the `clippy` feature is +-// provided, it is enabled and all compiler warnings are prohibited. +-#![cfg_attr(feature = "clippy", deny(warnings))] +-#![cfg_attr(feature = "clippy", feature(plugin))] +-#![cfg_attr(feature = "clippy", plugin(clippy))] +-#![cfg_attr(feature = "clippy", allow(inline_always))] +-#![cfg_attr(feature = "clippy", allow(too_many_arguments))] +-#![cfg_attr(feature = "clippy", allow(unreadable_literal))] +-#![cfg_attr(feature = "clippy", allow(many_single_char_names))] +-#![cfg_attr(feature = "clippy", allow(new_without_default_derive))] +-#![cfg_attr(feature = "clippy", allow(write_literal))] ++// common mistakes or strange code patterns. If the `cargo-clippy` feature ++// is provided, all compiler warnings are prohibited. ++#![cfg_attr(feature = "cargo-clippy", deny(warnings))] ++#![cfg_attr(feature = "cargo-clippy", allow(inline_always))] ++#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] ++#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))] ++#![cfg_attr(feature = "cargo-clippy", allow(many_single_char_names))] ++#![cfg_attr(feature = "cargo-clippy", allow(new_without_default_derive))] ++#![cfg_attr(feature = "cargo-clippy", allow(write_literal))] ++ + // Force public structures to implement Debug + #![deny(missing_debug_implementations)] + +-- +2.17.1 + diff --git a/depends/patches/librustzcash/remove-dev-dependencies.diff b/depends/patches/librustzcash/remove-dev-dependencies.diff new file mode 100644 index 000000000..d013de8da --- /dev/null +++ b/depends/patches/librustzcash/remove-dev-dependencies.diff @@ -0,0 +1,630 @@ +diff --git a/Cargo.lock b/Cargo.lock +index bc740bb..3c6c94b 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -28,22 +28,6 @@ dependencies = [ + "stream-cipher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +-[[package]] +-name = "aho-corasick" +-version = "0.6.8" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "ansi_term" +-version = "0.11.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- + [[package]] + name = "arrayvec" + version = "0.4.7" +@@ -52,27 +36,6 @@ dependencies = [ + "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +-[[package]] +-name = "backtrace" +-version = "0.3.9" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", +- "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", +- "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +- "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "backtrace-sys" +-version = "0.1.24" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- + [[package]] + name = "bellman" + version = "0.1.0" +@@ -92,11 +55,6 @@ name = "bit-vec" + version = "0.4.4" + source = "registry+https://github.com/rust-lang/crates.io-index" + +-[[package]] +-name = "bitflags" +-version = "0.9.1" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- + [[package]] + name = "bitflags" + version = "1.0.1" +@@ -130,61 +88,6 @@ name = "byteorder" + version = "1.2.2" + source = "registry+https://github.com/rust-lang/crates.io-index" + +-[[package]] +-name = "cargo_metadata" +-version = "0.5.8" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", +- "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", +- "serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "cc" +-version = "1.0.22" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "cfg-if" +-version = "0.1.5" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "clippy" +-version = "0.0.200" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "clippy_lints 0.0.200 (registry+https://github.com/rust-lang/crates.io-index)", +- "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +- "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +- "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "clippy_lints" +-version = "0.0.200" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +- "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +- "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", +- "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", +- "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +- "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +- "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- + [[package]] + name = "constant_time_eq" + version = "0.1.3" +@@ -203,19 +106,6 @@ dependencies = [ + "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +-[[package]] +-name = "either" +-version = "1.5.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "error-chain" +-version = "0.11.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- + [[package]] + name = "fpe" + version = "0.1.0" +@@ -256,11 +146,6 @@ dependencies = [ + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +-[[package]] +-name = "gcc" +-version = "0.3.54" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- + [[package]] + name = "generic-array" + version = "0.9.0" +@@ -269,59 +154,6 @@ dependencies = [ + "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +-[[package]] +-name = "getopts" +-version = "0.2.18" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "hex-literal" +-version = "0.1.1" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +- "proc-macro-hack 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "hex-literal-impl" +-version = "0.1.1" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "proc-macro-hack 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "idna" +-version = "0.1.5" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +- "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "if_chain" +-version = "0.1.3" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "itertools" +-version = "0.7.8" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "itoa" +-version = "0.4.2" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- + [[package]] + name = "lazy_static" + version = "1.0.0" +@@ -347,19 +179,6 @@ dependencies = [ + "zip32 0.0.0", + ] + +-[[package]] +-name = "matches" +-version = "0.1.8" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "memchr" +-version = "2.0.2" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- + [[package]] + name = "nodrop" + version = "0.1.12" +@@ -405,65 +224,6 @@ name = "pairing" + version = "0.14.2" + dependencies = [ + "byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "clippy 0.0.200 (registry+https://github.com/rust-lang/crates.io-index)", +- "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "percent-encoding" +-version = "1.0.1" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "proc-macro-hack" +-version = "0.4.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "proc-macro-hack-impl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "proc-macro-hack-impl" +-version = "0.4.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "proc-macro2" +-version = "0.4.14" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "pulldown-cmark" +-version = "0.1.2" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", +- "getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "quine-mc_cluskey" +-version = "0.2.4" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "quote" +-version = "0.6.8" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "rand" +-version = "0.3.22" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -477,66 +237,6 @@ dependencies = [ + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +-[[package]] +-name = "redox_syscall" +-version = "0.1.40" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "regex" +-version = "1.0.4" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +- "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "regex-syntax" +-version = "0.6.2" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "rust-crypto" +-version = "0.2.36" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", +- "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", +- "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +- "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "rustc-demangle" +-version = "0.1.9" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "rustc-serialize" +-version = "0.3.24" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "rustc_version" +-version = "0.2.3" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "ryu" +-version = "0.2.6" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- + [[package]] + name = "sapling-crypto" + version = "0.0.1" +@@ -545,49 +245,8 @@ dependencies = [ + "blake2-rfc 0.2.18 (git+https://github.com/gtank/blake2-rfc?rev=7a5b5fc99ae483a0043db7547fb79a6fa44b88a9)", + "byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pairing 0.14.2", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "semver" +-version = "0.9.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "semver-parser" +-version = "0.7.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "serde" +-version = "1.0.75" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "serde_derive" +-version = "1.0.75" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", +- "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "serde_json" +-version = "1.0.26" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "itoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +- "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -598,90 +257,11 @@ dependencies = [ + "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +-[[package]] +-name = "syn" +-version = "0.14.9" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", +- "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "thread_local" +-version = "0.3.6" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "time" +-version = "0.1.40" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", +- "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +- "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "toml" +-version = "0.4.6" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- + [[package]] + name = "typenum" + version = "1.10.0" + source = "registry+https://github.com/rust-lang/crates.io-index" + +-[[package]] +-name = "ucd-util" +-version = "0.1.1" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "unicode-bidi" +-version = "0.3.4" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "unicode-normalization" +-version = "0.1.7" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "unicode-width" +-version = "0.1.5" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "unicode-xid" +-version = "0.1.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- +-[[package]] +-name = "url" +-version = "1.7.1" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-dependencies = [ +- "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +- "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +-] +- +-[[package]] +-name = "utf8-ranges" +-version = "1.0.1" +-source = "registry+https://github.com/rust-lang/crates.io-index" +- + [[package]] + name = "winapi" + version = "0.3.4" +@@ -730,87 +310,33 @@ dependencies = [ + "checksum aes 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e6fb1737cdc8da3db76e90ca817a194249a38fcb500c2e6ecec39b29448aa873" + "checksum aes-soft 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67cc03b0a090a05cb01e96998a01905d7ceedce1bc23b756c0bb7faa0682ccb1" + "checksum aesni 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6810b7fb9f2bb4f76f05ac1c170b8dde285b6308955dc3afd89710268c958d9e" +-"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a" +-"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" + "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +-"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" +-"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" + "checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" +-"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" + "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" + "checksum blake2-rfc 0.2.18 (git+https://github.com/gtank/blake2-rfc?rev=7a5b5fc99ae483a0043db7547fb79a6fa44b88a9)" = "" + "checksum block-cipher-trait 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "370424437b9459f3dfd68428ed9376ddfe03d8b70ede29cc533b3557df186ab4" + "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" + "checksum byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b5bdfe7ee3ad0b99c9801d58807a9dbc9e09196365b0203853b99889ab3c87" +-"checksum cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1efca0b863ca03ed4c109fb1c55e0bc4bbeb221d3e103d86251046b06a526bd0" +-"checksum cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)" = "4a6007c146fdd28d4512a794b07ffe9d8e89e6bf86e2e0c4ddff2e1fb54a0007" +-"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" +-"checksum clippy 0.0.200 (registry+https://github.com/rust-lang/crates.io-index)" = "927a1f79af10deb103df108347f23c6b7fa1731c953d6fb24d68be1748a0993f" +-"checksum clippy_lints 0.0.200 (registry+https://github.com/rust-lang/crates.io-index)" = "d2432663f6bdb90255dcf9df5ca504f99b575bb471281591138f62f9d31f863b" + "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" + "checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" + "checksum digest 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "00a49051fef47a72c9623101b19bd71924a45cca838826caae3eaa4d00772603" +-"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" +-"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" + "checksum fpe 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce3371c82bfbd984f624cab093f55e7336f5a6e589f8518e1258f54f011b89ad" + "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" + "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + "checksum futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "1a70b146671de62ec8c8ed572219ca5d594d9b06c0b364d5e67b722fc559b48c" + "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +-"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" + "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" +-"checksum getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0a7292d30132fb5424b354f5dc02512a86e4c516fe544bb7a25e7f266951b797" +-"checksum hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4da5f0e01bd8a71a224a4eedecaacfcabda388dbb7a80faf04d3514287572d95" +-"checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" +-"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +-"checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec" +-"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" +-"checksum itoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5adb58558dcd1d786b5f0bd15f3226ee23486e24b7b58304b60f64dc68e62606" + "checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" + "checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b" +-"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +-"checksum memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b4142ab8738a78c51896f704f83c11df047ff1bda9a92a661aa6361552d93d" + "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" + "checksum num-bigint 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3eceac7784c5dc97c2d6edf30259b4e153e6e2b42b3c85e9a6e9f45d06caef6e" + "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" + "checksum num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe" + "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" + "checksum opaque-debug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d620c9c26834b34f039489ac0dfdb12c7ac15ccaf818350a64c9b5334a452ad7" +-"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +-"checksum proc-macro-hack 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ba8d4f9257b85eb6cdf13f055cea3190520aab1409ca2ab43493ea4820c25f0" +-"checksum proc-macro-hack-impl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5cb6f960ad471404618e9817c0e5d10b1ae74cfdf01fab89ea0641fe7fb2892" +-"checksum proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b331c6ad3411474cd55540398dc7ad89fc41488e64ec71fdecc9c9b86de96fb0" +-"checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" +-"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" +-"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" +-"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" + "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" +-"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" +-"checksum regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "67d0301b0c6804eca7e3c275119d0b01ff3b7ab9258a65709e608a66312a1025" +-"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" +-"checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" +-"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" +-"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +-"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +-"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" +-"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +-"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +-"checksum serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "22d340507cea0b7e6632900a176101fea959c7065d93ba555072da90aaaafc87" +-"checksum serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "234fc8b737737b148ccd625175fc6390f5e4dacfdaa543cb93a3430d984a9119" +-"checksum serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "44dd2cfde475037451fa99b7e5df77aa3cfd1536575fa8e7a538ab36dcde49ae" + "checksum stream-cipher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30dc6118470d69ce0fdcf7e6f95e95853f7f4f72f80d835d4519577c323814ab" +-"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" +-"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +-"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" +-"checksum toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a0263c6c02c4db6c8f7681f9fd35e90de799ebd4cfdeab77a38f4ff6b3d8c0d9" + "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +-"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" +-"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +-"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" +-"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +-"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +-"checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6" +-"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" + "checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" + "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +diff --git a/pairing/Cargo.toml b/pairing/Cargo.toml +index 98725aa..dedce80 100644 +--- a/pairing/Cargo.toml ++++ b/pairing/Cargo.toml +@@ -14,7 +14,6 @@ repository = "https://github.com/ebfull/pairing" + [dependencies] + rand = "0.4" + byteorder = "1" +-clippy = { version = "0.0.200", optional = true } + + [features] + unstable-features = ["expose-arith"] +diff --git a/sapling-crypto/Cargo.toml b/sapling-crypto/Cargo.toml +index 6e802f2..33e21bf 100644 +--- a/sapling-crypto/Cargo.toml ++++ b/sapling-crypto/Cargo.toml +@@ -22,10 +22,6 @@ byteorder = "1" + git = "https://github.com/gtank/blake2-rfc" + rev = "7a5b5fc99ae483a0043db7547fb79a6fa44b88a9" + +-[dev-dependencies] +-hex-literal = "0.1" +-rust-crypto = "0.2" +- + [features] + default = ["u128-support"] + u128-support = ["pairing/u128-support"] From ee3fa7020e8f11940d0e437f6aa974f19e09e371 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sat, 27 Oct 2018 17:15:32 +1300 Subject: [PATCH 20/21] Pass parameter paths as native strings to librustzcash --- depends/packages/librustzcash.mk | 4 ++-- src/gtest/main.cpp | 30 ++++++++++++++++++------------ src/init.cpp | 24 +++++++++++++++--------- src/test/test_bitcoin.cpp | 18 ++++++++++++------ 4 files changed, 47 insertions(+), 29 deletions(-) diff --git a/depends/packages/librustzcash.mk b/depends/packages/librustzcash.mk index c3437120a..f2953dc8d 100644 --- a/depends/packages/librustzcash.mk +++ b/depends/packages/librustzcash.mk @@ -3,8 +3,8 @@ $(package)_version=0.1 $(package)_download_path=https://github.com/zcash/$(package)/archive/ $(package)_file_name=$(package)-$($(package)_git_commit).tar.gz $(package)_download_file=$($(package)_git_commit).tar.gz -$(package)_sha256_hash=d2f0d93876b490f9c20060d28dcad833eb85e0609163a1106f540153e1b459c9 -$(package)_git_commit=041671f6425563bdef43c7c907a8396da76f8f21 +$(package)_sha256_hash=9909ec59fa7a411c2071d6237b3363a0bc6e5e42358505cf64b7da0f58a7ff5a +$(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 diff --git a/src/gtest/main.cpp b/src/gtest/main.cpp index 00700d05b..5f32b5fef 100644 --- a/src/gtest/main.cpp +++ b/src/gtest/main.cpp @@ -34,19 +34,25 @@ int main(int argc, char **argv) { boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params"; boost::filesystem::path sprout_groth16 = ZC_GetParamsDir() / "sprout-groth16.params"; - std::string sapling_spend_str = sapling_spend.string(); - std::string sapling_output_str = sapling_output.string(); - std::string sprout_groth16_str = sprout_groth16.string(); + static_assert( + sizeof(boost::filesystem::path::value_type) == sizeof(codeunit), + "librustzcash not configured correctly"); + auto sapling_spend_str = sapling_spend.native(); + auto sapling_output_str = sapling_output.native(); + auto sprout_groth16_str = sprout_groth16.native(); + + librustzcash_init_zksnark_params( + reinterpret_cast(sapling_spend_str.c_str()), + sapling_spend_str.length(), + "8270785a1a0d0bc77196f000ee6d221c9c9894f55307bd9357c3f0105d31ca63991ab91324160d8f53e2bbd3c2633a6eb8bdf5205d822e7f3f73edac51b2b70c", + reinterpret_cast(sapling_output_str.c_str()), + sapling_output_str.length(), + "657e3d38dbb5cb5e7dd2970e8b03d69b4787dd907285b5a7f0790dcc8072f60bf593b32cc2d1c030e00ff5ae64bf84c5c3beb84ddc841d48264b4a171744d028", + reinterpret_cast(sprout_groth16_str.c_str()), + sprout_groth16_str.length(), + "e9b238411bd6c0ec4791e9d04245ec350c9c5744f5610dfcce4365d5ca49dfefd5054e371842b3f88fa1b9d7e8e075249b3ebabd167fa8b0f3161292d36c180a" + ); - librustzcash_init_zksnark_params( - sapling_spend_str.c_str(), - "8270785a1a0d0bc77196f000ee6d221c9c9894f55307bd9357c3f0105d31ca63991ab91324160d8f53e2bbd3c2633a6eb8bdf5205d822e7f3f73edac51b2b70c", - sapling_output_str.c_str(), - "657e3d38dbb5cb5e7dd2970e8b03d69b4787dd907285b5a7f0790dcc8072f60bf593b32cc2d1c030e00ff5ae64bf84c5c3beb84ddc841d48264b4a171744d028", - sprout_groth16_str.c_str(), - "e9b238411bd6c0ec4791e9d04245ec350c9c5744f5610dfcce4365d5ca49dfefd5054e371842b3f88fa1b9d7e8e075249b3ebabd167fa8b0f3161292d36c180a" - ); - testing::InitGoogleMock(&argc, argv); auto ret = RUN_ALL_TESTS(); diff --git a/src/init.cpp b/src/init.cpp index 0c6cc31a6..086c6beb8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -718,21 +718,27 @@ static void ZC_LoadParams( elapsed = float(tv_end.tv_sec-tv_start.tv_sec) + (tv_end.tv_usec-tv_start.tv_usec)/float(1000000); LogPrintf("Loaded verifying key in %fs seconds.\n", elapsed); - std::string sapling_spend_str = sapling_spend.string(); - std::string sapling_output_str = sapling_output.string(); - std::string sprout_groth16_str = sprout_groth16.string(); + static_assert( + sizeof(boost::filesystem::path::value_type) == sizeof(codeunit), + "librustzcash not configured correctly"); + auto sapling_spend_str = sapling_spend.native(); + auto sapling_output_str = sapling_output.native(); + auto sprout_groth16_str = sprout_groth16.native(); - LogPrintf("Loading Sapling (Spend) parameters from %s\n", sapling_spend_str.c_str()); - LogPrintf("Loading Sapling (Output) parameters from %s\n", sapling_output_str.c_str()); - LogPrintf("Loading Sapling (Sprout Groth16) parameters from %s\n", sprout_groth16_str.c_str()); + LogPrintf("Loading Sapling (Spend) parameters from %s\n", sapling_spend.string().c_str()); + LogPrintf("Loading Sapling (Output) parameters from %s\n", sapling_output.string().c_str()); + LogPrintf("Loading Sapling (Sprout Groth16) parameters from %s\n", sprout_groth16.string().c_str()); gettimeofday(&tv_start, 0); librustzcash_init_zksnark_params( - sapling_spend_str.c_str(), + reinterpret_cast(sapling_spend_str.c_str()), + sapling_spend_str.length(), "8270785a1a0d0bc77196f000ee6d221c9c9894f55307bd9357c3f0105d31ca63991ab91324160d8f53e2bbd3c2633a6eb8bdf5205d822e7f3f73edac51b2b70c", - sapling_output_str.c_str(), + reinterpret_cast(sapling_output_str.c_str()), + sapling_output_str.length(), "657e3d38dbb5cb5e7dd2970e8b03d69b4787dd907285b5a7f0790dcc8072f60bf593b32cc2d1c030e00ff5ae64bf84c5c3beb84ddc841d48264b4a171744d028", - sprout_groth16_str.c_str(), + reinterpret_cast(sprout_groth16_str.c_str()), + sprout_groth16_str.length(), "e9b238411bd6c0ec4791e9d04245ec350c9c5744f5610dfcce4365d5ca49dfefd5054e371842b3f88fa1b9d7e8e075249b3ebabd167fa8b0f3161292d36c180a" ); diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 2b4acad84..ce1442b09 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -45,16 +45,22 @@ JoinSplitTestingSetup::JoinSplitTestingSetup() boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params"; boost::filesystem::path sprout_groth16 = ZC_GetParamsDir() / "sprout-groth16.params"; - std::string sapling_spend_str = sapling_spend.string(); - std::string sapling_output_str = sapling_output.string(); - std::string sprout_groth16_str = sprout_groth16.string(); + static_assert( + sizeof(boost::filesystem::path::value_type) == sizeof(codeunit), + "librustzcash not configured correctly"); + auto sapling_spend_str = sapling_spend.native(); + auto sapling_output_str = sapling_output.native(); + auto sprout_groth16_str = sprout_groth16.native(); librustzcash_init_zksnark_params( - sapling_spend_str.c_str(), + reinterpret_cast(sapling_spend_str.c_str()), + sapling_spend_str.length(), "8270785a1a0d0bc77196f000ee6d221c9c9894f55307bd9357c3f0105d31ca63991ab91324160d8f53e2bbd3c2633a6eb8bdf5205d822e7f3f73edac51b2b70c", - sapling_output_str.c_str(), + reinterpret_cast(sapling_output_str.c_str()), + sapling_output_str.length(), "657e3d38dbb5cb5e7dd2970e8b03d69b4787dd907285b5a7f0790dcc8072f60bf593b32cc2d1c030e00ff5ae64bf84c5c3beb84ddc841d48264b4a171744d028", - sprout_groth16_str.c_str(), + reinterpret_cast(sprout_groth16_str.c_str()), + sprout_groth16_str.length(), "e9b238411bd6c0ec4791e9d04245ec350c9c5744f5610dfcce4365d5ca49dfefd5054e371842b3f88fa1b9d7e8e075249b3ebabd167fa8b0f3161292d36c180a" ); } From 262cf38712df5b3105f2e39ba47058e2b73ecfe0 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 28 Oct 2018 06:41:53 +1300 Subject: [PATCH 21/21] Build librustzcash package without changing directory This ensures that the depends system's custom PATH is applied correctly, and the pre-build Rust binaries are accessible. --- depends/packages/librustzcash.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/depends/packages/librustzcash.mk b/depends/packages/librustzcash.mk index f2953dc8d..a47c757de 100644 --- a/depends/packages/librustzcash.mk +++ b/depends/packages/librustzcash.mk @@ -27,9 +27,7 @@ define $(package)_preprocess_cmds endef define $(package)_build_cmds - cd librustzcash && \ - cargo build $($(package)_build_opts) && \ - cd .. + cargo build --package librustzcash $($(package)_build_opts) endef define $(package)_stage_cmds