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