aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/serialization.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_tests/serialization.cpp')
-rw-r--r--tests/unit_tests/serialization.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp
index e730f6867..7b8a291d0 100644
--- a/tests/unit_tests/serialization.cpp
+++ b/tests/unit_tests/serialization.cpp
@@ -477,6 +477,7 @@ TEST(Serialization, serializes_ringct_types)
rct::ecdhTuple ecdh0, ecdh1;
rct::boroSig boro0, boro1;
rct::mgSig mg0, mg1;
+ rct::clsag clsag0, clsag1;
rct::Bulletproof bp0, bp1;
rct::rctSig s0, s1;
cryptonote::transaction tx0, tx1;
@@ -592,9 +593,11 @@ TEST(Serialization, serializes_ringct_types)
rct::skpkGen(Sk, Pk);
destinations.push_back(Pk);
//compute rct data with mixin 3
- const rct::RCTConfig rct_config{ rct::RangeProofPaddedBulletproof, 0 };
+ const rct::RCTConfig rct_config{ rct::RangeProofPaddedBulletproof, 2 };
s0 = rct::genRctSimple(rct::zero(), sc, pc, destinations, inamounts, amounts, amount_keys, NULL, NULL, 0, 3, rct_config, hw::get_device("default"));
+ ASSERT_FALSE(s0.p.MGs.empty());
+ ASSERT_TRUE(s0.p.CLSAGs.empty());
mg0 = s0.p.MGs[0];
ASSERT_TRUE(serialization::dump_binary(mg0, blob));
ASSERT_TRUE(serialization::parse_binary(blob, mg1));
@@ -614,6 +617,23 @@ TEST(Serialization, serializes_ringct_types)
ASSERT_TRUE(serialization::parse_binary(blob, bp1));
bp1.V = bp0.V; // this is not saved, as it is reconstructed from other tx data
ASSERT_EQ(bp0, bp1);
+
+ const rct::RCTConfig rct_config_clsag{ rct::RangeProofPaddedBulletproof, 3 };
+ s0 = rct::genRctSimple(rct::zero(), sc, pc, destinations, inamounts, amounts, amount_keys, NULL, NULL, 0, 3, rct_config_clsag, hw::get_device("default"));
+
+ ASSERT_FALSE(s0.p.CLSAGs.empty());
+ ASSERT_TRUE(s0.p.MGs.empty());
+ clsag0 = s0.p.CLSAGs[0];
+ ASSERT_TRUE(serialization::dump_binary(clsag0, blob));
+ ASSERT_TRUE(serialization::parse_binary(blob, clsag1));
+ ASSERT_TRUE(clsag0.s.size() == clsag1.s.size());
+ for (size_t n = 0; n < clsag0.s.size(); ++n)
+ {
+ ASSERT_TRUE(clsag0.s[n] == clsag1.s[n]);
+ }
+ ASSERT_TRUE(clsag0.c1 == clsag1.c1);
+ // I is not serialized, they are meant to be reconstructed
+ ASSERT_TRUE(clsag0.D == clsag1.D);
}
TEST(Serialization, portability_wallet)