Browse Source

Generate JS for trydecryptnotes, make number of addresses a variable

pull/4/head
Jack Grigg 8 years ago
parent
commit
88b7f3c28b
No known key found for this signature in database GPG Key ID: 6A6914DAFBEA00DA
  1. 8
      qa/zcash/performance-measurements.sh
  2. 6
      src/wallet/rpcwallet.cpp
  3. 11
      src/zcbenchmarks.cpp
  4. 2
      src/zcbenchmarks.h

8
qa/zcash/performance-measurements.sh

@ -56,7 +56,7 @@ function zcashd_valgrind_stop {
case "$1" in
*)
case "$2" in
verifyjoinsplit|trydecryptnotes)
verifyjoinsplit)
zcashd_start
RAWJOINSPLIT=$(zcash_rpc zcsamplejoinsplit)
zcashd_stop
@ -89,7 +89,7 @@ case "$1" in
zcash_rpc zcbenchmark validatelargetx 5
;;
trydecryptnotes)
zcash_rpc zcbenchmark trydecryptnotes 1000 "\"$RAWJOINSPLIT\""
zcash_rpc zcbenchmark trydecryptnotes 1000 "${@:3}"
;;
incnotewitnesses)
zcash_rpc zcbenchmark incnotewitnesses 100 "${@:3}"
@ -123,7 +123,7 @@ case "$1" in
zcash_rpc zcbenchmark verifyequihash 1
;;
trydecryptnotes)
zcash_rpc zcbenchmark trydecryptnotes 1 "\"$RAWJOINSPLIT\""
zcash_rpc zcbenchmark trydecryptnotes 1 "${@:3}"
;;
incnotewitnesses)
zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}"
@ -158,7 +158,7 @@ case "$1" in
zcash_rpc zcbenchmark verifyequihash 1
;;
trydecryptnotes)
zcash_rpc zcbenchmark trydecryptnotes 1 "\"$RAWJOINSPLIT\""
zcash_rpc zcbenchmark trydecryptnotes 1 "${@:3}"
;;
incnotewitnesses)
zcash_rpc zcbenchmark incnotewitnesses 1 "${@:3}"

6
src/wallet/rpcwallet.cpp

@ -2454,8 +2454,7 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp)
JSDescription samplejoinsplit;
if (benchmarktype == "verifyjoinsplit" ||
benchmarktype == "trydecryptnotes") {
if (benchmarktype == "verifyjoinsplit") {
CDataStream ss(ParseHexV(params[2].get_str(), "js"), SER_NETWORK, PROTOCOL_VERSION);
ss >> samplejoinsplit;
}
@ -2482,7 +2481,8 @@ Value zc_benchmark(const json_spirit::Array& params, bool fHelp)
} else if (benchmarktype == "validatelargetx") {
sample_times.push_back(benchmark_large_tx());
} else if (benchmarktype == "trydecryptnotes") {
sample_times.push_back(benchmark_try_decrypt_notes(samplejoinsplit));
int nAddrs = params[2].get_int();
sample_times.push_back(benchmark_try_decrypt_notes(nAddrs));
} else if (benchmarktype == "incnotewitnesses") {
int nTxs = params[2].get_int();
sample_times.push_back(benchmark_increment_note_witnesses(nTxs));

11
src/zcbenchmarks.cpp

@ -224,19 +224,16 @@ double benchmark_large_tx()
return timer_stop(tv_start);
}
double benchmark_try_decrypt_notes(const JSDescription &joinsplit)
double benchmark_try_decrypt_notes(size_t nAddrs)
{
const size_t NUM_ADDRS = 10;
CWallet wallet;
for (int i = 0; i < NUM_ADDRS; i++) {
for (int i = 0; i < nAddrs; i++) {
auto sk = libzcash::SpendingKey::random();
wallet.AddSpendingKey(sk);
}
CMutableTransaction mtx;
mtx.vjoinsplit.push_back(joinsplit);
CTransaction tx(mtx);
auto sk = libzcash::SpendingKey::random();
auto tx = GetValidReceive(*pzcashParams, sk, 10, true);
struct timeval tv_start;
timer_start(tv_start);

2
src/zcbenchmarks.h

@ -12,7 +12,7 @@ extern std::vector<double> benchmark_solve_equihash_threaded(int nThreads);
extern double benchmark_verify_joinsplit(const JSDescription &joinsplit);
extern double benchmark_verify_equihash();
extern double benchmark_large_tx();
extern double benchmark_try_decrypt_notes(const JSDescription &joinsplit);
extern double benchmark_try_decrypt_notes(size_t nAddrs);
extern double benchmark_increment_note_witnesses(size_t nTxs);
#endif

Loading…
Cancel
Save