mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
performance_tests: add aggregated bulletproof tx verification
This commit is contained in:
parent
263431c486
commit
d126a02b5d
2 changed files with 81 additions and 0 deletions
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue