diff --git a/src/gtest/test_joinsplit.cpp b/src/gtest/test_joinsplit.cpp index ca5cb04da..87f4fa4c5 100644 --- a/src/gtest/test_joinsplit.cpp +++ b/src/gtest/test_joinsplit.cpp @@ -16,6 +16,8 @@ #include "zcash/NoteEncryption.hpp" #include "zcash/IncrementalMerkleTree.hpp" +#include + using namespace libzcash; extern ZCJoinSplit* params; @@ -38,25 +40,25 @@ void test_full_api(ZCJoinSplit* js) uint64_t vpub_old = 10; uint64_t vpub_new = 0; uint256 pubKeyHash = random_uint256(); - boost::array macs; - boost::array nullifiers; - boost::array commitments; + std::array macs; + std::array nullifiers; + std::array commitments; uint256 rt = tree.root(); - boost::array ciphertexts; + std::array ciphertexts; SproutProof proof; { - boost::array inputs = { + std::array inputs = { JSInput(), // dummy input JSInput() // dummy input }; - boost::array outputs = { + std::array outputs = { JSOutput(recipient_addr, 10), JSOutput() // dummy output }; - boost::array output_notes; + std::array output_notes; // Perform the proof proof = js->prove( @@ -121,7 +123,7 @@ void test_full_api(ZCJoinSplit* js) pubKeyHash = random_uint256(); { - boost::array inputs = { + std::array inputs = { JSInput(), // dummy input JSInput(witness_recipient, decrypted_note, recipient_key) }; @@ -129,12 +131,12 @@ void test_full_api(ZCJoinSplit* js) SproutSpendingKey second_recipient = SproutSpendingKey::random(); SproutPaymentAddress second_addr = second_recipient.address(); - boost::array outputs = { + std::array outputs = { JSOutput(second_addr, 9), JSOutput() // dummy output }; - boost::array output_notes; + std::array output_notes; // Perform the proof proof = js->prove( @@ -176,8 +178,8 @@ void test_full_api(ZCJoinSplit* js) // to test exceptions void invokeAPI( ZCJoinSplit* js, - const boost::array& inputs, - const boost::array& outputs, + const std::array& inputs, + const std::array& outputs, uint64_t vpub_old, uint64_t vpub_new, const uint256& rt @@ -185,12 +187,12 @@ void invokeAPI( uint256 ephemeralKey; uint256 randomSeed; uint256 pubKeyHash = random_uint256(); - boost::array macs; - boost::array nullifiers; - boost::array commitments; - boost::array ciphertexts; + std::array macs; + std::array nullifiers; + std::array commitments; + std::array ciphertexts; - boost::array output_notes; + std::array output_notes; SproutProof proof = js->prove( false, @@ -213,8 +215,8 @@ void invokeAPI( void invokeAPIFailure( ZCJoinSplit* js, - const boost::array& inputs, - const boost::array& outputs, + const std::array& inputs, + const std::array& outputs, uint64_t vpub_old, uint64_t vpub_new, const uint256& rt, @@ -540,7 +542,7 @@ TEST(joinsplit, note_plaintexts) random_uint256() ); - boost::array memo; + std::array memo; SproutNotePlaintext note_pt(note, memo); diff --git a/src/gtest/test_noteencryption.cpp b/src/gtest/test_noteencryption.cpp index f521cdb01..754832179 100644 --- a/src/gtest/test_noteencryption.cpp +++ b/src/gtest/test_noteencryption.cpp @@ -1,6 +1,7 @@ #include #include "sodium.h" +#include #include #include "zcash/NoteEncryption.hpp" @@ -29,7 +30,7 @@ TEST(noteencryption, api) ASSERT_TRUE(b.get_epk() != c.get_epk()); } - boost::array message; + std::array message; for (size_t i = 0; i < ZC_NOTEPLAINTEXT_SIZE; i++) { // Fill the message with dummy data message[i] = (unsigned char) i; diff --git a/src/gtest/test_paymentdisclosure.cpp b/src/gtest/test_paymentdisclosure.cpp index e9768a6fd..d4cefa229 100644 --- a/src/gtest/test_paymentdisclosure.cpp +++ b/src/gtest/test_paymentdisclosure.cpp @@ -7,6 +7,8 @@ #include "zcash/Address.hpp" #include "wallet/wallet.h" #include "amount.h" + +#include #include #include #include @@ -167,7 +169,7 @@ TEST(paymentdisclosure, mainnet) { } // Convert signature buffer to boost array - boost::array arrayPayloadSig; + std::array arrayPayloadSig; memcpy(arrayPayloadSig.data(), &payloadSig[0], 64); // Payment disclosure blob to pass around diff --git a/src/gtest/test_transaction.cpp b/src/gtest/test_transaction.cpp index 44c047364..97dd4ffe4 100644 --- a/src/gtest/test_transaction.cpp +++ b/src/gtest/test_transaction.cpp @@ -4,6 +4,8 @@ #include "zcash/Note.hpp" #include "zcash/Address.hpp" +#include + extern ZCJoinSplit* params; extern int GenZero(int n); extern int GenMax(int n); @@ -30,16 +32,16 @@ TEST(Transaction, JSDescriptionRandomized) { // create JSDescription uint256 pubKeyHash; - boost::array inputs = { + std::array inputs = { libzcash::JSInput(witness, note, k), libzcash::JSInput() // dummy input of zero value }; - boost::array outputs = { + std::array outputs = { libzcash::JSOutput(addr, 50), libzcash::JSOutput(addr, 50) }; - boost::array inputMap; - boost::array outputMap; + std::array inputMap; + std::array outputMap; { auto jsdesc = JSDescription::Randomized( @@ -66,8 +68,8 @@ TEST(Transaction, JSDescriptionRandomized) { inputMap, outputMap, 0, 0, false, nullptr, GenZero); - boost::array expectedInputMap {1, 0}; - boost::array expectedOutputMap {1, 0}; + std::array expectedInputMap {1, 0}; + std::array expectedOutputMap {1, 0}; EXPECT_EQ(expectedInputMap, inputMap); EXPECT_EQ(expectedOutputMap, outputMap); } @@ -80,8 +82,8 @@ TEST(Transaction, JSDescriptionRandomized) { inputMap, outputMap, 0, 0, false, nullptr, GenMax); - boost::array expectedInputMap {0, 1}; - boost::array expectedOutputMap {0, 1}; + std::array expectedInputMap {0, 1}; + std::array expectedOutputMap {0, 1}; EXPECT_EQ(expectedInputMap, inputMap); EXPECT_EQ(expectedOutputMap, outputMap); } diff --git a/src/paymentdisclosure.h b/src/paymentdisclosure.h index eea0fda10..e336f905c 100644 --- a/src/paymentdisclosure.h +++ b/src/paymentdisclosure.h @@ -14,6 +14,7 @@ // For JSOutPoint #include "wallet/wallet.h" +#include #include #include @@ -113,11 +114,11 @@ struct PaymentDisclosurePayload { struct PaymentDisclosure { PaymentDisclosurePayload payload; - boost::array payloadSig; + std::array payloadSig; // We use boost array because serialize doesn't like char buffer, otherwise we could do: unsigned char payloadSig[64]; PaymentDisclosure() {}; - PaymentDisclosure(const PaymentDisclosurePayload payload, const boost::array sig) : payload(payload), payloadSig(sig) {}; + PaymentDisclosure(const PaymentDisclosurePayload payload, const std::array sig) : payload(payload), payloadSig(sig) {}; PaymentDisclosure(const uint256& joinSplitPubKey, const PaymentDisclosureKey& key, const PaymentDisclosureInfo& info, const std::string& message); ADD_SERIALIZE_METHODS; diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index a3ee0302c..ff15535c5 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -16,15 +16,15 @@ JSDescription::JSDescription( ZCJoinSplit& params, const uint256& pubKeyHash, const uint256& anchor, - const boost::array& inputs, - const boost::array& outputs, + const std::array& inputs, + const std::array& outputs, CAmount vpub_old, CAmount vpub_new, bool computeProof, uint256 *esk // payment disclosure ) : vpub_old(vpub_old), vpub_new(vpub_new), anchor(anchor) { - boost::array notes; + std::array notes; proof = params.prove( makeGrothProof, @@ -51,10 +51,10 @@ JSDescription JSDescription::Randomized( ZCJoinSplit& params, const uint256& pubKeyHash, const uint256& anchor, - boost::array& inputs, - boost::array& outputs, - boost::array& inputMap, - boost::array& outputMap, + std::array& inputs, + std::array& outputs, + std::array& inputMap, + std::array& outputMap, CAmount vpub_old, CAmount vpub_new, bool computeProof, diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index bea2485e9..897563891 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -14,7 +14,8 @@ #include "uint256.h" #include "consensus/consensus.h" -#include +#include + #include #include "zcash/NoteEncryption.hpp" @@ -42,7 +43,7 @@ static_assert(SAPLING_TX_VERSION <= SAPLING_MAX_TX_VERSION, class SpendDescription { public: - typedef boost::array spend_auth_sig_t; + typedef std::array spend_auth_sig_t; uint256 cv; //!< A value commitment to the value of the input note. uint256 anchor; //!< A Merkle root of the Sapling note commitment tree at some block height in the past. @@ -102,8 +103,8 @@ static constexpr size_t SAPLING_OUT_CIPHERTEXT_SIZE = ( class OutputDescription { public: - typedef boost::array sapling_enc_ct_t; // TODO: Replace with actual type - typedef boost::array sapling_out_ct_t; // TODO: Replace with actual type + typedef std::array sapling_enc_ct_t; // TODO: Replace with actual type + typedef std::array sapling_out_ct_t; // TODO: Replace with actual type uint256 cv; //!< A value commitment to the value of the output note. uint256 cm; //!< The note commitment for the output note. @@ -209,14 +210,14 @@ public: // are derived from the secrets placed in the note // and the secret spend-authority key known by the // spender. - boost::array nullifiers; + std::array nullifiers; // Note commitments are introduced into the commitment // tree, blinding the public about the values and // destinations involved in the JoinSplit. The presence of // a commitment in the note commitment tree is required // to spend it. - boost::array commitments; + std::array commitments; // Ephemeral key uint256 ephemeralKey; @@ -225,7 +226,7 @@ public: // These contain trapdoors, values and other information // that the recipient needs, including a memo field. It // is encrypted using the scheme implemented in crypto/NoteEncryption.cpp - boost::array ciphertexts = {{ {{0}} }}; + std::array ciphertexts = {{ {{0}} }}; // Random seed uint256 randomSeed; @@ -233,7 +234,7 @@ public: // MACs // The verification of the JoinSplit requires these MACs // to be provided as an input. - boost::array macs; + std::array macs; // JoinSplit proof // This is a zk-SNARK which ensures that this JoinSplit is valid. @@ -246,8 +247,8 @@ public: ZCJoinSplit& params, const uint256& pubKeyHash, const uint256& rt, - const boost::array& inputs, - const boost::array& outputs, + const std::array& inputs, + const std::array& outputs, CAmount vpub_old, CAmount vpub_new, bool computeProof = true, // Set to false in some tests @@ -259,10 +260,10 @@ public: ZCJoinSplit& params, const uint256& pubKeyHash, const uint256& rt, - boost::array& inputs, - boost::array& outputs, - boost::array& inputMap, - boost::array& outputMap, + std::array& inputs, + std::array& outputs, + std::array& inputMap, + std::array& outputMap, CAmount vpub_old, CAmount vpub_new, bool computeProof = true, // Set to false in some tests @@ -511,8 +512,8 @@ protected: CTransaction(const CMutableTransaction &tx, bool evilDeveloperFlag); public: - typedef boost::array joinsplit_sig_t; - typedef boost::array binding_sig_t; + typedef std::array joinsplit_sig_t; + typedef std::array binding_sig_t; // Transactions that include a list of JoinSplits are >= version 2. static const int32_t SPROUT_MIN_CURRENT_VERSION = 1; diff --git a/src/serialize.h b/src/serialize.h index 829d565a2..a945650d6 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -9,6 +9,7 @@ #include "compat/endian.h" #include +#include #include #include #include @@ -22,7 +23,6 @@ #include #include -#include #include #include "prevector.h" @@ -531,8 +531,8 @@ template void Unserialize(Stream& is, boost::option /** * array */ -template void Serialize(Stream& os, const boost::array& item); -template void Unserialize(Stream& is, boost::array& item); +template void Serialize(Stream& os, const std::array& item); +template void Unserialize(Stream& is, std::array& item); /** * pair @@ -790,7 +790,7 @@ void Unserialize(Stream& is, boost::optional& item) * array */ template -void Serialize(Stream& os, const boost::array& item) +void Serialize(Stream& os, const std::array& item) { for (size_t i = 0; i < N; i++) { Serialize(os, item[i]); @@ -798,7 +798,7 @@ void Serialize(Stream& os, const boost::array& item) } template -void Unserialize(Stream& is, boost::array& item) +void Unserialize(Stream& is, std::array& item) { for (size_t i = 0; i < N; i++) { Unserialize(is, item[i]); diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 47c85722a..42590c39e 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -23,6 +23,7 @@ #include "rpcprotocol.h" #include "init.h" +#include #include #include @@ -1042,7 +1043,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr); std::string memo = "DEADBEEF"; - boost::array array = proxy.get_memo_from_hex_string(memo); + std::array array = proxy.get_memo_from_hex_string(memo); BOOST_CHECK_EQUAL(array[0], 0xDE); BOOST_CHECK_EQUAL(array[1], 0xAD); BOOST_CHECK_EQUAL(array[2], 0xBE); @@ -1652,7 +1653,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_mergetoaddress_internals) TEST_FRIEND_AsyncRPCOperation_mergetoaddress proxy(ptr); std::string memo = "DEADBEEF"; - boost::array array = proxy.get_memo_from_hex_string(memo); + std::array array = proxy.get_memo_from_hex_string(memo); BOOST_CHECK_EQUAL(array[0], 0xDE); BOOST_CHECK_EQUAL(array[1], 0xAD); BOOST_CHECK_EQUAL(array[2], 0xBE); diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp index 6c0144271..eaf69f175 100644 --- a/src/test/serialize_tests.cpp +++ b/src/test/serialize_tests.cpp @@ -8,6 +8,7 @@ #include "test/test_bitcoin.h" #include "utilstrencodings.h" +#include #include #include @@ -96,9 +97,9 @@ BOOST_AUTO_TEST_CASE(boost_optional) } } -BOOST_AUTO_TEST_CASE(boost_arrays) +BOOST_AUTO_TEST_CASE(arrays) { - boost::array test_case = {string("zub"), string("baz")}; + std::array test_case = {string("zub"), string("baz")}; CDataStream ss(SER_DISK, 0); ss << test_case; @@ -119,12 +120,12 @@ BOOST_AUTO_TEST_CASE(boost_arrays) BOOST_CHECK(hash == hash2); } - boost::array decoded_test_case; + std::array decoded_test_case; ss >> decoded_test_case; BOOST_CHECK(decoded_test_case == test_case); - boost::array test = {100, 200}; + std::array test = {100, 200}; BOOST_CHECK_EQUAL(GetSerializeSize(test, 0, 0), 8); } diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index 6ca651981..12abaaa47 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -22,6 +22,7 @@ #include "sodium.h" +#include #include #include @@ -360,11 +361,11 @@ BOOST_AUTO_TEST_CASE(test_basic_joinsplit_verification) // create JSDescription uint256 pubKeyHash; - boost::array inputs = { + std::array inputs = { libzcash::JSInput(witness, note, k), libzcash::JSInput() // dummy input of zero value }; - boost::array outputs = { + std::array outputs = { libzcash::JSOutput(addr, 50), libzcash::JSOutput(addr, 50) }; diff --git a/src/utiltest.cpp b/src/utiltest.cpp index dbc92bca9..017cd84cd 100644 --- a/src/utiltest.cpp +++ b/src/utiltest.cpp @@ -6,6 +6,8 @@ #include "consensus/upgrades.h" +#include + CWalletTx GetValidReceive(ZCJoinSplit& params, const libzcash::SproutSpendingKey& sk, CAmount value, bool randomInputs) { @@ -28,12 +30,12 @@ CWalletTx GetValidReceive(ZCJoinSplit& params, crypto_sign_keypair(joinSplitPubKey.begin(), joinSplitPrivKey); mtx.joinSplitPubKey = joinSplitPubKey; - boost::array inputs = { + std::array inputs = { libzcash::JSInput(), // dummy input libzcash::JSInput() // dummy input }; - boost::array outputs = { + std::array outputs = { libzcash::JSOutput(sk.address(), value), libzcash::JSOutput(sk.address(), value) }; @@ -111,12 +113,12 @@ CWalletTx GetValidSpend(ZCJoinSplit& params, tree.append(note.cm()); - boost::array inputs = { + std::array inputs = { libzcash::JSInput(tree.witness(), note, sk), dummyin }; - boost::array outputs = { + std::array outputs = { dummyout, // dummy output libzcash::JSOutput() // dummy output }; diff --git a/src/wallet/asyncrpcoperation_mergetoaddress.cpp b/src/wallet/asyncrpcoperation_mergetoaddress.cpp index a29527e29..80afff196 100644 --- a/src/wallet/asyncrpcoperation_mergetoaddress.cpp +++ b/src/wallet/asyncrpcoperation_mergetoaddress.cpp @@ -760,10 +760,10 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit( FormatMoney(info.vjsout[0].value), FormatMoney(info.vjsout[1].value)); // Generate the proof, this can take over a minute. - boost::array inputs{info.vjsin[0], info.vjsin[1]}; - boost::array outputs{info.vjsout[0], info.vjsout[1]}; - boost::array inputMap; - boost::array outputMap; + std::array inputs{info.vjsin[0], info.vjsin[1]}; + std::array outputs{info.vjsout[0], info.vjsout[1]}; + std::array inputMap; + std::array outputMap; uint256 esk; // payment disclosure - secret @@ -874,9 +874,9 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit( return obj; } -boost::array AsyncRPCOperation_mergetoaddress::get_memo_from_hex_string(std::string s) +std::array AsyncRPCOperation_mergetoaddress::get_memo_from_hex_string(std::string s) { - boost::array memo = {{0x00}}; + std::array memo = {{0x00}}; std::vector rawMemo = ParseHex(s.c_str()); diff --git a/src/wallet/asyncrpcoperation_mergetoaddress.h b/src/wallet/asyncrpcoperation_mergetoaddress.h index 541a9541a..0bbd5f82d 100644 --- a/src/wallet/asyncrpcoperation_mergetoaddress.h +++ b/src/wallet/asyncrpcoperation_mergetoaddress.h @@ -13,6 +13,7 @@ #include "zcash/Address.hpp" #include "zcash/JoinSplit.hpp" +#include #include #include @@ -99,7 +100,7 @@ private: CTransaction tx_; - boost::array get_memo_from_hex_string(std::string s); + std::array get_memo_from_hex_string(std::string s); bool main_impl(); // JoinSplit without any input notes to spend @@ -149,7 +150,7 @@ public: // Delegated methods - boost::array get_memo_from_hex_string(std::string s) + std::array get_memo_from_hex_string(std::string s) { return delegate->get_memo_from_hex_string(s); } diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index b62e64469..38be63830 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -25,6 +25,7 @@ #include "sodium.h" #include "miner.h" +#include #include #include #include @@ -980,12 +981,12 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit( ); // Generate the proof, this can take over a minute. - boost::array inputs + std::array inputs {info.vjsin[0], info.vjsin[1]}; - boost::array outputs + std::array outputs {info.vjsout[0], info.vjsout[1]}; - boost::array inputMap; - boost::array outputMap; + std::array inputMap; + std::array outputMap; uint256 esk; // payment disclosure - secret @@ -1141,8 +1142,8 @@ void AsyncRPCOperation_sendmany::add_taddr_change_output_to_tx(CAmount amount) { tx_ = CTransaction(rawTx); } -boost::array AsyncRPCOperation_sendmany::get_memo_from_hex_string(std::string s) { - boost::array memo = {{0x00}}; +std::array AsyncRPCOperation_sendmany::get_memo_from_hex_string(std::string s) { + std::array memo = {{0x00}}; std::vector rawMemo = ParseHex(s.c_str()); diff --git a/src/wallet/asyncrpcoperation_sendmany.h b/src/wallet/asyncrpcoperation_sendmany.h index e1151962a..24f174574 100644 --- a/src/wallet/asyncrpcoperation_sendmany.h +++ b/src/wallet/asyncrpcoperation_sendmany.h @@ -13,6 +13,7 @@ #include "wallet.h" #include "paymentdisclosure.h" +#include #include #include @@ -99,7 +100,7 @@ private: void add_taddr_outputs_to_tx(); bool find_unspent_notes(); bool find_utxos(bool fAcceptCoinbase); - boost::array get_memo_from_hex_string(std::string s); + std::array get_memo_from_hex_string(std::string s); bool main_impl(); // JoinSplit without any input notes to spend @@ -154,7 +155,7 @@ public: return delegate->find_utxos(fAcceptCoinbase); } - boost::array get_memo_from_hex_string(std::string s) { + std::array get_memo_from_hex_string(std::string s) { return delegate->get_memo_from_hex_string(s); } diff --git a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp index 51e3a581c..0ed4f789d 100644 --- a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp +++ b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp @@ -24,6 +24,7 @@ #include "sodium.h" #include "miner.h" +#include #include #include #include @@ -349,12 +350,12 @@ UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInf ); // Generate the proof, this can take over a minute. - boost::array inputs + std::array inputs {info.vjsin[0], info.vjsin[1]}; - boost::array outputs + std::array outputs {info.vjsout[0], info.vjsout[1]}; - boost::array inputMap; - boost::array outputMap; + std::array inputMap; + std::array outputMap; uint256 esk; // payment disclosure - secret diff --git a/src/zcash/IncrementalMerkleTree.hpp b/src/zcash/IncrementalMerkleTree.hpp index fc476cd29..912e9fff0 100644 --- a/src/zcash/IncrementalMerkleTree.hpp +++ b/src/zcash/IncrementalMerkleTree.hpp @@ -1,6 +1,7 @@ #ifndef ZC_INCREMENTALMERKLETREE_H_ #define ZC_INCREMENTALMERKLETREE_H_ +#include #include #include #include @@ -69,7 +70,7 @@ public: friend bool operator==(const EmptyMerkleRoots& a, const EmptyMerkleRoots& b); private: - boost::array empty_roots; + std::array empty_roots; }; template diff --git a/src/zcash/JoinSplit.cpp b/src/zcash/JoinSplit.cpp index ef92d3967..13e666263 100644 --- a/src/zcash/JoinSplit.cpp +++ b/src/zcash/JoinSplit.cpp @@ -106,9 +106,9 @@ public: ProofVerifier& verifier, const uint256& pubKeyHash, const uint256& randomSeed, - const boost::array& macs, - const boost::array& nullifiers, - const boost::array& commitments, + const std::array& macs, + const std::array& nullifiers, + const std::array& commitments, uint64_t vpub_old, uint64_t vpub_new, const uint256& rt @@ -141,16 +141,16 @@ public: SproutProof prove( bool makeGrothProof, - const boost::array& inputs, - const boost::array& outputs, - boost::array& out_notes, - boost::array& out_ciphertexts, + const std::array& inputs, + const std::array& outputs, + std::array& out_notes, + std::array& out_ciphertexts, uint256& out_ephemeralKey, const uint256& pubKeyHash, uint256& out_randomSeed, - boost::array& out_macs, - boost::array& out_nullifiers, - boost::array& out_commitments, + std::array& out_macs, + std::array& out_nullifiers, + std::array& out_commitments, uint64_t vpub_old, uint64_t vpub_new, const uint256& rt, @@ -388,7 +388,7 @@ JoinSplit* JoinSplit::Prepared(con template uint256 JoinSplit::h_sig( const uint256& randomSeed, - const boost::array& nullifiers, + const std::array& nullifiers, const uint256& pubKeyHash ) { const unsigned char personalization[crypto_generichash_blake2b_PERSONALBYTES] diff --git a/src/zcash/JoinSplit.hpp b/src/zcash/JoinSplit.hpp index 7b095a6e9..07db55bb2 100644 --- a/src/zcash/JoinSplit.hpp +++ b/src/zcash/JoinSplit.hpp @@ -11,7 +11,7 @@ #include "uint256.h" #include "uint252.h" -#include +#include namespace libzcash { @@ -20,7 +20,7 @@ static constexpr size_t GROTH_PROOF_SIZE = ( 96 + // π_B 48); // π_C -typedef boost::array GrothProof; +typedef std::array GrothProof; typedef boost::variant SproutProof; class JSInput { @@ -43,7 +43,7 @@ class JSOutput { public: SproutPaymentAddress addr; uint64_t value; - boost::array memo = {{0xF6}}; // 0xF6 is invalid UTF8 as per spec, rest of array is 0x00 + std::array memo = {{0xF6}}; // 0xF6 is invalid UTF8 as per spec, rest of array is 0x00 JSOutput(); JSOutput(SproutPaymentAddress addr, uint64_t value) : addr(addr), value(value) { } @@ -63,22 +63,22 @@ public: const std::string pkPath); static uint256 h_sig(const uint256& randomSeed, - const boost::array& nullifiers, + const std::array& nullifiers, const uint256& pubKeyHash ); virtual SproutProof prove( bool makeGrothProof, - const boost::array& inputs, - const boost::array& outputs, - boost::array& out_notes, - boost::array& out_ciphertexts, + const std::array& inputs, + const std::array& outputs, + std::array& out_notes, + std::array& out_ciphertexts, uint256& out_ephemeralKey, const uint256& pubKeyHash, uint256& out_randomSeed, - boost::array& out_hmacs, - boost::array& out_nullifiers, - boost::array& out_commitments, + std::array& out_hmacs, + std::array& out_nullifiers, + std::array& out_commitments, uint64_t vpub_old, uint64_t vpub_new, const uint256& rt, @@ -94,9 +94,9 @@ public: ProofVerifier& verifier, const uint256& pubKeyHash, const uint256& randomSeed, - const boost::array& hmacs, - const boost::array& nullifiers, - const boost::array& commitments, + const std::array& hmacs, + const std::array& nullifiers, + const std::array& commitments, uint64_t vpub_old, uint64_t vpub_new, const uint256& rt diff --git a/src/zcash/Note.cpp b/src/zcash/Note.cpp index 3315a7c45..0addf4c18 100644 --- a/src/zcash/Note.cpp +++ b/src/zcash/Note.cpp @@ -40,7 +40,7 @@ uint256 SproutNote::nullifier(const SproutSpendingKey& a_sk) const { SproutNotePlaintext::SproutNotePlaintext( const SproutNote& note, - boost::array memo) : BaseNotePlaintext(note, memo) + std::array memo) : BaseNotePlaintext(note, memo) { rho = note.rho; r = note.r; diff --git a/src/zcash/Note.hpp b/src/zcash/Note.hpp index 4ffe24a5d..59327b2d6 100644 --- a/src/zcash/Note.hpp +++ b/src/zcash/Note.hpp @@ -6,6 +6,8 @@ #include "Address.hpp" #include "NoteEncryption.hpp" +#include + namespace libzcash { class BaseNote { @@ -41,15 +43,15 @@ public: class BaseNotePlaintext { protected: uint64_t value_ = 0; - boost::array memo_; + std::array memo_; public: BaseNotePlaintext() {} - BaseNotePlaintext(const BaseNote& note, boost::array memo) + BaseNotePlaintext(const BaseNote& note, std::array memo) : value_(note.value()), memo_(memo) {} virtual ~BaseNotePlaintext() {} inline uint64_t value() const { return value_; } - inline const boost::array & memo() const { return memo_; } + inline const std::array & memo() const { return memo_; } }; class SproutNotePlaintext : public BaseNotePlaintext { @@ -59,7 +61,7 @@ public: SproutNotePlaintext() {} - SproutNotePlaintext(const SproutNote& note, boost::array memo); + SproutNotePlaintext(const SproutNote& note, std::array memo); SproutNote note(const SproutPaymentAddress& addr) const; diff --git a/src/zcash/NoteEncryption.hpp b/src/zcash/NoteEncryption.hpp index 321d7dead..86de8f44b 100644 --- a/src/zcash/NoteEncryption.hpp +++ b/src/zcash/NoteEncryption.hpp @@ -6,12 +6,13 @@ https://github.com/zcash/zips/blob/master/protocol/protocol.pdf #ifndef ZC_NOTE_ENCRYPTION_H_ #define ZC_NOTE_ENCRYPTION_H_ -#include #include "uint256.h" #include "uint252.h" #include "zcash/Zcash.h" +#include + namespace libzcash { #define NOTEENCRYPTION_AUTH_BYTES 16 @@ -26,8 +27,8 @@ protected: uint256 hSig; public: - typedef boost::array Ciphertext; - typedef boost::array Plaintext; + typedef std::array Ciphertext; + typedef std::array Plaintext; NoteEncryption(uint256 hSig); @@ -63,8 +64,8 @@ protected: uint256 pk_enc; public: - typedef boost::array Ciphertext; - typedef boost::array Plaintext; + typedef std::array Ciphertext; + typedef std::array Plaintext; NoteDecryption() { } NoteDecryption(uint256 sk_enc); @@ -100,8 +101,8 @@ class PaymentDisclosureNoteDecryption : public NoteDecryption { protected: public: enum { CLEN=MLEN+NOTEENCRYPTION_AUTH_BYTES }; - typedef boost::array Ciphertext; - typedef boost::array Plaintext; + typedef std::array Ciphertext; + typedef std::array Plaintext; PaymentDisclosureNoteDecryption() : NoteDecryption() {} PaymentDisclosureNoteDecryption(uint256 sk_enc) : NoteDecryption(sk_enc) {} diff --git a/src/zcash/circuit/gadget.tcc b/src/zcash/circuit/gadget.tcc index 6d057459f..0a2ec7719 100644 --- a/src/zcash/circuit/gadget.tcc +++ b/src/zcash/circuit/gadget.tcc @@ -14,9 +14,9 @@ private: std::shared_ptr> zk_merkle_root; std::shared_ptr> zk_h_sig; - boost::array>, NumInputs> zk_input_nullifiers; - boost::array>, NumInputs> zk_input_macs; - boost::array>, NumOutputs> zk_output_commitments; + std::array>, NumInputs> zk_input_nullifiers; + std::array>, NumInputs> zk_input_macs; + std::array>, NumOutputs> zk_output_commitments; pb_variable_array zk_vpub_old; pb_variable_array zk_vpub_new; @@ -26,11 +26,11 @@ private: pb_variable_array zk_total_uint64; // Input note gadgets - boost::array>, NumInputs> zk_input_notes; - boost::array>, NumInputs> zk_mac_authentication; + std::array>, NumInputs> zk_input_notes; + std::array>, NumInputs> zk_mac_authentication; // Output note gadgets - boost::array>, NumOutputs> zk_output_notes; + std::array>, NumOutputs> zk_output_notes; public: // PRF_pk only has a 1-bit domain separation "nonce" @@ -190,8 +190,8 @@ public: const uint252& phi, const uint256& rt, const uint256& h_sig, - const boost::array& inputs, - const boost::array& outputs, + const std::array& inputs, + const std::array& outputs, uint64_t vpub_old, uint64_t vpub_new ) { @@ -280,9 +280,9 @@ public: static r1cs_primary_input witness_map( const uint256& rt, const uint256& h_sig, - const boost::array& macs, - const boost::array& nullifiers, - const boost::array& commitments, + const std::array& macs, + const std::array& nullifiers, + const std::array& commitments, uint64_t vpub_old, uint64_t vpub_new ) {