aboutsummaryrefslogtreecommitdiff
path: root/src/serialization
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-12-08 23:30:51 +0200
committerRiccardo Spagni <ric@spagni.net>2017-12-08 23:30:51 +0200
commit782a84f7b490baa10afef94dd6954d6ab50d020b (patch)
tree099cf5e07386236924d312606a2e4569658a1fb8 /src/serialization
parentMerge pull request #2845 (diff)
parentadd bulletproofs from v7 on testnet (diff)
downloadmonero-782a84f7b490baa10afef94dd6954d6ab50d020b.tar.xz
Merge pull request #2883
c83d0b3e add bulletproofs from v7 on testnet (moneromooo-monero) 8620ef0a bulletproofs: switch H/G in Pedersen commitments to match rct (moneromooo-monero) d58835b2 integrate bulletproofs into monero (moneromooo-monero) 90b8d9f2 add bulletproofs to the build, with basic unit tests (moneromooo-monero) fe120264 perf_timer: add non scoped start/stop timer defines (moneromooo-monero) ada42914 add a version of ge_double_scalarmult_precomp_vartime with A precomp (moneromooo-monero) d43eef6d ringct: add a version of addKeys which returns the result (moneromooo-monero) 7ff07928 sc_mul and sc_muladd (luigi1111) 3d0b54bd epee: add do while(0) around brace statement in a macro (moneromooo-monero)
Diffstat (limited to 'src/serialization')
-rw-r--r--src/serialization/json_object.cpp41
-rw-r--r--src/serialization/json_object.h3
2 files changed, 44 insertions, 0 deletions
diff --git a/src/serialization/json_object.cpp b/src/serialization/json_object.cpp
index 6e6e51528..2c86d4054 100644
--- a/src/serialization/json_object.cpp
+++ b/src/serialization/json_object.cpp
@@ -1007,6 +1007,7 @@ void toJsonValue(rapidjson::Document& doc, const rct::rctSigPrunable& sig, rapid
val.SetObject();
INSERT_INTO_JSON_OBJECT(val, doc, rangeSigs, sig.rangeSigs);
+ INSERT_INTO_JSON_OBJECT(val, doc, bulletproofs, sig.bulletproofs);
INSERT_INTO_JSON_OBJECT(val, doc, MGs, sig.MGs);
}
@@ -1018,6 +1019,7 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSigPrunable& sig)
}
GET_FROM_JSON_OBJECT(val, sig.rangeSigs, rangeSigs);
+ GET_FROM_JSON_OBJECT(val, sig.bulletproofs, bulletproofs);
GET_FROM_JSON_OBJECT(val, sig.MGs, MGs);
}
@@ -1052,6 +1054,45 @@ void fromJsonValue(const rapidjson::Value& val, rct::rangeSig& sig)
}
}
+void toJsonValue(rapidjson::Document& doc, const rct::Bulletproof& p, rapidjson::Value& val)
+{
+ val.SetObject();
+
+ INSERT_INTO_JSON_OBJECT(val, doc, V, p.V);
+ INSERT_INTO_JSON_OBJECT(val, doc, A, p.A);
+ INSERT_INTO_JSON_OBJECT(val, doc, S, p.S);
+ INSERT_INTO_JSON_OBJECT(val, doc, T1, p.T1);
+ INSERT_INTO_JSON_OBJECT(val, doc, T2, p.T2);
+ INSERT_INTO_JSON_OBJECT(val, doc, taux, p.taux);
+ INSERT_INTO_JSON_OBJECT(val, doc, mu, p.mu);
+ INSERT_INTO_JSON_OBJECT(val, doc, L, p.L);
+ INSERT_INTO_JSON_OBJECT(val, doc, R, p.R);
+ INSERT_INTO_JSON_OBJECT(val, doc, a, p.a);
+ INSERT_INTO_JSON_OBJECT(val, doc, b, p.b);
+ INSERT_INTO_JSON_OBJECT(val, doc, t, p.t);
+}
+
+void fromJsonValue(const rapidjson::Value& val, rct::Bulletproof& p)
+{
+ if (!val.IsObject())
+ {
+ throw WRONG_TYPE("json object");
+ }
+
+ GET_FROM_JSON_OBJECT(val, p.V, V);
+ GET_FROM_JSON_OBJECT(val, p.A, A);
+ GET_FROM_JSON_OBJECT(val, p.S, S);
+ GET_FROM_JSON_OBJECT(val, p.T1, T1);
+ GET_FROM_JSON_OBJECT(val, p.T2, T2);
+ GET_FROM_JSON_OBJECT(val, p.taux, taux);
+ GET_FROM_JSON_OBJECT(val, p.mu, mu);
+ GET_FROM_JSON_OBJECT(val, p.L, L);
+ GET_FROM_JSON_OBJECT(val, p.R, R);
+ GET_FROM_JSON_OBJECT(val, p.a, a);
+ GET_FROM_JSON_OBJECT(val, p.b, b);
+ GET_FROM_JSON_OBJECT(val, p.t, t);
+}
+
void toJsonValue(rapidjson::Document& doc, const rct::boroSig& sig, rapidjson::Value& val)
{
val.SetObject();
diff --git a/src/serialization/json_object.h b/src/serialization/json_object.h
index 7b9519c48..5dca7b249 100644
--- a/src/serialization/json_object.h
+++ b/src/serialization/json_object.h
@@ -274,6 +274,9 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSigPrunable& sig);
void toJsonValue(rapidjson::Document& doc, const rct::rangeSig& sig, rapidjson::Value& val);
void fromJsonValue(const rapidjson::Value& val, rct::rangeSig& sig);
+void toJsonValue(rapidjson::Document& doc, const rct::Bulletproof& p, rapidjson::Value& val);
+void fromJsonValue(const rapidjson::Value& val, rct::Bulletproof& p);
+
void toJsonValue(rapidjson::Document& doc, const rct::boroSig& sig, rapidjson::Value& val);
void fromJsonValue(const rapidjson::Value& val, rct::boroSig& sig);