From f931e16c6e45da6880c333cf1f355d7228c143d9 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 6 Jan 2019 13:47:16 +0000 Subject: add a bulletproof version, new bulletproof type, and rct config This makes it easier to modify the bulletproof format --- src/cryptonote_basic/cryptonote_boost_serialization.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/cryptonote_basic/cryptonote_boost_serialization.h') diff --git a/src/cryptonote_basic/cryptonote_boost_serialization.h b/src/cryptonote_basic/cryptonote_boost_serialization.h index 0725a2bb8..e3d0ec18f 100644 --- a/src/cryptonote_basic/cryptonote_boost_serialization.h +++ b/src/cryptonote_basic/cryptonote_boost_serialization.h @@ -295,7 +295,7 @@ namespace boost a & x.type; if (x.type == rct::RCTTypeNull) return; - if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof) + if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof && x.type != rct::RCTTypeBulletproof2) throw boost::archive::archive_exception(boost::archive::archive_exception::other_exception, "Unsupported rct type"); // a & x.message; message is not serialized, as it can be reconstructed from the tx data // a & x.mixRing; mixRing is not serialized, as it can be reconstructed from the offsets @@ -323,7 +323,7 @@ namespace boost a & x.type; if (x.type == rct::RCTTypeNull) return; - if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof) + if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof && x.type != rct::RCTTypeBulletproof2) throw boost::archive::archive_exception(boost::archive::archive_exception::other_exception, "Unsupported rct type"); // a & x.message; message is not serialized, as it can be reconstructed from the tx data // a & x.mixRing; mixRing is not serialized, as it can be reconstructed from the offsets @@ -337,7 +337,7 @@ namespace boost if (x.p.rangeSigs.empty()) a & x.p.bulletproofs; a & x.p.MGs; - if (x.type == rct::RCTTypeBulletproof) + if (x.type == rct::RCTTypeBulletproof || x.type == rct::RCTTypeBulletproof2) a & x.p.pseudoOuts; } } -- cgit v1.2.3 From 99d946e6191056f747225d36a2408085624b516e Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 6 Jan 2019 19:49:52 +0000 Subject: ringct: encode 8 byte amount, saving 24 bytes per output Found by knaccc --- src/cryptonote_basic/cryptonote_boost_serialization.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/cryptonote_basic/cryptonote_boost_serialization.h') diff --git a/src/cryptonote_basic/cryptonote_boost_serialization.h b/src/cryptonote_basic/cryptonote_boost_serialization.h index e3d0ec18f..6f26d8756 100644 --- a/src/cryptonote_basic/cryptonote_boost_serialization.h +++ b/src/cryptonote_basic/cryptonote_boost_serialization.h @@ -45,6 +45,8 @@ #include "ringct/rctTypes.h" #include "ringct/rctOps.h" +BOOST_CLASS_VERSION(rct::ecdhTuple, 1) + //namespace cryptonote { namespace boost { @@ -248,7 +250,15 @@ namespace boost inline void serialize(Archive &a, rct::ecdhTuple &x, const boost::serialization::version_type ver) { a & x.mask; - a & x.amount; + if (ver < 1) + { + a & x.amount; + return; + } + crypto::hash8 &amount = (crypto::hash8&)x.amount; + if (!Archive::is_saving::value) + memset(&x.amount, 0, sizeof(x.amount)); + a & amount; // a & x.senderPk; // not serialized, as we do not use it in monero currently } -- cgit v1.2.3 From 7d375981584e5ddac4ea6ad8879e2211d465b79d Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 8 Jan 2019 16:05:18 +0000 Subject: ringct: the commitment mask is now deterministic saves space in the tx and is safe Found by knaccc --- src/cryptonote_basic/cryptonote_boost_serialization.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cryptonote_basic/cryptonote_boost_serialization.h') diff --git a/src/cryptonote_basic/cryptonote_boost_serialization.h b/src/cryptonote_basic/cryptonote_boost_serialization.h index 6f26d8756..8a527b898 100644 --- a/src/cryptonote_basic/cryptonote_boost_serialization.h +++ b/src/cryptonote_basic/cryptonote_boost_serialization.h @@ -249,15 +249,18 @@ namespace boost template inline void serialize(Archive &a, rct::ecdhTuple &x, const boost::serialization::version_type ver) { - a & x.mask; if (ver < 1) { + a & x.mask; a & x.amount; return; } crypto::hash8 &amount = (crypto::hash8&)x.amount; if (!Archive::is_saving::value) + { + memset(&x.mask, 0, sizeof(x.mask)); memset(&x.amount, 0, sizeof(x.amount)); + } a & amount; // a & x.senderPk; // not serialized, as we do not use it in monero currently } -- cgit v1.2.3 From b6534c40e641c957ed4869acf5f58df2be97dcac Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 8 Jan 2019 23:27:42 +0000 Subject: ringct: remove unused senderPk from ecdhTuple This was an early ringct field, which was never used in production --- src/cryptonote_basic/cryptonote_boost_serialization.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/cryptonote_basic/cryptonote_boost_serialization.h') diff --git a/src/cryptonote_basic/cryptonote_boost_serialization.h b/src/cryptonote_basic/cryptonote_boost_serialization.h index 8a527b898..a4228b849 100644 --- a/src/cryptonote_basic/cryptonote_boost_serialization.h +++ b/src/cryptonote_basic/cryptonote_boost_serialization.h @@ -262,7 +262,6 @@ namespace boost memset(&x.amount, 0, sizeof(x.amount)); } a & amount; - // a & x.senderPk; // not serialized, as we do not use it in monero currently } template -- cgit v1.2.3