updated to support v0.7.0

This commit is contained in:
Some Random Crypto Guy
2024-12-18 10:37:46 +00:00
parent 953a41a15c
commit de9c89f3c2

View File

@@ -87,6 +87,18 @@ namespace rct {
typedef std::vector<key> keyV; //vector of keys typedef std::vector<key> keyV; //vector of keys
typedef std::vector<keyV> keyM; //matrix of keys (indexed by column first) typedef std::vector<keyV> keyM; //matrix of keys (indexed by column first)
struct zk_proof {
key R; // Commitment
key z1; // Response
key z2; // Response
BEGIN_SERIALIZE_OBJECT()
FIELD(R)
FIELD(z1)
FIELD(z2)
END_SERIALIZE()
};
//containers For CT operations //containers For CT operations
//if it's representing a private ctkey then "dest" contains the secret key of the address //if it's representing a private ctkey then "dest" contains the secret key of the address
// while "mask" contains a where C = aG + bH is CT pedersen commitment and b is the amount // while "mask" contains a where C = aG + bH is CT pedersen commitment and b is the amount
@@ -293,6 +305,7 @@ namespace rct {
RCTTypeBulletproof2 = 4, RCTTypeBulletproof2 = 4,
RCTTypeCLSAG = 5, RCTTypeCLSAG = 5,
RCTTypeBulletproofPlus = 6, RCTTypeBulletproofPlus = 6,
RCTTypeFullProofs = 7
}; };
enum RangeProofType { RangeProofBorromean, RangeProofBulletproof, RangeProofMultiOutputBulletproof, RangeProofPaddedBulletproof }; enum RangeProofType { RangeProofBorromean, RangeProofBulletproof, RangeProofMultiOutputBulletproof, RangeProofPaddedBulletproof };
struct RCTConfig { struct RCTConfig {
@@ -315,9 +328,11 @@ namespace rct {
ctkeyV outPk; ctkeyV outPk;
xmr_amount txnFee = 0; // contains b xmr_amount txnFee = 0; // contains b
key p_r; key p_r;
zk_proof pr_proof; // p_r
zk_proof sa_proof; // spend authority proof
rctSigBase() : rctSigBase() :
type(RCTTypeNull), message{}, mixRing{}, pseudoOuts{}, ecdhInfo{}, outPk{}, txnFee(0), p_r{} type(RCTTypeNull), message{}, mixRing{}, pseudoOuts{}, ecdhInfo{}, outPk{}, txnFee(0), p_r{}, pr_proof{}, sa_proof{}
{} {}
template<bool W, template <bool> class Archive> template<bool W, template <bool> class Archive>
@@ -326,7 +341,7 @@ namespace rct {
FIELD(type) FIELD(type)
if (type == RCTTypeNull) if (type == RCTTypeNull)
return ar.stream().good(); return ar.stream().good();
if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeCLSAG && type != RCTTypeBulletproofPlus) if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeCLSAG && type != RCTTypeBulletproofPlus && type != RCTTypeFullProofs)
return false; return false;
VARINT_FIELD(txnFee) VARINT_FIELD(txnFee)
// inputs/outputs not saved, only here for serialization help // inputs/outputs not saved, only here for serialization help
@@ -339,7 +354,7 @@ namespace rct {
return false; return false;
for (size_t i = 0; i < outputs; ++i) for (size_t i = 0; i < outputs; ++i)
{ {
if (type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus) if (type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus || type == RCTTypeFullProofs)
{ {
// Since RCTTypeBulletproof2 enote types, we don't serialize the blinding factor, and only serialize the // Since RCTTypeBulletproof2 enote types, we don't serialize the blinding factor, and only serialize the
// first 8 bytes of ecdhInfo[i].amount // first 8 bytes of ecdhInfo[i].amount
@@ -373,6 +388,11 @@ namespace rct {
ar.end_array(); ar.end_array();
FIELD(p_r) FIELD(p_r)
if (type == RCTTypeFullProofs)
{
FIELD(pr_proof)
FIELD(sa_proof)
}
return ar.stream().good(); return ar.stream().good();
} }
@@ -385,6 +405,10 @@ namespace rct {
FIELD(outPk) FIELD(outPk)
VARINT_FIELD(txnFee) VARINT_FIELD(txnFee)
FIELD(p_r) FIELD(p_r)
if (type == RCTTypeFullProofs) {
FIELD(pr_proof)
FIELD(sa_proof)
}
END_SERIALIZE() END_SERIALIZE()
}; };
struct rctSigPrunable { struct rctSigPrunable {
@@ -407,9 +431,9 @@ namespace rct {
return false; return false;
if (type == RCTTypeNull) if (type == RCTTypeNull)
return ar.stream().good(); return ar.stream().good();
if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeCLSAG && type != RCTTypeBulletproofPlus) if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeCLSAG && type != RCTTypeBulletproofPlus && type != RCTTypeFullProofs)
return false; return false;
if (type == RCTTypeBulletproofPlus) if (type == RCTTypeBulletproofPlus || type == RCTTypeFullProofs)
{ {
uint32_t nbp = bulletproofs_plus.size(); uint32_t nbp = bulletproofs_plus.size();
VARINT_FIELD(nbp) VARINT_FIELD(nbp)
@@ -466,7 +490,7 @@ namespace rct {
ar.end_array(); ar.end_array();
} }
if (type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus) if (type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus || type == RCTTypeFullProofs)
{ {
ar.tag("CLSAGs"); ar.tag("CLSAGs");
ar.begin_array(); ar.begin_array();
@@ -557,7 +581,7 @@ namespace rct {
} }
ar.end_array(); ar.end_array();
} }
if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus) if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus || type == RCTTypeFullProofs)
{ {
ar.tag("pseudoOuts"); ar.tag("pseudoOuts");
ar.begin_array(); ar.begin_array();
@@ -589,12 +613,12 @@ namespace rct {
keyV& get_pseudo_outs() keyV& get_pseudo_outs()
{ {
return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts; return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus || type == RCTTypeFullProofs ? p.pseudoOuts : pseudoOuts;
} }
keyV const& get_pseudo_outs() const keyV const& get_pseudo_outs() const
{ {
return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts; return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus || type == RCTTypeFullProofs ? p.pseudoOuts : pseudoOuts;
} }
BEGIN_SERIALIZE_OBJECT() BEGIN_SERIALIZE_OBJECT()
@@ -765,5 +789,6 @@ VARIANT_TAG(binary_archive, rct::multisig_kLRki, 0x9d);
VARIANT_TAG(binary_archive, rct::multisig_out, 0x9e); VARIANT_TAG(binary_archive, rct::multisig_out, 0x9e);
VARIANT_TAG(binary_archive, rct::clsag, 0x9f); VARIANT_TAG(binary_archive, rct::clsag, 0x9f);
VARIANT_TAG(binary_archive, rct::BulletproofPlus, 0xa0); VARIANT_TAG(binary_archive, rct::BulletproofPlus, 0xa0);
VARIANT_TAG(binary_archive, rct::zk_proof, 0xa1);
#endif /* RCTTYPES_H */ #endif /* RCTTYPES_H */