fix(contracts): index reissued certificates and mark originals as sup… - #901
Conversation
…erseded - Add new certificate to IssuerCertIds and OwnerCertIds indexes - Mark original certificate status as Revoked with reason 'Superseded' - Emit CertificateRevokedEvent for original certificate - Update test_reissue_certificate to verify all three requirements Fixes: reissue_certificate does not index the new certificate and leaves the old one active The fix ensures: 1. Reissued certificates are discoverable via get_certificates_by_issuer/owner 2. Original certificates are marked as revoked (not simultaneously active) 3. Proper audit trail with revocation events for both old and new certs
|
@OmniZlatoon Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Good day sir @feyishola , please kindly review the PR |
|
(index reissued certs) The approach is right, but it doesn't compile: new_cert is built with owner: new_owner.unwrap_or(original_cert.owner), which partially moves original_cert, so the later let mut updated_original = original_cert; is a use-of-moved-value (E0382). Fix: clone the field — new_owner.unwrap_or(original_cert.owner.clone()) — or restructure so original_cert isn't moved first. Please run cargo build && cargo test before pushing (it can't currently pass). |
|
Good day sir @feyishola , please kindly review the PR |
3 similar comments
|
Good day sir @feyishola , please kindly review the PR |
|
Good day sir @feyishola , please kindly review the PR |
|
Good day sir @feyishola , please kindly review the PR |
feyishola
left a comment
There was a problem hiding this comment.
Approved — thanks for contributing! 🎉
Description
This PR fixes the reissue flow in the Stellar certificate contract by avoiding the ownership move error introduced when creating the replacement certificate and by ensuring the emitted
CertificateReissuedEventincludes the requiredold_idfield. The change preserves the original certificate state while correctly creating the new reissued certificate and linking it back to its parent certificate.Type of Change
Files Modified
stellar-contracts/src/lib.rsstellar-contracts/src/types.rsTesting
Code Quality checks
cargo build✅cargo test✅Behavioural Changes
new_owner.unwrap_or(original_cert.owner)by cloning the original owner when no replacement owner is supplied.old_id, matching the event type definition and making the parent-child relationship explicit.Closes #802