aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-06-29 18:18:18 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:28:55 +0100
commit20e50ec7f7f4104b5eb177aa30df4f5d4db9c8c3 (patch)
tree1f18f1130c9c553b7b103d035e6d829ec182011e /tests
parentAdd rct core tests (diff)
downloadmonero-20e50ec7f7f4104b5eb177aa30df4f5d4db9c8c3.tar.xz
ringct: do not serialize what can be reconstructed
The mixRing (output keys and commitments) and II fields (key images) can be reconstructed from vin data. This saves some modest amount of space in the tx.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/ringct.cpp4
-rw-r--r--tests/unit_tests/serialization.cpp30
2 files changed, 13 insertions, 21 deletions
diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp
index ac1644c7b..47da05f49 100644
--- a/tests/unit_tests/ringct.cpp
+++ b/tests/unit_tests/ringct.cpp
@@ -131,7 +131,7 @@ TEST(ringct, MG_sigs)
}
key message = identity();
mgSig IIccss = MLSAG_Gen(message, P, sk, ind);
- ASSERT_TRUE(MLSAG_Ver(message, P, IIccss));
+ ASSERT_TRUE(MLSAG_Ver(message, P, IIccss, IIccss.II));
//#MG sig: false one
N = 3;// #cols
@@ -152,7 +152,7 @@ TEST(ringct, MG_sigs)
}
sk[2] = skGen();//asume we don't know one of the private keys..
IIccss = MLSAG_Gen(message, P, sk, ind);
- ASSERT_FALSE(MLSAG_Ver(message, P, IIccss));
+ ASSERT_FALSE(MLSAG_Ver(message, P, IIccss, IIccss.II));
}
TEST(ringct, range_proofs)
diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp
index 55a33c83f..5223298cd 100644
--- a/tests/unit_tests/serialization.cpp
+++ b/tests/unit_tests/serialization.cpp
@@ -576,11 +576,10 @@ TEST(Serialization, serializes_ringct_types)
ASSERT_TRUE(mg0.ss[n] == mg1.ss[n]);
}
ASSERT_TRUE(mg0.cc == mg1.cc);
- ASSERT_TRUE(mg0.II.size() == mg1.II.size());
- for (size_t n = 0; n < mg0.II.size(); ++n)
- {
- ASSERT_TRUE(mg0.II[n] == mg1.II[n]);
- }
+
+ // mixRing and II are not serialized, they are meant to be reconstructed
+ ASSERT_TRUE(mg1.II.size() == 1);
+ ASSERT_TRUE(mg1.II[0] == mg0.II.back());
rg0 = s0.rangeSigs.front();
ASSERT_TRUE(serialization::dump_binary(rg0, blob));
@@ -600,20 +599,13 @@ TEST(Serialization, serializes_ringct_types)
ASSERT_TRUE(s0.MG.ss[n] == s1.MG.ss[n]);
}
ASSERT_TRUE(s0.MG.cc == s1.MG.cc);
- ASSERT_TRUE(s0.MG.II.size() == s1.MG.II.size());
- for (size_t n = 0; n < s0.MG.II.size(); ++n)
- {
- ASSERT_TRUE(s0.MG.II[n] == s1.MG.II[n]);
- }
- ASSERT_TRUE(s0.mixRing.size() == s1.mixRing.size());
- for (size_t n = 0; n < s0.mixRing.size(); ++n)
- {
- ASSERT_TRUE(s0.mixRing[n].size() == s1.mixRing[n].size());
- for (size_t i = 0; i < s0.mixRing[n].size(); ++i)
- {
- ASSERT_TRUE(!memcmp(&s0.mixRing[n][i], &s1.mixRing[n][i], sizeof(s0.mixRing[n][i])));
- }
- }
+ // mixRing and II are not serialized, they are meant to be reconstructed
+ ASSERT_TRUE(s1.MG.II.size() == 1);
+ ASSERT_TRUE(s1.MG.II[0] == s0.MG.II.back());
+
+ // mixRing and II are not serialized, they are meant to be reconstructed
+ ASSERT_TRUE(s1.mixRing.size() == 0);
+
ASSERT_TRUE(s0.ecdhInfo.size() == s1.ecdhInfo.size());
for (size_t n = 0; n < s0.ecdhInfo.size(); ++n)
{