aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-05-28 12:54:11 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-11 13:37:46 +0000
commitd126a02b5de6989d045f92cedf0408e251648f87 (patch)
tree7b37a519bb67dd33a1c88d2a838aa8b3979d288e /tests
parentPippenger multiexp (diff)
downloadmonero-d126a02b5de6989d045f92cedf0408e251648f87.tar.xz
performance_tests: add aggregated bulletproof tx verification
Diffstat (limited to 'tests')
-rw-r--r--tests/performance_tests/check_tx_signature.h71
-rw-r--r--tests/performance_tests/main.cpp10
2 files changed, 81 insertions, 0 deletions
diff --git a/tests/performance_tests/check_tx_signature.h b/tests/performance_tests/check_tx_signature.h
index 79132ccee..bcd3b3dfe 100644
--- a/tests/performance_tests/check_tx_signature.h
+++ b/tests/performance_tests/check_tx_signature.h
@@ -101,3 +101,74 @@ private:
cryptonote::transaction m_tx;
crypto::hash m_tx_prefix_hash;
};
+
+template<size_t a_ring_size, size_t a_outputs, size_t a_num_txes, size_t extra_outs = 0>
+class test_check_tx_signature_aggregated_bulletproofs : private multi_tx_test_base<a_ring_size>
+{
+ static_assert(0 < a_ring_size, "ring_size must be greater than 0");
+
+public:
+ static const size_t loop_count = a_ring_size <= 2 ? 50 : 10;
+ static const size_t ring_size = a_ring_size;
+ static const size_t outputs = a_outputs;
+
+ typedef multi_tx_test_base<a_ring_size> base_class;
+
+ bool init()
+ {
+ using namespace cryptonote;
+
+ if (!base_class::init())
+ return false;
+
+ m_alice.generate();
+
+ std::vector<tx_destination_entry> destinations;
+ destinations.push_back(tx_destination_entry(this->m_source_amount - outputs + 1, m_alice.get_keys().m_account_address, false));
+ for (size_t n = 1; n < outputs; ++n)
+ destinations.push_back(tx_destination_entry(1, m_alice.get_keys().m_account_address, false));
+
+ crypto::secret_key tx_key;
+ std::vector<crypto::secret_key> additional_tx_keys;
+ std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
+ subaddresses[this->m_miners[this->real_source_idx].get_keys().m_account_address.m_spend_public_key] = {0,0};
+
+ m_txes.resize(a_num_txes + (extra_outs > 0 ? 1 : 0));
+ for (size_t n = 0; n < a_num_txes; ++n)
+ {
+ if (!construct_tx_and_get_tx_key(this->m_miners[this->real_source_idx].get_keys(), subaddresses, this->m_sources, destinations, cryptonote::account_public_address{}, std::vector<uint8_t>(), m_txes[n], 0, tx_key, additional_tx_keys, true, rct::RangeProofMultiOutputBulletproof))
+ return false;
+ }
+
+ if (extra_outs)
+ {
+ destinations.clear();
+ destinations.push_back(tx_destination_entry(this->m_source_amount - extra_outs + 1, m_alice.get_keys().m_account_address, false));
+ for (size_t n = 1; n < extra_outs; ++n)
+ destinations.push_back(tx_destination_entry(1, m_alice.get_keys().m_account_address, false));
+
+ if (!construct_tx_and_get_tx_key(this->m_miners[this->real_source_idx].get_keys(), subaddresses, this->m_sources, destinations, cryptonote::account_public_address{}, std::vector<uint8_t>(), m_txes.back(), 0, tx_key, additional_tx_keys, true, rct::RangeProofMultiOutputBulletproof))
+ return false;
+ }
+
+ return true;
+ }
+
+ bool test()
+ {
+ std::vector<const rct::rctSig*> rvv;
+ rvv.reserve(m_txes.size());
+ for (size_t n = 0; n < m_txes.size(); ++n)
+ {
+ const rct::rctSig &rv = m_txes[n].rct_signatures;
+ if (!rct::verRctNonSemanticsSimple(rv))
+ return false;
+ rvv.push_back(&rv);
+ }
+ return rct::verRctSemanticsSimple(rvv);
+ }
+
+private:
+ cryptonote::account_base m_alice;
+ std::vector<cryptonote::transaction> m_txes;
+};
diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp
index c3e1bb4e0..abcc2a3d0 100644
--- a/tests/performance_tests/main.cpp
+++ b/tests/performance_tests/main.cpp
@@ -141,6 +141,16 @@ int main(int argc, char** argv)
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 100, 2, true, true);
TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature, 2, 10, true, true);
+ TEST_PERFORMANCE3(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 2, 2, 64);
+ TEST_PERFORMANCE3(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 10, 2, 64);
+ TEST_PERFORMANCE3(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 100, 2, 64);
+ TEST_PERFORMANCE3(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 2, 10, 64);
+
+ TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 2, 2, 62, 4);
+ TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 10, 2, 62, 4);
+ TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 2, 2, 56, 16);
+ TEST_PERFORMANCE4(filter, verbose, test_check_tx_signature_aggregated_bulletproofs, 10, 2, 56, 16);
+
TEST_PERFORMANCE0(filter, verbose, test_is_out_to_acc);
TEST_PERFORMANCE0(filter, verbose, test_is_out_to_acc_precomp);
TEST_PERFORMANCE0(filter, verbose, test_generate_key_image_helper);