diff options
author | Lee Clagett <code@leeclagett.com> | 2021-01-24 07:42:57 +0000 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2021-01-23 06:23:39 +0000 |
commit | 08e4497c6e3b3f434c0bb255c3942648f153fe66 (patch) | |
tree | 2564f4214e9e66b2dc03ce3c788bb080b963be56 /tests/fuzz | |
parent | Merge pull request #7669 (diff) | |
download | monero-08e4497c6e3b3f434c0bb255c3942648f153fe66.tar.xz |
Improve cryptonote (block and tx) binary read performance
Diffstat (limited to 'tests/fuzz')
-rw-r--r-- | tests/fuzz/bulletproof.cpp | 4 | ||||
-rw-r--r-- | tests/fuzz/cold-outputs.cpp | 5 | ||||
-rw-r--r-- | tests/fuzz/cold-transaction.cpp | 5 |
3 files changed, 3 insertions, 11 deletions
diff --git a/tests/fuzz/bulletproof.cpp b/tests/fuzz/bulletproof.cpp index e0f183bc5..06416fe34 100644 --- a/tests/fuzz/bulletproof.cpp +++ b/tests/fuzz/bulletproof.cpp @@ -37,9 +37,7 @@ BEGIN_INIT_SIMPLE_FUZZER() END_INIT_SIMPLE_FUZZER() BEGIN_SIMPLE_FUZZER() - std::stringstream ss; - ss << std::string((const char*)buf, len); - binary_archive<false> ba(ss); + binary_archive<false> ba{{buf, len}}; rct::Bulletproof proof = AUTO_VAL_INIT(proof); ::serialization::serialize(ba, proof); END_SIMPLE_FUZZER() diff --git a/tests/fuzz/cold-outputs.cpp b/tests/fuzz/cold-outputs.cpp index bd298eb71..69eb7b61f 100644 --- a/tests/fuzz/cold-outputs.cpp +++ b/tests/fuzz/cold-outputs.cpp @@ -50,11 +50,8 @@ BEGIN_INIT_SIMPLE_FUZZER() END_INIT_SIMPLE_FUZZER() BEGIN_SIMPLE_FUZZER() - std::string s((const char*)buf, len); std::pair<uint64_t, std::vector<tools::wallet2::transfer_details>> outputs; - std::stringstream iss; - iss << s; - binary_archive<false> ar(iss); + binary_archive<false> ar{{buf, len}}; ::serialization::serialize(ar, outputs); size_t n_outputs = wallet->import_outputs(outputs); std::cout << boost::lexical_cast<std::string>(n_outputs) << " outputs imported" << std::endl; diff --git a/tests/fuzz/cold-transaction.cpp b/tests/fuzz/cold-transaction.cpp index 135343704..bf5fba1f7 100644 --- a/tests/fuzz/cold-transaction.cpp +++ b/tests/fuzz/cold-transaction.cpp @@ -50,11 +50,8 @@ BEGIN_INIT_SIMPLE_FUZZER() END_INIT_SIMPLE_FUZZER() BEGIN_SIMPLE_FUZZER() - std::string s((const char*)buf, len); tools::wallet2::unsigned_tx_set exported_txs; - std::stringstream iss; - iss << s; - binary_archive<false> ar(iss); + binary_archive<false> ar{{buf, len}}; ::serialization::serialize(ar, exported_txs); std::vector<tools::wallet2::pending_tx> ptx; bool success = wallet->sign_tx(exported_txs, "/tmp/cold-transaction-test-signed", ptx); |