unify payment proof storage

This commit is contained in:
wiesche
2026-09-09 22:16:17 +02:00
parent 106184e7c6
commit 7b6218530a
4 changed files with 15 additions and 18 deletions
+1 -1
View File
@@ -616,7 +616,7 @@ where
sender_address: p.sender_address,
timestamp: p.timestamp.unwrap().timestamp(),
memo: p.memo,
promise_signature: p.promise_signature,
promise_signature: p.receiver_signature,
witness_data: None,
},
p.sender_part_sig.unwrap(),
-1
View File
@@ -47,7 +47,6 @@ without a user confirmation step.
- Expose the kernel feature constants from `grin_core` and reuse them here.
- Move payment-proof handling onto `Slate` so it can be used outside contracts and
versioned with the slate format
- Unify legacy and early payment-proof storage
- Add compact Slatepack support for contracts
- Keep Slate V5 experimental until the related RFCs are accepted
- Add contract history, lookup and transport.
+7 -8
View File
@@ -126,21 +126,20 @@ where
};
tx_log_entry.payment_proof = Some(StoredProofInfo {
receiver_address: p.receiver_address,
receiver_signature: p.promise_signature,
sender_address: sender_address.to_ed25519()?,
sender_address_path,
sender_signature: None,
// Filled as separate steps for now; could be merged into a general case
// once we know which nonces here belong to the recipient.
proof_type: Some(p.proof_type.as_u8()),
receiver_public_nonce: Some(recipient.public_nonce),
receiver_public_excess: Some(recipient.public_blind_excess),
timestamp: Some(timestamp),
memo: p.memo.clone(),
promise_signature: p.promise_signature,
sender_part_sig: sender.part_sig,
sender_public_nonce,
..StoredProofInfo::new(
p.receiver_address,
p.promise_signature,
sender_address.to_ed25519()?,
sender_address_path,
None,
)
});
}
}
+7 -8
View File
@@ -779,14 +779,14 @@ pub struct StoredProofInfo {
#[serde(with = "dalek_ser::dalek_pubkey_serde")]
pub receiver_address: DalekPublicKey,
#[serde(with = "dalek_ser::option_dalek_sig_serde")]
/// receiver signature
/// Receiver signature for legacy proofs, or promise signature for early proofs
pub receiver_signature: Option<DalekSignature>,
/// sender address derivation path index
pub sender_address_path: u32,
/// sender address
#[serde(with = "dalek_ser::dalek_pubkey_serde")]
pub sender_address: DalekPublicKey,
/// sender signature
/// Legacy sender signature
#[serde(with = "dalek_ser::option_dalek_sig_serde")]
pub sender_signature: Option<DalekSignature>,
// Fields beyond here are specific to early payment proofs
@@ -800,10 +800,7 @@ pub struct StoredProofInfo {
pub timestamp: Option<DateTime<Utc>>,
/// Optional payment memo
pub memo: Option<PaymentMemo>,
/// recipient promise signature
#[serde(default, with = "dalek_ser::option_dalek_sig_serde")]
pub promise_signature: Option<DalekSignature>,
/// Original Sender partial key
/// Early-proof sender partial signature
pub sender_part_sig: Option<Signature>,
/// Untweaked sender public nonce for a sender-nonce proof
pub sender_public_nonce: Option<PublicKey>,
@@ -828,7 +825,6 @@ impl StoredProofInfo {
receiver_public_excess: None,
timestamp: None,
memo: None,
promise_signature: None,
sender_part_sig: None,
sender_public_nonce: None,
}
@@ -1103,7 +1099,10 @@ mod tests {
});
let proof: StoredProofInfo = serde_json::from_value(proof).unwrap();
assert!(proof.promise_signature.is_none());
assert!(proof.receiver_signature.is_none());
let proof = serde_json::to_value(proof).unwrap();
assert!(proof.get("receiver_signature").is_some());
assert!(proof.get("promise_signature").is_none());
}
#[test]