aboutsummaryrefslogtreecommitdiff
path: root/tests/performance_tests
diff options
context:
space:
mode:
authorSarang Noether <32460187+SarangNoether@users.noreply.github.com>2020-04-21 00:19:13 -0400
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-08-27 12:44:04 +0000
commitf964a92c57d53e6ae38e664a178c9b7f56dcfd4a (patch)
tree8f194aeb8d614079313d78d06a6ed5d229c890d2 /tests/performance_tests
parentCLSAG verification performance test (diff)
downloadmonero-f964a92c57d53e6ae38e664a178c9b7f56dcfd4a.tar.xz
Updated MLSAG and CLSAG tests for consistency
Diffstat (limited to 'tests/performance_tests')
-rw-r--r--tests/performance_tests/main.cpp14
-rw-r--r--tests/performance_tests/sig_clsag.h7
-rw-r--r--tests/performance_tests/sig_mlsag.h73
3 files changed, 63 insertions, 31 deletions
diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp
index dcd10703c..675a8c19f 100644
--- a/tests/performance_tests/main.cpp
+++ b/tests/performance_tests/main.cpp
@@ -215,8 +215,18 @@ int main(int argc, char** argv)
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 32);
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 16384);
- TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 11, true); // MLSAG verification
- TEST_PERFORMANCE2(filter, p, test_sig_clsag, 11, 1); // CLSAG verification (with commitment offset)
+ TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 8, 1); // MLSAG verification
+ TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 16, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 32, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 64, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 128, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_mlsag, 256, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_clsag, 8, 1); // CLSAG verification
+ TEST_PERFORMANCE2(filter, p, test_sig_clsag, 16, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_clsag, 32, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_clsag, 64, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_clsag, 128, 1);
+ TEST_PERFORMANCE2(filter, p, test_sig_clsag, 256, 1);
TEST_PERFORMANCE2(filter, p, test_ringct_mlsag, 11, false);
TEST_PERFORMANCE2(filter, p, test_ringct_mlsag, 11, true);
diff --git a/tests/performance_tests/sig_clsag.h b/tests/performance_tests/sig_clsag.h
index 255eac63b..c15668adb 100644
--- a/tests/performance_tests/sig_clsag.h
+++ b/tests/performance_tests/sig_clsag.h
@@ -51,8 +51,9 @@ public:
if (!single_tx_test_base::init())
return false;
- message = identity();
+ message = skGen();
+ // Random signing/commitment keys
pubs.reserve(N);
for (size_t i = 0; i < N; i++)
{
@@ -65,18 +66,22 @@ public:
pubs.push_back(tmp);
}
+ // Signing key
key p;
skpkGen(p,pubs[l].dest);
+ // Commitment key
key t,u;
t = skGen();
u = skGen();
addKeys2(pubs[l].mask,t,u,H);
+ // Offset
key t2;
t2 = skGen();
addKeys2(C_offset,t2,u,H);
+ // Final signing keys
ctkey insk;
insk.dest = p;
insk.mask = t;
diff --git a/tests/performance_tests/sig_mlsag.h b/tests/performance_tests/sig_mlsag.h
index fc987fcf5..c9745b504 100644
--- a/tests/performance_tests/sig_mlsag.h
+++ b/tests/performance_tests/sig_mlsag.h
@@ -32,56 +32,73 @@
#include "ringct/rctSigs.h"
#include "cryptonote_basic/cryptonote_basic.h"
+#include "device/device.hpp"
#include "single_tx_test_base.h"
-template<size_t ring_size, bool ver>
+using namespace rct;
+
+template<size_t ring_size, size_t index>
class test_sig_mlsag : public single_tx_test_base
{
public:
- static const size_t cols = ring_size;
- static const size_t rows = 2; // 1 spend + 1 commitment
+ static const size_t N = ring_size;
static const size_t loop_count = 1000;
+ static const size_t l = index;
bool init()
{
if (!single_tx_test_base::init())
return false;
- rct::keyV xtmp = rct::skvGen(rows);
- rct::keyM xm = rct::keyMInit(rows, cols);// = [[None]*N] #just used to generate test public keys
- sk = rct::skvGen(rows);
- P = rct::keyMInit(rows, cols);// = keyM[[None]*N] #stores the public keys;
- ind = 0; // fixed spend index
- for (size_t j = 0 ; j < rows ; j++)
- {
- for (size_t i = 0 ; i < cols ; i++)
- {
- xm[i][j] = rct::skGen();
- P[i][j] = rct::scalarmultBase(xm[i][j]);
- }
- }
- for (size_t j = 0 ; j < rows ; j++)
+ message = skGen();
+
+ // Random signing/commitment keys
+ pubs.reserve(N);
+ for (size_t i = 0; i < N; i++)
{
- sk[j] = xm[ind][j];
+ key sk;
+ ctkey tmp;
+
+ skpkGen(sk, tmp.dest);
+ skpkGen(sk, tmp.mask);
+
+ pubs.push_back(tmp);
}
- IIccss = MLSAG_Gen(rct::identity(), P, sk, NULL, NULL, ind, rows-1, hw::get_device("default"));
+
+ // Signing key
+ key p;
+ skpkGen(p,pubs[l].dest);
+
+ // Commitment key
+ key t,u;
+ t = skGen();
+ u = skGen();
+ addKeys2(pubs[l].mask,t,u,H);
+
+ // Offset
+ key t2;
+ t2 = skGen();
+ addKeys2(C_offset,t2,u,H);
+
+ // Final signing keys
+ ctkey insk;
+ insk.dest = p;
+ insk.mask = t;
+
+ sig = proveRctMGSimple(message,pubs,insk,t2,C_offset,NULL,NULL,l,hw::get_device("default"));
return true;
}
bool test()
{
- if (ver)
- return MLSAG_Ver(rct::identity(), P, IIccss, rows-1);
- else
- MLSAG_Gen(rct::identity(), P, sk, NULL, NULL, ind, rows-1, hw::get_device("default"));
- return true;
+ return verRctMGSimple(message,sig,pubs,C_offset);
}
private:
- rct::keyV sk;
- rct::keyM P;
- size_t ind;
- rct::mgSig IIccss;
+ ctkeyV pubs;
+ key C_offset;
+ mgSig sig;
+ key message;
};